]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Refactored check for unix sockets
authorFrancesco Chemolli <kinkie@squid-cache.org>
Wed, 28 Jul 2010 18:46:10 +0000 (20:46 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Wed, 28 Jul 2010 18:46:10 +0000 (20:46 +0200)
Fixed bug with libcap checks
Improved checks for libgnumalloc and libregex

acinclude/os-deps.m4
configure.in

index ff88f448ab07bcd308760999674524c97690f14b..33c7c4c4abf735979d7669e9b525923e3f7df647 100644 (file)
@@ -154,3 +154,18 @@ AC_DEFUN([SQUID_CHECK_FUNCTIONAL_LIBCAP2],[
   )
 ])
 
+
+dnl Ripped from Samba. Thanks!
+dnl check that we have Unix sockets. Sets squid_cv_unixsocket to either yes or no depending on the check
+AC_DEFUN([SQUID_CHECK_UNIX_SOCKET],[
+  AC_CACHE_CHECK([for unix domain sockets],squid_cv_unixsocket, [
+      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <sys/types.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <sys/socket.h>
+#include <sys/un.h>]], [[
+  struct sockaddr_un sunaddr;
+  sunaddr.sun_family = AF_UNIX;
+  ]])],[squid_cv_unixsocket=yes],[squid_cv_unixsocket=no])])
+])
index 82f0879167e9c289512ee9e2ed160b8731fe249e..8740b9401025a1c59a14922af0d65817e67f2723 100644 (file)
@@ -2385,9 +2385,9 @@ if test "x$with_libcap" != "xno"; then
 
   # if it can't be supported..
   if test "x$ac_cv_header_sys_capability_h" = "xno" -o \
-    "x$ac_cv_lib_cap_cap_clear_flag" = "xno"; then
+     "x$ac_cv_lib_cap_cap_clear_flag" = "xno"; then
     # and it was forced on: error
-    if "x$with_libcap" = "xyes" ; then
+    if test "x$with_libcap" = "xyes" ; then
       AC_MSG_ERROR([libcap forced enabled but not available or not usable, requires libcap-2.09 or later])
     else
       # with_libcap is "auto"; it can't be supported. Disable.
@@ -2452,44 +2452,32 @@ case "$host_os" in
     ;;
 esac
 
-dnl Ripped from the Samba sources
-AC_CACHE_CHECK([for unix domain sockets],squid_cv_unixsocket, [
-    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#include <sys/types.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <sys/socket.h>
-#include <sys/un.h>]], [[
-  struct sockaddr_un sunaddr; 
-  sunaddr.sun_family = AF_UNIX;
-]])],[squid_cv_unixsocket=yes],[squid_cv_unixsocket=no])])
-if test x"$squid_cv_unixsocket" = x"yes"; then
-   AC_DEFINE(HAVE_UNIXSOCKET,1,[Do we have unix sockets? (required for the winbind ntlm helper])
-fi
-dnl end rip
-
-  AC_CHECK_LIB(gnumalloc, main)
-  if test "$ac_cv_lib_gnumalloc_main" = "yes"; then
-               AC_MSG_NOTICE([Disabling extended malloc functions when using gnumalloc])
-               ac_cv_func_mallinfo=no
-               ac_cv_func_mallocblksize=no
-               ac_cv_func_mallopt=no
-  else
-               case "$host" in
-                       *-sun-solaris*)
-                         AC_MSG_NOTICE([skipping libmalloc check for $host])
-                               ;;
-                       i386-*-freebsd*)
-                         AC_MSG_NOTICE([skipping libmalloc check for $host])
-                               ;;
-                       *)
-  
-                               AC_CHECK_LIB(malloc, main)
-                               ;;
-               esac
+# check that we have unix sockets
+SQUID_CHECK_UNIX_SOCKET
+SQUID_DEFINE_BOOL(HAVE_UNIXSOCKET,$squid_cv_unixsocket,[System supports unix sockets])
+
+AC_CHECK_LIB(gnumalloc, malloc)
+if test "x$ac_cv_lib_gnumalloc_malloc" = "xyes"; then
+  AC_MSG_NOTICE([Disabling extended malloc functions when using gnumalloc])
+  ac_cv_func_mallinfo=no
+  ac_cv_func_mallocblksize=no
+  ac_cv_func_mallopt=no
+else
+  case "$squid_host_os" in
+    solaris)
+      AC_MSG_NOTICE([skipping libmalloc check for $host])
+      ;;
+    freebsd)
+      AC_MSG_NOTICE([skipping libmalloc check for $host])
+      ;;
+    *)
+      #used later. FIXME
+      AC_CHECK_LIB(malloc, main)
+      ;;
+   esac
   fi
 
-AC_CHECK_LIB(regex, main, [REGEXLIB="-lregex"])
+AC_CHECK_LIB(regex, regexec, [REGEXLIB="-lregex"])
 case "$host_os" in
 mingw|mingw32)
        AC_MSG_NOTICE([Use MSVCRT for math functions.])