source: trunk/m4/yat_cblas.m4 @ 3452

Last change on this file since 3452 was 3452, checked in by Peter, 6 years ago

fix typo, leftover from mother code

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