-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgsl.m4
79 lines (61 loc) · 1.75 KB
/
gsl.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Configure path for the GSL library.
# Denis Arnaud <[email protected]>, May 2007
AC_DEFUN([AM_PATH_GSL],
[
AC_ARG_WITH(gsl,
[ --with-gsl=PFX Prefix where GSL is installed (optional)],
gsl_dir="$withval",
gsl_dir="")
if test "x${GSL_CONFIG+set}" != xset ; then
if test "x$gsl_dir" != x ; then
GSL_CONFIG="$gsl_dir/bin/gsl-config"
fi
fi
AC_PATH_PROG(GSL_CONFIG, gsl-config, no)
min_gsl_version=ifelse([$1], ,0.11.0,$1)
AC_MSG_CHECKING(for GSL - version >= $min_gsl_version)
no_gsl=""
if test "$GSL_CONFIG" = "no" ; then
no_gsl=yes
AC_MSG_RESULT([no])
else
GSL_VERSION=`$GSL_CONFIG --version`
GSL_CFLAGS=`$GSL_CONFIG --cflags`
GSL_LIBS=`$GSL_CONFIG --libs`
AC_SUBST([GSL_VERSION])
AC_SUBST([GSL_CFLAGS])
AC_SUBST([GSL_LIBS])
gsl_major_version=`echo $GSL_VERSION | sed 's/^\([[0-9]]*\).*/\1/'`
if test "x${gsl_major_version}" = "x" ; then
gsl_major_version=0
fi
gsl_minor_version=`echo $GSL_VERSION | \
sed 's/^\([[0-9]]*\)\.\{0,1\}\([[0-9]]*\).*/\2/'`
if test "x${gsl_minor_version}" = "x" ; then
gsl_minor_version=0
fi
gsl_micro_version=`echo $GSL_VERSION | \
sed 's/^\([[0-9]]*\)\.\{0,1\}\([[0-9]]*\)\.\{0,1\}\([[0-9]]*\).*/\3/'`
if test "x${gsl_micro_version}" = "x" ; then
gsl_micro_version=0
fi
SAVED_CPPFLAGS="$CPPFLAGS"
SAVED_LDFLAGS="$LDFLAGS"
CPPFLAGS="$CPPFLAGS $GSL_CFLAGS"
LDFLAGS="$LDFLAGS $GSL_LIBS"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
#include <gsl/gsl_types.h>
]],
[[int i=0;]]
)]
,
[AC_MSG_RESULT([yes ($GSL_VERSION)])],
[
AC_MSG_ERROR([We could not compile a simple GSL example. See config.log.])
]
)
CPPFLAGS="$SAVED_CPPFLAGS"
LDFLAGS="$SAVED_LDFLAGS"
fi
])