source: branches/0.5-stable/m4/gsl.m4 @ 2043

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

fixes #558

Replaced GSL runtime test with a link test. I tried to keep the error
messages as before, but I pass them through AC_MSG_WARN while some
were previously printed from the test program and some were created
through echo calls.

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