Skip to content

Commit 76cabf8

Browse files
author
skip.montanaro
committed
issue 4483 - dbm build failures on systems with gdbm_compat lib.
git-svn-id: http://svn.python.org/projects/python/trunk@67614 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 7f2c21f commit 76cabf8

3 files changed

Lines changed: 20 additions & 2 deletions

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ Core and Builtins
6565
Library
6666
-------
6767

68+
- Issue #4483: _dbm module now builds on systems with gdbm & gdbm_compat
69+
libs.
70+
6871
- Issue #4529: fix the parser module's validation of try-except-finally
6972
statements.
7073

Modules/dbmmodule.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ static char *which_dbm = "GNU gdbm"; /* EMX port of GDBM */
2121
#elif defined(HAVE_GDBM_NDBM_H)
2222
#include <gdbm/ndbm.h>
2323
static char *which_dbm = "GNU gdbm";
24+
#elif defined(HAVE_GDBM_DASH_NDBM_H)
25+
#include <gdbm-ndbm.h>
26+
static char *which_dbm = "GNU gdbm";
2427
#elif defined(HAVE_BERKDB_H)
2528
#include <db.h>
2629
static char *which_dbm = "Berkeley DB";

setup.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,8 +1019,20 @@ class db_found(Exception): pass
10191019
exts.append( Extension('dbm', ['dbmmodule.c'],
10201020
define_macros=[('HAVE_NDBM_H',None)],
10211021
libraries = ndbm_libs ) )
1022-
elif (self.compiler.find_library_file(lib_dirs, 'gdbm')
1023-
and find_file("gdbm/ndbm.h", inc_dirs, []) is not None):
1022+
elif self.compiler.find_library_file(lib_dirs, 'gdbm'):
1023+
gdbm_libs = ['gdbm']
1024+
if self.compiler.find_library_file(lib_dirs, 'gdbm_compat'):
1025+
gdbm_libs.append('gdbm_compat')
1026+
if find_file("gdbm/ndbm.h", inc_dirs, []) is not None:
1027+
exts.append( Extension(
1028+
'dbm', ['dbmmodule.c'],
1029+
define_macros=[('HAVE_GDBM_NDBM_H',None)],
1030+
libraries = gdbm_libs ) )
1031+
elif find_file("gdbm-ndbm.h", inc_dirs, []) is not None:
1032+
exts.append( Extension(
1033+
'dbm', ['dbmmodule.c'],
1034+
define_macros=[('HAVE_GDBM_DASH_NDBM_H',None)],
1035+
libraries = gdbm_libs ) )
10241036
exts.append( Extension('dbm', ['dbmmodule.c'],
10251037
define_macros=[('HAVE_GDBM_NDBM_H',None)],
10261038
libraries = ['gdbm'] ) )

0 commit comments

Comments
 (0)