add isl_schedule_node_band_shift
[isl.git] / configure.ac
blob7362f7915820afe02a4112e3695abd4ccb86d6ac
1 AC_INIT([isl], [0.15], [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=15: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|imath-32],
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|imath-32)
45         ;;
47         AC_MSG_ERROR(
48             [bad value ${withval} for --with-int (use gmp, imath or imath-32)])
49 esac
51 AC_SUBST(MP_CPPFLAGS)
52 AC_SUBST(MP_LDFLAGS)
53 AC_SUBST(MP_LIBS)
54 case "$with_int" in
55 gmp)
56         AX_DETECT_GMP
57         ;;
58 imath|imath-32)
59         AX_DETECT_IMATH
60         ;;
61 esac
62 if test "x$with_int" = "ximath-32" -a "x$GCC" = "xyes"; then
63         MP_CPPFLAGS="-std=gnu99 $MP_CPPFLAGS"
66 AM_CONDITIONAL(IMATH_FOR_MP, test x$with_int = ximath -o x$with_int = ximath-32)
67 AM_CONDITIONAL(GMP_FOR_MP, test x$with_int = xgmp)
69 AM_CONDITIONAL(SMALL_INT_OPT, test "x$with_int" == "ximath-32")
70 AS_IF([test "x$with_int" == "ximath-32"], [
71         AC_DEFINE([USE_SMALL_INT_OPT], [], [Use small integer optimization])
74 AC_CHECK_DECLS(ffs,[],[],[#include <strings.h>])
75 AC_CHECK_DECLS(__builtin_ffs,[],[],[])
76 AC_CHECK_DECLS([_BitScanForward],[],[],[#include <intrin.h>])
77 if test "x$ac_cv_have_decl_ffs" = xno -a \
78                 "x$ac_cv_have_decl___builtin_ffs" = xno -a \
79                 "x$ac_cv_have_decl__BitScanForward" = xno; then
80         AC_MSG_ERROR([No ffs implementation found])
82 AC_CHECK_DECLS([strcasecmp,strncasecmp],[],[],[#include <strings.h>])
83 AC_CHECK_DECLS([_stricmp,_strnicmp],[],[],[#include <string.h>])
84 if test "x$ac_cv_have_decl_strcasecmp" = xno -a \
85                 "x$ac_cv_have_decl__stricmp" = xno; then
86         AC_MSG_ERROR([No strcasecmp implementation found])
88 if test "x$ac_cv_have_decl_strncasecmp" = xno -a \
89                 "x$ac_cv_have_decl__strnicmp" = xno; then
90         AC_MSG_ERROR([No strncasecmp implementation found])
92 AC_CHECK_DECLS([snprintf,_snprintf],[],[],[#include <stdio.h>])
93 if test "x$ac_cv_have_decl_snprintf" = xno -a \
94                 "x$ac_cv_have_decl__snprintf" = xno; then
95         AC_MSG_ERROR([No snprintf implementation found])
98 AC_SUBST(CLANG_CXXFLAGS)
99 AC_SUBST(CLANG_LDFLAGS)
100 AC_SUBST(CLANG_LIBS)
101 AX_SUBMODULE(clang,system|no,no)
102 case "$with_clang" in
103 system)
104         AC_PROG_GREP
105         llvm_config="llvm-config"
106         AC_CHECK_PROG([llvm_config_found], ["$llvm_config"], [yes])
107         if test "x$with_clang_prefix" != "x"; then
108                 llvm_config="$with_clang_prefix/bin/llvm-config"
109                 if test -x "$llvm_config"; then
110                         llvm_config_found=yes
111                 fi
112         fi
113         if test "$llvm_config_found" != yes; then
114                 AC_MSG_ERROR([llvm-config not found])
115         fi
116         CLANG_CXXFLAGS=`$llvm_config --cxxflags`
117         CLANG_LDFLAGS=`$llvm_config --ldflags`
118         targets=`$llvm_config --targets-built`
119         components="$targets asmparser bitreader support mc"
120         $llvm_config --components | $GREP option > /dev/null 2> /dev/null
121         if test $? -eq 0; then
122                 components="$components option"
123         fi
124         CLANG_LIBS=`$llvm_config --libs $components`
125         systemlibs=`$llvm_config --system-libs 2> /dev/null | tail -1`
126         if test $? -eq 0; then
127                 CLANG_LIBS="$CLANG_LIBS $systemlibs"
128         fi
129         CLANG_PREFIX=`$llvm_config --prefix`
130         AC_DEFINE_UNQUOTED(CLANG_PREFIX, ["$CLANG_PREFIX"],
131                                 [Clang installation prefix])
133         SAVE_CPPFLAGS="$CPPFLAGS"
134         CPPFLAGS="$CLANG_CXXFLAGS $CPPFLAGS"
135         AC_LANG_PUSH(C++)
136         AC_CHECK_HEADER([clang/Basic/SourceLocation.h], [],
137                 [AC_ERROR([clang header file not found])])
138         AC_EGREP_HEADER([getDefaultTargetTriple], [llvm/Support/Host.h], [],
139                 [AC_DEFINE([getDefaultTargetTriple], [getHostTriple],
140                 [Define to getHostTriple for older versions of clang])])
141         AC_EGREP_HEADER([getExpansionLineNumber],
142                 [clang/Basic/SourceLocation.h], [],
143                 [AC_DEFINE([getExpansionLineNumber],
144                         [getInstantiationLineNumber],
145             [Define to getInstantiationLineNumber for older versions of clang])])
146         AC_EGREP_HEADER([DiagnosticsEngine],
147                 [clang/Basic/Diagnostic.h], [],
148                 [AC_DEFINE([DiagnosticsEngine],
149                         [Diagnostic],
150             [Define to Diagnostic for older versions of clang])])
151         AC_EGREP_HEADER([ArrayRef], [clang/Driver/Driver.h],
152                 [AC_DEFINE([USE_ARRAYREF], [],
153                         [Define if Driver::BuildCompilation takes ArrayRef])])
154         AC_EGREP_HEADER([CXXIsProduction], [clang/Driver/Driver.h],
155                 [AC_DEFINE([HAVE_CXXISPRODUCTION], [],
156                 [Define if Driver constructor takes CXXIsProduction argument])])
157         AC_EGREP_HEADER([ IsProduction], [clang/Driver/Driver.h],
158                 [AC_DEFINE([HAVE_ISPRODUCTION], [],
159                 [Define if Driver constructor takes IsProduction argument])])
160         AC_TRY_COMPILE([#include <clang/Driver/Driver.h>], [
161                 using namespace clang;
162                 DiagnosticsEngine *Diags;
163                 new driver::Driver("", "", "", *Diags);
164         ], [AC_DEFINE([DRIVER_CTOR_TAKES_DEFAULTIMAGENAME], [],
165                       [Define if Driver constructor takes default image name])])
166         AC_EGREP_HEADER([void HandleTopLevelDecl\(], [clang/AST/ASTConsumer.h],
167                 [AC_DEFINE([HandleTopLevelDeclReturn], [void],
168                            [Return type of HandleTopLevelDeclReturn])
169                  AC_DEFINE([HandleTopLevelDeclContinue], [],
170                            [Return type of HandleTopLevelDeclReturn])],
171                 [AC_DEFINE([HandleTopLevelDeclReturn], [bool],
172                            [Return type of HandleTopLevelDeclReturn])
173                  AC_DEFINE([HandleTopLevelDeclContinue], [true],
174                            [Return type of HandleTopLevelDeclReturn])])
175         AC_CHECK_HEADER([clang/Basic/DiagnosticOptions.h],
176                 [AC_DEFINE([HAVE_BASIC_DIAGNOSTICOPTIONS_H], [],
177                            [Define if clang/Basic/DiagnosticOptions.h exists])])
178         AC_TRY_COMPILE([#include <clang/Basic/TargetInfo.h>], [
179                 using namespace clang;
180                 std::shared_ptr<TargetOptions> TO;
181                 DiagnosticsEngine *Diags;
182                 TargetInfo::CreateTargetInfo(*Diags, TO);
183         ], [AC_DEFINE([CREATETARGETINFO_TAKES_SHARED_PTR], [],
184                     [Define if TargetInfo::CreateTargetInfo takes shared_ptr])])
185         AC_TRY_COMPILE([#include <clang/Basic/TargetInfo.h>], [
186                 using namespace clang;
187                 TargetOptions *TO;
188                 DiagnosticsEngine *Diags;
189                 TargetInfo::CreateTargetInfo(*Diags, TO);
190         ], [AC_DEFINE([CREATETARGETINFO_TAKES_POINTER], [],
191                       [Define if TargetInfo::CreateTargetInfo takes pointer])])
192         AC_TRY_COMPILE([#include <clang/Frontend/CompilerInstance.h>], [
193                 using namespace clang;
194                 DiagnosticConsumer *client;
195                 CompilerInstance *Clang;
196                 Clang->createDiagnostics(client);
197         ], [], [AC_DEFINE([CREATEDIAGNOSTICS_TAKES_ARG], [],
198         [Define if CompilerInstance::createDiagnostics takes argc and argv])])
199         AC_TRY_COMPILE([#include <clang/Lex/HeaderSearchOptions.h>], [
200                 using namespace clang;
201                 HeaderSearchOptions HSO;
202                 HSO.AddPath("", frontend::Angled, false, false);
203         ], [AC_DEFINE([ADDPATH_TAKES_4_ARGUMENTS], [],
204                 [Define if HeaderSearchOptions::AddPath takes 4 arguments])])
205         AC_EGREP_HEADER([getNumParams],
206                 [clang/AST/CanonicalType.h],
207                 [AC_DEFINE([getNumArgs], [getNumParams],
208                     [Define to getNumParams for newer versions of clang])
209                  AC_DEFINE([getArgType], [getParamType],
210                     [Define to getParamType for newer versions of clang])])
211         AC_EGREP_HEADER([getReturnType],
212                 [clang/AST/CanonicalType.h], [],
213                 [AC_DEFINE([getReturnType], [getResultType],
214                     [Define to getResultType for older versions of clang])])
215         AC_TRY_COMPILE([#include <clang/Frontend/CompilerInstance.h>], [
216                 using namespace clang;
217                 CompilerInstance *Clang;
218                 Clang->createPreprocessor(TU_Complete);
219         ], [AC_DEFINE([CREATEPREPROCESSOR_TAKES_TUKIND], [],
220         [Define if CompilerInstance::createPreprocessor takes
221          TranslationUnitKind])])
222         AC_EGREP_HEADER([setMainFileID], [clang/Basic/SourceManager.h],
223                 [AC_DEFINE([HAVE_SETMAINFILEID], [],
224                 [Define if SourceManager has a setMainFileID method])])
225         AC_CHECK_HEADER([llvm/ADT/OwningPtr.h],
226                 [AC_DEFINE([HAVE_ADT_OWNINGPTR_H], [],
227                            [Define if llvm/ADT/OwningPtr.h exists])])
228         AC_LANG_POP
229         CPPFLAGS="$SAVE_CPPFLAGS"
231         SAVE_LDFLAGS="$LDFLAGS"
232         LDFLAGS="$CLANG_LDFLAGS $LDFLAGS"
233         AC_SUBST(LIB_CLANG_EDIT)
234         AC_CHECK_LIB([clangEdit], [main], [LIB_CLANG_EDIT=-lclangEdit], [])
235         LDFLAGS="$SAVE_LDFLAGS"
236         ;;
237 esac
238 AM_CONDITIONAL(HAVE_CLANG, test $with_clang = system)
240 AX_SET_WARNING_FLAGS
242 AC_SUBST(WARNING_FLAGS)
244 PACKAGE_CFLAGS="$MP_CPPFLAGS"
245 PACKAGE_LDFLAGS="$MP_LDFLAGS"
246 PACKAGE_LIBS="-lisl $MP_LIBS"
247 AX_CREATE_PKGCONFIG_INFO
249 AX_DETECT_GIT_HEAD
250 echo '#define GIT_HEAD_ID "'$GIT_HEAD_ID'"' > gitversion.h
252 AH_BOTTOM([#include <isl_config_post.h>])
253 AC_CONFIG_HEADERS(isl_config.h)
254 AC_CONFIG_FILES(Makefile)
255 AC_CONFIG_FILES(doc/Makefile)
256 if test $with_clang = system; then
257         AC_CONFIG_FILES(interface/Makefile)
259 AC_CONFIG_FILES([bound_test.sh], [chmod +x bound_test.sh])
260 AC_CONFIG_FILES([codegen_test.sh], [chmod +x codegen_test.sh])
261 AC_CONFIG_FILES([pip_test.sh], [chmod +x pip_test.sh])
262 AC_CONFIG_COMMANDS_POST([
263         dnl pass on arguments to subdir configures, but don't
264         dnl add them to config.status
265         ac_configure_args="$ac_configure_args $isl_configure_args"
267 AC_OUTPUT