source: m4/ax_blas.m4@ 4464ef

Action_Thermostats Add_AtomRandomPerturbation Add_RotateAroundBondAction Add_SelectAtomByNameAction Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_ChronosMutex Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion GeometryObjects Gui_displays_atomic_force_velocity IndependentFragmentGrids_IntegrationTest JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks RotateToPrincipalAxisSystem_UndoRedo StoppableMakroAction Subpackage_levmar Subpackage_vmg ThirdParty_MPQC_rebuilt_buildsystem TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps Ubuntu_1604_changes stable
Last change on this file since 4464ef was f06d52, checked in by Frederik Heber <heber@…>, 12 years ago

Added LevMartester that employs levmar package for non-linear regression.

  • as liblevmar is not a dynamically linked library, we don't need lapack.
  • path to levmar has to be given with --with-levmar (and is not tested so far).
  • LevMartester is linked against liblevmar and with includes.
  • copied Meyer's (reformulated) problem from lmdemo.c which is solved to same result.
  • Property mode set to 100644
File size: 7.9 KB
Line 
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 14
67
68AU_ALIAS([ACX_BLAS], [AX_BLAS])
69AC_DEFUN([AX_BLAS], [
70AC_PREREQ(2.50)
71AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS])
72AC_REQUIRE([AC_CANONICAL_HOST])
73ax_blas_ok=no
74
75AC_ARG_WITH(blas,
76 [AS_HELP_STRING([--with-blas=<lib>], [use BLAS library <lib>])])
77case $with_blas in
78 yes | "") ;;
79 no) ax_blas_ok=disable ;;
80 -* | */* | *.a | *.so | *.so.* | *.o) BLAS_LIBS="$with_blas" ;;
81 *) BLAS_LIBS="-l$with_blas" ;;
82esac
83
84# Get fortran linker names of BLAS functions to check for.
85AC_F77_FUNC(sgemm)
86AC_F77_FUNC(dgemm)
87
88ax_blas_save_LIBS="$LIBS"
89LIBS="$LIBS $FLIBS"
90
91# First, check BLAS_LIBS environment variable
92if test $ax_blas_ok = no; then
93if test "x$BLAS_LIBS" != x; then
94 save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS"
95 AC_MSG_CHECKING([for $sgemm in $BLAS_LIBS])
96 AC_TRY_LINK_FUNC($sgemm, [ax_blas_ok=yes], [BLAS_LIBS=""])
97 AC_MSG_RESULT($ax_blas_ok)
98 LIBS="$save_LIBS"
99fi
100fi
101
102# BLAS linked to by default? (happens on some supercomputers)
103if test $ax_blas_ok = no; then
104 save_LIBS="$LIBS"; LIBS="$LIBS"
105 AC_MSG_CHECKING([if $sgemm is being linked in already])
106 AC_TRY_LINK_FUNC($sgemm, [ax_blas_ok=yes])
107 AC_MSG_RESULT($ax_blas_ok)
108 LIBS="$save_LIBS"
109fi
110
111# BLAS in OpenBLAS library? (http://xianyi.github.com/OpenBLAS/)
112if test $ax_blas_ok = no; then
113 AC_CHECK_LIB(openblas, $sgemm, [ax_blas_ok=yes
114 BLAS_LIBS="-lopenblas"])
115fi
116
117# BLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
118if test $ax_blas_ok = no; then
119 AC_CHECK_LIB(atlas, ATL_xerbla,
120 [AC_CHECK_LIB(f77blas, $sgemm,
121 [AC_CHECK_LIB(cblas, cblas_dgemm,
122 [ax_blas_ok=yes
123 BLAS_LIBS="-lcblas -lf77blas -latlas"],
124 [], [-lf77blas -latlas])],
125 [], [-latlas])])
126fi
127
128# BLAS in PhiPACK libraries? (requires generic BLAS lib, too)
129if test $ax_blas_ok = no; then
130 AC_CHECK_LIB(blas, $sgemm,
131 [AC_CHECK_LIB(dgemm, $dgemm,
132 [AC_CHECK_LIB(sgemm, $sgemm,
133 [ax_blas_ok=yes; BLAS_LIBS="-lsgemm -ldgemm -lblas"],
134 [], [-lblas])],
135 [], [-lblas])])
136fi
137
138# BLAS in Intel MKL library?
139if test $ax_blas_ok = no; then
140 # MKL for gfortran
141 if test x"$ac_cv_fc_compiler_gnu" = xyes; then
142 # 64 bit
143 if test $host_cpu = x86_64; then
144 AC_CHECK_LIB(mkl_gf_lp64, $sgemm,
145 [ax_blas_ok=yes;BLAS_LIBS="-lmkl_gf_lp64 -lmkl_sequential -lmkl_core -lpthread"],,
146 [-lmkl_gf_lp64 -lmkl_sequential -lmkl_core -lpthread])
147 # 32 bit
148 elif test $host_cpu = i686; then
149 AC_CHECK_LIB(mkl_gf, $sgemm,
150 [ax_blas_ok=yes;BLAS_LIBS="-lmkl_gf -lmkl_sequential -lmkl_core -lpthread"],,
151 [-lmkl_gf -lmkl_sequential -lmkl_core -lpthread])
152 fi
153 # MKL for other compilers (Intel, PGI, ...?)
154 else
155 # 64-bit
156 if test $host_cpu = x86_64; then
157 AC_CHECK_LIB(mkl_intel_lp64, $sgemm,
158 [ax_blas_ok=yes;BLAS_LIBS="-lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread"],,
159 [-lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread])
160 # 32-bit
161 elif test $host_cpu = i686; then
162 AC_CHECK_LIB(mkl_intel, $sgemm,
163 [ax_blas_ok=yes;BLAS_LIBS="-lmkl_intel -lmkl_sequential -lmkl_core -lpthread"],,
164 [-lmkl_intel -lmkl_sequential -lmkl_core -lpthread])
165 fi
166 fi
167fi
168# Old versions of MKL
169if test $ax_blas_ok = no; then
170 AC_CHECK_LIB(mkl, $sgemm, [ax_blas_ok=yes;BLAS_LIBS="-lmkl -lguide -lpthread"],,[-lguide -lpthread])
171fi
172
173# BLAS in Apple vecLib library?
174if test $ax_blas_ok = no; then
175 save_LIBS="$LIBS"; LIBS="-framework vecLib $LIBS"
176 AC_MSG_CHECKING([for $sgemm in -framework vecLib])
177 AC_TRY_LINK_FUNC($sgemm, [ax_blas_ok=yes;BLAS_LIBS="-framework vecLib"])
178 AC_MSG_RESULT($ax_blas_ok)
179 LIBS="$save_LIBS"
180fi
181
182# BLAS in Alpha CXML library?
183if test $ax_blas_ok = no; then
184 AC_CHECK_LIB(cxml, $sgemm, [ax_blas_ok=yes;BLAS_LIBS="-lcxml"])
185fi
186
187# BLAS in Alpha DXML library? (now called CXML, see above)
188if test $ax_blas_ok = no; then
189 AC_CHECK_LIB(dxml, $sgemm, [ax_blas_ok=yes;BLAS_LIBS="-ldxml"])
190fi
191
192# BLAS in Sun Performance library?
193if test $ax_blas_ok = no; then
194 if test "x$GCC" != xyes; then # only works with Sun CC
195 AC_CHECK_LIB(sunmath, acosp,
196 [AC_CHECK_LIB(sunperf, $sgemm,
197 [BLAS_LIBS="-xlic_lib=sunperf -lsunmath"
198 ax_blas_ok=yes],[],[-lsunmath])])
199 fi
200fi
201
202# BLAS in SCSL library? (SGI/Cray Scientific Library)
203if test $ax_blas_ok = no; then
204 AC_CHECK_LIB(scs, $sgemm, [ax_blas_ok=yes; BLAS_LIBS="-lscs"])
205fi
206
207# BLAS in SGIMATH library?
208if test $ax_blas_ok = no; then
209 AC_CHECK_LIB(complib.sgimath, $sgemm,
210 [ax_blas_ok=yes; BLAS_LIBS="-lcomplib.sgimath"])
211fi
212
213# BLAS in IBM ESSL library? (requires generic BLAS lib, too)
214if test $ax_blas_ok = no; then
215 AC_CHECK_LIB(blas, $sgemm,
216 [AC_CHECK_LIB(essl, $sgemm,
217 [ax_blas_ok=yes; BLAS_LIBS="-lessl -lblas"],
218 [], [-lblas $FLIBS])])
219fi
220
221# Generic BLAS library?
222if test $ax_blas_ok = no; then
223 AC_CHECK_LIB(blas, $sgemm, [ax_blas_ok=yes; BLAS_LIBS="-lblas"])
224fi
225
226AC_SUBST(BLAS_LIBS)
227
228LIBS="$ax_blas_save_LIBS"
229
230# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
231if test x"$ax_blas_ok" = xyes; then
232 ifelse([$1],,AC_DEFINE(HAVE_BLAS,1,[Define if you have a BLAS library.]),[$1])
233 :
234else
235 ax_blas_ok=no
236 $2
237fi
238])dnl AX_BLAS
Note: See TracBrowser for help on using the repository browser.