forked from cruppstahl/upscaledb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.in
358 lines (326 loc) · 11.8 KB
/
configure.in
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
354
355
356
dnl
dnl configuration script for hamsterdb
dnl
dnl Copyright (C) 2005-2011 Christoph Rupp ([email protected]).
dnl All rights reserved. See file LICENSE for licence and copyright
dnl information
dnl
dnl Initialize autoconf/automake
AC_INIT(hamsterdb, 2.0.2)
AC_CANONICAL_HOST
AC_CONFIG_SRCDIR(src/hamsterdb.cc)
AC_CONFIG_MACRO_DIR(m4)
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(config.h)
AC_COPYRIGHT([
Copyright (C) 2005-2012 Christoph Rupp ([email protected])
])
AC_PROG_CC
AC_PROG_CC_STDC
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_CXX
LT_INIT # replaces AC_PROG_RANLIB
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
AC_PROG_INSTALL
AC_PROG_SED
AC_HEADER_STDC
AC_C_CONST
AC_TYPE_SIZE_T
AC_CHECK_FUNCS(mmap munmap getpagesize fdatasync fsync writev)
AC_CHECK_HEADERS(fcntl.h unistd.h malloc.h)
AC_TYPE_OFF_T
AC_FUNC_MMAP
BOOST_REQUIRE()
# ARM emulators w/ qemu: disable pread/pwrite; the functions exist, but
# seem to be buggy
case $host in
arm-*-linux-gnu)
;;
*)
AC_CHECK_FUNCS(pread pwrite)
;;
esac
# A string describing all enabled/disabled settings
settings=""
# Default settings: -Wall
CFLAGS="${CFLAGS} -Wall"
# -------------------------------------------------------------------------
# Enable debug mode?
# -------------------------------------------------------------------------
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],
[Build with diagnostics and debug symbols (slow!)]))
if test "$enable_debug" = "yes"
then
CFLAGS=`echo "$CFLAGS" | sed 's/-O. / /g'`
CFLAGS="${CFLAGS} -g -DHAM_DEBUG"
settings="$settings (debug)"
fi
# -------------------------------------------------------------------------
# Overwrite JDK path; if $JDK is empty then fallback to $JAVA_HOME
# -------------------------------------------------------------------------
AC_ARG_WITH(jdk, [ --with-jdk=[PATH] set JDK path])
if test "$with_jdk" != ""
then
JDK="$with_jdk"
fi
if test -d "$JDK"
then
printf ""
else
JDK="$JAVA_HOME"
fi
# -------------------------------------------------------------------------
# Disable java wrapper?
# -------------------------------------------------------------------------
AC_ARG_ENABLE(java,
AC_HELP_STRING([--disable-java],
[Do not build the Java wrapper]))
if test "$enable_java" = "no"; then
settings="$settings (no java)"
else
if test "$JDK" = ""; then
settings="$settings (no java)"
enable_java="no"
fi
fi
AM_CONDITIONAL(ENABLE_JAVA, test "x$enable_java" != "xno")
if test "x$enable_java" != "xno"
then
if test -d "$JDK"
then
AC_MSG_RESULT(["Found JDK at $JDK"])
else
AC_MSG_ERROR(["JDK not found - please either set JDK or JAVA_HOME, or use the switch --with-jdk=PATH"])
exit -1
fi
CFLAGS="${CFLAGS} -I$JDK/include -I$JDK/include/linux -I$JDK/include/solaris -I$JDK/include/mac"
settings="$settings (java)"
fi
# -------------------------------------------------------------------------
# Enable profiling mode
# -------------------------------------------------------------------------
AC_ARG_ENABLE(profile,
AC_HELP_STRING([--enable-profile],
[Build with profiling information (gprof)]))
if test "$enable_profile" = "yes"
then
CFLAGS="${CFLAGS} -pg"
settings="$settings (profile)"
fi
# -------------------------------------------------------------------------
# Enable test coverage
# -------------------------------------------------------------------------
AC_ARG_ENABLE(gcov,
AC_HELP_STRING([--enable-gcov],
[Build with test coverage information (gconf)]))
if test "$enable_gcov" = "yes"
then
CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage"
settings="$settings (test-coverage)"
fi
# -------------------------------------------------------------------------
# Enable internal functions (obsolete)
# -------------------------------------------------------------------------
AC_ARG_ENABLE(internal,
AC_HELP_STRING([--enable-internal],
[obsolete; internal functions are now enabled by default]))
# -------------------------------------------------------------------------
# Disable AES encryption
# -------------------------------------------------------------------------
AC_ARG_ENABLE(encryption,
AC_HELP_STRING([--disable-encryption],
[Disable AES encryption (ham_enable_encryption)]))
if test "$enable_encryption" = "no"; then
CFLAGS="${CFLAGS} -DHAM_DISABLE_ENCRYPTION"
settings="$settings (no encryption)"
fi
AM_CONDITIONAL(ENABLE_ENCRYPTION, test "x$enable_encryption" != "xno")
# -------------------------------------------------------------------------
# Disable zlib compression
# -------------------------------------------------------------------------
AC_ARG_ENABLE(compression,
AC_HELP_STRING([--disable-compression],
[Disable zlib compression (ham_enable_compression)]))
if test "$enable_compression" = "no"; then
CFLAGS="${CFLAGS} -DHAM_DISABLE_COMPRESSION"
settings="$settings (no compression)"
fi
AM_CONDITIONAL(ENABLE_COMPRESSION, test "x$enable_compression" != "xno")
# -------------------------------------------------------------------------
# Disable server
# -------------------------------------------------------------------------
AC_ARG_ENABLE(server,
AC_HELP_STRING([--disable-server],
[Disable build of the server (hamsvr)]))
if test "$enable_server" = "no"; then
settings="$settings (no server)"
fi
AM_CONDITIONAL(ENABLE_SERVER, test "x$enable_server" != "xno")
# -------------------------------------------------------------------------
# Use system zlib
# -------------------------------------------------------------------------
AC_ARG_ENABLE(system-zlib,
AC_HELP_STRING([--enable-system-zlib],
[Use an already installed zlib]))
if test "$enable_system_zlib" = "yes"
then
CFLAGS="${CFLAGS} -DHAM_USE_SYSTEM_ZLIB"
settings="$settings (system-zlib)"
fi
AM_CONDITIONAL(SYSTEM_ZLIB, test "x$enable_system_zlib" == "xyes")
# -------------------------------------------------------------------------
# Check for little endian/big endian
# -------------------------------------------------------------------------
AC_C_BIGENDIAN(
ac_big_endian=yes,
ac_big_endian=no,
ac_big_endian=no)
if test $ac_big_endian = yes; then
CFLAGS="${CFLAGS} -DHAM_BIG_ENDIAN"
settings="$settings (big endian)"
else
CFLAGS="${CFLAGS} -DHAM_LITTLE_ENDIAN"
settings="$settings (little endian)"
fi
# -------------------------------------------------------------------------
# Check for __FUNCTION__ macro
# -------------------------------------------------------------------------
AC_CACHE_CHECK(whether the compiler supports __FUNCTION__ macro,
ac_cv_FUNCTION1,
[AC_TRY_RUN([
int main(void) {
char *p=__FUNCTION__;
return 0;
}],ac_cv_FUNCTION1=yes,ac_cv_FUNCTION1=no,ac_cv_FUNCTION1=no)])
if test $ac_cv_FUNCTION1 = yes; then
AC_DEFINE(HAVE_FUNCTION_MACRO,1,[__FUNCTION__ is supported])
fi
# -------------------------------------------------------------------------
# Check if we use gcc >= 4.3 - if yes, disable some optimizations
# -------------------------------------------------------------------------
AC_CACHE_CHECK(whether we need -fno-tree-vectorize,
ac_cv_FUNCTION2,
[AC_TRY_RUN([
int main(void) {
#if !(__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
#error "this gcc is ok"
#endif
return 0;
}],ac_cv_FUNCTION2=yes,ac_cv_FUNCTION2=no,ac_cv_FUNCTION2=no)])
if test $ac_cv_FUNCTION2 = yes; then
CFLAGS="${CFLAGS} -fno-tree-vectorize"
fi
# -------------------------------------------------------------------------
# Check for O_LARGEFILE
# -------------------------------------------------------------------------
AC_CACHE_CHECK(for support of the O_LARGEFILE flag,ac_cv_largefile,
[AC_TRY_RUN([
#define _GNU_SOURCE 1 /* for O_LARGEFILE */
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <fcntl.h>
int main(void) {
int i=(int)O_LARGEFILE;
return 0;
}],ac_cv_largefile=yes,ac_cv_largefile=no,ac_cv_largefile=no)])
if test $ac_cv_largefile = yes; then
AC_DEFINE(HAVE_O_LARGEFILE,1,[flag O_LARGEFILE is supported])
CFLAGS="${CFLAGS} -D_FILE_OFFSET_BITS=64"
fi
# -------------------------------------------------------------------------
# Check for O_NOATIME
# -------------------------------------------------------------------------
AC_CACHE_CHECK(for support of the O_NOATIME flag,ac_cv_noatime,
[AC_TRY_RUN([
#define _GNU_SOURCE 1 /* for O_NOATIME */
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <fcntl.h>
int main(void) {
int i=(int)O_NOATIME;
return i;
}],ac_cv_noatime=yes,ac_cv_noatime=no,ac_cv_noatime=no)])
if test $ac_cv_noatime = yes; then
AC_DEFINE(HAVE_O_NOATIME,1,[flag O_NOATIME is supported])
fi
# -------------------------------------------------------------------------
# Check if protocol buffers are installed
# -------------------------------------------------------------------------
AC_LANG(C++)
AC_CACHE_CHECK(if google protocol buffers are installed,ac_cv_protobuf,
[AC_TRY_RUN([
#include <google/protobuf/message.h>
int main(void) {
return 0;
}],ac_cv_protobuf=yes,ac_cv_protobuf=no,ac_cv_protobuf=no)])
if test "x$enable_remote" != "xno"; then
if test "x$ac_cv_protobuf" = "xno"; then
settings="$settings (protobuf missing - remote disabled)"
enable_remote="no"
fi
fi
AC_LANG(C)
# -------------------------------------------------------------------------
# Check if libcurl is installed
# -------------------------------------------------------------------------
AC_CACHE_CHECK(if libcurl is installed,ac_cv_libcurl,
[AC_TRY_RUN([
#include <curl/curl.h>
int main(void) {
return 0;
}],ac_cv_libcurl=yes,ac_cv_libcurl=no,ac_cv_libcurl=no)])
if test "x$enable_remote" != "xno"; then
if test "x$ac_cv_libcurl" = "xno"; then
settings="$settings (libcurl missing - remote disabled)"
enable_remote="no"
fi
fi
# -------------------------------------------------------------------------
# Disable remote client
# -------------------------------------------------------------------------
AC_ARG_ENABLE(remote,
AC_HELP_STRING([--disable-remote],
[Disable access to remote databases]))
if test "$enable_remote" = "no"; then
settings="$settings (no remote access)"
fi
AM_CONDITIONAL(ENABLE_REMOTE, test "x$enable_remote" != "xno")
# -------------------------------------------------------------------------
# Solaris: add a flag
# -------------------------------------------------------------------------
case $host in
*-solaris*)
CFLAGS="${CFLAGS} -DHAM_SOLARIS"
;;
*)
;;
esac
CXXFLAGS=${CFLAGS}
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
AC_CONFIG_FILES(Makefile src/Makefile src/protocol/Makefile include/Makefile include/ham/Makefile samples/Makefile unittests/Makefile 3rdparty/Makefile 3rdparty/aes/Makefile 3rdparty/zlib/Makefile 3rdparty/json/Makefile 3rdparty/mongoose/Makefile tools/Makefile src/server/Makefile java/Makefile java/java/Makefile java/src/Makefile java/unittests/Makefile)
AC_OUTPUT
# Messages
printf '#================================================================\n'
printf "# Configuring hamsterdb version $PACKAGE_VERSION\n"
printf "# Settings:$settings\n"
if test "x$enable_remote" = "xno"; then
printf "#\n"
printf "# The remote functionality is disabled because you specified\n"
printf "# --disable-remote or because of missing dependencies!\n"
fi
if test "x$enable_java" = "xno"; then
printf "#\n"
printf "# The Java API is not built because you specified\n"
printf "# --disable-java or because \$JDK is not set\n"
fi
printf '#================================================================\n'
# build protobuf files
if test "x$enable_remote" != "xno"; then
cd src/protocol && make proto
fi