Index: doc/autoconf.texi =================================================================== RCS file: /sources/autoconf/autoconf/doc/autoconf.texi,v retrieving revision 1.1119 diff -u -r1.1119 autoconf.texi --- doc/autoconf.texi 15 Dec 2006 18:25:23 -0000 1.1119 +++ doc/autoconf.texi 16 Dec 2006 23:33:06 -0000 @@ -529,6 +529,7 @@ * External Software:: Working with other optional software * Package Options:: Selecting optional features * Pretty Help Strings:: Formatting help string +* Configure Option Checking:: Controlling checking of 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 @@ * External Software:: Working with other optional software * Package Options:: Selecting optional features * Pretty Help Strings:: Formatting help string +* Configure Option Checking:: Controlling checking of configure options * Site Details:: Configuring site details * Transforming Names:: Changing program names when installing * Site Defaults:: Giving @command{configure} local defaults @@ -15515,14 +15517,15 @@ @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. +By default, @command{configure} scripts print a warning for +@option{--with-@var{package}} options that they do not support. They do +not halt with an error in order to support configuring a source tree +containing multiple packages with a top-level @command{configure} script +when the packages support different options. Furthermore, these +warnings may be suppressed by the @option{--disable-option-checking} +option or by calling @code{AC_DISABLE_OPTION_CHECKING} in +@file{configure.ac}; this is the default if @code{AC_CONFIG_SUBDIRS} is +called. 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 +15680,15 @@ 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. +By default, @command{configure} scripts print a warning for +@option{--enable-@var{feature}} options that they do not support. They do +not halt with an error in order to support configuring a source tree +containing multiple packages with a top-level @command{configure} script +when the packages support different options. Furthermore, these +warnings may be suppressed by the @option{--disable-option-checking} +option or by calling @code{AC_DISABLE_OPTION_CHECKING} in +@file{configure.ac}; this is the default if @code{AC_CONFIG_SUBDIRS} is +called. For each optional feature, @file{configure.ac} should call @code{AC_ARG_ENABLE} to detect whether the @command{configure} user asked @@ -15775,6 +15779,51 @@ @end defmac +@node Configure Option Checking +@section Controlling Checking of Configure Options +@cindex Options, Package + +The @command{configure} script checks the command-line options that are +passed to it against a list of known options, like @option{--help} or +@option{--config-cache}. If an unknown option is passed, this +ordinarily indicates a mistake by the user and @command{configure} halts +with an error. However, for unknown @option{--with-@var{package}} or +@option{--enable-@var{feature}} options, by default only a warning +message is printed (both at the beginning and end of the configure +output). The reason for this behavior and how it may be modified are +as follows. + +It not uncommon to configure a source tree containing multiple packages +with a top-level @command{configure} script, via the +@code{AC_CONFIG_SUBDIRS} macro. Because the packages generally support +different @option{--with-@var{package}} and +@option{--enable-@var{feature}} options, however, they must accept +unrecognized options without halting. (For the same reason, this +behavior is required by the GNU Coding Standards.) In such cases, even +a warning message is undesirable, and so @code{AC_CONFIG_SUBDIRS} +automatically disables the warnings. + +This behavior may be modified in two other ways. First, the user can +pass @option{--disable-option-checking} to @command{configure} in order +to disable the warnings, or conversely +@option{--enable-option-checking=fatal} makes @command{configure} halt +with an error for unrecognized options. Second, the @file{configure.ac} +file may call @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 user may still 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 Index: lib/autoconf/general.m4 =================================================================== RCS file: /sources/autoconf/autoconf/lib/autoconf/general.m4,v retrieving revision 1.943 diff -u -r1.943 general.m4 --- lib/autoconf/general.m4 15 Dec 2006 18:25:23 -0000 1.943 +++ lib/autoconf/general.m4 16 Dec 2006 23:33:06 -0000 @@ -409,6 +409,7 @@ 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 @@ -878,6 +879,15 @@ AC_MSG_ERROR([missing argument to $ac_option]) fi +if test "x$ac_unrecognized_opts" != x; then + ac_unrecognized_opts=`echo $ac_unrecognized_opts | sed 's/^, //'` + case $enable_option_checking in + no) ac_unrecognized_opts="" ;; + 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 +957,10 @@ 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, --$1-$ac_useropt" ;; + esac eval $2_$ac_useropt=m4_if([$1], [$2], [\$ac_optarg], [no]) ;;dnl ]) @@ -985,6 +999,7 @@ -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] + --disable-option-checking ignore unrecognized --enable/--with options Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX @@ -1373,7 +1388,8 @@ ]) 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 +1426,11 @@ 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 ## ----------------------------------------- ## Index: lib/autoconf/status.m4 =================================================================== RCS file: /sources/autoconf/autoconf/lib/autoconf/status.m4,v retrieving revision 1.124 diff -u -r1.124 status.m4 --- lib/autoconf/status.m4 7 Dec 2006 05:16:59 -0000 1.124 +++ lib/autoconf/status.m4 16 Dec 2006 23:33:06 -0000 @@ -987,6 +987,7 @@ # 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 @@ # 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 @@ 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 @@ 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 @@ fi dnl config.status should not do recursion. AC_PROVIDE_IFELSE([AC_CONFIG_SUBDIRS], [_AC_OUTPUT_SUBDIRS()])dnl +if test "x$ac_unrecognized_opts" != x; then + AC_MSG_WARN([Unrecognized options: $ac_unrecognized_opts]) +fi ])# AC_OUTPUT