bug-autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: feature request: allow plus signs in AC_ARG_ENABLE


From: Ralf Wildenhues
Subject: Re: feature request: allow plus signs in AC_ARG_ENABLE
Date: Tue, 16 Mar 2010 07:04:40 +0100
User-agent: Mutt/1.5.20 (2009-10-28)

* Bruno Haible wrote on Sat, Mar 13, 2010 at 09:49:54PM CET:
> Ralf Wildenhues wrote:
> > Those semantics already have users out there, though.  For example GCC
> > relies on --disable-libstdc___v3, so this would be an incompatible
> > change.
> 
> OK, the name of the variable is not important to me (the user can define
> his own variable anyway). Here's a revised patch:

Thanks.  The patch looks ok to me, but is lacking testsuite exposure and
NEWS update.  I'll let Eric decide if he wants this in before the
release, or at all, with the below squashed in, which is at least a
start at testsuite exposure.

Please note however that using this new feature may introduce
incompatibilites in a package tree where different Autoconf releases are
used.  For example, 2.61-generated configure scripts will reject and
fail upon --enable-c++, so somebody using your package in a subtree and
a 2.61-using package in another part of her subtree will be in trouble.

Actually, I think standards.texi should be updated to document which
characters exactly are acceptable in a FEATURE name, and the Autoconf
test suite updated to ensure we accept exactly those names.

Cheers,
Ralf

    * tests/base.at (AC_ARG_ENABLE and AC_ARG_WITH): New test.
    * NEWS: Update.

diff --git a/NEWS b/NEWS
index 207325e..9ceac53 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,10 @@ GNU Autoconf NEWS - User visible changes.
 ** AC_PROG_INSTALL correctly uses `shtool' again.  Regression introduced
    in 2.64.
 
+** 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/tests/base.at b/tests/base.at
index 5ce3e89..a3f6cca 100644
--- a/tests/base.at
+++ b/tests/base.at
@@ -347,6 +347,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 ##
 ## --------------------- ##




reply via email to

[Prev in Thread] Current Thread [Next in Thread]