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 | ## HACK to allow gnu-make conditionals in automake-Makefiles. |
---|
15 | ENDIF=endif |
---|
16 | AC_SUBST(ENDIF) |
---|
17 | |
---|
18 | RTEMS_TOPdir="$1"; |
---|
19 | AC_SUBST(RTEMS_TOPdir) |
---|
20 | |
---|
21 | ## with_target_subdirs is handled implicitly by autoconf |
---|
22 | test -n "$with_target_subdir" || with_target_subdir="." |
---|
23 | |
---|
24 | if test "$with_target_subdir" = "." ; then |
---|
25 | # Native |
---|
26 | PROJECT_TOPdir=${RTEMS_TOPdir}/'$(top_builddir)' |
---|
27 | else |
---|
28 | # Cross |
---|
29 | dots=`echo $with_target_subdir|\ |
---|
30 | sed -e 's%^\./%%' -e 's%[[^/]]$%&/%' -e 's%[[^/]]*/%../%g'` |
---|
31 | PROJECT_TOPdir=${dots}${RTEMS_TOPdir}/'$(top_builddir)' |
---|
32 | fi |
---|
33 | AC_SUBST(PROJECT_TOPdir) |
---|
34 | |
---|
35 | if test "$with_target_subdir" = "." ; then |
---|
36 | # Native |
---|
37 | PROJECT_ROOT=${RTEMS_TOPdir}/'$(top_builddir)'; |
---|
38 | else |
---|
39 | # Cross |
---|
40 | PROJECT_ROOT=${RTEMS_TOPdir}/'$(top_builddir)' |
---|
41 | fi |
---|
42 | AC_SUBST(PROJECT_ROOT) |
---|
43 | |
---|
44 | dnl Determine RTEMS Version string from the VERSION file |
---|
45 | dnl Hopefully, Joel never changes its format ;- |
---|
46 | AC_MSG_CHECKING([for RTEMS Version]) |
---|
47 | if test -r "${srcdir}/${RTEMS_TOPdir}/VERSION"; then |
---|
48 | RTEMS_VERSION=`grep 'RTEMS Version' ${srcdir}/${RTEMS_TOPdir}/VERSION | \ |
---|
49 | sed -e 's%RTEMS[[ ]]*Version[[ ]]*\(.*\)[[ ]]*%\1%g'` |
---|
50 | else |
---|
51 | AC_MSG_ERROR(Unable to find ${RTEMS_TOPdir}/VERSION) |
---|
52 | fi |
---|
53 | if test -z "$RTEMS_VERSION"; then |
---|
54 | AC_MSG_ERROR(Unable to determine version) |
---|
55 | fi |
---|
56 | AC_MSG_RESULT($RTEMS_VERSION) |
---|
57 | ])dnl |
---|