source: trunk/m4/yat_cblas.m4 @ 2868

Last change on this file since 2868 was 2868, checked in by Peter, 9 years ago

refs #729. Add configure tests for samtools

  • 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 2868 2012-11-12 21:28:40Z 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], [
46AC_PREREQ([2.60]) dnl we use AS_CASE
47yat_cblas_ok=no;
48save_LIBS=$LIBS;
49
50AC_ARG_WITH([cblas],
51            [AS_HELP_STRING([--with-cblas=LIB], [use CBLAS library LIB])])
52
53AS_CASE([$with_cblas],
54        [yes | ""], ,
55        [no], [yat_cblas_ok=disable],
56        [-* | */* | *.a | *.so | *.so.* | *.o], [CBLAS_LIB="$with_blas"],
57        [CBLAS_LIB="-l$with_blas"])
58
59# First, check CBLAS_LIB environment variable
60AS_IF([test $yat_cblas_ok = no && test "x$CBLAS_LIB" != x],
61      [AC_LINK_IFELSE([AC_LANG_CALL(,[cblas_sgemm])],
62                      [yat_cblas_ok=yes],
63                      [CBLAS_LIB=""])])
64
65# CBLAS linked to by default (or with current LIBS)
66if test $yat_cblas_ok = no; then
67  AC_MSG_CHECKING([for cblas_sgemm])
68  AC_LINK_IFELSE([AC_LANG_CALL(,[cblas_sgemm])],
69                 [yat_cblas_ok=yes CBLAS_LIB=""])
70  AC_MSG_RESULT([$yat_cblas_ok])
71fi
72
73# CBLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
74if test $yat_cblas_ok = no; then
75  AC_SEARCH_LIBS([ATL_xerbla], [atlas],
76                 [AC_SEARCH_LIBS([cblas_sgemm], [cblas],
77                                 [yat_cblas_ok=yes;
78                                  CBLAS_LIB="-lcblas -latlas"])])
79  LIBS=$save_LIBS;
80fi
81
82if test $yat_cblas_ok = no; then
83  AC_CHECK_LIB([cblas], [cblas_sgemm], [yat_cblas_ok=yes; CBLAS_LIB="-lcblas";])
84fi
85
86# CBLAS in Intel MKL library?
87if test $yat_cblas_ok = no; then
88  AC_CHECK_LIB([mkl_core], [cblas_sgemm],
89               [acx_blas_ok=yes; CBLAS_LIBS="-lmkl_core"])
90fi
91
92# CBLAS in SCSL library?  (SGI/Cray Scientific Library)
93if test $yat_cblas_ok = no; then
94  AC_CHECK_LIB([scs], [cblas_sgemm], [yat_cblas_ok=yes; CBLAS_LIB="-lscs"])
95fi
96
97# Eexecute ACTION-IF-FOUND or ACTION-IF-NOT-FOUND
98AS_IF([test x"$yat_cblas_ok" = xyes],
99      [m4_default([$1], [:])],
100      [yat_cblas_ok=no; m4_default([$2], [:])])
101])dnl YAT_CBLAS
Note: See TracBrowser for help on using the repository browser.