-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.ac
348 lines (304 loc) · 12.6 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
# Process this file with autoreconf to generate a configure script
AC_INIT([clusterlib], [0.9])
# Use Automake for writing Makefiles
AM_INIT_AUTOMAKE([-Wall])
# Use libtool to generate libraries
# LT_PREREQ([1.5])
# Minimum Autoconf version
AC_PREREQ(2.59)
# Safety check to enure that the source directory is correct
AC_CONFIG_SRCDIR([src/include/clusterlib.h])
# Look for the C++ compiler
AC_PROG_CXX
# Find the install program
AC_PROG_INSTALL
# Look for the libtool
AC_PROG_LIBTOOL
# Enable large file support when possible
AC_SYS_LARGEFILE
# Allow per-product flags
AM_PROG_CC_C_O
# Use C++ for all compilation tests (otherwise defaults to gcc and all
# AC_CHECK_HEADER checks will fail for C++ libraries)
AC_LANG([C++])
# Boost regex header and library must exist (C++ style)
AC_CHECK_HEADER([boost/regex.hpp],,
AC_MSG_ERROR([boost/regex.hpp not found. Exiting.]))
AC_CHECK_LIB([boost_regex], [main],,
AC_MSG_ERROR([boost_regex library not found. Exiting.]))
# Check for pthread library
AC_SEARCH_LIBS([pthread_create], [pthread], [have_pthread=yes])
# Pthreads are required
if test "x${have_pthread}" = xno; then
echo "------------------------------------------"
echo " The pthread library and header file is "
echo " required to build clusterlib. Stopping..."
echo " Check 'config.log' for more information. "
echo "------------------------------------------"
(exit 1); exit 1;
fi
# ZooKeeper header must exist and library must exist
AC_CHECK_HEADER([zookeeper.h],,
AC_MSG_ERROR([zookeeper.h not found. Exiting.]))
AC_SEARCH_LIBS([zookeeper_init], [zookeeper_mt], [have_zookeeper=yes],
AC_MSG_ERROR([zookeeper_mt library not found. Exiting.]))
# Log4cxx header must exist and library must exist
AC_CHECK_HEADER([log4cxx/logger.h],,
AC_MSG_ERROR([log4cxx/logger.h not found. Exiting.]))
AC_CHECK_LIB([log4cxx], [main],,
AC_MSG_ERROR([log4cxx library not found. Exiting.]))
# Ncurses is not required, but would allows the CLI to use tab-completion
AC_CHECK_LIB([ncurses], [tputs],,
echo "------------------------------------------"
echo " The ncurses library "
echo " is required to get tab-completion. "
echo " The path should be specified in LDFLAGS. "
echo " Check 'config.log' for more information. "
echo "------------------------------------------"
)
# Readline is not required, but would allows the CLI to use tab-completion
AC_CHECK_HEADER([readline/readline.h],,
echo "------------------------------------------"
echo " The readline headers (i.e. readline/readline.h)"
echo " required get tab-completion are missing. "
echo " The path should be specified in CPPFLAGS."
echo " Check 'config.log' for more information. "
echo "------------------------------------------"
)
AC_CHECK_LIB([readline], [rl_line_buffer],,
echo "------------------------------------------"
echo " The readline library "
echo " is required to get tab-completion. "
echo " Check 'config.log' for more information. "
echo "------------------------------------------"
)
# Should build the GUI?
build_gui=true
# Apr-1 is not required, but would allow the GUI to be built.
# Check for the apr_getopt.h in either apr-1 or apr-1.0 (i.e. ubuntu)
AC_CHECK_FILE([/usr/include/apr-1/apr_getopt.h],
CPPFLAGS="${CPPFLAGS} -I/usr/include/apr-1"
AC_MSG_RESULT([Found /usr/include/apr-1/apr_getopt.h and adding /usr/include/apr-1 to CPPFLAGS.]))
AC_CHECK_FILE([/usr/include/apr-1.0/apr_getopt.h],
CPPFLAGS="${CPPFLAGS} -I/usr/include/apr-1.0"
AC_MSG_RESULT([Found /usr/include/apr-1.0/apr_getopt.h and adding /usr/include/apr-1.0 to CPPFLAGS.]))
AC_CHECK_HEADER([apr_getopt.h],,
echo "------------------------------------------"
echo " The apr-1 headers (i.e. apr_getopt.h) "
echo " required to build the GUI are missing. "
echo " The path should be specified in CPPFLAGS."
echo " Check 'config.log' for more information. "
echo "------------------------------------------"
build_gui=false)
AC_CHECK_LIB([apr-1], [main],,
echo "------------------------------------------"
echo " The apr-1 library "
echo " required to build the GUI is missing. "
echo " The path should be specified in LDFLAGS. "
echo " Check 'config.log' for more information. "
echo "------------------------------------------"
build_gui=false)
# Aprutil-1 is not required, but would allow the GUI to be built.
# Check for the apr_xml.h in either apr-1 or apr-1.0 (i.e. ubuntu)
AC_CHECK_FILE([/usr/include/apr-1/apr_xml.h],
CPPFLAGS="${CPPFLAGS} -I/usr/include/apr-1"
AC_MSG_RESULT([Found /usr/include/apr-1/apr_xml.h and adding /usr/include/apr-1 to CPPFLAGS.]))
AC_CHECK_FILE([/usr/include/apr-1.0/apr_xml.h],
CPPFLAGS="${CPPFLAGS} -I/usr/include/apr-1.0"
AC_MSG_RESULT([Found /usr/include/apr-1.0/apr_xml.h and adding /usr/include/apr-1.0 to CPPFLAGS.]))
AC_CHECK_HEADER([apr_xml.h],,
echo "------------------------------------------"
echo " The aprutil-1 headers (i.e. apr_xml.h) "
echo " required to build the GUI are missing. "
echo " The path should be specified in CPPFLAGS."
echo " Check 'config.log' for more information. "
echo "------------------------------------------"
build_gui=false)
AC_CHECK_LIB([aprutil-1], [main],,
echo "------------------------------------------"
echo " The aprutil-1 library "
echo " required to build the GUI is missing. "
echo " The path should be specified in LDFLAGS. "
echo " Check 'config.log' for more information. "
echo "------------------------------------------"
build_gui=false)
# Build the GUI unittests?
AC_ARG_ENABLE([gui_unittests],
[AS_HELP_STRING([--enable-gui_unittests],
[build GUI unittests] [default=no])],
[build_gui_unittests=true],
[build_gui_unittests=false])
# Boost unit_test_framework header and library must exist for GUI unittests
if test x${build_gui_unittests} = xtrue; then
AC_CHECK_HEADER([boost/test/auto_unit_test.hpp],,
AC_MSG_ERROR([boost/test/auto_unit_test.hpp not found for GUI unittests. Exiting.]))
AC_CHECK_LIB([boost_unit_test_framework], [main],,
AC_MSG_ERROR([boost_unit_test_framework library not found for GUI unittests. Exiting.]))
fi
AM_CONDITIONAL(BUILD_GUI_UNITTESTS, [test "x${build_gui_unittests}" = x"true"])
# Microhttpd is not required, but would allow the GUI to be built.
AC_CHECK_HEADER([microhttpd.h],,
echo "------------------------------------------"
echo " The microhttpd headers (i.e. microhttpd.h)"
echo " required to build the GUI are missing. "
echo " The path should be specified in CPPFLAGS."
echo " Check 'config.log' for more information. "
echo "------------------------------------------"
build_gui=false)
AC_CHECK_LIB([microhttpd], [main],,
echo "------------------------------------------"
echo " The microhttpd library "
echo " required to build the GUI is missing. "
echo " The path should be specified in LDFLAGS. "
echo " Check 'config.log' for more information. "
echo "------------------------------------------"
build_gui=false)
# Microhttpd > 0.9 needs size_t max, otherwise int max
mhd_max_type=int
if test x${build_gui} = xtrue; then
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <microhttpd.h>
]],
[[
#if MHD_VERSION >= 0x00090000
// MHD_VERSION >= 0x00090000 needs size_t max, not int max
#else
# MHD_VERSION is too low
#endif
]])],
mhd_max_type=size_t
[AC_MSG_RESULT([[The libmicrohttpd version is >= 0.9 and will use size_t max.]])],
[AC_MSG_RESULT([[The libmicrohttpd version is < 0.9 and will use int max.]])]
)
fi
if test "x${mhd_max_type}" = x"size_t"; then
AC_DEFINE([MHD_MAX_SIZE_T], [1], [Use size_t for MHD max])
fi
AM_CONDITIONAL(BUILD_GUI, [test "x${build_gui}" = x"true"])
# Mpich binaries (mpiexec, mpd) are required for unittests to be run
AC_PATH_PROG([MPIEXEC], [mpiexec])
if test x${MPIEXEC} = x; then
echo "------------------------------------------"
echo " Mpiexec is required to run the "
echo " unittests and cannot be found. "
echo " Check 'config.log' for more information. "
echo "------------------------------------------"
fi
AC_PATH_PROG([MPD], [mpd])
if test x${MPD} = x; then
echo "------------------------------------------"
echo " Mpd is required to run the "
echo " unittests and cannot be found. "
echo " Check 'config.log' for more information. "
echo "------------------------------------------"
fi
# ZooKeeper jar file locations are required to run the unittests
AC_ARG_WITH([zookeeper_jars_path],
[AS_HELP_STRING([--with-zookeeper-jars-path],
[location of ZooKeeper jar files])],
[case "${withval}" in yes|no)
AC_ERROR(Option --with-zookeeper-jars-path requires a path argument.)
;;
esac
AC_MSG_RESULT([Using $with_zookeeper_jars_path for zookeeper jars path])
])
ZOOKEEPER_JARS_PATH="${with_zookeeper_jars_path}"
AC_SUBST(ZOOKEEPER_JARS_PATH)
if test x${ZOOKEEPER_JARS_PATH} = x; then
echo "------------------------------------------"
echo " Zookeeper jars path is not found and "
echo " needed for the unittests (start/stop zk)."
echo " See option --with-zookeeper-jars-path. "
echo " Check 'config.log' for more information. "
echo "------------------------------------------"
fi
# Should build the unittests?
build_unittests=true
AC_PATH_PROG([MPICXX], [mpicxx])
if test x${MPICXX} = x; then
echo "------------------------------------------"
echo " mpicxx is required to compile "
echo " unittests and cannot be found. "
echo " Check 'config.log' for more information. "
echo "------------------------------------------"
build_unittests=false
fi
# Cppunit is not required, but would allow the unittests to be built.
AC_CHECK_HEADER([cppunit/ui/text/TestRunner.h],,
echo "------------------------------------------"
echo " The cppunit headers (i.e. cppunit/ui/text/TestRunner.h)"
echo " required to build unittests are missing. "
echo " The path should be specified in CPPFLAGS."
echo " Check 'config.log' for more information. "
echo "------------------------------------------"
build_unittests=false)
AC_CHECK_LIB([cppunit], [main],,
echo "------------------------------------------"
echo " The cppunit library "
echo " required to build unittests is missing. "
echo " The path should be specified in LDFLAGS. "
echo " Check 'config.log' for more information. "
echo "------------------------------------------"
build_unittests=false)
AM_CONDITIONAL(BUILD_UNITTESTS, [test "x${build_unittests}" = x"true"])
# Check to see if the following headers exist
AC_CHECK_HEADERS([pthread.h sys/epoll.h arpa/inet.h fcntl.h inttypes.h netdb.h stdlib.h string.h strings.h sys/socket.h sys/syscall.h sys/time.h unistd.h boost/test/auto_unit_test.hpp readline/readline.h apr_getopt.h apr_xml.h mach/mach.h])
# Generate a header file from configure with various configure output
AC_CONFIG_HEADERS([config.h])
# Check for various library functions
AC_CHECK_FUNCS([atexit bzero clock_gettime dup2 gethostname gettimeofday memset socket strdup strerror strtol mach_thread_self])
# Get the build path for doxygen
BUILD_PATH="`pwd`"
AC_SUBST(BUILD_PATH)
AC_CONFIG_FILES([
Makefile
src/Makefile
src/activenode/Makefile
src/cli/Makefile
src/core/Makefile
src/core/md5/Makefile
src/example/Makefile
src/gui/Makefile
src/gui/src/Makefile
src/gui/unittest/Makefile
src/gui/conf/config.xml
src/gui/conf/Makefile
src/include/Makefile
misc/Makefile
unittests/Makefile
unittests/unittestsHelper.pl
docs/doxygen-internal/doxygenInternalConfig
docs/doxygen-user/doxygenUserConfig])
# Default is release build, otherwise its debug
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug], [enable debug build] [default=no])],
[], [enable_debug=no])
# Disable Werror
AC_ARG_ENABLE([werror],
[AS_HELP_STRING([--disable-werror], [allow warnings] [default=no])],
[], [disable_werror=no])
# Set some general CXXFLAGS
GENERAL_CXXFLAGS="-Wall -g -rdynamic -D__STDC_FORMAT_MACROS -fno-strict-aliasing"
if test "x${enable_debug}" = xno; then
GENERAL_CXXFLAGS="${GENERAL_CXXFLAGS} -O3"
else
GENERAL_CXXFLAGS="${GENERAL_CXXFLAGS} -O0"
fi
# Add the Werror flags unless disabled
if test "x${disable_werror}" = xno; then
GENERAL_CXXFLAGS="$GENERAL_CXXFLAGS -Werror"
fi
AC_SUBST(GENERAL_CXXFLAGS)
# No extra CXXFLAGS should be added if none were specified
if test "x$ac_cv_env_CXXFLAGS_set" = x; then
CXXFLAGS=""
fi
if test "x${ac_cv_sys_file_offset_bits}" = xno; then
AC_DEFINE([_DARWIN_FEATURE_64_BIT_INODE], [1], [Make sure stat is 64 bit])
fi
AC_OUTPUT