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