summaryrefslogtreecommitdiff
path: root/Modules
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2021-11-10 21:26:55 +0200
committerGitHub <noreply@github.com>2021-11-10 20:26:55 +0100
commit0a9f69539be27acf1cddf1b58d02a88d02e5008d (patch)
tree45073f51d11b129bd88c0da801c0a23a61e7558f /Modules
parentc1323d4b8cb010a06c11bace6e681bea7f895851 (diff)
downloadcpython-git-0a9f69539be27acf1cddf1b58d02a88d02e5008d.tar.gz
bpo-45747: Detect gdbm/dbm dependencies in configure (GH-29467)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
Diffstat (limited to 'Modules')
-rw-r--r--Modules/Setup2
-rw-r--r--Modules/_dbmmodule.c32
2 files changed, 20 insertions, 14 deletions
diff --git a/Modules/Setup b/Modules/Setup
index 57584f38fd..49c6903121 100644
--- a/Modules/Setup
+++ b/Modules/Setup
@@ -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
diff --git a/Modules/_dbmmodule.c b/Modules/_dbmmodule.c
index 4cbbac3326..c0371fb3f3 100644
--- a/Modules/_dbmmodule.c
+++ b/Modules/_dbmmodule.c
@@ -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 {