]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - acinclude/os-deps.m4
SourceFormat Enforcement
[thirdparty/squid.git] / acinclude / os-deps.m4
index 5dd3df4534935ef95b5bf1bf920da008189b31b8..caf4d293b6335b51c9f596e239ebdc39916f48d1 100644 (file)
@@ -1,31 +1,9 @@
-dnl 
-dnl AUTHOR: Squid Web Cache team
-dnl
-dnl SQUID Web Proxy Cache          http://www.squid-cache.org/
-dnl ----------------------------------------------------------
-dnl Squid is the result of efforts by numerous individuals from
-dnl the Internet community; see the CONTRIBUTORS file for full
-dnl details.   Many organizations have provided support for Squid's
-dnl development; see the SPONSORS file for full details.  Squid is
-dnl Copyrighted (C) 2001 by the Regents of the University of
-dnl California; see the COPYRIGHT file for full details.  Squid
-dnl incorporates software developed and/or copyrighted by other
-dnl sources; see the CREDITS file for full details.
-dnl
-dnl This program is free software; you can redistribute it and/or modify
-dnl it under the terms of the GNU General Public License as published by
-dnl the Free Software Foundation; either version 2 of the License, or
-dnl (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-dnl GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program; if not, write to the Free Software
-dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
-
+## Copyright (C) 1996-2015 The Squid Software Foundation and contributors
+##
+## Squid software is distributed under GPLv2+ license and includes
+## contributions from numerous individuals and organizations.
+## Please see the COPYING and CONTRIBUTORS files for details.
+##
 
 dnl check that strnstr() works fine. On Macos X it can cause a buffer overrun
 dnl sets squid_cv_func_strnstr to "yes" or "no", and defines HAVE_STRNSTR
@@ -50,7 +28,7 @@ int main(int argc, char **argv)
     strnstr(str, "fubar", size);
     return 0;
 }
-  ]])],[squid_cv_func_strnstr="yes"],[squid_cv_func_strnstr="no"],[])
+  ]])],[squid_cv_func_strnstr="yes"],[squid_cv_func_strnstr="no"],[:])
 )
 if test "$squid_cv_func_strnstr" = "yes" ; then
   AC_DEFINE(HAVE_STRNSTR,1)
@@ -79,7 +57,7 @@ AC_CACHE_CHECK(if va_copy is implemented, squid_cv_func_va_copy,
          return 0;
       }
       int main(int argc, char **argv) { return f (0, 42); }
-      ]])],[squid_cv_func_va_copy="yes"],[squid_cv_func_va_copy="no"],[])
+      ]])],[squid_cv_func_va_copy="yes"],[squid_cv_func_va_copy="no"],[:])
 )
 if test "$squid_cv_func_va_copy" = "yes" ; then
   AC_DEFINE(HAVE_VA_COPY, 1)
@@ -106,7 +84,7 @@ AC_CACHE_CHECK(if __va_copy is implemented, squid_cv_func___va_copy,
          return 0;
       }
       int main(int argc, char **argv) { return f (0, 42); }
-      ]])],[squid_cv_func___va_copy="yes"],[squid_cv_func___va_copy="no"],[])
+      ]])],[squid_cv_func___va_copy="yes"],[squid_cv_func___va_copy="no"],[:])
 )
 if test "$squid_cv_func___va_copy" = "yes" ; then
   AC_DEFINE(HAVE___VA_COPY, 1)
@@ -132,10 +110,33 @@ int main(int argc, char **argv)
     }
     return 0;
 }
-      ]])],[squid_cv_epoll_works=yes],[squid_cv_epoll_works=no],[]))
+      ]])],[squid_cv_epoll_works=yes],[squid_cv_epoll_works=no],[:]))
 
 ]) dnl SQUID_CHECK_EPOLL
 
+dnl check that /dev/poll actually works
+dnl sets squid_cv_devpoll_works to "yes" or "no"
+AC_DEFUN([SQUID_CHECK_DEVPOLL],[
+
+    AC_CACHE_CHECK(if /dev/poll works, squid_cv_devpoll_works,
+      AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#include <sys/devpoll.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <stdio.h>
+int main(int argc, char **argv)
+{
+    int fd = open("/dev/poll", O_RDWR);
+    if (fd < 0) {
+       perror("devpoll_create:");
+       return 1;
+    }
+    return 0;
+}
+      ]])],[squid_cv_devpoll_works=yes],[squid_cv_devpoll_works=no],[:]))
+
+]) dnl SQUID_CHECK_DEVPOLL
+
 
 dnl check that we have functional libcap2 headers
 dnl sets squid_cv_sys_capability_works to "yes" or "no"
@@ -157,7 +158,7 @@ AC_DEFUN([SQUID_CHECK_FUNCTIONAL_LIBCAP2],[
 ])
 
 
-dnl Ripped from Samba. Thanks!
+dnl 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],[
@@ -174,26 +175,6 @@ AC_DEFUN([SQUID_CHECK_UNIX_SOCKET],[
 ])
 
 
-dnl checks that the system provides struct mallinfo and mallinfo.mxfast.
-dnl AC_DEFINEs HAVE_STRUCT_MALLINFO  and HAVE_STRUCT_MALLINFO_MXFAST if so
-
-AC_DEFUN([SQUID_HAVE_STRUCT_MALLINFO],[
-AC_CHECK_TYPE(struct mallinfo,AC_DEFINE(HAVE_STRUCT_MALLINFO,1,[The system provides struct mallinfo]),,[
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#if HAVE_MALLOC_H
-#include <malloc.h>
-#endif])
-AC_CHECK_MEMBERS([struct mallinfo.mxfast],,,[
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#if HAVE_MALLOC_H
-#include <malloc.h>
-#endif])
-])
-
 dnl check the default FD_SETSIZE size.
 dnl not cached, people are likely to tune this
 dnl defines DEFAULT_FD_SETSIZE
@@ -219,11 +200,10 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #if HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
-#if HAVE_WINSOCK_H
-#include <winsock.h>
-#endif
 #if HAVE_WINSOCK2_H
 #include <winsock2.h>
+#elif HAVE_WINSOCK_H
+#include <winsock.h>
 #endif
 int main(int argc, char **argv) {
        FILE *fp = fopen("conftestval", "w");
@@ -240,6 +220,7 @@ dnl checks the maximum number of filedescriptor we can open
 dnl sets shell var squid_filedescriptors_num
 
 AC_DEFUN([SQUID_CHECK_MAXFD],[
+AC_CHECK_FUNCS(setrlimit)
 AC_MSG_CHECKING(Maximum number of filedescriptors we can open)
 dnl damn! FreeBSD pthreads break dup2().
 SQUID_STATE_SAVE(maxfd)
@@ -399,11 +380,10 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #if HAVE_NETINET_IN_H
 #include <netinet/in.h>
 #endif
-#if HAVE_WINSOCK_H
-#include <winsock.h>
-#endif
 #if HAVE_WINSOCK2_H
 #include <winsock2.h>
+#elif HAVE_WINSOCK_H
+#include <winsock.h>
 #endif
 int main(int argc, char **argv)
 {
@@ -450,11 +430,10 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #if HAVE_NETINET_IN_H
 #include <netinet/in.h>
 #endif
-#if HAVE_WINSOCK_H
-#include <winsock.h>
-#endif
 #if HAVE_WINSOCK2_H
 #include <winsock2.h>
+#elif HAVE_WINSOCK_H
+#include <winsock.h>
 #endif
 int main(int argc, char **argv)
 {
@@ -501,11 +480,10 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #if HAVE_NETINET_IN_H
 #include <netinet/in.h>
 #endif
-#if HAVE_WINSOCK_H
-#include <winsock.h>
-#endif
 #if HAVE_WINSOCK2_H
 #include <winsock2.h>
+#elif HAVE_WINSOCK_H
+#include <winsock.h>
 #endif
 int main(int argc, char **argv)
 {
@@ -556,11 +534,10 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #if HAVE_NETINET_IN_H
 #include <netinet/in.h>
 #endif
-#if HAVE_WINSOCK_H
-#include <winsock.h>
-#endif
 #if HAVE_WINSOCK2_H
 #include <winsock2.h>
+#elif HAVE_WINSOCK_H
+#include <winsock.h>
 #endif
 int main(int argc, char **argv)
 {
@@ -610,7 +587,7 @@ dnl check if MAXPATHLEN is defined in the system headers
 dnl or define it ourselves
 
 AC_DEFUN([SQUID_CHECK_MAXPATHLEN],[
-AC_MSG_CHECKING(for MAXPATHLEN)
+AC_MSG_CHECKING(for system-provided MAXPATHLEN)
 AC_LINK_IFELSE([
   AC_LANG_PROGRAM([[
 #include <sys/param.h>]], [[
@@ -620,3 +597,370 @@ int i = MAXPATHLEN;]])], [
   AC_DEFINE(MAXPATHLEN,256,[If MAXPATHLEN has not been defined])])
 ])
 
+
+dnl check that we have a working statvfs
+dnl sets the ac_cv_func_statvfs shell variable and defines HAVE_STATVFS
+
+AC_DEFUN([SQUID_CHECK_WORKING_STATVFS],[
+AC_CACHE_CHECK(for working statvfs() interface,ac_cv_func_statvfs,[
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/statvfs.h>
+]], [[
+struct statvfs sfs;
+sfs.f_blocks = sfs.f_bfree = sfs.f_frsize = 
+sfs.f_files = sfs.f_ffree = 0;
+statvfs("/tmp", &sfs);
+]])],[ac_cv_func_statvfs=yes],[ac_cv_func_statvfs=no])
+])
+SQUID_DEFINE_BOOL(HAVE_STATVFS,$ac_cv_func_statvfs,[set to 1 if our system has statvfs(), and if it actually works])
+])
+
+
+dnl Check whether this OS defines f_frsize as a member of struct statfs
+AC_DEFUN([SQUID_CHECK_F_FRSIZE_IN_STATFS],[
+AC_CACHE_CHECK([for f_frsize field in struct statfs],
+                ac_cv_have_f_frsize_in_struct_statfs, [
+        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#if HAVE_SYS_STATFS_H
+#include <sts/statfs.h>
+#endif
+#if HAVE_SYS_STATVFS_H
+#include <sts/statvfs.h>
+#endif
+#if HAVE_SYS_VFS_H
+#include <sts/vfs.h>
+#endif
+                ]], [[ struct statfs s; s.f_frsize = 0; ]])],[ ac_cv_have_f_frsize_in_struct_statfs="yes" ],[ ac_cv_have_f_frsize_in_struct_statfs="no" 
+        ])
+])
+SQUID_DEFINE_BOOL(HAVE_F_FRSIZE_IN_STATFS,$ac_cv_have_f_frsize_in_struct_statfs,[Define if struct statfs has field f_frsize (Linux 2.6 or later)])
+])
+
+
+dnl check that we can use the libresolv _dns_ttl_ hack
+dnl sets the ac_cv_libresolv_dns_ttl_hack shell variable and defines LIBRESOLV_DNS_TTL_HACK
+
+AC_DEFUN([SQUID_CHECK_LIBRESOLV_DNS_TTL_HACK],[
+  AC_CACHE_CHECK(for libresolv _dns_ttl_ hack, ac_cv_libresolv_dns_ttl_hack, [
+   AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern int _dns_ttl_;]], [[return _dns_ttl_;]])],
+     [ac_cv_libresolv_dns_ttl_hack=yes],[ac_cv_libresolv_dns_ttl_hack=no]) ])
+  SQUID_DEFINE_BOOL(LIBRESOLV_DNS_TTL_HACK,$ac_cv_libresolv_dns_ttl_hack,
+     [libresolv.a has been hacked to export _dns_ttl_])
+])
+
+
+dnl checks for availability of some resolver fields
+dnl sets ac_cv_have_res_ext_nsaddr_list shell variable
+dnl defines _SQUID_RES_NSADDR6_COUNT _SQUID_RES_NSADDR6_LARRAY
+dnl defines _SQUID_RES_NSADDR6_LPTR _SQUID_RES_NSADDR6_COUNT
+dnl defines _SQUID_RES_NSADDR_LIST _SQUID_RES_NSADDR_COUNT
+
+AC_DEFUN([SQUID_CHECK_RESOLVER_FIELDS],[
+  AC_CACHE_CHECK(for _res_ext.nsaddr_list, ac_cv_have_res_ext_nsaddr_list,
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#if HAVE_ARPA_NAMESER_H
+#include <arpa/nameser.h>
+#endif
+#if HAVE_RESOLV_H
+#include <resolv.h>
+#endif
+    ]], 
+    [[_res_ext.nsaddr_list[[0]].s_addr;]])],[
+      ac_cv_have_res_ext_nsaddr_list="yes" ],[
+      ac_cv_have_res_ext_nsaddr_list="no"]))
+  if test "$ac_cv_have_res_ext_nsaddr_list" = "yes" ; then
+    AC_DEFINE(_SQUID_RES_NSADDR6_LARRAY,_res_ext.nsaddr_list,[If _res_ext structure has nsaddr_list member])
+    AC_DEFINE(_SQUID_RES_NSADDR6_COUNT,ns6count,[Nameserver Counter for IPv6 _res_ext])
+  fi
+
+if test "$_SQUID_RES_NSADDR6_LIST" = ""; then
+  AC_CACHE_CHECK(for _res._u._ext.nsaddrs, ac_cv_have_res_ext_nsaddrs,
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#if HAVE_ARPA_NAMESER_H
+#include <arpa/nameser.h>
+#endif
+#if HAVE_RESOLV_H
+#include <resolv.h>
+#endif
+    ]], i
+    [[_res._u._ext.nsaddrs[[0]]->sin6_addr;]])],
+    [ac_cv_have_res_ext_nsaddrs="yes"],[ac_cv_have_res_ext_nsaddrs="no"]))
+  if test "$ac_cv_have_res_ext_nsaddrs" = "yes" ; then
+    AC_DEFINE(_SQUID_RES_NSADDR6_LPTR,_res._u._ext.nsaddrs,[If _res structure has _ext.nsaddrs member])
+    AC_DEFINE(_SQUID_RES_NSADDR6_COUNT,_res._u._ext.nscount6,[Nameserver Counter for IPv6 _res])
+  fi
+fi
+
+AC_CACHE_CHECK(for _res.nsaddr_list, ac_cv_have_res_nsaddr_list,
+  AC_COMPILE_IFELSE([
+    AC_LANG_PROGRAM([[
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#if HAVE_ARPA_NAMESER_H
+#include <arpa/nameser.h>
+#endif
+#if HAVE_RESOLV_H
+#include <resolv.h>
+#endif
+  ]], [[_res.nsaddr_list[[0]];]])],
+  [ac_cv_have_res_nsaddr_list="yes"],[ac_cv_have_res_nsaddr_list="no"]))
+  if test $ac_cv_have_res_nsaddr_list = "yes" ; then
+    AC_DEFINE(_SQUID_RES_NSADDR_LIST,_res.nsaddr_list,[If _res structure has nsaddr_list member])
+    AC_DEFINE(_SQUID_RES_NSADDR_COUNT,_res.nscount,[Nameserver counter for IPv4 _res])
+  fi
+
+  if test "$_SQUID_RES_NSADDR_LIST" = ""; then
+    AC_CACHE_CHECK(for _res.ns_list, ac_cv_have_res_ns_list,
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#if HAVE_ARPA_NAMESER_H
+#include <arpa/nameser.h>
+#endif
+#if HAVE_RESOLV_H
+#include <resolv.h>
+#endif
+  ]], 
+  [[_res.ns_list[[0]].addr;]])],
+  [ac_cv_have_res_ns_list="yes"],[ac_cv_have_res_ns_list="no"]))
+  if test $ac_cv_have_res_ns_list = "yes" ; then
+    AC_DEFINE(_SQUID_RES_NSADDR_LIST,_res.ns_list,[If _res structure has ns_list member])
+    AC_DEFINE(_SQUID_RES_NSADDR_COUNT,_res.nscount,[Nameserver counter for IPv4 _res])
+  fi
+fi
+])
+
+
+dnl checks the winsock library to use (ws2_32 or wsock32)
+dnl may set ac_cv_func_select as a side effect
+AC_DEFUN([SQUID_CHECK_WINSOCK_LIB],[
+  AC_CHECK_HEADERS(winsock2.h winsock.h)
+  SQUID_STATE_SAVE(winsock)
+  SQUID_SEARCH_LIBS([squid_getprotobynumber],[ws2_32 wsock32],,,,[
+#if HAVE_WINSOCK2_H
+#include <winsock2.h>
+#elif HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+/* ugly hack. */
+void squid_getprotobynumber(void) {
+    getprotobynumber(1);
+}
+  ])
+  AC_MSG_CHECKING([for winsock library])
+  case "$ac_cv_search_squid_getprotobynumber" in
+    "no")
+      AC_MSG_RESULT([winsock library not found])
+      ;;
+    "none required")
+      AC_MSG_RESULT([winsock library already in LIBS])
+      ;;
+    "-lws2_32")
+      AC_MSG_RESULT([winsock2])
+      XTRA_LIBS="-lws2_32 $XTRA_LIBS"
+      ac_cv_func_select='yes'
+      ;;
+    "-lwsock32")
+      AC_MSG_RESULT([winsock])
+      XTRA_LIBS="-lwsock32 $XTRA_LIBS"
+      ac_cv_func_select='yes'
+      ;;
+  esac
+  SQUID_STATE_ROLLBACK(winsock)
+])
+
+dnl check that setresuid is properly implemented.
+dnl sets squid_cv_resuid_works to "yes" or "no"
+AC_DEFUN([SQUID_CHECK_SETRESUID_WORKS],[
+  AC_CACHE_CHECK(if setresuid is actually implemented, squid_cv_resuid_works,
+    AC_RUN_IFELSE([
+      AC_LANG_SOURCE([[
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STDIO_H
+#include <stdio.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+  int main(int argc, char **argv) {
+    if(setresuid(-1,-1,-1)) {
+      perror("setresuid:");
+      return 1;
+    }
+    return 0;
+  }
+  ]])],[
+    squid_cv_resuid_works="yes" ],[
+    squid_cv_resuid_works="no" ],[:])
+  )
+])
+
+dnl check that we have functional CPU clock access for the profiler
+dnl sets squid_cv_profiler_works to "yes" or "no"
+
+AC_DEFUN([SQUID_CHECK_FUNCTIONAL_CPU_PROFILER],[
+  AC_CACHE_CHECK([for operational CPU clock access], 
+                 squid_cv_cpu_profiler_works,
+    AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
+#if defined(__GNUC__) && ( defined(__i386) || defined(__i386__) )
+// okay
+#elif defined(__GNUC__) && ( defined(__x86_64) || defined(__x86_64__) )
+// okay
+#elif defined(__GNUC__) && defined(__alpha)
+// okay
+#elif defined(_M_IX86) && defined(_MSC_VER) /* x86 platform on Microsoft C Compiler ONLY */
+// okay
+#else
+#error This CPU is unsupported. No profiling available here.
+#endif
+  ]])],[
+  squid_cv_cpu_profiler_works=yes],[
+  squid_cv_cpu_profiler_works=no])
+  )
+])
+
+dnl check whether recv takes a char* or void* as a second argument
+AC_DEFUN([SQUID_CHECK_RECV_ARG_TYPE],[
+  AC_CACHE_CHECK([whether recv takes a pointer to void or char as second argument],
+         squid_cv_recv_second_arg_type, [
+                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <sys/types.h>
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_WINSOCK2_H
+#include <winsock2.h>
+#elif HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+int main (int argc, char ** argv) {
+       void *buf;
+  recv(0,buf,0,0);
+}
+]])],[squid_cv_recv_second_arg_type=void],
+     [squid_cv_recv_second_arg_type=char])
+  AC_MSG_RESULT($squid_cv_recv_second_arg_type*)
+  ])
+  AC_DEFINE_UNQUOTED(RECV_ARG_TYPE,$squid_cv_recv_second_arg_type,
+    [Base type of the second argument to recv(2)])
+])
+
+
+dnl check whether Solaris has broken IPFilter headers (Solaris 10 at least does)
+AC_DEFUN([SQUID_CHECK_BROKEN_SOLARIS_IPFILTER],[
+  if test "x$squid_cv_broken_ipfilter_minor_t" = "x"; then
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#     include <sys/types.h>
+#     include <sys/ioccom.h>
+#     include <netinet/in.h>
+
+#     include <netinet/ip_compat.h>
+#     include <netinet/ip_fil.h>
+#     include <netinet/ip_nat.h>
+    ]])],[
+      AC_MSG_RESULT(no)
+      squid_cv_broken_ipfilter_minor_t=0
+    ],[
+      ## on fail, test the hack
+      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#define minor_t fubaar
+#       include <sys/types.h>
+#       include <sys/ioccom.h>
+#       include <netinet/in.h>
+#undef minor_t
+#       include <netinet/ip_compat.h>
+#       include <netinet/ip_fil.h>
+#       include <netinet/ip_nat.h>
+      ]])],[
+        AC_MSG_RESULT(yes)
+        squid_cv_broken_ipfilter_minor_t=1
+      ],[
+        AC_MSG_RESULT(unable to make IPFilter work with netinet/ headers)
+      ])
+    ])
+  fi
+
+  AC_DEFINE_UNQUOTED(USE_SOLARIS_IPFILTER_MINOR_T_HACK,$squid_cv_broken_ipfilter_minor_t,
+    [Workaround IPFilter minor_t breakage])
+
+## check for IPFilter headers that require this hack
+## (but first netinet/in.h and sys/ioccom.h which they depend on)
+  AC_CHECK_HEADERS( \
+       netinet/in.h \
+       sys/ioccom.h \
+       ip_compat.h \
+       ip_fil_compat.h \
+       ip_fil.h \
+       ip_nat.h \
+       netinet/ip_compat.h \
+       netinet/ip_fil_compat.h \
+       netinet/ip_fil.h \
+       netinet/ip_nat.h \
+  ,,,[
+#if USE_SOLARIS_IPFILTER_MINOR_T_HACK
+#define minor_t fubar
+#endif
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_SYS_IOCCOM_H
+#include <sys/ioccom.h>
+#endif
+#if USE_SOLARIS_IPFILTER_MINOR_T_HACK
+#undef minor_t
+#endif
+#if HAVE_IP_COMPAT_H
+#include <ip_compat.h>
+#elif HAVE_NETINET_IP_COMPAT_H
+#include <netinet/ip_compat.h>
+#endif
+#if HAVE_IP_FIL_H
+#include <ip_fil.h>
+#elif HAVE_NETINET_IP_FIL_H
+#include <netinet/ip_fil.h>
+#endif
+#if !defined(IPFILTER_VERSION)
+#define IPFILTER_VERSION        5000004
+#endif
+  ])
+])