2 AM_INIT_AUTOMAKE(barvinok, 0.22)
13 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
14 if test "$enable_shared" = yes; then
15 BV_LDFLAGS="-no-undefined"
23 AC_CHECK_HEADERS(getopt.h)
24 AC_CHECK_HEADERS(sys/times.h)
26 dnl Check for GMP library
27 AC_MSG_CHECKING(whether to use GMP)
29 [ --with-libgmp DIR Location of the GMP Distribution],
30 gmp_package=$withval, gmp_package=yes)
31 if test "x$gmp_package" = "xno"; then
33 AC_MSG_ERROR(Need gmp)
36 if test "x$gmp_package" != "xyes"; then
38 if test ! -d "$GMP_DIR"; then
39 AC_ERROR(Directory given for GMP Distribution is not a directory)
41 CPPFLAGS="-I$GMP_DIR/include $CPPFLAGS"
42 LDFLAGS="-L$GMP_DIR/lib $LDFLAGS"
45 AC_CHECK_HEADER(gmp.h,
46 [AC_CHECK_LIB(gmp,main,
48 [poly_cv_gmpfatal="yes"])],
49 [poly_cv_gmpfatal="yes"])
50 if test "$poly_cv_gmpfatal" = "yes"; then
51 AC_MSG_ERROR([GMP not found])
54 AC_CHECK_DECL(mpz_divisible_p,[],[AC_LIBOBJ(mpz_divisible_p)],[#include <gmp.h>])
57 [ --with-polylib=DIR DIR Location of PolyLib],
58 [ echo "Package polylib : $withval" && polylib_package=$withval],
59 [ polylib_package=yes ])
61 if test "$polylib_package" = "no"; then
62 AC_MSG_ERROR(Need polylib)
65 if test "$polylib_package" != "yes"; then
66 CPPFLAGS="-I$polylib_package/include $CPPFLAGS"
67 LDFLAGS="-L$polylib_package/lib $LDFLAGS"
68 LD_LIBRARY_PATH="$polylib_package/lib:$LD_LIBRARY_PATH"
69 export LD_LIBRARY_PATH
72 AC_CHECK_LIB(polylibgmp, PolyhedronTSort,[],[
73 AC_MSG_ERROR(Need polylib)
75 AC_CHECK_FUNCS(Enumeration_Free)
76 AC_CHECK_FUNCS(compress_parms, [AC_LIBOBJ(remove_equalities)])
77 AC_SUBST(bv_extra_programs)
78 AC_CHECK_FUNCS(LexSmaller,[
79 bv_extra_programs="verify_lexsmaller $bv_extra_programs"
81 AC_REPLACE_FUNCS(DomainConstraintSimplify)
83 #include <polylib/polylibgmp.h>
89 Matrix *M = Matrix_Alloc(6,5);
90 for (i = 0; i < 6; ++i) {
91 value_set_si(M->p[i][0], 1);
92 for (j = 1; j < 4; ++j)
93 value_set_si(M->p[i][j], (j-1 == i/2) * (1-2*(i%2)));
94 value_set_si(M->p[i][4], i%2);
96 P = Constraints2Polyhedron(M, 6);
97 return !(P->NbRays == 8);
100 [AC_DEFINE(HAVE_GROWING_CHERNIKOVA,[],
101 [PolyLib automatically grows the Chernikova table space])],
102 AC_MSG_WARN([This version of PolyLib does not automatically])
103 AC_MSG_WARN([enlarge the Chernikova table space]),
104 AC_MSG_WARN([Unable to determine whether PolyLib automatically])
105 AC_MSG_WARN([grows the Chernikova table space]))
108 #include <polylib/polylibgmp.h>
112 enode *en = new_enode(polynomial, 1, 1);
113 return !(en->arr[0].x.p == NULL);
116 AC_MSG_WARN([This version of polylib leaks]),[true])
120 #include <polylib/polylibgmp.h>
126 Param_Polyhedron *PP;
130 freopen("$srcdir/tests/ehrhart/t12.in", "r", stdin);
132 P = Constraints2Polyhedron(M, 1024);
134 C = Constraints2Polyhedron(M, 1024);
135 PP = Polyhedron2Param_Domain(P, C, 1024);
136 for (i = 0, V = PP->V; V; ++i, V = V->next)
141 [AC_DEFINE(HAVE_CORRECT_VERTICES,[],
142 [PolyLib computes correct vertices])],
143 AC_MSG_WARN([This version of polylib produces incorrect vertices.]),
144 AC_MSG_WARN([Unable to determine whether PolyLib computes correct vertices]))
146 AC_MSG_CHECKING([number of arguments of Polyhedron_Enumerate])
147 AC_TRY_COMPILE([#include <polylib/polylibgmp.h>],
148 [Polyhedron_Enumerate(NULL,NULL,0,NULL)],
150 AC_DEFINE(HAVE_ENUMERATE4,[],
151 [Polyhedron_Enumerate takes four arguments])],
154 AC_MSG_CHECKING([number of arguments of count_points])
155 AC_TRY_COMPILE([#include <polylib/polylibgmp.h>],
156 [count_points(0,NULL,NULL,NULL)],
158 AC_DEFINE(HAVE_COUNT_POINTS4,[],
159 [count_points takes four arguments])],
162 AC_MSG_CHECKING([for value_subtract macro])
164 #include <polylib/polylibgmp.h>
165 #ifdef value_subtract
168 ],[AC_MSG_RESULT(yes)],
170 AC_DEFINE(value_subtract,value_substract,
171 [define to value_substract if missing from PolyLib])])
174 [ --with-piplib=DIR DIR Location of PIP],
175 [ echo "Package piplib : $withval" && piplib_package=$withval],
176 [ piplib_package=yes ])
179 if test "$piplib_package" != "no"; then
180 SAVE_CPPFLAGS="$CPPFLAGS"
181 SAVE_LDFLAGS="$LDFLAGS"
182 if test "$piplib_package" != "yes"; then
183 CPPFLAGS="-I$piplib_package/include $CPPFLAGS"
184 LDFLAGS="-L$piplib_package/lib $LDFLAGS"
187 bv_cv_piplibfatal="no"
188 AC_CHECK_LIB(piplibMP, pip_solve,[
189 AC_CHECK_MEMBER(PipOptions.Urs_parms, [], [
190 AC_MSG_WARN([Piplib too old; please install version 1.3.6 or newer])
191 bv_cv_piplibfatal="yes"
192 ],[#include <stdio.h>
193 #include <piplib/piplibMP.h>])
195 AC_MSG_WARN([Piplib not found])
196 bv_cv_piplibfatal="yes"
198 if test "$bv_cv_piplibfatal" = "no"; then
199 AC_DEFINE(HAVE_PIPLIB,[],[use piplib])
200 LIBS="-lpiplibMP $LIBS"
202 bv_extra_programs="piptest $bv_extra_programs"
205 CPPFLAGS="$SAVE_CPPFLAGS"
206 LDFLAGS="$SAVE_LDFLAGS"
209 AM_CONDITIONAL(HAVE_PIPLIB, test x$have_piplib = xtrue)
211 AC_MSG_CHECKING(if the fractional representation should be used)
212 AC_ARG_ENABLE(fractional, [AS_HELP_STRING([--disable-fractional],
213 [Don't use fractional representation])],
214 [bv_cv_fractional=$enableval], [bv_cv_fractional="yes"])
215 AC_ARG_ENABLE(modulo, [AS_HELP_STRING([--disable-modulo],
216 [Don't use fractional representation])],
217 [bv_cv_modulo=$enableval], [bv_cv_modulo="$bv_cv_fractional"])
218 AC_MSG_RESULT($bv_cv_modulo)
219 if test "x$bv_cv_modulo" != "xno" ; then
220 AC_DEFINE(USE_MODULO,[], [Use fractional representation])
223 AC_MSG_CHECKING(whether to use incremental algorithm)
224 AC_ARG_ENABLE(incremental,
225 [AS_HELP_STRING([--enable-incremental@<:@=bf|df@:>@],
226 [Enable incremental algorithm [bf]])],
227 [bv_cv_incremental=$enableval], [bv_cv_incremental="no"])
228 AC_MSG_RESULT($bv_cv_incremental)
229 case $bv_cv_incremental in
231 AC_DEFINE(USE_INCREMENTAL_BF,[],
232 [Use breadth-first incremental algorithm])
235 AC_DEFINE(USE_INCREMENTAL_DF,[],
236 [Use depth-first incremental algorithm])
241 [ --with-ntl=DIR DIR Location of NTL],
242 [ echo "Package ntl : $withval" && ntl_package=$withval],
245 if test "$ntl_package" = "no"; then
246 AC_MSG_ERROR(Need ntl)
249 if test "$ntl_package" != "yes"; then
250 CPPFLAGS="-I$ntl_package/include $CPPFLAGS"
251 LDFLAGS="-L$ntl_package/lib $LDFLAGS"
259 ],:,AC_MSG_ERROR(ntl not compiled with gmp support))
261 AC_CHECK_LIB(ntl, main,[],[
262 AC_MSG_ERROR(Need ntl)
265 AC_MSG_CHECKING(whether to compile bernstein)
266 AC_ARG_WITH(bernstein,
267 [AS_HELP_STRING([--without-bernstein],[do not compile bernstein])],
268 [ with_bernstein=$withval], [ with_bernstein=yes ])
269 AC_MSG_RESULT($with_bernstein)
272 if test "$with_bernstein" != "no"; then
274 AM_PATH_GINAC(1.3.3, [
276 AC_DEFINE(HAVE_GINAC,[],[use GiNaC])]
277 PACKAGE_LIBS="-lbarvinok -lbernstein")
280 AM_CONDITIONAL(HAVE_GINAC, test x$have_ginac = xtrue)
282 AC_MSG_CHECKING(whether to use Omega)
283 AC_ARG_WITH(omega, [AS_HELP_STRING([--with-omega=DIR],[DIR Location of Omega])],
284 [ omega_package=$withval], [ omega_package=yes ])
285 AC_MSG_RESULT($omega_package)
287 AC_SUBST(OMEGA_CPPFLAGS)
288 AC_SUBST(OMEGA_LDFLAGS)
290 AC_SUBST(bv_omega_programs)
292 if test "$omega_package" != "no"; then
293 if test "x$omega_package" != "xyes"; then
294 OMEGA_CPPFLAGS="-I$omega_package/include/omega"
295 OMEGA_LDFLAGS="-L$omega_package/lib"
297 for i in /usr/include /usr/local/include; do
298 if test -f $i/omega/omega.h; then
299 OMEGA_CPPFLAGS="-I$i/omega"
305 SAVE_CPPFLAGS="$CPPFLAGS"
306 CPPFLAGS="$OMEGA_CPPFLAGS $CPPFLAGS"
307 AC_CHECK_HEADERS([omega.h],[
308 if test x$have_ginac = xtrue; then
309 bv_omega_programs="occ $bv_omega_programs"
311 AC_DEFINE(HAVE_OMEGA,[],[use omega])
312 OMEGA_LIBS="-lcode_gen -lomega"
314 ],[AC_MSG_WARN(Omega not found)])
315 CPPFLAGS="$SAVE_CPPFLAGS"
318 AM_CONDITIONAL(HAVE_OMEGA, test x$have_omega = xtrue)
321 AC_MSG_CHECKING(whether to use cddlib)
322 AC_ARG_WITH(cddlib, [AS_HELP_STRING([--with-cddlib=DIR],[DIR Location of cddlib])],
323 [ cddlib_package=$withval], [ cddlib_package=yes ])
324 AC_MSG_RESULT($cddlib_package)
327 if test "$cddlib_package" != "no"; then
328 if test "x$cddlib_package" != "xyes"; then
329 CPPFLAGS="-I$cddlib_package/include $CPPFLAGS"
330 LDFLAGS="-L$cddlib_package/lib $LDFLAGS"
340 AC_CHECK_LIB(cddgmp, main,[],[have_cddlib=false])
343 AM_CONDITIONAL(HAVE_CDDLIB, test x$have_cddlib = xtrue)
347 AC_MSG_CHECKING(whether to use GLPK)
348 AC_ARG_WITH(glpk, [AS_HELP_STRING([--with-glpk=DIR],[DIR Location of GLPK])],
349 [ glpk_package=$withval], [ glpk_package=yes ])
350 AC_MSG_RESULT($glpk_package)
353 if test "$glpk_package" != "no"; then
354 if test "x$glpk_package" != "xyes"; then
355 CPPFLAGS="-I$glpk_package/include $CPPFLAGS"
356 LDFLAGS="-L$glpk_package/lib $LDFLAGS"
358 AC_CHECK_HEADERS([glpk.h],[
360 AC_CHECK_LIB(glpk, main,[],[have_glpk=false])
363 AM_CONDITIONAL(HAVE_GLPK, test x$have_glpk = xtrue)
365 if test "$have_glpk" = "true" -o "$have_cddlib" = "true"; then
367 bv_extra_programs="polyhedron_sample 4coins lexmin $bv_extra_programs"
368 bv_extra_programs="polytope_scan $bv_extra_programs"
371 AC_SUBST(GIT_HEAD_ID)
373 AC_SUBST(GIT_HEAD_VERSION)
374 if test -f $srcdir/.git/HEAD; then
375 GIT_HEAD="$srcdir/.git/index"
376 GIT_REPO="$srcdir/.git"
377 GIT_HEAD_ID=`GIT_DIR=$GIT_REPO git describe`
378 elif test -f $srcdir/GIT_HEAD_ID; then
379 GIT_HEAD_ID=`cat $srcdir/GIT_HEAD_ID`
381 mysrcdir=`(cd $srcdir; pwd)`
382 head=`basename $mysrcdir | sed -e 's/.*-//'`
383 head2=`echo $head | sed -e 's/[^0-9a-f]//'`
384 head3=`echo $head2 | sed -e 's/........................................//'`
385 base=`basename $mysrcdir | sed -e 's/-.*//'`
386 if test "x$head3" = "x" -a "x$head" = "x$head2"; then
387 GIT_HEAD_ID="barvinok-$VERSION-$head
388 elif test "x$base" = "xbarvinok-$VERSION" -a "x$head" != "x"; then
389 GIT_HEAD_ID="barvinok-$VERSION-$head
391 GIT_HEAD_ID="UNKNOWN"
394 if test -z "$GIT_REPO" ; then
395 GIT_HEAD_VERSION="$GIT_HEAD_ID"
397 GIT_HEAD_VERSION="\`GIT_DIR=$GIT_REPO git describe\`"
399 echo '#define GIT_HEAD_ID "'$GIT_HEAD_ID'"' > version.h
401 AX_CREATE_PKGCONFIG_INFO
403 AC_CONFIG_HEADERS(config.h)
404 AC_CONFIG_FILES(Makefile doc/Makefile omega/Makefile)
405 if test x$have_ginac = xtrue; then
406 AC_CONFIG_SUBDIRS(bernstein)