From ac3beb315576b095e27f9e56654cf0c6e4c701d9 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 17 Nov 2006 00:16:27 +0000 Subject: [PATCH] * 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. --- ChangeLog | 8 ++++++++ NEWS | 2 +- doc/autoconf.texi | 4 ++-- lib/autoconf/general.m4 | 47 +++++++++++++++++++---------------------------- 4 files changed, 30 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index 79c0f545..e2815f59 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-11-16 Stepan Kasal + + * 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 Import these changes from config via gnulib: diff --git a/NEWS b/NEWS index b6546658..6881b14d 100644 --- 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. diff --git a/doc/autoconf.texi b/doc/autoconf.texi index ae117806..adecc7a6 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -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}). diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 3f5b4595..cf7cd2cb 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -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. -- 2.11.4.GIT