source: trunk/m4/yat_cblas.m4 @ 2044

Last change on this file since 2044 was 2044, checked in by Peter, 12 years ago

prefer AS_HELP_STRING

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Date
File size: 3.2 KB
Line 
1## $Id: yat_cblas.m4 2044 2009-09-01 18:56:03Z peter $
2
3# SYNOPSIS
4#
5#   YAT_LIB_CBLAS([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
6#
7# DESCRIPTION
8#
9#   This macro looks for a library that implements the BLAS C API. The
10#   macro adds a configure option --with-cblas=LIB that can be used to
11#   select a specific CBLAS library.
12#
13#   On success it sets the YAT_CBLAS_LIB variable and execute
14#   ACTION-IF-FOUND. Otherise ACTION-IF-NOT-FOUND is executed.
15#
16# COPYLEFT
17#
18#   Copyright (C) 2009 Peter Johansson
19#
20#   This file is part of the yat library, http://dev.thep.lu.se/yat
21#
22#   The yat library is free software; you can redistribute it and/or
23#   modify it under the terms of the GNU General Public License as
24#   published by the Free Software Foundation; either version 3 of the
25#   License, or (at your option) any later version.
26#
27#   The yat library is distributed in the hope that it will be useful,
28#   but WITHOUT ANY WARRANTY; without even the implied warranty of
29#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
30#   General Public License for more details.
31#
32#   You should have received a copy of the GNU General Public License
33#   along with yat. If not, see <http://www.gnu.org/licenses/>.
34#
35
36#   This macro is a slimmed and modified version of the ACX_BLAS macro
37#   available from http://autoconf-archive.cryp.to/acx_blas.html
38#   written by Steven G. Johnson <stevenj@alum.mit.edu>
39
40#
41# serial 0 
42#
43
44
45AC_DEFUN([YAT_LIB_CBLAS], [
46yat_cblas_ok=no;
47save_LIBS=$LIBS;
48
49AC_ARG_WITH([cblas],
50            [AS_HELP_STRING([--with-cblas=LIB], [use CBLAS library LIB])])
51
52AS_CASE([$with_cblas],
53        [yes | ""], ,
54        [no], [yat_cblas_ok=disable],
55        [-* | */* | *.a | *.so | *.so.* | *.o], [CBLAS_LIB="$with_blas"],
56        [CBLAS_LIB="-l$with_blas"])
57
58# First, check CBLAS_LIB environment variable
59AS_IF([test $yat_cblas_ok = no && test "x$CBLAS_LIB" != x],
60      [AC_LINK_IFELSE([AC_LANG_CALL(,[cblas_sgemm])],
61                      [yat_cblas_ok=yes],
62                      [CBLAS_LIB=""])])
63
64# CBLAS linked to by default (or with current LIBS)
65if test $yat_cblas_ok = no; then
66  AC_MSG_CHECKING([for cblas_sgemm])
67  AC_LINK_IFELSE([AC_LANG_CALL(,[cblas_sgemm])],
68                 [yat_cblas_ok=yes CBLAS_LIB=""])
69  AC_MSG_RESULT([$yat_cblas_ok])
70fi
71
72# CBLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
73if test $yat_cblas_ok = no; then
74  AC_SEARCH_LIBS([ATL_xerbla], [atlas],
75                 [AC_SEARCH_LIBS([cblas_sgemm], [cblas],
76                                 [yat_cblas_ok=yes;
77                                  CBLAS_LIB="-lcblas -latlas"])])
78  LIBS=$save_LIBS;
79fi
80
81if test $yat_cblas_ok = no; then
82  AC_CHECK_LIB([cblas], [cblas_sgemm], [yat_cblas_ok=yes; CBLAS_LIB="-lcblas";])
83fi
84
85# CBLAS in Intel MKL library?
86if test $yat_cblas_ok = no; then
87  AC_CHECK_LIB([mkl_core], [cblas_sgemm],
88               [acx_blas_ok=yes; CBLAS_LIBS="-lmkl_core"])
89fi
90
91# CBLAS in SCSL library?  (SGI/Cray Scientific Library)
92if test $yat_cblas_ok = no; then
93  AC_CHECK_LIB([scs], [cblas_sgemm], [yat_cblas_ok=yes; CBLAS_LIB="-lscs"])
94fi
95
96# Eexecute ACTION-IF-FOUND or ACTION-IF-NOT-FOUND
97AS_IF([test x"$yat_cblas_ok" = xyes],
98      [m4_default([$1], [:])],
99      [yat_cblas_ok=no; m4_default([$2], [:])])
100])dnl YAT_CBLAS
Note: See TracBrowser for help on using the repository browser.