16 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
17 |
# 02111-1307 USA |
# 02111-1307 USA |
18 |
|
|
19 |
# serial 3 |
# serial 4 |
20 |
|
|
21 |
AC_DEFUN([AM_WITH_GMP], |
m4_define([_AC_LIB_GMP], |
22 |
[AC_MSG_CHECKING(if extended and fractional arithmetic is wanted) |
[AC_ARG_WITH(gmp, |
23 |
AC_ARG_WITH(gmp, |
[ --without-gmp don't use GNU multiple precision arithmetic library], |
24 |
[ --with-gmp use gmp for extended and fractional arithmetic], |
[use_gmp=$withval], [use_gmp=yes]) |
25 |
[use_gmp=$withval], [use_gmp=no]) |
|
26 |
AC_MSG_RESULT($use_gmp) |
case $use_gmp:$GMP_LIB:$ac_cv_header_gmp_h in |
27 |
|
*::yes) |
28 |
if test "$use_gmp" = yes; then |
AC_MSG_WARN([gmp library not found or does not appear to work |
29 |
LIBS="$LIBS -lgmp" |
but `gmp.h' is present]) |
30 |
AC_CHECK_HEADER([gmp.h], |
ac_cv_using_lib_gmp=no |
31 |
[AC_CACHE_CHECK([for mpq_init in libgmp], ac_cv_func_mpq_init_libgmp, |
;; |
32 |
[AC_TRY_LINK([#include <gmp.h>], |
*:-lgmp:no) |
33 |
[mpq_t x; (void)mpq_init(x)], |
AC_MSG_WARN([gmp works but `gmp.h' is missing]) |
34 |
ac_cv_func_mpq_init_libgmp=yes, |
ac_cv_using_lib_gmp=no |
35 |
ac_cv_func_mpq_init_libgmp=no)])], |
;; |
36 |
ac_cv_func_mpq_init_libgmp=no) |
yes:*:yes) |
37 |
|
ac_cv_using_lib_gmp=yes |
38 |
if test "$ac_cv_func_mpq_init_libgmp$ac_cv_header_gmp_h" = yesyes; then |
;; |
39 |
AC_DEFINE(WITH_GMP, 1, |
no:*) |
40 |
[Define to 1 if the GNU multiple precision library should be used.]) |
ac_cv_using_lib_gmp=no |
41 |
else |
;; |
42 |
LIBS=`echo $LIBS | sed -e 's/-lgmp//'` |
esac |
43 |
AC_MSG_WARN([gmp library not found or does not appear to work]) |
|
44 |
use_gmp=no |
if test "$ac_cv_using_lib_gmp" = yes; then |
45 |
fi |
AC_DEFINE(WITH_GMP, 1, |
46 |
fi |
[Define to 1 if the GNU multiple precision library should be used.]) |
47 |
|
fi |
48 |
if test "$use_gmp" != yes; then |
])# _AC_LIB_GMP |
49 |
AC_CHECK_SIZEOF(long long int, 0) |
|
50 |
fi |
AC_DEFUN([AC_LIB_GMP], |
51 |
]) |
[AC_CHECK_HEADERS([gmp.h]) |
52 |
|
AC_CHECK_LIB([gmp], [mpq_init], [GMP_LIB=-lgmp]) |
53 |
|
AC_SUBST([GMP_LIB])dnl |
54 |
|
|
55 |
|
AC_CACHE_CHECK([if using GNU multiple precision arithmetic library], |
56 |
|
[ac_cv_using_lib_gmp], |
57 |
|
[_AC_LIB_GMP]) |
58 |
|
AC_SUBST([USE_GMP], [$ac_cv_using_lib_gmp])dnl |
59 |
|
])# AC_LIB_GMP |