From: Paul Eggert Date: Fri, 26 May 2006 22:29:50 +0000 (+0000) Subject: * NEWS: Mention that AC_TRY_COMMAND and AC_TRY_EVAL may be removed. X-Git-Tag: AUTOCONF-2.59d~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=922c98ee7d026e71bcaf23bfc539f02a25dd9640;p=thirdparty%2Fautoconf.git * NEWS: Mention that AC_TRY_COMMAND and AC_TRY_EVAL may be removed. * doc/autoconf.texi (Special Chars in Variables): New section. (Preset Output Variables): Warn about special chars in CPPFLAGS. (Installation Directory Variables): Quote $(datadir) better. (Limitations of Builtins): Describe some of eval's trickiness. * lib/autoconf/c.m4 (AC_PROG_CC_C_O): Simplify quoting. * lib/autoconf/fortram.m4 (_AC_PROG_FC_V_OUTPUT): Likewise. * lib/autoconf/general.m4 (_AC_INIT_PREPARE): Put leading space in front of every arg, not just trailing args. Quote apostrophes. (_AC_EVAL_ECHO): New macro. (_AC_EVAL, AC_EVAL_STDERR): Use it. Quote arg of eval. (AC_TRY_EVAL, AC_TRY_COMMAND): Mention that these macros might get removed. (_AC_LINK_IFELSE): Use proper rule for shell continuation lines, exposed by quoting of eval argument. Put the command on line line so it logs better. * lib/autoconf/libs.m4 (_AC_PATH_X_XMKMF): Use eval more safely. (_AC_PATH_X, AC_PATH_X): Quote more safely. * lib/autoconf/programs.m4 (AC_PROG_MAKE_SET): Use eval more safely. * lib/autoconf/specific.m4 (AC_SYS_LONG_FILE_NAMES): Don't use eval. * lib/autoconf/status.m4 (_AC_OUTPUT_SUBDIRS): Minor style change. Handle special chars in prefix, ac_srcdir, ac_aux_dir. Use eval more safely. (_AC_OUTPUT_CONFIG_STATUS): Adjust to above changes. * lib/m4sugar/m4sh.m4 (AS_VAR_GET): Note that this API needs to be replaced. * tests/base.at (AC_TRY_COMMAND): Use proper rule for shell continuation lines, exposed by quoting of eval argument. --- diff --git a/ChangeLog b/ChangeLog index 21008ee31..cb5884958 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,37 @@ +2006-05-26 Paul Eggert + + * NEWS: Mention that AC_TRY_COMMAND and AC_TRY_EVAL may be removed. + * doc/autoconf.texi (Special Chars in Variables): New section. + (Preset Output Variables): Warn about special chars in CPPFLAGS. + (Installation Directory Variables): Quote $(datadir) better. + (Limitations of Builtins): Describe some of eval's trickiness. + * lib/autoconf/c.m4 (AC_PROG_CC_C_O): Simplify quoting. + * lib/autoconf/fortram.m4 (_AC_PROG_FC_V_OUTPUT): Likewise. + * lib/autoconf/general.m4 (_AC_INIT_PREPARE): Put leading space + in front of every arg, not just trailing args. Quote apostrophes. + (_AC_EVAL_ECHO): New macro. + (_AC_EVAL, AC_EVAL_STDERR): Use it. Quote arg of eval. + (AC_TRY_EVAL, AC_TRY_COMMAND): Mention that these macros might get + removed. + (_AC_LINK_IFELSE): Use proper rule for shell continuation lines, + exposed by quoting of eval argument. Put the command on line line + so it logs better. + * lib/autoconf/libs.m4 (_AC_PATH_X_XMKMF): Use eval more safely. + (_AC_PATH_X, AC_PATH_X): Quote more safely. + * lib/autoconf/programs.m4 (AC_PROG_MAKE_SET): Use eval more safely. + * lib/autoconf/specific.m4 (AC_SYS_LONG_FILE_NAMES): Don't use eval. + * lib/autoconf/status.m4 (_AC_OUTPUT_SUBDIRS): Minor style change. + Handle special chars in prefix, ac_srcdir, ac_aux_dir. + Use eval more safely. + (_AC_OUTPUT_CONFIG_STATUS): Adjust to above changes. + * lib/m4sugar/m4sh.m4 (AS_VAR_GET): Note that this API needs + to be replaced. + * tests/base.at (AC_TRY_COMMAND): Use proper rule for shell continuation + lines, exposed by quoting of eval argument. + 2006-05-26 Stepan Kasal and Ralf Wildenhues - + * lib/autoconf/lang.m4 (_AC_COMPILER_EXEEXT_DEFAULT): Drop the initialization of `ac_cv_exeext', do not override it if it was already set, unless it was set to `no', for compatibility with @@ -15,12 +46,12 @@ 2006-05-26 Ralf Wildenhues Revert these two patches: - + 2006-04-06 Eric Blake * lib/autoconf/lang.m4 (_AC_COMPILER_EXEEXT_O): Inside cache check, s/ac_exeext/ac_cv_exeext/. Fixes regression introduced 2006-04-01. - + 2006-04-01 Stepan Kasal Clean up _AC_COMPILER_EXEEXT* macros. * lib/autoconf/lang.m4 (_AC_COMPILER_EXEEXT_DEFAULT): Don't try to diff --git a/NEWS b/NEWS index 4a0a21dc0..b6b2482eb 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,9 @@ * Major changes in Autoconf 2.59d +** AC_TRY_COMMAND, AC_TRY_EVAL + These never-documented macros have been marked with a comment + saying that they may be removed in a future release. + ** ac_config_guess, ac_config_sub, ac_configure These never-documented variables have been marked with a comment saying that we intend to remove them in a future release. diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 2f160334f..3338d99e6 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -410,6 +410,7 @@ Results of Tests * Defining Symbols:: Defining C preprocessor symbols * Setting Output Variables:: Replacing variables in output files +* Special Chars in Variables:: Characters to beware of in variables * Caching Results:: Speeding up subsequent @command{configure} runs * Printing Messages:: Notifying @command{configure} users @@ -2219,6 +2220,8 @@ miscellaneous options for the C and C++ preprocessors and compilers. If it is not set in the environment when @command{configure} runs, the default value is empty. @command{configure} uses this variable when compiling or preprocessing programs to test for C and C++ features. +@xref{Special Chars in Variables}, for limitations that @code{CPPFLAGS} +might run into. @end defvar @defvar CXXFLAGS @@ -2520,7 +2523,8 @@ Makefiles. For instance, instead of trying to evaluate @code{datadir} in @file{configure} and hard-coding it in Makefiles using e.g., @samp{AC_DEFINE_UNQUOTED([DATADIR], ["$datadir"], [Data directory.])}, you should add -@option{-DDATADIR="$(datadir)"} to your @code{CPPFLAGS}. +@option{-DDATADIR='$(datadir)'} to your Makefile's definition of +@code{CPPFLAGS} (@code{AM_CPPFLAGS} if you are also using Automake). Similarly, you should not rely on @code{AC_CONFIG_FILES} to replace @code{datadir} and friends in your shell scripts and other files, rather @@ -7889,6 +7893,7 @@ print a message letting the user know the result of the test. @menu * Defining Symbols:: Defining C preprocessor symbols * Setting Output Variables:: Replacing variables in output files +* Special Chars in Variables:: Characters to beware of in variables * Caching Results:: Speeding up subsequent @command{configure} runs * Printing Messages:: Notifying @command{configure} users @end menu @@ -8137,6 +8142,35 @@ running /bin/sh ./configure undeclared_var=raboof --silent \ @end itemize @end defmac +@node Special Chars in Variables +@section Special Characters in Output Variables +@cindex Output variables, special characters in + +Many output variables are intended to be evaluated both by +@command{make} and by the shell. Some characters are expanded +differently in these two contexts, so to avoid confusion these +variables' values should not contain any of the following characters: + +@example +" # $ & ' ( ) * ; < > ? [ \ ^ ` | +@end example + +Also, these variables' values should neither contain newlines, nor start +with @samp{~}, nor contain white space or @samp{:} immediately followed +by @samp{~}. The values can contain nonempty sequences of white space +characters like tabs and spaces, but each such sequence might +arbitrarily be replaced by a single space during substitution. + +These restrictions apply both to the values that @command{configure} +computes, and to the values set directly by the user. For example, the +following invocations of @command{configure} are problematic, since they +attempt to use special characters within @code{CPPFLAGS}: + +@example +CPPFLAGS='-DOUCH="&\"#$*?"' ./configure + +./configure CPPFLAGS='-DOUCH="&\"#$*?"' +@end example @node Caching Results @section Caching Results @@ -10905,12 +10939,12 @@ the following: @end example Also, file names should not begin with @samp{~} or @samp{-}, and should -not contain @samp{-} immediately after @samp{/}. +contain neither @samp{-} immediately after @samp{/} nor @samp{~} +immediately after @samp{:}. These restrictions apply not only to the files that you distribute, but also to the absolute file names of your source, build, and destination -directories. Autoconf-generated @command{configure} scripts warn of -violations to the above restrictions. +directories. On some Posix-like platforms, @samp{!} and @samp{^} are special too, so they should be avoided. @@ -11958,6 +11992,36 @@ EOF @item @command{eval} @c ----------------- @prindex @command{eval} +The @command{eval} command is useful in limited circumstances, e.g., +using commands like @samp{eval table_$key=\$value} and @samp{eval +value=table_$key} to simulate a hash table when the key is known to be +alphanumeric. However, @command{eval} is tricky to use on arbitrary +arguments, even when it is implemented correctly. + +It is obviously unwise to use @samp{eval $cmd} if the string value of +@samp{cmd} was derived from an untrustworthy source. But even if the +string value is valid, @samp{eval $cmd} might not work as intended, +since it causes field splitting and file name expansion to occur twice, +once for the @command{eval} and once for the command itself. It is +therefore safer to use @samp{eval "$cmd"}. For example, if @var{cmd} +has the value @samp{cat test?.c}, @samp{eval $cmd} might expand to the +equivalent of @samp{cat test;.c} if there happens to be a file named +@file{test;.c} in the current directory; and this in turn will +mistakenly attempt to invoke @command{cat} on the file @file{test} and +then execute the command @command{.c}. To avoid this problem, use +@samp{eval "$cmd"} rather than @samp{eval $cmd}. + +However, suppose that you want to output the text of the evaluated +command just before executing it. Assuming the previous example, +@samp{echo "Executing: $cmd"} outputs @samp{Executing: cat test?.c}, but +this output doesn't show the user that @samp{test;.c} is the actual name +of the copied file. Conversely, @samp{eval "echo Executing: $cmd"} will +work on this example, but it will fail with @samp{cmd='cat foo >bar'}, +since it will mistakenly replace the contents of @file{bar} by the +string @samp{cat foo}. No simple, general, and portable solution to +this problem is known. + +You should also be wary of common bugs in @command{eval} implementations. In some shell implementations (e.g., older @command{ash}, Open@acronym{BSD} 3.8 @command{sh}, @command{pdksh} v5.2.14 99/07/13.2, and @command{zsh} 4.2.5), the arguments of @samp{eval} are evaluated in a context where diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4 index 6e409a319..f4a6fa29c 100644 --- a/lib/autoconf/c.m4 +++ b/lib/autoconf/c.m4 @@ -666,7 +666,7 @@ else fi rm -f conftest* ])dnl -if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = yes"; then +if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) diff --git a/lib/autoconf/fortran.m4 b/lib/autoconf/fortran.m4 index e6229da92..b92ec4658 100644 --- a/lib/autoconf/fortran.m4 +++ b/lib/autoconf/fortran.m4 @@ -527,8 +527,9 @@ AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # flags. ac_save_FFLAGS=$[]_AC_LANG_PREFIX[]FLAGS _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS m4_default([$1], [$ac_cv_prog_[]_AC_LANG_ABBREV[]_v])" -eval ac_link_cmd=\"$ac_link\" -_AS_ECHO_LOG([$ac_link_cmd]) +eval "set x $ac_link" +shift +_AS_ECHO_LOG([$[*]]) ac_[]_AC_LANG_ABBREV[]_v_output=`eval $ac_link AS_MESSAGE_LOG_FD>&1 2>&1 | grep -v 'Driving:'` echo "$ac_[]_AC_LANG_ABBREV[]_v_output" >&AS_MESSAGE_LOG_FD _AC_LANG_PREFIX[]FLAGS=$ac_save_FFLAGS diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 7578e9d13..2a30d2a0f 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -1145,7 +1145,6 @@ m4_define([_AC_INIT_PREPARE], ac_configure_args= ac_configure_args0= ac_configure_args1= -ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do @@ -1184,9 +1183,7 @@ dnl exit don't matter. -* ) ac_must_keep_next=true ;; esac fi - ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" - # Get rid of the leading space. - ac_sep=" " + ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done @@ -1217,6 +1214,9 @@ trap 'exit_status=$? for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac echo "$ac_var='\''$ac_val'\''" done | sort echo @@ -1227,6 +1227,9 @@ trap 'exit_status=$? for ac_var in $ac_subst_files do eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac echo "$ac_var='\''$ac_val'\''" done | sort echo @@ -2140,33 +2143,58 @@ AC_DEFUN([_AC_RUN_LOG_STDERR], _AS_ECHO_LOG([\$? = $ac_status]) (exit $ac_status); }]) +# _AC_EVAL_ECHO(COMMAND) +# ---------------------- +# Echo COMMAND. This is designed to be used just before evaluating COMMAND. +AC_DEFUN([_AC_EVAL_ECHO], +[m4_if([$1], [$ac_try], [], [ac_try="$1" +])dnl +dnl If the string contains '${', '"', '`', or '\', then escape +dnl $, ", `, and \. This is a hack, but it is safe and it also +dnl typically expands substrings like '$CC', which is what we want. +case $ac_try in #( + *\${* | *\"* | *\`* | *\\*) + ac_script='s/[[$"`\\]]/\\&/g' + ac_try=`echo "$ac_try" | sed "$ac_script"`;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try\""]) # _AC_EVAL(COMMAND) # ----------------- # Eval COMMAND, save the exit status in ac_status, and log it. AC_DEFUN([_AC_EVAL], -[_AC_RUN_LOG([eval $1], - [eval echo "$as_me:$LINENO: \"$1\""])]) +[_AC_RUN_LOG([eval "$1"], + [_AC_EVAL_ECHO([$1])])]) # _AC_EVAL_STDERR(COMMAND) # ------------------------ # Like _AC_RUN_LOG_STDERR, but eval (instead of running) COMMAND. AC_DEFUN([_AC_EVAL_STDERR], -[_AC_RUN_LOG_STDERR([eval $1], - [eval echo "$as_me:$LINENO: \"$1\""])]) +[_AC_RUN_LOG_STDERR([eval "$1"], + [_AC_EVAL_ECHO([$1])])]) # AC_TRY_EVAL(VARIABLE) # --------------------- +# Evaluate "$VARIABLE", which should be a valid shell command. # The purpose of this macro is to "configure:123: command line" # written into config.log for every test run. +# This macro is dangerous, and should not be used outside Autoconf, since not +# every shell command will work due to problems with eval and quoting, +# and the rules for exactly what does work are tricky. +# This macro may be removed in a future release. AC_DEFUN([AC_TRY_EVAL], [_AC_EVAL([$$1])]) # AC_TRY_COMMAND(COMMAND) # ----------------------- +# Like AC_TRY_EVAL, but execute the string COMMAND instead. +# This macro is dangerous, and should not be used outside Autoconf, since not +# every shell command will work due to problems with eval and quoting, +# and the rules for exactly what does work are tricky. +# This macro may be removed in a future release. AC_DEFUN([AC_TRY_COMMAND], [{ ac_try='$1' _AC_EVAL([$ac_try]); }]) @@ -2278,8 +2306,7 @@ m4_define([_AC_COMPILE_IFELSE], [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl rm -f conftest.$ac_objext AS_IF([_AC_EVAL_STDERR($ac_compile) && - AC_TRY_COMMAND([test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" - || test ! -s conftest.err]) && + AC_TRY_COMMAND([test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" || test ! -s conftest.err]) && AC_TRY_COMMAND([test -s conftest.$ac_objext])], [$2], [_AC_MSG_LOG_CONFTEST @@ -2319,8 +2346,7 @@ m4_define([_AC_LINK_IFELSE], [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl rm -f conftest.$ac_objext conftest$ac_exeext AS_IF([_AC_EVAL_STDERR($ac_link) && - AC_TRY_COMMAND([test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" - || test ! -s conftest.err]) && + AC_TRY_COMMAND([test -z "$ac_[]_AC_LANG_ABBREV[]_werror_flag" || test ! -s conftest.err]) && AC_TRY_COMMAND([test -s conftest$ac_exeext])], [$2], [_AC_MSG_LOG_CONFTEST diff --git a/lib/autoconf/libs.m4 b/lib/autoconf/libs.m4 index 5b670e431..2964b27fb 100644 --- a/lib/autoconf/libs.m4 +++ b/lib/autoconf/libs.m4 @@ -189,14 +189,19 @@ m4_define([_AC_PATH_X_XMKMF], rm -f -r conftest.dir if mkdir conftest.dir; then cd conftest.dir - # Make sure to not put "make" in the Imakefile rules, since we grep it out. cat >Imakefile <<'_ACEOF' -acfindx: - @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' +incroot: + @echo incroot='${INCROOT}' +usrlibdir: + @echo usrlibdir='${USRLIBDIR}' +libdir: + @echo libdir='${LIBDIR}' _ACEOF if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then # GNU make sometimes prints "make[1]: Entering...", which would confuse us. - eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` + for ac_var in incroot usrlibdir libdir; do + eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`" + done # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. for ac_extension in a so sl; do if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" && @@ -313,14 +318,16 @@ AC_DEFUN([_AC_PATH_X], ac_x_includes=no ac_x_libraries=no _AC_PATH_X_XMKMF _AC_PATH_X_DIRECT -if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then - # Didn't find X anywhere. Cache the known absence of X. - ac_cv_have_x="have_x=no" -else - # Record where we found X for the cache. - ac_cv_have_x="have_x=yes \ - ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" -fi])dnl +case $ac_x_includes,$ac_x_libraries in #( + no,* | *,no | *\'*) + # Didn't find X, or a directory has "'" in its name. + ac_cv_have_x="have_x=no";; #( + *) + # Record where we found X for the cache. + ac_cv_have_x="have_x=yes\ + ac_x_includes='$ac_x_includes'\ + ac_x_libraries='$ac_x_libraries'" +esac])dnl ]) @@ -345,12 +352,11 @@ if test "x$with_x" = xno; then # The user explicitly disabled X. have_x=disabled else - if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then - # Both variables are already set. - have_x=yes - else - _AC_PATH_X - fi + case $x_includes,$x_libraries in #( + *\'*) AC_MSG_ERROR([Cannot use X directory names containing ']);; #( + *,NONE | NONE,*) _AC_PATH_X;; #( + *) have_x=yes;; + esac eval "$ac_cv_have_x" fi # $with_x != no @@ -362,8 +368,9 @@ else test "x$x_includes" = xNONE && x_includes=$ac_x_includes test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries # Update the cache value to reflect the command line values. - ac_cv_have_x="have_x=yes \ - ac_x_includes=$x_includes ac_x_libraries=$x_libraries" + ac_cv_have_x="have_x=yes\ + ac_x_includes='$x_includes'\ + ac_x_libraries='$x_libraries'" AC_MSG_RESULT([libraries $x_libraries, headers $x_includes]) fi ])# AC_PATH_X diff --git a/lib/autoconf/programs.m4 b/lib/autoconf/programs.m4 index 1bb9a0099..98b1dafb4 100644 --- a/lib/autoconf/programs.m4 +++ b/lib/autoconf/programs.m4 @@ -764,22 +764,22 @@ AN_MAKEVAR([MAKE], [AC_PROG_MAKE_SET]) AN_PROGRAM([make], [AC_PROG_MAKE_SET]) AC_DEFUN([AC_PROG_MAKE_SET], [AC_MSG_CHECKING([whether ${MAKE-make} sets \$(MAKE)]) -set dummy ${MAKE-make}; ac_make=`echo "$[2]" | sed 'y,:./+-,___p_,'` +set x ${MAKE-make}; ac_make=`echo "$[2]" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` AC_CACHE_VAL(ac_cv_prog_make_${ac_make}_set, [cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: - @echo 'ac_maketemp=X"$(MAKE)"' + @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` -if test "$ac_maketemp" != X ; then - eval ac_cv_prog_make_${ac_make}_set=yes -else - eval ac_cv_prog_make_${ac_make}_set=no -fi +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac rm -f conftest.make])dnl -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then AC_MSG_RESULT([yes]) SET_MAKE= else @@ -819,7 +819,7 @@ AC_DEFUN([AC_PROG_SED], ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" | sed 99q >conftest.sed - $as_unset ac_script || ac_script= + $as_unset ac_script || ac_script= _AC_PATH_PROG_FEATURE_CHECK(SED, [sed gsed], [_AC_FEATURE_CHECK_LENGTH([ac_path_SED], [ac_cv_path_SED], ["$ac_path_SED" -f conftest.sed])])]) diff --git a/lib/autoconf/specific.m4 b/lib/autoconf/specific.m4 index 81abf0dd7..8512bcd2b 100644 --- a/lib/autoconf/specific.m4 +++ b/lib/autoconf/specific.m4 @@ -209,20 +209,18 @@ AC_DEFUN([AC_SYS_LONG_FILE_NAMES], # . the current directory, where building will happen # $prefix/lib where we will be installing things # $exec_prefix/lib likewise -# eval it to expand exec_prefix. # $TMPDIR if set, where it might want to write temporary files -# if $TMPDIR is not set: # /tmp where it might want to write temporary files # /var/tmp likewise # /usr/tmp likewise -if test -n "$TMPDIR" && test -d "$TMPDIR" && test -w "$TMPDIR"; then - ac_tmpdirs=$TMPDIR -else - ac_tmpdirs='/tmp /var/tmp /usr/tmp' -fi -for ac_dir in . $ac_tmpdirs `eval echo $prefix/lib $exec_prefix/lib` ; do - test -d "$ac_dir" || continue - test -w "$ac_dir" || continue # It is less confusing to not echo anything here. +for ac_dir in . "$TMPDIR" /tmp /var/tmp /usr/tmp "$prefix/lib" "$exec_prefix/lib"; do + # Skip $TMPDIR if it is empty or bogus, and skip $exec_prefix/lib + # in the usual case where exec_prefix is '${prefix}'. + case $ac_dir in #( + . | /* | ?:[[\\/]]*) ;; #( + *) continue;; + esac + test -w "$ac_dir/." || continue # It is less confusing to not echo anything here. ac_xdir=$ac_dir/cf$$ (umask 077 && mkdir "$ac_xdir" 2>/dev/null) || continue ac_tf1=$ac_xdir/conftest9012345 diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4 index 57810fc9e..f56be5a50 100644 --- a/lib/autoconf/status.m4 +++ b/lib/autoconf/status.m4 @@ -930,7 +930,7 @@ if test "$no_recursion" != yes; then # Remove --cache-file and --srcdir arguments so they do not pile up. ac_sub_configure_args= ac_prev= - eval set x "$ac_configure_args" + eval "set x $ac_configure_args" shift for ac_arg do @@ -966,7 +966,11 @@ if test "$no_recursion" != yes; then # Always prepend --prefix to ensure using the same prefix # in subdir configurations. - ac_sub_configure_args="--prefix=$prefix $ac_sub_configure_args" + ac_arg="--prefix=$prefix" + case $ac_arg in + *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + ac_sub_configure_args="$ac_arg $ac_sub_configure_args" ac_popdir=`pwd` for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue @@ -985,12 +989,12 @@ if test "$no_recursion" != yes; then # Check for guested configure; otherwise get Cygnus style configure. if test -f "$ac_srcdir/configure.gnu"; then - ac_sub_configure="$SHELL '$ac_srcdir/configure.gnu'" + ac_sub_configure=$ac_srcdir/configure.gnu elif test -f "$ac_srcdir/configure"; then - ac_sub_configure="$SHELL '$ac_srcdir/configure'" + ac_sub_configure=$ac_srcdir/configure elif test -f "$ac_srcdir/configure.in"; then # This should be Cygnus configure. - ac_sub_configure="$SHELL '$ac_aux_dir/configure'" + ac_sub_configure=$ac_aux_dir/configure else AC_MSG_WARN([no configuration information is in $ac_dir]) ac_sub_configure= @@ -1005,9 +1009,9 @@ if test "$no_recursion" != yes; then ac_sub_cache_file=$ac_top_build_prefix$cache_file ;; esac - AC_MSG_NOTICE([running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir]) + AC_MSG_NOTICE([running $SHELL $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 \ + eval "\$SHELL \"\$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 @@ -1213,7 +1217,7 @@ ac_cs_version="\\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.status[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING, - with options \\"`echo "$ac_configure_args" | sed 's/[[\\""\`\$]]/\\\\&/g'`\\" + with options \\"`echo "$ac_configure_args" | sed 's/^ / /; s/[[\\""\`\$]]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation @@ -1301,10 +1305,10 @@ cat >>$CONFIG_STATUS <<_ACEOF dnl Check this before opening the log, to avoid a bug on MinGW, dnl which prohibits the recursive instance from truncating an open log. if \$ac_cs_recheck; then - echo "running CONFIG_SHELL=$SHELL $SHELL $[0] " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&AS_MESSAGE_FD + echo "running CONFIG_SHELL=$SHELL $SHELL $[0] "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&AS_MESSAGE_FD CONFIG_SHELL=$SHELL export CONFIG_SHELL - exec $SHELL "$[0]" $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + exec $SHELL "$[0]"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4 index 850d491e6..40e3d106c 100644 --- a/lib/m4sugar/m4sh.m4 +++ b/lib/m4sugar/m4sh.m4 @@ -1369,6 +1369,8 @@ m4_define([AS_VAR_SET], # Get the value of the shell VARIABLE. # Evaluates to $VARIABLE if there are no indirection in VARIABLE, # else into the appropriate `eval' sequence. +# FIXME: This mishandles values that end in newlines, or have backslashes, +# or are '-n'. Fixing this will require changing the API. m4_define([AS_VAR_GET], [AS_LITERAL_IF([$1], [$$1], diff --git a/tests/base.at b/tests/base.at index fe5eea0a2..693edef8a 100644 --- a/tests/base.at +++ b/tests/base.at @@ -212,16 +212,16 @@ AT_DATA([configure.ac], [[AC_INIT if AC_TRY_COMMAND([(echo "The Cat in the Hat"; - echo "The Hat in the Cat" >&2) - | grep \^The\ Cat\ in\ the\ Hat\$ >/dev/null]); then + echo "The Hat in the Cat" >&2) | + grep \^The\ Cat\ in\ the\ Hat\$ >/dev/null]); then : else AC_MSG_ERROR([Didn't see the Cat in the Hat!]) fi if AC_TRY_COMMAND([(echo "The Cat in the Hat"; - echo "The Hat in the Cat" >&2) - | grep \^The\ Hat\ in\ the\ Cat\$ >/dev/null]); then + echo "The Hat in the Cat" >&2) | + grep \^The\ Hat\ in\ the\ Cat\$ >/dev/null]); then AC_MSG_ERROR([Saw the Hat in the Cat!]) fi ]]) diff --git a/tests/torture.at b/tests/torture.at index 9d58211bc..f3520c08c 100644 --- a/tests/torture.at +++ b/tests/torture.at @@ -1,6 +1,6 @@ # -*- Autotest -*- -# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software +# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software # Foundation, Inc. # # This program is free software; you can redistribute it and/or modify