aboutsummaryrefslogtreecommitdiffstats
path: root/moon-abe/libbswabe-0.9/acinclude.m4
blob: addc55817e168d12cd6a5fd26d6a19ab56e5eb2a (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
dnl Check for GNU MP (at least version 4.0) and set GMP_CFLAGS and
dnl GMP_LIBS appropriately.

AC_DEFUN([GMP_4_0_CHECK],
[

AC_MSG_CHECKING(for GMP version >= 4.0.0 or later)

AC_ARG_WITH(
  gmp-include,
  AC_HELP_STRING(
    [--with-gmp-include=DIR],
    [look for the header gmp.h in DIR rather than the default search path]),
  [GMP_CFLAGS="-I$withval"], [GMP_CFLAGS=""])

AC_ARG_WITH(
  gmp-lib,
  AC_HELP_STRING([--with-gmp-lib=DIR],
    [look for libgmp.so in DIR rather than the default search path]),
  [
    case $withval in
      /* ) true;;
      *  ) AC_MSG_ERROR([

You must specify an absolute path for --with-gmp-lib.
]) ;;
    esac
    GMP_LIBS="-L$withval -Wl,-rpath $withval -lgmp"
  ], [GMP_LIBS="-lgmp"])

BACKUP_CFLAGS=${CFLAGS}
BACKUP_LIBS=${LIBS}

CFLAGS="${CFLAGS} ${GMP_CFLAGS}"
LIBS="${LIBS} ${GMP_LIBS}"

AC_TRY_LINK(
  [#include <gmp.h>],
  [mpz_t a; mpz_init (a);],
  [
    AC_TRY_RUN(
      [
#include <gmp.h>
int main() { if (__GNU_MP_VERSION < 4) return -1; else return 0; }
],
      [
        AC_MSG_RESULT(found)
        AC_SUBST(GMP_CFLAGS)
        AC_SUBST(GMP_LIBS)
        AC_DEFINE(HAVE_GMP,1,[Defined if GMP is installed])
      ],
      [
        AC_MSG_RESULT(old version)
        AC_MSG_ERROR([

Your version of the GNU Multiple Precision library (libgmp) is too
old! Please install a more recent version from http://gmplib.org/ and
try again. If more than one version is installed, try specifying a
particular version with

  ./configure --with-gmp-include=DIR --with-gmp-lib=DIR

See ./configure --help for more information.
])
      ])
  ],
  [
    AC_MSG_RESULT(not found)
    AC_MSG_ERROR([

The GNU Multiple Precision library (libgmp) was not found on your
system! Please obtain it from http://gmplib.org/ and install it before
trying again. If libgmp is already installed in a non-standard
location, try again with

  ./configure --with-gmp-include=DIR --with-gmp-lib=DIR

If you already specified those arguments, double check that gmp.h can
be found in the first path and libgmp.a can be found in the second.

See ./configure --help for more information.
])
  ])

CFLAGS=${BACKUP_CFLAGS}
LIBS=${BACKUP_LIBS}

])

dnl Check for libpbc and set PBC_CFLAGS and PBC_LIBS
dnl appropriately.

AC_DEFUN([PBC_CHECK],
[

AC_MSG_CHECKING(for the PBC library)

AC_ARG_WITH(
  pbc-include,
  AC_HELP_STRING(
    [--with-pbc-include=DIR],
    [look for the header pbc.h in DIR rather than the default search path]),
  [PBC_CFLAGS="-I$withval"], [PBC_CFLAGS="-I/usr/include/pbc -I/usr/local/include/pbc"])

AC_ARG_WITH(
  pbc-lib,
  AC_HELP_STRING(
    [--with-pbc-lib=DIR],
    [look for libpbc.so in DIR rather than the default search path]),
  [
    case $withval in
      /* ) true;;
      *  ) AC_MSG_ERROR([

You must specify an absolute path for --with-pbc-lib.
]) ;;
    esac
    PBC_LIBS="-L$withval -Wl,-rpath $withval -lpbc"
  ], [PBC_LIBS="-lpbc"])

BACKUP_CFLAGS=${CFLAGS}
BACKUP_LIBS=${LIBS}

CFLAGS="${CFLAGS} ${GMP_CFLAGS} ${PBC_CFLAGS}"
LIBS="${LIBS} ${GMP_LIBS} ${PBC_LIBS}"

AC_TRY_LINK(
  [#include <pbc.h>],
  [pairing_t p; pairing_init_set_buf(p, "", 0);],
  [
    AC_MSG_RESULT(found)
    AC_SUBST(PBC_CFLAGS)
    AC_SUBST(PBC_LIBS)
    AC_DEFINE(HAVE_PBC,1,[Defined if PBC is installed])
  ],
  [
    AC_MSG_RESULT(not found)
    AC_MSG_ERROR([

The PBC library was not found on your system! Please obtain it from

  http://crypto.stanford.edu/pbc/

and install it before trying again. If libpbc is already
installed in a non-standard location, try again with

  ./configure --with-pbc-include=DIR --with-pbc-lib=DIR

If you already specified those arguments, double check that pbc.h can
be found in the first path and libpbc.a can be found in the second.

See ./configure --help for more information.
])
  ])

CFLAGS=${BACKUP_CFLAGS}
LIBS=${BACKUP_LIBS}

])