File: gmp.m4

package info (click to toggle)
gnu-smalltalk 3.1-6
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 33,300 kB
  • ctags: 13,999
  • sloc: ansic: 88,106; sh: 23,223; asm: 7,889; perl: 4,493; cpp: 3,539; awk: 1,483; yacc: 1,355; xml: 1,272; makefile: 1,192; lex: 843; sed: 258; objc: 124
file content (48 lines) | stat: -rw-r--r-- 1,223 bytes parent folder | download | duplicates (6)
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
dnl I'd like this to be edited in -*- Autoconf -*- mode...
dnl
AC_DEFUN([GST_HAVE_GMP], [

AC_ARG_WITH(gmp, 
	[  --with-gmp=path         set path to the GMP library
  --without-gmp           don't try to detect and use GMP])


if test "$with_gmp" != no; then
  AC_CACHE_CHECK(how to link with GMP, gst_cv_gmp_libs, [
    if test "$with_gmp" && test -d "$with_gmp"; then
      gst_cv_gmp_libs="-L$with_gmp -lgmp"
      CPPFLAGS="$CPPFLAGS -I$with_gmp/../include"
    else
      gst_cv_gmp_libs="-lgmp"
    fi
    
    ac_save_LIBS="$LIBS"
    LIBS="$ac_save_LIBS $gst_cv_gmp_libs"

    AC_LINK_IFELSE([AC_LANG_PROGRAM([[
	#include <stdio.h>
	#include <gmp.h>
      ]], [[
        #if __GNU_MP_VERSION < 4
          you lose
        #endif
        mpz_t z;
        mp_limb_t n[10];
        mpn_tdiv_qr (n, n, 10, n, 10, n, 10);
        mpz_init_set_str (z, "123456", 0);
      ]])],[],[gst_cv_gmp_libs="not found"])
    LIBS="$ac_save_LIBS"
  ])

  if test "$gst_cv_gmp_libs" != "not found"; then
    LIBGMP="$gst_cv_gmp_libs"
    AC_SUBST(LIBGMP)
    AC_DEFINE(HAVE_GMP, 1,
          [Define if your system has the GNU MP library.])
    AC_CHECK_SIZEOF(mp_limb_t, , [
	#include <gmp.h>
	#include <stdio.h> ])
  fi
fi

])dnl