gccpriv.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /*
  2. Name: wx/msw/gccpriv.h
  3. Purpose: MinGW/Cygwin definitions
  4. Author: Vadim Zeitlin
  5. Modified by:
  6. Created:
  7. Copyright: (c) Vadim Zeitlin
  8. Licence: wxWindows Licence
  9. */
  10. /* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
  11. #ifndef _WX_MSW_GCCPRIV_H_
  12. #define _WX_MSW_GCCPRIV_H_
  13. #if defined(__MINGW32__) && !defined(__GNUWIN32__)
  14. #define __GNUWIN32__
  15. #endif
  16. #if defined(__MINGW32__)
  17. /*
  18. Include the header defining __MINGW32_{MAJ,MIN}OR_VERSION but check
  19. that UNICODE or _UNICODE is already defined, as _mingw.h relies on them
  20. being set and we'd get weird compilation errors later if it is included
  21. without them being defined, better give a clearer error right now.
  22. */
  23. #if !defined(UNICODE)
  24. #ifndef wxUSE_UNICODE
  25. #error "wxUSE_UNICODE must be defined before including this header."
  26. #endif
  27. #if wxUSE_UNICODE
  28. #error "UNICODE must be defined before including this header."
  29. #endif
  30. #endif
  31. #include <_mingw.h>
  32. #define wxCHECK_MINGW32_VERSION( major, minor ) \
  33. ( ( ( __MINGW32_MAJOR_VERSION > (major) ) \
  34. || ( __MINGW32_MAJOR_VERSION == (major) && __MINGW32_MINOR_VERSION >= (minor) ) ) )
  35. #else
  36. #define wxCHECK_MINGW32_VERSION( major, minor ) (0)
  37. #endif
  38. #if defined( __MINGW32__ ) && !defined(__WINE__) && !defined( HAVE_W32API_H )
  39. #if __MINGW32_MAJOR_VERSION >= 1
  40. #define HAVE_W32API_H
  41. #endif
  42. #elif defined( __CYGWIN__ ) && !defined( HAVE_W32API_H )
  43. #if ( __GNUC__ > 2 )
  44. #define HAVE_W32API_H
  45. #endif
  46. #endif
  47. #if wxCHECK_WATCOM_VERSION(1,0)
  48. #define HAVE_W32API_H
  49. #endif
  50. /* check for MinGW/Cygwin w32api version ( releases >= 0.5, only ) */
  51. #if defined( HAVE_W32API_H )
  52. #include <w32api.h>
  53. #endif
  54. /* Watcom can't handle defined(xxx) here: */
  55. #if defined(__W32API_MAJOR_VERSION) && defined(__W32API_MINOR_VERSION)
  56. #define wxCHECK_W32API_VERSION( major, minor ) \
  57. ( ( ( __W32API_MAJOR_VERSION > (major) ) \
  58. || ( __W32API_MAJOR_VERSION == (major) && __W32API_MINOR_VERSION >= (minor) ) ) )
  59. #else
  60. #define wxCHECK_W32API_VERSION( major, minor ) (0)
  61. #endif
  62. /* Cygwin / Mingw32 with gcc >= 2.95 use new windows headers which
  63. are more ms-like (header author is Anders Norlander, hence the name) */
  64. #if (defined(__MINGW32__) || defined(__CYGWIN__) || defined(__WINE__)) && ((__GNUC__>2) || ((__GNUC__==2) && (__GNUC_MINOR__>=95)))
  65. #ifndef wxUSE_NORLANDER_HEADERS
  66. #define wxUSE_NORLANDER_HEADERS 1
  67. #endif
  68. #else
  69. #ifndef wxUSE_NORLANDER_HEADERS
  70. #define wxUSE_NORLANDER_HEADERS 0
  71. #endif
  72. #endif
  73. /* "old" GNUWIN32 is the one without Norlander's headers: it lacks the
  74. standard Win32 headers and we define the used stuff ourselves for it
  75. in wx/msw/gnuwin32/extra.h */
  76. #if defined(__GNUC__) && !wxUSE_NORLANDER_HEADERS
  77. #define __GNUWIN32_OLD__
  78. #endif
  79. /* Cygwin 1.0 */
  80. #if defined(__CYGWIN__) && ((__GNUC__==2) && (__GNUC_MINOR__==9))
  81. #define __CYGWIN10__
  82. #endif
  83. /* Mingw runtime 1.0-20010604 has some missing _tXXXX functions,
  84. so let's define them ourselves: */
  85. #if defined(__GNUWIN32__) && wxCHECK_W32API_VERSION( 1, 0 ) \
  86. && !wxCHECK_W32API_VERSION( 1, 1 )
  87. #ifndef _tsetlocale
  88. #if wxUSE_UNICODE
  89. #define _tsetlocale _wsetlocale
  90. #else
  91. #define _tsetlocale setlocale
  92. #endif
  93. #endif
  94. #ifndef _tgetenv
  95. #if wxUSE_UNICODE
  96. #define _tgetenv _wgetenv
  97. #else
  98. #define _tgetenv getenv
  99. #endif
  100. #endif
  101. #ifndef _tfopen
  102. #if wxUSE_UNICODE
  103. #define _tfopen _wfopen
  104. #else
  105. #define _tfopen fopen
  106. #endif
  107. #endif
  108. #endif
  109. /* current (= before mingw-runtime 3.3) mingw32 headers forget to
  110. define _puttchar, this will probably be fixed in the next versions but
  111. for now do it ourselves
  112. */
  113. #if defined( __MINGW32__ ) && \
  114. !wxCHECK_MINGW32_VERSION(3,3) && !defined( _puttchar )
  115. #ifdef wxUSE_UNICODE
  116. #define _puttchar putwchar
  117. #else
  118. #define _puttchar puttchar
  119. #endif
  120. #endif
  121. #endif
  122. /* _WX_MSW_GCCPRIV_H_ */