The recreate behaves as I expect if I modify gl_ABSOLUTE_HEADER to use AC_CHECK_HEADERS instead of AC_CHECK_HEADERS_ONCE.
-Rhys On Thu, Aug 14, 2008 at 11:47 AM, Rhys Ulerich <[EMAIL PROTECTED]>wrote: > Hi, > > We found an odd side effect of gnulib's absolute_header.m4 over on the > Autoconf mailing list ( > http://lists.gnu.org/archive/html/autoconf/2008-08/msg00024.html). Within > an Autoconf macro, modifying CPPFLAGS, calling AC_CHECK_HEADER, and then > calling gl_ABSOLUTE_HEADER prevents the header check from using the updated > CPPFLAGS value. > > The expansion of gl_ABSOLUTE_HEADER causes the function look for the header > before CPPFLAGS is modified. Then, after CPPFLAGS changes and > AC_CHECK_HEADER does occur, the previously cached "no" result is used. > > A recreate: > 1. Snag absolute_header.m4 from > http://cvs.savannah.gnu.org/viewvc/*checkout*/gnulib/m4/absolute-header.m4?root=gnulib&content-type=text/plain > 2. Pick your favorite Makefile.am. > 3. Use this configure.ac: > > AC_INIT(recreate, 0.0.1, [EMAIL PROTECTED]) >> AM_CONFIG_HEADER(config.h) >> AM_INIT_AUTOMAKE(1.9 -Wall -Werror foreign) >> AC_PREREQ([2.61]) >> >> AC_DEFUN([AX_TRILINOS_BASE],[ >> if test -n "${TRILINOS_HOME}"; then > > CPPFLAGS="-I${TRILINOS_HOME}/include $CPPFLAGS" >> fi >> >> AC_MSG_NOTICE([DEBUG: CPPFLAGS=${CPPFLAGS}]) >> AC_CHECK_HEADER([Trilinos_version.h],[found_header=yes]) >> >> if test "$found_header" = yes; then >> gl_ABSOLUTE_HEADER([Trilinos_version.h]) >> AC_DEFINE(HAVE_TRILINOS,1,[Define if Trilinos is available]) >> else >> AC_MSG_ERROR([Trilinos_version.h not found]) >> fi >> ]) >> AX_TRILINOS_BASE >> >> AC_CONFIG_FILES([ >> Makefile >> ]) >> AC_OUTPUT() >> > 4. Invoke 'TRILINOS_HOME=somewhere ./configure' > 5. Look at config.log and observe that the failed Trilinos_version.h check > did not use the DEBUG: CPPFLAGS=-Isomewhere value displayed in step #4. > > To workaround the issue, choose any of: > > 1. Remove gl_ABSOLUTE_HEADER([Trilinos_version.h]) from > AX_TRILINOS_BASE > 2. Move the gl_ABSOLUTE_HEADER call outside of AX_TRILINOS_BASE into > the toplevel configure.ac. > 3. Move the gl_ABSOLUTE_HEADER call into a separate function that isn't > AX_TRILINOS_BASE. But, you cannot call the new, separate function from > within AX_TRILINOS_BASE otherwise you hit the same issue. > 4. Remove the function AX_TRILINOS_BASE and just dump the function's > code into the main configure.ac file. > > > - Rhys >