bump version
[barvinok.git] / configure.in
blob0db1bf6b2822f0848c3ad5fe65073a8b34116e9e
1 AC_INIT
2 AM_INIT_AUTOMAKE(barvinok, 0.15)
3 AC_PROG_LIBTOOL
4 AC_PROG_CXX
5 AC_SUBST(versioninfo)
6 versioninfo=8:0:4
8 AC_CHECK_HEADERS(getopt.h)
10 dnl Check for GMP library
11 AC_MSG_CHECKING(whether to use GMP)
12 AC_ARG_WITH(libgmp, 
13         [  --with-libgmp           DIR Location of the GMP Distribution], 
14         gmp_package=$withval, gmp_package=yes)
15 if test "x$gmp_package" = "xno"; then
16         AC_MSG_RESULT(no)
17         AC_MSG_ERROR(Need gmp)
18 else
19         AC_MSG_RESULT(yes)
20         if test "x$gmp_package" != "xyes"; then
21             GMP_DIR=$gmp_package
22             if test ! -d "$GMP_DIR"; then
23                 AC_ERROR(Directory given for GMP Distribution is not a directory)
24             fi
25             CPPFLAGS="-I$GMP_DIR/include $CPPFLAGS"
26             LDFLAGS="-L$GMP_DIR/lib $LDFLAGS"
27         fi
28         poly_cv_gmpfatal="no"
29         AC_CHECK_HEADER(gmp.h,
30                 [AC_CHECK_LIB(gmp,main,
31                     [],
32                     [poly_cv_gmpfatal="yes"])],
33                 [poly_cv_gmpfatal="yes"])
34         if test "$poly_cv_gmpfatal" = "yes"; then
35                 AC_MSG_ERROR([GMP not found])
36         fi
38 AC_CHECK_DECL(mpz_divisible_p,[],[AC_LIBOBJ(mpz_divisible_p)],[#include <gmp.h>])
40 AC_ARG_WITH(polylib,
41             [  --with-polylib=DIR      DIR Location of PolyLib],
42             [ echo "Package polylib : $withval" && polylib_package=$withval],  
43             [ polylib_package=yes ])
45 if test "$polylib_package" = "no"; then
46     AC_MSG_ERROR(Need polylib)
49 if test "$polylib_package" != "yes"; then
50     CPPFLAGS="-I$polylib_package/include $CPPFLAGS"
51     LDFLAGS="-L$polylib_package/lib $LDFLAGS"
52     LD_LIBRARY_PATH="$polylib_package/lib:$LD_LIBRARY_PATH"
53     export LD_LIBRARY_PATH
56 AC_CHECK_LIB(polylibgmp, PolyhedronTSort,[],[
57     AC_MSG_ERROR(Need polylib)
59 AC_REPLACE_FUNCS(Enumeration_Free reduce_evalue)
60 AC_TRY_RUN([
61 #include <polylib/polylibgmp.h>
63 int main()
65     int i, j;
66     Polyhedron *P;
67     Matrix *M = Matrix_Alloc(6,5);
68     for (i = 0; i < 6; ++i) {
69         value_set_si(M->p[i][0], 1);
70         for (j = 1; j < 4; ++j)
71             value_set_si(M->p[i][j], (j-1 == i/2) * (1-2*(i%2)));
72         value_set_si(M->p[i][4], i%2);
73     }
74     P = Constraints2Polyhedron(M, 6);
75     return !(P->NbRays == 8);
78 [AC_DEFINE(HAVE_GROWING_CHERNIKOVA,[],
79           [PolyLib automatically grows the Chernikova table space])],
80 AC_MSG_WARN([This version of PolyLib does not automatically])
81 AC_MSG_WARN([enlarge the Chernikova table space]))
83 AC_TRY_RUN([
84 #include <polylib/polylibgmp.h>
86 int main()
88     enode *en = new_enode(polynomial, 1, 1);
89     return !(en->arr[0].x.p == NULL);
91 ],,
92 AC_MSG_WARN([This version of polylib leaks]))
94 AC_TRY_RUN([
95 #include <stdio.h>
96 #include <polylib/polylibgmp.h>
98 int main()
100     Matrix *M;
101     Polyhedron *P, *C;
102     Param_Polyhedron *PP;
103     int i;
104     Param_Vertices *V;
106     freopen("$srcdir/tests/ehrhart/t12.in", "r", stdin);
107     M = Matrix_Read();
108     P = Constraints2Polyhedron(M, 1024);
109     M = Matrix_Read();
110     C = Constraints2Polyhedron(M, 1024);
111     PP = Polyhedron2Param_SimplifiedDomain(&P, C, 1024, NULL, NULL);
112     for (i = 0, V = PP->V; V; ++i, V = V->next)
113         ;
114     return !(i == 10);
117 AC_MSG_WARN([This version of polylib produces incorrect vertices.]))
119 AC_MSG_CHECKING([number of arguments of Polyhedron_Enumerate])
120 AC_TRY_COMPILE([#include <polylib/polylibgmp.h>], 
121                [Polyhedron_Enumerate(NULL,NULL,0,NULL)],
122                [AC_MSG_RESULT(4)
123                 AC_DEFINE(HAVE_ENUMERATE4,[],
124                           [Polyhedron_Enumerate takes four arguments])],
125                [AC_MSG_RESULT(3)])
127 AC_MSG_CHECKING([number of arguments of count_points])
128 AC_TRY_COMPILE([#include <polylib/polylibgmp.h>], 
129                [count_points(0,NULL,NULL,NULL)],
130                [AC_MSG_RESULT(4)
131                 AC_DEFINE(HAVE_COUNT_POINTS4,[],
132                           [count_points takes four arguments])],
133                [AC_MSG_RESULT(3)])
135 AC_ARG_WITH(piplib,
136             [  --with-piplib=DIR       DIR Location of PolyLib],
137             [ echo "Package piplib : $withval" && piplib_package=$withval],  
138             [ piplib_package=yes ])
140 AC_SUBST(bv_extra_programs)
141 if test "$piplib_package" != "no"; then
142     if test "$piplib_package" != "yes"; then
143         CPPFLAGS="-I$piplib_package/include $CPPFLAGS"
144         LDFLAGS="-L$piplib_package/lib $LDFLAGS"
145     fi
147     AC_CHECK_LIB(piplibMP, pip_solve,[
148         AC_DEFINE(HAVE_PIPLIB,[],[use piplib])
149         LIBS="-lpiplibMP $LIBS"
150         AC_LIBOBJ(piputil)
151         bv_extra_programs="piptest $bv_extra_programs"
152     ],[
153         AC_MSG_WARN([Piplib not found])
154     ])
158 AC_MSG_CHECKING(if --enable-fractional option specified)
159 AC_ARG_ENABLE(fractional,
160             [  --enable-fractional     Use fractional representation],
161             [bv_cv_fractional=$enableval], [bv_cv_fractional="no"])
162 AC_MSG_RESULT($bv_cv_fractional)
163 AC_MSG_CHECKING(if --enable-modulo option specified)
164 AC_ARG_ENABLE(modulo,
165             [  --enable-modulo         Use fractional representation],
166             [bv_cv_modulo=$enableval], [bv_cv_modulo="no"])
167 AC_MSG_RESULT($bv_cv_modulo)
168 if test "x$bv_cv_modulo" != "xno" -o "x$bv_cv_fractional" != "xno"; then
169         AC_DEFINE(USE_MODULO,[], [Use fractional representation])
172 AC_MSG_CHECKING(whether to use incremental algorithm)
173 AC_ARG_ENABLE(incremental,
174             [  --disable-incremental   Disable incremental algorithm],
175             [bv_cv_incremental=$enableval], [bv_cv_incremental="yes"])
176 AC_MSG_RESULT($bv_cv_incremental)
177 if test "x$bv_cv_incremental" = "xyes"; then
178         AC_DEFINE(USE_INCREMENTAL,[], [Use incremental algorithm])
181 AC_ARG_WITH(ntl,
182             [  --with-ntl=DIR          DIR Location of NTL],
183             [ echo "Package ntl : $withval" && ntl_package=$withval],  
184             [ ntl_package=yes ])
186 if test "$ntl_package" = "no"; then
187     AC_MSG_ERROR(Need ntl)
190 if test "$ntl_package" != "yes"; then
191     CPPFLAGS="-I$ntl_package/include $CPPFLAGS"
192     LDFLAGS="-L$ntl_package/lib $LDFLAGS"
195 AC_CHECK_LIB(ntl, main,[],[
196     AC_MSG_ERROR(Need ntl)
199 AC_CONFIG_HEADERS(config.h)
200 AC_OUTPUT(Makefile)