2006-11-14 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. Index: NEWS =================================================================== RCS file: /cvsroot/autoconf/autoconf/NEWS,v retrieving revision 1.410 diff -u -r1.410 NEWS --- NEWS 13 Nov 2006 20:40:06 -0000 1.410 +++ NEWS 14 Nov 2006 10:49:04 -0000 @@ -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: doc/autoconf.texi =================================================================== RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v retrieving revision 1.1106 diff -u -r1.1106 autoconf.texi --- doc/autoconf.texi 13 Nov 2006 20:40:06 -0000 1.1106 +++ doc/autoconf.texi 14 Nov 2006 10:49:31 -0000 @@ -15688,12 +15688,12 @@ 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 address@hidden@var{feature}}, with any @option{-} characters changed into address@hidden@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: lib/autoconf/general.m4 =================================================================== RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/general.m4,v retrieving revision 1.937 diff -u -r1.937 general.m4 --- lib/autoconf/general.m4 13 Nov 2006 20:40:06 -0000 1.937 +++ lib/autoconf/general.m4 14 Nov 2006 10:49:33 -0000 @@ -626,13 +626,7 @@ | --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 @@ -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 @@ -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 @@ ])# _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.