autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Manual handling of arguments


From: Ralf Wildenhues
Subject: Re: Manual handling of arguments
Date: Tue, 21 Aug 2007 20:30:56 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

Hello Olaf, and sorry for the delay,

> * Olaf Lenz wrote on Fri, Jul 06, 2007 at 02:57:40PM CEST:
> > 
> > I'm experiencing some problems with autoconf 2.61. With autoconf 2.59,
> > everything was fine. I'm not sure whether this is a bug in the program
> > or just in the documentation.
> [...]
> > In the script, I'm trying to use the arguments to the configure script
> > "$@" directly after AC_INIT was called. Unfortunately, with autoconf
> > 2.61, it has already been altered (by some code concerning the
> > "config.site"-file). Therefore it is not possible anymore to do some
> > option processing manually.

Here's a patch to try, including a test to help ensure that we don't
regress here again.  OK to apply?

FWIW, the test isn't as good as it could be: through diversion, code
can be pushed up to the initialization stage due to macros invoked
later.  I don't see a good way to guard for future code (that could
be in a new macro that uses diversions) and I didn't find at a rough
glance any other existing macro in Autoconf that could break this.

Cheers,
Ralf

        * lib/autoconf/general.m4 (AC_SITE_LOAD): Do not overwrite "$@"
        here, this macro is expanded by AC_INIT.  Fixes 2.60 regression.
        * tests/base.at (configure arguments): New test.
        Report by Olaf Lenz <address@hidden>.

Index: lib/autoconf/general.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/general.m4,v
retrieving revision 1.953
diff -u -r1.953 general.m4
--- lib/autoconf/general.m4     21 Aug 2007 17:32:39 -0000      1.953
+++ lib/autoconf/general.m4     21 Aug 2007 18:19:53 -0000
@@ -1805,20 +1805,23 @@
 
 # AC_SITE_LOAD
 # ------------
-# Look for site or system specific initialization scripts.
+# Look for site- or system-specific initialization scripts.
 m4_define([AC_SITE_LOAD],
-[# Prefer explicitly selected file to automatically selected ones.
+[# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
 if test -n "$CONFIG_SITE"; then
-  set x "$CONFIG_SITE"
+  ac_site_file1=$CONFIG_SITE
 elif test "x$prefix" != xNONE; then
-  set x "$prefix/share/config.site" "$prefix/etc/config.site"
+  ac_site_file1=$prefix/share/config.site
+  ac_site_file2=$prefix/etc/config.site
 else
-  set x "$ac_default_prefix/share/config.site" \
-       "$ac_default_prefix/etc/config.site"
+  ac_site_file1=$ac_default_prefix/share/config.site
+  ac_site_file2=$ac_default_prefix/etc/config.site
 fi
-shift
-for ac_site_file
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
 do
+  test "$ac_site_file" = NONE && continue
   if test -r "$ac_site_file"; then
     AC_MSG_NOTICE([loading site script $ac_site_file])
     sed 's/^/| /' "$ac_site_file" >&AS_MESSAGE_LOG_FD
Index: tests/base.at
===================================================================
RCS file: /cvsroot/autoconf/autoconf/tests/base.at,v
retrieving revision 1.43
diff -u -r1.43 base.at
--- tests/base.at       20 Jul 2007 23:11:54 -0000      1.43
+++ tests/base.at       21 Aug 2007 18:19:53 -0000
@@ -289,3 +289,21 @@
 AT_CHECK([echo Hello | top_srcdir=$abs_top_srcdir ./configure --silent])
 
 AT_CLEANUP
+
+
+## ------------------- ##
+## configure arguments ##
+## ------------------- ##
+
+AT_SETUP([configure arguments])
+
+AT_DATA([configure.ac],
+[[AC_INIT
+echo "$@"
+]])
+
+AT_CHECK_AUTOCONF
+AT_CHECK_CONFIGURE([FOO=bar --enable-baz --without-zork --silent], [0], 
[stdout], [ignore])
+AT_CHECK([grep 'FOO=bar --enable-baz --without-zork --silent' stdout], [0], 
[ignore], [ignore])
+
+AT_CLEANUP




reply via email to

[Prev in Thread] Current Thread [Next in Thread]