[Top][All Lists]

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

Re: question about using AC_SEARCH_LIBS with fortran...

From: Ralf Wildenhues
Subject: Re: question about using AC_SEARCH_LIBS with fortran...
Date: Wed, 2 Dec 2009 21:05:10 +0100
User-agent: Mutt/1.5.20 (2009-08-09)

* Ed Hartnett wrote on Wed, Dec 02, 2009 at 06:41:08PM CET:
> 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.

No, you haven't.

> In my libcf 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:
> 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:
> AC_ARG_WITH([hdf5],

This is a fine possibility as well.

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

Well, complex packages need both.  In that case, it is typical to save
in LIBS all libraries that are needed by most or all programs in the
package, and use other variables (like HDF5_LIB, HDF5_INCLUDE or so)
for the rest.  Both AC_CHECK_LIB and AC_SEARCH_LIBS allow you to store
their result in other variables as well, through the ACTION-IF-FOUND
arguments of the macros.  One difference is that AC_SEARCH_LIBS always
updates $LIBS while AC_CHECK_LIB only does so if ACTION-IF-FOUND is not
given.  If needed you can save and restore the $LIBS value to keep it

> 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

Yes.  The CPPFLAGS should be set before you search for headers.

> Or is there some other
> way to tell AC_SEARCH_LIBS to add another directory to search for the
> library?



reply via email to

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