]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* lib/autoconf/general.m4 (_AC_INIT_PARSE_ARGS): Factor out
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 17 Nov 2006 00:16:27 +0000 (00:16 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 17 Nov 2006 00:16:27 +0000 (00:16 +0000)
code for --enable, --disable, --with, and --without to...
(_AC_INIT_PARSE_ENABLE): ... a new macro.
* doc/autoconf.texi (Package Options):
* NEWS: Document that AC_ARG_ENABLE allows dots, too.

ChangeLog
NEWS
doc/autoconf.texi
lib/autoconf/general.m4

index 79c0f5456a3d3f4b032e013d7e845582a2f43f8f..e2815f59b4031b6f45537aa5e455d5bd20dc9cb4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-11-16  Stepan Kasal  <kasal@ucw.cz>
+
+       * lib/autoconf/general.m4 (_AC_INIT_PARSE_ARGS): Factor out
+       code for --enable, --disable, --with, and --without to...
+       (_AC_INIT_PARSE_ENABLE): ... a new macro.
+       * doc/autoconf.texi (Package Options):
+       * NEWS: Document that AC_ARG_ENABLE allows dots, too.
+
 2006-11-16  Paul Eggert  <eggert@cs.ucla.edu>
 
        Import these changes from config via gnulib:
diff --git a/NEWS b/NEWS
index b6546658df684d3b11791950f9fc390141eaa29e..6881b14dc7fb0bbad5eb6af573b1481cebbb945a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -21,7 +21,7 @@
 
 ** New macros AC_C_FLEXIBLE_ARRAY_MEMBER, AC_C_VARARRAYS.
 
-** AC_ARG_WITH now allows '.' in package names.
+** AC_ARG_ENABLE and AC_ARG_WITH now allow '.' in feature and package names.
 
 ** AC_CHECK_DECL now also works with aggregate objects.
 
index ae1178061acdd1bc60d7652c7ab93c1247d46b82..adecc7a6691b882a83b224680429b5e933a4d504 100644 (file)
@@ -15688,12 +15688,12 @@ 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 and dashes.
+alphanumeric characters, dashes, 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
-@code{enable_@var{feature}}, with any @option{-} characters changed into
+@code{enable_@var{feature}}, with any non-alphanumeric characters 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}).
index 3f5b4595937793692941c16a80e30b74ef8f4104..cf7cd2cb87ec4ccf2bfcc2a3a04e10189ee356e0 100644 (file)
@@ -626,13 +626,7 @@ do
   | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
     datarootdir=$ac_optarg ;;
 
-  -disable-* | --disable-*)
-    ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
-    # Reject names that are not valid shell variable names.
-    expr "x$ac_feature" : "[.*[^-_$as_cr_alnum]]" >/dev/null &&
-      AC_MSG_ERROR([invalid feature name: $ac_feature])
-    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
-    eval enable_$ac_feature=no ;;
+  _AC_INIT_PARSE_ENABLE([disable], [feature], [no])
 
   -docdir | --docdir | --docdi | --doc | --do)
     ac_prev=docdir ;;
@@ -644,13 +638,7 @@ do
   -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
     dvidir=$ac_optarg ;;
 
-  -enable-* | --enable-*)
-    ac_feature=`expr "x$ac_option" : 'x-*enable-\([[^=]]*\)'`
-    # Reject names that are not valid shell variable names.
-    expr "x$ac_feature" : "[.*[^-_$as_cr_alnum]]" >/dev/null &&
-      AC_MSG_ERROR([invalid feature name: $ac_feature])
-    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
-    eval enable_$ac_feature=\$ac_optarg ;;
+  _AC_INIT_PARSE_ENABLE([enable], [feature], [\$ac_optarg])
 
   -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
   | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -840,21 +828,9 @@ do
   -version | --version | --versio | --versi | --vers | -V)
     ac_init_version=: ;;
 
-  -with-* | --with-*)
-    ac_package=`expr "x$ac_option" : 'x-*with-\([[^=]]*\)'`
-    # Reject names that are not valid shell variable names.
-    expr "x$ac_package" : "[.*[^-._$as_cr_alnum]]" >/dev/null &&
-      AC_MSG_ERROR([invalid package name: $ac_package])
-    [ac_package=`echo $ac_package | sed 's/[-.]/_/g'`]
-    eval with_$ac_package=\$ac_optarg ;;
+  _AC_INIT_PARSE_ENABLE([with],    [package], [\$ac_optarg])
 
-  -without-* | --without-*)
-    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
-    # Reject names that are not valid shell variable names.
-    expr "x$ac_package" : "[.*[^-._$as_cr_alnum]]" >/dev/null &&
-      AC_MSG_ERROR([invalid package name: $ac_package])
-    [ac_package=`echo $ac_package | sed 's/[-.]/_/g'`]
-    eval with_$ac_package=no ;;
+  _AC_INIT_PARSE_ENABLE([without], [package], [no])
 
   --x)
     # Obsolete; use --with-x.
@@ -943,6 +919,21 @@ m4_divert_pop([PARSE_ARGS])dnl
 ])# _AC_INIT_PARSE_ARGS
 
 
+# _AC_INIT_PARSE_ENABLE(OPTION-NAME, FEATURE, VALUE)
+# --------------------------------------------------
+# Handle an `--enable' or a `--with' option.
+#
+m4_define([_AC_INIT_PARSE_ENABLE],
+[-$1-* | --$1-*)
+    ac_$2=`expr "x$ac_option" : 'x-*$1-\(.*\)'`
+    # 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=`echo $ac_$2 | sed 's/[-.]/_/g'`]
+    eval with_$ac_$2=$3 ;;dnl
+])
+
+
 # _AC_INIT_HELP
 # -------------
 # Handle the `configure --help' message.