blob: c64c0d26d89647caa06c63da9cf0ac7ffdd89c14 [file] [log] [blame]
Daniel Veillard4151acb2001-06-22 10:48:57 +00001#ifndef __LIBXML_WIN32_CONFIG__
2#define __LIBXML_WIN32_CONFIG__
3
Owen Taylor3473f882001-02-23 17:55:21 +00004#define HAVE_CTYPE_H
5#define HAVE_STDLIB_H
Daniel Veillardf216d462002-02-08 13:44:24 +00006#define HAVE_STDARG_H
Owen Taylor3473f882001-02-23 17:55:21 +00007#define HAVE_MALLOC_H
8#define HAVE_TIME_H
9#define HAVE_FCNTL_H
10
11#include <io.h>
12
Daniel Veillard12f7d292001-06-28 13:12:11 +000013#define SOCKLEN_T int
Daniel Veillardf3afa7d2001-06-09 13:52:58 +000014#ifdef NEED_SOCKETS
Owen Taylor3473f882001-02-23 17:55:21 +000015#include <winsock2.h>
16
17#define EWOULDBLOCK WSAEWOULDBLOCK
18#define EINPROGRESS WSAEINPROGRESS
19#define EALREADY WSAEALREADY
20#define ENOTSOCK WSAENOTSOCK
21#define EDESTADDRREQ WSAEDESTADDRREQ
22#define EMSGSIZE WSAEMSGSIZE
23#define EPROTOTYPE WSAEPROTOTYPE
24#define ENOPROTOOPT WSAENOPROTOOPT
25#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
26#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
27#define EOPNOTSUPP WSAEOPNOTSUPP
28#define EPFNOSUPPORT WSAEPFNOSUPPORT
29#define EAFNOSUPPORT WSAEAFNOSUPPORT
30#define EADDRINUSE WSAEADDRINUSE
31#define EADDRNOTAVAIL WSAEADDRNOTAVAIL
32#define ENETDOWN WSAENETDOWN
33#define ENETUNREACH WSAENETUNREACH
34#define ENETRESET WSAENETRESET
35#define ECONNABORTED WSAECONNABORTED
36#define ECONNRESET WSAECONNRESET
37#define ENOBUFS WSAENOBUFS
38#define EISCONN WSAEISCONN
39#define ENOTCONN WSAENOTCONN
40#define ESHUTDOWN WSAESHUTDOWN
41#define ETOOMANYREFS WSAETOOMANYREFS
42#define ETIMEDOUT WSAETIMEDOUT
43#define ECONNREFUSED WSAECONNREFUSED
44#define ELOOP WSAELOOP
45#define ENAMETOOLONG WSAENAMETOOLONG
46#define EHOSTDOWN WSAEHOSTDOWN
47#define EHOSTUNREACH WSAEHOSTUNREACH
48#define ENOTEMPTY WSAENOTEMPTY
49#define EPROCLIM WSAEPROCLIM
50#define EUSERS WSAEUSERS
51#define EDQUOT WSAEDQUOT
52#define ESTALE WSAESTALE
53#define EREMOTE WSAEREMOTE
54#endif /* INCLUDE_WINSOCK */
55
56#define HAVE_ISINF
57#define HAVE_ISNAN
58
59#include <math.h>
Daniel Veillard50f34372001-08-03 12:06:36 +000060#ifdef _MSC_VER
61/* MS C-runtime has functions which can be used in order to determine if
62 a given floating-point variable contains NaN, (+-)INF. These are
63 preferred, because floating-point technology is considered propriatary
64 by MS and we can assume that their functions know more about their
65 oddities than we do. */
66#include <float.h>
67/* Bjorn Reese figured a quite nice construct for isinf() using the _fpclass
68 function. */
69#ifndef isinf
70#define isinf(d) ((_fpclass(d) == _FPCLASS_PINF) ? 1 \
71 : ((_fpclass(d) == _FPCLASS_NINF) ? -1 : 0))
72#endif
73/* _isnan(x) returns nonzero if (x == NaN) and zero otherwise. */
74#ifndef isnan
75#define isnan(d) (_isnan(d))
76#endif
77#else /* _MSC_VER */
Owen Taylor3473f882001-02-23 17:55:21 +000078static int isinf (double d) {
79 int expon = 0;
80 double val = frexp (d, &expon);
81 if (expon == 1025) {
82 if (val == 0.5) {
83 return 1;
84 } else if (val == -0.5) {
85 return -1;
86 } else {
87 return 0;
88 }
89 } else {
90 return 0;
91 }
92}
93static int isnan (double d) {
94 int expon = 0;
95 double val = frexp (d, &expon);
96 if (expon == 1025) {
97 if (val == 0.5) {
98 return 0;
99 } else if (val == -0.5) {
100 return 0;
101 } else {
102 return 1;
103 }
104 } else {
105 return 0;
106 }
107}
Daniel Veillard50f34372001-08-03 12:06:36 +0000108#endif /* _MSC_VER */
Owen Taylor3473f882001-02-23 17:55:21 +0000109
110#include <direct.h>
111
Daniel Veillard2d90de42001-04-16 17:46:18 +0000112#define HAVE_SYS_STAT_H
113#define HAVE__STAT
Daniel Veillard16756b62001-10-01 07:36:25 +0000114#define HAVE_STAT
Daniel Veillard2d90de42001-04-16 17:46:18 +0000115
Daniel Veillard50f34372001-08-03 12:06:36 +0000116#include <libxml/xmlwin32version.h>
117
118#ifdef _MSC_VER
119/* We don't use trio when compiling under MSVC. This is not because trio
120 is bad, but because MSVC has no easy way to conditionally include a .c
121 file in the project. In order to enable trio usage, we would have to compile
122 all trio functionality into the executable, even if we don't use it.
123 Since MS C-runtime has all required functions, trio is not necessary. */
124#ifdef WITH_TRIO
125#undef WITH_TRIO
126#endif /* WITH_TRIO */
127#ifndef WITHOUT_TRIO
128#define WITHOUT_TRIO
129#endif /* WITHOUT_TRIO */
Daniel Veillard2d90de42001-04-16 17:46:18 +0000130/* Microsoft's C runtime names all non-ANSI functions with a leading
131 underscore. Since functionality is still the same, they can be used. */
Daniel Veillard2d90de42001-04-16 17:46:18 +0000132#define snprintf _snprintf
133#define vsnprintf _vsnprintf
134#endif /* _MSC_VER */
Owen Taylor3473f882001-02-23 17:55:21 +0000135
Daniel Veillard50f34372001-08-03 12:06:36 +0000136#ifndef LIBXML_DLL_IMPORT
137#if defined(_MSC_VER) && !defined(IN_LIBXML) && !defined(LIBXML_STATIC)
138#define LIBXML_DLL_IMPORT __declspec(dllimport)
139#else
140#define LIBXML_DLL_IMPORT
141#endif
142#endif
Daniel Veillardcc146db2001-06-22 11:10:52 +0000143
144#ifndef ATTRIBUTE_UNUSED
145#define ATTRIBUTE_UNUSED
146#endif
147
Daniel Veillarddb0eb8d2002-01-13 13:35:00 +0000148/* Define this if you want to use Windows native thread implementation.
149 Undefine it if you wish to use another, pthreads for example. Note
150 that this alone does not enable threads, just specifies the
151 threading model. Threading support is activated in xmlversion.h by
152 defining LIBXML_THREAD_ENABLE. */
153#define HAVE_WIN32_THREADS
154
Daniel Veillard4151acb2001-06-22 10:48:57 +0000155#endif /* __LIBXML_WIN32_CONFIG__ */
156