1 | dnl $Id$ |
---|
2 | |
---|
3 | dnl |
---|
4 | dnl RTEMS_TOP($1) |
---|
5 | dnl |
---|
6 | dnl $1 .. relative path from this configure.in to the toplevel configure.in |
---|
7 | dnl |
---|
8 | AC_DEFUN(RTEMS_TOP, |
---|
9 | [dnl |
---|
10 | AC_CHECK_PROGS(MAKE, gmake make) |
---|
11 | AC_BEFORE([$0], [AC_CONFIG_AUX_DIR])dnl |
---|
12 | AC_BEFORE([$0], [AM_INIT_AUTOMAKE])dnl |
---|
13 | |
---|
14 | AC_PREFIX_DEFAULT([/opt/rtems]) |
---|
15 | |
---|
16 | ## HACK to allow gnu-make conditionals in automake-Makefiles. |
---|
17 | ENDIF=endif |
---|
18 | AC_SUBST(ENDIF) |
---|
19 | |
---|
20 | RTEMS_TOPdir="$1"; |
---|
21 | AC_SUBST(RTEMS_TOPdir) |
---|
22 | |
---|
23 | ## with_target_subdirs is handled implicitly by autoconf |
---|
24 | test -n "$with_target_subdir" || with_target_subdir="." |
---|
25 | |
---|
26 | if test "$with_target_subdir" = "." ; then |
---|
27 | # Native |
---|
28 | PROJECT_TOPdir=${RTEMS_TOPdir}/'$(top_builddir)' |
---|
29 | else |
---|
30 | # Cross |
---|
31 | dots=`echo $with_target_subdir|\ |
---|
32 | sed -e 's%^\./%%' -e 's%[[^/]]$%&/%' -e 's%[[^/]]*/%../%g'` |
---|
33 | PROJECT_TOPdir=${dots}${RTEMS_TOPdir}/'$(top_builddir)' |
---|
34 | fi |
---|
35 | AC_SUBST(PROJECT_TOPdir) |
---|
36 | |
---|
37 | if test "$with_target_subdir" = "." ; then |
---|
38 | # Native |
---|
39 | PROJECT_ROOT="${RTEMS_TOPdir}/\$(top_builddir)" |
---|
40 | else |
---|
41 | # Cross |
---|
42 | PROJECT_ROOT="${RTEMS_TOPdir}/\$(top_builddir)" |
---|
43 | fi |
---|
44 | AC_SUBST(PROJECT_ROOT) |
---|
45 | |
---|
46 | dnl Determine RTEMS Version string from the VERSION file |
---|
47 | dnl Hopefully, Joel never changes its format ;- |
---|
48 | AC_MSG_CHECKING([for RTEMS Version]) |
---|
49 | if test -r "${srcdir}/${RTEMS_TOPdir}/VERSION"; then |
---|
50 | RTEMS_VERSION=`grep 'RTEMS Version' ${srcdir}/${RTEMS_TOPdir}/VERSION | \ |
---|
51 | sed -e 's%RTEMS[[ ]]*Version[[ ]]*\(.*\)[[ ]]*%\1%g'` |
---|
52 | else |
---|
53 | AC_MSG_ERROR(Unable to find ${RTEMS_TOPdir}/VERSION) |
---|
54 | fi |
---|
55 | if test -z "$RTEMS_VERSION"; then |
---|
56 | AC_MSG_ERROR(Unable to determine version) |
---|
57 | fi |
---|
58 | AC_MSG_RESULT($RTEMS_VERSION) |
---|
59 | ])dnl |
---|