1 AC_INIT([pet], [0.02], [isl-development@googlegroups.com])
2 AC_CONFIG_AUX_DIR([build-aux])
3 AC_CONFIG_MACRO_DIR([m4])
4 AM_INIT_AUTOMAKE([foreign])
5 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
13 AC_SUBST(CLANG_CXXFLAGS)
14 AC_SUBST(CLANG_LDFLAGS)
16 AX_SUBMODULE(clang,system,system)
17 llvm_config="llvm-config"
18 AC_CHECK_PROG([llvm_config_found], ["$llvm_config"], [yes])
19 if test "x$with_clang_prefix" != "x"; then
20 llvm_config="$with_clang_prefix/bin/llvm-config"
21 if test -x "$llvm_config"; then
25 if test "$llvm_config_found" != yes; then
26 AC_MSG_ERROR([llvm-config not found])
28 CLANG_CXXFLAGS=`$llvm_config --cxxflags`
29 CLANG_LDFLAGS=`$llvm_config --ldflags`
30 targets=`$llvm_config --targets-built`
31 CLANG_LIBS=`$llvm_config --libs $targets asmparser support mc`
32 CLANG_PREFIX=`$llvm_config --prefix`
33 AC_DEFINE_UNQUOTED(CLANG_PREFIX, ["$CLANG_PREFIX"], [Clang installation prefix])
35 SAVE_CPPFLAGS="$CPPFLAGS"
36 CPPFLAGS="$CLANG_CXXFLAGS $CPPFLAGS"
38 AC_CHECK_HEADER([clang/Basic/SourceLocation.h], [],
39 [AC_ERROR([clang header file not found])])
40 AC_EGREP_HEADER([getDefaultTargetTriple], [llvm/Support/Host.h], [],
41 [AC_DEFINE([getDefaultTargetTriple], [getHostTriple],
42 [Define to getHostTriple for older versions of clang])])
43 AC_EGREP_HEADER([getExpansionLineNumber], [clang/Basic/SourceLocation.h], [],
44 [AC_DEFINE([getExpansionLineNumber], [getInstantiationLineNumber],
45 [Define to getInstantiationLineNumber for older versions of clang])])
46 AC_EGREP_HEADER([getExpansionLoc], [clang/Basic/SourceManager.h], [],
47 [AC_DEFINE([getExpansionLoc], [getInstantiationLoc],
48 [Define to getInstantiationLoc for older versions of clang])])
49 AC_EGREP_HEADER([DiagnosticConsumer], [clang/Basic/Diagnostic.h], [],
50 [AC_DEFINE([DiagnosticConsumer], [DiagnosticClient],
51 [Define to DiagnosticClient for older versions of clang])])
52 AC_EGREP_HEADER([DiagnosticsEngine], [clang/Basic/Diagnostic.h],
53 [AC_DEFINE([DiagnosticInfo], [Diagnostic],
54 [Define to Diagnostic for newer versions of clang])],
55 [AC_DEFINE([DiagnosticsEngine], [Diagnostic],
56 [Define to Diagnostic for older versions of clang])])
57 AC_EGREP_HEADER([ArrayRef], [clang/Driver/Driver.h],
58 [AC_DEFINE([USE_ARRAYREF], [],
59 [Define if Driver::BuildCompilation takes ArrayRef])])
60 AC_EGREP_HEADER([CXXIsProduction], [clang/Driver/Driver.h],
61 [AC_DEFINE([HAVE_CXXISPRODUCTION], [],
62 [Define if Driver constructor takes CXXIsProduction argument])])
63 AC_EGREP_HEADER([void HandleTopLevelDecl\(], [clang/AST/ASTConsumer.h],
64 [AC_DEFINE([HandleTopLevelDeclReturn], [void],
65 [Return type of HandleTopLevelDeclReturn])
66 AC_DEFINE([HandleTopLevelDeclContinue], [],
67 [Return type of HandleTopLevelDeclReturn])],
68 [AC_DEFINE([HandleTopLevelDeclReturn], [bool],
69 [Return type of HandleTopLevelDeclReturn])
70 AC_DEFINE([HandleTopLevelDeclContinue], [true],
71 [Return type of HandleTopLevelDeclReturn])])
72 AC_EGREP_HEADER([isEnclosingLocal,], [clang/AST/Expr.h],
73 [AC_DEFINE([DECLREFEXPR_CREATE_REQUIRES_BOOL], [],
74 [Define if DeclRefExpr::Create takes isEnclosingLocal argument])])
75 AC_EGREP_HEADER([HasTemplateKWAndArgsInfo], [clang/AST/Expr.h],
76 [AC_DEFINE([DECLREFEXPR_CREATE_REQUIRES_SOURCELOCATION], [],
77 [Define if DeclRefExpr::Create takes SourceLocation argument])])
78 AC_CHECK_HEADER([clang/Basic/DiagnosticOptions.h],
79 [AC_DEFINE([HAVE_BASIC_DIAGNOSTICOPTIONS_H], [],
80 [Define if clang/Basic/DiagnosticOptions.h exists])])
81 AC_CHECK_HEADER([clang/Lex/HeaderSearchOptions.h],
82 [AC_DEFINE([HAVE_LEX_HEADERSEARCHOPTIONS_H], [],
83 [Define if clang/Lex/HeaderSearchOptions.h exists])], [],
84 [#include <clang/Basic/LLVM.h>])
85 AC_CHECK_HEADER([clang/Lex/PreprocessorOptions.h],
86 [AC_DEFINE([HAVE_LEX_PREPROCESSOROPTIONS_H], [],
87 [Define if clang/Lex/PreprocessorOptions.h exists])], [],
88 [#include <clang/Basic/LLVM.h>])
90 CPPFLAGS="$SAVE_CPPFLAGS"
92 SAVE_LDFLAGS="$LDFLAGS"
93 LDFLAGS="$CLANG_LDFLAGS $LDFLAGS"
94 AC_SUBST(LIB_CLANG_EDIT)
95 AC_CHECK_LIB([clangEdit], [main], [LIB_CLANG_EDIT=-lclangEdit], [])
96 LDFLAGS="$SAVE_LDFLAGS"
98 AX_SUBMODULE(gmp,system|build,system)
100 AC_SUBST(GMP_LDFLAGS)
104 if test "x$with_gmp_prefix" != "x"; then
105 GMP_CPPFLAGS="-I$with_gmp_prefix/include"
106 GMP_LDFLAGS="-L$with_gmp_prefix/lib"
111 GMP_CPPFLAGS="-I$gmp_srcdir -I$with_gmp_builddir"
112 GMP_LIBS="$with_gmp_builddir/libgmp.la"
116 AX_SUBMODULE(isl,build|bundled|system,bundled)
117 AM_CONDITIONAL(BUNDLED_ISL, test $with_isl = bundled)
123 ISL_CFLAGS="-I\$(top_srcdir)/isl/include -I\$(top_builddir)/isl/include"
124 ISL_CFLAGS="$ISL_CFLAGS $GMP_CPPFLAGS"
127 ISL_BUILDDIR=`echo @abs_builddir@ | $with_isl_builddir/config.status --file=-`
128 ISL_CFLAGS="-I$isl_srcdir/include -I$ISL_BUILDDIR/include"
129 ISL_CFLAGS="$ISL_CFLAGS $GMP_CPPFLAGS"
130 ISL_LIBS="$with_isl_builddir/libisl.la $GMP_LDFLAGS $GMP_LIBS"
133 PKG_CHECK_MODULES([ISL], [isl])
134 PACKAGE_CFLAGS_ISL="$ISL_CFLAGS"
137 AX_SUBMODULE(libyaml,system|no,system)
138 AC_SUBST(LIBYAML_CPPFLAGS)
139 AC_SUBST(LIBYAML_LDFLAGS)
140 if test "x$with_libyaml_prefix" != "x"; then
141 LIBYAML_CPPFLAGS="-I$with_libyaml_prefix/include"
143 if test "x$with_libyaml_exec_prefix" != "x"; then
144 LIBYAML_LDFLAGS="-L$with_libyaml_exec_prefix/lib"
147 if test "$with_libyaml" = "system"; then
148 SAVE_CPPFLAGS=$CPPFLAGS
149 CPPFLAGS="$CPPFLAGS $LIBYAML_CPPFLAGS"
150 AC_CHECK_HEADER([yaml.h],[],[with_libyaml="no"])
151 CPPFLAGS="$SAVE_CPPFLAGS"
154 AC_SUBST(extra_bin_programs)
155 AC_SUBST(extra_noinst_programs)
156 AC_SUBST(extra_tests)
158 if test "$with_libyaml" != "no"; then
159 extra_bin_programs="pet"
160 extra_noinst_programs="pet_scop_cmp"
161 extra_tests="pet_test.sh"
164 PACKAGE_CFLAGS="$PACKAGE_CFLAGS_ISL"
165 PACKAGE_LIBS="-lpet -lisl"
166 AX_CREATE_PKGCONFIG_INFO
169 echo '#define GIT_HEAD_ID "'$GIT_HEAD_ID'"' > gitversion.h
171 AC_CONFIG_HEADERS(config.h)
172 AC_CONFIG_FILES(Makefile)
173 AC_CONFIG_FILES([pet_test.sh], [chmod +x pet_test.sh])
174 if test $with_isl = bundled; then
175 AC_CONFIG_SUBDIRS(isl)