Skip to content

Commit c9cb847

Browse files
committed
Skip Montanaro <skip@mojam.com>:
Update the build structures to automatically detect the presence of BSD db, including the proper name of the header file to include. Has all the expected niceties associated with yet-more-configure-options. ;) This checkin includes changes for non-generated files only; subsequent checkin will catch those. This is part of SourceForge patch python#101272.
1 parent 6102e29 commit c9cb847

5 files changed

Lines changed: 44 additions & 2 deletions

File tree

Modules/Setup.config.in

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,12 @@
88

99
# Garbage collection enabled with --with-cycle-gc
1010
@USE_GC_MODULE@gc gcmodule.c
11+
12+
# You may want this to be built as a dynamically loaded module; uncomment
13+
# the following line in that case:
14+
15+
#*shared*
16+
17+
# bsddb module enabled by --with-libdb or presence of db.h
18+
@USE_BSDDB_MODULE@bsddb bsddbmodule.c -ldb
19+

Modules/Setup.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,9 @@ new newmodule.c
361361
# (See http://www.jenkon-dev.com/~rd/python/ for an interface to
362362
# BSD DB 2.1.0.)
363363

364+
# Note: If a db.h file is found by configure, bsddb will be enabled
365+
# automatically via Setup.config.in
366+
364367
#DB=/depot/sundry/src/berkeley-db/db.1.85
365368
#DBPORT=$(DB)/PORT/irix.5.3
366369
#bsddb bsddbmodule.c -I$(DBPORT)/include -I$(DBPORT) $(DBPORT)/libdb.a

Modules/bsddbmodule.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@ redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
3030
#include <sys/types.h>
3131
#include <sys/stat.h>
3232
#include <fcntl.h>
33-
/* If using Berkeley DB 2.0 or newer, change this include to <db_185.h>: */
33+
#ifdef HAVE_DB_185_H
34+
#include <db_185.h>
35+
#else
3436
#include <db.h>
37+
#endif
3538
/* Please don't include internal header files of the Berkeley db package
3639
(it messes up the info required in the Setup file) */
3740

acconfig.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@
151151
(shared library plus accessory files). */
152152
#undef WITH_NEXT_FRAMEWORK
153153

154+
/* Define if you want to use BSD db. */
155+
#undef WITH_LIBDB
156+
154157
/* Define if you want to build an interpreter with many run-time checks */
155158
#undef Py_DEBUG
156159

configure.in

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ dnl AC_MSG_RESULT($cpp_type)
369369
AC_HEADER_STDC
370370
AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h locale.h ncurses.h poll.h pthread.h \
371371
signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h \
372-
sys/audioio.h sys/file.h sys/lock.h \
372+
sys/audioio.h sys/file.h sys/lock.h db_185.h db.h \
373373
sys/param.h sys/select.h sys/socket.h sys/time.h sys/times.h \
374374
sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h)
375375
AC_HEADER_DIRENT
@@ -812,6 +812,30 @@ else
812812
fi
813813
AC_MSG_RESULT($with_cycle_gc)
814814

815+
# Check for LIBDB support
816+
# either --with-libdb or, in its absence, the presence of db.h
817+
AC_SUBST(USE_BSDDB_MODULE)
818+
USE_BSDDB_MODULE=""
819+
AC_MSG_CHECKING(for --with-libdb)
820+
AC_ARG_WITH(libdb,
821+
[ --with(out)-libdb disable/enable bsddb module])
822+
823+
# default is enabled
824+
if test -z "$with_libdb"
825+
then with_libdb="yes"
826+
fi
827+
# if we found db.h, enable, unless with_libdb is expressly set to "no"
828+
if test "$ac_cv_header_db_h" = "yes" -a "$with_libdb" != "no"
829+
then with_libdb="yes"
830+
fi
831+
if test "$with_libdb" = "no"
832+
then
833+
USE_BSDDB_MODULE="#"
834+
else
835+
AC_DEFINE(WITH_LIBDB)
836+
fi
837+
AC_MSG_RESULT($with_libdb)
838+
815839
# Check for --with-wctype-functions
816840
AC_MSG_CHECKING(for --with-wctype-functions)
817841
AC_ARG_WITH(wctype-functions,

0 commit comments

Comments
 (0)