Mercurial > hg > octave-nkf
annotate m4/ax_lapack.m4 @ 20782:1b62fc4e1b2f stable
doc: Cuddle parentheses in example code of for loop.
* stmt.txi: Cuddle parentheses in example code of for loop.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 07 Oct 2015 14:41:39 -0700 |
parents | 97b8d462ef11 |
children |
rev | line source |
---|---|
8027
fd13f9f7dbac
update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents:
6208
diff
changeset
|
1 # =========================================================================== |
10951 | 2 # http://www.gnu.org/software/autoconf-archive/ax_lapack.html |
8027
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 # |
10951 | 7 # AX_LAPACK([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) |
8027
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 # |
10951 | 17 # $LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS |
8027
fd13f9f7dbac
update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents:
6208
diff
changeset
|
18 # |
10951 | 19 # in that order. BLAS_LIBS is the output variable of the AX_BLAS macro, |
8027
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 |
10951 | 21 # AC_F77_LIBRARY_LDFLAGS macro (called if necessary by AX_BLAS), and is |
8027
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 # |
10951 | 37 # LICENSE |
8027
fd13f9f7dbac
update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents:
6208
diff
changeset
|
38 # |
10951 | 39 # Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu> |
8027
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 # 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
|
42 # 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
|
43 # 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
|
44 # option) any later version. |
fd13f9f7dbac
update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents:
6208
diff
changeset
|
45 # |
fd13f9f7dbac
update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents:
6208
diff
changeset
|
46 # 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
|
47 # 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
|
48 # 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
|
49 # Public License for more details. |
fd13f9f7dbac
update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents:
6208
diff
changeset
|
50 # |
fd13f9f7dbac
update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents:
6208
diff
changeset
|
51 # 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
|
52 # 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
|
53 # |
fd13f9f7dbac
update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents:
6208
diff
changeset
|
54 # 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
|
55 # 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
|
56 # 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
|
57 # 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
|
58 # 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
|
59 # 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
|
60 # 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
|
61 # |
fd13f9f7dbac
update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents:
6208
diff
changeset
|
62 # This special exception to the GPL applies to versions of the Autoconf |
10951 | 63 # Macro released by the Autoconf Archive. When you make and distribute a |
64 # modified version of the Autoconf Macro, you may extend this special | |
65 # exception to the GPL to apply to your modified version as well. | |
3887 | 66 |
10951 | 67 #serial 7 |
68 | |
69 AU_ALIAS([ACX_LAPACK], [AX_LAPACK]) | |
70 AC_DEFUN([AX_LAPACK], [ | |
71 AC_REQUIRE([AX_BLAS]) | |
72 ax_lapack_ok=no | |
3887 | 73 |
74 AC_ARG_WITH(lapack, | |
10951 | 75 [AS_HELP_STRING([--with-lapack=<lib>], [use LAPACK library <lib>])]) |
3887 | 76 case $with_lapack in |
77 yes | "") ;; | |
10951 | 78 no) ax_lapack_ok=disable ;; |
3887 | 79 -* | */* | *.a | *.so | *.so.* | *.o) LAPACK_LIBS="$with_lapack" ;; |
80 *) LAPACK_LIBS="-l$with_lapack" ;; | |
81 esac | |
82 | |
83 # 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
|
84 AC_F77_FUNC(cheev) |
3887 | 85 |
86 # We cannot use LAPACK if BLAS is not found | |
10951 | 87 if test "x$ax_blas_ok" != xyes; then |
88 ax_lapack_ok=noblas | |
8027
fd13f9f7dbac
update macros from cryp.to auoconf archive
Jaroslav Hajek <highegg@gmail.com>
parents:
6208
diff
changeset
|
89 LAPACK_LIBS="" |
3887 | 90 fi |
91 | |
92 # First, check LAPACK_LIBS environment variable | |
93 if test "x$LAPACK_LIBS" != x; then | |
94 save_LIBS="$LIBS"; LIBS="$LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS" | |
95 AC_MSG_CHECKING([for $cheev in $LAPACK_LIBS]) | |
10951 | 96 AC_TRY_LINK_FUNC($cheev, [ax_lapack_ok=yes], [LAPACK_LIBS=""]) |
97 AC_MSG_RESULT($ax_lapack_ok) | |
3887 | 98 LIBS="$save_LIBS" |
10951 | 99 if test $ax_lapack_ok = no; then |
3887 | 100 LAPACK_LIBS="" |
101 fi | |
102 fi | |
103 | |
104 # LAPACK linked to by default? (is sometimes included in BLAS lib) | |
10951 | 105 if test $ax_lapack_ok = no; then |
3887 | 106 save_LIBS="$LIBS"; LIBS="$LIBS $BLAS_LIBS $FLIBS" |
10951 | 107 AC_CHECK_FUNC($cheev, [ax_lapack_ok=yes]) |
3887 | 108 LIBS="$save_LIBS" |
109 fi | |
110 | |
111 # Generic LAPACK library? | |
112 for lapack in lapack lapack_rs6k; do | |
10951 | 113 if test $ax_lapack_ok = no; then |
3887 | 114 save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS" |
115 AC_CHECK_LIB($lapack, $cheev, | |
10951 | 116 [ax_lapack_ok=yes; LAPACK_LIBS="-l$lapack"], [], [$FLIBS]) |
3887 | 117 LIBS="$save_LIBS" |
118 fi | |
119 done | |
120 | |
121 AC_SUBST(LAPACK_LIBS) | |
122 | |
123 # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: | |
10951 | 124 if test x"$ax_lapack_ok" = xyes; then |
3887 | 125 ifelse([$1],,AC_DEFINE(HAVE_LAPACK,1,[Define if you have LAPACK library.]),[$1]) |
126 : | |
127 else | |
10951 | 128 ax_lapack_ok=no |
3887 | 129 $2 |
130 fi | |
10951 | 131 ])dnl AX_LAPACK |