- Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify

the order that backends for the dbm extension are checked.
This commit is contained in:
Matthias Klose 2009-04-29 17:18:19 +00:00
parent 971b1b100b
commit 10cbe4886e
4 changed files with 88 additions and 33 deletions

View File

@ -814,6 +814,9 @@ Tools/Demos
Build Build
----- -----
- Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
the order that backends for the dbm extension are checked.
- Link the shared python library with $(MODLIBS). - Link the shared python library with $(MODLIBS).
- Issue #5134: Silence compiler warnings when compiling sqlite with VC++. - Issue #5134: Silence compiler warnings when compiling sqlite with VC++.

3
README
View File

@ -1068,6 +1068,9 @@ Modules/getpath.o.
--with-system-ffi: Build the _ctypes extension module using an ffi --with-system-ffi: Build the _ctypes extension module using an ffi
library installed on the system. library installed on the system.
--with-dbmliborder=db1:db2:...: Specify the order that backends for the
dbm extension are checked. Valid value is a colon separated string
with the backend names `ndbm', `gdbm' and `bdb'.
Building for multiple architectures (using the VPATH feature) Building for multiple architectures (using the VPATH feature)
------------------------------------------------------------- -------------------------------------------------------------

View File

@ -1918,6 +1918,26 @@ AC_ARG_WITH(system_ffi,
AC_MSG_RESULT($with_system_ffi) AC_MSG_RESULT($with_system_ffi)
# Check for --with-dbmliborder
AC_MSG_CHECKING(for --with-dbmliborder)
AC_ARG_WITH(dbmliborder,
AC_HELP_STRING(--with-dbmliborder=db1:db2:..., order to check db backends for dbm),
[
if test x$with_dbmliborder = xyes
then
AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
else
for db in `echo $with_dbmliborder | sed 's/:/ /g'`; do
if test x$db != xndbm && test x$db != xgdbm && test x$db != xbdb
then
AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
fi
done
AC_MSG_RESULT($with_dbmliborder)
fi],
[AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
])
# Determine if signalmodule should be used. # Determine if signalmodule should be used.
AC_SUBST(USE_SIGNAL_MODULE) AC_SUBST(USE_SIGNAL_MODULE)
AC_SUBST(SIGNAL_OBJS) AC_SUBST(SIGNAL_OBJS)

View File

@ -1000,39 +1000,68 @@ class PyBuildExt(build_ext):
# The standard Unix dbm module: # The standard Unix dbm module:
if platform not in ['cygwin']: if platform not in ['cygwin']:
if find_file("ndbm.h", inc_dirs, []) is not None: config_args = sysconfig.get_config_var("CONFIG_ARGS")
# Some systems have -lndbm, others don't dbm_args = [arg.split('=')[-1] for arg in args.split()
if self.compiler.find_library_file(lib_dirs, 'ndbm'): if arg.startswith('--with-dbmliborder=')]
ndbm_libs = ['ndbm'] if dbm_args:
else: dbm_order = "ndbm:gdbm:bdb".split(":")
ndbm_libs = [] else:
exts.append( Extension('dbm', ['dbmmodule.c'], dbm_order = dbm_args.split(":")
define_macros=[('HAVE_NDBM_H',None)], dbmext = None
libraries = ndbm_libs ) ) for cand in dbm_order:
elif self.compiler.find_library_file(lib_dirs, 'gdbm'): if cand == "ndbm":
gdbm_libs = ['gdbm'] if find_file("ndbm.h", inc_dirs, []) is not None:
if self.compiler.find_library_file(lib_dirs, 'gdbm_compat'): # Some systems have -lndbm, others don't
gdbm_libs.append('gdbm_compat') if self.compiler.find_library_file(lib_dirs, 'ndbm'):
if find_file("gdbm/ndbm.h", inc_dirs, []) is not None: ndbm_libs = ['ndbm']
exts.append( Extension( else:
'dbm', ['dbmmodule.c'], ndbm_libs = []
define_macros=[('HAVE_GDBM_NDBM_H',None)], print "building dbm using ndbm"
libraries = gdbm_libs ) ) dbmext = Extension('dbm', ['dbmmodule.c'],
elif find_file("gdbm-ndbm.h", inc_dirs, []) is not None: define_macros=[
exts.append( Extension( ('HAVE_NDBM_H',None),
'dbm', ['dbmmodule.c'], ],
define_macros=[('HAVE_GDBM_DASH_NDBM_H',None)], libraries=ndbm_libs)
libraries = gdbm_libs ) ) break
else:
missing.append('dbm') elif cand == "gdbm":
elif db_incs is not None: if self.compiler.find_library_file(lib_dirs, 'gdbm'):
exts.append( Extension('dbm', ['dbmmodule.c'], gdbm_libs = ['gdbm']
library_dirs=dblib_dir, if self.compiler.find_library_file(lib_dirs, 'gdbm_compat'):
runtime_library_dirs=dblib_dir, gdbm_libs.append('gdbm_compat')
include_dirs=db_incs, if find_file("gdbm/ndbm.h", inc_dirs, []) is not None:
define_macros=[('HAVE_BERKDB_H',None), print "building dbm using gdbm"
('DB_DBM_HSEARCH',None)], dbmext = Extension(
libraries=dblibs)) 'dbm', ['dbmmodule.c'],
define_macros=[
('HAVE_GDBM_NDBM_H', None),
],
libraries = gdbm_libs)
break
if find_file("gdbm-ndbm.h", inc_dirs, []) is not None:
print "building dbm using gdbm"
dbmext = Extension(
'dbm', ['dbmmodule.c'],
define_macros=[
('HAVE_GDBM_DASH_NDBM_H', None),
],
libraries = gdbm_libs)
break
elif cand == "bdb":
if db_incs is not None:
print "building dbm using bdb"
dbmext = Extension('dbm', ['dbmmodule.c'],
library_dirs=dblib_dir,
runtime_library_dirs=dblib_dir,
include_dirs=db_incs,
define_macros=[
('HAVE_BERKDB_H', None),
('DB_DBM_HSEARCH', None),
],
libraries=dblibs)
break
if dbmext is not None:
exts.append(dbmext)
else: else:
missing.append('dbm') missing.append('dbm')