windows-config.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /**
  2. * \file windows-config.h
  3. *
  4. * This file contains all of the routines that must be linked into
  5. * an executable to use the generated option processing. The optional
  6. * routines are in separately compiled modules so that they will not
  7. * necessarily be linked in.
  8. *
  9. * This file is part of AutoOpts, a companion to AutoGen.
  10. * AutoOpts is free software.
  11. * AutoOpts is Copyright (C) 1992-2018 by Bruce Korb - all rights reserved
  12. *
  13. * AutoOpts is available under any one of two licenses. The license
  14. * in use must be one of these two and the choice is under the control
  15. * of the user of the license.
  16. *
  17. * The GNU Lesser General Public License, version 3 or later
  18. * See the files "COPYING.lgplv3" and "COPYING.gplv3"
  19. *
  20. * The Modified Berkeley Software Distribution License
  21. * See the file "COPYING.mbsd"
  22. *
  23. * These files have the following sha256 sums:
  24. *
  25. * 8584710e9b04216a394078dc156b781d0b47e1729104d666658aecef8ee32e95 COPYING.gplv3
  26. * 4379e7444a0e2ce2b12dd6f5a52a27a4d02d39d247901d3285c88cf0d37f477b COPYING.lgplv3
  27. * 13aa749a5b0a454917a944ed8fffc530b784f5ead522b1aacaf4ec8aa55a6239 COPYING.mbsd
  28. */
  29. #ifndef WINDOWS_CONFIG_HACKERY
  30. #define WINDOWS_CONFIG_HACKERY 1
  31. /*
  32. * The definitions below have been stolen from NTP's config.h for Windows.
  33. * However, they may be kept here in order to keep libopts independent from
  34. * the NTP project.
  35. */
  36. #ifndef __windows__
  37. # define __windows__ 4
  38. #endif
  39. /*
  40. * Miscellaneous functions that Microsoft maps to other names
  41. */
  42. #define snprintf _snprintf
  43. #define SIZEOF_INT 4
  44. #define SIZEOF_CHARP 4
  45. #define SIZEOF_LONG 4
  46. #define SIZEOF_SHORT 2
  47. #define HAVE_LIMITS_H 1
  48. #define HAVE_STRDUP 1
  49. #define HAVE_STRCHR 1
  50. #define HAVE_FCNTL_H 1
  51. /*
  52. * VS.NET's version of wspiapi.h has a bug in it where it assigns a value
  53. * to a variable inside an if statement. It should be comparing them.
  54. * We prevent inclusion since we are not using this code so we don't have
  55. * to see the warning messages
  56. */
  57. #ifndef _WSPIAPI_H_
  58. #define _WSPIAPI_H_
  59. #endif
  60. /* Prevent inclusion of winsock.h in windows.h */
  61. #ifndef _WINSOCKAPI_
  62. #define _WINSOCKAPI_
  63. #endif
  64. #ifndef __RPCASYNC_H__
  65. #define __RPCASYNC_H__
  66. #endif
  67. /* Include Windows headers */
  68. #include <windows.h>
  69. #include <winsock2.h>
  70. #include <limits.h>
  71. /*
  72. * Compatibility declarations for Windows, assuming SYS_WINNT
  73. * has been defined.
  74. */
  75. #define strdup _strdup
  76. #define stat _stat /* struct stat from <sys/stat.h> */
  77. #define unlink _unlink
  78. #define fchmod( _x, _y )
  79. #define ssize_t SSIZE_T
  80. #include <io.h>
  81. #define open _open
  82. #define close _close
  83. #define read _read
  84. #define write _write
  85. #define lseek _lseek
  86. #define pipe _pipe
  87. #define dup2 _dup2
  88. #define O_RDWR _O_RDWR
  89. #define O_RDONLY _O_RDONLY
  90. #define O_EXCL _O_EXCL
  91. #ifndef S_ISREG
  92. # define S_IFREG _S_IFREG
  93. # define S_ISREG(mode) (((mode) & S_IFREG) == S_IFREG)
  94. #endif
  95. #ifndef S_ISDIR
  96. # define S_IFDIR _S_IFDIR
  97. # define S_ISDIR(mode) (((mode) & S_IFDIR) == S_IFDIR)
  98. #endif
  99. /* C99 exact size integer support. */
  100. #if defined(HAVE_INTTYPES_H)
  101. # include <inttypes.h>
  102. #elif defined(HAVE_STDINT_H)
  103. # include <stdint.h>
  104. # define MISSING_INTTYPES_H 1
  105. #elif ! defined(ADDED_EXACT_SIZE_INTEGERS)
  106. # define ADDED_EXACT_SIZE_INTEGERS 1
  107. # define MISSING_INTTYPES_H 1
  108. typedef __int8 int8_t;
  109. typedef unsigned __int8 uint8_t;
  110. typedef __int16 int16_t;
  111. typedef unsigned __int16 uint16_t;
  112. typedef __int32 int32_t;
  113. typedef unsigned __int32 uint32_t;
  114. typedef __int64 int64_t;
  115. typedef unsigned __int64 uint64_t;
  116. typedef unsigned long uintptr_t;
  117. typedef long intptr_t;
  118. #endif
  119. #endif /* WINDOWS_CONFIG_HACKERY */
  120. /* windows-config.h ends here */