• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Révision901beee059076f6dd2a3d0805c8219e3290bbb44 (tree)
l'heure2012-07-10 14:38:48
AuteurKatsuhiko Nishimra <ktns.87@gmai...>
CommiterKatsuhiko Nishimra

Message de Log

Utilize AX_BLAS and AX_LAPACK macro in configure.ac. #28588

git-svn-id: https://svn.sourceforge.jp/svnroot/molds/branches/automake@885 1136aad2-a195-0410-b898-f5ea1d11b9d8

Change Summary

Modification

--- a/src/configure.ac
+++ b/src/configure.ac
@@ -6,7 +6,7 @@ AC_INIT([MolDS], [0.1], [molds-dev@lists.sourceforge.jp])
66
77 # Check if pwd is source directory
88 AS_IF([test -x ./configure],
9- AC_MSG_FAILURE([Don't execute configure script in source directory!]))
9+ AC_MSG_FAILURE([Don't execute configure script in source directory!]))
1010
1111 AM_INIT_AUTOMAKE([MolDS], [0.1])
1212 AC_CONFIG_SRCDIR([Main.cpp])
@@ -62,15 +62,13 @@ AS_IF([test "$release_enabled" = "no" ],
6262 ,[AC_MSG_RESULT([no])
6363 export CXXFLAGS="$CXXFLAGS_SAVED"])])
6464
65-# Check for mkl
66-export LIBS="-lmkl_intel_thread -lmkl_core $LIBS"
67-AC_CHECK_HEADERS([mkl.h])
68-AC_CHECK_LIB([mkl_intel_lp64], [dsyevd],,
69- [
70- AC_CHECK_LIB([mkl_intel], [main],,
71- [AC_MSG_FAILURE([Cannot find mkl!])
72- ])
73- ])
65+# Check for LAPACK
66+AX_BLAS(,[AC_MSG_FAILURE([Cannot find BLAS library!])])
67+AX_LAPACK(,[AC_MSG_FAILURE([Cannot find LAPACK library!])])
68+LIBS="$LAPACK_LIBS $BLAS_LIBS $LIBS"
69+AC_CHECK_HEADERS([mkl.h lapacke.h],[molds_lapack_header_found=yes],)
70+AS_IF([test "x$molds_lapack_header_found" != "xyes"],
71+ [AC_MSG_FAILURE([Cannot find mkl.h or lapacke.h!])])
7472
7573 # Boost
7674 AX_BOOST_BASE([1.48],,[AC_MSG_FAILURE([boost library is too old!])])
--- /dev/null
+++ b/src/m4/ax_blas.m4
@@ -0,0 +1,201 @@
1+# ===========================================================================
2+# http://www.gnu.org/software/autoconf-archive/ax_blas.html
3+# ===========================================================================
4+#
5+# SYNOPSIS
6+#
7+# AX_BLAS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
8+#
9+# DESCRIPTION
10+#
11+# This macro looks for a library that implements the BLAS linear-algebra
12+# interface (see http://www.netlib.org/blas/). On success, it sets the
13+# BLAS_LIBS output variable to hold the requisite library linkages.
14+#
15+# To link with BLAS, you should link with:
16+#
17+# $BLAS_LIBS $LIBS $FLIBS
18+#
19+# in that order. FLIBS is the output variable of the
20+# AC_F77_LIBRARY_LDFLAGS macro (called if necessary by AX_BLAS), and is
21+# sometimes necessary in order to link with F77 libraries. Users will also
22+# need to use AC_F77_DUMMY_MAIN (see the autoconf manual), for the same
23+# reason.
24+#
25+# Many libraries are searched for, from ATLAS to CXML to ESSL. The user
26+# may also use --with-blas=<lib> in order to use some specific BLAS
27+# library <lib>. In order to link successfully, however, be aware that you
28+# will probably need to use the same Fortran compiler (which can be set
29+# via the F77 env. var.) as was used to compile the BLAS library.
30+#
31+# ACTION-IF-FOUND is a list of shell commands to run if a BLAS library is
32+# found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it is
33+# not found. If ACTION-IF-FOUND is not specified, the default action will
34+# define HAVE_BLAS.
35+#
36+# LICENSE
37+#
38+# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
39+#
40+# This program is free software: you can redistribute it and/or modify it
41+# under the terms of the GNU General Public License as published by the
42+# Free Software Foundation, either version 3 of the License, or (at your
43+# option) any later version.
44+#
45+# This program is distributed in the hope that it will be useful, but
46+# WITHOUT ANY WARRANTY; without even the implied warranty of
47+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
48+# Public License for more details.
49+#
50+# You should have received a copy of the GNU General Public License along
51+# with this program. If not, see <http://www.gnu.org/licenses/>.
52+#
53+# As a special exception, the respective Autoconf Macro's copyright owner
54+# gives unlimited permission to copy, distribute and modify the configure
55+# scripts that are the output of Autoconf when processing the Macro. You
56+# need not follow the terms of the GNU General Public License when using
57+# or distributing such scripts, even though portions of the text of the
58+# Macro appear in them. The GNU General Public License (GPL) does govern
59+# all other use of the material that constitutes the Autoconf Macro.
60+#
61+# This special exception to the GPL applies to versions of the Autoconf
62+# Macro released by the Autoconf Archive. When you make and distribute a
63+# modified version of the Autoconf Macro, you may extend this special
64+# exception to the GPL to apply to your modified version as well.
65+
66+#serial 12
67+
68+AU_ALIAS([ACX_BLAS], [AX_BLAS])
69+AC_DEFUN([AX_BLAS], [
70+AC_PREREQ(2.50)
71+AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS])
72+ax_blas_ok=no
73+
74+AC_ARG_WITH(blas,
75+ [AS_HELP_STRING([--with-blas=<lib>], [use BLAS library <lib>])])
76+case $with_blas in
77+ yes | "") ;;
78+ no) ax_blas_ok=disable ;;
79+ -* | */* | *.a | *.so | *.so.* | *.o) BLAS_LIBS="$with_blas" ;;
80+ *) BLAS_LIBS="-l$with_blas" ;;
81+esac
82+
83+# Get fortran linker names of BLAS functions to check for.
84+AC_F77_FUNC(sgemm)
85+AC_F77_FUNC(dgemm)
86+
87+ax_blas_save_LIBS="$LIBS"
88+LIBS="$LIBS $FLIBS"
89+
90+# First, check BLAS_LIBS environment variable
91+if test $ax_blas_ok = no; then
92+if test "x$BLAS_LIBS" != x; then
93+ save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS"
94+ AC_MSG_CHECKING([for $sgemm in $BLAS_LIBS])
95+ AC_TRY_LINK_FUNC($sgemm, [ax_blas_ok=yes], [BLAS_LIBS=""])
96+ AC_MSG_RESULT($ax_blas_ok)
97+ LIBS="$save_LIBS"
98+fi
99+fi
100+
101+# BLAS linked to by default? (happens on some supercomputers)
102+if test $ax_blas_ok = no; then
103+ save_LIBS="$LIBS"; LIBS="$LIBS"
104+ AC_MSG_CHECKING([if $sgemm is being linked in already])
105+ AC_TRY_LINK_FUNC($sgemm, [ax_blas_ok=yes])
106+ AC_MSG_RESULT($ax_blas_ok)
107+ LIBS="$save_LIBS"
108+fi
109+
110+# BLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
111+if test $ax_blas_ok = no; then
112+ AC_CHECK_LIB(atlas, ATL_xerbla,
113+ [AC_CHECK_LIB(f77blas, $sgemm,
114+ [AC_CHECK_LIB(cblas, cblas_dgemm,
115+ [ax_blas_ok=yes
116+ BLAS_LIBS="-lcblas -lf77blas -latlas"],
117+ [], [-lf77blas -latlas])],
118+ [], [-latlas])])
119+fi
120+
121+# BLAS in PhiPACK libraries? (requires generic BLAS lib, too)
122+if test $ax_blas_ok = no; then
123+ AC_CHECK_LIB(blas, $sgemm,
124+ [AC_CHECK_LIB(dgemm, $dgemm,
125+ [AC_CHECK_LIB(sgemm, $sgemm,
126+ [ax_blas_ok=yes; BLAS_LIBS="-lsgemm -ldgemm -lblas"],
127+ [], [-lblas])],
128+ [], [-lblas])])
129+fi
130+
131+# BLAS in Intel MKL library?
132+if test $ax_blas_ok = no; then
133+ AC_CHECK_LIB(mkl, $sgemm, [ax_blas_ok=yes;BLAS_LIBS="-lmkl -lguide -lpthread"],,[-lguide -lpthread])
134+fi
135+
136+# BLAS in Apple vecLib library?
137+if test $ax_blas_ok = no; then
138+ save_LIBS="$LIBS"; LIBS="-framework vecLib $LIBS"
139+ AC_MSG_CHECKING([for $sgemm in -framework vecLib])
140+ AC_TRY_LINK_FUNC($sgemm, [ax_blas_ok=yes;BLAS_LIBS="-framework vecLib"])
141+ AC_MSG_RESULT($ax_blas_ok)
142+ LIBS="$save_LIBS"
143+fi
144+
145+# BLAS in Alpha CXML library?
146+if test $ax_blas_ok = no; then
147+ AC_CHECK_LIB(cxml, $sgemm, [ax_blas_ok=yes;BLAS_LIBS="-lcxml"])
148+fi
149+
150+# BLAS in Alpha DXML library? (now called CXML, see above)
151+if test $ax_blas_ok = no; then
152+ AC_CHECK_LIB(dxml, $sgemm, [ax_blas_ok=yes;BLAS_LIBS="-ldxml"])
153+fi
154+
155+# BLAS in Sun Performance library?
156+if test $ax_blas_ok = no; then
157+ if test "x$GCC" != xyes; then # only works with Sun CC
158+ AC_CHECK_LIB(sunmath, acosp,
159+ [AC_CHECK_LIB(sunperf, $sgemm,
160+ [BLAS_LIBS="-xlic_lib=sunperf -lsunmath"
161+ ax_blas_ok=yes],[],[-lsunmath])])
162+ fi
163+fi
164+
165+# BLAS in SCSL library? (SGI/Cray Scientific Library)
166+if test $ax_blas_ok = no; then
167+ AC_CHECK_LIB(scs, $sgemm, [ax_blas_ok=yes; BLAS_LIBS="-lscs"])
168+fi
169+
170+# BLAS in SGIMATH library?
171+if test $ax_blas_ok = no; then
172+ AC_CHECK_LIB(complib.sgimath, $sgemm,
173+ [ax_blas_ok=yes; BLAS_LIBS="-lcomplib.sgimath"])
174+fi
175+
176+# BLAS in IBM ESSL library? (requires generic BLAS lib, too)
177+if test $ax_blas_ok = no; then
178+ AC_CHECK_LIB(blas, $sgemm,
179+ [AC_CHECK_LIB(essl, $sgemm,
180+ [ax_blas_ok=yes; BLAS_LIBS="-lessl -lblas"],
181+ [], [-lblas $FLIBS])])
182+fi
183+
184+# Generic BLAS library?
185+if test $ax_blas_ok = no; then
186+ AC_CHECK_LIB(blas, $sgemm, [ax_blas_ok=yes; BLAS_LIBS="-lblas"])
187+fi
188+
189+AC_SUBST(BLAS_LIBS)
190+
191+LIBS="$ax_blas_save_LIBS"
192+
193+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
194+if test x"$ax_blas_ok" = xyes; then
195+ ifelse([$1],,AC_DEFINE(HAVE_BLAS,1,[Define if you have a BLAS library.]),[$1])
196+ :
197+else
198+ ax_blas_ok=no
199+ $2
200+fi
201+])dnl AX_BLAS
--- /dev/null
+++ b/src/m4/ax_lapack.m4
@@ -0,0 +1,131 @@
1+# ===========================================================================
2+# http://www.gnu.org/software/autoconf-archive/ax_lapack.html
3+# ===========================================================================
4+#
5+# SYNOPSIS
6+#
7+# AX_LAPACK([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
8+#
9+# DESCRIPTION
10+#
11+# This macro looks for a library that implements the LAPACK linear-algebra
12+# interface (see http://www.netlib.org/lapack/). On success, it sets the
13+# LAPACK_LIBS output variable to hold the requisite library linkages.
14+#
15+# To link with LAPACK, you should link with:
16+#
17+# $LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS
18+#
19+# in that order. BLAS_LIBS is the output variable of the AX_BLAS macro,
20+# called automatically. FLIBS is the output variable of the
21+# AC_F77_LIBRARY_LDFLAGS macro (called if necessary by AX_BLAS), and is
22+# sometimes necessary in order to link with F77 libraries. Users will also
23+# need to use AC_F77_DUMMY_MAIN (see the autoconf manual), for the same
24+# reason.
25+#
26+# The user may also use --with-lapack=<lib> in order to use some specific
27+# LAPACK library <lib>. In order to link successfully, however, be aware
28+# that you will probably need to use the same Fortran compiler (which can
29+# be set via the F77 env. var.) as was used to compile the LAPACK and BLAS
30+# libraries.
31+#
32+# ACTION-IF-FOUND is a list of shell commands to run if a LAPACK library
33+# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
34+# is not found. If ACTION-IF-FOUND is not specified, the default action
35+# will define HAVE_LAPACK.
36+#
37+# LICENSE
38+#
39+# Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
40+#
41+# This program is free software: you can redistribute it and/or modify it
42+# under the terms of the GNU General Public License as published by the
43+# Free Software Foundation, either version 3 of the License, or (at your
44+# option) any later version.
45+#
46+# This program is distributed in the hope that it will be useful, but
47+# WITHOUT ANY WARRANTY; without even the implied warranty of
48+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
49+# Public License for more details.
50+#
51+# You should have received a copy of the GNU General Public License along
52+# with this program. If not, see <http://www.gnu.org/licenses/>.
53+#
54+# As a special exception, the respective Autoconf Macro's copyright owner
55+# gives unlimited permission to copy, distribute and modify the configure
56+# scripts that are the output of Autoconf when processing the Macro. You
57+# need not follow the terms of the GNU General Public License when using
58+# or distributing such scripts, even though portions of the text of the
59+# Macro appear in them. The GNU General Public License (GPL) does govern
60+# all other use of the material that constitutes the Autoconf Macro.
61+#
62+# This special exception to the GPL applies to versions of the Autoconf
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.
66+
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
73+
74+AC_ARG_WITH(lapack,
75+ [AS_HELP_STRING([--with-lapack=<lib>], [use LAPACK library <lib>])])
76+case $with_lapack in
77+ yes | "") ;;
78+ no) ax_lapack_ok=disable ;;
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.
84+AC_F77_FUNC(cheev)
85+
86+# We cannot use LAPACK if BLAS is not found
87+if test "x$ax_blas_ok" != xyes; then
88+ ax_lapack_ok=noblas
89+ LAPACK_LIBS=""
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])
96+ AC_TRY_LINK_FUNC($cheev, [ax_lapack_ok=yes], [LAPACK_LIBS=""])
97+ AC_MSG_RESULT($ax_lapack_ok)
98+ LIBS="$save_LIBS"
99+ if test $ax_lapack_ok = no; then
100+ LAPACK_LIBS=""
101+ fi
102+fi
103+
104+# LAPACK linked to by default? (is sometimes included in BLAS lib)
105+if test $ax_lapack_ok = no; then
106+ save_LIBS="$LIBS"; LIBS="$LIBS $BLAS_LIBS $FLIBS"
107+ AC_CHECK_FUNC($cheev, [ax_lapack_ok=yes])
108+ LIBS="$save_LIBS"
109+fi
110+
111+# Generic LAPACK library?
112+for lapack in lapack lapack_rs6k; do
113+ if test $ax_lapack_ok = no; then
114+ save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS"
115+ AC_CHECK_LIB($lapack, $cheev,
116+ [ax_lapack_ok=yes; LAPACK_LIBS="-l$lapack"], [], [$FLIBS])
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:
124+if test x"$ax_lapack_ok" = xyes; then
125+ ifelse([$1],,AC_DEFINE(HAVE_LAPACK,1,[Define if you have LAPACK library.]),[$1])
126+ :
127+else
128+ ax_lapack_ok=no
129+ $2
130+fi
131+])dnl AX_LAPACK