2 # Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 m4_define([_m4_LIB_GMP],
23 [ --without-gmp don't use GNU multiple precision arithmetic library],
24 [use_gmp=$withval], [use_gmp=yes])
26 case $use_gmp:$LIBADD_GMP:$ac_cv_header_gmp_h in
28 AC_MSG_WARN([gmp library not found or does not appear to work
29 but `gmp.h' is present])
30 m4_cv_using_lib_gmp=no
33 AC_MSG_WARN([gmp works but `gmp.h' is missing])
34 m4_cv_using_lib_gmp=no
37 m4_cv_using_lib_gmp=yes
40 m4_cv_using_lib_gmp=no
46 AC_DEFUN([m4_LIB_GMP],
47 [AC_PREREQ(2.56)dnl We use the new compiler based header checking in 2.56
48 AC_CHECK_HEADERS([gmp.h], [], [], [AC_INCLUDES_DEFAULT])
49 m4_pattern_allow([^m4_gmp_save_LIBS$])
50 m4_pattern_allow([^m4_cv_using_lib_gmp])
51 # Some versions of gmp provide mpq_init as a macro, so we need to
52 # include the header file, otherwise the detection will fail.
53 m4_gmp_save_LIBS="$LIBS"
55 AC_TRY_LINK([#if HAVE_GMP_H
58 [mpq_t n; mpq_init (n);],
60 LIBS=$m4_gmp_save_LIBS
61 AC_SUBST([LIBADD_GMP])
63 AC_CACHE_CHECK([if using GNU multiple precision arithmetic library],
64 [m4_cv_using_lib_gmp],
67 # Don't try to link in libgmp if we are not using it after the last call
68 if test "$m4_cv_using_lib_gmp" = yes; then
70 [Define to 1 if using the GNU multiple precision library.])
73 AC_SUBST([USE_GMP], [$m4_cv_using_lib_gmp])