1 AC_INIT([barvinok], [0.37], [isl-development@googlegroups.com])
2 AC_CONFIG_MACRO_DIR([m4])
3 AM_INIT_AUTOMAKE([foreign])
4 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
17 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
18 if test "$enable_shared" = yes; then
19 BV_LDFLAGS="-no-undefined"
28 AC_CHECK_HEADERS(getopt.h)
29 AC_CHECK_HEADERS(sys/times.h)
30 AC_CHECK_FUNCS(sigaction)
32 AC_MSG_CHECKING(whether to build shared libbarvinok)
33 AC_ARG_ENABLE(shared_barvinok,
34 AS_HELP_STRING([--enable-shared-barvinok],
35 [build shared barvinok library]),
36 [bv_cv_shared_barvinok=$enableval], [bv_cv_shared_barvinok="no"])
37 AC_MSG_RESULT($bv_cv_shared_barvinok)
38 if test "x$bv_cv_shared_barvinok" != "xyes" ; then
39 BV_LDFLAGS="$BV_LDFLAGS -static"
44 AC_ARG_WITH(default-prefix,
45 AS_HELP_STRING([--with-default-prefix=DIR],
46 [Default installation prefix of optional packages]))
47 if test "${with_default_prefix+set}" = set; then
48 if test "${with_libgmp+set}" != set -a \
49 -f "$with_default_prefix/include/gmp.h"; then
50 with_gmp_prefix=$with_default_prefix
52 if test "${with_ntl+set}" != set -a \
53 -f "$with_default_prefix/include/NTL/ZZ.h"; then
54 with_ntl=$with_default_prefix
56 if test "${with_cddlib+set}" != set -a \
57 -f "$with_default_prefix/include/cddmp.h"; then
58 with_cddlib=$with_default_prefix
60 if test "${with_glpk+set}" != set -a \
61 -f "$with_default_prefix/include/glpk.h"; then
62 with_glpk=$with_default_prefix
64 if test "${with_topcom+set}" != set -a \
65 -f "$with_default_prefix/bin/points2triangs"; then
66 with_topcom=$with_default_prefix
70 AX_SUBMODULE(gmp,system,system)
72 if test "x$with_gmp_prefix" != "x"; then
73 bv_configure_args="$bv_configure_args --with-libgmp=$with_gmp_prefix"
74 CPPFLAGS="-I$with_gmp_prefix/include $CPPFLAGS"
75 LDFLAGS="-L$with_gmp_prefix/lib $LDFLAGS"
77 bv_configure_args="$bv_configure_args --with-libgmp --with-gmp"
80 AC_CHECK_HEADER(gmp.h,
81 [AC_CHECK_LIB(gmp,main,
83 [poly_cv_gmpfatal="yes"])],
84 [poly_cv_gmpfatal="yes"])
85 if test "$poly_cv_gmpfatal" = "yes"; then
86 AC_MSG_ERROR([GMP not found])
88 AC_CHECK_DECL(mpz_divisible_p,[],[AC_LIBOBJ(mpz_divisible_p)],[#include <gmp.h>])
90 AX_SUBMODULE(polylib,build|bundled|system,bundled)
92 AC_SUBST(POLYLIB_CPPFLAGS)
93 AC_SUBST(POLYLIB_LDFLAGS)
94 AC_SUBST(POLYLIB_LIBS)
95 case "$with_polylib" in
97 bv_configure_args="$bv_configure_args --with-polylib-builddir=../polylib"
98 POLYLIB_CPPFLAGS="-I\$(top_builddir)/polylib/include -I\$(top_srcdir)/polylib/include"
101 with_polylib_builddir=`echo @abs_builddir@ | $with_polylib_builddir/config.status --file=-`
102 POLYLIB_CPPFLAGS="-I$polylib_srcdir/include -I$with_polylib_builddir/include"
103 POLYLIB_LIBS="$with_polylib_builddir/libpolylibgmp.la"
106 POLYLIB_LIBS="-lpolylibgmp"
107 if test "x$with_polylib_prefix" != "x"; then
108 POLYLIB_CPPFLAGS="-I$with_polylib_prefix/include"
109 POLYLIB_LDFLAGS="-L$with_polylib_prefix/lib"
111 SAVE_CPPFLAGS="$CPPFLAGS"
112 CPPFLAGS="$POLYLIB_CPPFLAGS $CPPFLAGS"
113 AC_CHECK_HEADERS([polylib/polylibgmp.h], [], [
114 AC_MSG_ERROR(Need PolyLib)
116 CPPFLAGS="$SAVE_CPPFLAGS"
119 AM_CONDITIONAL(BUNDLED_POLYLIB, test $with_polylib = bundled)
121 AX_SUBMODULE(isl,build|bundled|system,bundled)
125 AC_SUBST(ISL_BUILDDIR)
129 ISL_CFLAGS="-I\$(top_srcdir)/isl/include -I\$(top_builddir)/isl/include"
130 bv_configure_args="$bv_configure_args --with-isl-builddir=../isl"
131 PACKAGE_CFLAGS_ISL='-I${prefix}/include'
134 ISL_BUILDDIR=`echo @abs_builddir@ | $with_isl_builddir/config.status --file=-`
135 bv_configure_args="$bv_configure_args --with-isl-builddir=$ISL_BUILDDIR"
136 ISL_CFLAGS="-I$isl_srcdir/include -I$ISL_BUILDDIR/include"
137 PACKAGE_CFLAGS_ISL='-I${prefix}/include'
140 PKG_CHECK_MODULES([ISL], [isl])
141 PACKAGE_CFLAGS_ISL="$ISL_CFLAGS"
143 AM_CONDITIONAL(BUNDLED_ISL, test $with_isl = bundled)
144 AM_CONDITIONAL(BUILD_ISL, test $with_isl = build)
146 AX_SUBMODULE(pet,bundled|build|system|no,no)
149 AC_SUBST(PET_BUILDDIR)
152 PET_CFLAGS="-I\$(top_srcdir)/pet/include"
153 AC_DEFINE(HAVE_PET,[],[use Pet])
156 PET_BUILDDIR=`echo @abs_builddir@ | $with_pet_builddir/config.status --file=-`
157 PET_CFLAGS="-I$pet_srcdir/include"
158 AC_DEFINE(HAVE_PET,[],[use Pet])
161 PKG_CHECK_MODULES([PET], [pet])
162 AC_DEFINE(HAVE_PET,[],[use Pet])
164 AM_CONDITIONAL(BUNDLED_PET, test $with_pet = bundled)
165 AM_CONDITIONAL(BUILD_PET, test $with_pet = build)
167 AC_MSG_CHECKING(if the fractional representation should be used)
168 AC_ARG_ENABLE(fractional, [AS_HELP_STRING([--disable-fractional],
169 [Don't use fractional representation])],
170 [bv_cv_fractional=$enableval], [bv_cv_fractional="yes"])
171 AC_ARG_ENABLE(modulo, [AS_HELP_STRING([--disable-modulo],
172 [Don't use fractional representation])],
173 [bv_cv_modulo=$enableval], [bv_cv_modulo="$bv_cv_fractional"])
174 AC_MSG_RESULT($bv_cv_modulo)
175 if test "x$bv_cv_modulo" != "xno" ; then
176 AC_DEFINE(USE_MODULO,[], [Use fractional representation])
179 AC_MSG_CHECKING(whether to use incremental algorithm)
180 AC_ARG_ENABLE(incremental,
181 [AS_HELP_STRING([--enable-incremental@<:@=bf|df@:>@],
182 [Enable incremental algorithm [bf]])],
183 [bv_cv_incremental=$enableval], [bv_cv_incremental="no"])
184 AC_MSG_RESULT($bv_cv_incremental)
185 case $bv_cv_incremental in
187 AC_DEFINE(USE_INCREMENTAL_BF,[],
188 [Use breadth-first incremental algorithm])
191 AC_DEFINE(USE_INCREMENTAL_DF,[],
192 [Use depth-first incremental algorithm])
197 [ --with-ntl=DIR DIR Location of NTL],
198 [ echo "Package ntl : $withval" && ntl_package=$withval],
201 if test "$ntl_package" = "no"; then
202 AC_MSG_ERROR(Need ntl)
205 AC_SUBST(NTL_CPPFLAGS)
206 AC_SUBST(NTL_LDFLAGS)
207 if test "$ntl_package" != "yes"; then
208 NTL_CPPFLAGS="-I$ntl_package/include"
209 NTL_LDFLAGS="-L$ntl_package/lib"
213 SAVE_CPPFLAGS="$CPPFLAGS"
214 SAVE_LDFLAGS="$LDFLAGS"
215 CPPFLAGS="$NTL_CPPFLAGS $CPPFLAGS"
216 LDFLAGS="$NTL_LDFLAGS $LDFLAGS"
218 AC_CHECK_HEADER([NTL/ZZ.h],[],[bv_no_ntl=true])
224 ],:,AC_MSG_ERROR(ntl not compiled with gmp support))
227 AC_CHECK_LIB(ntl, main,[],[bv_no_ntl=true])
228 if test "$bv_no_ntl" = "true"; then
229 AC_MSG_ERROR(Need ntl)
231 CPPFLAGS="$SAVE_CPPFLAGS"
232 LDFLAGS="$SAVE_LDFLAGS"
234 AC_SUBST(bv_cone_hilbert_basis)
235 AC_MSG_CHECKING(whether to compile zsolve)
237 [AS_HELP_STRING([--without-zsolve],[do not compile zsolve])],
238 [ with_zsolve=$withval], [ with_zsolve=yes ])
239 AC_MSG_RESULT($with_zsolve)
242 if test "$with_zsolve" != "no"; then
243 if test "$GCC" = "yes"; then
245 sed -e 's/.* \(@<:@0-9@:>@@<:@0-9@:>@*\)\.\(@<:@0-9@:>@@<:@0-9@:>@*\).*/\1 \2/' |
247 if test $major -gt 3; then
250 if test $major -eq 3 -a $minor -ge 4; then
256 if test "$use_zsolve" = false; then
257 AC_MSG_WARN(gcc 3.4 required to compile zsolve)
259 AC_DEFINE(USE_ZSOLVE,[],[use zsolve])
260 bv_cone_hilbert_basis="cone_hilbert_basis\$(EXEEXT)"
263 AM_CONDITIONAL(USE_ZSOLVE, test x$use_zsolve = xtrue)
265 AX_SUBMODULE(omega,no|system,no)
267 AC_SUBST(OMEGA_CPPFLAGS)
268 AC_SUBST(OMEGA_LDFLAGS)
270 AC_SUBST(OMEGA_CODEGEN_LIBS)
273 case "$with_omega" in
275 if test "x$with_omega_prefix" != "xyes"; then
276 OMEGA_CPPFLAGS="-I$with_omega_prefix/include/omega"
277 OMEGA_LDFLAGS="-L$with_omega_prefix/lib"
279 for i in /usr/include /usr/local/include; do
280 if test -f $i/omega/omega.h; then
281 OMEGA_CPPFLAGS="-I$i/omega"
287 SAVE_CPPFLAGS="$CPPFLAGS"
288 SAVE_LDFLAGS="$LDFLAGS"
289 CPPFLAGS="$OMEGA_CPPFLAGS $CPPFLAGS"
290 LDFLAGS="$OMEGA_LDFLAGS $LDFLAGS"
291 AC_CHECK_HEADERS([omega.h],[
293 AC_CHECK_LIB(code_gen,main,[
294 OMEGA_CODEGEN_LIBS="-lcode_gen -lomega"
298 ],[AC_MSG_WARN(Omega not found)])
299 CPPFLAGS="$SAVE_CPPFLAGS"
300 LDFLAGS="$SAVE_LDFLAGS"
304 if test "$have_omega" = true; then
305 AC_DEFINE(HAVE_OMEGA,[],[use omega])
307 AM_CONDITIONAL(HAVE_OMEGA, test x$have_omega = xtrue)
310 AC_MSG_CHECKING(whether to compile parker)
312 [AS_HELP_STRING([--without-zsolve],[do not compile zsolve])],
313 [ with_parker=$withval], [ with_parker=yes ])
314 AC_MSG_RESULT($with_parker)
316 if test "$with_parker" != "no"; then
317 AC_MSG_CHECKING(for mona)
319 [AS_HELP_STRING([--with-mona=DIR],[mona *source* directory])],
320 [], [AC_MSG_RESULT(not specified)])
322 if test "x$with_mona" != "x"; then
325 AC_MSG_RESULT($MONAPATH)
327 AC_DEFINE(USE_PARKER,[],[use parker])
330 if test "x$with_mona" = "x"; then
331 AC_MSG_WARN(mona source directory required to compile parker)
332 AC_MSG_WARN(http://www.brics.dk/mona/download)
335 AM_CONDITIONAL(USE_PARKER, test x$use_parker = xtrue)
337 AC_MSG_CHECKING(whether to use cddlib)
338 AC_ARG_WITH(cddlib, [AS_HELP_STRING([--with-cddlib=DIR],[DIR Location of cddlib])],
339 [ cddlib_package=$withval], [ cddlib_package=yes ])
340 AC_MSG_RESULT($cddlib_package)
343 if test "$cddlib_package" != "no"; then
344 if test "x$cddlib_package" != "xyes"; then
345 CPPFLAGS="-I$cddlib_package/include $CPPFLAGS"
346 LDFLAGS="-L$cddlib_package/lib $LDFLAGS"
356 AC_CHECK_LIB(cddgmp, main,[
358 LIBS="-lcddgmp $LIBS"
359 AC_DEFINE_UNQUOTED([SRCDIR], ["$srcdir"], [srcdir])
361 AC_RUN_IFELSE([AC_LANG_PROGRAM([[#define GMPRATIONAL
365 const char *filename = SRCDIR"/cdd94e-test";
369 dd_ErrorType err = dd_NoError;
371 dd_set_global_constants();
373 f = fopen(filename, "r");
374 M = dd_PolyFile2Matrix(f, &err);
375 lp = dd_Matrix2LP(M, &err);
376 dd_LPSolve(lp, dd_DualSimplex, &err);
377 return lp->LPS == dd_Inconsistent;
379 AC_DEFINE(HAVE_LIBCDDGMP, [], [Define to 1 if you have the `cddgmp' library (-lcddgmp).])
381 AC_MSG_WARN(please upgrade cddlib to 0.94e or later)
386 ],[have_cddlib=false])
389 AM_CONDITIONAL(HAVE_CDDLIB, test x$have_cddlib = xtrue)
393 AC_MSG_CHECKING(whether to use GLPK)
394 AC_ARG_WITH(glpk, [AS_HELP_STRING([--with-glpk=DIR],[DIR Location of GLPK])],
395 [ glpk_package=$withval], [ glpk_package=yes ])
396 AC_MSG_RESULT($glpk_package)
399 if test "$glpk_package" != "no"; then
400 if test "x$glpk_package" != "xyes"; then
401 CPPFLAGS="-I$glpk_package/include $CPPFLAGS"
402 LDFLAGS="-L$glpk_package/lib $LDFLAGS"
404 AC_CHECK_HEADERS([glpk.h],[
406 AC_CHECK_LIB(glpk, [glp_simplex],[],[have_glpk=false])
409 AM_CONDITIONAL(HAVE_GLPK, test x$have_glpk = xtrue)
411 AC_MSG_CHECKING(location of TOPCOM)
412 AC_ARG_WITH(topcom, [AS_HELP_STRING([--with-topcom=DIR],[Location of TOPCOM])],
413 [topcom_package=$withval], [topcom_package=unspecified])
414 AC_MSG_RESULT($topcom_package)
416 if test "$topcom_package" != no; then
418 if test "$topcom_package" != unspecified; then
419 topcom_path="$topcom_package/bin"
421 AC_PATH_PROG([POINTS2TRIANGS], [points2triangs], [], [$topcom_path])
422 if test -n "$POINTS2TRIANGS"; then
424 AC_DEFINE_UNQUOTED(POINTS2TRIANGS_PATH, ["$POINTS2TRIANGS"],
425 [Path of points2triangs])
428 AM_CONDITIONAL(HAVE_TOPCOM, test x$have_topcom = xtrue)
431 echo '#define GIT_HEAD_ID "'$GIT_HEAD_ID'"' > version.h
438 suffix="normal", suffix="broken")
439 AC_CONFIG_COMMANDS([barvinok/set.h],
440 [cp $srcdir/barvinok/set.h.$suffix barvinok/set.h],
442 AC_CONFIG_COMMANDS([barvinok/NTL.h],
443 [cp $srcdir/barvinok/NTL.h.$suffix barvinok/NTL.h],
446 SAVE_CPPFLAGS="$CPPFLAGS"
447 CPPFLAGS="-I$srcdir $CPPFLAGS"
448 AC_TRY_COMPILE([#include "fdstream.h"],[],
449 [AC_DEFINE(USE_FDSTREAM,[],[use fdstream])
451 CPPFLAGS="$SAVE_CPPFLAGS"
453 AM_CONDITIONAL(USE_FDSTREAM, [test "$use_fdstream" = true])
455 PACKAGE_CFLAGS="$PACKAGE_CFLAGS_ISL"
456 PACKAGE_LIBS="-lbarvinok $EXTRA_PACKAGE_LIBS -lpolylibgmp -lisl"
457 AX_CREATE_PKGCONFIG_INFO
459 AC_CONFIG_HEADERS(config.h)
460 AC_CONFIG_FILES(Makefile zsolve/Makefile doc/Makefile)
461 AC_CONFIG_FILES(parker/Makefile)
462 if test $with_polylib = bundled; then
463 AC_CONFIG_SUBDIRS(polylib)
465 if test $with_isl = bundled; then
466 AC_CONFIG_SUBDIRS(isl)
468 if test $with_pet = bundled; then
469 AC_CONFIG_SUBDIRS(pet)
471 AC_CONFIG_COMMANDS_POST([
472 dnl pass on arguments to subdir configures, but don't
473 dnl add them to config.status
474 ac_configure_args="$ac_configure_args $bv_configure_args"