+2000-02-09 Akim Demaille <akim@epita.fr>
+
+ Fix the handling of `./configure foo=bar' and test it.
+
+ * acgeneral.m4 (AC_INIT_PARSE_ARGS, getopt loop): Always define
+ ac_optarg as the rhs of the first `=', not only on `-.*=', so that
+ `configure var=val' defines ac_optarg=val.
+ Improve the robustness to shell special characters:
+ - Use grep when checking that shell variable names are valid.
+ - Quote the quotes in ac_optarg before `eval var='$ac_optarg''.
+ - Quote the quotes when building ac_configure_args.
+
+ * tests/torture.m4: Test that `./configure foo=bar' works properly.
+
2000-02-09 Akim Demaille <akim@epita.fr>
Resynchronize `INSTALL' with the current `configure', and
continue
fi
- case "$ac_option" in
-changequote(, )dnl
- -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
-changequote([, ])dnl
- *) ac_optarg= ;;
- esac
+[ ac_optarg=`echo "$ac_option" | sed -n 's/^[^=]*=//p'`]
# Accept the important Cygnus configure options, so we can diagnose typos.
;;
*=*)
- ac_envvar=`echo $ac_option|sed -e 's/=.*//'`
+ ac_envvar=`echo "$ac_option" | sed -e 's/=.*//'`
# Reject names that are not valid shell variable names.
changequote(, )dnl
- if test -n "`echo $ac_envvar| sed 's/[_a-zA-Z0-9]//g'`"; then
+ if echo "$ac_envvar" | grep '[^a-zA-Z0-9_]' >/dev/null 2>&1; then
changequote([, ])dnl
AC_MSG_ERROR($ac_envvar: invalid variable name)
fi
- eval "${ac_envvar}='$ac_optarg'"
+ ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+ eval "$ac_envvar='$ac_optarg'"
export $ac_envvar ;;
*)
changequote(<<, >>)dnl
dnl If you change this globbing pattern, test it on an old shell --
dnl it's sensitive. Putting any kind of quote in it causes syntax errors.
- *" "*|*" "*|*[\[\]\~\<<#>>\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
- ac_arg=`echo "$ac_arg"|sed "s/'/'\\\\\\\\''/g"`
+ *" "*|*" "*|*[\[\]\~\<<#>>\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"`
ac_configure_args="$ac_configure_args '$ac_arg'" ;;
changequote([, ])dnl
*) ac_configure_args="$ac_configure_args $ac_arg" ;;
ac_cs_version="\\
$CONFIG_STATUS generated by autoconf version AC_ACVERSION.
-Configured on host `(hostname || uname -n) 2>/dev/null | sed 1q` by running
- [$]0 [$]ac_configure_args"
+Configured on host `(hostname || uname -n) 2>/dev/null | sed 1q` by
+ `echo "[$]0 [$]ac_configure_args" | sed 's/[[\\"\`\$]]/\\\\&/g'`"
dnl We use a different name than CONFTEST just to help the maintainers
dnl to make the difference between `conftest' which is the root of the
continue
fi
- case "$ac_option" in
-changequote(, )dnl
- -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
-changequote([, ])dnl
- *) ac_optarg= ;;
- esac
+[ ac_optarg=`echo "$ac_option" | sed -n 's/^[^=]*=//p'`]
# Accept the important Cygnus configure options, so we can diagnose typos.
;;
*=*)
- ac_envvar=`echo $ac_option|sed -e 's/=.*//'`
+ ac_envvar=`echo "$ac_option" | sed -e 's/=.*//'`
# Reject names that are not valid shell variable names.
changequote(, )dnl
- if test -n "`echo $ac_envvar| sed 's/[_a-zA-Z0-9]//g'`"; then
+ if echo "$ac_envvar" | grep '[^a-zA-Z0-9_]' >/dev/null 2>&1; then
changequote([, ])dnl
AC_MSG_ERROR($ac_envvar: invalid variable name)
fi
- eval "${ac_envvar}='$ac_optarg'"
+ ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+ eval "$ac_envvar='$ac_optarg'"
export $ac_envvar ;;
*)
changequote(<<, >>)dnl
dnl If you change this globbing pattern, test it on an old shell --
dnl it's sensitive. Putting any kind of quote in it causes syntax errors.
- *" "*|*" "*|*[\[\]\~\<<#>>\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
- ac_arg=`echo "$ac_arg"|sed "s/'/'\\\\\\\\''/g"`
+ *" "*|*" "*|*[\[\]\~\<<#>>\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"`
ac_configure_args="$ac_configure_args '$ac_arg'" ;;
changequote([, ])dnl
*) ac_configure_args="$ac_configure_args $ac_arg" ;;
ac_cs_version="\\
$CONFIG_STATUS generated by autoconf version AC_ACVERSION.
-Configured on host `(hostname || uname -n) 2>/dev/null | sed 1q` by running
- [$]0 [$]ac_configure_args"
+Configured on host `(hostname || uname -n) 2>/dev/null | sed 1q` by
+ `echo "[$]0 [$]ac_configure_args" | sed 's/[[\\"\`\$]]/\\\\&/g'`"
dnl We use a different name than CONFTEST just to help the maintainers
dnl to make the difference between `conftest' which is the root of the
dnl Remove test files.
rm -f dummy dummy.in
+
+
+
+dnl ## ------------------------------------------------------ ##
+dnl ## Check that `configure' and `config.status' honor their ##
+dnl ## interface. ##
+dnl ## ------------------------------------------------------ ##
+
+dnl We run `./configure result=val' and verify that (i) `configure'
+dnl correctly receives `val' and (ii) correctly passes it to
+dnl `config.status', which we check by running `config.status
+dnl --recheck' (which *must* preserve the value of `result').
+
+AT_SETUP(command line interface)
+
+AT_DATA(configure.in,
+[[AC_INIT
+echo "result=$result"
+AC_OUTPUT
+]])
+
+AT_CHECK([../autoconf -m .. -l $at_srcdir], 0,, ignore)
+
+AT_CHECK([./configure result=result | sed -n -e 's/^result=//p'], 0,
+ [result
+], ignore)
+AT_CHECK([./config.status --recheck | sed -n -e 's/^result=//p'], 0,
+ [result
+], ignore)
+
+AT_CHECK([./configure result="\"'$" | sed -n -e 's/^result=//p'], 0,
+ ["'$
+], ignore)
+AT_CHECK([./config.status --recheck | sed -n -e 's/^result=//p'], 0,
+ ["'$
+], ignore)
+
+AT_CLEANUP(configure config.status config.log config.cache)