From: Francesco Chemolli Date: Tue, 27 Apr 2010 10:17:20 +0000 (+0200) Subject: Portability fix: improve detecition of libdb-related headers. X-Git-Tag: SQUID_3_2_0_1~265 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6b5de50d654126522610da36baaecbe0feb219e5;p=thirdparty%2Fsquid.git Portability fix: improve detecition of libdb-related headers. --- diff --git a/configure.in b/configure.in index 2ceb7bb631..8d9a2c45e4 100644 --- a/configure.in +++ b/configure.in @@ -2844,17 +2844,24 @@ AC_SUBST(LDAPLIB) AC_SUBST(LBERLIB) dnl Check for libdb +dnl this is not fully functional if db.h is for a differend db version DBLIB= + +dnl check that dbopen is actually defined in the header +dnl FIXME: in case of failure undef db-related includes etc. +AC_CHECK_DECL(dbopen,,,[ +AC_INCLUDES_DEFAULT +#if HAVE_DB_185_H +#include +#elif HAVE_DB_H +#include +#endif]) + dnl 1.85 AC_CACHE_CHECK(if dbopen needs -ldb,ac_cv_dbopen_libdb, [ SAVED_LIBS="$LIBS"; LIBS="$LIBS -ldb" AC_LINK_IFELSE([AC_LANG_PROGRAM([[ -#if HAVE_SYS_TYPES_H -#include -#endif -#if HAVE_LIMITS_H -#include -#endif +AC_INCLUDES_DEFAULT #if HAVE_DB_185_H #include #elif HAVE_DB_H diff --git a/helpers/external_acl/session/config.test b/helpers/external_acl/session/config.test index 42aec74614..83b0f99047 100755 --- a/helpers/external_acl/session/config.test +++ b/helpers/external_acl/session/config.test @@ -4,7 +4,7 @@ if [ -f /usr/include/db_185.h ]; then exit 0 fi -if [ -f /usr/include/db.h ]; then +if [ -f /usr/include/db.h ] && grep dbopen /usr/include/db.h; then exit 0 fi exit 1 diff --git a/helpers/external_acl/session/squid_session.c b/helpers/external_acl/session/squid_session.c index 3af08324cb..ba529d82f5 100644 --- a/helpers/external_acl/session/squid_session.c +++ b/helpers/external_acl/session/squid_session.c @@ -43,12 +43,11 @@ #ifndef __BIT_TYPES_DEFINED__ #define __BIT_TYPES_DEFINED__ #endif -#if defined(HAVE_DB_185_H) + +#if HAVE_DB_185_H #include -#elif defined(HAVE_DB_H) +#elif HAVE_DB_H #include -#else -#include #endif static int session_ttl = 3600;