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