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])])
79 CPPFLAGS="$SAVE_CPPFLAGS"
81 SAVE_LDFLAGS="$LDFLAGS"
82 LDFLAGS="$CLANG_LDFLAGS $LDFLAGS"
83 AC_SUBST(LIB_CLANG_EDIT)
84 AC_CHECK_LIB([clangEdit], [main], [LIB_CLANG_EDIT=-lclangEdit], [])
85 LDFLAGS="$SAVE_LDFLAGS"
87 AX_SUBMODULE(gmp,system|build,system)
93 if test "x$with_gmp_prefix" != "x"; then
94 GMP_CPPFLAGS="-I$with_gmp_prefix/include"
95 GMP_LDFLAGS="-L$with_gmp_prefix/lib"
100 GMP_CPPFLAGS="-I$gmp_srcdir -I$with_gmp_builddir"
101 GMP_LIBS="$with_gmp_builddir/libgmp.la"
105 AX_SUBMODULE(isl,build|bundled|system,bundled)
106 AM_CONDITIONAL(BUNDLED_ISL, test $with_isl = bundled)
112 ISL_CFLAGS="-I\$(top_srcdir)/isl/include -I\$(top_builddir)/isl/include"
113 ISL_CFLAGS="$ISL_CFLAGS $GMP_CPPFLAGS"
116 ISL_BUILDDIR=`echo @abs_builddir@ | $with_isl_builddir/config.status --file=-`
117 ISL_CFLAGS="-I$isl_srcdir/include -I$ISL_BUILDDIR/include"
118 ISL_CFLAGS="$ISL_CFLAGS $GMP_CPPFLAGS"
119 ISL_LIBS="$with_isl_builddir/libisl.la $GMP_LDFLAGS $GMP_LIBS"
122 PKG_CHECK_MODULES([ISL], [isl])
123 PACKAGE_CFLAGS_ISL="$ISL_CFLAGS"
126 AX_SUBMODULE(libyaml,system|no,system)
127 AC_SUBST(LIBYAML_CPPFLAGS)
128 AC_SUBST(LIBYAML_LDFLAGS)
129 if test "x$with_libyaml_prefix" != "x"; then
130 LIBYAML_CPPFLAGS="-I$with_libyaml_prefix/include"
132 if test "x$with_libyaml_exec_prefix" != "x"; then
133 LIBYAML_LDFLAGS="-L$with_libyaml_exec_prefix/lib"
136 if test "$with_libyaml" = "system"; then
137 SAVE_CPPFLAGS=$CPPFLAGS
138 CPPFLAGS="$CPPFLAGS $LIBYAML_CPPFLAGS"
139 AC_CHECK_HEADER([yaml.h],[],[with_libyaml="no"])
140 CPPFLAGS="$SAVE_CPPFLAGS"
143 AC_SUBST(extra_bin_programs)
144 AC_SUBST(extra_noinst_programs)
145 AC_SUBST(extra_tests)
147 if test "$with_libyaml" != "no"; then
148 extra_bin_programs="pet"
149 extra_noinst_programs="pet_scop_cmp"
150 extra_tests="pet_test.sh"
153 PACKAGE_CFLAGS="$PACKAGE_CFLAGS_ISL"
154 PACKAGE_LIBS="-lpet -lisl"
155 AX_CREATE_PKGCONFIG_INFO
158 echo '#define GIT_HEAD_ID "'$GIT_HEAD_ID'"' > gitversion.h
160 AC_CONFIG_HEADERS(config.h)
161 AC_CONFIG_FILES(Makefile)
162 AC_CONFIG_FILES([pet_test.sh], [chmod +x pet_test.sh])
163 if test $with_isl = bundled; then
164 AC_CONFIG_SUBDIRS(isl)