forked from cruppstahl/upscaledb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
298 lines (269 loc) · 7.42 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
dnl
dnl configuration script for hamsterdb
dnl
dnl Copyright (C) 2005-2008 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, 1.1.13)
AC_CONFIG_SRCDIR(src/hamsterdb.c)
AC_CONFIG_AUX_DIR(build/scripts)
AM_INIT_AUTOMAKE(hamsterdb, 1.10)
AM_CONFIG_HEADER(config.h)
AC_PROG_CC
AC_PROG_CXX
AC_PROG_RANLIB
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
AC_PROG_INSTALL
AC_HEADER_STDC
AC_C_CONST
AC_TYPE_SIZE_T
AC_CHECK_FUNCS(mmap munmap getpagesize fdatasync fsync)
AC_CHECK_HEADERS(fcntl.h unistd.h malloc.h)
AC_TYPE_OFF_T
AC_FUNC_MMAP
AC_CANONICAL_SYSTEM
# 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"
#
# 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
#
# 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
#
# track 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.4 - 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__ >= 4)
#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])
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)
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
printf '#================================================================\n'
# build protobuf files
if test "x$enable_remote" != "xno"; then
cd src/protocol && make proto
fi