[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature request: allow plus signs in AC_ARG_ENABLE
From: |
Bruno Haible |
Subject: |
feature request: allow plus signs in AC_ARG_ENABLE |
Date: |
Sat, 13 Mar 2010 17:27:10 +0100 |
User-agent: |
KMail/1.9.9 |
Hi,
AC_ARG_ENABLE is documented to accept options only consisting of
"alphanumeric characters, dashes, and dots". I would like to write
AC_MSG_CHECKING([whether to use C++])
AC_ARG_ENABLE([c++],
[ --disable-c++ do not build C++ sources],
[CXX_CHOICE="$enableval"],
[CXX_CHOICE=yes])
AC_MSG_RESULT([$CXX_CHOICE])
AC_SUBST([CXX_CHOICE])
but it does not work. How to reproduce:
========================= configure.ac =========================
AC_INIT
AC_MSG_CHECKING([whether to use C++])
AC_ARG_ENABLE([c++],
[ --disable-c++ do not build C++ sources],
[CXX_CHOICE="$enableval"],
[CXX_CHOICE=yes])
AC_MSG_RESULT([$CXX_CHOICE])
AC_OUTPUT
================================================================
$ autoconf
$ ./configure --disable-c++
configure: WARNING: unrecognized options: --disable-c++
checking whether to use C++... yes
configure: creating ./config.status
configure: WARNING: unrecognized options: --disable-c++
Expected output:
$ ./configure --disable-c++
checking whether to use C++... no
configure: creating ./config.status
Here is a proposed patch. Note that in _AC_INIT_PARSE_ENABLE2 was
already handled, by converting it to an underscore, but that is only half
of the needed job.
2010-03-13 Bruno Haible <address@hidden>
* 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_INIT_PARSE_ENABLE2): Convert a plus sign
in a package or feature to an x.
(_AC_ENABLE_IF): Also replace '+' with 'x'.
--- doc/autoconf.texi.orig Sat Mar 13 17:23:43 2010
+++ doc/autoconf.texi Sat Mar 13 17:08:54 2010
@@ -20496,7 +20496,8 @@
The option's argument is available to the shell commands
@var{action-if-given} in the shell variable @code{withval}, which is
actually just the value of the shell variable named
address@hidden@var{package}}, with any non-alphanumeric characters in
address@hidden@var{package}}, with plus signs in @var{package} changed into
address@hidden and any other non-alphanumeric characters in
@var{package} changed into @samp{_}. You may use that variable instead,
if you wish.
@@ -20643,12 +20644,13 @@
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
actually just the value of the shell variable named
address@hidden@var{feature}}, with any non-alphanumeric characters in
address@hidden@var{feature}}, with plus signs in @var{feature} changed
+into @samp{x} and any other non-alphanumeric characters in
@var{feature} changed into @samp{_}. You may use that variable instead,
if you wish. The @var{help-string} argument is like that of
@code{AC_ARG_WITH} (@pxref{External Software}).
--- lib/autoconf/general.m4.orig Sat Mar 13 17:23:43 2010
+++ lib/autoconf/general.m4 Sat Mar 13 17:23:02 2010
@@ -986,7 +986,7 @@
AC_MSG_ERROR(
[invalid ]m4_if([$2], [with], [package], [feature])[ name: $ac_useropt])
ac_useropt_orig=$ac_useropt
- ac_useropt=`AS_ECHO(["$ac_useropt"]) | sed 's/[[-+.]]/_/g'`
+ ac_useropt=`AS_ECHO(["$ac_useropt"]) | sed -e 's/[[+]]/x/g' -e
's/[[-.]]/_/g'`
case $ac_user_opts in
*"
"$2_$ac_useropt"
@@ -1440,7 +1440,7 @@
#
m4_define([_AC_ENABLE_IF],
address@hidden:@ Check whether --$1-$2 was given.
-_AC_ENABLE_IF_ACTION([$1], m4_translit([$2], [-.], [__]), [$3], [$4])
+_AC_ENABLE_IF_ACTION([$1], m4_translit([$2], [+-.], [x__]), [$3], [$4])
])
m4_define([_AC_ENABLE_IF_ACTION],
- feature request: allow plus signs in AC_ARG_ENABLE,
Bruno Haible <=