1 AC_INIT([isl], [0.09], [isl-development@googlegroups.com])
3 AC_CONFIG_MACRO_DIR([m4])
4 AM_INIT_AUTOMAKE([foreign])
5 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
13 AX_GCC_WARN_UNUSED_RESULT
18 AC_CHECK_PROG(PERL, perl, perl, [])
19 AC_CHECK_PROG(PDFLATEX, pdflatex, pdflatex, [])
20 AC_CHECK_PROG(POD2HTML, pod2html, pod2html, [])
22 AM_CONDITIONAL(GENERATE_DOC, test -n "$PERL" -a -n "$PDFLATEX" -a -n "$POD2HTML")
24 AX_CREATE_STDINT_H(include/isl/stdint.h)
26 AX_SUBMODULE(gmp,system|build,system)
28 AC_SUBST(GMP_CPPFLAGS)
33 if test "x$with_gmp_prefix" != "x"; then
34 isl_configure_args="$isl_configure_args --with-gmp=$with_gmp_prefix"
35 GMP_CPPFLAGS="-I$with_gmp_prefix/include"
36 GMP_LDFLAGS="-L$with_gmp_prefix/lib"
41 GMP_CPPFLAGS="-I$gmp_srcdir -I$with_gmp_builddir"
42 GMP_LIBS="$with_gmp_builddir/libgmp.la"
45 SAVE_CPPFLAGS="$CPPFLAGS"
46 CPPFLAGS="$GMP_CPPFLAGS $CPPFLAGS"
47 need_get_memory_functions=false
48 AC_CHECK_DECLS(mp_get_memory_functions,[],[
49 need_get_memory_functions=true
51 CPPFLAGS="$SAVE_CPPFLAGS"
52 AM_CONDITIONAL(NEED_GET_MEMORY_FUNCTIONS, test x$need_get_memory_functions = xtrue)
54 AX_SUBMODULE(piplib,no|system|build,no)
57 AC_SUBST(PIPLIB_CPPFLAGS)
58 AC_SUBST(PIPLIB_LDFLAGS)
60 case "$with_piplib" in
62 PIPLIB_CPPFLAGS="-I$piplib_srcdir/include"
63 PIPLIB_LIBS="$with_piplib_builddir/libpiplibMP.la"
66 PIPLIB_LIBS="-lpiplibMP"
67 if test "x$with_piplib_prefix" != "x"; then
68 PIPLIB_CPPFLAGS="-I$with_piplib_prefix/include"
69 PIPLIB_LDFLAGS="-L$with_piplib_prefix/lib"
71 SAVE_CPPFLAGS="$CPPFLAGS"
72 SAVE_LDFLAGS="$LDFLAGS"
73 CPPFLAGS="$PIPLIB_CPPFLAGS $CPPFLAGS"
74 LDFLAGS="$PIPLIB_LDFLAGS $LDFLAGS"
75 AC_CHECK_LIB(piplibMP, pip_solve,[
76 AC_CHECK_MEMBER(PipOptions.Urs_parms, [], [
77 AC_MSG_ERROR([Piplib too old; please install version 1.3.6 or newer])
78 ],[#include <piplib/piplibMP.h>])
80 AC_MSG_ERROR([Piplib not found])
82 CPPFLAGS="$SAVE_CPPFLAGS"
83 LDFLAGS="$SAVE_LDFLAGS"
88 AC_MSG_ERROR(unsupported)
91 if test "$with_piplib" != "no"; then
92 AC_DEFINE(ISL_PIPLIB,,piplib is available)
95 AM_CONDITIONAL(HAVE_PIPLIB, test x$have_piplib = xtrue)
97 AC_SUBST(CLANG_CXXFLAGS)
98 AC_SUBST(CLANG_LDFLAGS)
100 AX_SUBMODULE(clang,system|no,no)
101 case "$with_clang" in
103 llvm_config="llvm-config"
104 AC_CHECK_PROG([llvm_config_found], ["$llvm_config"], [yes])
105 if test "x$with_clang_prefix" != "x"; then
106 llvm_config="$with_clang_prefix/bin/llvm-config"
107 if test -x "$llvm_config"; then
108 llvm_config_found=yes
111 if test "$llvm_config_found" != yes; then
112 AC_MSG_ERROR([llvm-config not found])
114 CLANG_CXXFLAGS=`$llvm_config --cxxflags`
115 CLANG_LDFLAGS=`$llvm_config --ldflags`
116 CLANG_LIBS=`$llvm_config --libs analysis`
117 CLANG_PREFIX=`$llvm_config --prefix`
118 AC_DEFINE_UNQUOTED(CLANG_PREFIX, ["$CLANG_PREFIX"],
119 [Clang installation prefix])
121 SAVE_CPPFLAGS="$CPPFLAGS"
122 CPPFLAGS="$CLANG_CXXFLAGS $CPPFLAGS"
124 AC_CHECK_HEADER([clang/Basic/SourceLocation.h], [],
125 [AC_ERROR([clang header file not found])])
126 AC_EGREP_HEADER([getDefaultTargetTriple], [llvm/Support/Host.h], [],
127 [AC_DEFINE([getDefaultTargetTriple], [getHostTriple],
128 [Define to getHostTriple for older versions of clang])])
129 AC_EGREP_HEADER([getExpansionLineNumber],
130 [clang/Basic/SourceLocation.h], [],
131 [AC_DEFINE([getExpansionLineNumber],
132 [getInstantiationLineNumber],
133 [Define to getInstantiationLineNumber for older versions of clang])])
134 AC_EGREP_HEADER([DiagnosticsEngine],
135 [clang/Basic/Diagnostic.h], [],
136 [AC_DEFINE([DiagnosticsEngine],
138 [Define to Diagnostic for older versions of clang])])
139 AC_EGREP_HEADER([ArrayRef], [clang/Driver/Driver.h],
140 [AC_DEFINE([USE_ARRAYREF], [],
141 [Define if Driver::BuildCompilation takes ArrayRef])])
142 AC_EGREP_HEADER([CXXIsProduction], [clang/Driver/Driver.h],
143 [AC_DEFINE([HAVE_CXXISPRODUCTION], [],
144 [Define if Driver constructor takes CXXIsProduction argument])])
146 CPPFLAGS="$SAVE_CPPFLAGS"
149 AM_CONDITIONAL(HAVE_CLANG, test $with_clang = system)
153 AC_SUBST(WARNING_FLAGS)
155 PACKAGE_CFLAGS="$GMP_CPPFLAGS"
156 PACKAGE_LDFLAGS="$GMP_LDFLAGS"
157 PACKAGE_LIBS="-lisl -lgmp"
158 AX_CREATE_PKGCONFIG_INFO
161 echo '#define GIT_HEAD_ID "'$GIT_HEAD_ID'"' > gitversion.h
163 AH_BOTTOM([#include <isl_config_post.h>])
164 AC_CONFIG_HEADERS(isl_config.h)
165 AC_CONFIG_HEADERS(include/isl/config.h)
166 AC_CONFIG_FILES(Makefile)
167 AC_CONFIG_FILES(doc/Makefile)
168 if test $with_clang = system; then
169 AC_CONFIG_FILES(interface/Makefile)
171 AC_CONFIG_FILES([bound_test.sh], [chmod +x bound_test.sh])
172 AC_CONFIG_FILES([pip_test.sh], [chmod +x pip_test.sh])
173 AC_CONFIG_COMMANDS_POST([
174 dnl pass on arguments to subdir configures, but don't
175 dnl add them to config.status
176 ac_configure_args="$ac_configure_args $isl_configure_args"