1214571Sdimdnl Fix Autoconf-2.59 AC_CONFIG_SUBDIRS whitespace mangling,
2214571Sdimdnl by overriding the broken internal Autoconf macro with a
3214571Sdimdnl backport of the 2.60 fix.
4214571Sdimdnl
5214571Sdimdnl This file should be a no-op for Autoconf versions != 2.59.
6214571Sdimdnl It can be removed once the complete tree has moved to a
7214571Sdimdnl newer Autoconf version.
8214571Sdim
9214571Sdimdnl m4_PACKAGE_VERSION is an undocumented Autoconf macro.
10214571Sdimdnl We use it because this fix is intended for 2.59 only.
11214571Sdimdnl A feature test for the broken AC_CONFIG_SUBDIRS instead
12214571Sdimdnl would be better but is tricky.
13214571Sdimdnl
14214571Sdimdnl Use ifdef/ifelse over m4_ifdef/m4_ifelse to be clean for 2.13.
15214571Sdimdnl Redefine AC_CONFIG_SUBDIRS so aclocal pulls in this file
16214571Sdimdnl when needed.
17214571Sdim
18214571Sdimifdef([m4_PACKAGE_VERSION],
19214571Sdim[ifelse(m4_PACKAGE_VERSION, [2.59], [
20214571Sdim
21214571Sdimdnl Redefine AC_CONFIG_SUBDIRS so this file is picked up if needed.
22214571SdimAC_DEFUN([AC_CONFIG_SUBDIRS], defn([AC_CONFIG_SUBDIRS]))
23214571Sdim
24214571Sdimdnl Override the broken macro.
25214571Sdim# _AC_OUTPUT_SUBDIRS
26214571Sdim# ------------------
27214571Sdim# This is a subroutine of AC_OUTPUT, but it does not go into
28214571Sdim# config.status, rather, it is called after running config.status.
29214571Sdimm4_define([_AC_OUTPUT_SUBDIRS],
30214571Sdim[
31214571Sdim#
32214571Sdim# CONFIG_SUBDIRS section, as fixed in confsubdir.m4.
33214571Sdim#
34214571Sdimif test "$no_recursion" != yes; then
35214571Sdim
36214571Sdim  # Remove --cache-file and --srcdir arguments so they do not pile up.
37214571Sdim  ac_sub_configure_args=
38214571Sdim  ac_prev=
39214571Sdim  eval "set x $ac_configure_args"
40214571Sdim  shift
41214571Sdim  for ac_arg
42214571Sdim  do
43214571Sdim    if test -n "$ac_prev"; then
44214571Sdim      ac_prev=
45214571Sdim      continue
46214571Sdim    fi
47214571Sdim    case $ac_arg in
48214571Sdim    -cache-file | --cache-file | --cache-fil | --cache-fi \
49214571Sdim    | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
50214571Sdim      ac_prev=cache_file ;;
51214571Sdim    -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
52214571Sdim    | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \
53214571Sdim    | --c=*)
54214571Sdim      ;;
55214571Sdim    --config-cache | -C)
56214571Sdim      ;;
57214571Sdim    -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
58214571Sdim      ac_prev=srcdir ;;
59214571Sdim    -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
60214571Sdim      ;;
61214571Sdim    -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
62214571Sdim      ac_prev=prefix ;;
63214571Sdim    -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
64214571Sdim      ;;
65214571Sdim    *)
66214571Sdim      case $ac_arg in
67214571Sdim      *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
68214571Sdim      esac
69214571Sdim      ac_sub_configure_args="$ac_sub_configure_args '$ac_arg'" ;;
70214571Sdim    esac
71214571Sdim  done
72214571Sdim
73214571Sdim  # Always prepend --prefix to ensure using the same prefix
74214571Sdim  # in subdir configurations.
75214571Sdim  ac_arg="--prefix=$prefix"
76214571Sdim  case $ac_arg in
77214571Sdim  *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
78214571Sdim  esac
79214571Sdim  ac_sub_configure_args="$ac_arg $ac_sub_configure_args"
80214571Sdim
81214571Sdim  ac_popdir=`pwd`
82214571Sdim  for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue
83214571Sdim
84214571Sdim    # Do not complain, so a configure script can configure whichever
85214571Sdim    # parts of a large source tree are present.
86214571Sdim    test -d "$srcdir/$ac_dir" || continue
87214571Sdim
88214571Sdim    AC_MSG_NOTICE([configuring in $ac_dir])
89214571Sdim    AS_MKDIR_P(["$ac_dir"])
90214571Sdim    _AC_SRCPATHS(["$ac_dir"])
91214571Sdim
92214571Sdim    cd "$ac_dir"
93214571Sdim
94214571Sdim    # Check for guested configure; otherwise get Cygnus style configure.
95214571Sdim    if test -f "$ac_srcdir/configure.gnu"; then
96214571Sdim      ac_sub_configure=$ac_srcdir/configure.gnu
97214571Sdim    elif test -f "$ac_srcdir/configure"; then
98214571Sdim      ac_sub_configure=$ac_srcdir/configure
99214571Sdim    elif test -f "$ac_srcdir/configure.in"; then
100214571Sdim      # This should be Cygnus configure.
101214571Sdim      ac_sub_configure=$ac_aux_dir/configure
102214571Sdim    else
103214571Sdim      AC_MSG_WARN([no configuration information is in $ac_dir])
104214571Sdim      ac_sub_configure=
105214571Sdim    fi
106214571Sdim
107214571Sdim    # The recursion is here.
108214571Sdim    if test -n "$ac_sub_configure"; then
109214571Sdim      # Make the cache file name correct relative to the subdirectory.
110214571Sdim      case $cache_file in
111214571Sdim      [[\\/]]* | ?:[[\\/]]* ) ac_sub_cache_file=$cache_file ;;
112214571Sdim      *) # Relative path.
113214571Sdim	ac_sub_cache_file=$ac_top_builddir$cache_file ;;
114214571Sdim      esac
115214571Sdim
116214571Sdim      AC_MSG_NOTICE([running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir])
117214571Sdim      # The eval makes quoting arguments work.
118214571Sdim      eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \
119214571Sdim	   --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" ||
120214571Sdim	AC_MSG_ERROR([$ac_sub_configure failed for $ac_dir])
121214571Sdim    fi
122214571Sdim
123214571Sdim    cd "$ac_popdir"
124214571Sdim  done
125214571Sdimfi
126214571Sdim])# _AC_OUTPUT_SUBDIRS
127214571Sdim])])
128