I habitually do something like this anyway (duplicated for every variable I mangle in configure):
orig_CFLAGS="$CFLAGS"
[detect some stuff...]
CFLAGS="$foo_CFLAGS $bar_CFLAGS $orig_CFLAGS"
[detect some more stuff...]
CFLAGS="$foo_CFLAGS $bar_CFLAGS $baz_CFLAGS $orig_CFLAGS"
Since that's the only sane way I can come up with to make 'CFLAGS=foo ./configure' work, and still keep a complicated configure.ac readable. So I'd just AC_SUBST(orig_CFLAGS) and stuff that into DISTCHECK_CONFIGURE_FLAGS, under the assumption that the configure script is supposed to sort it out given that input.
This is the scheme I plan on using to pass the key "environment" variables to the Makefile:
for var in CC CFLAGS CPPFLAGS CXX CXXCPP LDFLAGS LIBS ; do eval isset=$\{`echo $var`'+set'\} if test "$isset" = 'set' ; then eval val=$`echo $var` DISTCHECK_CONFIG_FLAGS="${DISTCHECK_CONFIG_FLAGS}'${var}=${val}' " fi done AC_SUBST(DISTCHECK_CONFIG_FLAGS)
The chunk of code is placed shortly after AC_INIT. Probably there is some better syntax but it seems to work.
The old days of Autoconf you couldn't specify environment variables as configure arguments. If you set them in the shell environment, this situation wouldn't exist since subordinate configures would pick them up. If you set them only in configure's environment, then the problem would exist.
Perhaps there is some reason why Automake shouldn't assure that these values are passed to subordinate distcheck configures, but I can't think of one.
Bob ====================================== Bob Friesenhahn [EMAIL PROTECTED] http://www.simplesystems.org/users/bfriesen