1 | # Id: configure.ac,v 11.156 2002/09/04 13:51:17 bostic Exp |
---|
2 | # Process this file with autoconf to produce a configure script. |
---|
3 | |
---|
4 | PACKAGE=db |
---|
5 | AC_INIT(Berkeley DB, |
---|
6 | __EDIT_DB_VERSION__, support@sleepycat.com, db-__EDIT_DB_VERSION__) |
---|
7 | AC_CONFIG_SRCDIR([../db/db.c]) |
---|
8 | AC_CONFIG_HEADER(db_config.h:config.hin) |
---|
9 | |
---|
10 | # Configure setup. |
---|
11 | AC_CANONICAL_HOST() |
---|
12 | AC_ARG_PROGRAM() |
---|
13 | |
---|
14 | # We cannot build in the top-level directory. |
---|
15 | AC_MSG_CHECKING(if building in the top-level directory) |
---|
16 | [ test -d db_archive ] && AC_MSG_ERROR([ |
---|
17 | Berkeley DB cannot be built in the top-level distribution directory.]) |
---|
18 | AC_MSG_RESULT(no) |
---|
19 | |
---|
20 | # Substitution variables. |
---|
21 | AC_SUBST(ADDITIONAL_INCS) |
---|
22 | AC_SUBST(ADDITIONAL_LANG) |
---|
23 | AC_SUBST(ADDITIONAL_OBJS) |
---|
24 | AC_SUBST(ADDITIONAL_PROGS) |
---|
25 | AC_SUBST(BUILD_TARGET) |
---|
26 | AC_SUBST(CFLAGS) |
---|
27 | AC_SUBST(CONFIGURATION_ARGS) |
---|
28 | AC_SUBST(CONFIGURATION_PATH) |
---|
29 | AC_SUBST(CPPFLAGS) |
---|
30 | AC_SUBST(CXX) |
---|
31 | AC_SUBST(CXXFLAGS) |
---|
32 | AC_SUBST(DEFAULT_LIB) |
---|
33 | AC_SUBST(DEFAULT_LIB_CXX) |
---|
34 | AC_SUBST(EMBEDIX_ECD_CXX) |
---|
35 | AC_SUBST(EMBEDIX_ECD_RPC) |
---|
36 | AC_SUBST(EMBEDIX_ROOT) |
---|
37 | AC_SUBST(INSTALLER) |
---|
38 | AC_SUBST(INSTALL_LIBS) |
---|
39 | AC_SUBST(INSTALL_TARGET) |
---|
40 | AC_SUBST(JAR) |
---|
41 | AC_SUBST(JAVACFLAGS) |
---|
42 | AC_SUBST(LDFLAGS) |
---|
43 | AC_SUBST(LIBJSO_LIBS) |
---|
44 | AC_SUBST(LIBS) |
---|
45 | AC_SUBST(LIBSO_LIBS) |
---|
46 | AC_SUBST(LIBTOOL) |
---|
47 | AC_SUBST(LIBTSO_LIBS) |
---|
48 | AC_SUBST(LIBXSO_LIBS) |
---|
49 | AC_SUBST(LOAD_LIBS) |
---|
50 | AC_SUBST(MAKEFILE_CC) |
---|
51 | AC_SUBST(MAKEFILE_CCLINK) |
---|
52 | AC_SUBST(MAKEFILE_CXX) |
---|
53 | AC_SUBST(MAKEFILE_CXXLINK) |
---|
54 | AC_SUBST(MAKEFILE_SOLINK) |
---|
55 | AC_SUBST(MAKEFILE_XSOLINK) |
---|
56 | AC_SUBST(POSTLINK) |
---|
57 | AC_SUBST(RPC_CLIENT_OBJS) |
---|
58 | AC_SUBST(RPM_POST_INSTALL) |
---|
59 | AC_SUBST(RPM_POST_UNINSTALL) |
---|
60 | AC_SUBST(SOFLAGS) |
---|
61 | AC_SUBST(db_cv_path_embedix_install) |
---|
62 | AC_SUBST(db_cv_path_rpm_archive) |
---|
63 | AC_SUBST(db_int_def) |
---|
64 | AC_SUBST(o) |
---|
65 | |
---|
66 | # RPM needs the current absolute path. |
---|
67 | # RPM needs the list of original arguments, but we don't include the RPM |
---|
68 | # option itself. |
---|
69 | CONFIGURATION_PATH=${PWD-`pwd`} |
---|
70 | CONFIGURATION_ARGS=`echo "$*" | |
---|
71 | sed -e 's/--with-embedix[[^ ]]*//' -e 's/--with-rpm[[^ ]]*//'` |
---|
72 | |
---|
73 | # Set the version. |
---|
74 | AM_VERSION_SET |
---|
75 | |
---|
76 | # Set the default installation location. |
---|
77 | AC_PREFIX_DEFAULT(/usr/local/BerkeleyDB.@DB_VERSION_MAJOR@.@DB_VERSION_MINOR@) |
---|
78 | |
---|
79 | # Process all options before using them. |
---|
80 | AM_OPTIONS_SET |
---|
81 | |
---|
82 | # Set some #defines based on configuration options. |
---|
83 | if test "$db_cv_diagnostic" = yes; then |
---|
84 | AC_DEFINE(DIAGNOSTIC) |
---|
85 | AH_TEMPLATE(DIAGNOSTIC, |
---|
86 | [Define to 1 if you want a version with run-time diagnostic checking.]) |
---|
87 | fi |
---|
88 | if test "$db_cv_debug_rop" = yes; then |
---|
89 | AC_DEFINE(DEBUG_ROP) |
---|
90 | AH_TEMPLATE(DEBUG_ROP, |
---|
91 | [Define to 1 if you want a version that logs read operations.]) |
---|
92 | fi |
---|
93 | if test "$db_cv_debug_wop" = yes; then |
---|
94 | AC_DEFINE(DEBUG_WOP) |
---|
95 | AH_TEMPLATE(DEBUG_WOP, |
---|
96 | [Define to 1 if you want a version that logs write operations.]) |
---|
97 | fi |
---|
98 | if test "$db_cv_umrw" = yes; then |
---|
99 | AC_DEFINE(UMRW) |
---|
100 | AH_TEMPLATE(UMRW, |
---|
101 | [Define to 1 to mask harmless unitialized memory read/writes.]) |
---|
102 | |
---|
103 | fi |
---|
104 | if test "$db_cv_test" = yes; then |
---|
105 | AC_DEFINE(CONFIG_TEST) |
---|
106 | AH_TEMPLATE(CONFIG_TEST, |
---|
107 | [Define to 1 if you want to build a version for running the test suite.]) |
---|
108 | fi |
---|
109 | |
---|
110 | # Check for programs used in building and installation. |
---|
111 | AM_PROGRAMS_SET |
---|
112 | AC_PROG_INSTALL |
---|
113 | |
---|
114 | # RPM/Embedix support: change the standard make and install targets |
---|
115 | if test "$db_cv_rpm" = "yes"; then |
---|
116 | BUILD_TARGET="rpm_build" |
---|
117 | echo "topdir: $CONFIGURATION_PATH" > rpmrc |
---|
118 | if test "$db_cv_embedix" = "yes"; then |
---|
119 | EMBEDIX_ROOT="/usr" |
---|
120 | INSTALL_TARGET="embedix_install" |
---|
121 | else |
---|
122 | INSTALL_TARGET="rpm_install" |
---|
123 | fi |
---|
124 | else |
---|
125 | BUILD_TARGET="library_build" |
---|
126 | INSTALL_TARGET="library_install" |
---|
127 | fi |
---|
128 | |
---|
129 | # This is where we handle stuff that autoconf can't handle: compiler, |
---|
130 | # preprocessor and load flags, libraries that the standard tests don't |
---|
131 | # look for. The default optimization is -O. We would like to set the |
---|
132 | # default optimization for systems using gcc to -O2, but we can't. By |
---|
133 | # the time we know we're using gcc, it's too late to set optimization |
---|
134 | # flags. |
---|
135 | # |
---|
136 | # There are additional libraries we need for some compiler/architecture |
---|
137 | # combinations. |
---|
138 | # |
---|
139 | # Some architectures require DB to be compiled with special flags and/or |
---|
140 | # libraries for threaded applications |
---|
141 | # |
---|
142 | # The makefile CC may be different than the CC used in config testing, |
---|
143 | # because the makefile CC may be set to use $(LIBTOOL). |
---|
144 | # |
---|
145 | # XXX |
---|
146 | # Don't override anything if it's already set from the environment. |
---|
147 | optimize_def="-O" |
---|
148 | case "$host_os" in |
---|
149 | aix4.3.*|aix5*) |
---|
150 | optimize_def="-O2" |
---|
151 | CC=${CC-"xlc_r"} |
---|
152 | CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" |
---|
153 | LDFLAGS="$LDFLAGS -Wl,-brtl";; |
---|
154 | bsdi3*) optimize_def="-O2" |
---|
155 | CC=${CC-"shlicc2"} |
---|
156 | LIBS="$LIBS -lipc";; |
---|
157 | bsdi*) optimize_def="-O2";; |
---|
158 | freebsd*) |
---|
159 | optimize_def="-O2" |
---|
160 | CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" |
---|
161 | LDFLAGS="$LDFLAGS -pthread";; |
---|
162 | hpux*) CPPFLAGS="$CPPFLAGS -D_REENTRANT";; |
---|
163 | irix*) optimize_def="-O2" |
---|
164 | CPPFLAGS="$CPPFLAGS -D_SGI_MP_SOURCE";; |
---|
165 | linux*) optimize_def="-O2" |
---|
166 | CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE -D_REENTRANT";; |
---|
167 | mpeix*) CPPFLAGS="$CPPFLAGS -D_POSIX_SOURCE -D_SOCKET_SOURCE" |
---|
168 | LIBS="$LIBS -lsocket -lsvipc";; |
---|
169 | osf*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" |
---|
170 | LDFLAGS="$LDFLAGS -pthread";; |
---|
171 | *qnx) AC_DEFINE(HAVE_QNX) |
---|
172 | AH_TEMPLATE(HAVE_QNX, [Define to 1 if building on QNX.]);; |
---|
173 | solaris*) |
---|
174 | CPPFLAGS="$CPPFLAGS -D_REENTRANT";; |
---|
175 | esac |
---|
176 | |
---|
177 | # Set CFLAGS/CXXFLAGS. We MUST set the flags before we call autoconf |
---|
178 | # compiler configuration macros, because if we don't, they set CFLAGS |
---|
179 | # to no optimization and -g, which isn't what we want. |
---|
180 | CFLAGS=${CFLAGS-$optimize_def} |
---|
181 | CXXFLAGS=${CXXFLAGS-"$CFLAGS"} |
---|
182 | |
---|
183 | # If the user wants a debugging environment, add -g to the CFLAGS value. |
---|
184 | # |
---|
185 | # XXX |
---|
186 | # Some compilers can't mix optimizing and debug flags. The only way to |
---|
187 | # handle this is to specify CFLAGS in the environment before configuring. |
---|
188 | if test "$db_cv_debug" = yes; then |
---|
189 | AC_DEFINE(DEBUG) |
---|
190 | AH_TEMPLATE(DEBUG, [Define to 1 if you want a debugging version.]) |
---|
191 | |
---|
192 | CFLAGS="$CFLAGS -g" |
---|
193 | CXXFLAGS="$CXXFLAGS -g" |
---|
194 | fi |
---|
195 | |
---|
196 | # The default compiler is cc (NOT gcc), the default CFLAGS is as specified |
---|
197 | # above, NOT what is set by AC_PROG_CC, as it won't set optimization flags |
---|
198 | # for any compiler other than gcc. |
---|
199 | AC_PROG_CC(cc gcc) |
---|
200 | |
---|
201 | # Because of shared library building, the ${CC} used for config tests |
---|
202 | # may be different than the ${CC} we want to put in the Makefile. |
---|
203 | # The latter is known as ${MAKEFILE_CC} in this script. |
---|
204 | MAKEFILE_CC="${CC}" |
---|
205 | MAKEFILE_CCLINK="${CC}" |
---|
206 | MAKEFILE_CXX="nocxx" |
---|
207 | MAKEFILE_CXXLINK="nocxx" |
---|
208 | |
---|
209 | # See if we need the C++ compiler at all. If so, we'd like to find one that |
---|
210 | # interoperates with the C compiler we chose. Since we prefered cc over gcc, |
---|
211 | # we'll also prefer the vendor's compiler over g++/gcc. If we're wrong, the |
---|
212 | # user can set CC and CXX in their environment before running configure. |
---|
213 | # |
---|
214 | # AC_PROG_CXX sets CXX, but it uses $CXX and $CCC (in that order) as its |
---|
215 | # first choices. |
---|
216 | if test "$db_cv_cxx" = "yes"; then |
---|
217 | if test "$GCC" != "yes"; then |
---|
218 | case "$host_os" in |
---|
219 | aix*) AC_CHECK_TOOL(CCC, xlC_r) |
---|
220 | LIBXSO_LIBS="-lC_r $LIBXSO_LIBS" |
---|
221 | LIBS="-lC_r $LIBS";; |
---|
222 | hpux*) AC_CHECK_TOOL(CCC, aCC);; |
---|
223 | irix*) AC_CHECK_TOOL(CCC, CC);; |
---|
224 | osf*) AC_CHECK_TOOL(CCC, cxx);; |
---|
225 | solaris*) AC_CHECK_TOOL(CCC, CC);; |
---|
226 | esac |
---|
227 | fi |
---|
228 | AC_PROG_CXX |
---|
229 | AC_CXX_HAVE_STDHEADERS |
---|
230 | MAKEFILE_CXX="${CXX}" |
---|
231 | MAKEFILE_CXXLINK="${CXX}" |
---|
232 | fi |
---|
233 | |
---|
234 | # Do some gcc specific configuration. |
---|
235 | AC_GCC_CONFIG1 |
---|
236 | AC_GCC_CONFIG2 |
---|
237 | |
---|
238 | # We need the -Kthread/-pthread flag when compiling on SCO/Caldera's UnixWare |
---|
239 | # and OpenUNIX releases. We can't make the test until we know which compiler |
---|
240 | # we're using. |
---|
241 | case "$host_os" in |
---|
242 | sysv5UnixWare*|sysv5OpenUNIX8*) |
---|
243 | if test "$GCC" == "yes"; then |
---|
244 | CPPFLAGS="$CPPFLAGS -pthread" |
---|
245 | LDFLAGS="$LDFLAGS -pthread" |
---|
246 | else |
---|
247 | CPPFLAGS="$CPPFLAGS -Kthread" |
---|
248 | LDFLAGS="$LDFLAGS -Kthread" |
---|
249 | fi;; |
---|
250 | esac |
---|
251 | |
---|
252 | # Export our compiler preferences for the libtool configuration. |
---|
253 | export CC CCC |
---|
254 | CCC=CXX |
---|
255 | |
---|
256 | # Libtool configuration. |
---|
257 | AC_PROG_LIBTOOL |
---|
258 | |
---|
259 | LIBTOOL="\$(SHELL) ./libtool" |
---|
260 | SOFLAGS="-rpath \$(libdir)" |
---|
261 | |
---|
262 | # Set SOSUFFIX and friends |
---|
263 | SOSUFFIX_CONFIG |
---|
264 | MODSUFFIX_CONFIG |
---|
265 | JMODSUFFIX_CONFIG |
---|
266 | |
---|
267 | INSTALLER="\$(LIBTOOL) --mode=install cp -p" |
---|
268 | |
---|
269 | MAKEFILE_CC="\$(LIBTOOL) --mode=compile ${MAKEFILE_CC}" |
---|
270 | MAKEFILE_SOLINK="\$(LIBTOOL) --mode=link ${MAKEFILE_CCLINK} -avoid-version" |
---|
271 | MAKEFILE_CCLINK="\$(LIBTOOL) --mode=link ${MAKEFILE_CCLINK}" |
---|
272 | MAKEFILE_CXX="\$(LIBTOOL) --mode=compile ${MAKEFILE_CXX}" |
---|
273 | MAKEFILE_XSOLINK="\$(LIBTOOL) --mode=link ${MAKEFILE_CXXLINK} -avoid-version" |
---|
274 | MAKEFILE_CXXLINK="\$(LIBTOOL) --mode=link ${MAKEFILE_CXXLINK}" |
---|
275 | |
---|
276 | # Configure for shared libraries, static libraries, or both. If both are |
---|
277 | # configured, build the utilities and example programs with shared versions. |
---|
278 | # |
---|
279 | # $o is set to ".o" or ".lo", and is the file suffix used in the Makefile |
---|
280 | # instead of .o |
---|
281 | if test "$enable_shared" = "no"; then |
---|
282 | DEFAULT_LIB="\$(libdb)" |
---|
283 | POSTLINK="@true" |
---|
284 | o=".o" |
---|
285 | fi |
---|
286 | if test "$enable_shared" = "yes"; then |
---|
287 | DEFAULT_LIB="\$(libso_target)" |
---|
288 | POSTLINK="\$(LIBTOOL) --mode=execute true" |
---|
289 | o=".lo" |
---|
290 | fi |
---|
291 | INSTALL_LIBS="$DEFAULT_LIB" |
---|
292 | |
---|
293 | # Optional C++ API. |
---|
294 | if test "$db_cv_cxx" = "yes"; then |
---|
295 | if test "$enable_shared" = "no"; then |
---|
296 | DEFAULT_LIB_CXX="\$(libcxx)" |
---|
297 | fi |
---|
298 | if test "$enable_shared" = "yes"; then |
---|
299 | DEFAULT_LIB_CXX="\$(libxso_target)" |
---|
300 | fi |
---|
301 | INSTALL_LIBS="$INSTALL_LIBS $DEFAULT_LIB_CXX" |
---|
302 | |
---|
303 | # Fill in C++ library for Embedix. |
---|
304 | EMBEDIX_ECD_CXX='<OPTION db-extra>\ |
---|
305 | TYPE=bool\ |
---|
306 | DEFAULT_VALUE=1\ |
---|
307 | PROMPT=Include BerkeleyDB C++ library?\ |
---|
308 | <KEEPLIST>\ |
---|
309 | /usr/include/db_cxx.h\ |
---|
310 | /usr/lib/libdb_cxx-@DB_VERSION_MAJOR@.@DB_VERSION_MINOR@.so\ |
---|
311 | </KEEPLIST>\ |
---|
312 | <PROVIDES>\ |
---|
313 | libdb_cxx-@DB_VERSION_MAJOR@.@DB_VERSION_MINOR@.so\ |
---|
314 | </PROVIDES>\ |
---|
315 | <REQUIRES>\ |
---|
316 | ld-linux.so.2\ |
---|
317 | libc.so.6\ |
---|
318 | </REQUIRES>\ |
---|
319 | STATIC_SIZE=0\ |
---|
320 | STORAGE_SIZE=523612\ |
---|
321 | STARTUP_TIME=0\ |
---|
322 | </OPTION>' |
---|
323 | fi |
---|
324 | |
---|
325 | # Optional Java API. |
---|
326 | if test "$db_cv_java" = "yes"; then |
---|
327 | # Java requires shared libraries. |
---|
328 | if test "$enable_shared" = "no"; then |
---|
329 | AC_MSG_ERROR([Java requires shared libraries]) |
---|
330 | fi |
---|
331 | |
---|
332 | AC_PROG_JAVAC |
---|
333 | AC_PROG_JAR |
---|
334 | AC_JNI_INCLUDE_DIR |
---|
335 | |
---|
336 | for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS |
---|
337 | do |
---|
338 | CPPFLAGS="$CPPFLAGS -I$JNI_INCLUDE_DIR" |
---|
339 | done |
---|
340 | |
---|
341 | ADDITIONAL_LANG="$ADDITIONAL_LANG java" |
---|
342 | INSTALL_LIBS="$INSTALL_LIBS \$(libjso_target)" |
---|
343 | else |
---|
344 | JAVAC=nojavac |
---|
345 | fi |
---|
346 | |
---|
347 | # Optional RPC client/server. |
---|
348 | if test "$db_cv_rpc" = "yes"; then |
---|
349 | AC_DEFINE(HAVE_RPC) |
---|
350 | AH_TEMPLATE(HAVE_RPC, [Define to 1 if building RPC client/server.]) |
---|
351 | |
---|
352 | RPC_CLIENT_OBJS="\$(RPC_CLIENT_OBJS)" |
---|
353 | ADDITIONAL_PROGS="berkeley_db_svc $ADDITIONAL_PROGS" |
---|
354 | |
---|
355 | EMBEDIX_ECD_RPC="/usr/bin/berkeley_db_svc" |
---|
356 | |
---|
357 | case "$host_os" in |
---|
358 | hpux*) |
---|
359 | AC_CHECK_FUNC(svc_run,, |
---|
360 | AC_CHECK_LIB(nsl, svc_run, |
---|
361 | LIBS="-lnsl $LIBS"; LIBTSO_LIBS="-lnsl $LIBTSO_LIBS"));; |
---|
362 | solaris*) |
---|
363 | AC_CHECK_FUNC(svc_run,, AC_CHECK_LIB(nsl, svc_run));; |
---|
364 | esac |
---|
365 | fi |
---|
366 | |
---|
367 | AM_TCL_LOAD |
---|
368 | |
---|
369 | # Optional crypto support. |
---|
370 | if test -d "$srcdir/../crypto"; then |
---|
371 | AC_DEFINE(HAVE_CRYPTO) |
---|
372 | AH_TEMPLATE(HAVE_CRYPTO, |
---|
373 | [Define to 1 if Berkeley DB release includes strong cryptography.]) |
---|
374 | ADDITIONAL_OBJS="aes_method${o} crypto${o} mt19937db${o} rijndael-alg-fst${o} rijndael-api-fst${o} $ADDITIONAL_OBJS" |
---|
375 | fi |
---|
376 | |
---|
377 | # Optional DB 1.85 compatibility API. |
---|
378 | if test "$db_cv_compat185" = "yes"; then |
---|
379 | ADDITIONAL_INCS="db_185.h $ADDITIONAL_INCS" |
---|
380 | ADDITIONAL_OBJS="db185${o} $ADDITIONAL_OBJS" |
---|
381 | fi |
---|
382 | |
---|
383 | # Optional utilities. |
---|
384 | if test "$db_cv_dump185" = "yes"; then |
---|
385 | ADDITIONAL_PROGS="db_dump185 $ADDITIONAL_PROGS" |
---|
386 | fi |
---|
387 | |
---|
388 | # Checks for compiler characteristics. |
---|
389 | AC_C_CONST |
---|
390 | |
---|
391 | # Checks for include files, structures, C types. |
---|
392 | AC_HEADER_STAT |
---|
393 | AC_HEADER_TIME |
---|
394 | AC_HEADER_DIRENT |
---|
395 | AC_CHECK_HEADERS(sys/select.h sys/time.h) |
---|
396 | AC_CHECK_MEMBERS([struct stat.st_blksize]) |
---|
397 | AM_TYPES |
---|
398 | |
---|
399 | AC_CACHE_CHECK([for ANSI C exit success/failure values], db_cv_exit_defines, [ |
---|
400 | AC_TRY_COMPILE([#include <stdlib.h>], return (EXIT_SUCCESS);, |
---|
401 | [db_cv_exit_defines=yes], [db_cv_exit_defines=no])]) |
---|
402 | if test "$db_cv_exit_defines" = yes; then |
---|
403 | AC_DEFINE(HAVE_EXIT_SUCCESS) |
---|
404 | AH_TEMPLATE(HAVE_EXIT_SUCCESS, |
---|
405 | [Define to 1 if you have EXIT_SUCCESS/EXIT_FAILURE #defines.]) |
---|
406 | fi |
---|
407 | |
---|
408 | # Test for various functions/libraries that the test and example programs use: |
---|
409 | # sched_yield function |
---|
410 | # pthreads, socket and math libraries |
---|
411 | AC_CHECK_FUNC(sched_yield,, |
---|
412 | AC_SEARCH_LIBS(sched_yield, rt, LOAD_LIBS="$LOAD_LIBS -lrt")) |
---|
413 | |
---|
414 | # XXX |
---|
415 | # We can't check for pthreads in the same way we did the test for sched_yield |
---|
416 | # because the Solaris C library includes pthread interfaces which are not |
---|
417 | # thread-safe. For that reason we always add -lpthread if we find a pthread |
---|
418 | # library. Also we can't depend on any specific call existing (pthread_create, |
---|
419 | # for example), as it may be #defined in an include file -- OSF/1 (Tru64) has |
---|
420 | # this problem. |
---|
421 | AC_HAVE_LIBRARY(pthread, LOAD_LIBS="$LOAD_LIBS -lpthread") |
---|
422 | |
---|
423 | # XXX |
---|
424 | # We could be more exact about whether these libraries are needed, but we don't |
---|
425 | # bother -- if they exist, we load them. |
---|
426 | AC_HAVE_LIBRARY(m, LOAD_LIBS="$LOAD_LIBS -lm") |
---|
427 | AC_HAVE_LIBRARY(socket, LOAD_LIBS="$LOAD_LIBS -lsocket") |
---|
428 | AC_HAVE_LIBRARY(nsl, LOAD_LIBS="$LOAD_LIBS -lnsl") |
---|
429 | |
---|
430 | # Check for mutexes. |
---|
431 | # We do this here because it changes $LIBS. |
---|
432 | AM_DEFINE_MUTEXES |
---|
433 | |
---|
434 | # Checks for system functions for which we have replacements. |
---|
435 | # |
---|
436 | # XXX |
---|
437 | # The only portable getcwd call is getcwd(char *, size_t), where the |
---|
438 | # buffer is non-NULL -- Solaris can't handle a NULL buffer, and they |
---|
439 | # deleted getwd(). |
---|
440 | AC_REPLACE_FUNCS(getcwd getopt memcmp memcpy memmove raise) |
---|
441 | AC_REPLACE_FUNCS(snprintf strcasecmp strdup strerror vsnprintf) |
---|
442 | |
---|
443 | # Check for system functions we optionally use. |
---|
444 | AC_CHECK_FUNCS(_fstati64 clock_gettime directio gettimeofday getuid) |
---|
445 | AC_CHECK_FUNCS(pstat_getdynamic sched_yield select strtoul sysconf yield) |
---|
446 | |
---|
447 | # Checks for system functions for which we don't have replacements. |
---|
448 | # We require qsort(3). |
---|
449 | AC_CHECK_FUNCS(qsort, , AC_MSG_ERROR([No qsort library function.])) |
---|
450 | |
---|
451 | # Pread/pwrite. |
---|
452 | # HP-UX has pread/pwrite, but it doesn't work with largefile support. |
---|
453 | case "$host_os" in |
---|
454 | hpux*) |
---|
455 | AC_MSG_WARN([pread/pwrite interfaces ignored on $host_os.]);; |
---|
456 | *) AC_CHECK_FUNCS(pread pwrite) |
---|
457 | esac |
---|
458 | |
---|
459 | # Check for fcntl(2) to deny child process access to file descriptors. |
---|
460 | AC_CACHE_CHECK([for fcntl/F_SETFD], db_cv_fcntl_f_setfd, [ |
---|
461 | AC_TRY_LINK([ |
---|
462 | #include <sys/types.h> |
---|
463 | #include <fcntl.h>], [ |
---|
464 | fcntl(1, F_SETFD, 1); |
---|
465 | ], [db_cv_fcntl_f_setfd=yes], [db_cv_fcntl_f_setfd=no])]) |
---|
466 | if test "$db_cv_fcntl_f_setfd" = yes; then |
---|
467 | AC_DEFINE(HAVE_FCNTL_F_SETFD) |
---|
468 | AH_TEMPLATE(HAVE_FCNTL_F_SETFD, |
---|
469 | [Define to 1 if fcntl/F_SETFD denies child access to file descriptors.]) |
---|
470 | fi |
---|
471 | |
---|
472 | # A/UX has a broken getopt(3). |
---|
473 | case "$host_os" in |
---|
474 | aux*) ADDITIONAL_OBJS="getopt${o} $ADDITIONAL_OBJS";; |
---|
475 | esac |
---|
476 | |
---|
477 | # Linux has the O_DIRECT flag, but you can't actually use it. |
---|
478 | AC_CACHE_CHECK([for open/O_DIRECT], db_cv_open_o_direct, [ |
---|
479 | echo "test for working open/O_DIRECT" > __o_direct_file |
---|
480 | AC_TRY_RUN([ |
---|
481 | #include <sys/types.h> |
---|
482 | #include <fcntl.h> |
---|
483 | main() { |
---|
484 | int c, fd = open("__o_direct_file", O_RDONLY | O_DIRECT, 0); |
---|
485 | exit ((fd == -1) || (read(fd, &c, 1) != 1)); |
---|
486 | }], [db_cv_open_o_direct=yes], [db_cv_open_o_direct=no], |
---|
487 | AC_TRY_LINK([ |
---|
488 | #include <sys/types.h> |
---|
489 | #include <fcntl.h>], [ |
---|
490 | open("__o_direct_file", O_RDONLY | O_DIRECT, 0); |
---|
491 | ], [db_cv_open_o_direct=yes], [db_cv_open_o_direct=no])) |
---|
492 | rm -f __o_direct_file]) |
---|
493 | if test "$db_cv_open_o_direct" = yes; then |
---|
494 | AC_DEFINE(HAVE_O_DIRECT) |
---|
495 | AH_TEMPLATE(HAVE_O_DIRECT, [Define to 1 if you have the O_DIRECT flag.]) |
---|
496 | fi |
---|
497 | |
---|
498 | # Check for largefile support. |
---|
499 | AC_SYS_LARGEFILE |
---|
500 | |
---|
501 | # Figure out how to create shared regions. |
---|
502 | # |
---|
503 | # First, we look for mmap. |
---|
504 | # |
---|
505 | # BSD/OS has mlock(2), but it doesn't work until the 4.1 release. |
---|
506 | # |
---|
507 | # Nextstep (version 3.3) apparently supports mmap(2) (the mmap symbol |
---|
508 | # is defined in the C library) but does not support munmap(2). Don't |
---|
509 | # try to use mmap if we can't find munmap. |
---|
510 | # |
---|
511 | # Ultrix has mmap(2), but it doesn't work. |
---|
512 | mmap_ok=no |
---|
513 | case "$host_os" in |
---|
514 | bsdi3*|bsdi4.0) |
---|
515 | AC_MSG_WARN([mlock(2) interface ignored on BSD/OS 3.X and 4.0.]) |
---|
516 | mmap_ok=yes |
---|
517 | AC_CHECK_FUNCS(mmap munmap, , mmap_ok=no);; |
---|
518 | ultrix*) |
---|
519 | AC_MSG_WARN([mmap(2) interface ignored on Ultrix.]);; |
---|
520 | *) |
---|
521 | mmap_ok=yes |
---|
522 | AC_CHECK_FUNCS(mlock munlock) |
---|
523 | AC_CHECK_FUNCS(mmap munmap, , mmap_ok=no);; |
---|
524 | esac |
---|
525 | |
---|
526 | # Second, we look for shmget. |
---|
527 | # |
---|
528 | # SunOS has the shmget(2) interfaces, but there appears to be a missing |
---|
529 | # #include <debug/debug.h> file, so we ignore them. |
---|
530 | shmget_ok=no |
---|
531 | case "$host_os" in |
---|
532 | sunos*) |
---|
533 | AC_MSG_WARN([shmget(2) interface ignored on SunOS.]);; |
---|
534 | *) |
---|
535 | shmget_ok=yes |
---|
536 | AC_CHECK_FUNCS(shmget, , shmget_ok=no);; |
---|
537 | esac |
---|
538 | |
---|
539 | # We require either mmap/munmap(2) or shmget(2). |
---|
540 | if test "$mmap_ok" = no -a "$shmget_ok" = no; then |
---|
541 | AC_MSG_WARN([Neither mmap/munmap(2) or shmget(2) library functions.]) |
---|
542 | fi |
---|
543 | |
---|
544 | # If we're not doing version name substitution, DB_VERSION_UNIQUE_NAME |
---|
545 | # needs to be erased. |
---|
546 | if test "$db_cv_uniquename" = "no"; then |
---|
547 | DB_VERSION_UNIQUE_NAME="" |
---|
548 | fi |
---|
549 | |
---|
550 | # This is necessary so that .o files in LIBOBJS are also built via |
---|
551 | # the ANSI2KNR-filtering rules. |
---|
552 | LIB@&t@OBJS=`echo "$LIB@&t@OBJS" | |
---|
553 | sed 's,\.[[^.]]* ,$U&,g;s,\.[[^.]]*$,$U&,'` |
---|
554 | LTLIBOBJS=`echo "$LIB@&t@OBJS" | |
---|
555 | sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'` |
---|
556 | AC_SUBST(LTLIBOBJS) |
---|
557 | |
---|
558 | # Initial output file list. |
---|
559 | CREATE_LIST="Makefile |
---|
560 | db_cxx.h:$srcdir/../dbinc/db_cxx.in |
---|
561 | db_int.h:$srcdir/../dbinc/db_int.in |
---|
562 | include.tcl:$srcdir/../test/include.tcl" |
---|
563 | |
---|
564 | # Create the db.h file from a source file, a list of global function |
---|
565 | # prototypes, and, if configured for unique names, a list of #defines |
---|
566 | # to do DB_VERSION_UNIQUE_NAME substitution. |
---|
567 | if test "$db_cv_uniquename" = "yes"; then |
---|
568 | CREATE_LIST="$CREATE_LIST |
---|
569 | db.h:$srcdir/../dbinc/db.in:$srcdir/../dbinc_auto/rpc_defs.in:$srcdir/../dbinc_auto/ext_def.in:$srcdir/../dbinc_auto/ext_prot.in" |
---|
570 | else |
---|
571 | CREATE_LIST="$CREATE_LIST |
---|
572 | db.h:$srcdir/../dbinc/db.in:$srcdir/../dbinc_auto/rpc_defs.in:$srcdir/../dbinc_auto/ext_prot.in" |
---|
573 | fi |
---|
574 | |
---|
575 | # If configured for unique names, create the db_int_uext.h file (which |
---|
576 | # does the DB_VERSION_UNIQUE_NAME substitution), which is included by |
---|
577 | # the db_int.h file. |
---|
578 | if test "$db_cv_uniquename" = "yes"; then |
---|
579 | CREATE_LIST="$CREATE_LIST |
---|
580 | db_int_def.h:$srcdir/../dbinc_auto/int_def.in" |
---|
581 | db_int_def='#include "db_int_def.h"' |
---|
582 | fi |
---|
583 | |
---|
584 | # Create the db_185.h and db185_int.h files from source files, a list of |
---|
585 | # global function prototypes, and, if configured for unique names, a list |
---|
586 | # of #defines to do DB_VERSION_UNIQUE_NAME substitution. |
---|
587 | if test "$db_cv_compat185" = "yes"; then |
---|
588 | if test "$db_cv_uniquename" = "yes"; then |
---|
589 | CREATE_LIST="$CREATE_LIST |
---|
590 | db_185.h:$srcdir/../dbinc/db_185.in:$srcdir/../dbinc_auto/ext_185_def.in:$srcdir/../dbinc_auto/ext_185_prot.in |
---|
591 | db185_int.h:$srcdir/../db185/db185_int.in:$srcdir/../dbinc_auto/ext_185_def.in:$srcdir/../dbinc_auto/ext_185_prot.in" |
---|
592 | else |
---|
593 | CREATE_LIST="$CREATE_LIST |
---|
594 | db_185.h:$srcdir/../dbinc/db_185.in:$srcdir/../dbinc_auto/ext_185_prot.in |
---|
595 | db185_int.h:$srcdir/../db185/db185_int.in:$srcdir/../dbinc_auto/ext_185_prot.in" |
---|
596 | fi |
---|
597 | fi |
---|
598 | |
---|
599 | if test "$db_cv_embedix" = "yes"; then |
---|
600 | CREATE_LIST="$CREATE_LIST db.ecd:../dist/db.ecd.in" |
---|
601 | fi |
---|
602 | |
---|
603 | if test "$db_cv_rpm" = "yes"; then |
---|
604 | CREATE_LIST="$CREATE_LIST db.spec:../dist/db.spec.in" |
---|
605 | fi |
---|
606 | |
---|
607 | AC_CONFIG_FILES($CREATE_LIST) |
---|
608 | AC_OUTPUT |
---|