2 AC_CONFIG_MACRO_DIR([m4])
3 AM_INIT_AUTOMAKE(isl, 0.00)
9 AX_CREATE_STDINT_H(include/isl_stdint.h)
11 AC_ARG_WITH(gmp_prefix,
12 [AS_HELP_STRING([--with-gmp-prefix=DIR],
13 [Location of GMP installation])])
15 AC_SUBST(GMP_CPPFLAGS)
17 if test "x$with_gmp_prefix" != "x"; then
18 isl_configure_args="$isl_configure_args --with-gmp=$with_gmp_prefix"
19 GMP_CPPFLAGS="-I$with_gmp_prefix/include"
20 GMP_LDFLAGS="-L$with_gmp_prefix/lib"
22 SAVE_CPPFLAGS="$CPPFLAGS"
23 CPPFLAGS="$GMP_CPPFLAGS $CPPFLAGS"
24 need_get_memory_functions=false
25 AC_CHECK_DECLS(mp_get_memory_functions,[],[
26 need_get_memory_functions=true
28 CPPFLAGS="$SAVE_CPPFLAGS"
29 AM_CONDITIONAL(NEED_GET_MEMORY_FUNCTIONS, test x$need_get_memory_functions = xtrue)
31 AC_DEFUN([ISL_SUBMODULE],[
32 AC_ARG_WITH($1_prefix,
33 [AS_HELP_STRING([--with-$1-prefix=DIR],
34 [Location of system $1])])
35 AC_ARG_WITH($1_builddir,
36 [AS_HELP_STRING([--with-$1-builddir=DIR],
37 [Location of $1 builddir])])
38 if test "x$with_$1_prefix" != "x"; then
39 if test "x$with_$1" != "x" -a "x$with_$1" != "xsystem"; then
40 AC_MSG_ERROR([Setting $with_$1_prefix implies use of system $1])
44 if test "x$with_$1_builddir" != "x"; then
45 if test "x$with_$1" != "x" -a "x$with_$1" != "xbuild"; then
46 AC_MSG_ERROR([Setting $with_$1_builddir implies use of build $1])
49 $1_srcdir=`echo @abs_srcdir@ | $with_$1_builddir/config.status --file=-`
50 AC_MSG_NOTICE($1 sources in $$1_srcdir)
53 no|bundled|system|build)
56 if test -d $srcdir/.git -a \
58 ! -d $srcdir/$1/.git; then
60 [git repo detected, but submodule $1 not initialized])
61 AC_MSG_WARN([You may want to run])
62 AC_MSG_WARN([ git submodule init])
63 AC_MSG_WARN([ git submodule update])
64 AC_MSG_WARN([ sh autogen.sh])
66 if test -f $srcdir/$1/configure; then
74 [AS_HELP_STRING([--with-polylib=build|system|no],
75 [Which PolyLib to use])])
76 ISL_SUBMODULE(polylib)
77 if test "x$with_polylib" = "x"; then
80 AC_MSG_CHECKING([which polylib to use])
81 AC_MSG_RESULT($with_polylib)
84 AC_SUBST(POLYLIB_CPPFLAGS)
85 AC_SUBST(POLYLIB_LDFLAGS)
86 AC_SUBST(POLYLIB_LIBS)
87 case "$with_polylib" in
89 polylibs=`echo @polylibs@ | $with_polylib_builddir/config.status --file=-`
90 AC_MSG_NOTICE(Configured polylibs: $polylibs)
91 isl_cv_polylib=missing
92 for bits in $polylibs; do
93 if test "$bits" = "libpolylibgmp.la"; then
97 if test "$isl_cv_polylib" = "missing"; then
98 AC_MSG_ERROR(no gmp polylib configured)
100 POLYLIB_CPPFLAGS="-I$with_polylib_builddir/include -I$polylib_srcdir/include"
101 POLYLIB_LIBS="$with_polylib_builddir/libpolylibgmp.la"
104 POLYLIB_LIBS="-lpolylibgmp"
105 if test "x$with_polylib_prefix" != "x"; then
106 POLYLIB_CPPFLAGS="-I$with_polylib_prefix/include"
107 POLYLIB_LDFLAGS="-L$with_polylib_prefix/lib"
109 SAVE_CPPFLAGS="$CPPFLAGS"
110 SAVE_LDFLAGS="$LDFLAGS"
111 CPPFLAGS="$POLYLIB_CPPFLAGS $CPPFLAGS"
112 LDFLAGS="$POLYLIB_LDFLAGS $LDFLAGS"
113 AC_CHECK_LIB(polylibgmp, PolyhedronTSort,[ true ],[
114 AC_MSG_ERROR(Need polylib)
116 CPPFLAGS="$SAVE_CPPFLAGS"
117 LDFLAGS="$SAVE_LDFLAGS"
122 AC_MSG_ERROR(unsupported)
125 if test "$with_polylib" != "no"; then
126 AC_DEFINE(ISL_POLYLIB,,polylib is available)
129 AM_CONDITIONAL(HAVE_POLYLIB, test x$have_polylib = xtrue)
132 [AS_HELP_STRING([--with-piplib=build|bundled|system|no],
133 [Which piplib to use])])
134 ISL_SUBMODULE(piplib)
135 if test "x$with_piplib" = "x"; then
138 AC_MSG_CHECKING([which piplib to use])
139 AC_MSG_RESULT($with_piplib)
142 AC_SUBST(PIPLIB_CPPFLAGS)
143 AC_SUBST(PIPLIB_LDFLAGS)
144 AC_SUBST(PIPLIB_LIBS)
145 case "$with_piplib" in
147 PIPLIB_CPPFLAGS="-I$srcdir/piplib/include"
148 isl_configure_args="$isl_configure_args --with-bits=gmp"
151 PIPLIB_CPPFLAGS="-I$piplib_srcdir/include"
152 PIPLIB_LIBS="$with_piplib_builddir/libpiplibMP.la"
155 PIPLIB_LIBS="-lpiplibMP"
156 if test "x$with_piplib_prefix" != "x"; then
157 PIPLIB_CPPFLAGS="-I$with_piplib_prefix/include"
158 PIPLIB_LDFLAGS="-L$with_piplib_prefix/lib"
160 SAVE_CPPFLAGS="$CPPFLAGS"
161 SAVE_LDFLAGS="$LDFLAGS"
162 CPPFLAGS="$PIPLIB_CPPFLAGS $CPPFLAGS"
163 LDFLAGS="$PIPLIB_LDFLAGS $LDFLAGS"
164 AC_CHECK_LIB(piplibMP, pip_solve,[
165 AC_CHECK_MEMBER(PipOptions.Urs_parms, [], [
166 AC_MSG_ERROR([Piplib too old; please install version 1.3.6 or newer])
167 ],[#include <piplib/piplibMP.h>])
169 AC_MSG_ERROR([Piplib not found])
171 CPPFLAGS="$SAVE_CPPFLAGS"
172 LDFLAGS="$SAVE_LDFLAGS"
177 AC_MSG_ERROR(unsupported)
180 if test "$with_piplib" != "no"; then
181 AC_DEFINE(ISL_PIPLIB,,piplib is available)
184 AM_CONDITIONAL(HAVE_PIPLIB, test x$have_piplib = xtrue)
185 AM_CONDITIONAL(BUNDLED_PIPLIB, test $with_piplib = bundled)
187 AC_CONFIG_HEADERS(config.h)
188 AC_CONFIG_HEADERS(include/isl_ctx.h)
189 AC_CONFIG_FILES(Makefile)
190 if test $with_piplib = bundled; then
191 AC_CONFIG_SUBDIRS(piplib)
193 AC_CONFIG_COMMANDS_POST([
194 dnl pass on arguments to subdir configures, but don't
195 ac_configure_args="$ac_configure_args $isl_configure_args"
196 ac_configure_args="$ac_configure_args $isl_configure_args"