autoconf
[Top][All Lists]
Advanced

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

Re: question about whether to set CFLAGS in configure.ac


From: Brian Lloyd
Subject: Re: question about whether to set CFLAGS in configure.ac
Date: Thu, 01 Dec 2005 21:33:33 -0600

On Thu, 2005-12-01 at 09:33 -0600, Bob Friesenhahn wrote:
> On Thu, 1 Dec 2005, Brian Lloyd wrote:
> >>
> > Try this.
> >
> > saved_CFLAGS=$CFLAGS
> > CFLAGS="$CFLAGS -I$(HDF5DIR)/include -L$(HDF5DIR)/lib"
> >>    AC_CHECK_LIB([hdf5], [H5Fflush], [], [nc_hdf5_lib_missing=yes])
> > CFLAGS=$saved_CFLAGS
> >
> > This gives the needed CFLAGS for the CHECK_LIB function, but leaves the
> > CFLAGS variable set as it was before this call.
> 
> Any -I options should be appended to CPPFLAGS and any -L options 
> should be appended to LDFLAGS.  While the approach of temporarily 
> updating a variable is the right one, this example is improperly using 
> CFLAGS.
> 

I will agree that -L "should" go in LDFLAGS.  However, when compiling a
single source CPPFLAGS is included during the linking, so instead of
having to save both LDFLAGS and CPPFLAGS, CPPFLAGS can be used for both
temporarily.  I've also had some tests fail when -L was not included in
CPPFLAGS for the test, but worked once -L was included.  Probably broken
code caused this (what I'm maintaining or Automake provided macros I
haven't had the time to figure out), but if it works, why not do it the
easy way?

Brian A. Lloyd





reply via email to

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