add isl_obj_schedule
[isl.git] / configure.ac
blobf5d684b2d82159604f7a04b753effc6b6a23bcb2
1 AC_INIT([isl], [0.14], [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=14:0:1
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_TRY_COMPILE([#include <clang/Driver/Driver.h>], [
130                 using namespace clang;
131                 DiagnosticsEngine *Diags;
132                 new driver::Driver("", "", "", *Diags);
133         ], [AC_DEFINE([DRIVER_CTOR_TAKES_DEFAULTIMAGENAME], [],
134                       [Define if Driver constructor takes default image name])])
135         AC_EGREP_HEADER([void HandleTopLevelDecl\(], [clang/AST/ASTConsumer.h],
136                 [AC_DEFINE([HandleTopLevelDeclReturn], [void],
137                            [Return type of HandleTopLevelDeclReturn])
138                  AC_DEFINE([HandleTopLevelDeclContinue], [],
139                            [Return type of HandleTopLevelDeclReturn])],
140                 [AC_DEFINE([HandleTopLevelDeclReturn], [bool],
141                            [Return type of HandleTopLevelDeclReturn])
142                  AC_DEFINE([HandleTopLevelDeclContinue], [true],
143                            [Return type of HandleTopLevelDeclReturn])])
144         AC_CHECK_HEADER([clang/Basic/DiagnosticOptions.h],
145                 [AC_DEFINE([HAVE_BASIC_DIAGNOSTICOPTIONS_H], [],
146                            [Define if clang/Basic/DiagnosticOptions.h exists])])
147         AC_TRY_COMPILE([#include <clang/Basic/TargetInfo.h>], [
148                 using namespace clang;
149                 std::shared_ptr<TargetOptions> TO;
150                 DiagnosticsEngine *Diags;
151                 TargetInfo::CreateTargetInfo(*Diags, TO);
152         ], [AC_DEFINE([CREATETARGETINFO_TAKES_SHARED_PTR], [],
153                     [Define if TargetInfo::CreateTargetInfo takes shared_ptr])])
154         AC_TRY_COMPILE([#include <clang/Basic/TargetInfo.h>], [
155                 using namespace clang;
156                 TargetOptions *TO;
157                 DiagnosticsEngine *Diags;
158                 TargetInfo::CreateTargetInfo(*Diags, TO);
159         ], [AC_DEFINE([CREATETARGETINFO_TAKES_POINTER], [],
160                       [Define if TargetInfo::CreateTargetInfo takes pointer])])
161         AC_TRY_COMPILE([#include <clang/Frontend/CompilerInstance.h>], [
162                 using namespace clang;
163                 DiagnosticConsumer *client;
164                 CompilerInstance *Clang;
165                 Clang->createDiagnostics(client);
166         ], [], [AC_DEFINE([CREATEDIAGNOSTICS_TAKES_ARG], [],
167         [Define if CompilerInstance::createDiagnostics takes argc and argv])])
168         AC_TRY_COMPILE([#include <clang/Lex/HeaderSearchOptions.h>], [
169                 using namespace clang;
170                 HeaderSearchOptions HSO;
171                 HSO.AddPath("", frontend::Angled, false, false);
172         ], [AC_DEFINE([ADDPATH_TAKES_4_ARGUMENTS], [],
173                 [Define if HeaderSearchOptions::AddPath takes 4 arguments])])
174         AC_EGREP_HEADER([getNumParams],
175                 [clang/AST/CanonicalType.h],
176                 [AC_DEFINE([getNumArgs], [getNumParams],
177                     [Define to getNumParams for newer versions of clang])
178                  AC_DEFINE([getArgType], [getParamType],
179                     [Define to getParamType for newer versions of clang])])
180         AC_EGREP_HEADER([getReturnType],
181                 [clang/AST/CanonicalType.h], [],
182                 [AC_DEFINE([getReturnType], [getResultType],
183                     [Define to getResultType for older versions of clang])])
184         AC_TRY_COMPILE([#include <clang/Frontend/CompilerInstance.h>], [
185                 using namespace clang;
186                 CompilerInstance *Clang;
187                 Clang->createPreprocessor(TU_Complete);
188         ], [AC_DEFINE([CREATEPREPROCESSOR_TAKES_TUKIND], [],
189         [Define if CompilerInstance::createPreprocessor takes
190          TranslationUnitKind])])
191         AC_EGREP_HEADER([setMainFileID], [clang/Basic/SourceManager.h],
192                 [AC_DEFINE([HAVE_SETMAINFILEID], [],
193                 [Define if SourceManager has a setMainFileID method])])
194         AC_CHECK_HEADER([llvm/ADT/OwningPtr.h],
195                 [AC_DEFINE([HAVE_ADT_OWNINGPTR_H], [],
196                            [Define if llvm/ADT/OwningPtr.h exists])])
197         AC_LANG_POP
198         CPPFLAGS="$SAVE_CPPFLAGS"
200         SAVE_LDFLAGS="$LDFLAGS"
201         LDFLAGS="$CLANG_LDFLAGS $LDFLAGS"
202         AC_SUBST(LIB_CLANG_EDIT)
203         AC_CHECK_LIB([clangEdit], [main], [LIB_CLANG_EDIT=-lclangEdit], [])
204         LDFLAGS="$SAVE_LDFLAGS"
205         ;;
206 esac
207 AM_CONDITIONAL(HAVE_CLANG, test $with_clang = system)
209 AX_SET_WARNING_FLAGS
211 AC_SUBST(WARNING_FLAGS)
213 PACKAGE_CFLAGS="$MP_CPPFLAGS"
214 PACKAGE_LDFLAGS="$MP_LDFLAGS"
215 PACKAGE_LIBS="-lisl $MP_LIBS"
216 AX_CREATE_PKGCONFIG_INFO
218 AX_DETECT_GIT_HEAD
219 echo '#define GIT_HEAD_ID "'$GIT_HEAD_ID'"' > gitversion.h
221 AH_BOTTOM([#include <isl_config_post.h>])
222 AC_CONFIG_HEADERS(isl_config.h)
223 AC_CONFIG_FILES(Makefile)
224 AC_CONFIG_FILES(doc/Makefile)
225 if test $with_clang = system; then
226         AC_CONFIG_FILES(interface/Makefile)
228 AC_CONFIG_FILES([bound_test.sh], [chmod +x bound_test.sh])
229 AC_CONFIG_FILES([codegen_test.sh], [chmod +x codegen_test.sh])
230 AC_CONFIG_FILES([pip_test.sh], [chmod +x pip_test.sh])
231 AC_CONFIG_COMMANDS_POST([
232         dnl pass on arguments to subdir configures, but don't
233         dnl add them to config.status
234         ac_configure_args="$ac_configure_args $isl_configure_args"
236 AC_OUTPUT