annotate acx_lapack.m4 @ 5915:b2e1be30c8e9 ss-2-9-7

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