forked from jrprice/Oclgrind
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
135 lines (116 loc) · 4.13 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# configure.ac (Oclgrind)
# Copyright (c) 2013-2015, James Price and Simon McIntosh-Smith,
# University of Bristol. All rights reserved.
#
# This program is provided under a three-clause BSD license. For full
# license terms please see the LICENSE file distributed with this
# source code.
AC_INIT([Oclgrind], [15.5], , [oclgrind], [https://github.com/jrprice/Oclgrind])
AC_PREREQ([2.63])
AC_CONFIG_SRCDIR([src/])
AM_INIT_AUTOMAKE([foreign 1.12])
AC_LANG(C++)
AC_PROG_CXX
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile])
LT_INIT
# Check if we're compiling with Clang
AS_CASE([`$CC --version`], [*clang*], [using_clang=yes])
AM_CONDITIONAL([USING_CLANG], [test "$using_clang" == "yes"])
oclgrind_extra_libs=
# Check for C++11
AX_CHECK_COMPILE_FLAG([-std=c++11], [],
[AC_MSG_ERROR([C++11 support is required])])
CXXFLAGS="$CXXFLAGS -std=c++11"
CPPFLAGS="$CPPFLAGS -std=c++11"
# Add LLVM required macro definitions
CPPFLAGS="$CPPFLAGS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS"
# --with-llvm option to specify root of LLVM/Clang installation
AC_ARG_WITH(
llvm,
[AS_HELP_STRING([--with-llvm],
[directory containing LLVM/Clang installation])],
[CPPFLAGS="$CPPFLAGS -I$withval/include";
LDFLAGS="$LDFLAGS -L$withval/lib";
AC_SUBST(clang, $withval/bin/clang)
AC_SUBST(llvm_config, $withval/bin/llvm-config)])
# Find LLVM/Clang binaries (assume on PATH if --with-llvm not used)
AC_CHECK_PROG(clang, [clang], `which clang`)
AC_CHECK_PROG(llvm_config, [llvm-config], `which llvm-config`)
if test -z $llvm_config; then
AC_MSG_ERROR([llvm-config not found (use --with-llvm=)])
fi
# Check version of LLVM
AC_MSG_CHECKING([llvm version])
llvm_full_version=`$llvm_config --version`
llvm_version=`echo $llvm_full_version | cut -b 1,3`
AC_MSG_RESULT($llvm_full_version)
if test $llvm_version -lt 36; then
AC_MSG_ERROR([LLVM version must be >= 3.6])
fi
AC_DEFINE_UNQUOTED([LLVM_VERSION],
[$llvm_version],
[Version of LLVM we are building against])
# Check for LLVM/Clang headers/libraries
AC_CHECK_HEADERS(
[llvm/IR/Instruction.h clang/CodeGen/CodeGenAction.h],
[:],
[AC_MSG_ERROR([LLVM/Clang includes not found (use --with-llvm=)])])
AC_CHECK_LIB(
[clangFrontend],
[main],
[:],
[AC_MSG_ERROR([Clang library not found (use --with-llvm)])])
# GNU readline library (for interactive debugger)
AC_ARG_WITH(
[readline],
AS_HELP_STRING([--with-readline],
[location of GNU readline library]),
[CPPFLAGS="$CPPFLAGS -I$withval/include";
LDFLAGS="$LDFLAGS -L$withval/lib"])
have_readline=true
AC_CHECK_HEADER(
[readline/readline.h],
[:],
[have_readline=false])
AC_CHECK_HEADER(
[readline/history.h],
[:],
[have_readline=false])
AC_CHECK_LIB(
[readline],
[readline],
[:],
[have_readline=false])
AC_CHECK_LIB(
[readline],
[add_history],
[:],
[have_readline=false])
if test $have_readline = true; then
AC_DEFINE([HAVE_READLINE], [1], [Define to 1 if GNU readline found])
oclgrind_extra_libs="$oclgrind_extra_libs -lreadline"
else
AC_MSG_WARN([GNU readline library not found (use --with-readline)])
fi
AC_SUBST([oclgrind_extra_libs], [$oclgrind_extra_libs])
# Check if Python is available (required to run tests)
AM_PATH_PYTHON(,,[:])
AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :])
# Kernel tests
KERNEL_TESTS=""
KERNEL_TEST_INPUTS=""
KERNEL_TEST_OUTPUTS=""
m4_foreach([name], m4_split(m4_include(tests/kernels/TESTS), m4_newline),
[
KERNEL_TESTS="$KERNEL_TESTS tests/kernels/"name".sim"
KERNEL_TEST_INPUTS="$KERNEL_TEST_INPUTS tests/kernels/"name".sim"
KERNEL_TEST_INPUTS="$KERNEL_TEST_INPUTS tests/kernels/"name".cl"
KERNEL_TEST_INPUTS="$KERNEL_TEST_INPUTS tests/kernels/"name".ref"
KERNEL_TEST_OUTPUTS="$KERNEL_TEST_OUTPUTS tests/kernels/"name".out"
])
AC_SUBST(KERNEL_TESTS, $KERNEL_TESTS)
AC_SUBST(KERNEL_TEST_INPUTS, $KERNEL_TEST_INPUTS)
AC_SUBST(KERNEL_TEST_OUTPUTS, $KERNEL_TEST_OUTPUTS)
AC_OUTPUT