-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure.in
312 lines (259 loc) · 7.07 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
# Source of configuration for QDBM
#================================================================
# Generic Settings
#================================================================
# Targets
AC_INIT(qdbm, 1.8.78)
# Export variables
LIBVER=14
LIBREV=14
TARGETS="all"
MYDEFS=""
MYOPTS=""
MGWLIBS=""
LD="ld"
AR="ar"
# Building paths
pathtmp="$PATH"
PATH="$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
PATH="$PATH:/usr/ccs/bin:/usr/ucb:/usr/xpg4/bin:/usr/xpg6/bin:$pathtmp"
LIBRARY_PATH="$HOME/lib:/usr/local/lib:$LIBRARY_PATH"
LD_LIBRARY_PATH="$HOME/lib:/usr/local/lib:$LD_LIBRARY_PATH"
CPATH="$HOME/include:/usr/local/include:$CPATH"
export PATH LIBRARY_PATH LD_LIBRARY_PATH CPATH
#================================================================
# Options
#================================================================
# Internal variables
enables=""
ispthread=""
iszlib=""
isiconv=""
isnowarn=""
# Debug mode
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug], [build for debugging]))
if test "$enable_debug" = "yes"
then
TARGETS="debug"
enables="$enables (debug)"
fi
# Developping mode
AC_ARG_ENABLE(devel,
AC_HELP_STRING([--enable-devel], [build for development]))
if test "$enable_devel" = "yes"
then
TARGETS="devel"
enables="$enables (devel)"
fi
# Stable mode
AC_ARG_ENABLE(stable,
AC_HELP_STRING([--enable-stable], [build for stable release]))
if test "$enable_stable" = "yes"
then
TARGETS="stable"
enables="$enables (stable)"
fi
# Enable POSIX thread
AC_ARG_ENABLE(pthread,
AC_HELP_STRING([--enable-pthread], [use POSIX thread and make APIs thread-safe]))
if test "$enable_pthread" = "yes"
then
MYDEFS="$MYDEFS -DMYPTHREAD"
enables="$enables (pthread)"
ispthread="yes"
fi
# Disable file locking
AC_ARG_ENABLE(lock,
AC_HELP_STRING([--disable-lock], [build for environments without file locking]))
if test "$enable_lock" = "no"
then
MYDEFS="$MYDEFS -DMYNOLOCK"
enables="$enables (no-lock)"
fi
# Disable memory mapping
AC_ARG_ENABLE(mmap,
AC_HELP_STRING([--disable-mmap], [build for environments without memory mapping]))
if test "$enable_mmap" = "no"
then
MYDEFS="$MYDEFS -DMYNOMMAP"
enables="$enables (no-mmap)"
fi
# Enable ZLIB compression
AC_ARG_ENABLE(zlib,
AC_HELP_STRING([--enable-zlib], [feature ZLIB for B+ tree and inverted index]))
if test "$enable_zlib" = "yes"
then
MYDEFS="$MYDEFS -DMYZLIB"
MGWLIBS="-lz $MGWLIBS"
enables="$enables (zlib)"
iszlib="yes"
fi
# Enable LZO compression
AC_ARG_ENABLE(lzo,
AC_HELP_STRING([--enable-lzo], [feature LZO for B+ tree and inverted index]))
if test "$enable_lzo" = "yes"
then
MYDEFS="$MYDEFS -DMYLZO"
MGWLIBS="-llzo2 $MGWLIBS"
enables="$enables (lzo)"
islzo="yes"
fi
# Enable BZIP2 compression
AC_ARG_ENABLE(bzip,
AC_HELP_STRING([--enable-bzip], [feature BZIP2 for B+ tree and inverted index]))
if test "$enable_bzip" = "yes"
then
MYDEFS="$MYDEFS -DMYBZIP"
MGWLIBS="-lbz2 $MGWLIBS"
enables="$enables (bzip)"
isbzip="yes"
fi
# Enable ICONV utilities
AC_ARG_ENABLE(iconv,
AC_HELP_STRING([--enable-iconv], [feature ICONV utilities]))
if test "$enable_iconv" = "yes"
then
MYDEFS="$MYDEFS -DMYICONV"
MGWLIBS="-liconv $MGWLIBS"
enables="$enables (iconv)"
isiconv="yes"
fi
# No warning configuration
AC_ARG_ENABLE(warn,
AC_HELP_STRING([--disable-warn], [hide warnings in the configuration]))
if test "$enable_warn" = "no"
then
isnowarn="yes"
fi
# Messages
printf '#================================================================\n'
printf '# Configuring QDBM version %s%s.\n' "$PACKAGE_VERSION" "$enables"
printf '#================================================================\n'
#================================================================
# Checking Commands to Build with
#================================================================
# C compiler
AC_PROG_CC
if test "$GCC" != "yes"
then
if test "$isnowarn" != "yes"
then
printf '#================================================================\n' 1>&2
printf '# WARNING: GCC is required to build this package.\n' 1>&2
printf '#================================================================\n' 1>&2
fi
fi
if uname | egrep -i 'Linux' > /dev/null 2>&1 &&
uname -m | egrep '(x|i)(3|4|5|6|7|8|9)?86' > /dev/null 2>&1
then
MYOPTS="-minline-all-stringops"
fi
if uname | egrep -i 'SunOS' > /dev/null 2>&1
then
MYOPTS="-O1 -fno-omit-frame-pointer -fno-force-addr"
fi
if uname | egrep -i 'BSD' > /dev/null 2>&1
then
MYOPTS="-O1 -fno-omit-frame-pointer -fno-force-addr"
fi
if gcc --version | egrep -i '^2\.(8|9)' > /dev/null 2>&1
then
MYOPTS="-O1 -fno-omit-frame-pointer -fno-force-addr"
fi
# Linker
printf 'checking for ld... '
if which ld | grep '/ld$' > /dev/null 2>&1
then
LD=`which ld`
printf '%s\n' "$LD"
else
printf 'no\n'
if test "$isnowarn" != "yes"
then
printf '#================================================================\n' 1>&2
printf '# WARNING: ld is not found in PATH.\n' 1>&2
printf '#================================================================\n' 1>&2
fi
fi
# Archiver
printf 'checking for ar... '
if which ar | grep '/ar$' > /dev/null 2>&1
then
AR=`which ar`
printf '%s\n' "$AR"
else
printf 'no\n'
if test "$isnowarn" != "yes"
then
printf '#================================================================\n' 1>&2
printf '# WARNING: ar is not found in PATH.\n' 1>&2
printf '#================================================================\n' 1>&2
fi
fi
#================================================================
# Checking Libraries
#================================================================
# Underlying libraries
AC_CHECK_LIB(c, main)
# for pthread
if test "$ispthread" = "yes"
then
AC_CHECK_LIB(pthread, main)
fi
# for zlib
if test "$iszlib" = "yes"
then
AC_CHECK_LIB(z, main)
fi
# for lzo
if test "$islzo" = "yes"
then
AC_CHECK_LIB(lzo2, main)
fi
# for bzip
if test "$isbzip" = "yes"
then
AC_CHECK_LIB(bz2, main)
fi
# for iconv
if test "$isiconv" = "yes"
then
AC_CHECK_LIB(iconv, main)
fi
# For old BSDs
if test "$ispthread" = "yes" && uname -a | grep BSD > /dev/null &&
test -f /usr/lib/libc_r.a && test ! -f /usr/lib/libpthread.a
then
LIBS=`printf '%s' "$LIBS" | sed 's/-lc/-lc_r/g'`
fi
# Duplication of QDBM for C
AC_CHECK_LIB(qdbm, main,
if test "$isnowarn" != "yes"
then
printf '#================================================================\n' 1>&2
printf '# WARNING: The existing library was detected.\n' 1>&2
printf '#================================================================\n' 1>&2
fi
)
#================================================================
# Generic Settings
#================================================================
# Export variables
AC_SUBST(LIBVER)
AC_SUBST(LIBREV)
AC_SUBST(TARGETS)
AC_SUBST(MYDEFS)
AC_SUBST(MYOPTS)
AC_SUBST(MGWLIBS)
AC_SUBST(LD)
AC_SUBST(AR)
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)
# Targets
AC_OUTPUT(Makefile LTmakefile qdbm.spec qdbm.pc)
# Messages
printf '#================================================================\n'
printf '# Ready to make.\n'
printf '#================================================================\n'
# END OF FILE