aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2005-12-15 19:39:44 +0000
committerYang Tse <yangsita@gmail.com>2005-12-15 19:39:44 +0000
commit51581c034d2a56028b3da937fa809a490c13e168 (patch)
treef0d734df5738d1abee35ea213912f6c4714b53e5
parent8f25a95b475e9ba3a5145a69fadf1f01879dc949 (diff)
Tests to check the availability of compilable and
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
-rw-r--r--acinclude.m4117
-rw-r--r--configure.ac16
2 files changed, 131 insertions, 2 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index c07072ebb..03cdd128e 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -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'.])
])
diff --git a/configure.ac b/configure.ac
index af7e62d0e..2de3128a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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.