Currently, configure ignores unknown --enable/disable/with/without
options. Personally I find this behaviour annoying, so here is a patch
that fixes it. Example:

$ ./configure --enable-depends
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
<snip>
checking whether to build with Bonjour support... no
checking whether to build with OpenSSL support... no
*** Unknown feature: enable_depends ***
$

Now, while the error message could do with some help (feedback welcome)
I personally find this to be quite useful.

This patch will detect any argument that isn't declared using one of
the PGAC_ARG macros. This means that if there are any other
--enable/with arguments we accept but don't declare, this will barf on
them too. Do we have any of those? If so, we should document them
somewhere, if necessary creating a PGAC_ARG_HIDDEN so they can pass
this test.

Have a nice day,
-- 
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to 
> litigate.
Index: configure.in
===================================================================
RCS file: /projects/cvsroot/pgsql/configure.in,v
retrieving revision 1.460
diff -u -r1.460 configure.in
--- configure.in        22 Apr 2006 00:29:41 -0000      1.460
+++ configure.in        4 May 2006 10:41:18 -0000
@@ -516,6 +516,12 @@
 AC_SUBST(with_zlib)
 
 #
+# Check user hasn't passed any strange args
+#
+
+PGAC_CHECK_ARGS
+
+#
 # Elf
 #
 
Index: config/general.m4
===================================================================
RCS file: /projects/cvsroot/pgsql/config/general.m4,v
retrieving revision 1.3
diff -u -r1.3 general.m4
--- config/general.m4   29 Nov 2003 19:51:17 -0000      1.3
+++ config/general.m4   4 May 2006 10:41:18 -0000
@@ -16,6 +16,9 @@
 m4_define([pgac_arg_to_variable],
           [$1[]_[]patsubst($2, -, _)])
 
+# This is the divert which we store all declared 'with' and 'enable'
+# arguments for use with PGAC_CHECK_ARGS
+m4_define([_m4_divert(PGAC_ARGS)],     5432)
 
 # PGAC_ARG(TYPE, NAME, HELP-STRING,
 #          [ACTION-IF-YES], [ACTION-IF-NO], [ACTION-IF-ARG],
@@ -28,6 +31,7 @@
 
 AC_DEFUN([PGAC_ARG],
 [
+m4_divert_text([PGAC_ARGS],[pgac_arg_to_variable([$1],[$2])) ;;])
 m4_case([$1],
 
 enable, [
@@ -68,6 +72,24 @@
 )
 ])# PGAC_ARG
 
+# PGAC_CHECK_ARGS()
+# -----------------
+# Checks if the user passed any --with/without/enable/disable arguments that
+# we don't recognise. This should be called shortly after the last PGAC_ARG*
+# macro in configure.in
+
+AC_DEFUN([PGAC_CHECK_ARGS],
+[
+  for var in `set |sed -ne '/^\(with_\|enable\_\)/ s/=.*//p'` ; do
+     case $var in
+       m4_undivert([PGAC_ARGS])
+     *)
+       echo "*** Unknown feature: $var ***"
+       exit
+       ;;
+     esac
+  done
+])# PGAC_CHECK_ARGS
 
 # PGAC_ARG_BOOL(TYPE, NAME, DEFAULT, HELP-STRING, 
 #               [ACTION-IF-YES], [ACTION-IF-NO])

Attachment: signature.asc
Description: Digital signature

Reply via email to