2 AM_INIT_AUTOMAKE(barvinok, 0.23)
16 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
17 if test "$enable_shared" = yes; then
18 BV_LDFLAGS="-no-undefined"
26 gl_MODULES(argp progname)
29 AC_CHECK_HEADERS(getopt.h)
30 AC_CHECK_HEADERS(sys/times.h)
32 dnl Check for GMP library
33 AC_MSG_CHECKING(whether to use GMP)
35 [ --with-libgmp DIR Location of the GMP Distribution],
36 gmp_package=$withval, gmp_package=yes)
37 if test "x$gmp_package" = "xno"; then
39 AC_MSG_ERROR(Need gmp)
42 if test "x$gmp_package" != "xyes"; then
44 if test ! -d "$GMP_DIR"; then
45 AC_ERROR(Directory given for GMP Distribution is not a directory)
47 CPPFLAGS="-I$GMP_DIR/include $CPPFLAGS"
48 LDFLAGS="-L$GMP_DIR/lib $LDFLAGS"
51 AC_CHECK_HEADER(gmp.h,
52 [AC_CHECK_LIB(gmp,main,
54 [poly_cv_gmpfatal="yes"])],
55 [poly_cv_gmpfatal="yes"])
56 if test "$poly_cv_gmpfatal" = "yes"; then
57 AC_MSG_ERROR([GMP not found])
60 AC_CHECK_DECL(mpz_divisible_p,[],[AC_LIBOBJ(mpz_divisible_p)],[#include <gmp.h>])
63 [ --with-polylib=DIR DIR Location of PolyLib],
64 [ echo "Package polylib : $withval" && polylib_package=$withval],
65 [ polylib_package=yes ])
67 if test "$polylib_package" = "no"; then
68 AC_MSG_ERROR(Need polylib)
71 if test "$polylib_package" != "yes"; then
72 CPPFLAGS="-I$polylib_package/include $CPPFLAGS"
73 LDFLAGS="-L$polylib_package/lib $LDFLAGS"
74 LD_LIBRARY_PATH="$polylib_package/lib:$LD_LIBRARY_PATH"
75 export LD_LIBRARY_PATH
78 AC_CHECK_HEADERS([polylib/polylibgmp.h], [], [
79 AC_MSG_ERROR(Need polylib)
81 AC_CHECK_LIB(polylibgmp, PolyhedronTSort,[],[
82 AC_MSG_ERROR(Need polylib)
84 AC_CHECK_FUNCS(Enumeration_Free)
85 AC_CHECK_FUNCS(compress_parms, [AC_LIBOBJ(remove_equalities)])
86 AC_SUBST(bv_extra_programs)
87 AC_CHECK_FUNCS(LexSmaller,[
88 bv_extra_programs="verify_lexsmaller\$(EXEEXT) $bv_extra_programs"
90 AC_REPLACE_FUNCS(DomainConstraintSimplify)
92 #include <polylib/polylibgmp.h>
98 Matrix *M = Matrix_Alloc(6,5);
99 for (i = 0; i < 6; ++i) {
100 value_set_si(M->p[i][0], 1);
101 for (j = 1; j < 4; ++j)
102 value_set_si(M->p[i][j], (j-1 == i/2) * (1-2*(i%2)));
103 value_set_si(M->p[i][4], i%2);
105 P = Constraints2Polyhedron(M, 6);
106 return !(P->NbRays == 8);
109 [AC_DEFINE(HAVE_GROWING_CHERNIKOVA,[],
110 [PolyLib automatically grows the Chernikova table space])],
111 AC_MSG_WARN([This version of PolyLib does not automatically])
112 AC_MSG_WARN([enlarge the Chernikova table space]),
113 AC_MSG_WARN([Unable to determine whether PolyLib automatically])
114 AC_MSG_WARN([grows the Chernikova table space]))
117 #include <polylib/polylibgmp.h>
121 enode *en = new_enode(polynomial, 1, 1);
122 return !(en->arr[0].x.p == NULL);
125 AC_MSG_WARN([This version of polylib leaks]),[true])
129 #include <polylib/polylibgmp.h>
135 Param_Polyhedron *PP;
139 freopen("$srcdir/tests/ehrhart/t12.in", "r", stdin);
141 P = Constraints2Polyhedron(M, 1024);
143 C = Constraints2Polyhedron(M, 1024);
144 PP = Polyhedron2Param_Domain(P, C, 1024);
145 for (i = 0, V = PP->V; V; ++i, V = V->next)
151 AC_MSG_ERROR([This version of polylib produces incorrect vertices.]),
152 AC_MSG_WARN([Unable to determine whether PolyLib computes correct vertices]))
154 AC_MSG_CHECKING([number of arguments of Polyhedron_Enumerate])
155 AC_TRY_COMPILE([#include <polylib/polylibgmp.h>],
156 [Polyhedron_Enumerate(NULL,NULL,0,NULL)],
158 AC_DEFINE(HAVE_ENUMERATE4,[],
159 [Polyhedron_Enumerate takes four arguments])],
162 AC_MSG_CHECKING([number of arguments of count_points])
163 AC_TRY_COMPILE([#include <polylib/polylibgmp.h>],
164 [count_points(0,NULL,NULL,NULL)],
166 AC_DEFINE(HAVE_COUNT_POINTS4,[],
167 [count_points takes four arguments])],
171 [ --with-piplib=DIR DIR Location of PIP],
172 [ echo "Package piplib : $withval" && piplib_package=$withval],
173 [ piplib_package=yes ])
176 if test "$piplib_package" != "no"; then
177 SAVE_CPPFLAGS="$CPPFLAGS"
178 SAVE_LDFLAGS="$LDFLAGS"
179 if test "$piplib_package" != "yes"; then
180 CPPFLAGS="-I$piplib_package/include $CPPFLAGS"
181 LDFLAGS="-L$piplib_package/lib $LDFLAGS"
184 bv_cv_piplibfatal="no"
185 AC_CHECK_LIB(piplibMP, pip_solve,[
186 AC_CHECK_MEMBER(PipOptions.Urs_parms, [], [
187 AC_MSG_WARN([Piplib too old; please install version 1.3.6 or newer])
188 bv_cv_piplibfatal="yes"
189 ],[#include <stdio.h>
190 #include <piplib/piplibMP.h>])
192 AC_MSG_WARN([Piplib not found])
193 bv_cv_piplibfatal="yes"
195 if test "$bv_cv_piplibfatal" = "no"; then
196 AC_DEFINE(HAVE_PIPLIB,[],[use piplib])
197 LIBS="-lpiplibMP $LIBS"
199 bv_extra_programs="piptest\$(EXEEXT) $bv_extra_programs"
202 CPPFLAGS="$SAVE_CPPFLAGS"
203 LDFLAGS="$SAVE_LDFLAGS"
206 AM_CONDITIONAL(HAVE_PIPLIB, test x$have_piplib = xtrue)
208 AC_MSG_CHECKING(if the fractional representation should be used)
209 AC_ARG_ENABLE(fractional, [AS_HELP_STRING([--disable-fractional],
210 [Don't use fractional representation])],
211 [bv_cv_fractional=$enableval], [bv_cv_fractional="yes"])
212 AC_ARG_ENABLE(modulo, [AS_HELP_STRING([--disable-modulo],
213 [Don't use fractional representation])],
214 [bv_cv_modulo=$enableval], [bv_cv_modulo="$bv_cv_fractional"])
215 AC_MSG_RESULT($bv_cv_modulo)
216 if test "x$bv_cv_modulo" != "xno" ; then
217 AC_DEFINE(USE_MODULO,[], [Use fractional representation])
220 AC_MSG_CHECKING(whether to use incremental algorithm)
221 AC_ARG_ENABLE(incremental,
222 [AS_HELP_STRING([--enable-incremental@<:@=bf|df@:>@],
223 [Enable incremental algorithm [bf]])],
224 [bv_cv_incremental=$enableval], [bv_cv_incremental="no"])
225 AC_MSG_RESULT($bv_cv_incremental)
226 case $bv_cv_incremental in
228 AC_DEFINE(USE_INCREMENTAL_BF,[],
229 [Use breadth-first incremental algorithm])
232 AC_DEFINE(USE_INCREMENTAL_DF,[],
233 [Use depth-first incremental algorithm])
238 [ --with-ntl=DIR DIR Location of NTL],
239 [ echo "Package ntl : $withval" && ntl_package=$withval],
242 if test "$ntl_package" = "no"; then
243 AC_MSG_ERROR(Need ntl)
246 if test "$ntl_package" != "yes"; then
247 CPPFLAGS="-I$ntl_package/include $CPPFLAGS"
248 LDFLAGS="-L$ntl_package/lib $LDFLAGS"
256 ],:,AC_MSG_ERROR(ntl not compiled with gmp support))
258 AC_CHECK_LIB(ntl, main,[],[
259 AC_MSG_ERROR(Need ntl)
262 AC_MSG_CHECKING(whether to compile bernstein)
263 AC_ARG_WITH(bernstein,
264 [AS_HELP_STRING([--without-bernstein],[do not compile bernstein])],
265 [ with_bernstein=$withval], [ with_bernstein=yes ])
266 AC_MSG_RESULT($with_bernstein)
269 if test "$with_bernstein" != "no"; then
271 AM_PATH_GINAC(1.3.3, [
273 AC_DEFINE(HAVE_GINAC,[],[use GiNaC])
274 PACKAGE_LIBS="-lbarvinok -lbernstein"
275 bv_extra_programs="barvinok_maximize\$(EXEEXT) $bv_extra_programs"
279 AM_CONDITIONAL(HAVE_GINAC, test x$have_ginac = xtrue)
281 AC_MSG_CHECKING(whether to use Omega)
282 AC_ARG_WITH(omega, [AS_HELP_STRING([--with-omega=DIR],[DIR Location of Omega])],
283 [ omega_package=$withval], [ omega_package=yes ])
284 AC_MSG_RESULT($omega_package)
286 AC_SUBST(OMEGA_CPPFLAGS)
287 AC_SUBST(OMEGA_LDFLAGS)
289 AC_SUBST(bv_omega_programs)
291 if test "$omega_package" != "no"; then
292 if test "x$omega_package" != "xyes"; then
293 OMEGA_CPPFLAGS="-I$omega_package/include/omega"
294 OMEGA_LDFLAGS="-L$omega_package/lib"
296 for i in /usr/include /usr/local/include; do
297 if test -f $i/omega/omega.h; then
298 OMEGA_CPPFLAGS="-I$i/omega"
304 SAVE_CPPFLAGS="$CPPFLAGS"
305 CPPFLAGS="$OMEGA_CPPFLAGS $CPPFLAGS"
306 AC_CHECK_HEADERS([omega.h],[
307 if test x$have_ginac = xtrue; then
308 bv_omega_programs="occ $bv_omega_programs"
310 AC_DEFINE(HAVE_OMEGA,[],[use omega])
311 OMEGA_LIBS="-lcode_gen -lomega"
313 ],[AC_MSG_WARN(Omega not found)])
314 CPPFLAGS="$SAVE_CPPFLAGS"
317 AM_CONDITIONAL(HAVE_OMEGA, test x$have_omega = xtrue)
320 AC_MSG_CHECKING(whether to use cddlib)
321 AC_ARG_WITH(cddlib, [AS_HELP_STRING([--with-cddlib=DIR],[DIR Location of cddlib])],
322 [ cddlib_package=$withval], [ cddlib_package=yes ])
323 AC_MSG_RESULT($cddlib_package)
326 if test "$cddlib_package" != "no"; then
327 if test "x$cddlib_package" != "xyes"; then
328 CPPFLAGS="-I$cddlib_package/include $CPPFLAGS"
329 LDFLAGS="-L$cddlib_package/lib $LDFLAGS"
339 AC_CHECK_LIB(cddgmp, main,[],[have_cddlib=false])
342 AM_CONDITIONAL(HAVE_CDDLIB, test x$have_cddlib = xtrue)
346 AC_MSG_CHECKING(whether to use GLPK)
347 AC_ARG_WITH(glpk, [AS_HELP_STRING([--with-glpk=DIR],[DIR Location of GLPK])],
348 [ glpk_package=$withval], [ glpk_package=yes ])
349 AC_MSG_RESULT($glpk_package)
352 if test "$glpk_package" != "no"; then
353 if test "x$glpk_package" != "xyes"; then
354 CPPFLAGS="-I$glpk_package/include $CPPFLAGS"
355 LDFLAGS="-L$glpk_package/lib $LDFLAGS"
357 AC_CHECK_HEADERS([glpk.h],[
359 AC_CHECK_LIB(glpk, main,[],[have_glpk=false])
362 AM_CONDITIONAL(HAVE_GLPK, test x$have_glpk = xtrue)
364 if test "$have_glpk" = "true" -o "$have_cddlib" = "true"; then
366 bv_extra_programs="polyhedron_sample\$(EXEEXT) 4coins\$(EXEEXT) lexmin\$(EXEEXT) $bv_extra_programs"
367 bv_extra_programs="polytope_scan\$(EXEEXT) $bv_extra_programs"
370 AC_SUBST(GIT_HEAD_ID)
372 AC_SUBST(GIT_HEAD_VERSION)
373 if test -f $srcdir/.git/HEAD; then
374 GIT_HEAD="$srcdir/.git/index"
375 GIT_REPO="$srcdir/.git"
376 GIT_HEAD_ID=`GIT_DIR=$GIT_REPO git describe`
377 elif test -f $srcdir/GIT_HEAD_ID; then
378 GIT_HEAD_ID=`cat $srcdir/GIT_HEAD_ID`
380 mysrcdir=`(cd $srcdir; pwd)`
381 head=`basename $mysrcdir | sed -e 's/.*-//'`
382 head2=`echo $head | sed -e 's/[^0-9a-f]//'`
383 head3=`echo $head2 | sed -e 's/........................................//'`
384 base=`basename $mysrcdir | sed -e 's/-.*//'`
385 if test "x$head3" = "x" -a "x$head" = "x$head2"; then
386 GIT_HEAD_ID="barvinok-$VERSION-$head
387 elif test "x$base" = "xbarvinok-$VERSION" -a "x$head" != "x"; then
388 GIT_HEAD_ID="barvinok-$VERSION-$head
390 GIT_HEAD_ID="UNKNOWN"
393 if test -z "$GIT_REPO" ; then
394 GIT_HEAD_VERSION="$GIT_HEAD_ID"
396 GIT_HEAD_VERSION="\`GIT_DIR=$GIT_REPO git describe\`"
398 echo '#define GIT_HEAD_ID "'$GIT_HEAD_ID'"' > version.h
405 suffix="normal", suffix="broken")
406 AC_CONFIG_COMMANDS([barvinok/set.h],
407 [cp $srcdir/barvinok/set.h.$suffix barvinok/set.h],
409 AC_CONFIG_COMMANDS([barvinok/NTL.h],
410 [cp $srcdir/barvinok/NTL.h.$suffix barvinok/NTL.h],
413 SAVE_CPPFLAGS="$CPPFLAGS"
414 CPPFLAGS="-I$srcdir $CPPFLAGS"
415 AC_TRY_COMPILE([#include "fdstream.h"],[],
416 [AC_DEFINE(USE_FDSTREAM,[],[use fdstream])
418 CPPFLAGS="$SAVE_CPPFLAGS"
420 AM_CONDITIONAL(USE_FDSTREAM, [test "$use_fdstream" = true])
422 AX_CREATE_PKGCONFIG_INFO
424 AC_CONFIG_HEADERS(config.h)
425 AC_CONFIG_FILES(Makefile lib/Makefile doc/Makefile omega/Makefile)
426 if test x$have_ginac = xtrue; then
427 AC_CONFIG_SUBDIRS(bernstein)