Initial implementation of barvinok_enumerate_e.
[barvinok.git] / configure.in
blob5b4bc29b817fec43bd2d3f4842a95f4bc9870470
1 AC_INIT
2 AM_INIT_AUTOMAKE(barvinok, 0.07)
3 AC_PROG_LIBTOOL
4 AC_PROG_CXX
5 AC_SUBST(versioninfo)
6 versioninfo=3:2:1
8 dnl Check for GMP library
9 AC_MSG_CHECKING(whether to use GMP)
10 AC_ARG_WITH(libgmp, 
11         [  --with-libgmp           DIR Location of the GMP Distribution], 
12         gmp_package=$withval, gmp_package=yes)
13 if test "x$gmp_package" = "xno"; then
14         AC_MSG_RESULT(no)
15         AC_MSG_ERROR(Need gmp)
16 else
17         AC_MSG_RESULT(yes)
18         if test "x$gmp_package" != "xyes"; then
19             GMP_DIR=$gmp_package
20             if test ! -d "$GMP_DIR"; then
21                 AC_ERROR(Directory given for GMP Distribution is not a directory)
22             fi
23             CPPFLAGS="-I$GMP_DIR/include $CPPFLAGS"
24             LDFLAGS="-L$GMP_DIR/lib $LDFLAGS"
25         fi
26         poly_cv_gmpfatal="no"
27         AC_CHECK_HEADER(gmp.h,
28                 [AC_CHECK_LIB(gmp,main,
29                     [],
30                     [poly_cv_gmpfatal="yes"])],
31                 [poly_cv_gmpfatal="yes"])
32         if test "$poly_cv_gmpfatal" = "yes"; then
33                 AC_MSG_ERROR([GMP not found])
34         fi
37 AC_ARG_WITH(polylib,
38             [  --with-polylib=DIR      DIR Location of PolyLib],
39             [ echo "Package polylib : $withval" && polylib_package=$withval],  
40             [ polylib_package=yes ])
42 if test "$polylib_package" = "no"; then
43     AC_MSG_ERROR(Need polylib)
46 if test "$polylib_package" != "yes"; then
47     CPPFLAGS="-I$polylib_package/include $CPPFLAGS"
48     LDFLAGS="-L$polylib_package/lib $LDFLAGS"
49     LD_LIBRARY_PATH="$polylib_package/lib:$LD_LIBRARY_PATH"
50     export LD_LIBRARY_PATH
53 AC_CHECK_LIB(polylibgmp, PolyhedronTSort,[],[
54     AC_MSG_ERROR(Need polylib)
56 AC_REPLACE_FUNCS(Enumeration_Free reduce_evalue)
57 AC_TRY_RUN([
58 #include <polylib/polylibgmp.h>
60 int main()
62     int i, j;
63     Polyhedron *P;
64     Matrix *M = Matrix_Alloc(6,5);
65     for (i = 0; i < 6; ++i) {
66         value_set_si(M->p[i][0], 1);
67         for (j = 1; j < 4; ++j)
68             value_set_si(M->p[i][j], (j-1 == i/2) * (1-2*(i%2)));
69         value_set_si(M->p[i][4], i%2);
70     }
71     P = Constraints2Polyhedron(M, 6);
72     return !(P->NbRays == 8);
74 ],,
75 AC_MSG_WARN([This version of polylib does not automatically])
76 AC_MSG_WARN([enlarge the chernikova table space]))
78 AC_TRY_RUN([
79 #include <polylib/polylibgmp.h>
81 int main()
83     enode *en = new_enode(polynomial, 1, 1);
84     return !(en->arr[0].x.p == NULL);
86 ],,
87 AC_MSG_WARN([This version of polylib leaks]))
89 AC_MSG_CHECKING([number of arguments of Polyhedron_Enumerate])
90 AC_TRY_COMPILE([#include <polylib/polylibgmp.h>], 
91                [Polyhedron_Enumerate(NULL,NULL,0,NULL)],
92                [AC_MSG_RESULT(4)
93                 AC_DEFINE(HAVE_ENUMERATE4,[],
94                           [Polyhedron_Enumerate takes four arguments])],
95                [AC_MSG_RESULT(3)])
97 AC_MSG_CHECKING([number of arguments of count_points])
98 AC_TRY_COMPILE([#include <polylib/polylibgmp.h>], 
99                [count_points(0,NULL,NULL,NULL)],
100                [AC_MSG_RESULT(4)
101                 AC_DEFINE(HAVE_COUNT_POINTS4,[],
102                           [count_points takes four arguments])],
103                [AC_MSG_RESULT(3)])
105 AC_MSG_CHECKING(if --enable-modulo option specified)
106 AC_ARG_ENABLE(modulo,
107             [  --enable-modulo         Use modulo representation],
108             [bv_cv_modulo=$enableval], [bv_cv_modulo="no"])
109 AC_MSG_RESULT($bv_cv_modulo)
110 if test "x$bv_cv_modulo" != "xno"; then
111         AC_MSG_WARN(This is not fully supported yet)
112         AC_DEFINE(USE_MODULO,[], [Use modulo representation])
115 AC_ARG_WITH(ntl,
116             [  --with-ntl=DIR          DIR Location of NTL],
117             [ echo "Package tnl : $withval" && ntl_package=$withval],  
118             [ ntl_package=yes ])
120 if test "$ntl_package" = "no"; then
121     AC_MSG_ERROR(Need ntl)
124 if test "$ntl_package" != "yes"; then
125     CPPFLAGS="-I$ntl_package/include $CPPFLAGS"
126     LDFLAGS="-L$ntl_package/lib $LDFLAGS"
129 AC_CHECK_LIB(ntl, main,[],[
130     AC_MSG_ERROR(Need ntl)
133 AC_CONFIG_HEADERS(config.h)
134 AC_OUTPUT(Makefile)