annotate acx_lapack.m4 @ 9022:5e276a0b9997 ss-3-1-55

bump version for snapshot
author John W. Eaton <jwe@octave.org>
date Wed, 25 Mar 2009 23:28:17 -0400
parents fd13f9f7dbac
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8027
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
1 # ===========================================================================
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
2 # http://autoconf-archive.cryp.to/acx_lapack.html
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
3 # ===========================================================================
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
4 #
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
5 # SYNOPSIS
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
6 #
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
7 # ACX_LAPACK([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
8 #
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
9 # DESCRIPTION
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
10 #
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
11 # This macro looks for a library that implements the LAPACK linear-algebra
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
12 # interface (see http://www.netlib.org/lapack/). On success, it sets the
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
13 # LAPACK_LIBS output variable to hold the requisite library linkages.
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
14 #
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
15 # To link with LAPACK, you should link with:
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
16 #
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
17 # $LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
18 #
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
19 # in that order. BLAS_LIBS is the output variable of the ACX_BLAS macro,
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
20 # called automatically. FLIBS is the output variable of the
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
21 # AC_F77_LIBRARY_LDFLAGS macro (called if necessary by ACX_BLAS), and is
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
22 # sometimes necessary in order to link with F77 libraries. Users will also
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
23 # need to use AC_F77_DUMMY_MAIN (see the autoconf manual), for the same
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
24 # reason.
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
25 #
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
26 # The user may also use --with-lapack=<lib> in order to use some specific
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
27 # LAPACK library <lib>. In order to link successfully, however, be aware
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
28 # that you will probably need to use the same Fortran compiler (which can
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
29 # be set via the F77 env. var.) as was used to compile the LAPACK and BLAS
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
30 # libraries.
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
31 #
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
32 # ACTION-IF-FOUND is a list of shell commands to run if a LAPACK library
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
33 # is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
34 # is not found. If ACTION-IF-FOUND is not specified, the default action
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
35 # will define HAVE_LAPACK.
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
36 #
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
37 # LAST MODIFICATION
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
38 #
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
39 # 2008-06-29
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
40 #
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
41 # COPYLEFT
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
42 #
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
43 # Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
44 #
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
45 # This program is free software: you can redistribute it and/or modify it
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
46 # under the terms of the GNU General Public License as published by the
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
47 # Free Software Foundation, either version 3 of the License, or (at your
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
48 # option) any later version.
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
49 #
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
50 # This program is distributed in the hope that it will be useful, but
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
51 # WITHOUT ANY WARRANTY; without even the implied warranty of
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
52 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
53 # Public License for more details.
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
54 #
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
55 # You should have received a copy of the GNU General Public License along
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
56 # with this program. If not, see <http://www.gnu.org/licenses/>.
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
57 #
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
58 # As a special exception, the respective Autoconf Macro's copyright owner
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
59 # gives unlimited permission to copy, distribute and modify the configure
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
60 # scripts that are the output of Autoconf when processing the Macro. You
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
61 # need not follow the terms of the GNU General Public License when using
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
62 # or distributing such scripts, even though portions of the text of the
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
63 # Macro appear in them. The GNU General Public License (GPL) does govern
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
64 # all other use of the material that constitutes the Autoconf Macro.
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
65 #
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
66 # This special exception to the GPL applies to versions of the Autoconf
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
67 # Macro released by the Autoconf Macro Archive. When you make and
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
68 # distribute a modified version of the Autoconf Macro, you may extend this
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
69 # special exception to the GPL to apply to your modified version as well.
3887
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 AC_DEFUN([ACX_LAPACK], [
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
72 AC_REQUIRE([ACX_BLAS])
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
73 acx_lapack_ok=no
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
74
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
75 AC_ARG_WITH(lapack,
8027
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
76 [AC_HELP_STRING([--with-lapack=<lib>], [use LAPACK library <lib>])])
3887
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
77 case $with_lapack in
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
78 yes | "") ;;
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
79 no) acx_lapack_ok=disable ;;
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
80 -* | */* | *.a | *.so | *.so.* | *.o) LAPACK_LIBS="$with_lapack" ;;
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
81 *) LAPACK_LIBS="-l$with_lapack" ;;
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
82 esac
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 # Get fortran linker name of LAPACK function to check for.
8027
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
85 AC_F77_FUNC(cheev)
3887
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
86
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
87 # We cannot use LAPACK if BLAS is not found
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
88 if test "x$acx_blas_ok" != xyes; then
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
89 acx_lapack_ok=noblas
8027
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
90 LAPACK_LIBS=""
3887
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
91 fi
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
92
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
93 # First, check LAPACK_LIBS environment variable
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
94 if test "x$LAPACK_LIBS" != x; then
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
95 save_LIBS="$LIBS"; LIBS="$LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS"
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
96 AC_MSG_CHECKING([for $cheev in $LAPACK_LIBS])
8027
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
97 AC_TRY_LINK_FUNC($cheev, [acx_lapack_ok=yes], [LAPACK_LIBS=""])
3887
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
98 AC_MSG_RESULT($acx_lapack_ok)
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
99 LIBS="$save_LIBS"
8027
fd13f9f7dbac update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents: 6208
diff changeset
100 if test $acx_lapack_ok = no; then
3887
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
101 LAPACK_LIBS=""
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
102 fi
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
103 fi
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
104
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
105 # 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
106 if test $acx_lapack_ok = no; then
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
107 save_LIBS="$LIBS"; LIBS="$LIBS $BLAS_LIBS $FLIBS"
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
108 AC_CHECK_FUNC($cheev, [acx_lapack_ok=yes])
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
109 LIBS="$save_LIBS"
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
110 fi
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
111
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
112 # Generic LAPACK library?
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
113 for lapack in lapack lapack_rs6k; do
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
114 if test $acx_lapack_ok = no; then
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
115 save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS"
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
116 AC_CHECK_LIB($lapack, $cheev,
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
117 [acx_lapack_ok=yes; LAPACK_LIBS="-l$lapack"], [], [$FLIBS])
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
118 LIBS="$save_LIBS"
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
119 fi
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
120 done
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
121
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
122 AC_SUBST(LAPACK_LIBS)
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
123
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
124 # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
125 if test x"$acx_lapack_ok" = xyes; then
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
126 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
127 :
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
128 else
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
129 acx_lapack_ok=no
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
130 $2
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
131 fi
7da18459c08b [project @ 2002-04-04 00:44:21 by jwe]
jwe
parents:
diff changeset
132 ])dnl ACX_LAPACK