-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathconfigure.ac
268 lines (240 loc) · 7.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
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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(femto, 1.3.0, [email protected])
AM_INIT_AUTOMAKE([1.9 foreign tar-pax])
AC_CONFIG_SRCDIR([src/main/bwt_writer.h])
AM_CONFIG_HEADER([config.h])
# did the user specify custom C flags?
CUSTOMCFLAGS=$CFLAGS
CUSTOMCXXFLAGS=$CXXFLAGS
# add a single space to trick AC_PROG_CC into
# leaving no CFLAGS (default is to add -g -O2)
CFLAGS="$CFLAGS $EXTRA_CFLAGS"
CXXFLAGS="$CXXFLAGS $EXTRA_CFLAGS"
AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [turn on debug]),
[
DEBUG=yes
],
[
DEBUG=""
])
AC_ARG_ENABLE([profile], AS_HELP_STRING([--enable-profile], [turn on gprof profiling (-pg)]),
[
PROFILE=yes
],
[
PROFILE=""
])
AC_ARG_ENABLE([mod_femto], AS_HELP_STRING([--enable-mod_femto], [build Apache module]),
[case "${enableval}" in
yes) mod_femto=true ;;
no) mod_femto=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-mod_femto]) ;;
esac],[mod_femto=false])
AM_CONDITIONAL([MOD_FEMTO], [test x$mod_femto = xtrue])
AC_ARG_WITH([mpi], AS_HELP_STRING([--with-mpi], [build with MPI ie mpicc and mpic++]),
[],
[with_mpi=check])
# Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AM_PROG_CC_C_O
AS_IF([test "x$with_mpi" != xno],
[
# Check for MPI compiler wrappers.
# Enable them if possible.
AC_CHECK_PROG([MPICC],[mpicc],[mpicc],[])
AC_CHECK_PROG([MPICXX],[mpic++],[mpic++],[])
AS_IF([test "x$with_mpi" != xcheck],
[
AS_IF([test "x" == "x$MPICC"],
[AC_MSG_FAILURE([--with-mpi was given, but no mpicc found])])
])
# Switch to these compilers.
#CC=$MPICC
#CXX=$MPICXX
])
AS_IF([test "x$MPICC" == "x"],
[
MPICC=$CC
MPICXX=$CXX
],
[
AC_DEFINE([HAVE_MPI_H],[1],[Has MPI])
])
AC_PROG_LIBTOOL
AC_PROG_YACC
AM_PROG_LEX
# Check for Apache eXtenSion Tool apxs
AC_CHECK_PROG([APXS],[apxs],[apxs])
AC_CHECK_PROG([APXS],[apxs2],[apxs2])
AS_IF([test "x$APXS" == "x"],
[AM_CONDITIONAL([HAS_APXS], [false])],
[AM_CONDITIONAL([HAS_APXS], [true])])
# Checks for libraries.
AC_CHECK_LIB([rt], [clock_gettime])
AC_CHECK_LIB([c],[aio_read],
[POSIX_AIO_LIB=-lc
AC_DEFINE([HAS_POSIX_AIO],[1],[Has POSIX AIO e.g. aio_read])
AM_CONDITIONAL([HAS_POSIX_AIO], [true])],
[AC_CHECK_LIB([rt], [aio_read],
[POSIX_AIO_LIB=-lrt
AC_DEFINE([HAS_POSIX_AIO],[1],[Has POSIX AIO e.g. aio_read])
AM_CONDITIONAL([HAS_POSIX_AIO], [true])],
[POSIX_AIO_LIB=
AM_CONDITIONAL([HAS_POSIX_AIO], [false])])])
AC_CHECK_LIB([aio], [io_submit],
[AM_CONDITIONAL([HAS_LINUX_LIBAIO], [true])
AC_DEFINE([HAS_LINUX_LIBAIO],[1],[Has linux AIO e.g. io_submit])],
[AM_CONDITIONAL([HAS_LINUX_LIBAIO], [false])])
AC_CHECK_LIB([ssl], [SSL_library_init])
# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS([inttypes.h limits.h stddef.h stdlib.h string.h strings.h unistd.h malloc.h fcntl.h fcntl.h sys/statvfs.h])
AC_LANG_PUSH(C++)
AC_CHECK_HEADERS([parallel/algorithm])
AC_LANG_POP(C++)
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_C_RESTRICT
AC_TYPE_SIZE_T
# Checks for library functions.
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_FUNC_REALLOC
AC_FUNC_STAT
AC_CHECK_FUNCS([clock_gettime floor ftruncate memset mkdir munmap strdup strerror sync_file_range posix_fadvise fstatfs readahead])
AC_CHECK_DECLS([__sync_fetch_and_add])
# Custom check to append a default CFLAG if it is available.
# ------
AC_DEFUN([AX_ADD_CFLAG],
[
AC_LANG_PUSH(C)
AC_REQUIRE([AC_LANG_PROGRAM])
AC_MSG_CHECKING([C compiler flags for $1])
SAVECFLAGS=$CFLAGS
CFLAGS="$CFLAGS $1"
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([
],
[
return 0;
])],
[
AC_MSG_RESULT(yes)
],
[
AC_MSG_RESULT(no)
CFLAGS=$SAVECFLAGS
] )
unset SAVECFLAGS
AC_LANG_POP(C)
])# AX_ADD_CFLAG
# Custom check to append a default CFLAG if it is available.
# ------
AC_DEFUN([AX_ADD_CXXFLAG],
[
AC_LANG_PUSH(C++)
AC_REQUIRE([AC_LANG_PROGRAM])
AC_MSG_CHECKING([C++ compiler flags for $1])
SAVECXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS $1"
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([
],
[
return 0;
])],
[
AC_MSG_RESULT(yes)
],
[
AC_MSG_RESULT(no)
CXXFLAGS=$SAVECXXFLAGS
] )
unset SAVECXXFLAGS
AC_LANG_POP(C++)
])# AX_ADD_CFLAG
# Add our default flags if no custom flags were specified.
[if [ -z "$CUSTOMCFLAGS" ]]
then
AC_MSG_NOTICE([Using default C compiler flags])
AX_ADD_CFLAG([-std=gnu99])
AX_ADD_CFLAG([-Wall])
AX_ADD_CFLAG([-m64 -D_64_BIT])
# Add support for OpenMP if available
AX_ADD_CFLAG([-fopenmp])
AX_ADD_CFLAG([-fnested-functions])
# This flag is needed on older redhats to get posix read/write locks
AX_ADD_CFLAG([-D_XOPEN_SOURCE=600])
[if [ "$PROFILE" ]]
then
AX_ADD_CFLAG([-pg])
fi
[if [ -z "$DEBUG" ]]
then
AX_ADD_CXXFLAG([-g])
AX_ADD_CFLAG([-O4])
AX_ADD_CFLAG([-fomit-frame-pointer])
AX_ADD_CFLAG([-DEXTRA_CHECKS=0])
AX_ADD_CFLAG([-march=native])
AX_ADD_CFLAG([-mtune=native])
else
AX_ADD_CFLAG([-g])
AX_ADD_CFLAG([-DEXTRA_CHECKS=1])
fi
else
AC_MSG_NOTICE([Using provided C compiler flags])
fi
[if [ -z "$CUSTOMCXXFLAGS" ]]
then
AC_MSG_NOTICE([Using default C++ compiler flags])
# AX_ADD_CXXFLAG([-std=gnu99])
AX_ADD_CXXFLAG([-Wall])
# AX_ADD_CXXFLAG([-Weffc++]) These seem to be noisy and not totally useful.
AX_ADD_CXXFLAG([-m64 -D_64_BIT])
# AX_ADD_CXXFLAG([-fnested-functions]) not supported in C++
# Add support for OpenMP if available
AX_ADD_CXXFLAG([-fopenmp])
# This flag is needed on older redhats to get posix read/write locks
AX_ADD_CXXFLAG([-D_XOPEN_SOURCE=600])
[if [ "$PROFILE" ]]
then
AX_ADD_CXXFLAG([-pg])
fi
[if [ -z "$DEBUG" ]]
then
AX_ADD_CXXFLAG([-g])
AX_ADD_CXXFLAG([-O4])
AX_ADD_CXXFLAG([-fomit-frame-pointer])
AX_ADD_CXXFLAG([-DEXTRA_CHECKS=0])
AX_ADD_CXXFLAG([-march=native])
AX_ADD_CXXFLAG([-mtune=native])
else
AX_ADD_CXXFLAG([-g])
AX_ADD_CXXFLAG([-DEXTRA_CHECKS=1])
fi
else
AC_MSG_NOTICE([Using provided C++ compiler flags])
fi
AC_CONFIG_FILES([Makefile
src/Makefile
src/re2/Makefile
src/utils/Makefile
src/utils_cc/Makefile
src/mpi/Makefile
src/main/Makefile
src/main_cc/Makefile
src/dcx_cc/Makefile
src/test/Makefile
src/scripts/Makefile
src/mod_femto/Makefile
])
# src/dcy/Makefile
AC_OUTPUT