mirror of
https://github.com/python/cpython
synced 2024-09-05 00:05:39 +00:00
bpo-45847: Port _gdbm to PY_STDLIB_MOD (GH-29720)
This commit is contained in:
parent
b9e9292d75
commit
9cf5646bb4
|
@ -66,6 +66,11 @@
|
|||
@MODULE__LZMA_TRUE@_lzma _lzmamodule.c
|
||||
@MODULE_ZLIB_TRUE@zlib zlibmodule.c
|
||||
|
||||
# dbm/gdbm
|
||||
# dbm needs either libndbm, libgdbm_compat, or libdb 5.x
|
||||
# gdbm module needs -lgdbm
|
||||
@MODULE__GDBM_TRUE@_gdbm _gdbmmodule.c
|
||||
|
||||
# hashing builtins, can be disabled with --without-builtin-hashlib-hashes
|
||||
@MODULE__MD5_TRUE@_md5 md5module.c
|
||||
@MODULE__SHA1_TRUE@_sha1 sha1module.c
|
||||
|
|
119
configure
vendored
119
configure
vendored
|
@ -658,6 +658,8 @@ MODULE__SQLITE3_FALSE
|
|||
MODULE__SQLITE3_TRUE
|
||||
MODULE_NIS_FALSE
|
||||
MODULE_NIS_TRUE
|
||||
MODULE__GDBM_FALSE
|
||||
MODULE__GDBM_TRUE
|
||||
MODULE__DECIMAL_FALSE
|
||||
MODULE__DECIMAL_TRUE
|
||||
MODULE__CRYPT_FALSE
|
||||
|
@ -807,6 +809,8 @@ DTRACE_OBJS
|
|||
DTRACE_HEADERS
|
||||
DFLAGS
|
||||
DTRACE
|
||||
GDBM_LIBS
|
||||
GDBM_CFLAGS
|
||||
TCLTK_LIBS
|
||||
TCLTK_INCLUDES
|
||||
LIBSQLITE3_LIBS
|
||||
|
@ -1044,6 +1048,8 @@ LIBNSL_CFLAGS
|
|||
LIBNSL_LIBS
|
||||
LIBSQLITE3_CFLAGS
|
||||
LIBSQLITE3_LIBS
|
||||
GDBM_CFLAGS
|
||||
GDBM_LIBS
|
||||
ZLIB_CFLAGS
|
||||
ZLIB_LIBS
|
||||
BZIP2_CFLAGS
|
||||
|
@ -1832,6 +1838,8 @@ Some influential environment variables:
|
|||
C compiler flags for LIBSQLITE3, overriding pkg-config
|
||||
LIBSQLITE3_LIBS
|
||||
linker flags for LIBSQLITE3, overriding pkg-config
|
||||
GDBM_CFLAGS C compiler flags for gdbm
|
||||
GDBM_LIBS additional linker flags for gdbm
|
||||
ZLIB_CFLAGS C compiler flags for ZLIB, overriding pkg-config
|
||||
ZLIB_LIBS linker flags for ZLIB, overriding pkg-config
|
||||
BZIP2_CFLAGS
|
||||
|
@ -11668,8 +11676,17 @@ else
|
|||
TCLTK_LIBS="$with_tcltk_libs"
|
||||
fi
|
||||
|
||||
# check for _gdbmmodulec dependencies
|
||||
for ac_header in gdbm.h
|
||||
|
||||
|
||||
save_CFLAGS=$CFLAGS
|
||||
save_CPPFLAGS=$CPPFLAGS
|
||||
save_LDFLAGS=$LDFLAGS
|
||||
save_LIBS=$LIBS
|
||||
|
||||
|
||||
CPPFLAGS="$GDBM_CFLAGS $CFLAGS"
|
||||
LDFLAGS="$GDBM_LIBS $LDFLAGS"
|
||||
for ac_header in gdbm.h
|
||||
do :
|
||||
ac_fn_c_check_header_mongrel "$LINENO" "gdbm.h" "ac_cv_header_gdbm_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_gdbm_h" = xyes; then :
|
||||
|
@ -11677,8 +11694,7 @@ if test "x$ac_cv_header_gdbm_h" = xyes; then :
|
|||
#define HAVE_GDBM_H 1
|
||||
_ACEOF
|
||||
|
||||
LIBS_SAVE=$LIBS
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdbm_open in -lgdbm" >&5
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdbm_open in -lgdbm" >&5
|
||||
$as_echo_n "checking for gdbm_open in -lgdbm... " >&6; }
|
||||
if ${ac_cv_lib_gdbm_gdbm_open+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
|
@ -11715,21 +11731,29 @@ fi
|
|||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gdbm_gdbm_open" >&5
|
||||
$as_echo "$ac_cv_lib_gdbm_gdbm_open" >&6; }
|
||||
if test "x$ac_cv_lib_gdbm_gdbm_open" = xyes; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_LIBGDBM 1
|
||||
_ACEOF
|
||||
|
||||
LIBS="-lgdbm $LIBS"
|
||||
have_gdbm=yes
|
||||
GDBM_LIBS="$GDBM_LIBS -lgdbm"
|
||||
|
||||
else
|
||||
have_gdbm=no
|
||||
fi
|
||||
|
||||
LIBS=$LIBS_SAVE
|
||||
|
||||
else
|
||||
have_gdbm=no
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
|
||||
CFLAGS=$save_CFLAGS
|
||||
CPPFLAGS=$save_CPPFLAGS
|
||||
LDFLAGS=$save_LDFLAGS
|
||||
LIBS=$save_LIBS
|
||||
|
||||
|
||||
|
||||
# check for _dbmmodule.c dependencies
|
||||
for ac_header in ndbm.h
|
||||
do :
|
||||
|
@ -12009,22 +12033,33 @@ $as_echo_n "checking for --with-dbmliborder... " >&6; }
|
|||
# Check whether --with-dbmliborder was given.
|
||||
if test "${with_dbmliborder+set}" = set; then :
|
||||
withval=$with_dbmliborder;
|
||||
if test x$with_dbmliborder = xyes
|
||||
then
|
||||
as_fn_error $? "proper usage is --with-dbmliborder=db1:db2:..." "$LINENO" 5
|
||||
else
|
||||
as_save_IFS=$IFS
|
||||
IFS=:
|
||||
for db in $with_dbmliborder; do
|
||||
if test x$db != xndbm && test x$db != xgdbm && test x$db != xbdb
|
||||
then
|
||||
as_fn_error $? "proper usage is --with-dbmliborder=db1:db2:..." "$LINENO" 5
|
||||
fi
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
fi
|
||||
with_dbmliborder=ndbm:gdbm:bdb
|
||||
fi
|
||||
|
||||
|
||||
have_gdbm_dbmliborder=no
|
||||
as_save_IFS=$IFS
|
||||
IFS=:
|
||||
for db in $with_dbmliborder; do
|
||||
case $db in #(
|
||||
ndbm) :
|
||||
;; #(
|
||||
gdbm) :
|
||||
have_gdbm_dbmliborder=yes ;; #(
|
||||
bdb) :
|
||||
;; #(
|
||||
*) :
|
||||
with_dbmliborder=error
|
||||
;;
|
||||
esac
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
if test "x$with_dbmliborder" = xerror; then :
|
||||
|
||||
as_fn_error $? "proper usage is --with-dbmliborder=db1:db2:... (ndbm:gdbm:bdb)" "$LINENO" 5
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_dbmliborder" >&5
|
||||
$as_echo "$with_dbmliborder" >&6; }
|
||||
|
||||
|
@ -21725,6 +21760,42 @@ fi
|
|||
$as_echo "$py_cv_module__decimal" >&6; }
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _gdbm" >&5
|
||||
$as_echo_n "checking for stdlib extension module _gdbm... " >&6; }
|
||||
case $py_stdlib_not_available in #(
|
||||
*_gdbm*) :
|
||||
py_cv_module__gdbm=n/a ;; #(
|
||||
*) :
|
||||
if test "$have_gdbm_dbmliborder" = yes; then :
|
||||
if test "$have_gdbm" = yes; then :
|
||||
py_cv_module__gdbm=yes
|
||||
else
|
||||
py_cv_module__gdbm=missing
|
||||
fi
|
||||
else
|
||||
py_cv_module__gdbm=disabled
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
as_fn_append MODULE_BLOCK "MODULE__GDBM=$py_cv_module__gdbm$as_nl"
|
||||
if test "x$py_cv_module__gdbm" = xyes; then :
|
||||
|
||||
as_fn_append MODULE_BLOCK "MODULE__GDBM_CFLAGS=$GDBM_CFLAGS$as_nl"
|
||||
as_fn_append MODULE_BLOCK "MODULE__GDBM_LDFLAGS=$GDBM_LIBS$as_nl"
|
||||
|
||||
fi
|
||||
if test "$py_cv_module__gdbm" = yes; then
|
||||
MODULE__GDBM_TRUE=
|
||||
MODULE__GDBM_FALSE='#'
|
||||
else
|
||||
MODULE__GDBM_TRUE='#'
|
||||
MODULE__GDBM_FALSE=
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__gdbm" >&5
|
||||
$as_echo "$py_cv_module__gdbm" >&6; }
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module nis" >&5
|
||||
$as_echo_n "checking for stdlib extension module nis... " >&6; }
|
||||
case $py_stdlib_not_available in #(
|
||||
|
@ -22650,6 +22721,10 @@ if test -z "${MODULE__DECIMAL_TRUE}" && test -z "${MODULE__DECIMAL_FALSE}"; then
|
|||
as_fn_error $? "conditional \"MODULE__DECIMAL\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
fi
|
||||
if test -z "${MODULE__GDBM_TRUE}" && test -z "${MODULE__GDBM_FALSE}"; then
|
||||
as_fn_error $? "conditional \"MODULE__GDBM\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
fi
|
||||
if test -z "${MODULE_NIS_TRUE}" && test -z "${MODULE_NIS_FALSE}"; then
|
||||
as_fn_error $? "conditional \"MODULE_NIS\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||
|
|
53
configure.ac
53
configure.ac
|
@ -3303,11 +3303,19 @@ else
|
|||
TCLTK_LIBS="$with_tcltk_libs"
|
||||
fi
|
||||
|
||||
# check for _gdbmmodulec dependencies
|
||||
AC_CHECK_HEADERS([gdbm.h], [
|
||||
LIBS_SAVE=$LIBS
|
||||
AC_CHECK_LIB([gdbm], [gdbm_open])
|
||||
LIBS=$LIBS_SAVE
|
||||
dnl check for _gdbmmodule dependencies
|
||||
dnl NOTE: gdbm does not provide a pkgconf file.
|
||||
AC_ARG_VAR([GDBM_CFLAGS], [C compiler flags for gdbm])
|
||||
AC_ARG_VAR([GDBM_LIBS], [additional linker flags for gdbm])
|
||||
WITH_SAVE_ENV([
|
||||
CPPFLAGS="$GDBM_CFLAGS $CFLAGS"
|
||||
LDFLAGS="$GDBM_LIBS $LDFLAGS"
|
||||
AC_CHECK_HEADERS([gdbm.h], [
|
||||
AC_CHECK_LIB([gdbm], [gdbm_open], [
|
||||
have_gdbm=yes
|
||||
GDBM_LIBS="$GDBM_LIBS -lgdbm"
|
||||
], [have_gdbm=no])
|
||||
], [have_gdbm=no])
|
||||
])
|
||||
|
||||
# check for _dbmmodule.c dependencies
|
||||
|
@ -3375,21 +3383,23 @@ AC_CHECK_HEADERS([db.h], [
|
|||
AC_MSG_CHECKING(for --with-dbmliborder)
|
||||
AC_ARG_WITH(dbmliborder,
|
||||
AS_HELP_STRING([--with-dbmliborder=db1:db2:...], [override order to check db backends for dbm; a valid value is a colon separated string with the backend names `ndbm', `gdbm' and `bdb'.]),
|
||||
[
|
||||
if test x$with_dbmliborder = xyes
|
||||
then
|
||||
AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:...])
|
||||
else
|
||||
as_save_IFS=$IFS
|
||||
IFS=:
|
||||
for db in $with_dbmliborder; 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
|
||||
IFS=$as_save_IFS
|
||||
fi])
|
||||
[], [with_dbmliborder=ndbm:gdbm:bdb])
|
||||
|
||||
have_gdbm_dbmliborder=no
|
||||
as_save_IFS=$IFS
|
||||
IFS=:
|
||||
for db in $with_dbmliborder; do
|
||||
AS_CASE([$db],
|
||||
[ndbm], [],
|
||||
[gdbm], [have_gdbm_dbmliborder=yes],
|
||||
[bdb], [],
|
||||
[with_dbmliborder=error]
|
||||
)
|
||||
done
|
||||
IFS=$as_save_IFS
|
||||
AS_VAR_IF([with_dbmliborder], [error], [
|
||||
AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:... (ndbm:gdbm:bdb)])
|
||||
])
|
||||
AC_MSG_RESULT($with_dbmliborder)
|
||||
|
||||
# Templates for things AC_DEFINEd more than once.
|
||||
|
@ -6279,6 +6289,9 @@ PY_STDLIB_MOD([_crypt],
|
|||
[], [test "$ac_cv_crypt_crypt" = yes],
|
||||
[$LIBCRYPT_CFLAGS], [$LIBCRYPT_LIBS])
|
||||
PY_STDLIB_MOD([_decimal], [], [], [$LIBMPDEC_CFLAGS], [$LIBMPDEC_LDFLAGS])
|
||||
PY_STDLIB_MOD([_gdbm],
|
||||
[test "$have_gdbm_dbmliborder" = yes], [test "$have_gdbm" = yes],
|
||||
[$GDBM_CFLAGS], [$GDBM_LIBS])
|
||||
PY_STDLIB_MOD([nis],
|
||||
[], [test "$have_nis" = yes -a "$ac_cv_header_rpc_rpc_h" = yes],
|
||||
[$LIBNSL_CFLAGS], [$LIBNSL_LIBS])
|
||||
|
|
|
@ -604,9 +604,6 @@
|
|||
/* Define to 1 if you have the `dld' library (-ldld). */
|
||||
#undef HAVE_LIBDLD
|
||||
|
||||
/* Define to 1 if you have the `gdbm' library (-lgdbm). */
|
||||
#undef HAVE_LIBGDBM
|
||||
|
||||
/* Define to 1 if you have the `gdbm_compat' library (-lgdbm_compat). */
|
||||
#undef HAVE_LIBGDBM_COMPAT
|
||||
|
||||
|
|
8
setup.py
8
setup.py
|
@ -1256,11 +1256,9 @@ def detect_dbm_gdbm(self):
|
|||
|
||||
# libdb, gdbm and ndbm headers and libraries
|
||||
have_ndbm_h = sysconfig.get_config_var("HAVE_NDBM_H")
|
||||
have_gdbm_h = sysconfig.get_config_var("HAVE_GDBM_H")
|
||||
have_gdbm_ndbm_h = sysconfig.get_config_var("HAVE_GDBM_NDBM_H")
|
||||
have_gdbm_dash_ndbm_h = sysconfig.get_config_var("HAVE_GDBM_DASH_NDBM_H")
|
||||
have_libndbm = sysconfig.get_config_var("HAVE_LIBNDBM")
|
||||
have_libgdbm = sysconfig.get_config_var("HAVE_LIBGDBM")
|
||||
have_libgdbm_compat = sysconfig.get_config_var("HAVE_LIBGDBM_COMPAT")
|
||||
have_libdb = sysconfig.get_config_var("HAVE_LIBDB")
|
||||
|
||||
|
@ -1318,11 +1316,7 @@ def detect_dbm_gdbm(self):
|
|||
self.missing.append('_dbm')
|
||||
|
||||
# Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm:
|
||||
if 'gdbm' in dbm_order and have_libgdbm:
|
||||
self.add(Extension('_gdbm', ['_gdbmmodule.c'],
|
||||
libraries=['gdbm']))
|
||||
else:
|
||||
self.missing.append('_gdbm')
|
||||
self.addext(Extension('_gdbm', ['_gdbmmodule.c']))
|
||||
|
||||
def detect_sqlite(self):
|
||||
sources = [
|
||||
|
|
Loading…
Reference in a new issue