1# Source of configuration for QDBM
2
3
4
5#================================================================
6# Generic Settings
7#================================================================
8
9
10# Targets
11AC_INIT(qdbm, 1.8.78)
12
13# Export variables
14LIBVER=14
15LIBREV=14
16TARGETS="all"
17MYDEFS=""
18MYOPTS=""
19MGWLIBS=""
20LD="ld"
21AR="ar"
22
23# Building paths
24pathtmp="$PATH"
25PATH="$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
26PATH="$PATH:/usr/ccs/bin:/usr/ucb:/usr/xpg4/bin:/usr/xpg6/bin:$pathtmp"
27LIBRARY_PATH="$HOME/lib:/usr/local/lib:$LIBRARY_PATH"
28LD_LIBRARY_PATH="$HOME/lib:/usr/local/lib:$LD_LIBRARY_PATH"
29CPATH="$HOME/include:/usr/local/include:$CPATH"
30export PATH LIBRARY_PATH LD_LIBRARY_PATH CPATH
31
32
33
34#================================================================
35# Options
36#================================================================
37
38
39# Internal variables
40enables=""
41ispthread=""
42iszlib=""
43isiconv=""
44isnowarn=""
45
46# Debug mode
47AC_ARG_ENABLE(debug,
48  AC_HELP_STRING([--enable-debug], [build for debugging]))
49if test "$enable_debug" = "yes"
50then
51  TARGETS="debug"
52  enables="$enables (debug)"
53fi
54
55# Developping mode
56AC_ARG_ENABLE(devel,
57  AC_HELP_STRING([--enable-devel], [build for development]))
58if test "$enable_devel" = "yes"
59then
60  TARGETS="devel"
61  enables="$enables (devel)"
62fi
63
64# Stable mode
65AC_ARG_ENABLE(stable,
66  AC_HELP_STRING([--enable-stable], [build for stable release]))
67if test "$enable_stable" = "yes"
68then
69  TARGETS="stable"
70  enables="$enables (stable)"
71fi
72
73# Enable POSIX thread
74AC_ARG_ENABLE(pthread,
75  AC_HELP_STRING([--enable-pthread], [use POSIX thread and make APIs thread-safe]))
76if test "$enable_pthread" = "yes"
77then
78  MYDEFS="$MYDEFS -DMYPTHREAD"
79  enables="$enables (pthread)"
80  ispthread="yes"
81fi
82
83# Disable file locking
84AC_ARG_ENABLE(lock,
85  AC_HELP_STRING([--disable-lock], [build for environments without file locking]))
86if test "$enable_lock" = "no"
87then
88  MYDEFS="$MYDEFS -DMYNOLOCK"
89  enables="$enables (no-lock)"
90fi
91
92# Disable memory mapping
93AC_ARG_ENABLE(mmap,
94  AC_HELP_STRING([--disable-mmap], [build for environments without memory mapping]))
95if test "$enable_mmap" = "no"
96then
97  MYDEFS="$MYDEFS -DMYNOMMAP"
98  enables="$enables (no-mmap)"
99fi
100
101# Enable ZLIB compression
102AC_ARG_ENABLE(zlib,
103  AC_HELP_STRING([--enable-zlib], [feature ZLIB for B+ tree and inverted index]))
104if test "$enable_zlib" = "yes"
105then
106  MYDEFS="$MYDEFS -DMYZLIB"
107  MGWLIBS="-lz $MGWLIBS"
108  enables="$enables (zlib)"
109  iszlib="yes"
110fi
111
112# Enable LZO compression
113AC_ARG_ENABLE(lzo,
114  AC_HELP_STRING([--enable-lzo], [feature LZO for B+ tree and inverted index]))
115if test "$enable_lzo" = "yes"
116then
117  MYDEFS="$MYDEFS -DMYLZO"
118  MGWLIBS="-llzo2 $MGWLIBS"
119  enables="$enables (lzo)"
120  islzo="yes"
121fi
122
123# Enable BZIP2 compression
124AC_ARG_ENABLE(bzip,
125  AC_HELP_STRING([--enable-bzip], [feature BZIP2 for B+ tree and inverted index]))
126if test "$enable_bzip" = "yes"
127then
128  MYDEFS="$MYDEFS -DMYBZIP"
129  MGWLIBS="-lbz2 $MGWLIBS"
130  enables="$enables (bzip)"
131  isbzip="yes"
132fi
133
134# Enable ICONV utilities
135AC_ARG_ENABLE(iconv,
136  AC_HELP_STRING([--enable-iconv], [feature ICONV utilities]))
137if test "$enable_iconv" = "yes"
138then
139  MYDEFS="$MYDEFS -DMYICONV"
140  MGWLIBS="-liconv $MGWLIBS"
141  enables="$enables (iconv)"
142  isiconv="yes"
143fi
144
145# No warning configuration
146AC_ARG_ENABLE(warn,
147  AC_HELP_STRING([--disable-warn], [hide warnings in the configuration]))
148if test "$enable_warn" = "no"
149then
150  isnowarn="yes"
151fi
152
153# Messages
154printf '#================================================================\n'
155printf '# Configuring QDBM version %s%s.\n' "$PACKAGE_VERSION" "$enables"
156printf '#================================================================\n'
157
158
159
160#================================================================
161# Checking Commands to Build with
162#================================================================
163
164
165# C compiler
166AC_PROG_CC
167if test "$GCC" != "yes"
168then
169  if test "$isnowarn" != "yes"
170  then
171    printf '#================================================================\n' 1>&2
172    printf '# WARNING: GCC is required to build this package.\n' 1>&2
173    printf '#================================================================\n' 1>&2
174  fi
175fi
176if uname | egrep -i 'Linux' > /dev/null 2>&1 &&
177  uname -m | egrep '(x|i)(3|4|5|6|7|8|9)?86' > /dev/null 2>&1
178then
179  MYOPTS="-minline-all-stringops"
180fi
181if uname | egrep -i 'SunOS' > /dev/null 2>&1
182then
183  MYOPTS="-O1 -fno-omit-frame-pointer -fno-force-addr"
184fi
185if uname | egrep -i 'BSD' > /dev/null 2>&1
186then
187  MYOPTS="-O1 -fno-omit-frame-pointer -fno-force-addr"
188fi
189if gcc --version | egrep -i '^2\.(8|9)' > /dev/null 2>&1
190then
191  MYOPTS="-O1 -fno-omit-frame-pointer -fno-force-addr"
192fi
193
194# Linker
195printf 'checking for ld... '
196if which ld | grep '/ld$' > /dev/null 2>&1
197then
198  LD=`which ld`
199  printf '%s\n' "$LD"
200else
201  printf 'no\n'
202  if test "$isnowarn" != "yes"
203  then
204    printf '#================================================================\n' 1>&2
205    printf '# WARNING: ld is not found in PATH.\n' 1>&2
206    printf '#================================================================\n' 1>&2
207  fi
208fi
209
210# Archiver
211printf 'checking for ar... '
212if which ar | grep '/ar$' > /dev/null 2>&1
213then
214  AR=`which ar`
215  printf '%s\n' "$AR"
216else
217  printf 'no\n'
218  if test "$isnowarn" != "yes"
219  then
220    printf '#================================================================\n' 1>&2
221    printf '# WARNING: ar is not found in PATH.\n' 1>&2
222    printf '#================================================================\n' 1>&2
223  fi
224fi
225
226
227
228#================================================================
229# Checking Libraries
230#================================================================
231
232
233# Underlying libraries
234AC_CHECK_LIB(c, main)
235
236# for pthread
237if test "$ispthread" = "yes"
238then
239  AC_CHECK_LIB(pthread, main)
240fi
241
242# for zlib
243if test "$iszlib" = "yes"
244then
245  AC_CHECK_LIB(z, main)
246fi
247
248# for lzo
249if test "$islzo" = "yes"
250then
251  AC_CHECK_LIB(lzo2, main)
252fi
253
254# for bzip
255if test "$isbzip" = "yes"
256then
257  AC_CHECK_LIB(bz2, main)
258fi
259
260# for iconv
261if test "$isiconv" = "yes"
262then
263  AC_CHECK_LIB(iconv, main)
264fi
265
266# For old BSDs
267if test "$ispthread" = "yes" && uname -a | grep BSD > /dev/null &&
268  test -f /usr/lib/libc_r.a && test ! -f /usr/lib/libpthread.a
269then
270  LIBS=`printf '%s' "$LIBS" | sed 's/-lc/-lc_r/g'`
271fi
272
273# Duplication of QDBM for C
274AC_CHECK_LIB(qdbm, main,
275  if test "$isnowarn" != "yes"
276  then
277    printf '#================================================================\n' 1>&2
278    printf '# WARNING: The existing library was detected.\n' 1>&2
279    printf '#================================================================\n' 1>&2
280  fi
281)
282
283
284
285#================================================================
286# Generic Settings
287#================================================================
288
289
290# Export variables
291AC_SUBST(LIBVER)
292AC_SUBST(LIBREV)
293AC_SUBST(TARGETS)
294AC_SUBST(MYDEFS)
295AC_SUBST(MYOPTS)
296AC_SUBST(MGWLIBS)
297AC_SUBST(LD)
298AC_SUBST(AR)
299AC_SUBST(CPPFLAGS)
300AC_SUBST(LDFLAGS)
301
302# Targets
303AC_OUTPUT(Makefile LTmakefile qdbm.spec qdbm.pc)
304
305# Messages
306printf '#================================================================\n'
307printf '# Ready to make.\n'
308printf '#================================================================\n'
309
310
311
312# END OF FILE
313