source: git/m4/gmp-check.m4 @ 1e09dec

fieker-DuValspielwiese
Last change on this file since 1e09dec was 1e09dec, checked in by Matthias Koeppe <mkoeppe@…>, 3 years ago
m4/gmp-check.m4: Fix handling of the --with-gmp=path option
  • Property mode set to 100644
File size: 1.2 KB
Line 
1AC_DEFUN([SING_CHECK_GMP], [
2AC_REQUIRE([SING_DEFAULT_CHECKING_PATH])
3# Check whether --with-gmp was given.
4AC_ARG_WITH([gmp],[AS_HELP_STRING([--with-gmp=path],
5                    [provide a non-standard location of gmp])], [
6    dnl Given
7if test "$with_gmp" = yes ; then
8        GMP_HOME_PATH="${DEFAULT_CHECKING_PATH}"
9elif test "$with_gmp" != no ; then
10        GMP_HOME_PATH="$with_gmp"
11else
12     AC_MSG_ERROR([Use of GNU MP is required, cannot use --without-gmp])
13fi
14], [
15    dnl Not given
16    GMP_HOME_PATH="${DEFAULT_CHECKING_PATH}"
17])
18
19BACKUP_CFLAGS=${CFLAGS}
20BACKUP_LIBS=${LIBS}
21
22gmp_found=no
23for GMP_HOME in ${GMP_HOME_PATH}
24do
25    if test "x$GMP_HOME" != "x/usr"; then
26      GMP_CPPFLAGS="-I${GMP_HOME}/include"
27      GMP_LIBS="-L${GMP_HOME}/lib -Wl,-rpath,${GMP_HOME}/lib -lgmp"
28      CFLAGS="${GMP_CPPFLAGS} ${BACKUP_CFLAGS}"
29      LIBS=" ${GMP_LIBS} ${BACKUP_LIBS}"
30    else
31      GMP_CPPFLAGS=""
32      GMP_LIBS="-lgmp"
33    fi
34    AC_TRY_LINK([#include <gmp.h>
35                ],
36                [mpz_t a; mpz_init (a);], [
37      gmp_found=yes
38    ])
39done
40if test "$gmp_found" != yes; then
41    AC_MSG_ERROR([GNU MP not found])
42fi
43
44AC_SUBST(GMP_CPPFLAGS)
45AC_SUBST(GMP_LIBS)
46
47])
Note: See TracBrowser for help on using the repository browser.