]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* lib/autoconf/general.m4 (_AC_INIT_PARSE_ENABLE): Make it
authorStepan Kasal <kasal@ucw.cz>
Wed, 6 Dec 2006 21:17:48 +0000 (21:17 +0000)
committerStepan Kasal <kasal@ucw.cz>
Wed, 6 Dec 2006 21:17:48 +0000 (21:17 +0000)
more readable, using ...
(_AC_INIT_PARSE_ENABLE2): ... this new helper macro.

ChangeLog
lib/autoconf/general.m4

index 8375769a7f9913ae9d123539e6874a60ca97afb1..73fa963419f3eb79ff57d7aa26a6803c52db39f7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2006-12-06  Stepan Kasal  <kasal@ucw.cz>
 
+       * lib/autoconf/general.m4 (_AC_INIT_PARSE_ENABLE): Make it
+       more readable, using ...
+       (_AC_INIT_PARSE_ENABLE2): ... this new helper macro.
+
        * doc/autoconf.texi (autoheader Invocation): Do not double-
        quote the parameter of `AH_BOTTOM' in the example.
 
index 12de53bf4e70f4e87bc54c8d0a7738ab05e949b0..0cd1e7bdd5c268eefd9c4d1eb79b31099ea28de1 100644 (file)
@@ -626,7 +626,7 @@ do
   | --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 @@ do
   -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 @@ do
   -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 @@ m4_divert_pop([PARSE_ARGS])dnl
 ])# _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
 ])