xref: /PHP-8.3/ext/gmp/config.m4 (revision dc40332b)
1PHP_ARG_WITH([gmp],
2  [for GNU MP support],
3  [AS_HELP_STRING([[--with-gmp[=DIR]]],
4    [Include GNU MP support])])
5
6if test "$PHP_GMP" != "no"; then
7  if test "$PHP_GMP" = "yes"; then
8    PHP_CHECK_LIBRARY(gmp, __gmpz_rootrem,
9    [],[
10      AC_MSG_ERROR([GNU MP Library version 4.2 or greater required.])
11    ])
12
13    PHP_ADD_LIBRARY(gmp,,GMP_SHARED_LIBADD)
14  else
15    if test ! -f $PHP_GMP/include/gmp.h; then
16      AC_MSG_ERROR(Unable to locate gmp.h)
17    fi
18
19    PHP_CHECK_LIBRARY(gmp, __gmpz_rootrem,
20    [],[
21      AC_MSG_ERROR([GNU MP Library version 4.2 or greater required.])
22    ],[
23      -L$PHP_GMP/$PHP_LIBDIR
24    ])
25
26    PHP_ADD_LIBRARY_WITH_PATH(gmp, $PHP_GMP/$PHP_LIBDIR, GMP_SHARED_LIBADD)
27    PHP_ADD_INCLUDE($PHP_GMP/include)
28  fi
29
30  PHP_INSTALL_HEADERS([ext/gmp/php_gmp_int.h])
31
32  PHP_NEW_EXTENSION(gmp, gmp.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
33  PHP_SUBST(GMP_SHARED_LIBADD)
34  AC_DEFINE(HAVE_GMP, 1, [ ])
35fi
36