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