isl_output.c: print_set_c: handle NULL input
[isl.git] / configure.ac
blob504b207df8ba42c96b33e57ac7f75d806194082a
1 AC_INIT([isl], [0.10], [isl-development@googlegroups.com])
2 AC_CONFIG_AUX_DIR([.])
3 AC_CONFIG_MACRO_DIR([m4])
4 AM_INIT_AUTOMAKE([foreign])
5 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
6 AC_SUBST(versioninfo)
7 versioninfo=10:0:0
9 if test "x$prefix" != "xNONE"; then
10         prefix_wd=`cd $prefix && pwd`
11         srcdir_wd=`cd $srcdir && pwd`
12         wd=`pwd`
13         if test "x$prefix_wd" = "x$srcdir_wd"; then
14                 AC_MSG_ERROR(Installation in source directory not supported)
15         fi
16         if test "x$prefix_wd" = "x$wd"; then
17                 AC_MSG_ERROR(Installation in build directory not supported)
18         fi
21 AC_PROG_CC
22 AC_PROG_CXX
24 AX_CC_MAXOPT
25 AX_GCC_WARN_UNUSED_RESULT
26 AX_C___ATTRIBUTE__
28 AC_PROG_LIBTOOL
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)
41 AC_SUBST(GMP_LDFLAGS)
42 AC_SUBST(GMP_LIBS)
43 case "$with_gmp" in
44 system)
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"
49         fi
50         GMP_LIBS=-lgmp
51         ;;
52 build)
53         GMP_CPPFLAGS="-I$gmp_srcdir -I$with_gmp_builddir"
54         GMP_LIBS="$with_gmp_builddir/libgmp.la"
55         ;;
56 esac
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
62 ],[#include <gmp.h>])
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)
68 have_piplib=false
69 AC_SUBST(PIPLIB_CPPFLAGS)
70 AC_SUBST(PIPLIB_LDFLAGS)
71 AC_SUBST(PIPLIB_LIBS)
72 case "$with_piplib" in
73         build)
74                 PIPLIB_CPPFLAGS="-I$piplib_srcdir/include"
75                 PIPLIB_LIBS="$with_piplib_builddir/libpiplibMP.la"
76         ;;
77         system)
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"
82                 fi
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>])
91                 ],[
92                         AC_MSG_ERROR([Piplib not found])
93                 ])
94                 CPPFLAGS="$SAVE_CPPFLAGS"
95                 LDFLAGS="$SAVE_LDFLAGS"
96         ;;
97         no)
98         ;;
99         *)
100                 AC_MSG_ERROR(unsupported)
101         ;;
102 esac
103 if test "$with_piplib" != "no"; then
104         AC_DEFINE(ISL_PIPLIB,,piplib is available)
105         have_piplib=true
107 AM_CONDITIONAL(HAVE_PIPLIB, test x$have_piplib = xtrue)
109 AC_SUBST(CLANG_CXXFLAGS)
110 AC_SUBST(CLANG_LDFLAGS)
111 AC_SUBST(CLANG_LIBS)
112 AX_SUBMODULE(clang,system|no,no)
113 case "$with_clang" in
114 system)
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
121                 fi
122         fi
123         if test "$llvm_config_found" != yes; then
124                 AC_MSG_ERROR([llvm-config not found])
125         fi
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 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"
136         AC_LANG_PUSH(C++)
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],
150                         [Diagnostic],
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;
175                 TargetOptions *TO;
176                 DiagnosticsEngine *Diags;
177                 TargetInfo::CreateTargetInfo(*Diags, TO);
178         ], [AC_DEFINE([CREATETARGETINFO_TAKES_POINTER], [],
179                       [Define if TargetInfo::CreateTargetInfo takes pointer])])
180         AC_LANG_POP
181         CPPFLAGS="$SAVE_CPPFLAGS"
183         SAVE_LDFLAGS="$LDFLAGS"
184         LDFLAGS="$CLANG_LDFLAGS $LDFLAGS"
185         AC_SUBST(LIB_CLANG_EDIT)
186         AC_CHECK_LIB([clangEdit], [main], [LIB_CLANG_EDIT=-lclangEdit], [])
187         LDFLAGS="$SAVE_LDFLAGS"
188         ;;
189 esac
190 AM_CONDITIONAL(HAVE_CLANG, test $with_clang = system)
192 AX_SET_WARNING_FLAGS
194 AC_SUBST(WARNING_FLAGS)
196 PACKAGE_CFLAGS="$GMP_CPPFLAGS"
197 PACKAGE_LDFLAGS="$GMP_LDFLAGS"
198 PACKAGE_LIBS="-lisl -lgmp"
199 AX_CREATE_PKGCONFIG_INFO
201 AX_DETECT_GIT_HEAD
202 echo '#define GIT_HEAD_ID "'$GIT_HEAD_ID'"' > gitversion.h
204 AH_BOTTOM([#include <isl_config_post.h>])
205 AC_CONFIG_HEADERS(isl_config.h)
206 AC_CONFIG_HEADERS(include/isl/config.h)
207 AC_CONFIG_FILES(Makefile)
208 AC_CONFIG_FILES(doc/Makefile)
209 if test $with_clang = system; then
210         AC_CONFIG_FILES(interface/Makefile)
212 AC_CONFIG_FILES([bound_test.sh], [chmod +x bound_test.sh])
213 AC_CONFIG_FILES([codegen_test.sh], [chmod +x codegen_test.sh])
214 AC_CONFIG_FILES([pip_test.sh], [chmod +x pip_test.sh])
215 AC_CONFIG_COMMANDS_POST([
216         dnl pass on arguments to subdir configures, but don't
217         dnl add them to config.status
218         ac_configure_args="$ac_configure_args $isl_configure_args"
220 AC_OUTPUT