apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Mark Vandenberg <jay...@gmail.com>
Subject [patch 11/17] struct in_addr
Date Sat, 15 Apr 2006 01:41:29 GMT
Move the autoconf check for type 'in_addr' into a macro, and
improve it to work for Windows as well.

Index: build/apr_network.m4
===================================================================
--- build/apr_network.m4.orig
+++ build/apr_network.m4
@@ -17,6 +17,31 @@ dnl ------------------------------------
 dnl apr_network.m4: APR's autoconf macros for testing network support
 dnl
 
+dnl check for type in_addr
+dnl
+dnl
+AC_DEFUN(APR_TYPE_IN_ADDR,[
+  AC_CACHE_CHECK(for type in_addr, ac_cv_type_in_addr,[
+  AC_TRY_COMPILE([
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+],[
+ struct in_addr arg;
+ arg.s_addr = htonl(INADDR_ANY);
+], [ ac_cv_type_in_addr="yes"] , [
+ac_cv_type_in_addr="no"])
+])
+])
+
+dnl
+
 dnl
 dnl check for working getaddrinfo()
 dnl
Index: configure.in
===================================================================
--- configure.in.orig
+++ configure.in
@@ -1971,17 +1971,12 @@ AC_CHECK_MEMBERS([struct tm.tm_gmtoff, s
 
 dnl ----------------------------- Checking for Networking Support 
 echo "${nl}Checking for Networking support..."
-AC_MSG_CHECKING(for in_addr in netinet/in.h)
-AC_TRY_COMPILE([
-#include <sys/types.h>
-#include <netinet/in.h>
-],[
-struct in_addr arg;
-arg.s_addr = htonl(INADDR_ANY);
-], [ have_in_addr="1" 
-msg=yes ] , [ have_in_addr="0"
-msg=no ])
-AC_MSG_RESULT([$msg])
+APR_TYPE_IN_ADDR
+if test "$ac_cv_type_in_addr" = "yes"; then
+  have_in_addr="1"
+else
+  have_in_addr="0"
+fi
 
 AC_MSG_CHECKING([if fd == socket on this platform])
 if test "x$file_as_socket" != "x0" ; then

--

Mime
View raw message