blob: a639b07263ba9e45c7e8699309cd21d0674a30e5 [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 Veillardf3afa7d2001-06-09 13:52:58 +000013#ifdef NEED_SOCKETS
Owen Taylor3473f882001-02-23 17:55:21 +000014#include <winsock2.h>
15
Igor Zlatkovic648b8e92002-04-17 18:35:57 +000016#if !defined SOCKLEN_T
17#define SOCKLEN_T int
18#endif
19
Owen Taylor3473f882001-02-23 17:55:21 +000020#define EWOULDBLOCK WSAEWOULDBLOCK
21#define EINPROGRESS WSAEINPROGRESS
22#define EALREADY WSAEALREADY
23#define ENOTSOCK WSAENOTSOCK
24#define EDESTADDRREQ WSAEDESTADDRREQ
25#define EMSGSIZE WSAEMSGSIZE
26#define EPROTOTYPE WSAEPROTOTYPE
27#define ENOPROTOOPT WSAENOPROTOOPT
28#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
29#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
30#define EOPNOTSUPP WSAEOPNOTSUPP
31#define EPFNOSUPPORT WSAEPFNOSUPPORT
32#define EAFNOSUPPORT WSAEAFNOSUPPORT
33#define EADDRINUSE WSAEADDRINUSE
34#define EADDRNOTAVAIL WSAEADDRNOTAVAIL
35#define ENETDOWN WSAENETDOWN
36#define ENETUNREACH WSAENETUNREACH
37#define ENETRESET WSAENETRESET
38#define ECONNABORTED WSAECONNABORTED
39#define ECONNRESET WSAECONNRESET
40#define ENOBUFS WSAENOBUFS
41#define EISCONN WSAEISCONN
42#define ENOTCONN WSAENOTCONN
43#define ESHUTDOWN WSAESHUTDOWN
44#define ETOOMANYREFS WSAETOOMANYREFS
45#define ETIMEDOUT WSAETIMEDOUT
46#define ECONNREFUSED WSAECONNREFUSED
47#define ELOOP WSAELOOP
Owen Taylor3473f882001-02-23 17:55:21 +000048#define EHOSTDOWN WSAEHOSTDOWN
49#define EHOSTUNREACH WSAEHOSTUNREACH
Owen Taylor3473f882001-02-23 17:55:21 +000050#define EPROCLIM WSAEPROCLIM
51#define EUSERS WSAEUSERS
52#define EDQUOT WSAEDQUOT
53#define ESTALE WSAESTALE
54#define EREMOTE WSAEREMOTE
Igor Zlatkovic648b8e92002-04-17 18:35:57 +000055/* These cause conflicts with the codes from errno.h. Since they are
56 not used in the relevant code (nanoftp, nanohttp), we can leave
57 them disabled.
58#define ENAMETOOLONG WSAENAMETOOLONG
59#define ENOTEMPTY WSAENOTEMPTY
60*/
61
62#endif /* NEED_SOCKETS */
Owen Taylor3473f882001-02-23 17:55:21 +000063
64#define HAVE_ISINF
65#define HAVE_ISNAN
66
67#include <math.h>
Daniel Veillard50f34372001-08-03 12:06:36 +000068#ifdef _MSC_VER
69/* MS C-runtime has functions which can be used in order to determine if
70 a given floating-point variable contains NaN, (+-)INF. These are
71 preferred, because floating-point technology is considered propriatary
72 by MS and we can assume that their functions know more about their
73 oddities than we do. */
74#include <float.h>
75/* Bjorn Reese figured a quite nice construct for isinf() using the _fpclass
76 function. */
77#ifndef isinf
78#define isinf(d) ((_fpclass(d) == _FPCLASS_PINF) ? 1 \
79 : ((_fpclass(d) == _FPCLASS_NINF) ? -1 : 0))
80#endif
81/* _isnan(x) returns nonzero if (x == NaN) and zero otherwise. */
82#ifndef isnan
83#define isnan(d) (_isnan(d))
84#endif
85#else /* _MSC_VER */
Owen Taylor3473f882001-02-23 17:55:21 +000086static int isinf (double d) {
87 int expon = 0;
88 double val = frexp (d, &expon);
89 if (expon == 1025) {
90 if (val == 0.5) {
91 return 1;
92 } else if (val == -0.5) {
93 return -1;
94 } else {
95 return 0;
96 }
97 } else {
98 return 0;
99 }
100}
101static int isnan (double d) {
102 int expon = 0;
103 double val = frexp (d, &expon);
104 if (expon == 1025) {
105 if (val == 0.5) {
106 return 0;
107 } else if (val == -0.5) {
108 return 0;
109 } else {
110 return 1;
111 }
112 } else {
113 return 0;
114 }
115}
Daniel Veillard50f34372001-08-03 12:06:36 +0000116#endif /* _MSC_VER */
Owen Taylor3473f882001-02-23 17:55:21 +0000117
118#include <direct.h>
119
Daniel Veillard2d90de42001-04-16 17:46:18 +0000120#define HAVE_SYS_STAT_H
121#define HAVE__STAT
Daniel Veillard16756b62001-10-01 07:36:25 +0000122#define HAVE_STAT
Daniel Veillard2d90de42001-04-16 17:46:18 +0000123
Daniel Veillard50f34372001-08-03 12:06:36 +0000124#include <libxml/xmlwin32version.h>
125
126#ifdef _MSC_VER
127/* We don't use trio when compiling under MSVC. This is not because trio
128 is bad, but because MSVC has no easy way to conditionally include a .c
129 file in the project. In order to enable trio usage, we would have to compile
130 all trio functionality into the executable, even if we don't use it.
131 Since MS C-runtime has all required functions, trio is not necessary. */
132#ifdef WITH_TRIO
133#undef WITH_TRIO
134#endif /* WITH_TRIO */
135#ifndef WITHOUT_TRIO
136#define WITHOUT_TRIO
137#endif /* WITHOUT_TRIO */
Daniel Veillard2d90de42001-04-16 17:46:18 +0000138/* Microsoft's C runtime names all non-ANSI functions with a leading
139 underscore. Since functionality is still the same, they can be used. */
Daniel Veillard2d90de42001-04-16 17:46:18 +0000140#define snprintf _snprintf
141#define vsnprintf _vsnprintf
142#endif /* _MSC_VER */
Owen Taylor3473f882001-02-23 17:55:21 +0000143
Daniel Veillard50f34372001-08-03 12:06:36 +0000144#ifndef LIBXML_DLL_IMPORT
145#if defined(_MSC_VER) && !defined(IN_LIBXML) && !defined(LIBXML_STATIC)
146#define LIBXML_DLL_IMPORT __declspec(dllimport)
147#else
148#define LIBXML_DLL_IMPORT
149#endif
150#endif
Daniel Veillardcc146db2001-06-22 11:10:52 +0000151
152#ifndef ATTRIBUTE_UNUSED
153#define ATTRIBUTE_UNUSED
154#endif
155
Daniel Veillarddb0eb8d2002-01-13 13:35:00 +0000156/* Define this if you want to use Windows native thread implementation.
157 Undefine it if you wish to use another, pthreads for example. Note
158 that this alone does not enable threads, just specifies the
159 threading model. Threading support is activated in xmlversion.h by
160 defining LIBXML_THREAD_ENABLE. */
161#define HAVE_WIN32_THREADS
162
Daniel Veillard4151acb2001-06-22 10:48:57 +0000163#endif /* __LIBXML_WIN32_CONFIG__ */
164