]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix PF_INET6 test under C++
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 26 Jan 2009 08:23:36 +0000 (21:23 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 26 Jan 2009 08:23:36 +0000 (21:23 +1300)
configure.in

index b0c54ca69ef97278429cf60f4a5eab2ff9ca1b6d..4dca58c4de8149b4ecad1112b81584279720b4ea 100644 (file)
@@ -1991,15 +1991,14 @@ if test "$use_ipng" = "yes"; then
       ;;
   esac
   AC_CACHE_CHECK([if PF_INET6 is available], $use_ipng,
-    AC_TRY_RUN(
-      [ /* PF_INET6 available check */
+    AC_TRY_RUN([ /* PF_INET6 available check */
 #       include <sys/types.h>
 #       include <sys/socket.h>
-        void main() {
+        int main() {
           if (socket(PF_INET6, SOCK_STREAM, 0) < 0)
-            exit(1);
+            return 1;
           else
-            exit(0);
+            return 0;
         }
       ],
       [ AC_MSG_RESULT(yes)
@@ -2045,6 +2044,26 @@ AC_ARG_WITH(localhost-ipv6,
   [AC_DEFINE(IPV6_SPECIAL_LOCALHOST, 0, [Convert IPv4-localhost requests to IPv6. Default: Keep seperate.]) AC_MSG_RESULT(no)]
 )
 
+dnl Check whether this OS defines sin6_len as a member of sockaddr_in6 as a backup to ss_len
+AC_CACHE_CHECK([for sin6_len field in struct sockaddr_in6],
+                ac_cv_have_sin6_len_in_struct_sai, [
+        AC_TRY_COMPILE([
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+                ],
+                [ struct sockaddr_in6 s; s.sin6_len = 1; ],
+                [ ac_cv_have_sin6_len_in_struct_sai="yes" ],
+                [ ac_cv_have_sin6_len_in_struct_sai="no" ]
+        )
+])
+if test "x$ac_cv_have_sin6_len_in_struct_sai" = "xyes" ; then
+        AC_DEFINE(HAVE_SIN6_LEN_IN_SAI, 1, [Does struct sockaddr_in6 have sin6_len? 1: Yes, 0: No])
+else
+        AC_DEFINE(HAVE_SIN6_LEN_IN_SAI, 0, [Does struct sockaddr_in6 have sin6_len? 1: Yes, 0: No])
+fi
+
+
 else
   # NP: semi-silent failure as IPv4-only mode is perfectly usable on this system.
   AC_MSG_WARN([IPv6 is not available on this system.])
@@ -2102,25 +2121,6 @@ else
         AC_DEFINE(HAVE_SIN_LEN_IN_SAI, 0, [Does struct sockaddr_in have sin_len? 1: Yes, 0: No])
 fi
 
-dnl Check whether this OS defines sin6_len as a member of sockaddr_in6 as a backup to ss_len
-AC_CACHE_CHECK([for sin6_len field in struct sockaddr_in6],
-                ac_cv_have_sin6_len_in_struct_sai, [
-        AC_TRY_COMPILE([
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-                ],
-                [ struct sockaddr_in6 s; s.sin6_len = 1; ],
-                [ ac_cv_have_sin6_len_in_struct_sai="yes" ],
-                [ ac_cv_have_sin6_len_in_struct_sai="no" ]
-        )
-])
-if test "x$ac_cv_have_sin6_len_in_struct_sai" = "xyes" ; then
-        AC_DEFINE(HAVE_SIN6_LEN_IN_SAI, 1, [Does struct sockaddr_in6 have sin6_len? 1: Yes, 0: No])
-else
-        AC_DEFINE(HAVE_SIN6_LEN_IN_SAI, 0, [Does struct sockaddr_in6 have sin6_len? 1: Yes, 0: No])
-fi
-
 dnl --with-maxfd present for compatibility with Squid-2.
 dnl undocumented in ./configure --help  to encourage using the Squid-3 directive.
 AC_ARG_WITH(maxfd,,