summaryrefslogtreecommitdiff
path: root/m4/libgmp.m4
blob: b569bb7346235c67c297c288dfbc9add056e32f4 (plain)
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
# Configure the GMP library or a replacement.

dnl Copyright 2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.

AC_DEFUN([gl_LIBGMP],
[
  AC_ARG_WITH([libgmp],
    [AS_HELP_STRING([--without-libgmp],
       [do not use the GNU Multiple Precision (GMP) library;
        this is the default on systems lacking libgmp.])])

  AC_CHECK_HEADERS_ONCE([gmp.h])
  GMP_H=gmp.h
  LIB_GMP=

  case $with_libgmp in
    no) ;;
    yes) GMP_H= LIB_GMP=-lgmp;;
    *) if test "$ac_cv_header_gmp_h" = yes; then
         gl_saved_LIBS=$LIBS
         AC_SEARCH_LIBS([__gmpz_roinit_n], [gmp])
         LIBS=$gl_saved_LIBS
         case $ac_cv_search___gmpz_roinit_n in
           'none needed')
             GMP_H=;;
           -*)
             GMP_H= LIB_GMP=$ac_cv_search___gmpz_roinit_n;;
         esac
       fi;;
  esac

  if test -z "$GMP_H"; then
    AC_DEFINE([HAVE_GMP], 1,
      [Define to 1 if you have the GMP library instead of just the
       mini-gmp replacement.])
  fi

  AC_SUBST([LIB_GMP])
  AC_SUBST([GMP_H])
  AM_CONDITIONAL([GL_GENERATE_GMP_H], [test -n "$GMP_H"])
])

Return to:

Send suggestions and report system problems to the System administrator.