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