isl_ast_codegen.c: create_node_scaled: postpone adding degenerate guards
[isl.git] / configure.ac
blobc5d374d204d35f816031ba5348ef0b1bb994f686
1 AC_INIT([isl], [0.13], [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=13: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 AC_ARG_WITH([int],
39             [AS_HELP_STRING([--with-int=gmp|imath],
40                             [Which package to use to represent
41                                 multi-precision integers [default=gmp]])],
42             [], [with_int=gmp])
43 case "$with_int" in
44 gmp|imath)
45         ;;
47         AC_MSG_ERROR([bad value ${withval} for --with-int (use gmp or imath)])
48 esac
50 AC_SUBST(MP_CPPFLAGS)
51 AC_SUBST(MP_LDFLAGS)
52 AC_SUBST(MP_LIBS)
53 case "$with_int" in
54 gmp)
55         AX_DETECT_GMP
56         ;;
57 imath)
58         AX_DETECT_IMATH
59         ;;
60 esac
62 AM_CONDITIONAL(IMATH_FOR_MP, test x$with_int = ximath)
63 AM_CONDITIONAL(GMP_FOR_MP, test x$with_int = xgmp)
64 AC_CHECK_DECLS(ffs,[],[],[#include <strings.h>])
65 AC_CHECK_DECLS(__builtin_ffs,[],[],[])
67 AC_SUBST(CLANG_CXXFLAGS)
68 AC_SUBST(CLANG_LDFLAGS)
69 AC_SUBST(CLANG_LIBS)
70 AX_SUBMODULE(clang,system|no,no)
71 case "$with_clang" in
72 system)
73         AC_PROG_GREP
74         llvm_config="llvm-config"
75         AC_CHECK_PROG([llvm_config_found], ["$llvm_config"], [yes])
76         if test "x$with_clang_prefix" != "x"; then
77                 llvm_config="$with_clang_prefix/bin/llvm-config"
78                 if test -x "$llvm_config"; then
79                         llvm_config_found=yes
80                 fi
81         fi
82         if test "$llvm_config_found" != yes; then
83                 AC_MSG_ERROR([llvm-config not found])
84         fi
85         CLANG_CXXFLAGS=`$llvm_config --cxxflags`
86         CLANG_LDFLAGS=`$llvm_config --ldflags`
87         targets=`$llvm_config --targets-built`
88         components="$targets asmparser bitreader support mc"
89         $llvm_config --components | $GREP option > /dev/null 2> /dev/null
90         if test $? -eq 0; then
91                 components="$components option"
92         fi
93         CLANG_LIBS=`$llvm_config --libs $components`
94         systemlibs=`$llvm_config --system-libs 2> /dev/null | tail -1`
95         if test $? -eq 0; then
96                 CLANG_LIBS="$CLANG_LIBS $systemlibs"
97         fi
98         CLANG_PREFIX=`$llvm_config --prefix`
99         AC_DEFINE_UNQUOTED(CLANG_PREFIX, ["$CLANG_PREFIX"],
100                                 [Clang installation prefix])
102         SAVE_CPPFLAGS="$CPPFLAGS"
103         CPPFLAGS="$CLANG_CXXFLAGS $CPPFLAGS"
104         AC_LANG_PUSH(C++)
105         AC_CHECK_HEADER([clang/Basic/SourceLocation.h], [],
106                 [AC_ERROR([clang header file not found])])
107         AC_EGREP_HEADER([getDefaultTargetTriple], [llvm/Support/Host.h], [],
108                 [AC_DEFINE([getDefaultTargetTriple], [getHostTriple],
109                 [Define to getHostTriple for older versions of clang])])
110         AC_EGREP_HEADER([getExpansionLineNumber],
111                 [clang/Basic/SourceLocation.h], [],
112                 [AC_DEFINE([getExpansionLineNumber],
113                         [getInstantiationLineNumber],
114             [Define to getInstantiationLineNumber for older versions of clang])])
115         AC_EGREP_HEADER([DiagnosticsEngine],
116                 [clang/Basic/Diagnostic.h], [],
117                 [AC_DEFINE([DiagnosticsEngine],
118                         [Diagnostic],
119             [Define to Diagnostic for older versions of clang])])
120         AC_EGREP_HEADER([ArrayRef], [clang/Driver/Driver.h],
121                 [AC_DEFINE([USE_ARRAYREF], [],
122                         [Define if Driver::BuildCompilation takes ArrayRef])])
123         AC_EGREP_HEADER([CXXIsProduction], [clang/Driver/Driver.h],
124                 [AC_DEFINE([HAVE_CXXISPRODUCTION], [],
125                 [Define if Driver constructor takes CXXIsProduction argument])])
126         AC_EGREP_HEADER([ IsProduction], [clang/Driver/Driver.h],
127                 [AC_DEFINE([HAVE_ISPRODUCTION], [],
128                 [Define if Driver constructor takes IsProduction argument])])
129         AC_EGREP_HEADER([void HandleTopLevelDecl\(], [clang/AST/ASTConsumer.h],
130                 [AC_DEFINE([HandleTopLevelDeclReturn], [void],
131                            [Return type of HandleTopLevelDeclReturn])
132                  AC_DEFINE([HandleTopLevelDeclContinue], [],
133                            [Return type of HandleTopLevelDeclReturn])],
134                 [AC_DEFINE([HandleTopLevelDeclReturn], [bool],
135                            [Return type of HandleTopLevelDeclReturn])
136                  AC_DEFINE([HandleTopLevelDeclContinue], [true],
137                            [Return type of HandleTopLevelDeclReturn])])
138         AC_CHECK_HEADER([clang/Basic/DiagnosticOptions.h],
139                 [AC_DEFINE([HAVE_BASIC_DIAGNOSTICOPTIONS_H], [],
140                            [Define if clang/Basic/DiagnosticOptions.h exists])])
141         AC_TRY_COMPILE([#include <clang/Basic/TargetInfo.h>], [
142                 using namespace clang;
143                 TargetOptions *TO;
144                 DiagnosticsEngine *Diags;
145                 TargetInfo::CreateTargetInfo(*Diags, TO);
146         ], [AC_DEFINE([CREATETARGETINFO_TAKES_POINTER], [],
147                       [Define if TargetInfo::CreateTargetInfo takes pointer])])
148         AC_TRY_COMPILE([#include <clang/Frontend/CompilerInstance.h>], [
149                 using namespace clang;
150                 DiagnosticConsumer *client;
151                 CompilerInstance *Clang;
152                 Clang->createDiagnostics(client);
153         ], [], [AC_DEFINE([CREATEDIAGNOSTICS_TAKES_ARG], [],
154         [Define if CompilerInstance::createDiagnostics takes argc and argv])])
155         AC_TRY_COMPILE([#include <clang/Lex/HeaderSearchOptions.h>], [
156                 using namespace clang;
157                 HeaderSearchOptions HSO;
158                 HSO.AddPath("", frontend::Angled, false, false);
159         ], [AC_DEFINE([ADDPATH_TAKES_4_ARGUMENTS], [],
160                 [Define if HeaderSearchOptions::AddPath takes 4 arguments])])
161         AC_EGREP_HEADER([getNumParams],
162                 [clang/AST/CanonicalType.h],
163                 [AC_DEFINE([getNumArgs], [getNumParams],
164                     [Define to getNumParams for newer versions of clang])
165                  AC_DEFINE([getArgType], [getParamType],
166                     [Define to getParamType for newer versions of clang])])
167         AC_EGREP_HEADER([getReturnType],
168                 [clang/AST/CanonicalType.h], [],
169                 [AC_DEFINE([getReturnType], [getResultType],
170                     [Define to getResultType for older versions of clang])])
171         AC_TRY_COMPILE([#include <clang/Frontend/CompilerInstance.h>], [
172                 using namespace clang;
173                 CompilerInstance *Clang;
174                 Clang->createPreprocessor(TU_Complete);
175         ], [AC_DEFINE([CREATEPREPROCESSOR_TAKES_TUKIND], [],
176         [Define if CompilerInstance::createPreprocessor takes
177          TranslationUnitKind])])
178         AC_LANG_POP
179         CPPFLAGS="$SAVE_CPPFLAGS"
181         SAVE_LDFLAGS="$LDFLAGS"
182         LDFLAGS="$CLANG_LDFLAGS $LDFLAGS"
183         AC_SUBST(LIB_CLANG_EDIT)
184         AC_CHECK_LIB([clangEdit], [main], [LIB_CLANG_EDIT=-lclangEdit], [])
185         LDFLAGS="$SAVE_LDFLAGS"
186         ;;
187 esac
188 AM_CONDITIONAL(HAVE_CLANG, test $with_clang = system)
190 AX_SET_WARNING_FLAGS
192 AC_SUBST(WARNING_FLAGS)
194 PACKAGE_CFLAGS="$MP_CPPFLAGS"
195 PACKAGE_LDFLAGS="$MP_LDFLAGS"
196 PACKAGE_LIBS="-lisl $MP_LIBS"
197 AX_CREATE_PKGCONFIG_INFO
199 AX_DETECT_GIT_HEAD
200 echo '#define GIT_HEAD_ID "'$GIT_HEAD_ID'"' > gitversion.h
202 AH_BOTTOM([#include <isl_config_post.h>])
203 AC_CONFIG_HEADERS(isl_config.h)
204 AC_CONFIG_FILES(Makefile)
205 AC_CONFIG_FILES(doc/Makefile)
206 if test $with_clang = system; then
207         AC_CONFIG_FILES(interface/Makefile)
209 AC_CONFIG_FILES([bound_test.sh], [chmod +x bound_test.sh])
210 AC_CONFIG_FILES([codegen_test.sh], [chmod +x codegen_test.sh])
211 AC_CONFIG_FILES([pip_test.sh], [chmod +x pip_test.sh])
212 AC_CONFIG_COMMANDS_POST([
213         dnl pass on arguments to subdir configures, but don't
214         dnl add them to config.status
215         ac_configure_args="$ac_configure_args $isl_configure_args"
217 AC_OUTPUT