On Tue, 2005-11-29 at 09:11 -0700, Ed Hartnett wrote: > Howdy all! > > I believe the common consensus is that one should not set CFLAGS in > configure.ac. > > However, I have a problem that seems to call for it. Is there a better > way to get this working then messing with CFLAGS? > > My configure allows the user to specify a location for a library, the > HDF5 library. So they can do --with-hdf5=/some/location. I do it like > this: > > AC_ARG_WITH([hdf5], > [AS_HELP_STRING([--with-hdf5=<directory>], > [Specify location of HDF5 library. Configure will expect to find subdirs include and lib.])]) > AM_CONDITIONAL(USE_HDF5_DIR, [test ! "x$with_hdf5" = x]) > AC_SUBST(HDF5DIR, [$with_hdf5]) > > Then, in the automake files: > > # If the user specified a root location for HDF5, use it. > if USE_HDF5_DIR > AM_CPPFLAGS += -I@HDF5DIR@/include > AM_LDFLAGS += -L@HDF5DIR@/lib > endif > > But now I want to test during configure that I can really link to the > HDF5 library (i.e. did they provide a valid location?). This is before > the makefiles are even built, of course. So I try this in > configure.ac: > 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. Brian _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf