config.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. #ifndef __LIBXML_WIN32_CONFIG__
  2. #define __LIBXML_WIN32_CONFIG__
  3. #define HAVE_CTYPE_H
  4. #define HAVE_STDARG_H
  5. #define HAVE_MALLOC_H
  6. #define HAVE_ERRNO_H
  7. #if defined(_WIN32_WCE)
  8. #undef HAVE_ERRNO_H
  9. #include <windows.h>
  10. #include "wincecompat.h"
  11. #else
  12. #define HAVE_SYS_STAT_H
  13. #define HAVE__STAT
  14. #define HAVE_STAT
  15. #define HAVE_STDLIB_H
  16. #define HAVE_TIME_H
  17. #define HAVE_FCNTL_H
  18. #include <io.h>
  19. #include <direct.h>
  20. #endif
  21. #include <libxml/xmlversion.h>
  22. #ifndef ICONV_CONST
  23. #define ICONV_CONST const
  24. #endif
  25. #ifdef NEED_SOCKETS
  26. #include <wsockcompat.h>
  27. #endif
  28. /*
  29. * Windows platforms may define except
  30. */
  31. #undef except
  32. #define HAVE_ISINF
  33. #define HAVE_ISNAN
  34. #include <math.h>
  35. #if defined(_MSC_VER) || defined(__BORLANDC__)
  36. /* MS C-runtime has functions which can be used in order to determine if
  37. a given floating-point variable contains NaN, (+-)INF. These are
  38. preferred, because floating-point technology is considered propriatary
  39. by MS and we can assume that their functions know more about their
  40. oddities than we do. */
  41. #include <float.h>
  42. /* Bjorn Reese figured a quite nice construct for isinf() using the _fpclass
  43. function. */
  44. #ifndef isinf
  45. #define isinf(d) ((_fpclass(d) == _FPCLASS_PINF) ? 1 \
  46. : ((_fpclass(d) == _FPCLASS_NINF) ? -1 : 0))
  47. #endif
  48. /* _isnan(x) returns nonzero if (x == NaN) and zero otherwise. */
  49. #ifndef isnan
  50. #define isnan(d) (_isnan(d))
  51. #endif
  52. #else /* _MSC_VER */
  53. #ifndef isinf
  54. static int isinf (double d) {
  55. int expon = 0;
  56. double val = frexp (d, &expon);
  57. if (expon == 1025) {
  58. if (val == 0.5) {
  59. return 1;
  60. } else if (val == -0.5) {
  61. return -1;
  62. } else {
  63. return 0;
  64. }
  65. } else {
  66. return 0;
  67. }
  68. }
  69. #endif
  70. #ifndef isnan
  71. static int isnan (double d) {
  72. int expon = 0;
  73. double val = frexp (d, &expon);
  74. if (expon == 1025) {
  75. if (val == 0.5) {
  76. return 0;
  77. } else if (val == -0.5) {
  78. return 0;
  79. } else {
  80. return 1;
  81. }
  82. } else {
  83. return 0;
  84. }
  85. }
  86. #endif
  87. #endif /* _MSC_VER */
  88. #if defined(_MSC_VER)
  89. #define mkdir(p,m) _mkdir(p)
  90. #define snprintf _snprintf
  91. #if _MSC_VER < 1500
  92. #define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a)
  93. #endif
  94. #elif defined(__MINGW32__)
  95. #define mkdir(p,m) _mkdir(p)
  96. #endif
  97. /* Threading API to use should be specified here for compatibility reasons.
  98. This is however best specified on the compiler's command-line. */
  99. #if defined(LIBXML_THREAD_ENABLED)
  100. #if !defined(HAVE_PTHREAD_H) && !defined(HAVE_WIN32_THREADS) && !defined(_WIN32_WCE)
  101. #define HAVE_WIN32_THREADS
  102. #endif
  103. #endif
  104. /* Some third-party libraries far from our control assume the following
  105. is defined, which it is not if we don't include windows.h. */
  106. #if !defined(FALSE)
  107. #define FALSE 0
  108. #endif
  109. #if !defined(TRUE)
  110. #define TRUE (!(FALSE))
  111. #endif
  112. #endif /* __LIBXML_WIN32_CONFIG__ */