From a258dfca3481ca82e5b0b3e75c9c7b2d83f2cb0d Mon Sep 17 00:00:00 2001 From: hno <> Date: Tue, 23 May 2006 03:22:05 +0000 Subject: [PATCH] Do a full compile test of dbopen to see if -ldb is needed --- configure | 187 +++++++-------------------------------------------- configure.in | 26 +++++-- 2 files changed, 45 insertions(+), 168 deletions(-) diff --git a/configure b/configure index 0b62221791..6cc83792dd 100755 --- a/configure +++ b/configure @@ -39003,174 +39003,41 @@ esac DBLIB= -echo "$as_me:$LINENO: checking for dbopen in -ldb" >&5 -echo $ECHO_N "checking for dbopen in -ldb... $ECHO_C" >&6 -if test "${ac_cv_lib_db_dbopen+set}" = set; then +echo "$as_me:$LINENO: checking if dbopen needs -ldb" >&5 +echo $ECHO_N "checking if dbopen needs -ldb... $ECHO_C" >&6 +if test "${ac_cv_dbopen_libdb+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldb $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dbopen (); -int -main () -{ -dbopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_db_dbopen=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_db_dbopen=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_db_dbopen" >&5 -echo "${ECHO_T}$ac_cv_lib_db_dbopen" >&6 -if test $ac_cv_lib_db_dbopen = yes; then - LIB_DB="-ldb" -fi - -echo "$as_me:$LINENO: checking for db_open in -ldb" >&5 -echo $ECHO_N "checking for db_open in -ldb... $ECHO_C" >&6 -if test "${ac_cv_lib_db_db_open+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldb $LIBS" -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" +#if HAVE_SYS_TYPES_H +#include #endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char db_open (); -int -main () -{ -db_open (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_db_db_open=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_db_db_open=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_db_db_open" >&5 -echo "${ECHO_T}$ac_cv_lib_db_db_open" >&6 -if test $ac_cv_lib_db_db_open = yes; then - LIB_DB="-ldb" -fi - -echo "$as_me:$LINENO: checking for __db185_open in -ldb" >&5 -echo $ECHO_N "checking for __db185_open in -ldb... $ECHO_C" >&6 -if test "${ac_cv_lib_db___db185_open+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldb $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" +#if HAVE_LIMITS_H +#include +#endif +#if HAVE_DB_185_H +#include +#elif HAVE_DB_H +#include #endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char __db185_open (); int main () { -__db185_open (); +dbopen((void *)0L, 0, 0, DB_HASH, (void *)0L) ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -39184,29 +39051,25 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_db___db185_open=yes + LIB_DB="-ldb" + ac_cv_dbopen_libdb="yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_lib_db___db185_open=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_db___db185_open" >&5 -echo "${ECHO_T}$ac_cv_lib_db___db185_open" >&6 -if test $ac_cv_lib_db___db185_open = yes; then - LIB_DB="-ldb" +ac_cv_dbopen_libdb="no" fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_dbopen_libdb" >&5 +echo "${ECHO_T}$ac_cv_dbopen_libdb" >&6 case "$host" in diff --git a/configure.in b/configure.in index 66ceb27ec1..a0fca20cb5 100644 --- a/configure.in +++ b/configure.in @@ -3,7 +3,7 @@ dnl Configuration input file for Squid dnl dnl Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9) dnl -dnl $Id: configure.in,v 1.411 2006/05/11 01:36:57 hno Exp $ +dnl $Id: configure.in,v 1.412 2006/05/22 21:22:06 hno Exp $ dnl dnl dnl @@ -13,7 +13,7 @@ AC_CONFIG_SRCDIR([src/main.cc]) AC_CONFIG_AUX_DIR(cfgaux) AM_INIT_AUTOMAKE([tar-ustar]) AM_CONFIG_HEADER(include/autoconf.h) -AC_REVISION($Revision: 1.411 $)dnl +AC_REVISION($Revision: 1.412 $)dnl AC_PREFIX_DEFAULT(/usr/local/squid) AM_MAINTAINER_MODE @@ -2289,10 +2289,24 @@ AC_SUBST(LIB_LBER) dnl Check for libdb DBLIB= dnl 1.85 -AC_CHECK_LIB(db, dbopen, [LIB_DB="-ldb"]) -dnl more current ones.. -AC_CHECK_LIB(db, db_open, [LIB_DB="-ldb"]) -AC_CHECK_LIB(db, __db185_open, [LIB_DB="-ldb"]) +AC_CACHE_CHECK(if dbopen needs -ldb,ac_cv_dbopen_libdb, [ + AC_TRY_COMPILE([ +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_LIMITS_H +#include +#endif +#if HAVE_DB_185_H +#include +#elif HAVE_DB_H +#include +#endif], + [dbopen((void *)0L, 0, 0, DB_HASH, (void *)0L)], + LIB_DB="-ldb" + ac_cv_dbopen_libdb="yes", + ac_cv_dbopen_libdb="no") +]) AC_SUBST(LIB_DB) dnl System-specific library modifications -- 2.47.3