verify.c: extract some helper functions for isl based verification
[barvinok/uuh.git] / configure.in
blob19764f6d93ba20a9ca83e372e2114a2ced5f7a95
1 AC_INIT
2 AC_CONFIG_MACRO_DIR([m4])
3 AM_INIT_AUTOMAKE(barvinok, 0.30)
4 AC_PROG_CC
5 gl_EARLY
7 AC_PROG_CXX
8 AM_PROG_LEX
9 AC_PROG_YACC
10 AC_SUBST(versioninfo)
11 versioninfo=19:0:2
13 AC_CANONICAL_HOST
14 AC_LIBTOOL_WIN32_DLL
15 AC_SUBST(BV_LDFLAGS)
16 case $host in
17         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
18         if test "$enable_shared" = yes; then
19                 BV_LDFLAGS="-no-undefined" 
20         fi
21         ;;
22 esac
24 AC_PROG_LIBTOOL
26 gl_MODULES(argp progname)
27 gl_INIT
29 PKG_PROG_PKG_CONFIG
31 AC_CHECK_HEADERS(getopt.h)
32 AC_CHECK_HEADERS(sys/times.h)
34 AC_MSG_CHECKING(whether to build shared libbarvinok)
35 AC_ARG_ENABLE(shared_barvinok,
36         AS_HELP_STRING([--enable-shared-barvinok],
37                        [build shared barvinok library]),
38         [bv_cv_shared_barvinok=$enableval], [bv_cv_shared_barvinok="no"])
39 AC_MSG_RESULT($bv_cv_shared_barvinok)
40 if test "x$bv_cv_shared_barvinok" != "xyes" ; then
41         BV_LDFLAGS="$BV_LDFLAGS -static"
44 AC_CXX_GNUCXX_HASHMAP
46 AC_ARG_WITH(default-prefix,
47         AS_HELP_STRING([--with-default-prefix=DIR],
48             [Default installation prefix of optional packages]))
49 if test "${with_default_prefix+set}" = set; then
50         if test "${with_ginac_prefix+set}" != set -a \
51            -f "$with_default_prefix/lib/pkgconfig/ginac.pc"; then
52                 with_ginac_prefix=$with_default_prefix
53         fi
54         if test "${with_libgmp+set}" != set -a \
55            -f "$with_default_prefix/include/gmp.h"; then
56                 with_libgmp=$with_default_prefix
57         fi
58         if test "${with_ntl+set}" != set -a \
59            -f "$with_default_prefix/include/NTL/ZZ.h"; then
60                 with_ntl=$with_default_prefix
61         fi
62         if test "${with_cddlib+set}" != set -a \
63            -f "$with_default_prefix/include/cddmp.h"; then
64                 with_cddlib=$with_default_prefix
65         fi
66         if test "${with_glpk+set}" != set -a \
67            -f "$with_default_prefix/include/glpk.h"; then
68                 with_glpk=$with_default_prefix
69         fi
70         if test "${with_topcom+set}" != set -a \
71            -f "$with_default_prefix/bin/points2triangs"; then
72                 with_topcom=$with_default_prefix
73         fi
76 dnl Check for GMP library
77 AC_MSG_CHECKING(whether to use GMP)
78 AC_ARG_WITH(libgmp, 
79         [  --with-libgmp           DIR Location of the GMP Distribution], 
80         gmp_package=$withval, gmp_package=yes)
81 if test "x$gmp_package" = "xno"; then
82         AC_MSG_RESULT(no)
83         AC_MSG_ERROR(Need gmp)
84 else
85         AC_MSG_RESULT(yes)
86         if test "x$gmp_package" = "xyes"; then
87                 bv_configure_args="$bv_configure_args --with-libgmp --with-gmp"
88         else
89             bv_configure_args="$bv_configure_args --with-libgmp=$gmp_package"
90             bv_configure_args="$bv_configure_args --with-gmp-prefix=$gmp_package"
91             GMP_DIR=$gmp_package
92             if test ! -d "$GMP_DIR"; then
93                 AC_ERROR(Directory given for GMP Distribution is not a directory)
94             fi
95             CPPFLAGS="-I$GMP_DIR/include $CPPFLAGS"
96             LDFLAGS="-L$GMP_DIR/lib $LDFLAGS"
97         fi
98         poly_cv_gmpfatal="no"
99         AC_CHECK_HEADER(gmp.h,
100                 [AC_CHECK_LIB(gmp,main,
101                     [],
102                     [poly_cv_gmpfatal="yes"])],
103                 [poly_cv_gmpfatal="yes"])
104         if test "$poly_cv_gmpfatal" = "yes"; then
105                 AC_MSG_ERROR([GMP not found])
106         fi
108 AC_CHECK_DECL(mpz_divisible_p,[],[AC_LIBOBJ(mpz_divisible_p)],[#include <gmp.h>])
110 AX_SUBMODULE(polylib,build|bundled|system,bundled)
112 AC_SUBST(POLYLIB_CPPFLAGS)
113 AC_SUBST(POLYLIB_LDFLAGS)
114 AC_SUBST(POLYLIB_LIBS)
115 case "$with_polylib" in
116 bundled)
117         bv_configure_args="$bv_configure_args --with-polylib-builddir=../polylib"
118         POLYLIB_CPPFLAGS="-I\$(top_builddir)/polylib/include -I\$(top_srcdir)/polylib/include"
119         ;;
120 build)
121         with_polylib_builddir=`echo @abs_builddir@ | $with_polylib_builddir/config.status --file=-`
122         POLYLIB_CPPFLAGS="-I$polylib_srcdir/include -I$with_polylib_builddir/include"
123         POLYLIB_LIBS="$with_polylib_builddir/libpolylibgmp.la"
124         ;;
125 system)
126         POLYLIB_LIBS="-lpolylibgmp"
127         if test "x$with_polylib_prefix" != "x"; then
128                 POLYLIB_CPPFLAGS="-I$with_polylib_prefix/include"
129                 POLYLIB_LDFLAGS="-L$with_polylib_prefix/lib"
130         fi
131         SAVE_CPPFLAGS="$CPPFLAGS"
132         CPPFLAGS="$POLYLIB_CPPFLAGS $CPPFLAGS"
133         AC_CHECK_HEADERS([polylib/polylibgmp.h], [], [
134                 AC_MSG_ERROR(Need PolyLib)
135         ])
136         CPPFLAGS="$SAVE_CPPFLAGS"
137 esac
139 AM_CONDITIONAL(BUNDLED_POLYLIB, test $with_polylib = bundled)
141 AX_SUBMODULE(piplib,bundled|system,bundled)
143 AC_SUBST(PIPLIB_CPPFLAGS)
144 AC_SUBST(PIPLIB_LDFLAGS)
145 AC_SUBST(PIPLIB_LIBS)
146 if test "$with_piplib" = "bundled"; then
147         bv_configure_args="$bv_configure_args --with-piplib-builddir=../piplib"
148         bv_configure_args="$bv_configure_args --with-bits=gmp"
149         PIPLIB_CPPFLAGS="-I$srcdir/piplib/include"
150 else
151         PIPLIB_LIBS="-lpiplibMP"
152         if test "x$with_piplib_prefix" != "x"; then
153                 PIPLIB_CPPFLAGS="-I$with_piplib_prefix/include"
154                 PIPLIB_LDFLAGS="-L$with_piplib_prefix/lib"
155         fi
156         SAVE_CPPFLAGS="$CPPFLAGS"
157         SAVE_LDFLAGS="$LDFLAGS"
158         CPPFLAGS="$PIPLIB_CPPFLAGS $CPPFLAGS"
159         LDFLAGS="$PIPLIB_LDFLAGS $LDFLAGS"
160         AC_CHECK_LIB(piplibMP, pip_solve,[
161             AC_CHECK_MEMBER(PipOptions.Urs_parms, [], [
162                 AC_MSG_ERROR([Piplib too old; please install version 1.3.6 or newer])
163             ],[#include <stdio.h>
164                #include <piplib/piplibMP.h>])
165         ],[
166             AC_MSG_ERROR([Piplib not found])
167         ])
168         CPPFLAGS="$SAVE_CPPFLAGS"
169         LDFLAGS="$SAVE_LDFLAGS"
171 AM_CONDITIONAL(BUNDLED_PIPLIB, test $with_piplib = bundled)
173 AX_SUBMODULE(isl,build|bundled|system,bundled)
175 AC_SUBST(ISL_CFLAGS)
176 AC_SUBST(ISL_LIBS)
177 case "$with_isl" in
178 bundled)
179         ISL_CFLAGS="-I\$(top_srcdir)/isl/include -I\$(top_builddir)/isl/include"
180         bv_configure_args="$bv_configure_args --with-isl-builddir=../isl"
181         PACKAGE_CFLAGS_ISL="-I$prefix/include/isl"
182         ;;
183 build)
184         with_isl_builddir=`echo @abs_builddir@ | $with_isl_builddir/config.status --file=-`
185         ISL_CFLAGS="-I$isl_srcdir/include -I$with_isl_builddir/include"
186         ISL_LIBS="$with_isl_builddir/libisl.la"
187         PACKAGE_CFLAGS_ISL="-I$prefix/include/isl"
188         ;;
189 system)
190         PKG_CHECK_MODULES([ISL], [isl])
191         PACKAGE_CFLAGS_ISL="$ISL_CFLAGS"
192 esac
193 AM_CONDITIONAL(BUNDLED_ISL, test $with_isl = bundled)
195 AX_SUBMODULE(isl-polylib,build|bundled|system,bundled)
197 AC_SUBST(ISL_POLYLIB_CFLAGS)
198 AC_SUBST(ISL_POLYLIB_LIBS)
199 case "$with_isl_polylib" in
200 bundled)
201         ISL_POLYLIB_CFLAGS="-I\$(top_srcdir)/isl-polylib/include -I\$(top_builddir)/isl-polylib/include"
202         ;;
203 build)
204         ISL_POLYLIB_CFLAGS="-I$isl_polylib_srcdir/include -I$with_isl_polylib_builddir/include"
205         ISL_POLYLIB_LIBS="$with_isl_polylib_builddir/libisl-polylib.la"
206         ;;
207 system)
208         PKG_CHECK_MODULES([ISL_POLYLIB], [isl-polylib])
209 esac
210 AM_CONDITIONAL(BUNDLED_ISL_POLYLIB, test $with_isl_polylib = bundled)
212 AC_MSG_CHECKING(if the fractional representation should be used)
213 AC_ARG_ENABLE(fractional, [AS_HELP_STRING([--disable-fractional],
214                                           [Don't use fractional representation])],
215             [bv_cv_fractional=$enableval], [bv_cv_fractional="yes"])
216 AC_ARG_ENABLE(modulo, [AS_HELP_STRING([--disable-modulo],
217                                       [Don't use fractional representation])],
218             [bv_cv_modulo=$enableval], [bv_cv_modulo="$bv_cv_fractional"])
219 AC_MSG_RESULT($bv_cv_modulo)
220 if test "x$bv_cv_modulo" != "xno" ; then
221         AC_DEFINE(USE_MODULO,[], [Use fractional representation])
224 AC_MSG_CHECKING(whether to use incremental algorithm)
225 AC_ARG_ENABLE(incremental,
226         [AS_HELP_STRING([--enable-incremental@<:@=bf|df@:>@],
227                         [Enable incremental algorithm [bf]])],
228         [bv_cv_incremental=$enableval], [bv_cv_incremental="no"])
229 AC_MSG_RESULT($bv_cv_incremental)
230 case $bv_cv_incremental in
231         yes | bf)
232                 AC_DEFINE(USE_INCREMENTAL_BF,[], 
233                           [Use breadth-first incremental algorithm])
234         ;;
235         df)
236                 AC_DEFINE(USE_INCREMENTAL_DF,[], 
237                           [Use depth-first incremental algorithm])
238         ;;
239 esac
241 AC_ARG_WITH(ntl,
242             [  --with-ntl=DIR          DIR Location of NTL],
243             [ echo "Package ntl : $withval" && ntl_package=$withval],  
244             [ ntl_package=yes ])
246 if test "$ntl_package" = "no"; then
247     AC_MSG_ERROR(Need ntl)
250 AC_SUBST(NTL_CPPFLAGS)
251 AC_SUBST(NTL_LDFLAGS)
252 if test "$ntl_package" != "yes"; then
253     NTL_CPPFLAGS="-I$ntl_package/include"
254     NTL_LDFLAGS="-L$ntl_package/lib"
257 SAVE_CPPFLAGS="$CPPFLAGS"
258 SAVE_LDFLAGS="$LDFLAGS"
259 CPPFLAGS="$NTL_CPPFLAGS $CPPFLAGS"
260 LDFLAGS="$NTL_LDFLAGS $LDFLAGS"
261 AC_EGREP_CPP(yes, [
262     #include <NTL/ZZ.h>
263     #ifdef NTL_GMP_LIP
264     yes
265     #endif
266     ],:,AC_MSG_ERROR(ntl not compiled with gmp support))
268 AC_CHECK_LIB(ntl, main,[],[
269     AC_MSG_ERROR(Need ntl)
271 CPPFLAGS="$SAVE_CPPFLAGS"
272 LDFLAGS="$SAVE_LDFLAGS"
274 AC_SUBST(bv_cone_hilbert_basis)
275 AC_MSG_CHECKING(whether to compile zsolve)
276 AC_ARG_WITH(bernstein,
277             [AS_HELP_STRING([--without-zsolve],[do not compile zsolve])],
278             [ with_zsolve=$withval],  [ with_zsolve=yes ])
279 AC_MSG_RESULT($with_zsolve)
281 use_zsolve=false
282 if test "$with_zsolve" != "no"; then
283         if test "$GCC" = "yes"; then
284                 $CC --version |
285                 sed -e 's/.* \(@<:@0-9@:>@@<:@0-9@:>@*\)\.\(@<:@0-9@:>@@<:@0-9@:>@*\).*/\1 \2/' |
286                 (read major minor
287                         if test $major -gt 3; then
288                                 exit 0
289                         fi
290                         if test $major -eq 3 -a $minor -ge 4; then
291                                 exit 0
292                         fi
293                         exit 1
294                 ) && use_zsolve=true
295         fi
296         if test "$use_zsolve" = false; then
297                 AC_MSG_WARN(gcc 3.4 required to compile zsolve)
298         else
299                 AC_DEFINE(USE_ZSOLVE,[],[use zsolve])
300                 bv_cone_hilbert_basis="cone_hilbert_basis\$(EXEEXT)"
301         fi
303 AM_CONDITIONAL(USE_ZSOLVE, test x$use_zsolve = xtrue)
305 AC_MSG_CHECKING(whether to compile bernstein)
306 AC_ARG_WITH(bernstein,
307             [AS_HELP_STRING([--without-bernstein],[do not compile bernstein])],
308             [ with_bernstein=$withval],  [ with_bernstein=yes ])
309 AC_MSG_RESULT($with_bernstein)
311 AC_ARG_WITH(ginac_prefix,
312         [AS_HELP_STRING([--with-ginac-prefix=DIR],[Installation prefix of GiNaC])])
313 if test "x$with_ginac_prefix" != "x"; then
314         export PKG_CONFIG_PATH="$with_ginac_prefix/lib/pkgconfig${PKG_CONFIG_PATH+:$PKG_CONFIG_PATH}"
317 AC_SUBST(bv_barvinok_bound)
318 have_ginac=false
319 if test "$with_bernstein" != "no"; then
320         PKG_CHECK_EXISTS([ginac], [
321                 PKG_CHECK_MODULES(ginac, ginac)
322                 have_ginac=true
323                 AC_DEFINE(HAVE_GINAC,[],[use GiNaC])
324                 EXTRA_PACKAGE_LIBS="-lbernstein $EXTRA_PACKAGE_LIBS"
325                 bv_barvinok_bound="barvinok_bound\$(EXEEXT) test_bound\$(EXEEXT)"
326         ])
328 AM_CONDITIONAL(HAVE_GINAC, test x$have_ginac = xtrue)
330 AX_SUBMODULE(omega,no|bundled|system,bundled)
332 AC_SUBST(OMEGA_CPPFLAGS)
333 AC_SUBST(OMEGA_LDFLAGS)
334 AC_SUBST(OMEGA_LIBS)
335 AC_SUBST(OMEGA_CODEGEN_LIBS)
336 AC_SUBST(bv_omega_programs)
337 have_omega=false
338 have_codegen=false
339 case "$with_omega" in
340 bundled)
341         have_omega=true
342         have_codegen=true
343         OMEGA_CPPFLAGS="-I\$(top_srcdir)/omega/omega_lib/include"
344         OMEGA_CPPFLAGS="$OMEGA_CPPFLAGS -I\$(top_srcdir)/omega/basic/include"
345         OMEGA_CPPFLAGS="$OMEGA_CPPFLAGS -I\$(top_srcdir)/omega/code_gen/include"
346         OMEGA_CPPFLAGS="$OMEGA_CPPFLAGS -I\$(top_srcdir)/omega/omega_calc/include"
347         ;;
348 system)
349     if test "x$omega_package" != "xyes"; then
350         OMEGA_CPPFLAGS="-I$omega_package/include/omega"
351         OMEGA_LDFLAGS="-L$omega_package/lib"
352     else
353         for i in /usr/include /usr/local/include; do
354             if test -f $i/omega/omega.h; then
355                 OMEGA_CPPFLAGS="-I$i/omega"
356             fi
357         done
358     fi
360     AC_LANG_PUSH(C++)
361     SAVE_CPPFLAGS="$CPPFLAGS"
362     SAVE_LDFLAGS="$LDFLAGS"
363     CPPFLAGS="$OMEGA_CPPFLAGS $CPPFLAGS"
364     LDFLAGS="$OMEGA_LDFLAGS $LDFLAGS"
365     AC_CHECK_HEADERS([omega.h],[
366         OMEGA_LIBS="-lomega"
367         AC_CHECK_LIB(code_gen,main,[
368                 OMEGA_CODEGEN_LIBS="-lcode_gen -lomega"
369                 have_codegen=true
370         ])
371         have_omega=true
372     ],[AC_MSG_WARN(Omega not found)])
373     CPPFLAGS="$SAVE_CPPFLAGS"
374     LDFLAGS="$SAVE_LDFLAGS"
375     AC_LANG_POP
376     ;;
377 esac
378 if test "$have_omega" = true; then
379         AC_DEFINE(HAVE_OMEGA,[],[use omega])
381 if test "$have_codegen" = true -a x$have_ginac = xtrue; then
382         AC_CHECK_HEADERS([sys/resource.h], [],
383                 [AC_DEFINE([OMIT_GETRUSAGE], [], [Don't use getrusage in occ])])
384         bv_omega_programs="occ\$(EXEEXT) $bv_omega_programs"
386 AM_CONDITIONAL(HAVE_OMEGA, test x$have_omega = xtrue)
387 AM_CONDITIONAL(BUNDLED_OMEGA, test $with_omega = bundled)
389 use_parker=false
390 AC_MSG_CHECKING(whether to compile parker)
391 AC_ARG_WITH(parker,
392             [AS_HELP_STRING([--without-zsolve],[do not compile zsolve])],
393             [ with_parker=$withval],  [ with_parker=yes ])
394 AC_MSG_RESULT($with_parker)
396 if test "$with_parker" != "no"; then
397         AC_MSG_CHECKING(for mona)
398         AC_ARG_WITH(mona,
399                 [AS_HELP_STRING([--with-mona=DIR],[mona *source* directory])],
400                                 [], [AC_MSG_RESULT(not specified)])
402         if test "x$with_mona" != "x"; then
403                 AC_SUBST(MONAPATH)
404                 MONAPATH=$with_mona
405                 AC_MSG_RESULT($MONAPATH)
406                 use_parker=true
407                 AC_DEFINE(USE_PARKER,[],[use parker])
408         fi
410         if test "x$with_mona" = "x"; then
411                 AC_MSG_WARN(mona source directory required to compile parker)
412                 AC_MSG_WARN(http://www.brics.dk/mona/download)
413         fi
415 AM_CONDITIONAL(USE_PARKER, test x$use_parker = xtrue)
417 AC_MSG_CHECKING(whether to use cddlib)
418 AC_ARG_WITH(cddlib, [AS_HELP_STRING([--with-cddlib=DIR],[DIR Location of cddlib])],
419             [ cddlib_package=$withval],  [ cddlib_package=yes ])
420 AC_MSG_RESULT($cddlib_package)
422 have_cddlib=false
423 if test "$cddlib_package" != "no"; then
424     if test "x$cddlib_package" != "xyes"; then
425         CPPFLAGS="-I$cddlib_package/include $CPPFLAGS"
426         LDFLAGS="-L$cddlib_package/lib $LDFLAGS"
427     fi
428     AC_TRY_LINK([
429 #define GMPRATIONAL
430 #include <setoper.h>
431 #include <cddmp.h>
432 ], [
433     mytype a;
434     dd_init(a); ], [
435         have_cddlib=true
436         AC_CHECK_LIB(cddgmp, main,[
437                 SAVE_LIBS="$LIBS"
438                 LIBS="-lcddgmp $LIBS"
439                 AC_DEFINE_UNQUOTED([SRCDIR], ["$srcdir"], [srcdir])
440                 AC_LANG_PUSH(C++)
441                 AC_RUN_IFELSE(AC_LANG_PROGRAM([[#define GMPRATIONAL
442 #include <setoper.h>
443 #include <cdd.h>]],
444                 [[
445         const char *filename = SRCDIR"/cdd94e-test";
446         FILE *f;
447         dd_MatrixPtr M;
448         dd_LPType *lp;
449         dd_ErrorType err = dd_NoError;
451         dd_set_global_constants();
453         f = fopen(filename, "r");
454         M = dd_PolyFile2Matrix(f, &err);
455         lp = dd_Matrix2LP(M, &err);
456         dd_LPSolve(lp, dd_DualSimplex, &err);
457         return lp->LPS == dd_Inconsistent;
458                 ]]),[
459                         AC_DEFINE(HAVE_LIBCDDGMP, [], [Define to 1 if you have the `cddgmp' library (-lcddgmp).])
460                 ],[
461                         AC_MSG_WARN(please upgrade cddlib to 0.94e or later)
462                         LIBS="$SAVE_LIBS"
463                         have_cddlib=false
464                 ])
465                 AC_LANG_POP
466         ],[have_cddlib=false])
467     ])
469 AM_CONDITIONAL(HAVE_CDDLIB, test x$have_cddlib = xtrue)
473 AC_MSG_CHECKING(whether to use GLPK)
474 AC_ARG_WITH(glpk, [AS_HELP_STRING([--with-glpk=DIR],[DIR Location of GLPK])],
475             [ glpk_package=$withval],  [ glpk_package=yes ])
476 AC_MSG_RESULT($glpk_package)
478 have_glpk=false
479 if test "$glpk_package" != "no"; then
480     if test "x$glpk_package" != "xyes"; then
481         CPPFLAGS="-I$glpk_package/include $CPPFLAGS"
482         LDFLAGS="-L$glpk_package/lib $LDFLAGS"
483     fi
484     AC_CHECK_HEADERS([glpk.h],[
485         have_glpk=true
486         AC_CHECK_LIB(glpk, main,[],[have_glpk=false])
487     ])
489 AM_CONDITIONAL(HAVE_GLPK, test x$have_glpk = xtrue)
491 AC_MSG_CHECKING(location of TOPCOM)
492 AC_ARG_WITH(topcom, [AS_HELP_STRING([--with-topcom=DIR],[Location of TOPCOM])],
493             [topcom_package=$withval], [topcom_package=unspecified])
494 AC_MSG_RESULT($topcom_package)
495 have_topcom=false
496 if test "$topcom_package" != no; then
497         topcom_path="$PATH"
498         if test "$topcom_package" != unspecified; then
499                 topcom_path="$topcom_package/bin"
500         fi
501         AC_PATH_PROG([POINTS2TRIANGS], [points2triangs], [], [$topcom_path])
502         if test -n "$POINTS2TRIANGS"; then
503                 have_topcom=true
504                 AC_DEFINE_UNQUOTED(POINTS2TRIANGS_PATH, ["$POINTS2TRIANGS"],
505                                     [Path of points2triangs])
506         fi
508 AM_CONDITIONAL(HAVE_TOPCOM, test x$have_topcom = xtrue)
510 AC_SUBST(GIT_HEAD_ID)
511 AC_SUBST(GIT_HEAD)
512 AC_SUBST(GIT_HEAD_VERSION)
513 if test -f $srcdir/.git/HEAD; then
514     GIT_HEAD="$srcdir/.git/index"
515     GIT_REPO="$srcdir/.git"
516     GIT_HEAD_ID=`GIT_DIR=$GIT_REPO git describe`
517 elif test -f $srcdir/GIT_HEAD_ID; then
518     GIT_HEAD_ID=`cat $srcdir/GIT_HEAD_ID`
519 else
520     mysrcdir=`(cd $srcdir; pwd)`
521     head=`basename $mysrcdir | sed -e 's/.*-//'`
522     head2=`echo $head | sed -e 's/[^0-9a-f]//'`
523     head3=`echo $head2 | sed -e 's/........................................//'`
524     base=`basename $mysrcdir | sed -e 's/-.*//'`
525     if test "x$head3" = "x" -a "x$head" = "x$head2"; then
526         GIT_HEAD_ID="barvinok-$VERSION-$head
527     elif test "x$base" = "xbarvinok-$VERSION" -a "x$head" != "x"; then
528         GIT_HEAD_ID="barvinok-$VERSION-$head
529     else
530         GIT_HEAD_ID="UNKNOWN"
531     fi
533 if test -z "$GIT_REPO" ; then
534     GIT_HEAD_VERSION="$GIT_HEAD_ID"
535 else
536     GIT_HEAD_VERSION="\`GIT_DIR=$GIT_REPO git describe\`"
538 echo '#define GIT_HEAD_ID "'$GIT_HEAD_ID'"' > version.h
540 AC_LANG_PUSH(C++)
541 AC_TRY_COMPILE([
542                 #include <set>
543                 void negate();
544         ], [negate()],
545         suffix="normal", suffix="broken")
546 AC_CONFIG_COMMANDS([barvinok/set.h],
547                    [cp $srcdir/barvinok/set.h.$suffix barvinok/set.h],
548                    [suffix="$suffix"])
549 AC_CONFIG_COMMANDS([barvinok/NTL.h],
550                    [cp $srcdir/barvinok/NTL.h.$suffix barvinok/NTL.h],
551                    [suffix="$suffix"])
552 use_fdstream=false
553 SAVE_CPPFLAGS="$CPPFLAGS"
554 CPPFLAGS="-I$srcdir $CPPFLAGS"
555 AC_TRY_COMPILE([#include "fdstream.h"],[],
556         [AC_DEFINE(USE_FDSTREAM,[],[use fdstream])
557         use_fdstream=true])
558 CPPFLAGS="$SAVE_CPPFLAGS"
559 AC_LANG_POP
560 AM_CONDITIONAL(USE_FDSTREAM, [test "$use_fdstream" = true])
562 PACKAGE_CFLAGS="$PACKAGE_CFLAGS_ISL"
563 PACKAGE_LIBS="-lbarvinok -lbarvinok-core $EXTRA_PACKAGE_LIBS -lisl-polylib -lpolylibgmp -lpiplibMP -lisl"
564 AX_CREATE_PKGCONFIG_INFO
566 AC_CONFIG_HEADERS(config.h)
567 AC_CONFIG_FILES(Makefile lib/Makefile zsolve/Makefile doc/Makefile)
568 AC_CONFIG_FILES(parker/Makefile)
569 if test $with_polylib = bundled; then
570         AC_CONFIG_SUBDIRS(polylib)
572 if test $with_piplib = bundled; then
573         AC_CONFIG_SUBDIRS(piplib)
575 if test $with_isl = bundled; then
576         AC_CONFIG_SUBDIRS(isl)
578 if test $with_isl_polylib = bundled; then
579         AC_CONFIG_SUBDIRS(isl-polylib)
581 if test x$have_ginac = xtrue; then
582     AC_CONFIG_SUBDIRS(bernstein)
584 if test $with_omega = bundled; then
585         AC_CONFIG_SUBDIRS(omega)
587 AC_CONFIG_COMMANDS_POST([
588         dnl pass on arguments to subdir configures, but don't
589         dnl add them to config.status
590         ac_configure_args="$ac_configure_args $bv_configure_args"
592 AC_OUTPUT