summaryrefslogtreecommitdiffstats
path: root/Modules/_dbmmodule.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2021-11-10 19:26:55 (GMT)
committerGitHub <noreply@github.com>2021-11-10 19:26:55 (GMT)
commit0a9f69539be27acf1cddf1b58d02a88d02e5008d (patch)
tree45073f51d11b129bd88c0da801c0a23a61e7558f /Modules/_dbmmodule.c
parentc1323d4b8cb010a06c11bace6e681bea7f895851 (diff)
downloadcpython-0a9f69539be27acf1cddf1b58d02a88d02e5008d.zip
cpython-0a9f69539be27acf1cddf1b58d02a88d02e5008d.tar.gz
cpython-0a9f69539be27acf1cddf1b58d02a88d02e5008d.tar.bz2
bpo-45747: Detect gdbm/dbm dependencies in configure (GH-29467)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
Diffstat (limited to 'Modules/_dbmmodule.c')
-rw-r--r--Modules/_dbmmodule.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/Modules/_dbmmodule.c b/Modules/_dbmmodule.c
index 4cbbac3..c0371fb 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 {