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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
|
dnl A function to test for the existence and usability of particular
dnl versions of the PPL, defining macros containing the required paths.
dnl Copyright (C) 1997 Owen Taylor
dnl Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
dnl Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com)
dnl
dnl This file is part of the Parma Polyhedra Library (PPL).
dnl
dnl The PPL is free software; you can redistribute it and/or modify it
dnl under the terms of the GNU General Public License as published by the
dnl Free Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
dnl The PPL is distributed in the hope that it will be useful, but WITHOUT
dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
dnl for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software Foundation,
dnl Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
dnl
dnl For the most up-to-date information see the Parma Polyhedra Library
dnl site: http://www.cs.unipr.it/ppl/ .
dnl AM_PATH_PPL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for PPL, and define PPL_CPPFLAGS, PPL_LDFLAGS, ... what else?
AC_DEFUN([AM_PATH_PPL],
[
dnl Get the required information from the ppl-config program.
AC_ARG_WITH(ppl-prefix,
AS_HELP_STRING([--with-ppl-prefix=PREFIX],
[prefix used to configure the PPL]),
ppl_prefix="$withval",
ppl_prefix="")
AC_ARG_WITH(ppl-exec-prefix,
AS_HELP_STRING([--with-ppl-exec-prefix=PREFIX],
[exec-prefix used to configure the PPL]),
ppl_exec_prefix="$withval",
ppl_exec_prefix="")
AC_ARG_ENABLE(ppl-test,
AS_HELP_STRING([--disable-ppltest],
[do not try to compile and run a test PPL program]),
,
enable_ppltest=yes)
if test "x$ppl_exec_prefix" != x
then
ppl_config_args="$ppl_config_args --exec-prefix=$ppl_exec_prefix"
if test "x${PPL_CONFIG+set}" != xset
then
PPL_CONFIG="$ppl_exec_prefix/bin/ppl-config"
fi
fi
if test "x$ppl_prefix" != x
then
ppl_config_args="$ppl_config_args --prefix=$ppl_prefix"
if test "x${PPL_CONFIG+set}" != xset
then
PPL_CONFIG="$ppl_prefix/bin/ppl-config"
fi
fi
AC_PATH_PROG(PPL_CONFIG, ppl-config, no)
min_ppl_version=ifelse([$1], ,0.0,$1)
if test \( "x$min_ppl_version" = "x0.0" \) -o \( "x$min_ppl_version" = "x0.0.0" \)
then
AC_MSG_CHECKING([for the Parma Polyhedra Library])
else
AC_MSG_CHECKING([for the Parma Polyhedra Library, version >= $min_ppl_version])
fi
no_ppl=""
if test $PPL_CONFIG = no
then
no_ppl=yes
else
PPL_CPPFLAGS=`$PPL_CONFIG $ppl_config_args --cppflags`
PPL_LDFLAGS=`$PPL_CONFIG $ppl_config_args --ldflags`
ppl_config_version="`$PPL_CONFIG $ppl_config_args --version`"
if test "x$enable_ppltest" = xyes
then
ac_save_CPPFLAGS="$CPPFLAGS"
ac_save_LDFLAGS="$LDFLAGS"
CPPFLAGS="$CPPFLAGS $PPL_CPPFLAGS"
LDFLAGS="$PPL_LDFLAGS $LDFLAGS"
dnl Now check if the installed PPL is sufficiently new.
dnl (Also sanity checks the results of ppl-config to some extent.)
AC_LANG_PUSH(C++)
rm -f conf.ppltest
AC_TRY_RUN([
#include <ppl.hh>
#include <iostream>
#include <cstdio>
#include <cstdlib>
namespace PPL = Parma_Polyhedra_Library;
using std::cout;
using std::endl;
int
main() {
system("touch conf.ppltest");
unsigned min_ppl_major, min_ppl_minor, min_ppl_revision, min_ppl_beta;
int n = sscanf("$min_ppl_version",
"%u.%u.%upre%u%*c",
&min_ppl_major, &min_ppl_minor,
&min_ppl_revision, &min_ppl_beta);
bool min_ppl_version_ok = true;
if (n == 4) {
if (min_ppl_beta == 0)
min_ppl_version_ok = false;
}
else if (n == 3) {
n = sscanf("$min_ppl_version",
"%u.%u.%u%*c",
&min_ppl_major, &min_ppl_minor, &min_ppl_revision);
if (n != 3)
min_ppl_version_ok = false;
else
min_ppl_beta = 0;
}
else if (n == 2) {
n = sscanf("$min_ppl_version",
"%u.%upre%u%*c",
&min_ppl_major, &min_ppl_minor, &min_ppl_beta);
if (n == 3) {
if (min_ppl_beta == 0)
min_ppl_version_ok = false;
else
min_ppl_revision = 0;
}
else if (n == 2) {
n = sscanf("$min_ppl_version",
"%u.%u%*c",
&min_ppl_major, &min_ppl_minor);
if (n != 2)
min_ppl_version_ok = false;
else {
min_ppl_revision = 0;
min_ppl_beta = 0;
}
}
else
min_ppl_version_ok = false;
}
else
min_ppl_version_ok = false;
if (!min_ppl_version_ok) {
cout << "illegal version string '$min_ppl_version'"
<< endl;
return 1;
}
if (strcmp("$ppl_config_version", PPL::version()) != 0) {
cout << "\n*** 'ppl-config --version' returned $ppl_config_version, "
"but PPL version "
<< PPL::version()
<< "\n*** was found! If ppl-config was correct, then it is best"
"\n*** to remove the old version of PPL."
" You may also be able to fix the error"
"\n*** by modifying your LD_LIBRARY_PATH enviroment variable,"
" or by editing"
"\n*** /etc/ld.so.conf."
" Make sure you have run ldconfig if that is"
"\n*** required on your system."
"\n*** If ppl-config was wrong, set the environment variable"
" PPL_CONFIG"
"\n*** to point to the correct copy of ppl-config,"
" and remove the file config.cache"
"\n*** before re-running configure."
<< endl;
return 1;
}
else if (strcmp(PPL_VERSION, PPL::version()) != 0) {
cout << "\n*** PPL header file (version " PPL_VERSION ") does not match"
<< "\n*** library (version " << PPL::version() << ")"
<< endl;
return 1;
}
else if (PPL_VERSION_MAJOR < min_ppl_major
|| (PPL_VERSION_MAJOR == min_ppl_major
&& PPL_VERSION_MINOR < min_ppl_minor)
|| (PPL_VERSION_MAJOR == min_ppl_major
&& PPL_VERSION_MINOR == min_ppl_minor
&& PPL_VERSION_REVISION < min_ppl_revision)
|| (PPL_VERSION_MAJOR == min_ppl_major
&& PPL_VERSION_MINOR == min_ppl_minor
&& PPL_VERSION_REVISION == min_ppl_revision
&& PPL_VERSION_BETA < min_ppl_beta)) {
cout << "\n*** An old version of PPL (" PPL_VERSION ") was found."
"\n*** You need at least PPL version $min_ppl_version."
" The latest version of"
"\n*** PPL is always available from ftp://ftp.cs.unipr.it/ppl/ ."
"\n***"
"\n*** If you have already installed a sufficiently new version,"
" this error"
"\n*** probably means that the wrong copy of the ppl-config"
" program is"
"\n*** being found. The easiest way to fix this is to remove"
" the old version"
"\n*** of PPL, but you can also set the PPL_CONFIG environment"
" variable to point"
"\n*** to the correct copy of ppl-config. (In this case,"
" you will have to"
"\n*** modify your LD_LIBRARY_PATH enviroment"
" variable or edit /etc/ld.so.conf"
"\n*** so that the correct libraries are found at run-time.)"
<< endl;
return 1;
}
return 0;
}
],, no_ppl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
AC_LANG_POP
CPPFLAGS="$ac_save_CPPFLAGS"
LDFLAGS="$ac_save_LDFLAGS"
fi
fi
if test "x$no_ppl" = x
then
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test x"$PPL_CONFIG" = xno
then
echo "*** The ppl-config script installed by PPL could not be found."
echo "*** If the PPL was installed in PREFIX, make sure PREFIX/bin is in"
echo "*** your path, or set the PPL_CONFIG environment variable to the"
echo "*** full path to ppl-config."
else
if test -f conf.ppltest
then
:
else
echo "*** Could not run PPL test program, checking why..."
CPPFLAGS="$CPPFLAGS $PPL_CPPFLAGS"
LDFLAGS="$LDFLAGS $PPL_LDFLAGS"
AC_TRY_LINK([
#include <ppl.hh>
using namespace Parma_Polyhedra_Library;
],
[
return version_major() || version_minor()
|| version_revision() || version_beta();
],
[
echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding the PPL or finding the"
echo "*** wrong version of the PPL. If it is not finding the PPL, you will"
echo "*** need to set your LD_LIBRARY_PATH environment variable, or edit"
echo "*** /etc/ld.so.conf to point to the installed location. Also, make"
echo "*** sure you have run ldconfig if that is required on your system."
echo "***"
echo "*** If you have an old version installed, it is best to remove it,"
echo "*** although you may also be able to get things to work by modifying"
echo "*** LD_LIBRARY_PATH."
],
[
echo "*** The test program failed to compile or link. See the file"
echo "*** config.log for the exact error that occured. This usually means"
echo "*** the PPL was incorrectly installed or that someone moved the PPL"
echo "*** since it was installed. In both cases you should reinstall"
echo "*** the library."
])
CPPFLAGS="$ac_save_CPPFLAGS"
LDFLAGS="$ac_save_LDFLAGS"
fi
fi
PPL_CPPFLAGS=""
PPL_LDFLAGS=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(PPL_CPPFLAGS)
AC_SUBST(PPL_LDFLAGS)
rm -f conf.ppltest
])
|