File: gsl.m4

package info (click to toggle)
cpl-plugin-fors 5.3.32%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 16,920 kB
  • sloc: ansic: 91,690; cpp: 17,755; sh: 4,278; python: 1,265; makefile: 1,015
file content (123 lines) | stat: -rw-r--r-- 4,157 bytes parent folder | download | duplicates (35)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# LIB_CHECK_GSL
#------------------
# Checks for the gsl library and header files.
AC_DEFUN([CPL_CHECK_GSL],
[

    AC_MSG_CHECKING([for gsl])

    AC_ARG_WITH(gsl,
                AS_HELP_STRING([--with-gsl],
                               [location where gsl is installed]),
                [
                    cpl_gsl_dir=$withval
                ])

    export PKG_CONFIG_PATH="$cpl_gsl_dir/lib/pkgconfig:$cpl_gsl_dir/lib64/pkgconfig:$GSLDIR/lib/pkgconfig/:$GSLDIR/lib64/pkgconfig/:$PKG_CONFIG_PATH"

    AC_SUBST(PKG_CONFIG_PATH)
    PKG_CHECK_MODULES([GSL], [gsl], 
                      [AC_DEFINE([HAVE_LIBGSL], [1], [Define to 1 iff you have GSL])
                       AC_DEFINE(HAVE_GSL, 1, [Define to 1 iff you have GSL])],
                      AC_MSG_WARN([No GSL available]))

])

# GSL_CHECK_LIBS
#---------------
# Checks for the GSL libraries and header files, does not require pkg-config
# If the first argument is "optional" the check is allowed to fail, otherwise
# missing GSL is a fatal error
# adds --with-gsl{,-libs,-includes}, --disable-gsl-test and sets
# GSL_INCLUDES
# GSL_LDFLAGS
# GSL_LIBS
# It defines HAVE_GSL and HAVE_LIBGSL in config.h
AC_DEFUN([GSL_CHECK_LIBS],
[

    AC_MSG_CHECKING([for GSL])

    gsl_check_gsl_lib="-lgsl -lgslcblas"

    gsl_includes=""
    gsl_libraries=""

    AC_ARG_WITH(gsl,
                AS_HELP_STRING([--with-gsl],
                               [location where GSL is installed]),
                [
                    gsl_with_gsl_includes=$withval/include
                    # opensuse defaults also non systems installations to lib64 ...
                    gsl_with_gsl_libs="-L$withval/lib -L$withval/lib64 -L$withval/lib32"
                ])

    AC_ARG_WITH(gsl-includes,
                AS_HELP_STRING([--with-gsl-includes],
                               [location of the GSL header files]),
                gsl_with_gsl_includes=$withval)

    AC_ARG_WITH(gsl-libs,
                AS_HELP_STRING([--with-gsl-libs],
                               [location of the GSL library]),
                gsl_with_gsl_libs=-L$withval)

    AC_ARG_ENABLE(gsl-test,
                  AS_HELP_STRING([--disable-gsl-test],
                                 [disables checks for the GSL library and headers]),
                  gsl_enable_gsl_test=$enableval,
                  gsl_enable_gsl_test=yes)


    if test "x$gsl_enable_gsl_test" = xyes; then
        save_LDFLAGS="$LDFLAGS"
        save_LIBS="$LIBS"
        save_CFLAGS="$CFLAGS"
        if test -n "$gsl_with_gsl_libs"; then
            LDFLAGS="$gsl_with_gsl_libs"
        elif test -n "$GSLDIR"; then
            LDFLAGS="-L$GSLDIR/lib -L$GSLDIR/lib64 -L$GSLDIR/lib32"
        else
            LDFLAGS=""
        fi
        if test -n "$gsl_with_gsl_includes"; then
            CFLAGS="-I$gsl_with_gsl_includes"
        elif test -n "$GSLDIR"; then
            CFLAGS="-I$GSLDIR/include"
        else
            CFLAGS=""
        fi
        LIBS=$gsl_check_gsl_lib

        AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gsl/gsl_sf_bessel.h>]], [[gsl_sf_bessel_J0(5.);]])],[
                        AC_MSG_RESULT(yes)
                        AC_DEFINE(HAVE_GSL, 1, [Define to 1 iff you have GSL])
                        AC_DEFINE(HAVE_LIBGSL, 1, [Define to 1 iff you have GSL])
                        # Set up the symbols
                        GSL_INCLUDES="$CFLAGS"
                        GSL_LDFLAGS="$LDFLAGS"
                        GSL_LIBS="$gsl_check_gsl_lib"
                    ],[
                        if test "x$1" = xoptional; then
                            AC_MSG_NOTICE([Optional GSL not found])
                        else
                            AC_MSG_ERROR([GSL not found])
                        fi
                    ])

        LDFLAGS="$save_LDFLAGS"
        LIBS="$save_LIBS"
        CFLAGS="$save_CFLAGS"
    else
        AC_MSG_RESULT([disabled])
        AC_MSG_WARN([GSL checks have been disabled! This package may not build!])
        GSL_INCLUDES=""
        GSL_LDFLAGS=""
        GSL_LIBS=""
    fi

    AC_SUBST(GSL_INCLUDES)
    AC_SUBST(GSL_LDFLAGS)
    AC_SUBST(GSL_LIBS)

])