1 | dnl $Id$ |
---|
2 | |
---|
3 | # AC_DISABLE_OPTION_CHECKING is not available before 2.62 |
---|
4 | AC_PREREQ(2.62) |
---|
5 | |
---|
6 | dnl |
---|
7 | dnl RTEMS_TOP($1) |
---|
8 | dnl |
---|
9 | dnl $1 .. relative path from this configure.ac to the toplevel configure.ac |
---|
10 | dnl |
---|
11 | AC_DEFUN([RTEMS_TOP], |
---|
12 | [dnl |
---|
13 | AC_REQUIRE([RTEMS_VERSIONING]) |
---|
14 | AC_REQUIRE([AM_SET_LEADING_DOT]) |
---|
15 | AC_REQUIRE([AC_DISABLE_OPTION_CHECKING]) |
---|
16 | AC_CONFIG_AUX_DIR([$1]) |
---|
17 | AC_CHECK_PROGS(MAKE, gmake make) |
---|
18 | AC_BEFORE([$0], [AM_INIT_AUTOMAKE])dnl |
---|
19 | |
---|
20 | AC_PREFIX_DEFAULT([/opt/rtems-][_RTEMS_API]) |
---|
21 | |
---|
22 | AC_SUBST([RTEMS_TOPdir],["$1"]) |
---|
23 | |
---|
24 | # HACK: The sed pattern below strips of "../", corresponding to "cpukit/" |
---|
25 | rtems_updir=m4_if([$2],[],[`echo "$1/" | sed 's,^\.\.\/,,'`],[$2/]) |
---|
26 | |
---|
27 | AS_IF([test -n "$with_multisubdir"], |
---|
28 | [MULTIBUILDTOP=`echo "/$with_multisubdir" | sed 's,/[[^\\/]]*,../,g'`]) |
---|
29 | AC_SUBST(MULTIBUILDTOP) |
---|
30 | |
---|
31 | AS_IF([test -n "$with_multisubdir"], |
---|
32 | [MULTISUBDIR="/$with_multisubdir"]) |
---|
33 | AC_SUBST(MULTISUBDIR) |
---|
34 | |
---|
35 | AC_ARG_WITH([project-root],[ |
---|
36 | AS_HELP_STRING(--with-project-root,directory to pre-install files into)],[ |
---|
37 | ## Make sure to have a terminating '/' |
---|
38 | case "${with_project_root}" in |
---|
39 | */) ;; |
---|
40 | *) with_project_root="${with_project_root}/" ;; |
---|
41 | esac |
---|
42 | |
---|
43 | case "${with_project_root}" in |
---|
44 | [[\\/$]]* | ?:[[\\/]]* ) # absolute directory |
---|
45 | PROJECT_ROOT=${with_project_root} |
---|
46 | ;; |
---|
47 | *) # relative directory |
---|
48 | sav0dir=`pwd` && cd ./${rtems_updir} |
---|
49 | sav1dir=`pwd` && cd ../${MULTIBUILDTOP} |
---|
50 | sav2dir=`pwd` && cd "$sav0dir" |
---|
51 | mydir=`echo "$sav1dir" | sed "s,^$sav2dir${MULTISUBDIR}/,,"` |
---|
52 | PROJECT_ROOT='$(top_builddir)'/${rtems_updir}'../$(MULTIBUILDTOP)'${mydir}/${with_project_root} |
---|
53 | ;; |
---|
54 | esac],[ |
---|
55 | ## Defaults: Note: Two different defaults! |
---|
56 | ## ../ for multilib |
---|
57 | ## '.' for non-multilib |
---|
58 | AS_IF([test "$enable_multilib" = "yes"],[ |
---|
59 | PROJECT_ROOT='$(top_builddir)'/${rtems_updir}'../$(MULTIBUILDTOP)'],[ |
---|
60 | PROJECT_ROOT='$(top_builddir)'/${rtems_updir}]) |
---|
61 | ]) |
---|
62 | |
---|
63 | AC_SUBST([PROJECT_INCLUDE],["${PROJECT_ROOT}lib/include"]) |
---|
64 | AC_SUBST([PROJECT_LIB],["${PROJECT_ROOT}lib\$(MULTISUBDIR)"]) |
---|
65 | |
---|
66 | libdir="${libdir}\$(MULTISUBDIR)" |
---|
67 | |
---|
68 | AC_SUBST([project_libdir],["\$(libdir)"]) |
---|
69 | AC_SUBST([project_includedir],["\$(includedir)"]) |
---|
70 | |
---|
71 | AC_SUBST([dirstamp],[\${am__leading_dot}dirstamp]) |
---|
72 | ])dnl |
---|