Hello,
On Thu, Nov 16, 2006 at 04:38:30PM -0800, Paul Eggert wrote:
> I installed this to fix some bugs introduced by the
> <http://lists.gnu.org/archive/html/autoconf-patches/2006-11/msg00020.html>
> patch:
>
> 2006-11-16 Paul Eggert <[EMAIL PROTECTED]>
>
> * lib/autoconf/general.m4 (_AC_INIT_PARSE_ENABLE): Fix some typos
> in previous change, which caused test failures.
thanks you for fixing the bug introduced by my previous patch.
But I feel a more elegant/readable variant might be possible.
What about the following variation?
(I have run make check this time. ;-)
Have a nice day,
Stepan Kasal
2006-12-06 Stepan Kasal <[EMAIL PROTECTED]>
* lib/autoconf/general.m4 (_AC_INIT_PARSE_ENABLE): Make it
more readable, using ...
(_AC_INIT_PARSE_ENABLE2): ... this new helper macro.
Index: lib/autoconf/general.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/general.m4,v
retrieving revision 1.941
diff -u -r1.941 general.m4
--- lib/autoconf/general.m4 28 Nov 2006 06:20:17 -0000 1.941
+++ lib/autoconf/general.m4 6 Dec 2006 14:26:19 -0000
@@ -626,7 +626,7 @@
| --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
datarootdir=$ac_optarg ;;
- _AC_INIT_PARSE_ENABLE([disable], [feature], [no])
+ _AC_INIT_PARSE_ENABLE([disable])
-docdir | --docdir | --docdi | --doc | --do)
ac_prev=docdir ;;
@@ -638,7 +638,7 @@
-dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
dvidir=$ac_optarg ;;
- _AC_INIT_PARSE_ENABLE([enable], [feature], [\$ac_optarg])
+ _AC_INIT_PARSE_ENABLE([enable])
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -828,9 +828,9 @@
-version | --version | --versio | --versi | --vers | -V)
ac_init_version=: ;;
- _AC_INIT_PARSE_ENABLE([with], [package], [\$ac_optarg])
+ _AC_INIT_PARSE_ENABLE([with])
- _AC_INIT_PARSE_ENABLE([without], [package], [no])
+ _AC_INIT_PARSE_ENABLE([without])
--x)
# Obsolete; use --with-x.
@@ -919,18 +919,35 @@
])# _AC_INIT_PARSE_ARGS
-# _AC_INIT_PARSE_ENABLE(OPTION-NAME, FEATURE, VALUE)
+# _AC_INIT_PARSE_ENABLE(OPTION-NAME)
+# ----------------------------------
+# A trivial front-end for _AC_INIT_PARSE_ENABLE2.
+#
+m4_define([_AC_INIT_PARSE_ENABLE],
+[m4_bmatch([$1], [^with],
+ [_AC_INIT_PARSE_ENABLE2([$1], [with])],
+ [_AC_INIT_PARSE_ENABLE2([$1], [enable])])])
+
+
+# _AC_INIT_PARSE_ENABLE2(OPTION-NAME, POSITIVE-NAME)
# --------------------------------------------------
# Handle an `--enable' or a `--with' option.
#
-m4_define([_AC_INIT_PARSE_ENABLE],
+# OPTION-NAME is `enable', `disable', `with', or `without'.
+# POSITIVE-NAME is the corresponding positive variant, i.e. `enable' or `with'.
+#
+# Positive variant of the option is recognized by the condition
+# OPTION-NAME == POSITIVE-NAME .
+#
+m4_define([_AC_INIT_PARSE_ENABLE2],
[-$1-* | --$1-*)
- ac_$2=`expr "x$ac_option" : 'x-*$1-\(m4_bmatch([$1], [^\(enable\|with\)$],
[[[^=]]], [.])*\)'`
+ ac_useropt=`expr "x$ac_option" : 'x-*$1-\(m4_if([$1], [$2], [[[^=]]],
[.])*\)'`
# Reject names that are not valid shell variable names.
- expr "x$ac_$2" : "[.*[^-._$as_cr_alnum]]" >/dev/null &&
- AC_MSG_ERROR([invalid $2 name: $ac_$2])
- ac_$2=`AS_ECHO(["$ac_$2"]) | sed 's/[[-.]]/_/g'`
- eval m4_bmatch([$1], [^\(enable\|disable\)$], [enable], [with])_$ac_$2=$3
;;dnl
+ expr "x$ac_useropt" : "[.*[^-._$as_cr_alnum]]" >/dev/null &&
+ AC_MSG_ERROR(
+ [invalid ]m4_if([$2], [with], [package], [feature])[ name: $ac_useropt])
+ ac_useropt=`AS_ECHO(["$ac_useropt"]) | sed 's/[[-.]]/_/g'`
+ eval $2_$ac_useropt=m4_if([$1], [$2], [\$ac_optarg], [no]) ;;dnl
])