Skip to content

Commit b7f54e6

Browse files
committed
bpo-45747: Detect gdbm/dbm dependencies in configure
Signed-off-by: Christian Heimes <[email protected]>
1 parent 5b7c7cb commit b7f54e6

File tree

8 files changed

+495
-262
lines changed

8 files changed

+495
-262
lines changed

Doc/whatsnew/3.11.rst

+4
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,10 @@ Build Changes
528528
detected by :program:`configure`.
529529
(Contributed by Christian Heimes in :issue:`45763`.)
530530

531+
* Build dependencies for :mod:`dbm` are now detected by :program:`configure`.
532+
``libdb`` 3.x and 4.x are no longer supported.
533+
(Contributed by Christian Heimes in :issue:`45747`.)
534+
531535
C API Changes
532536
=============
533537

Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
gdbm and dbm build dependencies are now detected by ``configure``.

Modules/Setup

+1-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ time timemodule.c
216216
#_bz2 _bz2module.c -lbz2
217217
#_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
218218
# The _dbm module supports NDBM, GDBM with compat module, and Berkeley DB.
219-
#_dbm _dbmmodule.c -lgdbm_compat -DHAVE_NDBM_H
219+
#_dbm _dbmmodule.c -lgdbm_compat -DUSE_GDBM_COMPAT
220220
#_gdbm _gdbmmodule.c -lgdbm
221221
#_lzma _lzmamodule.c -llzma
222222
#_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

Modules/_dbmmodule.c

+19-13
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,26 @@
1212
/* Some Linux systems install gdbm/ndbm.h, but not ndbm.h. This supports
1313
* whichever configure was able to locate.
1414
*/
15-
#if defined(HAVE_NDBM_H)
16-
#include <ndbm.h>
17-
static const char which_dbm[] = "GNU gdbm"; /* EMX port of GDBM */
18-
#elif defined(HAVE_GDBM_NDBM_H)
19-
#include <gdbm/ndbm.h>
20-
static const char which_dbm[] = "GNU gdbm";
21-
#elif defined(HAVE_GDBM_DASH_NDBM_H)
22-
#include <gdbm-ndbm.h>
23-
static const char which_dbm[] = "GNU gdbm";
24-
#elif defined(HAVE_BERKDB_H)
25-
#include <db.h>
26-
static const char which_dbm[] = "Berkeley DB";
15+
#if defined(USE_NDBM)
16+
#include <ndbm.h>
17+
static const char which_dbm[] = "GNU gdbm"; /* EMX port of GDBM */
18+
#elif defined(USE_GDBM_COMPAT)
19+
#ifdef HAVE_GDBM_NDBM_H
20+
#include <gdbm/ndbm.h>
21+
#elif HAVE_GDBM_DASH_NDBM_H
22+
#include <gdbm-ndbm.h>
23+
#else
24+
#error "No gdbm/ndbm.h or gdbm-ndbm.h available"
25+
#endif
26+
static const char which_dbm[] = "GNU gdbm";
27+
#elif defined(USE_BERKDB)
28+
#ifndef DB_DBM_HSEARCH
29+
#define DB_DBM_HSEARCH 1
30+
#endif
31+
#include <db.h>
32+
static const char which_dbm[] = "Berkeley DB";
2733
#else
28-
#error "No ndbm.h available!"
34+
#error "No ndbm.h available!"
2935
#endif
3036

3137
typedef struct {

0 commit comments

Comments
 (0)