1dnl @synopsis ACX_LAPACK([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) 2dnl 3dnl This macro looks for a library that implements the LAPACK 4dnl linear-algebra interface (see http://www.netlib.org/lapack/). 5dnl On success, it sets the LAPACK_LIBS output variable to 6dnl hold the requisite library linkages. 7dnl 8dnl To link with LAPACK, you should link with: 9dnl $LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS 10dnl in that order. BLAS_LIBS is the output variable of the ACX_BLAS 11dnl macro, called automatically. FLIBS is the output variable of the 12dnl AC_F77_LIBRARY_LDFLAGS macro (called if necessary by ACX_BLAS), 13dnl and is sometimes necessary in order to link with F77 libraries. 14dnl Users will also need to use AC_F77_DUMMY_MAIN (see the autoconf 15dnl manual), for the same reason. 16dnl 17dnl The user may also use --with-lapack=<lib> in order to use some 18dnl specific LAPACK library <lib>. In order to link successfully, 19dnl however, be aware that you will probably need to use the same 20dnl Fortran compiler (which can be set via the F77 env. var.) as 21dnl was used to compile the LAPACK and BLAS libraries. 22dnl 23dnl ACTION-IF-FOUND is a list of shell commands to run if a LAPACK 24dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands 25dnl to run it if it is not found. If ACTION-IF-FOUND is not specified, 26dnl the default action will define HAVE_LAPACK. 27dnl 28dnl @version $Id: acx_lapack.m4,v 1.3 2006/07/05 01:21:07 stevenj Exp $ 29dnl @author Steven G. Johnson <stevenj@alum.mit.edu> 30 31AC_DEFUN([ACX_LAPACK], [ 32AC_REQUIRE([ACX_BLAS]) 33acx_lapack_ok=no 34 35AC_ARG_WITH(lapack, 36 [AC_HELP_STRING([--with-lapack=<lib>], [use LAPACK library <lib>])]) 37case $with_lapack in 38 yes | "") ;; 39 no) acx_lapack_ok=disable ;; 40 -* | */* | *.a | *.so | *.so.* | *.o) LAPACK_LIBS="$with_lapack" ;; 41 *) LAPACK_LIBS="-l$with_lapack" ;; 42esac 43 44# Get fortran linker name of LAPACK function to check for. 45AC_F77_FUNC(cheev) 46 47# We cannot use LAPACK if BLAS is not found 48if test "x$acx_blas_ok" != xyes; then 49 acx_lapack_ok=noblas 50fi 51 52# First, check LAPACK_LIBS environment variable 53if test "x$LAPACK_LIBS" != x; then 54 save_LIBS="$LIBS"; LIBS="$LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS" 55 AC_MSG_CHECKING([for $cheev in $LAPACK_LIBS]) 56 AC_TRY_LINK_FUNC($cheev, [acx_lapack_ok=yes], [LAPACK_LIBS=""]) 57 AC_MSG_RESULT($acx_lapack_ok) 58 LIBS="$save_LIBS" 59 if test acx_lapack_ok = no; then 60 LAPACK_LIBS="" 61 fi 62fi 63 64# LAPACK linked to by default? (is sometimes included in BLAS lib) 65if test $acx_lapack_ok = no; then 66 save_LIBS="$LIBS"; LIBS="$LIBS $BLAS_LIBS $FLIBS" 67 AC_CHECK_FUNC($cheev, [acx_lapack_ok=yes]) 68 LIBS="$save_LIBS" 69fi 70 71# Generic LAPACK library? 72for lapack in lapack lapack_rs6k; do 73 if test $acx_lapack_ok = no; then 74 save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS" 75 AC_CHECK_LIB($lapack, $cheev, 76 [acx_lapack_ok=yes; LAPACK_LIBS="-l$lapack"], [], [$FLIBS]) 77 LIBS="$save_LIBS" 78 fi 79done 80 81AC_SUBST(LAPACK_LIBS) 82 83# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: 84if test x"$acx_lapack_ok" = xyes; then 85 ifelse([$1],,AC_DEFINE(HAVE_LAPACK,1,[Define if you have LAPACK library.]),[$1]) 86 : 87else 88 acx_lapack_ok=no 89 $2 90fi 91])dnl ACX_LAPACK 92