]> granicus.if.org Git - python/commitdiff
issue 4483 - _dbm build failures on systems with gdbm_compat lib.
authorSkip Montanaro <skip@pobox.com>
Sat, 6 Dec 2008 17:25:02 +0000 (17:25 +0000)
committerSkip Montanaro <skip@pobox.com>
Sat, 6 Dec 2008 17:25:02 +0000 (17:25 +0000)
Misc/NEWS
Modules/_dbmmodule.c
setup.py

index 472751f09b57ed4702d0a9bc93967d385e97f057..9445457a754ff34d8e1c2f8f6a1dc127a5d8abe9 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -25,6 +25,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #4483: _dbm module now builds on systems with gdbm & gdbm_compat
+  libs.
+
 - Issue #4542: On Windows, binascii.crc32 still accepted str as binary input;
   the corresponding tests now pass.
 
index 1aef3d9bb94c389eb6762e01de62d52d4489f329..57755111a6a7730e0cc4c51acb149c75f75aa159 100644 (file)
@@ -21,6 +21,9 @@ static char *which_dbm = "GNU gdbm";  /* EMX port of GDBM */
 #elif defined(HAVE_GDBM_NDBM_H)
 #include <gdbm/ndbm.h>
 static char *which_dbm = "GNU gdbm";
+#elif defined(HAVE_GDBM_DASH_NDBM_H)
+#include <gdbm-ndbm.h>
+static char *which_dbm = "GNU gdbm";
 #elif defined(HAVE_BERKDB_H)
 #include <db.h>
 static char *which_dbm = "Berkeley DB";
index d2931d16922135869f524716d3340ad1f37a7f30..d6d9c97e7b54347b205efe7f389aac4038265afb 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -783,11 +783,20 @@ class PyBuildExt(build_ext):
                 exts.append( Extension('_dbm', ['_dbmmodule.c'],
                                        define_macros=[('HAVE_NDBM_H',None)],
                                        libraries = ndbm_libs ) )
-            elif (self.compiler.find_library_file(lib_dirs, 'gdbm')
-                  and find_file("gdbm/ndbm.h", inc_dirs, []) is not None):
-                exts.append( Extension('_dbm', ['_dbmmodule.c'],
-                                       define_macros=[('HAVE_GDBM_NDBM_H',None)],
-                                       libraries = ['gdbm'] ) )
+            elif self.compiler.find_library_file(lib_dirs, 'gdbm'):
+                gdbm_libs = ['gdbm']
+                if self.compiler.find_library_file(lib_dirs, 'gdbm_compat'):
+                    gdbm_libs.append('gdbm_compat')
+                if find_file("gdbm/ndbm.h", inc_dirs, []) is not None:
+                    exts.append( Extension(
+                        '_dbm', ['_dbmmodule.c'],
+                        define_macros=[('HAVE_GDBM_NDBM_H',None)],
+                        libraries = gdbm_libs ) )
+                elif find_file("gdbm-ndbm.h", inc_dirs, []) is not None:
+                    exts.append( Extension(
+                        '_dbm', ['_dbmmodule.c'],
+                        define_macros=[('HAVE_GDBM_DASH_NDBM_H',None)],
+                        libraries = gdbm_libs ) )
             elif db_incs is not None:
                 exts.append( Extension('_dbm', ['_dbmmodule.c'],
                                        library_dirs=dblib_dir,