[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AC_CHECK_HEADER won't use updates to CFLAGS/CPPFLAGS
From: |
Rhys Ulerich |
Subject: |
Re: AC_CHECK_HEADER won't use updates to CFLAGS/CPPFLAGS |
Date: |
Thu, 14 Aug 2008 12:06:07 -0500 |
Final comment:
The recreate behaves as I expect if I modify gl_ABSOLUTE_HEADER to use
AC_CHECK_HEADERS instead of AC_CHECK_HEADERS_ONCE.
My stupidity for not seeing the _ONCE variant buried in there. Sorry.
- Rhys
On Thu, Aug 14, 2008 at 11:34 AM, Rhys Ulerich <address@hidden>wrote:
> Hi Ralf,
>
> I got it reproduced. The root cause is a side effect of calling
> gl_ABSOLUTE_HEADER (
> http://cvs.savannah.gnu.org/viewvc/*checkout*/gnulib/m4/absolute-header.m4?root=gnulib&content-type=text/plain)
> after AC_CHECK_HEADER within my function definition. The expansion of
> gl_ABSOLUTE_HEADER causes my function look for the header before I've
> modified CPPFLAGS. The, after I modify CPPFLAGS, the cached "no" result is
> being used.
>
> Recreate:
> 1. Snag absolute_header.m4 from the link above
> 2. Pick your favorite Makefile.am.
> 3. Use this configure.ac:
>
> AC_INIT(recreate, 0.0.1, address@hidden)
>> 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 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.
>
> I'll modify my use of gl_ABSOLUTE_HEADER to get past this one. I'll also
> email address@hidden to report it. A note in the gl_ABSOLUTE_HEADER
> macro source might save someone else some time.
>
> Thanks,
> Rhys
>
>
>
>
>
>
>
>
> On Thu, Aug 14, 2008 at 2:09 AM, Ralf Wildenhues <address@hidden>wrote:
>
>> * Rhys Ulerich wrote on Thu, Aug 14, 2008 at 06:30:50AM CEST:
>> >
>> > How many chickens must I sacrifice for AC_CHECK_HEADER to notice that
>> I've
>> > modified CFLAGS/CPPFLAGS within my configure script?
>>
>> Please show your full configure.ac script, or, even better, a reduced
>> one that still exposes this issue.
>>
>> Since AC_CHECK_HEADER apparently invokes g++, it seems you have an
>> AC_LANG([C++]) somewhere, thus CFLAGS won't be used in favor of
>> CXXFLAGS. However, CPPFLAGS should still be used.
>>
>> Cheers,
>> Ralf
>>
>
>