annotate acx_lapack.m4 @ 7948:af10baa63915 ss-3-1-50

3.1.50 snapshot
author John W. Eaton <jwe@octave.org>
date Fri, 18 Jul 2008 17:42:48 -0400
parents 323be5eeed1f
children fd13f9f7dbac
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.
6208
323be5eeed1f [project @ 2006-12-06 20:23:18 by jwe]
jwe
parents: 5844
diff changeset
47 if $have_fortran_compiler; then
323be5eeed1f [project @ 2006-12-06 20:23:18 by jwe]
jwe
parents: 5844
diff changeset
48 AC_F77_FUNC(cheev)
323be5eeed1f [project @ 2006-12-06 20:23:18 by jwe]
jwe
parents: 5844
diff changeset
49 elif $have_f2c; then
323be5eeed1f [project @ 2006-12-06 20:23:18 by jwe]
jwe
parents: 5844
diff changeset
50 cheev=cheev_
323be5eeed1f [project @ 2006-12-06 20:23:18 by jwe]
jwe
parents: 5844
diff changeset
51 fi
3887
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
52
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
53 # We cannot use LAPACK if BLAS is not found
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
54 if test "x$acx_blas_ok" != xyes; then
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
55 acx_lapack_ok=noblas
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
56 fi
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
57
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
58 # First, check LAPACK_LIBS environment variable
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
59 if test "x$LAPACK_LIBS" != x; then
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
60 save_LIBS="$LIBS"; LIBS="$LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS"
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
61 AC_MSG_CHECKING([for $cheev in $LAPACK_LIBS])
5844
034cdbd34c0a [project @ 2006-06-07 15:38:58 by jwe]
jwe
parents: 3887
diff changeset
62 AC_LINK_IFELSE([AC_LANG_CALL([], [$cheev])],
034cdbd34c0a [project @ 2006-06-07 15:38:58 by jwe]
jwe
parents: 3887
diff changeset
63 [acx_lapack_ok=yes], [LAPACK_LIBS=""])
3887
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
64 AC_MSG_RESULT($acx_lapack_ok)
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
65 LIBS="$save_LIBS"
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
66 if test acx_lapack_ok = no; then
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
67 LAPACK_LIBS=""
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
68 fi
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
69 fi
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
70
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
71 # 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
72 if test $acx_lapack_ok = no; then
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
73 save_LIBS="$LIBS"; LIBS="$LIBS $BLAS_LIBS $FLIBS"
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
74 AC_CHECK_FUNC($cheev, [acx_lapack_ok=yes])
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
75 LIBS="$save_LIBS"
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
76 fi
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
77
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
78 # Generic LAPACK library?
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
79 for lapack in lapack lapack_rs6k; do
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
80 if test $acx_lapack_ok = no; then
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
81 save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS"
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
82 AC_CHECK_LIB($lapack, $cheev,
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
83 [acx_lapack_ok=yes; LAPACK_LIBS="-l$lapack"], [], [$FLIBS])
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
84 LIBS="$save_LIBS"
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
85 fi
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
86 done
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
87
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
88 AC_SUBST(LAPACK_LIBS)
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 # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
91 if test x"$acx_lapack_ok" = xyes; then
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
92 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
93 :
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
94 else
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
95 acx_lapack_ok=no
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
96 $2
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
97 fi
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
98 ])dnl ACX_LAPACK