autoconf
[Top][All Lists]
Advanced

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

Re: autoconf, Fortran, LAPACK, and AC_SEARCH_LIBS


From: David A. Ventimiglia
Subject: Re: autoconf, Fortran, LAPACK, and AC_SEARCH_LIBS
Date: Tue, 24 Mar 2009 17:47:03 -0700

Hello,

I think I solved one of my problems.  Evidently, there's an Autoconf
macro AC_LANG.  By adding AC_LANG(Fortran) to my configure.ac file, it
ensures that test programs are written in Fortran rather than in C, and
that seems sufficient to find sgetrf in liblapack.

Now, onto the next issue!  Which is this:

The reference implementation of LAPACK is relatively simple. I just have
to link my application using -llapack, and it works.

The Intel MKL implementation is in pieces, with dependencies.  On a
64-bit platform, I have to link using -lmkl_lapack -lmkl_em64t -lguide
-lpthread.  


First, how do I get the AC_SEARCH_LIBS([sgetrf],[lapack mkl_lapack])
test to work?  After all, in order to work, the test program that
AC_SEARCH_LIBS writes would have also to link to mkl_em64t, guide, and
pthread, otherwise it gets 'undefined reference' to functions in those
files, the link step fails, and it concludes that it has not found
sgetrf (which is in mkl_lapack).

Second, how do I pass all this information onto the generated Makefile?
After all, when using the reference lapack, I want only -llapack in the
link line.  When using Intel MKL, I want -lmkl_lapack -lmkl_em64t
-lguide -lpthread.

Thanks!

Cheers,
David

On Tue, 2009-03-24 at 15:54 -0700, David A. Ventimiglia wrote:
> Hello,
> 
> I have a Fortran program that uses LAPACK.  Since LAPACK can come from 
> different vendors depending on the platform, 
> and be in different locations (e.g., /usr/lib/liblapack.a with the reference 
> implementation, or in mkl_lapack.a in 
> the Intel compiler tree when using the Intel compiler), I want to use 
> autoconf to make by build process agnostic about this. 
> How do I accomplish this?
> 
> I thought I'd put this in my configure.ac file:
> 
>               AC_SEARCH_LIBS([sgetrf], [lapack mkl_lapack])
> 
> 'sgetrf' is a subroutine in LAPACK.
> 
> After I run aclocal ; autoconf ; automake ; ./configure, among the output is 
> this:
> 
>               checking for library containing sgetrf... no 
> 
> And in the config.log file (attached), there's this:
> 
>               configure:3968: checking for library containing sgetrf          
>                                                                               
>                                                                               
>                  
>               configure:4009: gcc -o conftest -g -O2   conftest.c >&5         
>                                                                               
>                                                                               
>                 
>               /tmp/cckOOIRY.o: In function `main':                            
>                                                                               
>                                                                               
>                  
>               /home/dventimi/work/cosmosurfo/conftest.c:21: undefined 
> reference to `sgetrf'                                                         
>                                                                               
>                          
>               collect2: ld returned 1 exit status                             
>                                                                               
>                                                                               
>                  
>               configure:4015: $? = 1                                          
>                                                                               
>                                                                               
>                  
> 
> Evidently, to find a library file that supports the test subprogram 'sgetrf', 
> it tries to compile and link a test
> program that calls 'sgetrf', but it comes back with 'undefined reference'.
> 
> Perhaps this is a consequence of using autoconf to search for Fortran 
> libraries (like LAPACK).  But either way, how is one
> supposed to do this?  Thanks!
> 
> Cheers,
> David
> 
> _______________________________________________
> Autoconf mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/autoconf





reply via email to

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