File: ax_detect_gmp.m4

package info (click to toggle)
llvm-toolchain-6.0 1%3A6.0.1-10
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 598,080 kB
  • sloc: cpp: 3,046,253; ansic: 595,057; asm: 271,965; python: 128,926; objc: 106,554; sh: 21,906; lisp: 10,191; pascal: 6,094; ml: 5,544; perl: 5,265; makefile: 2,227; cs: 2,027; xml: 686; php: 212; csh: 117
file content (48 lines) | stat: -rw-r--r-- 1,467 bytes parent folder | download | duplicates (17)
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
45
46
47
48
AC_DEFUN([AX_DETECT_GMP], [
AC_DEFINE([USE_GMP_FOR_MP], [], [use gmp to implement isl_int])
AX_SUBMODULE(gmp,system|build,system)
case "$with_gmp" in
system)
	if test "x$with_gmp_prefix" != "x"; then
		isl_configure_args="$isl_configure_args --with-gmp=$with_gmp_prefix"
		MP_CPPFLAGS="-I$with_gmp_prefix/include"
		MP_LDFLAGS="-L$with_gmp_prefix/lib"
	fi
	MP_LIBS=-lgmp
	SAVE_CPPFLAGS="$CPPFLAGS"
	SAVE_LDFLAGS="$LDFLAGS"
	SAVE_LIBS="$LIBS"
	CPPFLAGS="$MP_CPPFLAGS $CPPFLAGS"
	LDFLAGS="$MP_LDFLAGS $LDFLAGS"
	LIBS="$MP_LIBS $LIBS"
	AC_CHECK_HEADER([gmp.h], [], [AC_ERROR([gmp.h header not found])])
	AC_CHECK_LIB([gmp], [main], [], [AC_ERROR([gmp library not found])])
	AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gmp.h>]], [[
		mpz_t n, d;
		if (mpz_divisible_p(n, d))
			mpz_divexact_ui(n, n, 4);
	]])], [], [AC_ERROR([gmp library too old])])
	CPPFLAGS="$SAVE_CPPFLAGS"
	LDFLAGS="$SAVE_LDFLAGS"
	LIBS="$SAVE_LIBS"
	;;
build)
	MP_CPPFLAGS="-I$gmp_srcdir -I$with_gmp_builddir"
	MP_LIBS="$with_gmp_builddir/libgmp.la"
	;;
esac
SAVE_CPPFLAGS="$CPPFLAGS"
SAVE_LDFLAGS="$LDFLAGS"
SAVE_LIBS="$LIBS"
CPPFLAGS="$MP_CPPFLAGS $CPPFLAGS"
LDFLAGS="$MP_LDFLAGS $LDFLAGS"
LIBS="$MP_LIBS $LIBS"
need_get_memory_functions=false
AC_CHECK_DECLS(mp_get_memory_functions,[],[
	need_get_memory_functions=true
],[#include <gmp.h>])
CPPFLAGS="$SAVE_CPPFLAGS"
LDFLAGS="$SAVE_LDFLAGS"
LIBS="$SAVE_LIBS"
AM_CONDITIONAL(NEED_GET_MEMORY_FUNCTIONS, test x$need_get_memory_functions = xtrue)
])