-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
269 lines (211 loc) · 5.86 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
# Process this file with autoconf to produce a configure script.
AC_INIT([spiral_wht],[2.0-pre-4],[[email protected]])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE(1.9)
AM_MAINTAINER_MODE
AC_DISABLE_SHARED
AM_DISABLE_SHARED
AC_CANONICAL_HOST
#
# M A I N T A I N E R P A R A M E T E R S
#
MAX_UNROLL_PKG=8
MAX_INTERLEAVE_PKG=16
MAX_VECTOR_PKG=4
AC_SUBST(MAX_UNROLL_PKG)
AC_SUBST(MAX_INTERLEAVE_PKG)
AC_SUBST(MAX_VECTOR_PKG)
#
# D E F A U L T P A R A M E T E R S
#
MAX_UNROLL=6
MAX_INTERLEAVE=0
VECTOR_SIZE=0
if test "$CFLAGS" = ""; then
CFLAGS="-O2"
fi
#
# T R A N S F O R M T Y P E
#
AC_ARG_ENABLE([double],
[AS_HELP_STRING([--enable-double],
[compile with double precision floating point (default is enabled) ])],
[ok=$enableval],
[ok=yes])
if test "$ok" = "yes"; then
AC_DEFINE(WHT_DOUBLE,1,
[define to compile with double precision floating point])
WHT_PRECISION=
WHT_SUFFIX=
fi
AC_ARG_ENABLE([float],
[AS_HELP_STRING([--enable-float],
[compile wht with single precision floating point (default is disabled)])],
[ok=$enableval],
[ok=no])
if test "$ok" = "yes"; then
if test "$WHT_PRECISION" != ""; then
AC_MSG_ERROR([--enable-float conflict])
fi
AC_DEFINE(WHT_FLOAT,1,
[define to compile with single precision floating point])
AC_DEFINE(WHT_DOUBLE,0)
WHT_PRECISION=f
WHT_SUFFIX=f
fi
#
# M A X C O D E L E T S I Z E
#
AC_ARG_ENABLE([max_unroll],
[AS_HELP_STRING([--enable-max-unroll=N],
[maximum unrolled codelet size (default is 6)])],
[max_unroll=$enableval],
[max_unroll=$MAX_UNROLL])
if test $max_unroll -gt $MAX_UNROLL_PKG; then
AC_MSG_ERROR([--enable-max-unroll larger than package was built for])
fi
AC_DEFINE_UNQUOTED(WHT_MAX_UNROLL,$max_unroll,
[maximum unrolled codelet size])
#
# M A X I N T E R L E A V E F A C T O R
#
AC_ARG_ENABLE([interleave],
[AS_HELP_STRING([--enable-interleave=K],
[interleave K loop iterations in codelet (default is disabled)])],
[interleave=$enableval],
[interleave=$MAX_INTERLEAVE])
if test $interleave -gt $MAX_INTERLEAVE_PKG; then
AC_MSG_ERROR([--enable-interleave larger than package was built for])
fi
#
# V E C T O R I Z A T I O N
#
AC_ARG_ENABLE([sse],
[AS_HELP_STRING([--enable-sse],
[enable SSE optimizations (default is disabled)])],
[have_sse=$enableval],
[have_sse=no])
if test "$have_sse" = "yes"; then
AC_DEFINE(WHT_HAVE_SSE,1,
[define to enable SSE optimizations.])
have_simd="yes"
if test "$WHT_PRECISION" != "f"; then
AC_MSG_ERROR([--enable-sse can only be used in conjunction with --enable-float])
fi
CFLAGS="$CFLAGS -msse"
VECTOR_SIZE=4
if test $VECTOR_SIZE -gt $MAX_VECTOR_PKG; then
AC_MSG_ERROR([--enable-sse vectors are larger than package was built for])
fi
if test $interleave -eq 0; then
interleave=$VECTOR_SIZE;
fi
fi
AC_ARG_ENABLE([sse2],
[AS_HELP_STRING([--enable-sse2],
[enable SSE2 optimizations (default is disabled)])],
[have_sse2=$enableval],
[have_sse2=no])
if test "$have_sse2" = "yes"; then
AC_DEFINE(WHT_HAVE_SSE2,1,[Define to enable SSE2 optimizations.])
have_simd="yes"
if test "$have_sse" = "yes"; then
AC_MSG_ERROR([you cannot use SSE and SSE2 at the same time])
fi
if test "$WHT_PRECISION" != ""; then
AC_MSG_ERROR([--enable-sse2 can only be used in conjunction with --enable-double])
fi
CFLAGS="$CFLAGS -msse2"
VECTOR_SIZE=2
if test $VECTOR_SIZE -gt $MAX_VECTOR_PKG; then
AC_MSG_ERROR([--enable-sse2 vectors are larger than package was built for])
fi
if test $interleave -eq 0; then
interleave=$VECTOR_SIZE;
fi
fi
AC_DEFINE_UNQUOTED(WHT_VECTOR_SIZE,$VECTOR_SIZE, [Size of vector to use.])
AC_DEFINE_UNQUOTED(WHT_MAX_INTERLEAVE,$interleave,
[interleave K loop iterations in codelet])
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([memset strdup getline fgetln])
AC_SEARCH_LIBS([sqrtl],[m],[], AC_MSG_ERROR([required sqrtl symbol not found]))
AC_SEARCH_LIBS([ceil],[m],[], AC_MSG_ERROR([required ceil symbol not found]))
#
# P A P I M E A S U R E
#
AC_ARG_WITH([papi],
[AS_HELP_STRING([--with-papi=PATH],
[compile with PAPI support, PATH is location of PAPI install])],
[papi_path=$withval],
[papi_path="no"])
AM_CONDITIONAL(HAVE_PAPI, test "$papi_path" != "no")
if test "$papi_path" != "no"; then
LDFLAGS="$LDFLAGS -L$papi_path/lib"
CPPFLAGS="$CPPFLAGS -I$papi_path/include"
AC_DEFINE(HAVE_PAPI, [], [Compile with PAPI] )
AC_CHECK_HEADER([papi.h],[],
AC_MSG_ERROR([required header file for --with-papi not found]))
LIBS="$LIBS -lpapi"
fi
# Checks for programs.
AC_PROG_CC
AC_PROG_CC_STDC
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_CHECK_PROG(PERL,perl,perl)
AC_CHECK_PROG(RUBY,ruby,ruby)
AC_CHECK_PROG(BASH,bash,bash)
AC_PROG_LIBTOOL
if test "$USE_MAINTAINER_MODE" = yes; then
AC_PROG_LEX
AC_PROG_YACC
fi
# Checks for header files.
AC_FUNC_ALLOCA
AC_HEADER_STDC
AC_HEADER_STDBOOL
AC_HEADER_TIME
AC_CHECK_HEADERS([inttypes.h libintl.h malloc.h math.h stddef.h stdlib.h string.h strings.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT8_T
AC_TYPE_SIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT8_T
AC_C_VOLATILE
# Add gcc warnings, in maintainer mode only
if test "$USE_MAINTAINER_MODE" = yes; then
CFLAGS="$CFLAGS -Wall -g"
fi
if test "$ac_test_CXXFLAGS" != "set"; then
CXXFLAGS="$CFLAGS"
fi
AC_DEFINE_UNQUOTED(WHT_CC,"$CC",
[the compiler used to compile this.])
AC_DEFINE_UNQUOTED(WHT_CFLAGS,"$CFLAGS",
[the compiler flags used to compile this.])
# TODO puts these back when model is ready to be distributed
# model/Makefile
# model/ic/Makefile
AC_CONFIG_FILES([
Makefile
whtgen/Makefile
wht/Makefile
wht/codelets/Makefile
measure/Makefile
measure/papi/Makefile
search/Makefile
rand/Makefile
tests/Makefile
])
AC_OUTPUT