]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 4610: cleanup of BerkleyDB related checks
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 1 Apr 2017 09:01:23 +0000 (22:01 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 1 Apr 2017 09:01:23 +0000 (22:01 +1300)
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.

acinclude/lib-checks.m4
configure.ac
src/acl/external/session/Makefile.am
src/acl/external/session/required.m4
src/acl/external/time_quota/Makefile.am
src/acl/external/time_quota/required.m4

index 6579024a7997b683bdb6416d521be3193dee97bb..41a6583335ad6b52cee846692c6a5c2ed5e51baa 100644 (file)
@@ -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 <sys/types.h>
-#endif
-#if HAVE_LIMITS_H
-#include <limits.h>
-#endif
-#if HAVE_DB_185_H
-#include <db_185.h>
-#elif HAVE_DB_H
-#include <db.h>
-#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
 
index e27b06b512a4576f84075004aee76de0ba7dc1ae..59ccb0e9ebd309dda5c9e11784b06f89cb607e4a 100644 (file)
@@ -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 <sys/types.h>
-#endif
-#if HAVE_LIMITS_H
-#include <limits.h>
-#endif
-#if HAVE_DB_185_H
-#include <db_185.h>
-#elif HAVE_DB_H
-#include <db.h>
-#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
index 14684a9c58704bef66d6539b78bb7e68389d9da4..60694ef080ef05fb2824906972121779da1f43b1 100644 (file)
@@ -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
index 00b394947131027a9ba0fa068ef9d86f71e531ef..6dd78fba64b4165e726b148496cb644a52a05c75 100755 (executable)
@@ -5,4 +5,11 @@
 ## Please see the COPYING and CONTRIBUTORS files for details.
 ##
 
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <db.h>]],[[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.h>]],[[
+    DB_ENV *db_env = nullptr;
+    db_env_create(&db_env, 0);
+  ]])],[
+    BUILD_HELPER="session"
+  ],[])
+])
index 74488d989bde0baf2af3b07008c29849ab65be15..f79d5c7b30fde32bd1cf9cf79e2d7c8ef198a18f 100644 (file)
@@ -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
index 084f3a3a2f6580d3859467e74bdb474738ca29f3..80db17615ccb247a16e02d5e5c3e1c84c9a82471 100644 (file)
@@ -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"])
+  ])
+])