From: Bruno Haible Date: Tue, 16 Mar 2010 06:04:40 +0000 (+0100) Subject: Allow plus signs in AC_ARG_ENABLE and AC_ARG_WITH. X-Git-Tag: v2.66~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee0ecf0c37a41661c42ac9425ba50adb40bea4f7;p=thirdparty%2Fautoconf.git Allow plus signs in AC_ARG_ENABLE and AC_ARG_WITH. * doc/autoconf.texi (External Software): Mention that AC_ARG_WITH accepts packages with a + sign in it. (Package Options): Likewise for AC_ARG_ENABLE. * lib/autoconf/general.m4 (_AC_ENABLE_IF): Also replace '+' with '_'. * tests/base.at (AC_ARG_ENABLE and AC_ARG_WITH): New test. * NEWS: Update. Signed-off-by: Eric Blake --- diff --git a/ChangeLog b/ChangeLog index d1fc70e8..c0c4bc0f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2010-03-13 Bruno Haible + and Ralf Wildenhues + + Allow plus signs in AC_ARG_ENABLE and AC_ARG_WITH. + * doc/autoconf.texi (External Software): Mention that AC_ARG_WITH + accepts packages with a + sign in it. + (Package Options): Likewise for AC_ARG_ENABLE. + * lib/autoconf/general.m4 (_AC_ENABLE_IF): Also replace '+' with '_'. + * tests/base.at (AC_ARG_ENABLE and AC_ARG_WITH): New test. + * NEWS: Update. + 2010-06-14 Ralf Wildenhues Autotest: simplify logic to compute test group result. diff --git a/NEWS b/NEWS index f1fdefba..5c0d1309 100644 --- a/NEWS +++ b/NEWS @@ -24,6 +24,10 @@ GNU Autoconf NEWS - User visible changes. ** Autotest testsuites accept an option --recheck to rerun tests that failed or passed unexpectedly during the last non-debug testsuite run. +** AC_ARG_ENABLE and AC_ARG_WITH now also accept `+' signs in `--enable-*' + and `--with-*' arguments, converting them to underscores for the variable + names. + * Major changes in Autoconf 2.65 (2009-11-21) [stable] Released by Eric Blake, based on git versions 2.64.*. diff --git a/doc/autoconf.texi b/doc/autoconf.texi index ca0d85cf..519158c2 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -20534,7 +20534,7 @@ or @option{--without-@var{package}}, run shell commands @var{action-if-given}. If neither option was given, run shell commands @var{action-if-not-given}. The name @var{package} indicates another software package that this program should work with. It should consist -only of alphanumeric characters, dashes, and dots. +only of alphanumeric characters, dashes, plus signs, and dots. The option's argument is available to the shell commands @var{action-if-given} in the shell variable @code{withval}, which is @@ -20686,7 +20686,7 @@ If the user gave @command{configure} the option shell commands @var{action-if-given}. If neither option was given, run shell commands @var{action-if-not-given}. The name @var{feature} indicates an optional user-level facility. It should consist only of -alphanumeric characters, dashes, and dots. +alphanumeric characters, dashes, plus signs, and dots. The option's argument is available to the shell commands @var{action-if-given} in the shell variable @code{enableval}, which is diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 9c24b3fd..e764b160 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -1440,7 +1440,7 @@ m4_define([_m4_divert(HELP_ENABLE)], _m4_divert(HELP_WITH)) # m4_define([_AC_ENABLE_IF], [@%:@ Check whether --$1-$2 was given. -_AC_ENABLE_IF_ACTION([$1], m4_translit([$2], [-.], [__]), [$3], [$4]) +_AC_ENABLE_IF_ACTION([$1], m4_translit([$2], [-+.], [___]), [$3], [$4]) ]) m4_define([_AC_ENABLE_IF_ACTION], diff --git a/tests/base.at b/tests/base.at index 042f16cd..54ccd8ad 100644 --- a/tests/base.at +++ b/tests/base.at @@ -532,6 +532,58 @@ AT_CHECK_CONFIGURE([1=2], [1], [], [ignore], [ignore]) AT_CLEANUP +## ------------------------------ ## +## AC_ARG_ENABLE and AC_ARG_WITH. ## +## ------------------------------ ## + +AT_SETUP([AC_ARG_ENABLE and AC_ARG_WITH]) + +AT_DATA_M4SH([configure.ac], +[[AC_INIT +# Taken from autoconf.texi:Pretty Help Strings. +AC_ARG_WITH([foo], + [AS_HELP_STRING([--with-foo], + [use foo (default is no)])], + [use_foo=$withval], + [use_foo=no]) +AC_ARG_WITH([c++], + [AS_HELP_STRING([--with-c++], + [with c++])], + [choice_with=$withval]) +AC_ARG_ENABLE([c++], + [AS_HELP_STRING([--enable-c++], + [enable c++])], + [choice_enable=$enableval]) +echo "use_foo: $use_foo" +echo "with_c++: $with_c__, $choice_with" +echo "enable_c++: $enable_c__, $choice_enable" +]]) + +AT_CHECK_AUTOCONF +AT_CHECK_CONFIGURE([--help | grep foo], [0], +[[ --with-foo use foo (default is no) +]], [ignore]) +AT_CHECK_CONFIGURE([--with-foo=yes --with-c++ --disable-c++], + [], [stdout], [ignore]) +AT_CHECK([grep 'use_foo: yes' stdout], [], [ignore]) +AT_CHECK([grep 'with_c++: yes, yes' stdout], [], [ignore]) +AT_CHECK([grep 'enable_c++: no, no' stdout], [], [ignore]) +AT_CHECK([grep 'unrecognized option' stdout], [1]) +AT_CHECK_CONFIGURE([--without-foo --with-c++=no --enable-c++=maybe], + [], [stdout], [ignore]) +AT_CHECK([grep 'use_foo: no' stdout], [], [ignore]) +AT_CHECK([grep 'with_c++: no, no' stdout], [], [ignore]) +AT_CHECK([grep 'enable_c++: maybe, maybe' stdout], [], [ignore]) +AT_CHECK([grep 'unrecognized option' stdout], [1]) +AT_CHECK_CONFIGURE([], [], [stdout], [ignore]) +AT_CHECK([grep 'use_foo: no' stdout], [], [ignore]) +AT_CHECK([grep 'with_c++: , $' stdout], [], [ignore]) +AT_CHECK([grep 'enable_c++: , $' stdout], [], [ignore]) +AT_CHECK([grep 'unrecognized option' stdout], [1]) + +AT_CLEANUP + + ## --------------------- ## ## configure directories ## ## --------------------- ##