]> granicus.if.org Git - curl/commitdiff
Tests to check the availability of compilable and
authorYang Tse <yangsita@gmail.com>
Thu, 15 Dec 2005 19:39:44 +0000 (19:39 +0000)
committerYang Tse <yangsita@gmail.com>
Thu, 15 Dec 2005 19:39:44 +0000 (19:39 +0000)
valid windows.h winsock.h winsock2.h and ws2tcpip.h
header files:
CURL_CHECK_HEADER_WINDOWS
CURL_CHECK_HEADER_WINSOCK
CURL_CHECK_HEADER_WINSOCK2
CURL_CHECK_HEADER_WS2TCPIP

acinclude.m4
configure.ac

index c07072ebb477bd914cc9473cbcfc1fb839a2cd98..03cdd128ea58c299d96372b026bfe60f0d91802b 100644 (file)
@@ -1,3 +1,116 @@
+
+
+dnl CURL_CHECK_HEADER_WINDOWS
+dnl -------------------------------------------------
+dnl Checks for compilable and valid windows.h header 
+
+AC_DEFUN([CURL_CHECK_HEADER_WINDOWS], [
+  AC_CACHE_CHECK([for windows.h], [ac_cv_header_windows_h], [
+    AC_COMPILE_IFELSE([
+      AC_LANG_PROGRAM([
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+      ],[
+        int dummy=2*WINVER;
+      ])
+    ],[
+      ac_cv_header_windows_h="yes"
+    ],[
+      ac_cv_header_windows_h="no"
+    ])
+  ])
+  if test "x$ac_cv_header_windows_h" = "xyes"; then
+    AC_DEFINE_UNQUOTED(HAVE_WINDOWS_H, "1",
+      [Define to 1 if you have the windows.h header file.])
+  fi
+])
+
+
+dnl CURL_CHECK_HEADER_WINSOCK
+dnl -------------------------------------------------
+dnl Checks for compilable and valid winsock.h header 
+
+AC_DEFUN([CURL_CHECK_HEADER_WINSOCK], [
+  AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
+  AC_CACHE_CHECK([for winsock.h], [ac_cv_header_winsock_h], [
+    AC_COMPILE_IFELSE([
+      AC_LANG_PROGRAM([
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <winsock.h>
+      ],[
+        int dummy=WSACleanup();
+      ])
+    ],[
+      ac_cv_header_winsock_h="yes"
+    ],[
+      ac_cv_header_winsock_h="no"
+    ])
+  ])
+  if test "x$ac_cv_header_winsock_h" = "xyes"; then
+    AC_DEFINE_UNQUOTED(HAVE_WINSOCK_H, "1",
+      [Define to 1 if you have the winsock.h header file.])
+  fi
+])
+
+
+dnl CURL_CHECK_HEADER_WINSOCK2
+dnl -------------------------------------------------
+dnl Checks for compilable and valid winsock2.h header 
+
+AC_DEFUN([CURL_CHECK_HEADER_WINSOCK2], [
+  AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
+  AC_CACHE_CHECK([for winsock2.h], [ac_cv_header_winsock2_h], [
+    AC_COMPILE_IFELSE([
+      AC_LANG_PROGRAM([
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <winsock2.h>
+      ],[
+        int dummy=2*IPPROTO_ESP;
+      ])
+    ],[
+      ac_cv_header_winsock2_h="yes"
+    ],[
+      ac_cv_header_winsock2_h="no"
+    ])
+  ])
+  if test "x$ac_cv_header_winsock2_h" = "xyes"; then
+    AC_DEFINE_UNQUOTED(HAVE_WINSOCK2_H, "1",
+      [Define to 1 if you have the winsock2.h header file.])
+  fi
+])
+
+
+dnl CURL_CHECK_HEADER_WS2TCPIP
+dnl -------------------------------------------------
+dnl Checks for compilable and valid ws2tcpip.h header
+
+AC_DEFUN([CURL_CHECK_HEADER_WS2TCPIP], [
+  AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
+  AC_CACHE_CHECK([for ws2tcpip.h], [ac_cv_header_ws2tcpip_h], [
+    AC_COMPILE_IFELSE([
+      AC_LANG_PROGRAM([
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <winsock2.h>
+#include <ws2tcpip.h>
+      ],[
+        int dummy=2*IP_PKTINFO;
+      ])
+    ],[
+      ac_cv_header_ws2tcpip_h="yes"
+    ],[
+      ac_cv_header_ws2tcpip_h="no"
+    ])
+  ])
+  if test "x$ac_cv_header_ws2tcpip_h" = "xyes"; then
+    AC_DEFINE_UNQUOTED(HAVE_WS2TCPIP_H, "1",
+      [Define to 1 if you have the ws2tcpip.h header file.])
+  fi
+])
+
+
 dnl Check for how to set a socket to non-blocking state. There seems to exist
 dnl four known different ways, with the one used almost everywhere being POSIX
 dnl and XPG3, while the other different ways for different systems (old BSD,
@@ -758,9 +871,9 @@ AC_DEFUN([CURL_FUNC_GETNAMEINFO_ARGTYPES], [
   shift
   AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG2, $[1],
     [Define to the type of arg 2 for `getnameinfo'.])
-  AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG46, ($[2]),
+  AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG46, $[2],
     [Define to the type of args 4 and 6 for `getnameinfo'.])
-  AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG7, ($[3]),
+  AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG7, $[3],
     [Define to the type of arg 7 for `getnameinfo'.])
 ])
 
index af7e62d0eef8b5884582046efb3e5f4b56f0e228..2de3128a78538125ea3fac759fbb1c132d47d9d1 100644 (file)
@@ -289,6 +289,22 @@ AC_HELP_STRING([--disable-manual],[Disable built-in manual]),
 dnl The actual use of the USE_MANUAL variable is done much later in this
 dnl script to allow other actions to disable it as well.
 
+dnl **********************************************************************
+dnl Make sure that our checks for headers windows.h winsock.h winsock2.h 
+dnl and ws2tcpip.h take precedence over any other further check done later.
+dnl **********************************************************************
+
+dnl Do we have a compilable and valid windows.h header ?
+CURL_CHECK_HEADER_WINDOWS
+
+dnl Do we have a compilable and valid winsock.h header ?
+CURL_CHECK_HEADER_WINSOCK
+
+dnl Do we have a compilable and valid winsock2.h header ?
+CURL_CHECK_HEADER_WINSOCK2
+
+dnl Do we have a compilable and valid ws2tcpip.h header ?
+CURL_CHECK_HEADER_WS2TCPIP
 
 dnl **********************************************************************
 dnl Checks for libraries.