autoconf
[Top][All Lists]
Advanced

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

question about whether to set CFLAGS in configure.ac


From: Ed Hartnett
Subject: question about whether to set CFLAGS in configure.ac
Date: Tue, 29 Nov 2005 09:11:14 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.4 (gnu/linux)

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 += address@hidden@/include
AM_LDFLAGS += address@hidden@/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:

   AC_CHECK_LIB([hdf5], [H5Fflush], [], [nc_hdf5_lib_missing=yes])

But this doesn't work, because it doesn't know about the location that
the user has specified. How do I get this to work without setting
CFLAGS in configure?

Thanks for any suggestions!

Ed

-- 
Ed Hartnett  -- address@hidden





reply via email to

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