1 | # $Id$ |
---|
2 | # |
---|
3 | # Some hacks for handling powerpc-exception subdirectories |
---|
4 | # |
---|
5 | # Note: Consider this file a temporary band-aid until a better, more general |
---|
6 | # subdirectory handling solution is introduced to RTEMS. |
---|
7 | |
---|
8 | AC_DEFUN([RTEMS_CONFIG_SUBDIR], |
---|
9 | [ |
---|
10 | AC_CONFIG_COMMANDS_POST( |
---|
11 | [ |
---|
12 | ac_sub_sourcedir=$2 |
---|
13 | ac_sub_builddir=$1 |
---|
14 | |
---|
15 | if test "$no_recursion" != yes; then |
---|
16 | |
---|
17 | # Remove --cache-file and --srcdir arguments so they do not pile up. |
---|
18 | ac_sub_configure_args= |
---|
19 | ac_prev= |
---|
20 | for ac_arg in $ac_configure_args; do |
---|
21 | if test -n "$ac_prev"; then |
---|
22 | ac_prev= |
---|
23 | continue |
---|
24 | fi |
---|
25 | case $ac_arg in |
---|
26 | -cache-file | --cache-file | --cache-fil | --cache-fi \ |
---|
27 | | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) |
---|
28 | ac_prev=cache_file ;; |
---|
29 | -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ |
---|
30 | | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ |
---|
31 | | --c=*) |
---|
32 | ;; |
---|
33 | --config-cache | -C) |
---|
34 | ;; |
---|
35 | -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) |
---|
36 | ac_prev=srcdir ;; |
---|
37 | -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) |
---|
38 | ;; |
---|
39 | *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;; |
---|
40 | esac |
---|
41 | done |
---|
42 | |
---|
43 | ac_sub_configure_args="$ac_sub_configure_args $3" |
---|
44 | |
---|
45 | for ac_subdir in : $ac_sub_sourcedir; do test "x$ac_subdir" = x: && continue |
---|
46 | |
---|
47 | # Do not complain, so a configure script can configure whichever |
---|
48 | # parts of a large source tree are present. |
---|
49 | test -d $srcdir/$ac_subdir || continue |
---|
50 | |
---|
51 | AC_MSG_NOTICE([configuring in $ac_subdir]) |
---|
52 | case $srcdir in |
---|
53 | .) ;; |
---|
54 | *) AS_MKDIR_P(["./$ac_sub_builddir"]) |
---|
55 | if test -d ./$ac_sub_builddir; then :; |
---|
56 | else |
---|
57 | AC_MSG_ERROR([cannot create `pwd`/$ac_sub_builddir]) |
---|
58 | fi |
---|
59 | ;; |
---|
60 | esac |
---|
61 | |
---|
62 | ac_popdir=`pwd` |
---|
63 | cd $ac_sub_builddir |
---|
64 | |
---|
65 | # A "../" for each directory in /$ac_subdir. |
---|
66 | ac_dots=`echo $ac_sub_builddir | |
---|
67 | sed 's,^\./,,;s,[[^/]]$,&/,;s,[[^/]]*/,../,g'` |
---|
68 | |
---|
69 | echo "*** dots :$ac_dots" |
---|
70 | echo "*** src :$srcdir" |
---|
71 | case $srcdir in |
---|
72 | .) # No --srcdir option. We are building in place. |
---|
73 | ac_sub_srcdir=$srcdir${ac_subdir} ;; |
---|
74 | [[\\/]]* | ?:[[\\/]]* ) # Absolute path. |
---|
75 | ac_sub_srcdir=$srcdir/$ac_subdir ;; |
---|
76 | *) # Relative path. |
---|
77 | ac_sub_srcdir=$ac_dots$srcdir/$ac_subdir ;; |
---|
78 | esac |
---|
79 | |
---|
80 | echo "*** source:$ac_sub_sourcedir" |
---|
81 | echo "*** build :$ac_sub_builddir" |
---|
82 | echo "*** src :$ac_sub_srcdir" |
---|
83 | echo "*** pwd :"`pwd` |
---|
84 | |
---|
85 | # Check for guested configure; otherwise get Cygnus style configure. |
---|
86 | if test -f $ac_sub_srcdir/configure.gnu; then |
---|
87 | ac_sub_configure="$SHELL '$ac_sub_srcdir/configure.gnu'" |
---|
88 | elif test -f $ac_sub_srcdir/configure; then |
---|
89 | ac_sub_configure="$SHELL '$ac_sub_srcdir/configure'" |
---|
90 | elif test -f $ac_sub_srcdir/configure.in; then |
---|
91 | ac_sub_configure=$ac_configure |
---|
92 | else |
---|
93 | AC_MSG_WARN([no configuration information is in $ac_subdir]) |
---|
94 | ac_sub_configure= |
---|
95 | fi |
---|
96 | |
---|
97 | # The recursion is here. |
---|
98 | if test -n "$ac_sub_configure"; then |
---|
99 | # Make the cache file name correct relative to the subdirectory. |
---|
100 | case $cache_file in |
---|
101 | [[\\/]]* | ?:[[\\/]]* ) ac_sub_cache_file=$cache_file ;; |
---|
102 | *) # Relative path. |
---|
103 | ac_sub_cache_file=$ac_dots$cache_file ;; |
---|
104 | esac |
---|
105 | |
---|
106 | AC_MSG_NOTICE([running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir]) |
---|
107 | # The eval makes quoting arguments work. |
---|
108 | eval $ac_sub_configure $ac_sub_configure_args \ |
---|
109 | --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir || |
---|
110 | AC_MSG_ERROR([$ac_sub_configure failed for $ac_subdir]) |
---|
111 | fi |
---|
112 | |
---|
113 | cd $ac_popdir |
---|
114 | done |
---|
115 | fi |
---|
116 | ]) |
---|
117 | ]) |
---|