aboutsummaryrefslogtreecommitdiff
path: root/ares/setup.h
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2005-12-17 20:37:53 +0000
committerYang Tse <yangsita@gmail.com>2005-12-17 20:37:53 +0000
commitbc8590aa12b93f2df1ad20f53f4cce39724d140e (patch)
tree8cc312deba06942554e4709f818821204e2615da /ares/setup.h
parent939d368d5ff2a777e7d1b69f0c6f57287762e024 (diff)
Windows related cleanup
Diffstat (limited to 'ares/setup.h')
-rw-r--r--ares/setup.h81
1 files changed, 55 insertions, 26 deletions
diff --git a/ares/setup.h b/ares/setup.h
index 05eb76b3d..69081a899 100644
--- a/ares/setup.h
+++ b/ares/setup.h
@@ -1,5 +1,5 @@
-#ifndef ARES_SETUP_H
-#define ARES_SETUP_H
+#ifndef __ARES_SETUP_H
+#define __ARES_SETUP_H
/* Copyright (C) 2004 - 2005 by Daniel Stenberg et al
*
@@ -14,6 +14,21 @@
* without express or implied warranty.
*/
+#if !defined(WIN32) && defined(__WIN32__)
+/* Borland fix */
+#define WIN32
+#endif
+
+#if !defined(WIN32) && defined(_WIN32)
+/* VS2005 on x64 fix */
+#define WIN32
+#endif
+
+/*
+ * Include configuration script results or hand-crafted
+ * configuration file for platforms which lack config tool.
+ */
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#else
@@ -22,6 +37,7 @@
#include "config-win32.h"
#endif
+#endif /* HAVE_CONFIG_H */
/*
* Include header files for windows builds before redefining anything.
@@ -30,38 +46,46 @@
* to any other further and independant block.
*/
-#ifdef WIN32
-# ifdef HAVE_WINDOWS_H
-# ifndef WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN
+#ifdef HAVE_WINDOWS_H
+# ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+# endif
+# include <windows.h>
+# ifdef HAVE_WINSOCK2_H
+# include <winsock2.h>
+# ifdef HAVE_WS2TCPIP_H
+# include <ws2tcpip.h>
# endif
-# include <windows.h>
-# ifdef HAVE_WINSOCK2_H
-# include <winsock2.h>
-# ifdef HAVE_WS2TCPIP_H
-# include <ws2tcpip.h>
-# endif
-# else
-# ifdef HAVE_WINSOCK_H
-# include <winsock.h>
-# endif
+# else
+# ifdef HAVE_WINSOCK_H
+# include <winsock.h>
# endif
# endif
#endif
+/+
+ * Work-arounds for systems without configure support
+ */
-/* simple work-around for now, for systems without configure support */
-#ifndef __DJGPP__
+#ifndef HAVE_CONFIG_H
+
+#if defined(__DJGPP__) || (defined(__WATCOMC__) && (__WATCOMC__ >= 1240))
+#else
#define ssize_t int
#endif
-#ifndef _MSC_VER
+
+#ifndef HAVE_WS2TCPIP_H
#define socklen_t int
#endif
-#endif /* HAVE_CONFIG_H */
-/* Recent autoconf versions define these symbols in config.h. We don't want
- them (since they collide with the libcurl ones when we build
- --enable-debug) so we undef them again here. */
+#endif /* HAVE_CONFIG_H */
+
+/*
+ * Recent autoconf versions define these symbols in config.h. We don't
+ * want them (since they collide with the libcurl ones when we build
+ * --enable-debug) so we undef them again here.
+ */
+
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
@@ -70,7 +94,10 @@
#undef VERSION
#undef PACKAGE
-/* now typedef our socket type */
+/*
+ * Typedef our socket type
+ */
+
#if defined(WIN32) && !defined(WATT32)
typedef SOCKET ares_socket_t;
#define ARES_SOCKET_BAD INVALID_SOCKET
@@ -79,8 +106,10 @@ typedef int ares_socket_t;
#define ARES_SOCKET_BAD -1
#endif
-/* Assume a few thing unless they're set by configure
+/*
+ * Assume a few thing unless they're set by configure
*/
+
#if !defined(HAVE_SYS_TIME_H) && !defined(_MSC_VER)
#define HAVE_SYS_TIME_H
#endif
@@ -115,4 +144,4 @@ int ares_strcasecmp(const char *s1, const char *s2);
#endif
#endif
-#endif /* ARES_SETUP_H */
+#endif /* __ARES_SETUP_H */