forked from vtsynergy/OpenDwarfs
-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure.ac
executable file
·353 lines (320 loc) · 11 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
dnl
dnl Copyright 2010 by Virginia Polytechnic Institute and State
dnl University. All rights reserved. Virginia Polytechnic Institute and
dnl State University (Virginia Tech) owns the software and its
dnl associated documentation.
dnl
AC_PREREQ(2.63)
AC_INIT([opencl-apps], [0])
AC_CONFIG_AUX_DIR([m4])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([-Wall foreign 1.10])
PAC_PUSH_ALL_FLAGS
LT_INIT
PAC_POP_ALL_FLAGS
PAC_PROG_CC
PAC_PROG_CXX
AC_CONFIG_HEADER(config.h)
# Strict flags should come first as it might change the way the
# remaining tests behave
PAC_ARG_STRICT
PAC_APPEND_FLAG([--std=gnu89],[CFLAGS])
PAC_APPEND_FLAG([-fgnu89-inline],[CFLAGS])
PAC_APPEND_FLAG([-Wno-error],[CFLAGS])
PAC_APPEND_FLAG([-lm],[LIBS])
#AC_PROG_CC_C89
AM_PROG_CC_C_O
AC_PROG_INSTALL
AC_PROG_MKDIR_P
AC_PROG_RANLIB
AC_C_INLINE
AC_C_CONST
AC_C_RESTRICT
PAC_ARG_CACHING
PAC_C_MACRO_VA_ARGS
PAC_C_GNU_ATTRIBUTE
PAC_CC_FUNCTION_NAME_SYMBOL
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
### The OpenCL SDK allows us to build some additional applications
# NOTE: We prioritize the OpenCL SDK compared to the regular OpenCL in
# order to avoid picking the system OpenCL. This is because the OpenCL
# library seems to have a dependency on some scripts that ship with
# the SDK, which is not installed on the system. So if the person who
# installed the system OpenCL library deleted his/her SDK source, we
# will be in trouble.
AC_ARG_WITH([opencl-sdk],
AS_HELP_STRING([--with-opencl-sdk],[path to the OpenCL SDK]),
[OPENCL_SDK_PREFIX=$withval],[OPENCL_SDK_PREFIX=])
if test ! -z "$OPENCL_SDK_PREFIX" ; then
# FIXME: check for when the 32-bit version is required
PAC_APPEND_FLAG([-I${OPENCL_SDK_PREFIX}/include],[CPPFLAGS])
PAC_APPEND_FLAG([-I${OPENCL_SDK_PREFIX}/samples/opencl/SDKUtil/include],[CPPFLAGS])
PAC_APPEND_FLAG([-L${OPENCL_SDK_PREFIX}/lib/x86_64],[LDFLAGS])
PAC_APPEND_FLAG([-L${OPENCL_SDK_PREFIX}/lib64],[LDFLAGS])
PAC_APPEND_FLAG([-L${OPENCL_SDK_PREFIX}/samples/opencl/SDKUtil/build/debug/x86_64],[LDFLAGS])
# Use rpath to force the use of these libraries
PAC_APPEND_FLAG([-Wl,-rpath=${OPENCL_SDK_PREFIX}/lib/x86_64],[LDFLAGS])
PAC_APPEND_FLAG([-Wl,-rpath=${OPENCL_SDK_PREFIX}/lib64],[LDFLAGS])
PAC_APPEND_FLAG([-Wl,-rpath=${OPENCL_SDK_PREFIX}/samples/opencl/SDKUtil/build/debug/x86_64],[LDFLAGS])
fi
AC_SUBST(OPENCL_SDK_PREFIX)
AC_CHECK_HEADER([CL/cl.h], [HEADER_LINUX=1], [])
AC_CHECK_HEADER([OpenCL/OpenCL.h], [HEADER_APPLE=1], [])
### We need OpenCL
AC_ARG_WITH([opencl], AS_HELP_STRING([--with-opencl],[path to OpenCL]),
[OPENCL_PREFIX=$withval],[OPENCL_PREFIX=])
if test ! -z "$OPENCL_PREFIX" ; then
PAC_APPEND_FLAG([-L${OPENCL_PREFIX}],[LDFLAGS])
if test ! -z "$HEADER_LINUX" ; then
PAC_APPEND_FLAG([-Wl,-rpath=${OPENCL_PREFIX}],[LDFLAGS])
fi
fi
###Specify build with Altera OpenCL SDK
AC_ARG_WITH([AOCL], AS_HELP_STRING([--with-AOCL],[path to Altera OpenCl SDK]),
[AOCL_ROOT=$withval],[AOCL_ROOT=])
if test ! -z "$HEADER_LINUX";
then
AC_DEFINE(OPENCL_HEADER_CL_CL, 1, [use non-apple header])
if test -n "$AOCL_ROOT";
then ###If AOCL option passed (build for Altera FPGA)
AC_DEFINE(__FPGA__, , [Use FPGA])
PAC_APPEND_FLAG([-I${AOCL_ROOT}/host/include],[CPPFLAGS])
PAC_APPEND_FLAG([-I${AOCL_ROOT}/host/include/CL],[CPPFLAGS])
PAC_APPEND_FLAG([-L${AOCL_ROOT}/board/bittware/linux64/lib],[LDFLAGS])
PAC_APPEND_FLAG([-L${AOCL_ROOT}/host/linux64/lib],[LDFLAGS])
PAC_APPEND_FLAG([-Wl,-rpath=${AOCL_ROOT}/board/bittware/linux64/lib],[LDFLAGS])
PAC_APPEND_FLAG([-Wl,-rpath=${AOCL_ROOT}/host/linux64/lib],[LDFLAGS])
PAC_APPEND_FLAG([-lalteracl],[LIBS])
PAC_APPEND_FLAG([-ldl],[LIBS])
PAC_APPEND_FLAG([-lacl_emulator_kernel_rt],[LIBS])
PAC_APPEND_FLAG([-laltera_s5phq_mmd],[LIBS])
PAC_APPEND_FLAG([-lalterahalmmd],[LIBS])
PAC_APPEND_FLAG([-lelf],[LIBS])
PAC_APPEND_FLAG([-lrt],[LIBS])
PAC_APPEND_FLAG([-lstdc++],[LIBS])
else ### default (CPU or GPU)
### Check for the libraries that we need
AC_CHECK_LIB(OpenCL,clGetPlatformIDs,[PAC_PREPEND_FLAG([-lOpenCL],[LIBS])],
AC_MSG_ERROR([OpenCL library not found]))
fi
else
if test ! -z "$HEADER_APPLE" ; then
AC_DEFINE(OPENCL_HEADER_LONG, 1 , [use apple header])
PAC_PREPEND_FLAG([-framework OpenCL],[LIBS])
else
AC_MSG_ERROR([OpenCL header not found])
fi
fi
###AC_ARG_WITH([opts], AC_HELP_STRING([--with-opts],[path to Opts argument library]),
### [OPTS_PREFIX=$withval],[OPTS_PREFIX=])
###if test ! -z "$OPTS_PREFIX" ; then
### PAC_APPEND_FLAG([-L${OPTS_PREFIX}],[LDFLAGS])
### PAC_APPEND_FLAG([-I${OPTS_PREFIX}],[CPPFLAGS])
###fi
###AC_CHECK_LIB(opts,optsload,[PAC_PREPEND_FLAG([-lopts],[LIBS])],
### AC_MSG_ERROR([opts library not found]))
AC_LANG_PUSH([C++])
PAC_PUSH_FLAG([LIBS])
PAC_APPEND_FLAG([-lSDKUtil],[LIBS])
AC_MSG_CHECKING([for SDKSample::initialize in -lSDKUtil])
AC_TRY_LINK([
#include <SDKCommon.hpp>
#include <SDKApplication.hpp>
#include <SDKCommandArgs.hpp>
#include <SDKFile.hpp>],
[streamsdk::Option x;],found_sdkutil=yes,found_sdkutil=no)
AC_MSG_RESULT([${found_sdkutil}])
if test "${found_sdkutil}" = "no" ; then
PAC_POP_FLAG([LIBS])
fi
AC_LANG_POP([C++])
### Do we use libscibench for timing instead? by default not
AC_ARG_WITH([libscibench],
AS_HELP_STRING([--with-libscibench],[path to libscibench]), [LIBSCIBENCH_PREFIX=$withval],[LIBSCIBENCH_PREFIX=])
if test ! -z "$LIBSCIBENCH_PREFIX" ; then
PAC_APPEND_FLAG([-I${LIBSCIBENCH_PREFIX}/include],[CPPFLAGS])
PAC_APPEND_FLAG([-L${LIBSCIBENCH_PREFIX}/lib],[LDFLAGS])
if test ! -z "$HEADER_LINUX"; then
PAC_APPEND_FLAG([-Wl,-rpath=${LIBSCIBENCH_PREFIX}/lib],[LDFLAGS])
fi
PAC_APPEND_FLAG([-llsb],[LIBS])
PAC_APPEND_FLAG([-DTIME_WITH_LIBSCIBENCH],[CPPFLAGS])
AC_MSG_RESULT([using LibSciBench ... -I${LIBSCIBENCH_PREFIX}/include -L${LIBSCIBENCH_PREFIX}/lib])
fi
AM_CONDITIONAL([libscibench], [test ! -z "$LIBSCIBENCH_PREFIX"])
AC_ARG_WITH([papi],
AS_HELP_STRING([--with-papi],[path to papi]), [LIBPAPI_PREFIX=$withval],[LIBPAPI_PREFIX=])
if test ! -z "$LIBPAPI_PREFIX" ; then
PAC_APPEND_FLAG([-I${LIBPAPI_PREFIX}/include],[CPPFLAGS])
PAC_APPEND_FLAG([-L${LIBPAPI_PREFIX}/lib],[LDFLAGS])
if test ! -z "$HEADER_LINUX"; then
PAC_APPEND_FLAG([-Wl,-rpath=${LIBPAPI_PREFIX}/lib],[LDFLAGS])
fi
PAC_APPEND_FLAG([-lpapi],[LIBS])
AC_MSG_RESULT([using papi ... -I${LIBPAPI_PREFIX}/include -L${LIBPAPI_PREFIX}/lib])
fi
### Check what applications the user wants us to build
#AC_ARG_WITH([apps],
# AC_HELP_STRING([--with-apps],[Applications to build (gem,matmult,mattran,swat)]),
# [app_list=$withval],[app_list=gem,matmult,mattran,swat])
AC_ARG_WITH([apps],
AS_HELP_STRING([--with-apps],[Applications to build (gem,nw,srad,lud,kmeans,fft,openclfft,dwt2d,swat,samplecl,crc,cfd,bfs,csr,tdm,nqueens,bwa_hmm)]),
[app_list=$withval],[app_list=gem,nw,srad,lud,kmeans,fft,openclfft,dwt2d,swat,samplecl,crc,cfd,bfs,csr,tdm,nqueens,bwa_hmm])
app_names="`echo $app_list | sed -e 's/:/ /g' -e 's/,/ /g'`"
build_gem=false
build_fft=false
build_openclfft=false
build_dwt2d=false
build_swat=false
#build_matmult=false
#build_mattran=false
#build_swat=false
build_nw=false
build_srad=false
build_lud=false
build_kmeans=false
build_samplecl=false
build_csr=false
#build_createcsr=false
build_crc=false
build_cfd=false
#build_bsort=false
#build_oesort=false
build_bfs=false
build_tdm=false
build_nqueens=false
build_bwa_hmm=false
selected_apps=""
for app in ${app_names}; do
case "$app" in
gem)
# We don't need to test anything here, as we would
# have already aborted if OpenCL wasn't present
build_gem=true
selected_apps="$selected_apps gem"
;;
# matmult)
# if test "${found_sdkutil}" = "yes"; then
# build_matmult=true
# selected_apps="$selected_apps matmult"
# fi
# ;;
# mattran)
# if test "${found_sdkutil}" = "yes"; then
# build_mattran=true
# selected_apps="$selected_apps mattran"
# fi
# ;;
# swat)
# if test "${found_sdkutil}" = "yes"; then
# build_swat=true
# selected_apps="$selected_apps swat"
# fi
# ;;
bfs)
build_bfs=true
selected_apps="$selected_apps bfs"
;;
cfd)
build_cfd=true
selected_apps="$selected_apps cfd"
;;
crc)
build_crc=true
selected_apps="$selected_apps crc"
;;
# bsort)
# build_bsort=true
# selected_apps="$selected_apps bsort"
# ;;
# oesort)
# build_oesort=true
# selected_apps="$selected_apps oesort"
# ;;
nw)
build_nw=true
selected_apps="$selected_apps nw"
;;
srad)
build_srad=true
selected_apps="$selected_apps srad"
;;
lud)
build_lud=true
selected_apps="$selected_apps lud"
;;
kmeans)
build_kmeans=true
selected_apps="$selected_apps kmeans"
;;
samplecl)
build_samplecl=true
selected_apps="$selected_apps samplecl"
;;
fft)
build_fft=true
selected_apps="$selected_apps fft"
;;
openclfft)
build_openclfft=true
selected_apps="$selected_apps openclfft"
;;
dwt2d)
build_dwt2d=true
selected_apps="$selected_apps dwt2d"
;;
swat)
build_swat=true
selected_apps="$selected_apps swat"
;;
tdm)
build_tdm=true
selected_apps="$selected_apps tdm"
;;
csr)
build_csr=true
selected_apps="$selected_apps csr"
;;
nqueens)
build_nqueens=true
selected_apps="$selected_apps nqueens"
;;
bwa_hmm)
build_bwa_hmm=true
selected_apps="$selected_apps bwa_hmm"
;;
*)
AC_MSG_ERROR([unrecognized application $app])
;;
esac
done
#Enable or disable the OCD Timer Suite from ./include/rdtsc.h
#Still doesn't seem to be taking effect
AC_ARG_ENABLE([timing],
AS_HELP_STRING([--disable-timing], [Disable automatic macro-based timing (enabled by default)]), , AC_DEFINE(ENABLE_TIMER, 1, [Enable the OCD suite of automatic timing and output macros.])
)
AC_MSG_RESULT([building applications... ${selected_apps}])
AM_CONDITIONAL([build_gem], [$build_gem])
#AM_CONDITIONAL([build_matmult], [$build_matmult])
#AM_CONDITIONAL([build_mattran], [$build_mattran])
#AM_CONDITIONAL([build_swat], [$build_swat])
AM_CONDITIONAL([build_nw], [$build_nw])
AM_CONDITIONAL([build_srad], [$build_srad])
AM_CONDITIONAL([build_lud], [$build_lud])
AM_CONDITIONAL([build_kmeans], [$build_kmeans])
AM_CONDITIONAL([build_samplecl], [$build_samplecl])
AM_CONDITIONAL([build_fft], [$build_fft])
AM_CONDITIONAL([build_openclfft], [$build_openclfft])
AM_CONDITIONAL([build_dwt2d], [$build_dwt2d])
AM_CONDITIONAL([build_swat], [$build_swat])
AM_CONDITIONAL([build_csr], [$build_csr])
AM_CONDITIONAL([build_crc], [$build_crc])
AM_CONDITIONAL([build_cfd], [$build_cfd])
#AM_CONDITIONAL([build_bsort], [$build_bsort])
#AM_CONDITIONAL([build_oesort], [$build_oesort])
AM_CONDITIONAL([build_bfs], [$build_bfs])
AM_CONDITIONAL([build_tdm], [$build_tdm])
AM_CONDITIONAL([build_nqueens], [$build_nqueens])
AM_CONDITIONAL([build_bwa_hmm], [$build_bwa_hmm])
# Final output
AC_OUTPUT(Makefile)