1 | # |
---|
2 | # Some hacks for handling special config subdirectories |
---|
3 | # |
---|
4 | # Note: Consider this file a temporary band-aid until a better, more general |
---|
5 | # subdirectory handling solution is introduced to RTEMS. |
---|
6 | |
---|
7 | AC_DEFUN([_RTEMS_CONFIG_SUBDIR], |
---|
8 | [ |
---|
9 | if test "$no_recursion" != yes; then |
---|
10 | ac_sub_sourcedir=$2 |
---|
11 | ac_sub_builddir=$1 |
---|
12 | |
---|
13 | for ac_subdir in : $ac_sub_sourcedir; do test "x$ac_subdir" = x: && continue |
---|
14 | |
---|
15 | # Do not complain, so a configure script can configure whichever |
---|
16 | # parts of a large source tree are present. |
---|
17 | test -d $srcdir/$ac_subdir || continue |
---|
18 | |
---|
19 | AC_MSG_NOTICE([configuring in $ac_subdir]) |
---|
20 | case $srcdir in |
---|
21 | .) ;; |
---|
22 | *) AS_MKDIR_P(["./$ac_sub_builddir"]) |
---|
23 | if test -d ./$ac_sub_builddir; then :; |
---|
24 | else |
---|
25 | AC_MSG_ERROR([cannot create `pwd`/$ac_sub_builddir]) |
---|
26 | fi |
---|
27 | ;; |
---|
28 | esac |
---|
29 | |
---|
30 | ac_popdir=`pwd` |
---|
31 | cd $ac_sub_builddir |
---|
32 | |
---|
33 | # A "../" for each directory in /$ac_subdir. |
---|
34 | ac_dots=`echo $ac_sub_builddir | |
---|
35 | sed 's,^\./,,;s,[[^/]]$,&/,;s,[[^/]]*/,../,g'` |
---|
36 | |
---|
37 | case $srcdir in |
---|
38 | .) # No --srcdir option. We are building in place. |
---|
39 | ac_sub_srcdir=$srcdir${ac_subdir} ;; |
---|
40 | [[\\/]]* | ?:[[\\/]]* ) # Absolute path. |
---|
41 | ac_sub_srcdir=$srcdir/$ac_subdir ;; |
---|
42 | *) # Relative path. |
---|
43 | ac_sub_srcdir=$ac_dots$srcdir/$ac_subdir ;; |
---|
44 | esac |
---|
45 | |
---|
46 | # Check for guested configure; otherwise get Cygnus style configure. |
---|
47 | if test -f $ac_sub_srcdir/configure.gnu; then |
---|
48 | ac_sub_configure="$SHELL '$ac_sub_srcdir/configure.gnu'" |
---|
49 | elif test -f $ac_sub_srcdir/configure; then |
---|
50 | ac_sub_configure="$SHELL '$ac_sub_srcdir/configure'" |
---|
51 | elif test -f $ac_sub_srcdir/configure.in; then |
---|
52 | ac_sub_configure=$ac_configure |
---|
53 | else |
---|
54 | AC_MSG_WARN([no configuration information is in $ac_subdir]) |
---|
55 | ac_sub_configure= |
---|
56 | fi |
---|
57 | |
---|
58 | # The recursion is here. |
---|
59 | if test -n "$ac_sub_configure"; then |
---|
60 | # Make the cache file name correct relative to the subdirectory. |
---|
61 | case $cache_file in |
---|
62 | [[\\/]]* | ?:[[\\/]]* ) ac_sub_cache_file=$cache_file ;; |
---|
63 | *) # Relative path. |
---|
64 | ac_sub_cache_file=$ac_dots$cache_file ;; |
---|
65 | esac |
---|
66 | |
---|
67 | AC_MSG_NOTICE([running $ac_sub_configure $ac_sub_configure_args $3 --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir]) |
---|
68 | # The eval makes quoting arguments work. |
---|
69 | eval $ac_sub_configure $ac_sub_configure_args $3 \ |
---|
70 | --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir || |
---|
71 | AC_MSG_ERROR([$ac_sub_configure failed for $ac_subdir]) |
---|
72 | fi |
---|
73 | |
---|
74 | cd "$ac_popdir" |
---|
75 | done |
---|
76 | fi |
---|
77 | ]) |
---|
78 | |
---|
79 | ## RTEMS_BSP_CONFIG_SUBDIR(builddir,srcdir,configargs,condition) |
---|
80 | AC_DEFUN([RTEMS_BSP_CONFIG_SUBDIR],[ |
---|
81 | m4_expand_once([RTEMS_CONFIGURE_ARGS_QUOTE([ac_sub_configure_args])]) |
---|
82 | AS_IF([$4],[BSP_SUBDIRS="$BSP_SUBDIRS $1"]) |
---|
83 | AC_CONFIG_COMMANDS_POST([ |
---|
84 | AS_IF([$4],[_RTEMS_CONFIG_SUBDIR([$1],[$2],[$3])])]) |
---|
85 | ]) |
---|