source: trunk/m4/yat_gsl.m4 @ 1895

Last change on this file since 1895 was 1895, checked in by Peter, 14 years ago

fixes #386. Add test that gsl header files are available. Add 'GSL_CONFIG --cflags' to CPPFLAGS (unless it's a default path) to make the test work also when header files are installed in non-standard location. The flag is stored and used downstream.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Date
File size: 1.9 KB
Line 
1## $Id: yat_gsl.m4 1895 2009-04-15 19:11:59Z peter $
2
3#   Copyright (C) 2009 Peter Johansson
4#
5#   This file is part of the yat library, http://dev.thep.lu.se/yat
6#
7#   The yat library is free software; you can redistribute it and/or
8#   modify it under the terms of the GNU General Public License as
9#   published by the Free Software Foundation; either version 3 of the
10#   License, or (at your option) any later version.
11#
12#   The yat library is distributed in the hope that it will be useful,
13#   but WITHOUT ANY WARRANTY; without even the implied warranty of
14#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15#   General Public License for more details.
16#
17#   You should have received a copy of the GNU General Public License
18#   along with yat. If not, see <http://www.gnu.org/licenses/>.
19#
20
21#
22# serial 0 
23#
24# see http://www.gnu.org/software/automake/manual/automake.html#Serials
25
26
27#
28#
29#
30AC_DEFUN([YAT_CHECK_GSL],
31[
32  yat_gsl_status="ok"
33  AX_PATH_GSL([$1],,[yat_gsl_status="no"])
34
35  AS_IF([test "x$yat_gsl_status" = "xok"],
36        [YAT_CHECK_GSL_HEADER([gsl/gsl_version.h],,
37                              [yat_gsl_status="no-header"])
38        ])
39
40  # check if failure was due to too old gsl
41  AS_IF([test "x$yat_gsl_status" = "xno" && \
42         test -f "$GSL_CONFIG" && $GSL_CONFIG --help >/dev/null 2>&1],
43        [yat_gsl_status="old"
44        ])
45     
46  # if everything is fine, append to gsl variables to LIBS and friends
47  AS_IF([test "x$yat_gsl_status" = "xok"],
48        [LIBS="-lgsl $LIBS"
49         # grep words starting with '-L' in other words LDFLAGS
50         for i in $GSL_LIBS; do
51           AS_IF([test ${i:0:2} = "-L"],
52                 [YAT_LD_ADD_FLAG([LDFLAGS], [$i])])
53         done
54        ])
55
56]) # YAT_CHECK_GSL
57
58AC_DEFUN([YAT_CHECK_GSL_HEADER],
59[
60  save_CPPFLAGS=$CPPFLAGS
61  YAT_CPP_ADD_FLAG([$CPPFLAGS],[`$GSL_CONFIG --cflags`])
62  AC_CHECK_HEADER([$1], [$2], [$3])
63]) # YAT_CHECK_GSL_HEADER
Note: See TracBrowser for help on using the repository browser.