source: trunk/m4/gsl.m4 @ 2129

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

New configure option 'with-gsl=DIR'. This option also accepts 'no' as
an argument or equivalently '--without-gsl' in which case no check for
GSL will be performed. The old --with-gsl-prefix and
--with-gsl-exec-prefix are deprecated.

fixes #544

  • Property svn:eol-style set to native
File size: 2.7 KB
Line 
1# Configure path for the GNU Scientific Library
2# Christopher R. Gabriel <cgabriel@linux.it>, April 2000
3
4
5AC_DEFUN([AX_PATH_GSL],
6[
7AC_ARG_WITH([gsl-prefix],[],
8            [AC_MSG_WARN([option --with-gsl-prefix is deprecated])
9             gsl_prefix="$withval"], [gsl_prefix=""])
10
11AC_ARG_WITH([gsl-exec-prefix],[],
12            [AC_MSG_WARN([option --with-gsl-exec-prefix is deprecated])
13             gsl_exec_prefix="$withval"], [gsl_exec_prefix=""])
14
15  if test "x${GSL_CONFIG+set}" != xset ; then
16     if test "x$gsl_prefix" != x ; then
17         GSL_CONFIG="$gsl_prefix/bin/gsl-config"
18     fi
19     if test "x$gsl_exec_prefix" != x ; then
20        GSL_CONFIG="$gsl_exec_prefix/bin/gsl-config"
21     fi
22     if test "x$with_gsl" != x ; then
23        GSL_CONFIG="$with_gsl/bin/gsl-config"
24     fi
25  fi
26
27  AC_PATH_PROG(GSL_CONFIG, gsl-config, no)
28  min_gsl_version=ifelse([$1], ,0.2.5,$1)
29  AC_MSG_CHECKING(for GSL - version >= $min_gsl_version)
30  no_gsl=""
31  if test "$GSL_CONFIG" = "no" ; then
32    no_gsl=yes
33    AC_MSG_RESULT([no])
34    AC_MSG_WARN([
35       The gsl-config script installed by GSL could not be found
36       If GSL was installed in PREFIX, make sure PREFIX/bin is in
37       your path, or set the GSL_CONFIG environment variable to the
38       full path to gsl-config.
39    ])
40  else
41    GSL_CFLAGS=`$GSL_CONFIG --cflags`
42    GSL_LIBS=`$GSL_CONFIG --libs`
43    ac_save_LIBS="$LIBS"
44    CXXFLAGS="$CXXFLAGS $GSL_CFLAGS"
45    LIBS="$GSL_LIBS $LIBS"
46    AC_LINK_IFELSE([AC_LANG_PROGRAM(, [return 0])],,[no_gsl=yes]) 
47    LIBS="$ac_save_LIBS"
48  fi
49
50  if test "x$no_gsl" = xyes ; then
51    AC_MSG_RESULT([no])
52    AC_MSG_WARN([
53     The test program failed to compile or link. See the config.log
54     for the exact error that occured. This usually means GSL was
55     incorrectly installed or that you have moved GSL since it was
56     installed. In the latter case, you may want to edit the
57     gsl-config script: $GSL_CONFIG.
58    ])
59  else
60    ac_gsl_version=`$GSL_CONFIG --version`
61    AX_COMPARE_VERSION([$ac_gsl_version], [ge], [$min_gsl_version],,[no_gsl=yes])
62    AC_MSG_RESULT([$ac_gsl_version])
63    if test "x$no_gsl" = xyes ; then
64      AC_MSG_WARN([
65       gsl-config --version returned $ac_gsl_version, but the minimum
66       version of GSL required is $min_gsl_version. If gsl-config is
67       correct, then it is best to upgrade to the required version. If
68       gsl-config was wrong, set the environment variable GSL_CONFIG to
69       point to the correct copy of gsl-config, and remove the file
70       config.cache before re-running configure. 
71      ])
72    fi
73  fi
74
75  if test "x$no_gsl" = x ; then
76     ifelse([$2], , :, [$2])     
77  else
78     ifelse([$3], , :, [$3])
79  fi
80  AC_SUBST(GSL_CFLAGS)
81  AC_SUBST(GSL_LIBS)
82])
83
84AU_ALIAS([AM_PATH_GSL], [AX_PATH_GSL])
Note: See TracBrowser for help on using the repository browser.