[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: print warning for unrecognized --enable and --with options
From: |
Paul Eggert |
Subject: |
Re: print warning for unrecognized --enable and --with options |
Date: |
Mon, 18 Dec 2006 12:43:17 -0800 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux) |
Thanks for contributing that. I tightened up the wording
in the documentation, added a NEWS entry, fixed a bug in
status.m4 that caused a test failure, and a couple other
things like that, and installed the following:
2006-12-18 Paul Eggert <address@hidden>
* 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 <address@hidden>
* 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.
Index: NEWS
===================================================================
RCS file: /cvsroot/autoconf/autoconf/NEWS,v
retrieving revision 1.420
diff -u -r1.420 NEWS
--- NEWS 16 Dec 2006 19:09:51 -0000 1.420
+++ NEWS 18 Dec 2006 20:10:00 -0000
@@ -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
Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/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 18 Dec 2006 20:10:01 -0000
@@ -529,6 +529,7 @@
* 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 @@
* 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 @@
@address@hidden is equivalent to
@address@hidden
address@hidden scripts do not complain about
address@hidden@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
address@hidden@var{package}} options that they do not support.
address@hidden 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 @@
given, it defaults to @samp{yes}. @address@hidden is
equivalent to @address@hidden
address@hidden scripts do not complain about
address@hidden@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
address@hidden@var{package}} options that they do not support.
address@hidden 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 @@
@end defmac
address@hidden Option Checking
address@hidden Controlling Checking of @command{configure} Options
address@hidden 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
address@hidden halts with an error. However, by default unknown
address@hidden@var{package}} and @address@hidden
+options elicit only a warning, to support configuring entire source
+trees.
+
+Source trees often contain multiple packages with a top-level
address@hidden script that uses the @code{AC_CONFIG_SUBDIRS} macro
+(@pxref{Subdirectories}). Because the packages generally support
+different @address@hidden and
address@hidden@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
address@hidden or
address@hidden options to disable these
+warnings or turn them into fatal errors, respectively. Second, the
+maintainer can use @code{AC_DISABLE_OPTION_CHECKING}.
+
address@hidden AC_DISABLE_OPTION_CHECKING
address@hidden
+
+By default, disable warnings for unrecognized
address@hidden@var{package}} or @address@hidden
+options. This is implied by @code{AC_CONFIG_SUBDIRS}.
+
+The installer can override this behavior by passing
address@hidden (enable warnings) or
address@hidden (enable errors) to
address@hidden
address@hidden defmac
+
+
@node Site Details
@section Configuring Site Details
@cindex Site details
Index: lib/autoconf/general.m4
===================================================================
RCS file: /cvsroot/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 18 Dec 2006 20:10:01 -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
@@ -527,6 +528,8 @@
# 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 @@
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 @@
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_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 @@
])
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 @@
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: /cvsroot/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 18 Dec 2006 20:10:01 -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 -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no;
then
+ AC_MSG_WARN([Unrecognized options: $ac_unrecognized_opts])
+fi
])# AC_OUTPUT