Fred Drake committed 1205b18

Skip Montanaro <>:
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 #101272.

  • Participants
  • Parent commits eda449f
  • Branches legacy-trunk

Comments (0)

Files changed (5)


 # Garbage collection enabled with --with-cycle-gc
 @USE_GC_MODULE@gc gcmodule.c
+# You may want this to be built as a dynamically loaded module; uncomment
+# the following line in that case:
+# bsddb module enabled by --with-libdb or presence of db.h
+@USE_BSDDB_MODULE@bsddb bsddbmodule.c -ldb
 # (See for an interface to
 # BSD DB 2.1.0.)
+# Note: If a db.h file is found by configure, bsddb will be enabled
+# automatically via
 #bsddb bsddbmodule.c -I$(DBPORT)/include -I$(DBPORT) $(DBPORT)/libdb.a


 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-/* If using Berkeley DB 2.0 or newer, change this include to <db_185.h>: */
+#ifdef HAVE_DB_185_H
+#include <db_185.h>
 #include <db.h>
 /* Please don't include internal header files of the Berkeley db package
    (it messes up the info required in the Setup file) */
    (shared library plus accessory files). */
+/* Define if you want to use BSD db. */
+#undef WITH_LIBDB
 /* Define if you want to build an interpreter with many run-time checks  */
 #undef Py_DEBUG
 AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h locale.h ncurses.h poll.h pthread.h \
 signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h \
-sys/audioio.h sys/file.h sys/lock.h \
+sys/audioio.h sys/file.h sys/lock.h db_185.h db.h \
 sys/param.h sys/select.h sys/socket.h sys/time.h sys/times.h \
 sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h)
+# Check for LIBDB support
+# either --with-libdb or, in its absence, the presence of db.h
+AC_MSG_CHECKING(for --with-libdb)
+[  --with(out)-libdb               disable/enable bsddb module])
+# default is enabled
+if test -z "$with_libdb"
+then with_libdb="yes"
+# if we found db.h, enable, unless with_libdb is expressly set to "no"
+if test "$ac_cv_header_db_h" = "yes" -a "$with_libdb" != "no"
+then with_libdb="yes"
+if test "$with_libdb" = "no"
 # Check for --with-wctype-functions
 AC_MSG_CHECKING(for --with-wctype-functions)