2006-05-06 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+ * lib/autoconf/status.m4 (_AC_OUTPUT_SUBDIRS): Take care not to
+ munge (multiple) white space and other oddities.
+ * tests/torture.at (AT_CHECK_AC_ARG_VAR): Make sure to M4-escape
+ single quotes in variable assignment.
+ (AC_ARG_VAR, configure invocation): Adjust tests to expose this
+ and similar failures by adding multiple spaces, tabs, and other
+ special characters.
+ Report and different test suggested by Francesco Romani
+ <fromani@gmail.com> and Andrew Church <achurch@achurch.org>.
+
* lib/autoconf/general.m4 (_AC_INIT_PREPARE): When we escape
single quotes, we only need to search for single quotes; this
both simplifies the search pattern, and makes us less
# Remove --cache-file and --srcdir arguments so they do not pile up.
ac_sub_configure_args=
ac_prev=
- for ac_arg in $ac_configure_args; do
+ eval set x "$ac_configure_args"
+ shift
+ for ac_arg
+ do
if test -n "$ac_prev"; then
ac_prev=
continue
ac_prev=prefix ;;
-prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
;;
- *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;;
+ *)
+ case $ac_arg in
+ *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ ac_sub_configure_args="$ac_sub_configure_args '$ac_arg'" ;;
esac
done
AC_MSG_NOTICE([running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir])
# The eval makes quoting arguments work.
- eval $ac_sub_configure $ac_sub_configure_args \
- --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir ||
+ eval "$ac_sub_configure $ac_sub_configure_args \
+ --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" ||
AC_MSG_ERROR([$ac_sub_configure failed for $ac_dir])
fi
# Initial value.
m4_ifval([$1],
- [precious='$1'; export precious],
+ [precious='m4_bpatsubst($1, [[']], ['\\''])'; export precious],
[unset precious])
AT_CHECK_CONFIGURE([--config-cache -q])
AT_CHECK([cat file], [], [`$1'
# Change a precious variable that contains braces
AT_CHECK_AC_ARG_VAR([apple of my {eye}], [orange of my eye])
+# Change a precious variable that contains all kinds of fun
+AT_CHECK_AC_ARG_VAR(['p r ec"iou$], [orange of my eye])
+
AT_CLEANUP
# Check that `configure' and `config.status' honor their interface.
#
# We run `./configure one=val1 --enable-two=val2 --with-three=val3'
-# and verify that (i) `configure' correctly receives the arguments and
+# and verify that (i) `configure' correctly receives the arguments,
# (ii) correctly passes them to `config.status', which we check by
-# running `config.status --recheck'.
+# running `config.status --recheck', and (iii) correctly passes them
+# to sub-configure scripts.
AT_SETUP([configure invocation])
+mkdir sub
+
AT_DATA([configure.ac],
[[AC_INIT
+AC_CONFIG_SUBDIRS([sub])
+echo "result=$one$enable_two$with_three"
+AC_OUTPUT
+]])
+
+AT_DATA([sub/configure.ac],
+[[AC_INIT
echo "result=$one$enable_two$with_three"
AC_OUTPUT
]])
+echo fake install-sh script >install-sh
+
+AT_CHECK_AUTOCONF
+cd sub
AT_CHECK_AUTOCONF
+cd ..
AT_CHECK_CONFIGURE([one=one --enable-two=two --with-three=three |
sed -n -e 's/^result=//p'], 0,
- [onetwothree
-])
+ [m4_do([onetwothree
+], [onetwothree
+])])
AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
[onetwothree
])
-AT_CHECK_CONFIGURE([one="\"'$ " --enable-two="\" ' $" --with-three=" \"'$"|
+AT_CHECK_CONFIGURE([one="\"'$ " --enable-two="\" ' $" --with-three=" \"'$"|
sed -n -e 's/^result=//p'], 0,
- ["'$ " ' $ "'$
-])
+ [m4_do(["'$ " ' $ "'$
+], ["'$ " ' $ "'$
+])])
AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
- ["'$ " ' $ "'$
+ ["'$ " ' $ "'$
])
AT_CLEANUP