OSDN Git Service

config/
[pf3gnuchains/gcc-fork.git] / config / confsubdir.m4
1 dnl Fix Autoconf-2.59 AC_CONFIG_SUBDIRS whitespace mangling,
2 dnl by overriding the broken internal Autoconf macro with a
3 dnl backport of the 2.60 fix.
4 dnl
5 dnl This file should be a no-op for Autoconf versions != 2.59.
6 dnl It can be removed once the complete tree has moved to a
7 dnl newer Autoconf version.
8
9 dnl m4_PACKAGE_VERSION is an undocumented Autoconf macro.
10 dnl We use it because this fix is intended for 2.59 only.
11 dnl A feature test for the broken AC_CONFIG_SUBDIRS instead
12 dnl would be better but is tricky.
13 dnl
14 dnl Use ifdef/ifelse over m4_ifdef/m4_ifelse to be clean for 2.13.
15 dnl Redefine AC_CONFIG_SUBDIRS so aclocal pulls in this file
16 dnl when needed.
17
18 ifdef([m4_PACKAGE_VERSION],
19 [ifelse(m4_PACKAGE_VERSION, [2.59], [
20
21 dnl Redefine AC_CONFIG_SUBDIRS so this file is picked up if needed.
22 AC_DEFUN([AC_CONFIG_SUBDIRS], defn([AC_CONFIG_SUBDIRS]))
23
24 dnl Override the broken macro.
25 # _AC_OUTPUT_SUBDIRS
26 # ------------------
27 # This is a subroutine of AC_OUTPUT, but it does not go into
28 # config.status, rather, it is called after running config.status.
29 m4_define([_AC_OUTPUT_SUBDIRS],
30 [
31 #
32 # CONFIG_SUBDIRS section, as fixed in confsubdir.m4.
33 #
34 if test "$no_recursion" != yes; then
35
36   # Remove --cache-file and --srcdir arguments so they do not pile up.
37   ac_sub_configure_args=
38   ac_prev=
39   eval "set x $ac_configure_args"
40   shift
41   for ac_arg
42   do
43     if test -n "$ac_prev"; then
44       ac_prev=
45       continue
46     fi
47     case $ac_arg in
48     -cache-file | --cache-file | --cache-fil | --cache-fi \
49     | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
50       ac_prev=cache_file ;;
51     -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
52     | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \
53     | --c=*)
54       ;;
55     --config-cache | -C)
56       ;;
57     -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
58       ac_prev=srcdir ;;
59     -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
60       ;;
61     -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
62       ac_prev=prefix ;;
63     -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
64       ;;
65     *)
66       case $ac_arg in
67       *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
68       esac
69       ac_sub_configure_args="$ac_sub_configure_args '$ac_arg'" ;;
70     esac
71   done
72
73   # Always prepend --prefix to ensure using the same prefix
74   # in subdir configurations.
75   ac_arg="--prefix=$prefix"
76   case $ac_arg in
77   *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
78   esac
79   ac_sub_configure_args="$ac_arg $ac_sub_configure_args"
80
81   ac_popdir=`pwd`
82   for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue
83
84     # Do not complain, so a configure script can configure whichever
85     # parts of a large source tree are present.
86     test -d "$srcdir/$ac_dir" || continue
87
88     AC_MSG_NOTICE([configuring in $ac_dir])
89     AS_MKDIR_P(["$ac_dir"])
90     _AC_SRCPATHS(["$ac_dir"])
91
92     cd "$ac_dir"
93
94     # Check for guested configure; otherwise get Cygnus style configure.
95     if test -f "$ac_srcdir/configure.gnu"; then
96       ac_sub_configure=$ac_srcdir/configure.gnu
97     elif test -f "$ac_srcdir/configure"; then
98       ac_sub_configure=$ac_srcdir/configure
99     elif test -f "$ac_srcdir/configure.in"; then
100       # This should be Cygnus configure.
101       ac_sub_configure=$ac_aux_dir/configure
102     else
103       AC_MSG_WARN([no configuration information is in $ac_dir])
104       ac_sub_configure=
105     fi
106
107     # The recursion is here.
108     if test -n "$ac_sub_configure"; then
109       # Make the cache file name correct relative to the subdirectory.
110       case $cache_file in
111       [[\\/]]* | ?:[[\\/]]* ) ac_sub_cache_file=$cache_file ;;
112       *) # Relative path.
113         ac_sub_cache_file=$ac_top_builddir$cache_file ;;
114       esac
115
116       AC_MSG_NOTICE([running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir])
117       # The eval makes quoting arguments work.
118       eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \
119            --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" ||
120         AC_MSG_ERROR([$ac_sub_configure failed for $ac_dir])
121     fi
122
123     cd "$ac_popdir"
124   done
125 fi
126 ])# _AC_OUTPUT_SUBDIRS
127 ])])