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 <ja...@dkrz.de>

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

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

Reply via email to