1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: Runtime build options checking
4 // Author: Vadim Zeitlin, Vaclav Slavik
8 // Copyright: (c) 2002 Vadim Zeitlin <vadim@wxwidgets.org>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
15 #include "wx/version.h"
17 // ----------------------------------------------------------------------------
18 // WX_BUILD_OPTIONS_SIGNATURE
19 // ----------------------------------------------------------------------------
21 #define __WX_BO_STRINGIZE(x) __WX_BO_STRINGIZE0(x)
22 #define __WX_BO_STRINGIZE0(x) #x
24 #if (wxMINOR_VERSION % 2) == 0
25 #define __WX_BO_VERSION(x,y,z) \
26 __WX_BO_STRINGIZE(x) "." __WX_BO_STRINGIZE(y)
28 #define __WX_BO_VERSION(x,y,z) \
29 __WX_BO_STRINGIZE(x) "." __WX_BO_STRINGIZE(y) "." __WX_BO_STRINGIZE(z)
33 #define __WX_BO_DEBUG "debug"
35 #define __WX_BO_DEBUG "no debug"
39 #define __WX_BO_UNICODE "Unicode"
41 #define __WX_BO_UNICODE "ANSI"
44 // GCC and Intel C++ share same C++ ABI (and possibly others in the future),
45 // check if compiler versions are compatible:
46 #if defined(__GXX_ABI_VERSION)
47 #define __WX_BO_COMPILER \
48 ",compiler with C++ ABI " __WX_BO_STRINGIZE(__GXX_ABI_VERSION)
49 #elif defined(__INTEL_COMPILER)
50 #define __WX_BO_COMPILER ",Intel C++"
51 #elif defined(__GNUG__)
52 #define __WX_BO_COMPILER ",GCC " \
53 __WX_BO_STRINGIZE(__GNUC__) "." __WX_BO_STRINGIZE(__GNUC_MINOR__)
54 #elif defined(__VISUALC__)
55 #define __WX_BO_COMPILER ",Visual C++"
56 #elif defined(__BORLANDC__)
57 #define __WX_BO_COMPILER ",Borland C++"
58 #elif defined(__DIGITALMARS__)
59 #define __WX_BO_COMPILER ",DigitalMars"
60 #elif defined(__WATCOMC__)
61 #define __WX_BO_COMPILER ",Watcom C++"
63 #define __WX_BO_COMPILER
66 // WXWIN_COMPATIBILITY macros affect presence of virtual functions
67 #if WXWIN_COMPATIBILITY_2_2
68 #define __WX_BO_WXWIN_COMPAT_2_2 ",compatible with 2.2"
70 #define __WX_BO_WXWIN_COMPAT_2_2
72 #if WXWIN_COMPATIBILITY_2_4
73 #define __WX_BO_WXWIN_COMPAT_2_4 ",compatible with 2.4"
75 #define __WX_BO_WXWIN_COMPAT_2_4
78 // deriving wxWin containers from STL ones changes them completely:
80 #define __WX_BO_STL ",STL containers"
82 #define __WX_BO_STL ",wx containers"
85 // This macro is passed as argument to wxConsoleApp::CheckBuildOptions()
86 #define WX_BUILD_OPTIONS_SIGNATURE \
87 __WX_BO_VERSION(wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) \
88 " (" __WX_BO_DEBUG "," __WX_BO_UNICODE \
91 __WX_BO_WXWIN_COMPAT_2_2 __WX_BO_WXWIN_COMPAT_2_4 \
95 // ----------------------------------------------------------------------------
96 // WX_CHECK_BUILD_OPTIONS
97 // ----------------------------------------------------------------------------
99 // Use this macro to check build options. Adding it to a file in DLL will
100 // ensure that the DLL checks build options in same way IMPLEMENT_APP() does.
101 #define WX_CHECK_BUILD_OPTIONS(libName) \
102 static bool wxCheckBuildOptions() \
104 wxAppConsole::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, \
108 static bool gs_buildOptionsCheck = wxCheckBuildOptions();
111 #if WXWIN_COMPATIBILITY_2_4
113 // ----------------------------------------------------------------------------
115 // ----------------------------------------------------------------------------
117 // NB: Don't use this class in new code, it relies on the ctor being always
118 // inlined. WX_BUILD_OPTIONS_SIGNATURE always works.
122 // the ctor must be inline to get the compilation settings of the code
123 // which included this header
124 wxBuildOptions() : m_signature(WX_BUILD_OPTIONS_SIGNATURE
) {}
127 const char *m_signature
;
129 // actually only CheckBuildOptions() should be our friend but well...
130 friend class wxAppConsole
;
133 #endif // WXWIN_COMPATIBILITY_2_4
135 #endif // _WX_BUILD_H_