mirror of https://github.com/python/cpython
gh-90005: Port _dbm module to PY_STDLIB_MOD (GH-94433)
This commit is contained in:
parent
80aaeabb8b
commit
ec5e253556
|
@ -0,0 +1 @@
|
||||||
|
``_dbm`` module dependencies are now detected by configure.
|
|
@ -68,7 +68,7 @@
|
||||||
|
|
||||||
# dbm/gdbm
|
# dbm/gdbm
|
||||||
# dbm needs either libndbm, libgdbm_compat, or libdb 5.x
|
# dbm needs either libndbm, libgdbm_compat, or libdb 5.x
|
||||||
#@MODULE__DBM_TRUE@_dbm _dbmmodule.c
|
@MODULE__DBM_TRUE@_dbm _dbmmodule.c
|
||||||
# gdbm module needs -lgdbm
|
# gdbm module needs -lgdbm
|
||||||
@MODULE__GDBM_TRUE@_gdbm _gdbmmodule.c
|
@MODULE__GDBM_TRUE@_gdbm _gdbmmodule.c
|
||||||
|
|
||||||
|
|
|
@ -664,6 +664,8 @@ MODULE_NIS_FALSE
|
||||||
MODULE_NIS_TRUE
|
MODULE_NIS_TRUE
|
||||||
MODULE__GDBM_FALSE
|
MODULE__GDBM_FALSE
|
||||||
MODULE__GDBM_TRUE
|
MODULE__GDBM_TRUE
|
||||||
|
MODULE__DBM_FALSE
|
||||||
|
MODULE__DBM_TRUE
|
||||||
MODULE__DECIMAL_FALSE
|
MODULE__DECIMAL_FALSE
|
||||||
MODULE__DECIMAL_TRUE
|
MODULE__DECIMAL_TRUE
|
||||||
MODULE__CTYPES_FALSE
|
MODULE__CTYPES_FALSE
|
||||||
|
@ -14040,7 +14042,6 @@ LIBS=$save_LIBS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# check for _dbmmodule.c dependencies
|
|
||||||
for ac_header in ndbm.h
|
for ac_header in ndbm.h
|
||||||
do :
|
do :
|
||||||
ac_fn_c_check_header_mongrel "$LINENO" "ndbm.h" "ac_cv_header_ndbm_h" "$ac_includes_default"
|
ac_fn_c_check_header_mongrel "$LINENO" "ndbm.h" "ac_cv_header_ndbm_h" "$ac_includes_default"
|
||||||
|
@ -14049,14 +14050,18 @@ if test "x$ac_cv_header_ndbm_h" = xyes; then :
|
||||||
#define HAVE_NDBM_H 1
|
#define HAVE_NDBM_H 1
|
||||||
_ACEOF
|
_ACEOF
|
||||||
|
|
||||||
LIBS_SAVE="$LIBS"
|
save_CFLAGS=$CFLAGS
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dbm_open in -lndbm" >&5
|
save_CPPFLAGS=$CPPFLAGS
|
||||||
$as_echo_n "checking for dbm_open in -lndbm... " >&6; }
|
save_LDFLAGS=$LDFLAGS
|
||||||
if ${ac_cv_lib_ndbm_dbm_open+:} false; then :
|
save_LIBS=$LIBS
|
||||||
|
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dbm_open" >&5
|
||||||
|
$as_echo_n "checking for library containing dbm_open... " >&6; }
|
||||||
|
if ${ac_cv_search_dbm_open+:} false; then :
|
||||||
$as_echo_n "(cached) " >&6
|
$as_echo_n "(cached) " >&6
|
||||||
else
|
else
|
||||||
ac_check_lib_save_LIBS=$LIBS
|
ac_func_search_save_LIBS=$LIBS
|
||||||
LIBS="-lndbm $LIBS"
|
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
/* end confdefs.h. */
|
/* end confdefs.h. */
|
||||||
|
|
||||||
|
@ -14075,81 +14080,73 @@ return dbm_open ();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
_ACEOF
|
_ACEOF
|
||||||
if ac_fn_c_try_link "$LINENO"; then :
|
for ac_lib in '' ndbm gdbm_compat; do
|
||||||
ac_cv_lib_ndbm_dbm_open=yes
|
if test -z "$ac_lib"; then
|
||||||
else
|
ac_res="none required"
|
||||||
ac_cv_lib_ndbm_dbm_open=no
|
else
|
||||||
|
ac_res=-l$ac_lib
|
||||||
|
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
|
||||||
|
fi
|
||||||
|
if ac_fn_c_try_link "$LINENO"; then :
|
||||||
|
ac_cv_search_dbm_open=$ac_res
|
||||||
fi
|
fi
|
||||||
rm -f core conftest.err conftest.$ac_objext \
|
rm -f core conftest.err conftest.$ac_objext \
|
||||||
conftest$ac_exeext conftest.$ac_ext
|
conftest$ac_exeext
|
||||||
LIBS=$ac_check_lib_save_LIBS
|
if ${ac_cv_search_dbm_open+:} false; then :
|
||||||
|
break
|
||||||
fi
|
fi
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ndbm_dbm_open" >&5
|
done
|
||||||
$as_echo "$ac_cv_lib_ndbm_dbm_open" >&6; }
|
if ${ac_cv_search_dbm_open+:} false; then :
|
||||||
if test "x$ac_cv_lib_ndbm_dbm_open" = xyes; then :
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
|
||||||
#define HAVE_LIBNDBM 1
|
|
||||||
_ACEOF
|
|
||||||
|
|
||||||
LIBS="-lndbm $LIBS"
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
LIBS="$LIBS_SAVE"
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dbm_open in -lgdbm_compat" >&5
|
|
||||||
$as_echo_n "checking for dbm_open in -lgdbm_compat... " >&6; }
|
|
||||||
if ${ac_cv_lib_gdbm_compat_dbm_open+:} false; then :
|
|
||||||
$as_echo_n "(cached) " >&6
|
|
||||||
else
|
else
|
||||||
ac_check_lib_save_LIBS=$LIBS
|
ac_cv_search_dbm_open=no
|
||||||
LIBS="-lgdbm_compat $LIBS"
|
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
||||||
/* end confdefs.h. */
|
|
||||||
|
|
||||||
/* Override any GCC internal prototype to avoid an error.
|
|
||||||
Use char because int might match the return type of a GCC
|
|
||||||
builtin and then its argument prototype would still apply. */
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C"
|
|
||||||
#endif
|
|
||||||
char dbm_open ();
|
|
||||||
int
|
|
||||||
main ()
|
|
||||||
{
|
|
||||||
return dbm_open ();
|
|
||||||
;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
_ACEOF
|
|
||||||
if ac_fn_c_try_link "$LINENO"; then :
|
|
||||||
ac_cv_lib_gdbm_compat_dbm_open=yes
|
|
||||||
else
|
|
||||||
ac_cv_lib_gdbm_compat_dbm_open=no
|
|
||||||
fi
|
fi
|
||||||
rm -f core conftest.err conftest.$ac_objext \
|
rm conftest.$ac_ext
|
||||||
conftest$ac_exeext conftest.$ac_ext
|
LIBS=$ac_func_search_save_LIBS
|
||||||
LIBS=$ac_check_lib_save_LIBS
|
|
||||||
fi
|
fi
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gdbm_compat_dbm_open" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dbm_open" >&5
|
||||||
$as_echo "$ac_cv_lib_gdbm_compat_dbm_open" >&6; }
|
$as_echo "$ac_cv_search_dbm_open" >&6; }
|
||||||
if test "x$ac_cv_lib_gdbm_compat_dbm_open" = xyes; then :
|
ac_res=$ac_cv_search_dbm_open
|
||||||
cat >>confdefs.h <<_ACEOF
|
if test "$ac_res" != no; then :
|
||||||
#define HAVE_LIBGDBM_COMPAT 1
|
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
|
||||||
_ACEOF
|
|
||||||
|
|
||||||
LIBS="-lgdbm_compat $LIBS"
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LIBS="$LIBS_SAVE"
|
|
||||||
|
CFLAGS=$save_CFLAGS
|
||||||
|
CPPFLAGS=$save_CPPFLAGS
|
||||||
|
LDFLAGS=$save_LDFLAGS
|
||||||
|
LIBS=$save_LIBS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
# "gdbm-ndbm.h" and "gdbm/ndbm.h" are both normalized to "gdbm_ndbm_h"
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ndbm presence and linker args" >&5
|
||||||
# unset ac_cv_header_gdbm_ndbm_h to prevent false positive cache hits.
|
$as_echo_n "checking for ndbm presence and linker args... " >&6; }
|
||||||
|
case $ac_cv_search_dbm_open in #(
|
||||||
|
*ndbm*|*gdbm_compat*) :
|
||||||
|
|
||||||
|
dbm_ndbm="$ac_cv_search_dbm_open"
|
||||||
|
have_ndbm=yes
|
||||||
|
;; #(
|
||||||
|
none*) :
|
||||||
|
|
||||||
|
dbm_ndbm=""
|
||||||
|
have_ndbm=yes
|
||||||
|
;; #(
|
||||||
|
no) :
|
||||||
|
have_ndbm=no
|
||||||
|
;; #(
|
||||||
|
*) :
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_ndbm ($dbm_ndbm)" >&5
|
||||||
|
$as_echo "$have_ndbm ($dbm_ndbm)" >&6; }
|
||||||
|
|
||||||
{ ac_cv_header_gdbm_ndbm_h=; unset ac_cv_header_gdbm_ndbm_h;}
|
{ ac_cv_header_gdbm_ndbm_h=; unset ac_cv_header_gdbm_ndbm_h;}
|
||||||
if ${ac_cv_header_gdbm_slash_ndbm_h+:} false; then :
|
if ${ac_cv_header_gdbm_slash_ndbm_h+:} false; then :
|
||||||
$as_echo_n "(cached) " >&6
|
$as_echo_n "(cached) " >&6
|
||||||
|
@ -14202,14 +14199,18 @@ fi
|
||||||
{ ac_cv_header_gdbm_ndbm_h=; unset ac_cv_header_gdbm_ndbm_h;}
|
{ ac_cv_header_gdbm_ndbm_h=; unset ac_cv_header_gdbm_ndbm_h;}
|
||||||
|
|
||||||
if test "$ac_cv_header_gdbm_slash_ndbm_h" = yes -o "$ac_cv_header_gdbm_dash_ndbm_h" = yes; then
|
if test "$ac_cv_header_gdbm_slash_ndbm_h" = yes -o "$ac_cv_header_gdbm_dash_ndbm_h" = yes; then
|
||||||
LIBS_SAVE="$LIBS"
|
save_CFLAGS=$CFLAGS
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dbm_open in -lgdbm_compat" >&5
|
save_CPPFLAGS=$CPPFLAGS
|
||||||
$as_echo_n "checking for dbm_open in -lgdbm_compat... " >&6; }
|
save_LDFLAGS=$LDFLAGS
|
||||||
if ${ac_cv_lib_gdbm_compat_dbm_open+:} false; then :
|
save_LIBS=$LIBS
|
||||||
|
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dbm_open" >&5
|
||||||
|
$as_echo_n "checking for library containing dbm_open... " >&6; }
|
||||||
|
if ${ac_cv_search_dbm_open+:} false; then :
|
||||||
$as_echo_n "(cached) " >&6
|
$as_echo_n "(cached) " >&6
|
||||||
else
|
else
|
||||||
ac_check_lib_save_LIBS=$LIBS
|
ac_func_search_save_LIBS=$LIBS
|
||||||
LIBS="-lgdbm_compat $LIBS"
|
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
/* end confdefs.h. */
|
/* end confdefs.h. */
|
||||||
|
|
||||||
|
@ -14228,27 +14229,45 @@ return dbm_open ();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
_ACEOF
|
_ACEOF
|
||||||
if ac_fn_c_try_link "$LINENO"; then :
|
for ac_lib in '' gdbm_compat; do
|
||||||
ac_cv_lib_gdbm_compat_dbm_open=yes
|
if test -z "$ac_lib"; then
|
||||||
else
|
ac_res="none required"
|
||||||
ac_cv_lib_gdbm_compat_dbm_open=no
|
else
|
||||||
|
ac_res=-l$ac_lib
|
||||||
|
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
|
||||||
|
fi
|
||||||
|
if ac_fn_c_try_link "$LINENO"; then :
|
||||||
|
ac_cv_search_dbm_open=$ac_res
|
||||||
fi
|
fi
|
||||||
rm -f core conftest.err conftest.$ac_objext \
|
rm -f core conftest.err conftest.$ac_objext \
|
||||||
conftest$ac_exeext conftest.$ac_ext
|
conftest$ac_exeext
|
||||||
LIBS=$ac_check_lib_save_LIBS
|
if ${ac_cv_search_dbm_open+:} false; then :
|
||||||
|
break
|
||||||
fi
|
fi
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gdbm_compat_dbm_open" >&5
|
done
|
||||||
$as_echo "$ac_cv_lib_gdbm_compat_dbm_open" >&6; }
|
if ${ac_cv_search_dbm_open+:} false; then :
|
||||||
if test "x$ac_cv_lib_gdbm_compat_dbm_open" = xyes; then :
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
|
||||||
#define HAVE_LIBGDBM_COMPAT 1
|
|
||||||
_ACEOF
|
|
||||||
|
|
||||||
LIBS="-lgdbm_compat $LIBS"
|
else
|
||||||
|
ac_cv_search_dbm_open=no
|
||||||
|
fi
|
||||||
|
rm conftest.$ac_ext
|
||||||
|
LIBS=$ac_func_search_save_LIBS
|
||||||
|
fi
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dbm_open" >&5
|
||||||
|
$as_echo "$ac_cv_search_dbm_open" >&6; }
|
||||||
|
ac_res=$ac_cv_search_dbm_open
|
||||||
|
if test "$ac_res" != no; then :
|
||||||
|
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LIBS="$LIBS_SAVE"
|
|
||||||
|
CFLAGS=$save_CFLAGS
|
||||||
|
CPPFLAGS=$save_CPPFLAGS
|
||||||
|
LDFLAGS=$save_LDFLAGS
|
||||||
|
LIBS=$save_LIBS
|
||||||
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for libdb >= 5 with dbm_open()
|
# Check for libdb >= 5 with dbm_open()
|
||||||
|
@ -14267,16 +14286,21 @@ if ${ac_cv_have_libdb+:} false; then :
|
||||||
$as_echo_n "(cached) " >&6
|
$as_echo_n "(cached) " >&6
|
||||||
else
|
else
|
||||||
|
|
||||||
LIBS_SAVE="$LIBS"
|
save_CFLAGS=$CFLAGS
|
||||||
LIBS="$LIBS -ldb"
|
save_CPPFLAGS=$CPPFLAGS
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
save_LDFLAGS=$LDFLAGS
|
||||||
|
save_LIBS=$LIBS
|
||||||
|
|
||||||
|
|
||||||
|
LIBS="$LIBS -ldb"
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
/* end confdefs.h. */
|
/* end confdefs.h. */
|
||||||
|
|
||||||
#define DB_DBM_HSEARCH 1
|
#define DB_DBM_HSEARCH 1
|
||||||
#include <db.h>
|
#include <db.h>
|
||||||
#if DB_VERSION_MAJOR < 5
|
#if DB_VERSION_MAJOR < 5
|
||||||
#error "dh.h: DB_VERSION_MAJOR < 5 is not supported."
|
#error "dh.h: DB_VERSION_MAJOR < 5 is not supported."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
main ()
|
main ()
|
||||||
|
@ -14294,7 +14318,13 @@ else
|
||||||
fi
|
fi
|
||||||
rm -f core conftest.err conftest.$ac_objext \
|
rm -f core conftest.err conftest.$ac_objext \
|
||||||
conftest$ac_exeext conftest.$ac_ext
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
LIBS="$LIBS_SAVE"
|
|
||||||
|
CFLAGS=$save_CFLAGS
|
||||||
|
CPPFLAGS=$save_CPPFLAGS
|
||||||
|
LDFLAGS=$save_LDFLAGS
|
||||||
|
LIBS=$save_LIBS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_libdb" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_libdb" >&5
|
||||||
|
@ -14349,6 +14379,43 @@ fi
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_dbmliborder" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_dbmliborder" >&5
|
||||||
$as_echo "$with_dbmliborder" >&6; }
|
$as_echo "$with_dbmliborder" >&6; }
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _dbm module CFLAGS and LIBS" >&5
|
||||||
|
$as_echo_n "checking for _dbm module CFLAGS and LIBS... " >&6; }
|
||||||
|
have_dbm=no
|
||||||
|
as_save_IFS=$IFS
|
||||||
|
IFS=:
|
||||||
|
for db in $with_dbmliborder; do
|
||||||
|
case "$db" in
|
||||||
|
ndbm)
|
||||||
|
if test "$have_ndbm" = yes; then
|
||||||
|
DBM_CFLAGS="-DUSE_NDBM"
|
||||||
|
DBM_LIBS="$dbm_ndbm"
|
||||||
|
have_dbm=yes
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
gdbm)
|
||||||
|
if test "$have_gdbm_compat" = yes; then
|
||||||
|
DBM_CFLAGS="-DUSE_GDBM_COMPAT"
|
||||||
|
DBM_LIBS="-lgdbm_compat"
|
||||||
|
have_dbm=yes
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
bdb)
|
||||||
|
if test "$ac_cv_have_libdb" = yes; then
|
||||||
|
DBM_CFLAGS="-DUSE_BERKDB"
|
||||||
|
DBM_LIBS="-ldb"
|
||||||
|
have_dbm=yes
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
IFS=$as_save_IFS
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $DBM_CFLAGS $DBM_LIBS" >&5
|
||||||
|
$as_echo "$DBM_CFLAGS $DBM_LIBS" >&6; }
|
||||||
|
|
||||||
# Templates for things AC_DEFINEd more than once.
|
# Templates for things AC_DEFINEd more than once.
|
||||||
# For a single AC_DEFINE, no template is needed.
|
# For a single AC_DEFINE, no template is needed.
|
||||||
|
|
||||||
|
@ -24604,6 +24671,40 @@ fi
|
||||||
$as_echo "$py_cv_module__decimal" >&6; }
|
$as_echo "$py_cv_module__decimal" >&6; }
|
||||||
|
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _dbm" >&5
|
||||||
|
$as_echo_n "checking for stdlib extension module _dbm... " >&6; }
|
||||||
|
if test "$py_cv_module__dbm" != "n/a"; then :
|
||||||
|
|
||||||
|
if test -n "$with_dbmliborder"; then :
|
||||||
|
if test "$have_dbm" != "no"; then :
|
||||||
|
py_cv_module__dbm=yes
|
||||||
|
else
|
||||||
|
py_cv_module__dbm=missing
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
py_cv_module__dbm=disabled
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
as_fn_append MODULE_BLOCK "MODULE__DBM_STATE=$py_cv_module__dbm$as_nl"
|
||||||
|
if test "x$py_cv_module__dbm" = xyes; then :
|
||||||
|
|
||||||
|
as_fn_append MODULE_BLOCK "MODULE__DBM_CFLAGS=$DBM_CFLAGS$as_nl"
|
||||||
|
as_fn_append MODULE_BLOCK "MODULE__DBM_LDFLAGS=$DBM_LIBS$as_nl"
|
||||||
|
|
||||||
|
fi
|
||||||
|
if test "$py_cv_module__dbm" = yes; then
|
||||||
|
MODULE__DBM_TRUE=
|
||||||
|
MODULE__DBM_FALSE='#'
|
||||||
|
else
|
||||||
|
MODULE__DBM_TRUE='#'
|
||||||
|
MODULE__DBM_FALSE=
|
||||||
|
fi
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__dbm" >&5
|
||||||
|
$as_echo "$py_cv_module__dbm" >&6; }
|
||||||
|
|
||||||
|
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _gdbm" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _gdbm" >&5
|
||||||
$as_echo_n "checking for stdlib extension module _gdbm... " >&6; }
|
$as_echo_n "checking for stdlib extension module _gdbm... " >&6; }
|
||||||
if test "$py_cv_module__gdbm" != "n/a"; then :
|
if test "$py_cv_module__gdbm" != "n/a"; then :
|
||||||
|
@ -25622,6 +25723,10 @@ if test -z "${MODULE__DECIMAL_TRUE}" && test -z "${MODULE__DECIMAL_FALSE}"; then
|
||||||
as_fn_error $? "conditional \"MODULE__DECIMAL\" was never defined.
|
as_fn_error $? "conditional \"MODULE__DECIMAL\" was never defined.
|
||||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||||
fi
|
fi
|
||||||
|
if test -z "${MODULE__DBM_TRUE}" && test -z "${MODULE__DBM_FALSE}"; then
|
||||||
|
as_fn_error $? "conditional \"MODULE__DBM\" 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
|
if test -z "${MODULE__GDBM_TRUE}" && test -z "${MODULE__GDBM_FALSE}"; then
|
||||||
as_fn_error $? "conditional \"MODULE__GDBM\" was never defined.
|
as_fn_error $? "conditional \"MODULE__GDBM\" was never defined.
|
||||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||||
|
|
100
configure.ac
100
configure.ac
|
@ -3956,17 +3956,30 @@ WITH_SAVE_ENV([
|
||||||
], [have_gdbm=no])
|
], [have_gdbm=no])
|
||||||
])
|
])
|
||||||
|
|
||||||
# check for _dbmmodule.c dependencies
|
dnl check for _dbmmodule.c dependencies
|
||||||
|
dnl ndbm, gdbm_compat, libdb
|
||||||
AC_CHECK_HEADERS([ndbm.h], [
|
AC_CHECK_HEADERS([ndbm.h], [
|
||||||
LIBS_SAVE="$LIBS"
|
WITH_SAVE_ENV([
|
||||||
AC_CHECK_LIB([ndbm], [dbm_open])
|
AC_SEARCH_LIBS([dbm_open], [ndbm gdbm_compat])
|
||||||
LIBS="$LIBS_SAVE"
|
])
|
||||||
AC_CHECK_LIB([gdbm_compat], [dbm_open])
|
|
||||||
LIBS="$LIBS_SAVE"
|
|
||||||
])
|
])
|
||||||
|
|
||||||
# "gdbm-ndbm.h" and "gdbm/ndbm.h" are both normalized to "gdbm_ndbm_h"
|
AC_MSG_CHECKING([for ndbm presence and linker args])
|
||||||
# unset ac_cv_header_gdbm_ndbm_h to prevent false positive cache hits.
|
AS_CASE([$ac_cv_search_dbm_open],
|
||||||
|
[*ndbm*|*gdbm_compat*], [
|
||||||
|
dbm_ndbm="$ac_cv_search_dbm_open"
|
||||||
|
have_ndbm=yes
|
||||||
|
],
|
||||||
|
[none*], [
|
||||||
|
dbm_ndbm=""
|
||||||
|
have_ndbm=yes
|
||||||
|
],
|
||||||
|
[no], [have_ndbm=no]
|
||||||
|
)
|
||||||
|
AC_MSG_RESULT([$have_ndbm ($dbm_ndbm)])
|
||||||
|
|
||||||
|
dnl "gdbm-ndbm.h" and "gdbm/ndbm.h" are both normalized to "gdbm_ndbm_h"
|
||||||
|
dnl unset ac_cv_header_gdbm_ndbm_h to prevent false positive cache hits.
|
||||||
AS_UNSET([ac_cv_header_gdbm_ndbm_h])
|
AS_UNSET([ac_cv_header_gdbm_ndbm_h])
|
||||||
AC_CACHE_VAL([ac_cv_header_gdbm_slash_ndbm_h], [
|
AC_CACHE_VAL([ac_cv_header_gdbm_slash_ndbm_h], [
|
||||||
AC_CHECK_HEADER(
|
AC_CHECK_HEADER(
|
||||||
|
@ -3991,26 +4004,26 @@ AS_VAR_IF([ac_cv_header_gdbm_dash_ndbm_h], [yes], [
|
||||||
AS_UNSET([ac_cv_header_gdbm_ndbm_h])
|
AS_UNSET([ac_cv_header_gdbm_ndbm_h])
|
||||||
|
|
||||||
if test "$ac_cv_header_gdbm_slash_ndbm_h" = yes -o "$ac_cv_header_gdbm_dash_ndbm_h" = yes; then
|
if test "$ac_cv_header_gdbm_slash_ndbm_h" = yes -o "$ac_cv_header_gdbm_dash_ndbm_h" = yes; then
|
||||||
LIBS_SAVE="$LIBS"
|
WITH_SAVE_ENV([
|
||||||
AC_CHECK_LIB([gdbm_compat], [dbm_open])
|
AC_SEARCH_LIBS([dbm_open], [gdbm_compat])
|
||||||
LIBS="$LIBS_SAVE"
|
])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for libdb >= 5 with dbm_open()
|
# Check for libdb >= 5 with dbm_open()
|
||||||
# db.h re-defines the name of the function
|
# db.h re-defines the name of the function
|
||||||
AC_CHECK_HEADERS([db.h], [
|
AC_CHECK_HEADERS([db.h], [
|
||||||
AC_CACHE_CHECK([for libdb], [ac_cv_have_libdb], [
|
AC_CACHE_CHECK([for libdb], [ac_cv_have_libdb], [
|
||||||
LIBS_SAVE="$LIBS"
|
WITH_SAVE_ENV([
|
||||||
LIBS="$LIBS -ldb"
|
LIBS="$LIBS -ldb"
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([
|
||||||
#define DB_DBM_HSEARCH 1
|
#define DB_DBM_HSEARCH 1
|
||||||
#include <db.h>
|
#include <db.h>
|
||||||
#if DB_VERSION_MAJOR < 5
|
#if DB_VERSION_MAJOR < 5
|
||||||
#error "dh.h: DB_VERSION_MAJOR < 5 is not supported."
|
#error "dh.h: DB_VERSION_MAJOR < 5 is not supported."
|
||||||
#endif
|
#endif
|
||||||
], [DBM *dbm = dbm_open(NULL, 0, 0)])
|
], [DBM *dbm = dbm_open(NULL, 0, 0)])
|
||||||
], [ac_cv_have_libdb=yes], [ac_cv_have_libdb=no])
|
], [ac_cv_have_libdb=yes], [ac_cv_have_libdb=no])
|
||||||
LIBS="$LIBS_SAVE"
|
])
|
||||||
])
|
])
|
||||||
AS_VAR_IF([ac_cv_have_libdb], [yes], [
|
AS_VAR_IF([ac_cv_have_libdb], [yes], [
|
||||||
AC_DEFINE([HAVE_LIBDB], [1], [Define to 1 if you have the `db' library (-ldb).])
|
AC_DEFINE([HAVE_LIBDB], [1], [Define to 1 if you have the `db' library (-ldb).])
|
||||||
|
@ -4018,7 +4031,7 @@ AC_CHECK_HEADERS([db.h], [
|
||||||
])
|
])
|
||||||
|
|
||||||
# Check for --with-dbmliborder
|
# Check for --with-dbmliborder
|
||||||
AC_MSG_CHECKING(for --with-dbmliborder)
|
AC_MSG_CHECKING([for --with-dbmliborder])
|
||||||
AC_ARG_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'.]),
|
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'.]),
|
||||||
[], [with_dbmliborder=gdbm:ndbm:bdb])
|
[], [with_dbmliborder=gdbm:ndbm:bdb])
|
||||||
|
@ -4038,7 +4051,42 @@ IFS=$as_save_IFS
|
||||||
AS_VAR_IF([with_dbmliborder], [error], [
|
AS_VAR_IF([with_dbmliborder], [error], [
|
||||||
AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:... (gdbm:ndbm:bdb)])
|
AC_MSG_ERROR([proper usage is --with-dbmliborder=db1:db2:... (gdbm:ndbm:bdb)])
|
||||||
])
|
])
|
||||||
AC_MSG_RESULT($with_dbmliborder)
|
AC_MSG_RESULT([$with_dbmliborder])
|
||||||
|
|
||||||
|
AC_MSG_CHECKING([for _dbm module CFLAGS and LIBS])
|
||||||
|
have_dbm=no
|
||||||
|
as_save_IFS=$IFS
|
||||||
|
IFS=:
|
||||||
|
for db in $with_dbmliborder; do
|
||||||
|
case "$db" in
|
||||||
|
ndbm)
|
||||||
|
if test "$have_ndbm" = yes; then
|
||||||
|
DBM_CFLAGS="-DUSE_NDBM"
|
||||||
|
DBM_LIBS="$dbm_ndbm"
|
||||||
|
have_dbm=yes
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
gdbm)
|
||||||
|
if test "$have_gdbm_compat" = yes; then
|
||||||
|
DBM_CFLAGS="-DUSE_GDBM_COMPAT"
|
||||||
|
DBM_LIBS="-lgdbm_compat"
|
||||||
|
have_dbm=yes
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
bdb)
|
||||||
|
if test "$ac_cv_have_libdb" = yes; then
|
||||||
|
DBM_CFLAGS="-DUSE_BERKDB"
|
||||||
|
DBM_LIBS="-ldb"
|
||||||
|
have_dbm=yes
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
IFS=$as_save_IFS
|
||||||
|
AC_MSG_RESULT([$DBM_CFLAGS $DBM_LIBS])
|
||||||
|
|
||||||
# Templates for things AC_DEFINEd more than once.
|
# Templates for things AC_DEFINEd more than once.
|
||||||
# For a single AC_DEFINE, no template is needed.
|
# For a single AC_DEFINE, no template is needed.
|
||||||
|
@ -6940,7 +6988,9 @@ PY_STDLIB_MOD([_ctypes],
|
||||||
dnl PY_STDLIB_MOD([_curses], [], [], [], [])
|
dnl PY_STDLIB_MOD([_curses], [], [], [], [])
|
||||||
dnl PY_STDLIB_MOD([_curses_panel], [], [], [], [])
|
dnl PY_STDLIB_MOD([_curses_panel], [], [], [], [])
|
||||||
PY_STDLIB_MOD([_decimal], [], [], [$LIBMPDEC_CFLAGS], [$LIBMPDEC_LDFLAGS])
|
PY_STDLIB_MOD([_decimal], [], [], [$LIBMPDEC_CFLAGS], [$LIBMPDEC_LDFLAGS])
|
||||||
dnl PY_STDLIB_MOD([_dbm], [], [], [], [])
|
PY_STDLIB_MOD([_dbm],
|
||||||
|
[test -n "$with_dbmliborder"], [test "$have_dbm" != "no"],
|
||||||
|
[$DBM_CFLAGS], [$DBM_LIBS])
|
||||||
PY_STDLIB_MOD([_gdbm],
|
PY_STDLIB_MOD([_gdbm],
|
||||||
[test "$have_gdbm_dbmliborder" = yes], [test "$have_gdbm" = yes],
|
[test "$have_gdbm_dbmliborder" = yes], [test "$have_gdbm" = yes],
|
||||||
[$GDBM_CFLAGS], [$GDBM_LIBS])
|
[$GDBM_CFLAGS], [$GDBM_LIBS])
|
||||||
|
|
|
@ -640,18 +640,12 @@
|
||||||
/* Define to 1 if you have the `dld' library (-ldld). */
|
/* Define to 1 if you have the `dld' library (-ldld). */
|
||||||
#undef HAVE_LIBDLD
|
#undef HAVE_LIBDLD
|
||||||
|
|
||||||
/* Define to 1 if you have the `gdbm_compat' library (-lgdbm_compat). */
|
|
||||||
#undef HAVE_LIBGDBM_COMPAT
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `ieee' library (-lieee). */
|
/* Define to 1 if you have the `ieee' library (-lieee). */
|
||||||
#undef HAVE_LIBIEEE
|
#undef HAVE_LIBIEEE
|
||||||
|
|
||||||
/* Define to 1 if you have the <libintl.h> header file. */
|
/* Define to 1 if you have the <libintl.h> header file. */
|
||||||
#undef HAVE_LIBINTL_H
|
#undef HAVE_LIBINTL_H
|
||||||
|
|
||||||
/* Define to 1 if you have the `ndbm' library (-lndbm). */
|
|
||||||
#undef HAVE_LIBNDBM
|
|
||||||
|
|
||||||
/* Define to build the readline module. */
|
/* Define to build the readline module. */
|
||||||
#undef HAVE_LIBREADLINE
|
#undef HAVE_LIBREADLINE
|
||||||
|
|
||||||
|
|
72
setup.py
72
setup.py
|
@ -1163,77 +1163,7 @@ class PyBuildExt(build_ext):
|
||||||
self.addext(Extension('_crypt', ['_cryptmodule.c']))
|
self.addext(Extension('_crypt', ['_cryptmodule.c']))
|
||||||
|
|
||||||
def detect_dbm_gdbm(self):
|
def detect_dbm_gdbm(self):
|
||||||
# Modules that provide persistent dictionary-like semantics. You will
|
self.addext(Extension('_dbm', ['_dbmmodule.c']))
|
||||||
# probably want to arrange for at least one of them to be available on
|
|
||||||
# your machine, though none are defined by default because of library
|
|
||||||
# dependencies. The Python module dbm/__init__.py provides an
|
|
||||||
# implementation independent wrapper for these; dbm/dumb.py provides
|
|
||||||
# similar functionality (but slower of course) implemented in Python.
|
|
||||||
|
|
||||||
dbm_setup_debug = False # verbose debug prints from this script?
|
|
||||||
dbm_order = ['gdbm']
|
|
||||||
|
|
||||||
# libdb, gdbm and ndbm headers and libraries
|
|
||||||
have_ndbm_h = sysconfig.get_config_var("HAVE_NDBM_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_compat = sysconfig.get_config_var("HAVE_LIBGDBM_COMPAT")
|
|
||||||
have_libdb = sysconfig.get_config_var("HAVE_LIBDB")
|
|
||||||
|
|
||||||
# The standard Unix dbm module:
|
|
||||||
if not CYGWIN:
|
|
||||||
config_args = [arg.strip("'")
|
|
||||||
for arg in sysconfig.get_config_var("CONFIG_ARGS").split()]
|
|
||||||
dbm_args = [arg for arg in config_args
|
|
||||||
if arg.startswith('--with-dbmliborder=')]
|
|
||||||
if dbm_args:
|
|
||||||
dbm_order = [arg.split('=')[-1] for arg in dbm_args][-1].split(":")
|
|
||||||
else:
|
|
||||||
dbm_order = "gdbm:ndbm:bdb".split(":")
|
|
||||||
dbmext = None
|
|
||||||
for cand in dbm_order:
|
|
||||||
if cand == "ndbm":
|
|
||||||
if have_ndbm_h:
|
|
||||||
# Some systems have -lndbm, others have -lgdbm_compat,
|
|
||||||
# others don't have either
|
|
||||||
if have_libndbm:
|
|
||||||
ndbm_libs = ['ndbm']
|
|
||||||
elif have_libgdbm_compat:
|
|
||||||
ndbm_libs = ['gdbm_compat']
|
|
||||||
else:
|
|
||||||
ndbm_libs = []
|
|
||||||
if dbm_setup_debug: print("building dbm using ndbm")
|
|
||||||
dbmext = Extension(
|
|
||||||
'_dbm', ['_dbmmodule.c'],
|
|
||||||
define_macros=[('USE_NDBM', None)],
|
|
||||||
libraries=ndbm_libs
|
|
||||||
)
|
|
||||||
break
|
|
||||||
elif cand == "gdbm":
|
|
||||||
# dbm_open() is provided by libgdbm_compat, which wraps libgdbm
|
|
||||||
if have_libgdbm_compat and (have_gdbm_ndbm_h or have_gdbm_dash_ndbm_h):
|
|
||||||
if dbm_setup_debug: print("building dbm using gdbm")
|
|
||||||
dbmext = Extension(
|
|
||||||
'_dbm', ['_dbmmodule.c'],
|
|
||||||
define_macros=[('USE_GDBM_COMPAT', None)],
|
|
||||||
libraries=['gdbm_compat']
|
|
||||||
)
|
|
||||||
break
|
|
||||||
elif cand == "bdb":
|
|
||||||
if have_libdb:
|
|
||||||
if dbm_setup_debug: print("building dbm using bdb")
|
|
||||||
dbmext = Extension(
|
|
||||||
'_dbm', ['_dbmmodule.c'],
|
|
||||||
define_macros=[('USE_BERKDB', None)],
|
|
||||||
libraries=['db']
|
|
||||||
)
|
|
||||||
break
|
|
||||||
if dbmext is not None:
|
|
||||||
self.add(dbmext)
|
|
||||||
else:
|
|
||||||
self.missing.append('_dbm')
|
|
||||||
|
|
||||||
# Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm:
|
# Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm:
|
||||||
self.addext(Extension('_gdbm', ['_gdbmmodule.c']))
|
self.addext(Extension('_gdbm', ['_gdbmmodule.c']))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue