From: Paul Eggert Date: Mon, 18 Dec 2006 20:10:05 +0000 (+0000) Subject: * NEWS: Warnings are now generated by default for unknown X-Git-Tag: v2.62~384 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2d75dbd53ee7989dbcefecb443a396f7364682fd;p=thirdparty%2Fautoconf.git * NEWS: Warnings are now generated by default for unknown --enable-* and --with-* options. * doc/autoconf.texi (Option Checking): Renamed from (Configure Option Checking). Tighten up the wording a bit. (External Software, Package Options): Cross-reference to Option Checking, and use this to shorten our section. * lib/autoconf/general.m4 (_AC_INIT_PARSE_ARGS): Prefer test -n "$x" to test "x$foo" != x. * lib/autoconf/status.m4 (AC_OUTPUT): Likewise. Don't warn if $enable_option_checking is "no". * lib/autoconf/general.m4 (_AC_INIT_PARSE_ARGS): Initialize ac_unrecognized_opts to the empty string. Don't echo the unrecognized opts, as this might mishandle backslashes or leading -. (AC_PRESERVE_HELP_ORDER): Put the --disable-option-checking usage next to the other --disable-FEATURE options in the help string. 2006-12-18 Steven G. Johnson * lib/autoconf/general.m4 (_AC_INIT_DEFAULTS, _AC_INIT_PARSE_ARGS): (_AC_INIT_PARSE_ENABLE2, _AC_INIT_HELP, _AC_ENABLE_IF): Print warning for unrecognized --with and --enable options (AC_DISABLE_OPTION_CHECKING): New macro to disable warnings. * lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS, _AC_OUTPUT_SUBDIRS): Disable option checking when subdirs are configured. (AC_OUTPUT): If warnings are enabled, print warning about unrecognized --with and --enable options at the end of the configure output (as well as at the beginning). * doc/autoconf.texi (Option Checking): New node. Document new option warning functionality. --- diff --git a/ChangeLog b/ChangeLog index 6ca52e96..ed018cac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,37 @@ +2006-12-18 Paul Eggert + + * NEWS: Warnings are now generated by default for unknown + --enable-* and --with-* options. + * doc/autoconf.texi (Option Checking): Renamed from + (Configure Option Checking). Tighten up the wording a bit. + (External Software, Package Options): Cross-reference to Option + Checking, and use this to shorten our section. + * lib/autoconf/general.m4 (_AC_INIT_PARSE_ARGS): Prefer test -n + "$x" to test "x$foo" != x. + * lib/autoconf/status.m4 (AC_OUTPUT): Likewise. + Don't warn if $enable_option_checking is "no". + * lib/autoconf/general.m4 (_AC_INIT_PARSE_ARGS): Initialize + ac_unrecognized_opts to the empty string. + Don't echo the unrecognized opts, as this might mishandle + backslashes or leading -. + (AC_PRESERVE_HELP_ORDER): Put the --disable-option-checking + usage next to the other --disable-FEATURE options in the + help string. + +2006-12-18 Steven G. Johnson + + * lib/autoconf/general.m4 (_AC_INIT_DEFAULTS, _AC_INIT_PARSE_ARGS): + (_AC_INIT_PARSE_ENABLE2, _AC_INIT_HELP, _AC_ENABLE_IF): + Print warning for unrecognized --with and --enable options + (AC_DISABLE_OPTION_CHECKING): New macro to disable warnings. + * lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS, _AC_OUTPUT_SUBDIRS): + Disable option checking when subdirs are configured. + (AC_OUTPUT): If warnings are enabled, print warning about + unrecognized --with and --enable options at the end of + the configure output (as well as at the beginning). + * doc/autoconf.texi (Option Checking): New node. + Document new option warning functionality. + 2006-12-16 Eric Blake * configure.ac (AC_INIT): Bump version, since 2.61a is released. diff --git a/NEWS b/NEWS index 92c9582f..d481dc68 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,11 @@ on some modern systems and could no longer be maintained reliably due to lack of ancient systems to test it on. +** Warnings are now generated by default when an installer invokes + 'configure' with an unknown --enable-* or --with-* option. + These warnings can be disabled with the new AC_DISABLE_OPTION_CHECKING + macro, or by invoking 'configure' with --disable-option-checking. + ** config.status now uses awk instead of sed for most substitutions, for speed. - As a side effect multi-line values of substituted variables no diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 98bf219b..b217075a 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -529,6 +529,7 @@ Site Configuration * External Software:: Working with other optional software * Package Options:: Selecting optional features * Pretty Help Strings:: Formatting help string +* Option Checking:: Controlling checking of @command{configure} options * Site Details:: Configuring site details * Transforming Names:: Changing program names when installing * Site Defaults:: Giving @command{configure} local defaults @@ -15445,6 +15446,7 @@ options. * External Software:: Working with other optional software * Package Options:: Selecting optional features * Pretty Help Strings:: Formatting help string +* Option Checking:: Controlling checking of @command{configure} options * Site Details:: Configuring site details * Transforming Names:: Changing program names when installing * Site Defaults:: Giving @command{configure} local defaults @@ -15515,14 +15517,10 @@ with. If no argument is given, it defaults to @samp{yes}. @option{--without-@var{package}} is equivalent to @option{--with-@var{package}=no}. -@command{configure} scripts do not complain about -@option{--with-@var{package}} options that they do not support. This -behavior permits configuring a source tree containing multiple packages -with a top-level @command{configure} script when the packages support -different options, without spurious error messages about options that -some of the packages support. An unfortunate side effect is that option -spelling errors are not diagnosed. No better approach to this problem -has been suggested so far. +Normally @command{configure} scripts complain about +@option{--with-@var{package}} options that they do not support. +@xref{Option Checking}, for details, and for how to override the +defaults. For each external software package that may be used, @file{configure.ac} should call @code{AC_ARG_WITH} to detect whether the @command{configure} @@ -15677,14 +15675,10 @@ argument looks like @option{--enable-debug=stabs}. If no argument is given, it defaults to @samp{yes}. @option{--disable-@var{feature}} is equivalent to @option{--enable-@var{feature}=no}. -@command{configure} scripts do not complain about -@option{--enable-@var{feature}} options that they do not support. -This behavior permits configuring a source tree containing multiple -packages with a top-level @command{configure} script when the packages -support different options, without spurious error messages about options -that some of the packages support. -An unfortunate side effect is that option spelling errors are not diagnosed. -No better approach to this problem has been suggested so far. +Normally @command{configure} scripts complain about +@option{--enable-@var{package}} options that they do not support. +@xref{Option Checking}, for details, and for how to override the +defaults. For each optional feature, @file{configure.ac} should call @code{AC_ARG_ENABLE} to detect whether the @command{configure} user asked @@ -15775,6 +15769,48 @@ AC_DEFUN([MY_ARG_WITH], @end defmac +@node Option Checking +@section Controlling Checking of @command{configure} Options +@cindex Options, Package + +The @command{configure} script checks its command-line options against a +list of known options, like @option{--help} or @option{--config-cache}. +An unknown option ordinarily indicates a mistake by the user and +@command{configure} halts with an error. However, by default unknown +@option{--with-@var{package}} and @option{--enable-@var{feature}} +options elicit only a warning, to support configuring entire source +trees. + +Source trees often contain multiple packages with a top-level +@command{configure} script that uses the @code{AC_CONFIG_SUBDIRS} macro +(@pxref{Subdirectories}). Because the packages generally support +different @option{--with-@var{package}} and +@option{--enable-@var{feature}} options, the @acronym{GNU} Coding +Standards say they must accept unrecognized options without halting. +Even a warning message is undesirable here, so @code{AC_CONFIG_SUBDIRS} +automatically disables the warnings. + +This default behavior may be modified in two ways. First, the installer +can invoke @command{configure} with the +@option{--disable-option-checking} or +@option{--enable-option-checking=fatal} options to disable these +warnings or turn them into fatal errors, respectively. Second, the +maintainer can use @code{AC_DISABLE_OPTION_CHECKING}. + +@defmac AC_DISABLE_OPTION_CHECKING +@acindex{DISABLE_OPTION_CHECKING} + +By default, disable warnings for unrecognized +@option{--with-@var{package}} or @option{--enable-@var{feature}} +options. This is implied by @code{AC_CONFIG_SUBDIRS}. + +The installer can override this behavior by passing +@option{--enable-option-checking} (enable warnings) or +@option{--enable-option-checking=fatal} (enable errors) to +@command{configure}. +@end defmac + + @node Site Details @section Configuring Site Details @cindex Site details diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 27bfa607..f4e1f443 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -409,6 +409,7 @@ m4_divert_pop([DEFAULTS])dnl m4_wrap([m4_divert_text([DEFAULTS], [ac_subst_vars='m4_ifdef([_AC_SUBST_VARS], [m4_defn([_AC_SUBST_VARS])])' ac_subst_files='m4_ifdef([_AC_SUBST_FILES], [m4_defn([_AC_SUBST_FILES])])' +ac_user_opts=':enable_option_checking:m4_ifdef([_AC_USER_OPTS], [m4_defn([_AC_USER_OPTS]):])' m4_ifdef([_AC_PRECIOUS_VARS], [_AC_ARG_VAR_STORE[]dnl _AC_ARG_VAR_VALIDATE[]dnl @@ -527,6 +528,8 @@ m4_define([_AC_INIT_PARSE_ARGS], # Initialize some variables set by options. ac_init_help= ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null @@ -878,6 +881,14 @@ if test -n "$ac_prev"; then AC_MSG_ERROR([missing argument to $ac_option]) fi +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) AC_MSG_ERROR([Unrecognized options: $ac_unrecognized_opts]) ;; + *) AC_MSG_WARN( [Unrecognized options: $ac_unrecognized_opts]) ;; + esac +fi + # Be sure to have absolute directory names. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ @@ -947,6 +958,11 @@ m4_define([_AC_INIT_PARSE_ENABLE2], AC_MSG_ERROR( [invalid ]m4_if([$2], [with], [package], [feature])[ name: $ac_useropt]) ac_useropt=`AS_ECHO(["$ac_useropt"]) | sed 's/[[-.]]/_/g'` + case $ac_user_opts in + *:$2_$ac_useropt:*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--$1-$ac_useropt" + ac_unrecognized_sep=', ';; + esac eval $2_$ac_useropt=m4_if([$1], [$2], [\$ac_optarg], [no]) ;;dnl ]) @@ -1355,6 +1371,7 @@ AC_LANG_PUSH(C) AC_DEFUN([AC_PRESERVE_HELP_ORDER], [m4_divert_once([HELP_ENABLE], [[ Optional Features and Packages: + --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1373,7 +1390,8 @@ _AC_ENABLE_IF_ACTION([$1], m4_translit([$2], [-.], [__]), [$3], [$4])[]dnl ]) m4_define([_AC_ENABLE_IF_ACTION], -[AS_IF([test "${$1_$2+set}" = set], [$1val=$$1_$2; $3], [$4])dnl +[m4_append_uniq([_AC_USER_OPTS], [$1_$2], [:])dnl +AS_IF([test "${$1_$2+set}" = set], [$1val=$$1_$2; $3], [$4])dnl ]) # AC_ARG_ENABLE(FEATURE, HELP-STRING, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) @@ -1410,6 +1428,11 @@ _AC_ENABLE_IF([with], [$1], [$3], [$4])dnl AU_DEFUN([AC_WITH], [AC_ARG_WITH([$1], [ --with-$1], [$2], [$3])]) +# AC_DISABLE_OPTION_CHECKING +# -------------------------------------------------------------------- +AC_DEFUN([AC_DISABLE_OPTION_CHECKING], +[m4_divert_once([DEFAULTS], [enable_option_checking=no]) +])# AC_DISABLE_OPTION_CHECKING ## ----------------------------------------- ## diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4 index a03d006f..75e8e912 100644 --- a/lib/autoconf/status.m4 +++ b/lib/autoconf/status.m4 @@ -987,6 +987,7 @@ m4_define([AC_OUTPUT_COMMANDS_POST]) # This is used in _AC_OUTPUT_SUBDIRS. AC_DEFUN([AC_CONFIG_SUBDIRS], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +AC_REQUIRE([AC_DISABLE_OPTION_CHECKING])dnl m4_foreach_w([_AC_Sub], [$1], [_AC_CONFIG_UNIQUE([SUBDIRS], m4_bpatsubst(m4_defn([_AC_Sub]), [:.*]))])dnl @@ -1009,7 +1010,8 @@ m4_define([_AC_OUTPUT_SUBDIRS], # if test "$no_recursion" != yes; then - # Remove --cache-file and --srcdir arguments so they do not pile up. + # Remove --cache-file, --srcdir, and --disable-option-checking arguments + # so they do not pile up. ac_sub_configure_args= ac_prev= eval "set x $ac_configure_args" @@ -1038,6 +1040,8 @@ if test "$no_recursion" != yes; then ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) ;; + --disable-option-checking) + ;; *) case $ac_arg in *\'*) ac_arg=`AS_ECHO(["$ac_arg"]) | sed "s/'/'\\\\\\\\''/g"` ;; @@ -1059,6 +1063,10 @@ if test "$no_recursion" != yes; then ac_sub_configure_args="--silent $ac_sub_configure_args" fi + # Always prepend --disable-option-checking to silence warnings, since + # different subdirs can have different --enable and --with options. + ac_sub_configure_args="--disable-option-checking $ac_sub_configure_args" + ac_popdir=`pwd` for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue @@ -1186,6 +1194,9 @@ if test "$no_create" != yes; then fi dnl config.status should not do recursion. AC_PROVIDE_IFELSE([AC_CONFIG_SUBDIRS], [_AC_OUTPUT_SUBDIRS()])dnl +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + AC_MSG_WARN([Unrecognized options: $ac_unrecognized_opts]) +fi ])# AC_OUTPUT