automake
[Top][All Lists]
Advanced

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

Re: Proper way to link Fortran with C++


From: Ralf Wildenhues
Subject: Re: Proper way to link Fortran with C++
Date: Wed, 24 Feb 2010 22:49:50 +0100
User-agent: Mutt/1.5.20 (2009-10-28)

Hello Steven,

sorry to bother you.  Jö asked this on the Automake mailing list:

* Jö Fahlke wrote on Tue, Feb 23, 2010 at 10:06:01AM CET:
> Our project uses C++, but some of its optional dependencies require linking
> with fortran libraries (like blas).  What is the proper way to do this?
> 
> On the one hand the Autoconf documentation says that the output variable FLIBS
> should be included after LIBS when linking.  This is consistent with the
> documentation for ACX_BLAS from the Autoconf archive, which states
> 
> #   To link with BLAS, you should link with:
> #
> #       $BLAS_LIBS $LIBS $FLIBS
> #
> #   in that order.
> 
> The Automake documentation on the other hand states that I should put $(FLIBS)
> into the apropriate _LDADD or _LIBADD variable.  That would include the value
> of FLIBS before the value of LIBS on the linker command line, contradicting
> the autoconf documentation.
> 
> Is there a reason Autconf requires FLIBS after LIBS, and not just FLIBS after
> the library actually using fortran?  That would be
> 
>    $BLAS_LIBS $FLIBS $LIBS
> 
> in the case of blas, and it would allow me to fold FLIBS into BLAS_LIBS.  This
> in turn would make it easier to omit the FLIBS completely in case blas was not
> detected by configure.

Do you remember why the Autoconf macro specifically recommends
this ordering?  We should amend it with a rationale.

I couldn't find anything in the archives of the macro sources about it.
Maybe it is because $LIBS may contain a Fortran library?

Thanks,
Ralf




reply via email to

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