~ubuntu-branches/ubuntu/saucy/dune-common/saucy-proposed

« back to all changes in this revision

Viewing changes to m4/gmp.m4

  • Committer: Package Import Robot
  • Author(s): Ansgar Burchardt
  • Date: 2012-03-17 17:15:13 UTC
  • Revision ID: package-import@ubuntu.com-20120317171513-l2eqm95mddmu2dj3
Tags: upstream-2.2~svn6573
ImportĀ upstreamĀ versionĀ 2.2~svn6573

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
## -*- autoconf -*-
 
2
 
 
3
# DUNE_PATH_GMP()
 
4
#
 
5
# shell variables
 
6
#   with_gmp
 
7
#     no or path
 
8
#   HAVE_GMP
 
9
#     no or yes
 
10
#   GMP_CPPFLAGS
 
11
#   GMP_LIBS
 
12
#
 
13
# substitutions
 
14
#   GMP_CPPFLAGS
 
15
#   GMP_LIBS
 
16
#
 
17
# defines:
 
18
#   HAVE_GMP
 
19
#
 
20
# conditionals:
 
21
#   GMP
 
22
AC_DEFUN([DUNE_PATH_GMP],[
 
23
  AC_REQUIRE([AC_PROG_CXX])
 
24
 
 
25
  AC_ARG_WITH([gmp],
 
26
    [AS_HELP_STRING([--with-gmp=PATH],
 
27
                   [directory to GMP (GNU MP Bignum Library)])])
 
28
 
 
29
  HAVE_GMP=no
 
30
  AS_IF([test x"$with_gmp" = x"no"], [
 
31
    AC_MSG_NOTICE([skipping check for GMP])
 
32
  ], [
 
33
    AS_IF([test x"$with_gmp" = x || test x"$with_gmp" = xyes], [
 
34
      for d in /usr /usr/local; do
 
35
        AC_MSG_NOTICE([searching for GMP in $d...])
 
36
        DUNE_CHECK_PATH_GMP($d)
 
37
        AS_IF([test $HAVE_GMP = yes],[break])
 
38
      done],[
 
39
      DUNE_CHECK_PATH_GMP($with_gmp)
 
40
    ])
 
41
 
 
42
  ])
 
43
 
 
44
  AS_IF([test $HAVE_GMP = yes],[
 
45
    AC_DEFINE([HAVE_GMP],[ENABLE_GMP],[Was GMP found and GMP_CPPFLAGS used?])
 
46
    DUNE_ADD_ALL_PKG([GMP], [\${GMP_CPPFLAGS}],
 
47
                     [], [\${GMP_LIBS}])
 
48
  ], [
 
49
    GMP_CPPFLAGS=
 
50
    GMP_LIBS=
 
51
  ])
 
52
 
 
53
  AC_SUBST([GMP_CPPFLAGS])
 
54
  AC_SUBST([GMP_LIBS])
 
55
 
 
56
  AM_CONDITIONAL(GMP,[test $HAVE_GMP = yes])
 
57
  DUNE_ADD_SUMMARY_ENTRY([GMP],[$HAVE_GMP])
 
58
])
 
59
 
 
60
AC_DEFUN([DUNE_CHECK_PATH_GMP],[
 
61
  GMP_CPPFLAGS="-I$1/include -DENABLE_GMP=1"
 
62
  GMP_LIBS="-L$1/lib -lgmpxx -lgmp"
 
63
 
 
64
  AC_LANG_PUSH([C++])
 
65
  ac_save_CPPFLAGS="$CPPFLAGS"
 
66
  ac_save_LIBS="$LIBS"
 
67
 
 
68
  CPPFLAGS="$CPPFLAGS $GMP_CPPFLAGS"
 
69
 
 
70
  AC_CHECK_HEADER([gmpxx.h], [HAVE_GMP=yes],
 
71
    [AC_MSG_WARN([gmpxx.h not found in $1])])
 
72
 
 
73
  AS_IF([test $HAVE_GMP = yes],[
 
74
    DUNE_CHECK_LIB_EXT([$1/lib], gmp,[__gmpz_abs],[],[
 
75
      HAVE_GMP=no
 
76
      AC_MSG_WARN(libgmp not found)])
 
77
  ])
 
78
 
 
79
  CPPFLAGS="$ac_save_CPPFLAGS"
 
80
  LIBS="$ac_save_LIBS"
 
81
  AC_LANG_POP([C++])
 
82
])
 
83