Skip to content

bpo-45747: Detect gdbm/dbm dependencies in configure (GH-29467) #29467

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Doc/whatsnew/3.11.rst
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,10 @@ Build Changes
detected by :program:`configure`.
(Contributed by Christian Heimes in :issue:`45763`.)

* Build dependencies for :mod:`dbm` are now detected by :program:`configure`.
``libdb`` 3.x and 4.x are no longer supported.
(Contributed by Christian Heimes in :issue:`45747`.)

C API Changes
=============

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gdbm and dbm build dependencies are now detected by ``configure``.
2 changes: 1 addition & 1 deletion Modules/Setup
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ time timemodule.c
#_bz2 _bz2module.c -lbz2
#_ctypes _ctypes/_ctypes.c _ctypes/callbacks.c _ctypes/callproc.c _ctypes/stgdict.c _ctypes/cfield.c -ldl -lffi -DHAVE_FFI_PREP_CIF_VAR -DHAVE_FFI_PREP_CLOSURE_LOC -DHAVE_FFI_CLOSURE_ALLOC
# The _dbm module supports NDBM, GDBM with compat module, and Berkeley DB.
#_dbm _dbmmodule.c -lgdbm_compat -DHAVE_NDBM_H
#_dbm _dbmmodule.c -lgdbm_compat -DUSE_GDBM_COMPAT
#_gdbm _gdbmmodule.c -lgdbm
#_lzma _lzmamodule.c -llzma
#_sqlite3 _sqlite/connection.c _sqlite/cursor.c _sqlite/microprotocols.c _sqlite/module.c _sqlite/prepare_protocol.c _sqlite/row.c _sqlite/statement.c _sqlite/util.c -lsqlite3
Expand Down
32 changes: 19 additions & 13 deletions Modules/_dbmmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,26 @@
/* Some Linux systems install gdbm/ndbm.h, but not ndbm.h. This supports
* whichever configure was able to locate.
*/
#if defined(HAVE_NDBM_H)
#include <ndbm.h>
static const char which_dbm[] = "GNU gdbm"; /* EMX port of GDBM */
#elif defined(HAVE_GDBM_NDBM_H)
#include <gdbm/ndbm.h>
static const char which_dbm[] = "GNU gdbm";
#elif defined(HAVE_GDBM_DASH_NDBM_H)
#include <gdbm-ndbm.h>
static const char which_dbm[] = "GNU gdbm";
#elif defined(HAVE_BERKDB_H)
#include <db.h>
static const char which_dbm[] = "Berkeley DB";
#if defined(USE_NDBM)
#include <ndbm.h>
static const char which_dbm[] = "GNU gdbm"; /* EMX port of GDBM */
#elif defined(USE_GDBM_COMPAT)
#ifdef HAVE_GDBM_NDBM_H
#include <gdbm/ndbm.h>
#elif HAVE_GDBM_DASH_NDBM_H
#include <gdbm-ndbm.h>
#else
#error "No gdbm/ndbm.h or gdbm-ndbm.h available"
#endif
static const char which_dbm[] = "GNU gdbm";
#elif defined(USE_BERKDB)
#ifndef DB_DBM_HSEARCH
#define DB_DBM_HSEARCH 1
#endif
#include <db.h>
static const char which_dbm[] = "Berkeley DB";
#else
#error "No ndbm.h available!"
#error "No ndbm.h available!"
#endif

typedef struct {
Expand Down
Loading