]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Allow plus signs in AC_ARG_ENABLE and AC_ARG_WITH.
authorBruno Haible <bruno@clisp.org>
Tue, 16 Mar 2010 06:04:40 +0000 (07:04 +0100)
committerEric Blake <eblake@redhat.com>
Mon, 14 Jun 2010 19:56:46 +0000 (13:56 -0600)
* 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 <eblake@redhat.com>
ChangeLog
NEWS
doc/autoconf.texi
lib/autoconf/general.m4
tests/base.at

index d1fc70e86a0e11c555b4327e3b64c786d247a2d4..c0c4bc0f44aa9cc34fe00e9e9a7d2998325f627d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2010-03-13  Bruno Haible  <bruno@clisp.org>
+       and Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       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  <Ralf.Wildenhues@gmx.de>
 
        Autotest: simplify logic to compute test group result.
diff --git a/NEWS b/NEWS
index f1fdefba56f8164c4fc67c7d869304ee73364d8b..5c0d1309f20cf472f2175b073fb33c0e960c2c8f 100644 (file)
--- 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.*.
 
index ca0d85cfd23107372c286f2a785b3b5c492c6de4..519158c2eacd6670c71b60f23adde8ce82fdf045 100644 (file)
@@ -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
index 9c24b3fd41fa1f5a2f636f4a1d2e89da19c5c736..e764b160bb31abba3235e89eeb3d5bd0084a038e 100644 (file)
@@ -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],
index 042f16cd63e62d56ac34d7baadeb73de44ffad91..54ccd8ad256830a49af303a82f18e0255f286339 100644 (file)
@@ -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 ##
 ## --------------------- ##