[aac7fdd2] | 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 | |
---|
[3174a7ed] | 18 | # with_target_subdir |
---|
[aac7fdd2] | 19 | AC_ARG_WITH(target-subdir, |
---|
| 20 | [ --with-target-subdir=DIR], |
---|
[3174a7ed] | 21 | with_target_subdir="$withval", |
---|
| 22 | with_target_subdir=".") |
---|
[aac7fdd2] | 23 | |
---|
| 24 | RTEMS_TOPdir="$1"; |
---|
| 25 | AC_SUBST(RTEMS_TOPdir) |
---|
| 26 | |
---|
[3174a7ed] | 27 | if test "$with_target_subdir" = "." ; then |
---|
| 28 | # Native |
---|
| 29 | PROJECT_TOPdir=${RTEMS_TOPdir}/'$(top_builddir)' |
---|
| 30 | else |
---|
| 31 | # Cross |
---|
| 32 | changequote(, )dnl |
---|
| 33 | dots=`echo $with_target_subdir|\ |
---|
| 34 | sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'` |
---|
| 35 | changequote([, ])dnl |
---|
| 36 | PROJECT_TOPdir=${dots}${RTEMS_TOPdir}/'$(top_builddir)' |
---|
| 37 | fi |
---|
| 38 | AC_SUBST(PROJECT_TOPdir) |
---|
| 39 | |
---|
| 40 | if test "$with_target_subdir" = "." ; then |
---|
| 41 | # Native |
---|
| 42 | PROJECT_ROOT=${RTEMS_TOPdir}/'$(top_builddir)'; |
---|
| 43 | else |
---|
| 44 | # Cross |
---|
| 45 | PROJECT_ROOT=${RTEMS_TOPdir}/'$(top_builddir)' |
---|
| 46 | fi |
---|
| 47 | AC_SUBST(PROJECT_ROOT) |
---|
| 48 | |
---|
[aac7fdd2] | 49 | dnl Determine RTEMS Version string from the VERSION file |
---|
| 50 | dnl Hopefully, Joel never changes its format ;- |
---|
| 51 | AC_MSG_CHECKING([for RTEMS Version]) |
---|
| 52 | if test -r "${srcdir}/${RTEMS_TOPdir}/VERSION"; then |
---|
| 53 | changequote(,)dnl |
---|
| 54 | RTEMS_VERSION=`grep 'RTEMS Version' ${srcdir}/${RTEMS_TOPdir}/VERSION | \ |
---|
| 55 | sed -e 's%RTEMS[ ]*Version[ ]*\(.*\)[ ]*%\1%g'` |
---|
| 56 | changequote([,])dnl |
---|
| 57 | else |
---|
| 58 | AC_MSG_ERROR(Unable to find ${RTEMS_TOPdir}/VERSION) |
---|
| 59 | fi |
---|
| 60 | if test -z "$RTEMS_VERSION"; then |
---|
| 61 | AC_MSG_ERROR(Unable to determine version) |
---|
| 62 | fi |
---|
| 63 | AC_MSG_RESULT($RTEMS_VERSION) |
---|
| 64 | ])dnl |
---|