2005-12-17 15:37:53 -05:00
|
|
|
#ifndef __ARES_SETUP_H
|
|
|
|
#define __ARES_SETUP_H
|
2004-07-22 18:18:45 -04:00
|
|
|
|
2006-07-22 11:38:35 -04:00
|
|
|
/* $Id$ */
|
2006-07-22 11:21:13 -04:00
|
|
|
|
2005-03-10 18:30:34 -05:00
|
|
|
/* Copyright (C) 2004 - 2005 by Daniel Stenberg et al
|
2004-07-22 18:18:45 -04:00
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and distribute this software and its
|
|
|
|
* documentation for any purpose and without fee is hereby granted, provided
|
|
|
|
* that the above copyright notice appear in all copies and that both that
|
|
|
|
* copyright notice and this permission notice appear in supporting
|
|
|
|
* documentation, and that the name of M.I.T. not be used in advertising or
|
|
|
|
* publicity pertaining to distribution of the software without specific,
|
|
|
|
* written prior permission. M.I.T. makes no representations about the
|
|
|
|
* suitability of this software for any purpose. It is provided "as is"
|
|
|
|
* without express or implied warranty.
|
|
|
|
*/
|
|
|
|
|
2005-12-17 15:37:53 -05:00
|
|
|
#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.
|
|
|
|
*/
|
|
|
|
|
2004-07-22 18:18:45 -04:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#else
|
2005-11-10 11:55:59 -05:00
|
|
|
|
|
|
|
#ifdef WIN32
|
|
|
|
#include "config-win32.h"
|
|
|
|
#endif
|
|
|
|
|
2005-12-17 15:37:53 -05:00
|
|
|
#endif /* HAVE_CONFIG_H */
|
2005-12-16 15:55:07 -05:00
|
|
|
|
2005-12-20 15:48:38 -05:00
|
|
|
/*
|
2005-12-16 15:55:07 -05:00
|
|
|
* Include header files for windows builds before redefining anything.
|
2005-12-20 15:48:38 -05:00
|
|
|
* Use this preproessor block only to include or exclude windows.h,
|
|
|
|
* winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs
|
2006-07-05 19:10:37 -04:00
|
|
|
* to any other further and independant block. Under Cygwin things work
|
|
|
|
* just as under linux (e.g. <sys/socket.h>) and the winsock headers should
|
2006-08-03 21:13:24 -04:00
|
|
|
* never be included when __CYGWIN__ is defined. configure script takes
|
|
|
|
* care of this, not defining HAVE_WINDOWS_H, HAVE_WINSOCK_H, HAVE_WINSOCK2_H,
|
|
|
|
* neither HAVE_WS2TCPIP_H when __CYGWIN__ is defined.
|
2005-12-16 15:55:07 -05:00
|
|
|
*/
|
|
|
|
|
2006-08-03 21:13:24 -04:00
|
|
|
#ifdef HAVE_WINDOWS_H
|
2005-12-17 15:37:53 -05:00
|
|
|
# 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>
|
2005-12-16 15:55:07 -05:00
|
|
|
# endif
|
2005-12-17 15:37:53 -05:00
|
|
|
# else
|
|
|
|
# ifdef HAVE_WINSOCK_H
|
|
|
|
# include <winsock.h>
|
2005-12-16 15:55:07 -05:00
|
|
|
# endif
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2006-10-18 11:57:49 -04:00
|
|
|
/*
|
|
|
|
* Define USE_WINSOCK to 2 if we have and use WINSOCK2 API, else
|
|
|
|
* define USE_WINSOCK to 1 if we have and use WINSOCK API, else
|
|
|
|
* undefine USE_WINSOCK.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#undef USE_WINSOCK
|
|
|
|
|
|
|
|
#ifdef HAVE_WINSOCK2_H
|
|
|
|
# define USE_WINSOCK 2
|
|
|
|
#else
|
|
|
|
# ifdef HAVE_WINSOCK_H
|
|
|
|
# define USE_WINSOCK 1
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2005-12-17 18:35:25 -05:00
|
|
|
/*
|
2005-12-20 15:48:38 -05:00
|
|
|
* Work-arounds for systems without configure support
|
2005-12-17 15:37:53 -05:00
|
|
|
*/
|
2005-12-16 15:55:07 -05:00
|
|
|
|
2005-12-17 15:37:53 -05:00
|
|
|
#ifndef HAVE_CONFIG_H
|
|
|
|
|
2005-12-20 15:48:38 -05:00
|
|
|
#if defined(__DJGPP__) || (defined(__WATCOMC__) && (__WATCOMC__ >= 1240)) || \
|
|
|
|
defined(__POCC__)
|
2005-12-17 15:37:53 -05:00
|
|
|
#else
|
2004-07-22 18:18:45 -04:00
|
|
|
#define ssize_t int
|
2005-11-10 11:55:59 -05:00
|
|
|
#endif
|
2005-12-17 15:37:53 -05:00
|
|
|
|
|
|
|
#ifndef HAVE_WS2TCPIP_H
|
2005-05-16 14:06:54 -04:00
|
|
|
#define socklen_t int
|
2004-07-22 18:18:45 -04:00
|
|
|
#endif
|
|
|
|
|
2005-12-17 15:37:53 -05:00
|
|
|
#endif /* HAVE_CONFIG_H */
|
|
|
|
|
2005-12-20 15:48:38 -05:00
|
|
|
/*
|
|
|
|
* Recent autoconf versions define these symbols in config.h. We don't
|
2005-12-17 15:37:53 -05:00
|
|
|
* want them (since they collide with the libcurl ones when we build
|
|
|
|
* --enable-debug) so we undef them again here.
|
|
|
|
*/
|
|
|
|
|
2004-07-22 18:18:45 -04:00
|
|
|
#undef PACKAGE_STRING
|
|
|
|
#undef PACKAGE_TARNAME
|
|
|
|
#undef PACKAGE_VERSION
|
|
|
|
#undef PACKAGE_BUGREPORT
|
|
|
|
#undef PACKAGE_NAME
|
|
|
|
#undef VERSION
|
|
|
|
#undef PACKAGE
|
|
|
|
|
2005-12-20 15:48:38 -05:00
|
|
|
/*
|
|
|
|
* Typedef our socket type
|
2005-12-17 15:37:53 -05:00
|
|
|
*/
|
|
|
|
|
2006-10-18 17:05:40 -04:00
|
|
|
#ifdef USE_WINSOCK
|
2004-07-22 18:18:45 -04:00
|
|
|
typedef SOCKET ares_socket_t;
|
|
|
|
#define ARES_SOCKET_BAD INVALID_SOCKET
|
|
|
|
#else
|
|
|
|
typedef int ares_socket_t;
|
|
|
|
#define ARES_SOCKET_BAD -1
|
|
|
|
#endif
|
|
|
|
|
2005-12-20 15:48:38 -05:00
|
|
|
/*
|
2005-12-17 15:37:53 -05:00
|
|
|
* Assume a few thing unless they're set by configure
|
2004-08-20 09:45:26 -04:00
|
|
|
*/
|
2005-12-17 15:37:53 -05:00
|
|
|
|
2007-01-30 08:15:07 -05:00
|
|
|
#if !defined(HAVE_SYS_TIME_H) && !defined(_MSC_VER) && !defined(__WATCOMC__)
|
2005-03-10 18:30:34 -05:00
|
|
|
#define HAVE_SYS_TIME_H
|
2004-08-20 09:45:26 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(HAVE_UNISTD_H) && !defined(_MSC_VER)
|
2005-03-22 05:36:20 -05:00
|
|
|
#define HAVE_UNISTD_H 1
|
2004-08-20 09:45:26 -04:00
|
|
|
#endif
|
|
|
|
|
2004-08-20 09:48:24 -04:00
|
|
|
#if !defined(HAVE_SYS_UIO_H) && !defined(WIN32) && !defined(MSDOS)
|
2004-08-20 09:45:26 -04:00
|
|
|
#define HAVE_SYS_UIO_H
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if (defined(WIN32) || defined(WATT32)) && \
|
2005-11-10 11:55:59 -05:00
|
|
|
!(defined(__MINGW32__) || defined(NETWARE) || defined(__DJGPP__))
|
2004-08-20 09:45:26 -04:00
|
|
|
/* protos for the functions we provide in windows_port.c */
|
|
|
|
int ares_strncasecmp(const char *s1, const char *s2, int n);
|
|
|
|
int ares_strcasecmp(const char *s1, const char *s2);
|
|
|
|
|
|
|
|
/* use this define magic to prevent us from adding symbol names to the library
|
|
|
|
that is a high-risk to collide with another libraries' attempts to do the
|
|
|
|
same */
|
|
|
|
#define strncasecmp(a,b,c) ares_strncasecmp(a,b,c)
|
|
|
|
#define strcasecmp(a,b) ares_strcasecmp(a,b)
|
|
|
|
#endif
|
|
|
|
|
2005-03-10 18:30:34 -05:00
|
|
|
/* IPv6 compatibility */
|
|
|
|
#if !defined(HAVE_AF_INET6)
|
|
|
|
#if defined(HAVE_PF_INET6)
|
|
|
|
#define AF_INET6 PF_INET6
|
|
|
|
#else
|
|
|
|
#define AF_INET6 AF_MAX+1
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2006-07-28 10:19:02 -04:00
|
|
|
/*
|
|
|
|
* Include macros and defines that should only be processed once.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __SETUP_ONCE_H
|
|
|
|
#include "setup_once.h"
|
|
|
|
#endif
|
|
|
|
|
2005-12-17 15:37:53 -05:00
|
|
|
#endif /* __ARES_SETUP_H */
|