diff options
author | Christian Heimes <christian@python.org> | 2021-11-10 19:26:55 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-10 19:26:55 (GMT) |
commit | 0a9f69539be27acf1cddf1b58d02a88d02e5008d (patch) | |
tree | 45073f51d11b129bd88c0da801c0a23a61e7558f /configure | |
parent | c1323d4b8cb010a06c11bace6e681bea7f895851 (diff) | |
download | cpython-0a9f69539be27acf1cddf1b58d02a88d02e5008d.zip cpython-0a9f69539be27acf1cddf1b58d02a88d02e5008d.tar.gz cpython-0a9f69539be27acf1cddf1b58d02a88d02e5008d.tar.bz2 |
bpo-45747: Detect gdbm/dbm dependencies in configure (GH-29467)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 339 |
1 files changed, 338 insertions, 1 deletions
@@ -10822,6 +10822,340 @@ else TCLTK_LIBS="$with_tcltk_libs" fi +# check for _gdbmmodulec dependencies +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 : + cat >>confdefs.h <<_ACEOF +#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_n "checking for gdbm_open in -lgdbm... " >&6; } +if ${ac_cv_lib_gdbm_gdbm_open+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgdbm $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 gdbm_open (); +int +main () +{ +return gdbm_open (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_gdbm_gdbm_open=yes +else + ac_cv_lib_gdbm_gdbm_open=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +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" + +fi + + LIBS=$LIBS_SAVE + +fi + +done + + +# check for _dbmmodule.c dependencies +for ac_header in ndbm.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "ndbm.h" "ac_cv_header_ndbm_h" "$ac_includes_default" +if test "x$ac_cv_header_ndbm_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_NDBM_H 1 +_ACEOF + + LIBS_SAVE="$LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dbm_open in -lndbm" >&5 +$as_echo_n "checking for dbm_open in -lndbm... " >&6; } +if ${ac_cv_lib_ndbm_dbm_open+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lndbm $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_ndbm_dbm_open=yes +else + ac_cv_lib_ndbm_dbm_open=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ndbm_dbm_open" >&5 +$as_echo "$ac_cv_lib_ndbm_dbm_open" >&6; } +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 + ac_check_lib_save_LIBS=$LIBS +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 +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gdbm_compat_dbm_open" >&5 +$as_echo "$ac_cv_lib_gdbm_compat_dbm_open" >&6; } +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" + +fi + + LIBS="$LIBS_SAVE" + +fi + +done + + +# "gdbm-ndbm.h" and "gdbm/ndbm.h" are both normalized to "gdbm_ndbm_h" +# unset ac_cv_header_gdbm_ndbm_h to prevent false positive cache hits. +{ ac_cv_header_gdbm_ndbm_h=; unset ac_cv_header_gdbm_ndbm_h;} +if ${ac_cv_header_gdbm_slash_ndbm_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ac_fn_c_check_header_mongrel "$LINENO" "gdbm/ndbm.h" "ac_cv_header_gdbm_ndbm_h" "$ac_includes_default" +if test "x$ac_cv_header_gdbm_ndbm_h" = xyes; then : + ac_cv_header_gdbm_slash_ndbm_h=yes +else + ac_cv_header_gdbm_slash_ndbm_h=no + +fi + + + +fi + +if test "x$ac_cv_header_gdbm_slash_ndbm_h" = xyes; then : + + +$as_echo "#define HAVE_GDBM_NDBM_H 1" >>confdefs.h + + +fi + +{ ac_cv_header_gdbm_ndbm_h=; unset ac_cv_header_gdbm_ndbm_h;} +if ${ac_cv_header_gdbm_dash_ndbm_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ac_fn_c_check_header_mongrel "$LINENO" "gdbm-ndbm.h" "ac_cv_header_gdbm_ndbm_h" "$ac_includes_default" +if test "x$ac_cv_header_gdbm_ndbm_h" = xyes; then : + ac_cv_header_gdbm_dash_ndbm_h=yes +else + ac_cv_header_gdbm_dash_ndbm_h=no + +fi + + + +fi + +if test "x$ac_cv_header_gdbm_dash_ndbm_h" = xyes; then : + + +$as_echo "#define HAVE_GDBM_DASH_NDBM_H 1" >>confdefs.h + + +fi +{ 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 + LIBS_SAVE="$LIBS" + { $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 + ac_check_lib_save_LIBS=$LIBS +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 +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gdbm_compat_dbm_open" >&5 +$as_echo "$ac_cv_lib_gdbm_compat_dbm_open" >&6; } +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" + +fi + + LIBS="$LIBS_SAVE" +fi + +# Check for libdb >= 5 with dbm_open() +# db.h re-defines the name of the function +for ac_header in db.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "db.h" "ac_cv_header_db_h" "$ac_includes_default" +if test "x$ac_cv_header_db_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_DB_H 1 +_ACEOF + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libdb" >&5 +$as_echo_n "checking for libdb... " >&6; } +if ${ac_cv_have_libdb+:} false; then : + $as_echo_n "(cached) " >&6 +else + + LIBS_SAVE="$LIBS" + LIBS="$LIBS -ldb" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #define DB_DBM_HSEARCH 1 + #include <db.h> + #if DB_VERSION_MAJOR < 5 + #error "dh.h: DB_VERSION_MAJOR < 5 is not supported." + #endif + +int +main () +{ +DBM *dbm = dbm_open(NULL, 0, 0) + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_have_libdb=yes +else + ac_cv_have_libdb=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$LIBS_SAVE" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_libdb" >&5 +$as_echo "$ac_cv_have_libdb" >&6; } + if test "x$ac_cv_have_libdb" = xyes; then : + + +$as_echo "#define HAVE_LIBDB 1" >>confdefs.h + + +fi + +fi + +done + + # Check for --with-dbmliborder { $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-dbmliborder" >&5 $as_echo_n "checking for --with-dbmliborder... " >&6; } @@ -10833,12 +11167,15 @@ if test x$with_dbmliborder = xyes then as_fn_error $? "proper usage is --with-dbmliborder=db1:db2:..." "$LINENO" 5 else - for db in `echo $with_dbmliborder | sed 's/:/ /g'`; do + 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 fi |