1 AC_INIT([isl], [0.11.2], [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])])
9 if test "x$prefix" != "xNONE"; then
10 prefix_wd=`cd $prefix && pwd`
11 srcdir_wd=`cd $srcdir && pwd`
13 if test "x$prefix_wd" = "x$srcdir_wd"; then
14 AC_MSG_ERROR(Installation in source directory not supported)
16 if test "x$prefix_wd" = "x$wd"; then
17 AC_MSG_ERROR(Installation in build directory not supported)
25 AX_GCC_WARN_UNUSED_RESULT
30 AC_CHECK_PROG(PERL, perl, perl, [])
31 AC_CHECK_PROG(PDFLATEX, pdflatex, pdflatex, [])
32 AC_CHECK_PROG(POD2HTML, pod2html, pod2html, [])
34 AM_CONDITIONAL(GENERATE_DOC, test -n "$PERL" -a -n "$PDFLATEX" -a -n "$POD2HTML")
36 AX_CREATE_STDINT_H(include/isl/stdint.h)
38 AX_SUBMODULE(gmp,system|build,system)
40 AC_SUBST(GMP_CPPFLAGS)
45 if test "x$with_gmp_prefix" != "x"; then
46 isl_configure_args="$isl_configure_args --with-gmp=$with_gmp_prefix"
47 GMP_CPPFLAGS="-I$with_gmp_prefix/include"
48 GMP_LDFLAGS="-L$with_gmp_prefix/lib"
53 GMP_CPPFLAGS="-I$gmp_srcdir -I$with_gmp_builddir"
54 GMP_LIBS="$with_gmp_builddir/libgmp.la"
57 SAVE_CPPFLAGS="$CPPFLAGS"
58 CPPFLAGS="$GMP_CPPFLAGS $CPPFLAGS"
59 need_get_memory_functions=false
60 AC_CHECK_DECLS(mp_get_memory_functions,[],[
61 need_get_memory_functions=true
63 CPPFLAGS="$SAVE_CPPFLAGS"
64 AM_CONDITIONAL(NEED_GET_MEMORY_FUNCTIONS, test x$need_get_memory_functions = xtrue)
66 AX_SUBMODULE(piplib,no|system|build,no)
69 AC_SUBST(PIPLIB_CPPFLAGS)
70 AC_SUBST(PIPLIB_LDFLAGS)
72 case "$with_piplib" in
74 PIPLIB_CPPFLAGS="-I$piplib_srcdir/include"
75 PIPLIB_LIBS="$with_piplib_builddir/libpiplibMP.la"
78 PIPLIB_LIBS="-lpiplibMP"
79 if test "x$with_piplib_prefix" != "x"; then
80 PIPLIB_CPPFLAGS="-I$with_piplib_prefix/include"
81 PIPLIB_LDFLAGS="-L$with_piplib_prefix/lib"
83 SAVE_CPPFLAGS="$CPPFLAGS"
84 SAVE_LDFLAGS="$LDFLAGS"
85 CPPFLAGS="$PIPLIB_CPPFLAGS $CPPFLAGS"
86 LDFLAGS="$PIPLIB_LDFLAGS $LDFLAGS"
87 AC_CHECK_LIB(piplibMP, pip_solve,[
88 AC_CHECK_MEMBER(PipOptions.Urs_parms, [], [
89 AC_MSG_ERROR([Piplib too old; please install version 1.3.6 or newer])
90 ],[#include <piplib/piplibMP.h>])
92 AC_MSG_ERROR([Piplib not found])
94 CPPFLAGS="$SAVE_CPPFLAGS"
95 LDFLAGS="$SAVE_LDFLAGS"
100 AC_MSG_ERROR(unsupported)
103 if test "$with_piplib" != "no"; then
104 AC_DEFINE(ISL_PIPLIB,,piplib is available)
107 AM_CONDITIONAL(HAVE_PIPLIB, test x$have_piplib = xtrue)
109 AC_SUBST(CLANG_CXXFLAGS)
110 AC_SUBST(CLANG_LDFLAGS)
112 AX_SUBMODULE(clang,system|no,no)
113 case "$with_clang" in
115 llvm_config="llvm-config"
116 AC_CHECK_PROG([llvm_config_found], ["$llvm_config"], [yes])
117 if test "x$with_clang_prefix" != "x"; then
118 llvm_config="$with_clang_prefix/bin/llvm-config"
119 if test -x "$llvm_config"; then
120 llvm_config_found=yes
123 if test "$llvm_config_found" != yes; then
124 AC_MSG_ERROR([llvm-config not found])
126 CLANG_CXXFLAGS=`$llvm_config --cxxflags`
127 CLANG_LDFLAGS=`$llvm_config --ldflags`
128 targets=`$llvm_config --targets-built`
129 CLANG_LIBS=`$llvm_config --libs $targets asmparser bitreader support mc`
130 CLANG_PREFIX=`$llvm_config --prefix`
131 AC_DEFINE_UNQUOTED(CLANG_PREFIX, ["$CLANG_PREFIX"],
132 [Clang installation prefix])
134 SAVE_CPPFLAGS="$CPPFLAGS"
135 CPPFLAGS="$CLANG_CXXFLAGS $CPPFLAGS"
137 AC_CHECK_HEADER([clang/Basic/SourceLocation.h], [],
138 [AC_ERROR([clang header file not found])])
139 AC_EGREP_HEADER([getDefaultTargetTriple], [llvm/Support/Host.h], [],
140 [AC_DEFINE([getDefaultTargetTriple], [getHostTriple],
141 [Define to getHostTriple for older versions of clang])])
142 AC_EGREP_HEADER([getExpansionLineNumber],
143 [clang/Basic/SourceLocation.h], [],
144 [AC_DEFINE([getExpansionLineNumber],
145 [getInstantiationLineNumber],
146 [Define to getInstantiationLineNumber for older versions of clang])])
147 AC_EGREP_HEADER([DiagnosticsEngine],
148 [clang/Basic/Diagnostic.h], [],
149 [AC_DEFINE([DiagnosticsEngine],
151 [Define to Diagnostic for older versions of clang])])
152 AC_EGREP_HEADER([ArrayRef], [clang/Driver/Driver.h],
153 [AC_DEFINE([USE_ARRAYREF], [],
154 [Define if Driver::BuildCompilation takes ArrayRef])])
155 AC_EGREP_HEADER([CXXIsProduction], [clang/Driver/Driver.h],
156 [AC_DEFINE([HAVE_CXXISPRODUCTION], [],
157 [Define if Driver constructor takes CXXIsProduction argument])])
158 AC_EGREP_HEADER([ IsProduction], [clang/Driver/Driver.h],
159 [AC_DEFINE([HAVE_ISPRODUCTION], [],
160 [Define if Driver constructor takes IsProduction argument])])
161 AC_EGREP_HEADER([void HandleTopLevelDecl\(], [clang/AST/ASTConsumer.h],
162 [AC_DEFINE([HandleTopLevelDeclReturn], [void],
163 [Return type of HandleTopLevelDeclReturn])
164 AC_DEFINE([HandleTopLevelDeclContinue], [],
165 [Return type of HandleTopLevelDeclReturn])],
166 [AC_DEFINE([HandleTopLevelDeclReturn], [bool],
167 [Return type of HandleTopLevelDeclReturn])
168 AC_DEFINE([HandleTopLevelDeclContinue], [true],
169 [Return type of HandleTopLevelDeclReturn])])
170 AC_CHECK_HEADER([clang/Basic/DiagnosticOptions.h],
171 [AC_DEFINE([HAVE_BASIC_DIAGNOSTICOPTIONS_H], [],
172 [Define if clang/Basic/DiagnosticOptions.h exists])])
173 AC_TRY_COMPILE([#include <clang/Basic/TargetInfo.h>], [
174 using namespace clang;
176 DiagnosticsEngine *Diags;
177 TargetInfo::CreateTargetInfo(*Diags, TO);
178 ], [AC_DEFINE([CREATETARGETINFO_TAKES_POINTER], [],
179 [Define if TargetInfo::CreateTargetInfo takes pointer])])
180 AC_TRY_COMPILE([#include <clang/Frontend/CompilerInstance.h>], [
181 using namespace clang;
182 DiagnosticConsumer *client;
183 CompilerInstance *Clang;
184 Clang->createDiagnostics(client);
185 ], [], [AC_DEFINE([CREATEDIAGNOSTICS_TAKES_ARG], [],
186 [Define if CompilerInstance::createDiagnostics takes argc and argv])])
187 AC_TRY_COMPILE([#include <clang/Lex/HeaderSearchOptions.h>], [
188 using namespace clang;
189 HeaderSearchOptions HSO;
190 HSO.AddPath("", frontend::Angled, false, false);
191 ], [AC_DEFINE([ADDPATH_TAKES_4_ARGUMENTS], [],
192 [Define if HeaderSearchOptions::AddPath takes 4 arguments])])
194 CPPFLAGS="$SAVE_CPPFLAGS"
196 SAVE_LDFLAGS="$LDFLAGS"
197 LDFLAGS="$CLANG_LDFLAGS $LDFLAGS"
198 AC_SUBST(LIB_CLANG_EDIT)
199 AC_CHECK_LIB([clangEdit], [main], [LIB_CLANG_EDIT=-lclangEdit], [])
200 LDFLAGS="$SAVE_LDFLAGS"
203 AM_CONDITIONAL(HAVE_CLANG, test $with_clang = system)
207 AC_SUBST(WARNING_FLAGS)
209 PACKAGE_CFLAGS="$GMP_CPPFLAGS"
210 PACKAGE_LDFLAGS="$GMP_LDFLAGS"
211 PACKAGE_LIBS="-lisl -lgmp"
212 AX_CREATE_PKGCONFIG_INFO
215 echo '#define GIT_HEAD_ID "'$GIT_HEAD_ID'"' > gitversion.h
217 AH_BOTTOM([#include <isl_config_post.h>])
218 AC_CONFIG_HEADERS(isl_config.h)
219 AC_CONFIG_HEADERS(include/isl/config.h)
220 AC_CONFIG_FILES(Makefile)
221 AC_CONFIG_FILES(doc/Makefile)
222 if test $with_clang = system; then
223 AC_CONFIG_FILES(interface/Makefile)
225 AC_CONFIG_FILES([bound_test.sh], [chmod +x bound_test.sh])
226 AC_CONFIG_FILES([codegen_test.sh], [chmod +x codegen_test.sh])
227 AC_CONFIG_FILES([pip_test.sh], [chmod +x pip_test.sh])
228 AC_CONFIG_COMMANDS_POST([
229 dnl pass on arguments to subdir configures, but don't
230 dnl add them to config.status
231 ac_configure_args="$ac_configure_args $isl_configure_args"