1 AC_INIT([barvinok], [0.41.7], [isl-development@googlegroups.com])
2 AC_CONFIG_MACRO_DIR([m4])
3 AM_INIT_AUTOMAKE([foreign subdir-objects])
4 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
14 AC_SUBST(BV_LIB_LDFLAGS)
16 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
17 if test "$enable_shared" = yes; then
18 BV_LIB_LDFLAGS="-no-undefined"
27 AC_CHECK_HEADERS(getopt.h)
28 AC_CHECK_HEADERS(sys/times.h)
29 AC_CHECK_FUNCS(sigaction)
31 AC_MSG_CHECKING(whether to build shared libbarvinok)
32 AC_ARG_ENABLE(shared_barvinok,
33 AS_HELP_STRING([--enable-shared-barvinok],
34 [build shared barvinok library]),
35 [bv_cv_shared_barvinok=$enableval], [bv_cv_shared_barvinok="no"])
36 AC_MSG_RESULT($bv_cv_shared_barvinok)
37 if test "x$bv_cv_shared_barvinok" != "xyes" ; then
38 BV_LIB_LDFLAGS="$BV_LIB_LDFLAGS -static"
42 AC_MSG_CHECKING(whether to build static executables)
43 AC_ARG_ENABLE(all_static,
44 AS_HELP_STRING([--enable-all-static],
45 [build static executables]),
46 [bv_cv_all_static=$enableval], [bv_cv_all_static="no"])
47 AC_MSG_RESULT($bv_cv_all_static)
48 if test "x$bv_cv_all_static" = "xyes" ; then
49 BV_LDFLAGS="$BV_LDFLAGS -all-static"
53 AX_CXX_COMPILE_STDCXX_11([], [mandatory])
55 AC_ARG_WITH(default-prefix,
56 AS_HELP_STRING([--with-default-prefix=DIR],
57 [Default installation prefix of optional packages]))
58 if test "${with_default_prefix+set}" = set; then
59 if test "${with_libgmp+set}" != set -a \
60 -f "$with_default_prefix/include/gmp.h"; then
61 with_gmp_prefix=$with_default_prefix
63 if test "${with_ntl+set}" != set -a \
64 "${with_ntl_prefix+set}" != set -a \
65 -f "$with_default_prefix/include/NTL/ZZ.h"; then
66 with_ntl_prefix=$with_default_prefix
68 if test "${with_cddlib+set}" != set -a \
69 -f "$with_default_prefix/include/cddlib/cddmp.h"; then
70 with_cddlib=$with_default_prefix
72 if test "${with_glpk+set}" != set -a \
73 -f "$with_default_prefix/include/glpk.h"; then
74 with_glpk=$with_default_prefix
76 if test "${with_topcom+set}" != set -a \
77 -f "$with_default_prefix/bin/points2triangs"; then
78 with_topcom=$with_default_prefix
82 AX_SUBMODULE(gmp,system|build,system)
86 with_gmp_builddir=`echo @abs_builddir@ | \
87 $with_gmp_builddir/config.status --file=-`
88 CPPFLAGS="-I$with_gmp_builddir $CPPFLAGS"
89 LDFLAGS="-L$with_gmp_builddir/$lt_cv_objdir $LDFLAGS"
90 bv_extra="--with-gmp --with-gmp-builddir=$with_gmp_builddir"
91 bv_configure_args="$bv_configure_args $bv_extra"
94 if test "x$with_gmp_prefix" != "x"; then
95 bv_extra="--with-libgmp=$with_gmp_prefix"
96 bv_configure_args="$bv_configure_args $bv_extra"
97 CPPFLAGS="-I$with_gmp_prefix/include $CPPFLAGS"
98 LDFLAGS="-L$with_gmp_prefix/lib $LDFLAGS"
100 bv_configure_args="$bv_configure_args --with-libgmp --with-gmp"
105 poly_cv_gmpfatal="no"
106 AC_CHECK_HEADER(gmp.h,
107 [AC_CHECK_LIB(gmp,main,
109 [poly_cv_gmpfatal="yes"])],
110 [poly_cv_gmpfatal="yes"])
111 if test "$poly_cv_gmpfatal" = "yes"; then
112 AC_MSG_ERROR([GMP not found])
114 AC_CHECK_DECL(mpz_divisible_p,[],[AC_LIBOBJ(mpz_divisible_p)],[#include <gmp.h>])
116 AX_SUBMODULE(polylib,build|bundled|system,bundled)
118 AC_SUBST(POLYLIB_CPPFLAGS)
119 AC_SUBST(POLYLIB_LDFLAGS)
120 AC_SUBST(POLYLIB_LIBS)
121 case "$with_polylib" in
123 bv_configure_args="$bv_configure_args --with-polylib-builddir=../polylib"
124 POLYLIB_CPPFLAGS="-I\$(top_builddir)/polylib/include -I\$(top_srcdir)/polylib/include"
127 with_polylib_builddir=`echo @abs_builddir@ | $with_polylib_builddir/config.status --file=-`
128 POLYLIB_CPPFLAGS="-I$polylib_srcdir/include -I$with_polylib_builddir/include"
129 POLYLIB_LIBS="$with_polylib_builddir/libpolylibgmp.la"
132 POLYLIB_LIBS="-lpolylibgmp"
133 if test "x$with_polylib_prefix" != "x"; then
134 POLYLIB_CPPFLAGS="-I$with_polylib_prefix/include"
135 POLYLIB_LDFLAGS="-L$with_polylib_prefix/lib"
137 SAVE_CPPFLAGS="$CPPFLAGS"
138 CPPFLAGS="$POLYLIB_CPPFLAGS $CPPFLAGS"
139 AC_CHECK_HEADERS([polylib/polylibgmp.h], [], [
140 AC_MSG_ERROR(Need PolyLib)
142 CPPFLAGS="$SAVE_CPPFLAGS"
145 AM_CONDITIONAL(BUNDLED_POLYLIB, test $with_polylib = bundled)
147 AX_SUBMODULE(isl,build|bundled|system,bundled)
152 AC_SUBST(ISL_BUILDDIR)
155 ISL_SRCDIR="$srcdir/isl"
157 ISL_CFLAGS="-I\$(top_srcdir)/isl/include -I\$(top_builddir)/isl/include"
158 bv_configure_args="$bv_configure_args --with-isl=build"
159 bv_configure_args="$bv_configure_args --with-isl-builddir=../isl"
160 PACKAGE_CFLAGS_ISL='-I${prefix}/include'
163 ISL_SRCDIR="$isl_srcdir"
164 ISL_BUILDDIR=`echo @abs_builddir@ | $with_isl_builddir/config.status --file=-`
165 bv_configure_args="$bv_configure_args --with-isl-builddir=$ISL_BUILDDIR"
166 ISL_CFLAGS="-I$isl_srcdir/include -I$ISL_BUILDDIR/include"
167 PACKAGE_CFLAGS_ISL='-I${prefix}/include'
170 PKG_CHECK_MODULES([ISL], [isl])
171 PACKAGE_CFLAGS_ISL="$ISL_CFLAGS"
173 AM_CONDITIONAL(BUNDLED_ISL, test $with_isl = bundled)
174 AM_CONDITIONAL(BUILD_ISL, test $with_isl = build)
175 AM_CONDITIONAL(HAVE_ISL_BUILDDIR, test "x$ISL_BUILDDIR" != "x")
177 AX_SUBMODULE(pet,bundled|build|system|no,no)
180 AC_SUBST(PET_BUILDDIR)
184 PET_CFLAGS="-I\$(top_srcdir)/pet/include"
185 AC_DEFINE(HAVE_PET,[],[use Pet])
188 PET_BUILDDIR=`echo @abs_builddir@ | $with_pet_builddir/config.status --file=-`
189 PET_CFLAGS="-I$pet_srcdir/include"
190 AC_DEFINE(HAVE_PET,[],[use Pet])
193 PKG_CHECK_MODULES([PET], [pet])
194 AC_DEFINE(HAVE_PET,[],[use Pet])
197 pet_suffix="top.no_pet"
200 AM_CONDITIONAL(BUNDLED_PET, test $with_pet = bundled)
201 AM_CONDITIONAL(BUILD_PET, test $with_pet = build)
204 [AS_HELP_STRING([--with-ntl=system|build],
205 [Which NTL to use [default=system]])])
207 AC_ARG_WITH(ntl-prefix,
208 [AS_HELP_STRING([--with-ntl-prefix=DIR],
209 [Prefix of NTL installation])])
211 AC_ARG_WITH(ntl-builddir,
212 [AS_HELP_STRING([--with-ntl-builddir=DIR],
213 [Prefix of NTL root build directory
214 containing include and src subdirectories])])
216 if test "x$with_ntl_builddir" != "x"; then
217 if test "x$with_ntl" != "xbuild" -a "x$with_ntl" != "x"; then
218 AC_MSG_ERROR(m4_normalize([Setting --with-ntl-builddir implies
224 if test "x$with_ntl_prefix" != "x"; then
225 if test "x$with_ntl" != "xsystem" -a "x$with_ntl" != "x"; then
226 AC_MSG_ERROR(m4_normalize([Setting --with-ntl-prefix implies
239 AC_MSG_CHECKING([which NTL to use])
240 AC_MSG_RESULT($with_ntl)
242 AC_SUBST(NTL_CPPFLAGS)
243 AC_SUBST(NTL_LDFLAGS)
246 ntl_include="$with_ntl_builddir/include"
247 NTL_LDFLAGS="-L$with_ntl_builddir/src/$lt_cv_objdir"
248 ntl_builddir_found=false
249 AC_CHECK_FILE(["$with_ntl_builddir/src/ZZ.c"],
250 [ntl_builddir_found=true],[])
251 if test "x$ntl_builddir_found" != "xtrue"; then
252 if test -f "$with_ntl_builddir/ZZ.c"; then
253 ntl_builddir=`dirname $with_ntl_builddir`
254 AC_MSG_ERROR(m4_normalize(
255 [NTL source directory src/ specified as builddir.
256 Use root directory instead as
257 --with-ntl-builddir=$ntl_builddir]))
259 AC_MSG_ERROR([Could not find NTL in the builddir])
264 if test "x$with_ntl_prefix" != "x"; then
265 ntl_include="$with_ntl_prefix/include"
266 NTL_LDFLAGS="-L$with_ntl_prefix/lib"
270 if test "x$ntl_include" != "x"; then
271 NTL_CPPFLAGS="-I$ntl_include"
273 for path in /usr/local /usr; do
274 if test -f "$path/include/NTL/ZZ.h"; then
275 ntl_include="$path/include"
280 # Look for compiler/linker options needed for linking against NTL
281 ntl_configlog="$ntl_include/NTL/ConfigLog.h"
282 if test -f "$ntl_configlog"; then
283 AC_MSG_CHECKING([for compiler options in $ntl_configlog])
284 eval $($GREP "^CXXAUTOFLAGS" $ntl_configlog | $SED -e 's/^/NTL_/')
285 AC_MSG_RESULT([$NTL_CXXAUTOFLAGS])
286 NTL_CPPFLAGS="$NTL_CPPFLAGS $NTL_CXXAUTOFLAGS"
287 NTL_LDFLAGS="$NTL_LDFLAGS $NTL_CXXAUTOFLAGS"
292 AC_SUBST(bv_cone_hilbert_basis)
293 AC_MSG_CHECKING(whether to compile zsolve)
295 [AS_HELP_STRING([--without-zsolve],[do not compile zsolve])],
296 [ with_zsolve=$withval], [ with_zsolve=yes ])
297 AC_MSG_RESULT($with_zsolve)
300 if test "$with_zsolve" != "no"; then
301 if test "$GCC" = "yes"; then
303 $SED -e 's/.* \(@<:@0-9@:>@@<:@0-9@:>@*\)\.\(@<:@0-9@:>@@<:@0-9@:>@*\).*/\1 \2/' |
305 if test $major -gt 3; then
308 if test $major -eq 3 -a $minor -ge 4; then
314 if test "$use_zsolve" = false; then
315 AC_MSG_WARN(gcc 3.4 required to compile zsolve)
317 AC_DEFINE(USE_ZSOLVE,[],[use zsolve])
318 bv_cone_hilbert_basis="cone_hilbert_basis\$(EXEEXT)"
321 AM_CONDITIONAL(USE_ZSOLVE, test x$use_zsolve = xtrue)
323 AC_MSG_CHECKING(whether to use cddlib)
324 AC_ARG_WITH(cddlib, [AS_HELP_STRING([--with-cddlib=DIR],[DIR Location of cddlib])],
325 [ cddlib_package=$withval], [ cddlib_package=yes ])
326 AC_MSG_RESULT($cddlib_package)
329 if test "$cddlib_package" != "no"; then
330 if test "x$cddlib_package" != "xyes"; then
331 CPPFLAGS="-I$cddlib_package/include $CPPFLAGS"
332 LDFLAGS="-L$cddlib_package/lib $LDFLAGS"
334 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
336 #include <cddlib/setoper.h>
337 #include <cddlib/cddmp.h>
342 AC_CHECK_LIB(cddgmp, dd_SetMatrixObjective,[],[have_cddlib=false])
345 AM_CONDITIONAL(HAVE_CDDLIB, test x$have_cddlib = xtrue)
349 AC_MSG_CHECKING(whether to use GLPK)
350 AC_ARG_WITH(glpk, [AS_HELP_STRING([--with-glpk=DIR],[DIR Location of GLPK])],
351 [ glpk_package=$withval], [ glpk_package=yes ])
352 AC_MSG_RESULT($glpk_package)
355 if test "$glpk_package" != "no"; then
356 if test "x$glpk_package" != "xyes"; then
357 CPPFLAGS="-I$glpk_package/include $CPPFLAGS"
358 LDFLAGS="-L$glpk_package/lib $LDFLAGS"
360 AC_CHECK_HEADERS([glpk.h],[
362 AC_CHECK_LIB(glpk, [glp_simplex],[],[have_glpk=false])
365 AM_CONDITIONAL(HAVE_GLPK, test x$have_glpk = xtrue)
367 AC_MSG_CHECKING(location of TOPCOM)
368 AC_ARG_WITH(topcom, [AS_HELP_STRING([--with-topcom=DIR],[Location of TOPCOM])],
369 [topcom_package=$withval], [topcom_package=unspecified])
370 AC_MSG_RESULT($topcom_package)
372 if test "$topcom_package" != no; then
374 if test "$topcom_package" != unspecified; then
375 topcom_path="$topcom_package/bin"
377 AC_PATH_PROG([POINTS2TRIANGS], [points2triangs], [], [$topcom_path])
378 if test -n "$POINTS2TRIANGS"; then
380 AC_DEFINE_UNQUOTED(POINTS2TRIANGS_PATH, ["$POINTS2TRIANGS"],
381 [Path of points2triangs])
384 AM_CONDITIONAL(HAVE_TOPCOM, test x$have_topcom = xtrue)
385 AM_COND_IF([HAVE_TOPCOM], [
386 AC_SUBST(TOPCOM_CD, '--chamber-decomposition=topcom')
390 echo '#define GIT_HEAD_ID "'$GIT_HEAD_ID'"' > version.h
393 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
397 suffix="normal", suffix="broken")
398 AC_CONFIG_COMMANDS([barvinok/set.h],
399 [cp $srcdir/barvinok/set.h.$suffix barvinok/set.h],
401 AC_CONFIG_COMMANDS([barvinok/NTL.h],
402 [cp $srcdir/barvinok/NTL.h.$suffix barvinok/NTL.h],
405 SAVE_CPPFLAGS="$CPPFLAGS"
406 CPPFLAGS="-I$srcdir $CPPFLAGS"
407 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "fdstream.h"]],[[]])],
408 [AC_DEFINE(USE_FDSTREAM,[],[use fdstream])
410 CPPFLAGS="$SAVE_CPPFLAGS"
412 AM_CONDITIONAL(USE_FDSTREAM, [test "$use_fdstream" = true])
414 AC_CONFIG_COMMANDS([interface/isl.py.top],
415 [cp $srcdir/interface/isl.py.$pet_suffix interface/isl.py.top],
416 [pet_suffix="$pet_suffix"])
418 PACKAGE_CFLAGS="$PACKAGE_CFLAGS_ISL"
419 PACKAGE_LIBS="-lbarvinok $EXTRA_PACKAGE_LIBS -lpolylibgmp -lisl"
420 AX_CREATE_PKGCONFIG_INFO
422 AH_BOTTOM([#include "config_post.h"])
423 AC_CONFIG_HEADERS(config.h)
424 AC_CONFIG_FILES(Makefile zsolve/Makefile doc/Makefile)
425 AC_CONFIG_FILES([check_approx.sh], [chmod +x check_approx.sh])
426 AC_CONFIG_FILES([check_enumerate.sh], [chmod +x check_enumerate.sh])
427 AC_CONFIG_FILES([check_enumerate_e.sh], [chmod +x check_enumerate_e.sh])
428 AC_CONFIG_FILES([check_euler.sh], [chmod +x check_euler.sh])
429 AC_CONFIG_FILES([check_iscc.sh], [chmod +x check_iscc.sh])
430 AC_CONFIG_FILES([check_lexmin.sh], [chmod +x check_lexmin.sh])
431 AC_CONFIG_FILES([check_pwqp.sh], [chmod +x check_pwqp.sh])
432 AC_CONFIG_FILES([check_test.sh], [chmod +x check_test.sh])
433 AC_CONFIG_FILES([check_union.sh], [chmod +x check_union.sh])
434 if test $with_polylib = bundled; then
435 AC_CONFIG_SUBDIRS(polylib)
437 if test $with_isl = bundled; then
438 AC_CONFIG_SUBDIRS(isl)
440 if test $with_pet = bundled; then
441 AC_CONFIG_SUBDIRS(pet)
443 AC_CONFIG_COMMANDS_POST([
444 dnl pass on arguments to subdir configures, but don't
445 dnl add them to config.status
446 ac_configure_args="$ac_configure_args $bv_configure_args"