autoconf
[Top][All Lists]
Advanced

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

Re: question about using AC_SEARCH_LIBS with fortran...


From: Ed Hartnett
Subject: Re: question about using AC_SEARCH_LIBS with fortran...
Date: Wed, 02 Dec 2009 10:41:08 -0700
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux)

Ralf Wildenhues <address@hidden> writes:

Howdy Ralf!

Before I continue asking questions about my fortran AC_SEARCH_LIBS
question, let me first make sure I've got it correct for my C library,
because I just recently realized that I've been doing it wrong for
years.

In my libcf configure.ac file I have added the following:

AC_SEARCH_LIBS([deflate], [z])
AC_SEARCH_LIBS([ceil], [m])
AC_SEARCH_LIBS([H5open], [hdf5])
AC_SEARCH_LIBS([H5DSattach_scale], [hdf5_hl])
AC_SEARCH_LIBS([Curl_cfree], [curl])
AC_SEARCH_LIBS([nc_open], [netcdf])

This finds all the correct libraries in the correct order, and helpfully
adds them to the LIBS variable, so that I don't have to have things like
this in my makefile:

if USE_NETCDF4
LDADD += -lhdf5_hl -lhdf5 -lz 
endif

This is wonderful, but how does the user pass in a special directory
that may include his HDF5 library? With the CPPFLAGS and LDFLAGS,
correct?

Meanwhile I support in my configure script a way to specify a location
for HDF5:

# Did the user specify a location for the HDF5 library?
AC_MSG_CHECKING([whether a location for the HDF5 library was specified])
AC_ARG_WITH([hdf5],
              [AS_HELP_STRING([--with-hdf5=<directory>],
                              [Specify location of HDF5 library. Configure will 
expect \
                              to find subdirs include and lib.])],
            [HDF5DIR=$with_hdf5])
AC_MSG_RESULT([$HDF5DIR])

What I have been doing is handling all this in my Makefile.am files. But
that will go away under the new (to me) system of using AC_SEARCH_LIBS
properly.

But how to get the user's --with-hdf5=/somewhere option into the list of
directories searched by AC_SEARCH_LIBS? Do I modify CPPFLAGS and LDFLAGS
before calling AC_SEARCH_LIBS in my configure.ac? Or is there some other
way to tell AC_SEARCH_LIBS to add another directory to search for the
library?

Thanks!

Ed
-- 
Ed Hartnett  -- address@hidden




reply via email to

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