2 # Configure the GMP library or a replacement.
3 dnl Copyright 2020 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
9 dnl Search for an installed libgmp.
10 dnl If found, set and AC_SUBST HAVE_LIBGMP=yes and the LIBGMP and LTLIBGMP
11 dnl variables, and augment the CPPFLAGS variable, and #define HAVE_LIBGMP to 1.
12 dnl Otherwise, set and AC_SUBST HAVE_LIBGMP=no and LIBGMP and LTLIBGMP to
18 [AS_HELP_STRING([--without-libgmp],
19 [do not use the GNU Multiple Precision (GMP) library;
20 this is the default on systems lacking libgmp.])])
24 AS_IF([test "$with_libgmp" != no],
25 [AC_CHECK_HEADERS([gmp.h gmp/gmp.h], [break])
26 dnl Prefer AC_LIB_HAVE_LINKFLAGS if the havelib module is also in use.
27 AS_IF([test "$ac_cv_header_gmp_h" = yes ||
28 test "$ac_cv_header_gmp_gmp_h" = yes],
29 [m4_ifdef([gl_HAVE_MODULE_HAVELIB],
30 [AC_LIB_HAVE_LINKFLAGS([gmp], [],
36 [static const mp_limb_t x[2] = { 0x73, 0x55 };
38 mpz_roinit_n (tmp, x, 2);
42 AC_SEARCH_LIBS([__gmpz_roinit_n], [gmp])
44 case $ac_cv_search___gmpz_roinit_n in
49 LIBGMP=$ac_cv_search___gmpz_roinit_n
52 AC_SUBST([HAVE_LIBGMP])
54 AC_SUBST([LTLIBGMP])])])
55 if test "$with_libgmp,$HAVE_LIBGMP" = yes,no; then
57 [GMP not found, although --with-libgmp was specified.m4_ifdef(
58 [AC_LIB_HAVE_LINKFLAGS],
59 [ Try specifying --with-libgmp-prefix=DIR.])])
61 if test $HAVE_LIBGMP = yes && test "$ac_cv_header_gmp_h" = yes; then
67 AM_CONDITIONAL([GL_GENERATE_MINI_GMP_H],
68 [test $HAVE_LIBGMP != yes])
69 AM_CONDITIONAL([GL_GENERATE_GMP_GMP_H],
70 [test $HAVE_LIBGMP = yes && test "$ac_cv_header_gmp_h" != yes])