question about whether to set CFLAGS in configure.ac

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

 



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:

   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  -- ed@xxxxxxxxxxxxxxxx



_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux