From: Amos Jeffries Date: Sat, 1 Apr 2017 09:01:23 +0000 (+1300) Subject: Bug 4610: cleanup of BerkleyDB related checks X-Git-Tag: SQUID_4_0_19~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=25b5360df8a1c7b14fc54282ca23a1388f5af65c;p=thirdparty%2Fsquid.git Bug 4610: cleanup of BerkleyDB related checks Most of the logic seems to be hangovers from when session helper was using the BerkleyDB v1.85 compatibility interface. Some of it is possibly still necessary for the time_quota helper, but that helper has not been using it so far and needs an upgrade to match what happened to session helper. Changes: * The helpers needing -ldb will not be built unless the library and headers are available. So we can drop the Makefile LIB_DB substitutions and always just link -ldb explicitly to these helpers. NP: Anyone who needs small minimal binaries, can build with the --as-needed linker flag, or without these helpers. This change has no effect on other helpers or the main squid binary. * Since we no longer need to check if -ldb is necessary, we can drop the configure.ac and acinclude logic detecting that. * Remove unused AC_CHECK_DECL(dbopen, ...) - resolves one "FIXME" * Fix the time_quota helper check to only scan db.h header file contents if that file is existing, and if the db_185.h file is not being used instead. * Fix the session helper check to only try compiling with the db.h header if that header actually exists. * De-duplicate the library header file detection shared by configure.ac and the helpers required.m4 files (after the above two changes). * Remove unused DBLIB variable from configure.ac. --- diff --git a/acinclude/lib-checks.m4 b/acinclude/lib-checks.m4 index 6579024a79..41a6583335 100644 --- a/acinclude/lib-checks.m4 +++ b/acinclude/lib-checks.m4 @@ -5,33 +5,6 @@ ## Please see the COPYING and CONTRIBUTORS files for details. ## -dnl checks whether dbopen needs -ldb to be added to libs -dnl sets ac_cv_dbopen_libdb to either "yes" or "no" - -AC_DEFUN([SQUID_CHECK_DBOPEN_NEEDS_LIBDB],[ - AC_CACHE_CHECK(if dbopen needs -ldb,ac_cv_dbopen_libdb, [ - SQUID_STATE_SAVE(dbopen_libdb) - LIBS="$LIBS -ldb" - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ -#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("", 0, 0, DB_HASH, (void *)0L)]])], - [ac_cv_dbopen_libdb="yes"], - [ac_cv_dbopen_libdb="no"]) - SQUID_STATE_ROLLBACK(dbopen_libdb) - ]) -]) - - dnl check whether regex works by actually compiling one dnl sets squid_cv_regex_works to either yes or no diff --git a/configure.ac b/configure.ac index e27b06b512..59ccb0e9eb 100644 --- a/configure.ac +++ b/configure.ac @@ -2848,8 +2848,6 @@ AC_CHECK_HEADERS( \ glib.h \ stdint.h \ inttypes.h \ - db.h \ - db_185.h \ wchar.h ) @@ -3183,32 +3181,6 @@ case "$host" in ;; esac -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,,,[ -#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]) - -dnl 1.85 -SQUID_CHECK_DBOPEN_NEEDS_LIBDB -if test "x$ac_cv_dbopen_libdb" = "xyes"; then - LIB_DB="-ldb" -fi -AC_SUBST(LIB_DB) - dnl System-specific library modifications dnl case "$host" in diff --git a/src/acl/external/session/Makefile.am b/src/acl/external/session/Makefile.am index 14684a9c58..60694ef080 100644 --- a/src/acl/external/session/Makefile.am +++ b/src/acl/external/session/Makefile.am @@ -14,6 +14,6 @@ ext_session_acl_SOURCES= \ ext_session_acl.cc ext_session_acl_LDADD = \ $(COMPAT_LIB) \ - $(LIB_DB) + -ldb EXTRA_DIST= ext_session_acl.8 required.m4 diff --git a/src/acl/external/session/required.m4 b/src/acl/external/session/required.m4 index 00b3949471..6dd78fba64 100755 --- a/src/acl/external/session/required.m4 +++ b/src/acl/external/session/required.m4 @@ -5,4 +5,11 @@ ## Please see the COPYING and CONTRIBUTORS files for details. ## -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]],[[DB_ENV *db_env = NULL; db_env_create(&db_env, 0);]])],[BUILD_HELPER="session"],[]) +AC_CHECK_HEADERS(db.h,[ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]],[[ + DB_ENV *db_env = nullptr; + db_env_create(&db_env, 0); + ]])],[ + BUILD_HELPER="session" + ],[]) +]) diff --git a/src/acl/external/time_quota/Makefile.am b/src/acl/external/time_quota/Makefile.am index 74488d989b..f79d5c7b30 100644 --- a/src/acl/external/time_quota/Makefile.am +++ b/src/acl/external/time_quota/Makefile.am @@ -16,6 +16,6 @@ ext_time_quota_acl_SOURCES= \ ext_time_quota_acl.cc ext_time_quota_acl_LDADD = \ $(COMPAT_LIB) \ - $(LIB_DB) + -ldb EXTRA_DIST= ext_time_quota_acl.8 required.m4 diff --git a/src/acl/external/time_quota/required.m4 b/src/acl/external/time_quota/required.m4 index 084f3a3a2f..80db17615c 100644 --- a/src/acl/external/time_quota/required.m4 +++ b/src/acl/external/time_quota/required.m4 @@ -5,5 +5,8 @@ ## Please see the COPYING and CONTRIBUTORS files for details. ## -AC_CHECK_HEADERS([db_185.h],[BUILD_HELPER="time_quota"]) -AC_EGREP_HEADER([dbopen],[/usr/include/db.h],[BUILD_HELPER="time_quota"]) +AC_CHECK_HEADERS(db_185.h,[BUILD_HELPER="time_quota"],[ + AC_CHECK_HEADERS(db.h,[ + AC_EGREP_HEADER([dbopen],[/usr/include/db.h],[BUILD_HELPER="time_quota"]) + ]) +])