Mercurial > hg > octave-thorsten
comparison acx_lapack.m4 @ 3887:7da18459c08b
[project @ 2002-04-04 00:44:21 by jwe]
author | jwe |
---|---|
date | Thu, 04 Apr 2002 00:46:37 +0000 |
parents | |
children | 034cdbd34c0a |
comparison
equal
deleted
inserted
replaced
3886:96919c87953c | 3887:7da18459c08b |
---|---|
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, | |
38 [AC_HELP_STRING([--with-lapack=<lib>], [use LAPACK library <lib>])]) | |
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. | |
47 AC_F77_FUNC(cheev) | |
48 | |
49 # We cannot use LAPACK if BLAS is not found | |
50 if test "x$acx_blas_ok" != xyes; then | |
51 acx_lapack_ok=noblas | |
52 fi | |
53 | |
54 # First, check LAPACK_LIBS environment variable | |
55 if test "x$LAPACK_LIBS" != x; then | |
56 save_LIBS="$LIBS"; LIBS="$LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS" | |
57 AC_MSG_CHECKING([for $cheev in $LAPACK_LIBS]) | |
58 AC_TRY_LINK_FUNC($cheev, [acx_lapack_ok=yes], [LAPACK_LIBS=""]) | |
59 AC_MSG_RESULT($acx_lapack_ok) | |
60 LIBS="$save_LIBS" | |
61 if test acx_lapack_ok = no; then | |
62 LAPACK_LIBS="" | |
63 fi | |
64 fi | |
65 | |
66 # LAPACK linked to by default? (is sometimes included in BLAS lib) | |
67 if test $acx_lapack_ok = no; then | |
68 save_LIBS="$LIBS"; LIBS="$LIBS $BLAS_LIBS $FLIBS" | |
69 AC_CHECK_FUNC($cheev, [acx_lapack_ok=yes]) | |
70 LIBS="$save_LIBS" | |
71 fi | |
72 | |
73 # Generic LAPACK library? | |
74 for lapack in lapack lapack_rs6k; do | |
75 if test $acx_lapack_ok = no; then | |
76 save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS" | |
77 AC_CHECK_LIB($lapack, $cheev, | |
78 [acx_lapack_ok=yes; LAPACK_LIBS="-l$lapack"], [], [$FLIBS]) | |
79 LIBS="$save_LIBS" | |
80 fi | |
81 done | |
82 | |
83 AC_SUBST(LAPACK_LIBS) | |
84 | |
85 # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: | |
86 if test x"$acx_lapack_ok" = xyes; then | |
87 ifelse([$1],,AC_DEFINE(HAVE_LAPACK,1,[Define if you have LAPACK library.]),[$1]) | |
88 : | |
89 else | |
90 acx_lapack_ok=no | |
91 $2 | |
92 fi | |
93 ])dnl ACX_LAPACK |