autoconf
[Top][All Lists]
Advanced

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

Re: FOO_LIBS


From: Thomas Jahns
Subject: Re: FOO_LIBS
Date: Tue, 08 Oct 2013 11:58:04 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130922 Icedove/17.0.9

Hello,

On 09/30/13 09:56, Harlan Stenn wrote:
> Any idaes how I could do this?  Are there better options?

I had almost the same problem where adding MPI libraries would complicate
non-MPI programs in a package that had some HPC binary plus related auxiliary
binaries.

I then went on to write such functionality as you propose, where the check for
package FOO which might depend on packages BAR and BAZ resulted in setting
FOO_C_LIBS/FOO_FC_LIBS to the appropriate prefix for LIBS.

Feel free to have a look at the m4 source in the tarball at

https://www.dkrz.de/redmine/projects/scales-ppm/files

The macros you might be interested in are

dnl ACX_OPTION_SEARCH_LIBS(FUNCTION, SEARCH-LIBS,
dnl   [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [OTHER-LIBRARIES],
dnl   [EXTRA-FLAGS], [PREAMBLE])
dnl --------------------------------------------------------
dnl Search for a library defining FUNC, if it's not already available.
dnl Do not add said library to default LIBS output variable.
dnl Use $ac_lib or $ac_res in ACTION if needed. Uses OTHER-LIBRARIES
dnl unconditionally, which might provoke linker errors.

and

dnl ACX_OPTION_SEARCH_LIBS_MULTI(FUNCTION, SEARCH-LIBS,
dnl   [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [OTHER-LIBRARIES],
dnl   [EXTRA-FLAGS], [PREAMBLE], [CALL-CODE])
dnl --------------------------------------------------------
dnl Search for a library defining FUNC, if it's not already available.
dnl Do not add said library to default LIBS output variable.
dnl Use $ac_lib or $ac_res in ACTION if needed.
dnl
dnl If CALL-CODE is present it will be compiled to make the function
dnl call, otherwise AC_LANG_CALL will be used with FUNCTION as
dnl argument.
dnl
dnl Tries first to link without any OTHER-LIBRARY, then successively
dnl tries each library in the list.

where [OTHER-LIBRARY] is a set of flag combinations in the second _MULTI version
like might be specified as:

[[-fsome-flag-for-libbar -lbar],[-Lsome-other-flag -lbaz]]

The whole thing (i.e. the higher level macros using the two above) is
unfortunately quite complicated (because it deals with Fortran (with INCLUDE
files and module USE) and C (and could be easily extended to Fortran 77 and C++)
and also emits appropriate --with-foo arguments and FOO_* argument variables. It
also addresses complicated cases where some library can depend on some subset of
set of libraries which in turn can have equally complicated dependencies and the
package might be a multi-part where some library files are needed for a single
function to work.

As a side-note: All of these packages have a habit of preparing wrappers for the
compiler and declare the problem thus solved. That strategy unfortunately breaks
down the moment you try to use two packages simultaneously.

Regards, Thomas
-- 
Thomas Jahns
DKRZ GmbH, Department: Application software

Deutsches Klimarechenzentrum
Bundesstraße 45a
D-20146 Hamburg

Phone: +49-40-460094-151
Fax: +49-40-460094-270
Email: Thomas Jahns <address@hidden>

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


reply via email to

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