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