-
Notifications
You must be signed in to change notification settings - Fork 3
/
configure.in
362 lines (313 loc) · 10.5 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
357
358
359
360
361
362
# Source of configuration for Tokyo Cabinet
#================================================================
# Generic Settings
#================================================================
# Package name
AC_INIT(tokyocabinet, 1.4.47)
# Package information
MYLIBVER=9
MYLIBREV=10
MYFORMATVER="1.0"
# Targets
MYHEADERFILES="tcutil.h tchdb.h tcbdb.h tcfdb.h tctdb.h tcadb.h"
MYLIBRARYFILES="libtokyocabinet.a"
MYLIBOBJFILES="tcutil.o tchdb.o tcbdb.o tcfdb.o tctdb.o tcadb.o myconf.o md5.o"
MYCOMMANDFILES="tcutest tcumttest tcucodec tchtest tchmttest tchmgr"
MYCOMMANDFILES="$MYCOMMANDFILES tcbtest tcbmttest tcbmgr tcftest tcfmttest tcfmgr"
MYCOMMANDFILES="$MYCOMMANDFILES tcttest tctmttest tctmgr tcatest tcamttest tcamgr"
MYCGIFILES="tcawmgr.cgi"
MYMAN1FILES="tcutest.1 tcumttest.1 tcucodec.1 tchtest.1 tchmttest.1 tchmgr.1"
MYMAN1FILES="$MYMAN1FILES tcbtest.1 tcbmttest.1 tcbmgr.1 tcftest.1 tcfmttest.1 tcfmgr.1"
MYMAN1FILES="$MYMAN1FILES tcttest.1 tctmttest.1 tctmgr.1 tcatest.1 tcamttest.1 tcamgr.1"
MYMAN3FILES="tokyocabinet.3 tcutil.3 tcxstr.3 tclist.3 tcmap.3 tctree.3 tcmdb.3 tcmpool.3"
MYMAN3FILES="$MYMAN3FILES tchdb.3 tcbdb.3 tcfdb.3 tctdb.3 tcadb.3"
MYDOCUMENTFILES="COPYING ChangeLog doc tokyocabinet.idl"
MYPCFILES="tokyocabinet.pc"
# Building flags
MYCFLAGS="-std=c99 -Wall -fPIC -fsigned-char -O2"
MYCPPFLAGS="-I. -I\$(INCLUDEDIR) -I$HOME/include -I/usr/local/include"
MYCPPFLAGS="$MYCPPFLAGS -DNDEBUG -D_GNU_SOURCE=1 -D_REENTRANT -D__EXTENSIONS__"
MYLDFLAGS="-L. -L\$(LIBDIR) -L$HOME/lib -L/usr/local/lib"
MYCMDLDFLAGS=""
MYRUNPATH="\$(LIBDIR)"
MYLDLIBPATHENV="LD_LIBRARY_PATH"
MYPOSTCMD="true"
# Building paths
PATH="$PATH:$HOME/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin"
PATH="$PATH:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/xpg4/bin:/usr/xpg6/bin:/usr/ucb"
CPATH="$HOME/include:/usr/local/include:$CPATH"
LIBRARY_PATH="$HOME/lib:/usr/local/lib:$LIBRARY_PATH"
LD_LIBRARY_PATH="$HOME/lib:/usr/local/lib:$LD_LIBRARY_PATH"
PKG_CONFIG_PATH="$HOME/lib/pkgconfig:/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
export PATH CPATH LIBRARY_PATH LD_LIBRARY_PATH PKG_CONFIG_PATH
#================================================================
# Options
#================================================================
# Internal variables
enables=""
# Debug mode
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug], [build for debugging]))
if test "$enable_debug" = "yes"
then
MYCFLAGS="-std=c99 -Wall -fPIC -pedantic -fsigned-char -g -O0"
MYCPPFLAGS="$MYCPPFLAGS -UNDEBUG"
MYCMDLDFLAGS="$MYCMDLDFLAGS -static"
enables="$enables (debug)"
fi
# Developping mode
AC_ARG_ENABLE(devel,
AC_HELP_STRING([--enable-devel], [build for development]))
if test "$enable_devel" = "yes"
then
MYCFLAGS="-std=c99 -Wall -fPIC -pedantic -fsigned-char -g -O2 -pipe"
MYCPPFLAGS="$MYCPPFLAGS -UNDEBUG"
enables="$enables (devel)"
fi
# Profiling mode
AC_ARG_ENABLE(profile,
AC_HELP_STRING([--enable-profile], [build for profiling]))
if test "$enable_profile" = "yes"
then
MYCFLAGS="-std=c99 -Wall -fPIC -pedantic -fsigned-char -g -pg -O2 -pipe"
enables="$enables (profile)"
fi
# Static mode
AC_ARG_ENABLE(static,
AC_HELP_STRING([--enable-static], [build by static linking]))
if test "$enable_static" = "yes"
then
MYCMDLDFLAGS="$MYCMDLDFLAGS -static"
enables="$enables (static)"
fi
# Fastest mode
AC_ARG_ENABLE(fastest,
AC_HELP_STRING([--enable-fastest], [build for fastest run]))
if test "$enable_fastest" = "yes"
then
MYLIBOBJFILES="tokyocabinet_all.o"
MYCFLAGS="-std=c99 -Wall -fPIC -pedantic -fsigned-char -O3"
MYCFLAGS="$MYCFLAGS -fomit-frame-pointer -fforce-addr -minline-all-stringops"
MYCPPFLAGS="$MYCPPFLAGS -D_MYFASTEST"
enables="$enables (fastest)"
fi
# 64-bit offset mode
AC_ARG_ENABLE(off64,
AC_HELP_STRING([--enable-off64], [build with 64-bit file offset on 32-bit system]))
if test "$enable_off64" = "yes"
then
MYCPPFLAGS="$MYCPPFLAGS -D_FILE_OFFSET_BITS=64"
enables="$enables (off64)"
fi
# Swapping byte-orders mode
AC_ARG_ENABLE(swab,
AC_HELP_STRING([--enable-swab], [build for swapping byte-orders]))
if test "$enable_swab" = "yes"
then
MYCPPFLAGS="$MYCPPFLAGS -D_MYSWAB"
enables="$enables (swab)"
fi
# Micro yield mode
AC_ARG_ENABLE(uyield,
AC_HELP_STRING([--enable-uyield], [build for detecting race conditions]))
if test "$enable_uyield" = "yes"
then
MYCPPFLAGS="$MYCPPFLAGS -D_MYMICROYIELD"
enables="$enables (uyield)"
fi
# Disable the unified buffer cache assumption
AC_ARG_ENABLE(ubc,
AC_HELP_STRING([--disable-ubc], [build without the unified buffer cache assumption]))
if test "$enable_ubc" = "no"
then
MYCPPFLAGS="$MYCPPFLAGS -D_MYNOUBC"
enables="$enables (no-ubc)"
fi
# Disable ZLIB compression
AC_ARG_ENABLE(zlib,
AC_HELP_STRING([--disable-zlib], [build without ZLIB compression]))
if test "$enable_zlib" = "no"
then
MYCPPFLAGS="$MYCPPFLAGS -D_MYNOZLIB"
enables="$enables (no-zlib)"
fi
# Disable BZIP2 compression
AC_ARG_ENABLE(bzip,
AC_HELP_STRING([--disable-bzip], [build without BZIP2 compression]))
if test "$enable_bzip" = "no"
then
MYCPPFLAGS="$MYCPPFLAGS -D_MYNOBZIP"
enables="$enables (no-bzip)"
fi
# Disable POSIX thread
AC_ARG_ENABLE(pthread,
AC_HELP_STRING([--disable-pthread], [build without POSIX thread support]))
if test "$enable_pthread" = "no"
then
MYCPPFLAGS="$MYCPPFLAGS -D_MYNOPTHREAD"
enables="$enables (no-pthread)"
fi
# Disable shared object
AC_ARG_ENABLE(shared,
AC_HELP_STRING([--disable-shared], [avoid to build shared libraries]))
if test "$enable_shared" = "no"
then
enables="$enables (no-shared)"
fi
# Enable custom codec functions of LZMA
AC_ARG_ENABLE(exlzma,
AC_HELP_STRING([--disable-exlzma], [build with the custom codec of LZMA]))
if test "$enable_exlzma" = "yes"
then
MYCPPFLAGS="$MYCPPFLAGS -D_MYEXLZMA"
enables="$enables (exlzma)"
fi
# Enable custom codec functions of LZO
AC_ARG_ENABLE(exlzo,
AC_HELP_STRING([--disable-exlzo], [build with the custom codec of LZO]))
if test "$enable_exlzo" = "yes"
then
MYCPPFLAGS="$MYCPPFLAGS -D_MYEXLZO"
enables="$enables (exlzo)"
fi
# Specify the installation path of ZLIB
AC_ARG_WITH(zlib,
AC_HELP_STRING([--with-zlib=DIR], [search DIR/include and DIR/lib for ZLIB]))
if test -n "$with_zlib"
then
MYCPPFLAGS="$MYCPPFLAGS -I$with_zlib/include"
MYLDFLAGS="$MYLDFLAGS -L$with_zlib/lib"
MYRUNPATH="$MYRUNPATH:$with_zlib/lib"
CPATH="$CPATH:$with_zlib/include"
LIBRARY_PATH="$LIBRARY_PATH:$with_zlib/lib"
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$with_zlib/lib"
fi
# Specify the installation path of BZIP2
AC_ARG_WITH(bzip,
AC_HELP_STRING([--with-bzip=DIR], [search DIR/include and DIR/lib for BZIP2]))
if test -n "$with_bzip"
then
MYCPPFLAGS="$MYCPPFLAGS -I$with_bzip/include"
MYLDFLAGS="$MYLDFLAGS -L$with_bzip/lib"
MYRUNPATH="$MYRUNPATH:$with_bzip/lib"
CPATH="$CPATH:$with_bzip/include"
LIBRARY_PATH="$LIBRARY_PATH:$with_bzip/lib"
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$with_bzip/lib"
fi
# Messages
printf '#================================================================\n'
printf '# Configuring Tokyo Cabinet version %s%s.\n' "$PACKAGE_VERSION" "$enables"
printf '#================================================================\n'
#================================================================
# Checking Commands and Libraries
#================================================================
# C compiler
AC_PROG_CC
# Reset variables
if test "$GCC" != "yes"
then
AC_MSG_WARN([another compiler except for GCC was detected])
MYCFLAGS=""
fi
test -n "$CFLAGS" && MYCFLAGS="$CFLAGS $MYCFLAGS"
test -n "$CPPFLAGS" && MYCPPFLAGS="$CPPFLAGS $MYCPPFLAGS"
test -n "$LDFLAGS" && MYLDFLAGS="$LDFLAGS $MYLDFLAGS"
# Byte order
AC_C_BIGENDIAN(MYCPPFLAGS="$MYCPPFLAGS -D_MYBIGEND")
# Underlying libraries
AC_CHECK_LIB(c, main)
AC_CHECK_LIB(m, main)
if test "$enable_pthread" != "no"
then
AC_CHECK_LIB(pthread, main)
AC_CHECK_LIB(rt, main)
fi
if test "$enable_zlib" != "no"
then
AC_CHECK_LIB(z, main)
fi
if test "$enable_bzip" != "no"
then
AC_CHECK_LIB(bz2, main)
fi
if test "$enable_exlzma" = "yes"
then
AC_CHECK_LIB(lzma, main)
fi
if test "$enable_exlzo" = "yes"
then
AC_CHECK_LIB(lzo2, main)
fi
AC_CHECK_LIB(tokyocabinet, main, AC_MSG_WARN([old version of Tokyo Cabinet was detected]))
# Necessary headers
AC_CHECK_HEADER(stdlib.h, true, AC_MSG_ERROR([stdlib.h is required]))
AC_CHECK_HEADER(stdint.h, true, AC_MSG_ERROR([stdint.h is required]))
AC_CHECK_HEADER(unistd.h, true, AC_MSG_ERROR([unistd.h is required]))
AC_CHECK_HEADER(dirent.h, true, AC_MSG_ERROR([dirent.h is required]))
AC_CHECK_HEADER(regex.h, true, AC_MSG_ERROR([regex.h is required]))
AC_CHECK_HEADER(glob.h, true, AC_MSG_ERROR([glob.h is required]))
if test "$enable_pthread" != "no"
then
AC_CHECK_HEADER(pthread.h, true, AC_MSG_ERROR([pthread.h is required]))
fi
if test "$enable_zlib" != "no"
then
AC_CHECK_HEADER(zlib.h, true, AC_MSG_ERROR([zlib.h is required]))
fi
if test "$enable_bzip" != "no"
then
AC_CHECK_HEADER(bzlib.h, true, AC_MSG_ERROR([bzlib.h is required]))
fi
if test "$enable_exlzma" = "yes"
then
AC_CHECK_HEADER(lzmalib.h, true, AC_MSG_ERROR([lzmalib.h is required]))
fi
if test "$enable_exlzo" = "yes"
then
AC_CHECK_HEADER(lzo/lzo1x.h, true, AC_MSG_ERROR([lzo/lzo1x.h is required]))
fi
# Shared libraries
if test "$enable_shared" != "no" && test "$enable_profile" != "yes"
then
if uname | grep Darwin >/dev/null
then
MYLIBRARYFILES="$MYLIBRARYFILES libtokyocabinet.$MYLIBVER.$MYLIBREV.0.dylib"
MYLIBRARYFILES="$MYLIBRARYFILES libtokyocabinet.$MYLIBVER.dylib"
MYLIBRARYFILES="$MYLIBRARYFILES libtokyocabinet.dylib"
MYLDLIBPATHENV="DYLD_LIBRARY_PATH"
else
MYLIBRARYFILES="$MYLIBRARYFILES libtokyocabinet.so.$MYLIBVER.$MYLIBREV.0"
MYLIBRARYFILES="$MYLIBRARYFILES libtokyocabinet.so.$MYLIBVER"
MYLIBRARYFILES="$MYLIBRARYFILES libtokyocabinet.so"
fi
fi
#================================================================
# Generic Settings
#================================================================
# Export variables
AC_SUBST(MYLIBVER)
AC_SUBST(MYLIBREV)
AC_SUBST(MYFORMATVER)
AC_SUBST(MYHEADERFILES)
AC_SUBST(MYLIBRARYFILES)
AC_SUBST(MYLIBOBJFILES)
AC_SUBST(MYCOMMANDFILES)
AC_SUBST(MYCGIFILES)
AC_SUBST(MYMAN1FILES)
AC_SUBST(MYMAN3FILES)
AC_SUBST(MYDOCUMENTFILES)
AC_SUBST(MYPCFILES)
AC_SUBST(MYCFLAGS)
AC_SUBST(MYCPPFLAGS)
AC_SUBST(MYLDFLAGS)
AC_SUBST(MYCMDLDFLAGS)
AC_SUBST(MYRUNPATH)
AC_SUBST(MYLDLIBPATHENV)
AC_SUBST(MYPOSTCMD)
# Targets
AC_OUTPUT(Makefile tokyocabinet.pc)
# Messages
printf '#================================================================\n'
printf '# Ready to make.\n'
printf '#================================================================\n'
# END OF FILE