@@ -45,10 +45,21 @@ defenv['SUBSYS_WIN'] = '-Wl,--subsystem,windows'
45
45
defenv['MSVCRT_FLAG'] = ''
46
46
defenv['STDCALL'] = '"__attribute__((__stdcall__))"'
47
47
48
- # Don't allow mingw to link with LIBGCC*.DLL and LIBSTDC++-*.DLL
48
+ # Don't allow mingw to link with LIBGCC*.DLL and LIBSTDC++-*.DLL
49
+ def configure_static_libs(env):
50
+ env.Append(LINKFLAGS = ['-static-libgcc'])
51
+ code = """
52
+ #define G_V (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
53
+ #if G_V >= 10000 && G_V < 40503 // Might not be correct, 4.5.2 is known not to support it
54
+ #error !
55
+ #endif
56
+ """
57
+ conf = FlagsConfigure(env)
58
+ conf.CheckLinkFlag('-static-libstdc++', codeprepend = code)
59
+ conf.Finish()
60
+
49
61
if defenv['PLATFORM'] == 'win32':
50
- defenv.Append(LINKFLAGS = ['-static-libgcc'])
51
- defenv.Append(LINKFLAGS = ['-static-libstdc++'])
62
+ configure_static_libs(defenv)
52
63
53
64
### defines
54
65
@@ -144,8 +155,7 @@ if not defenv['DEBUG'] and defenv['STRIP'] and defenv['STRIP_W32']:
144
155
plugin_env.Append(LINKFLAGS = ['-mwindows']) # build windows executables
145
156
plugin_env.Append(LINKFLAGS = ['$ALIGN_FLAG']) # 512 bytes align
146
157
plugin_env.Append(LINKFLAGS = ['$MAP_FLAG']) # generate map file
147
- plugin_env.Append(LINKFLAGS = ['-static-libgcc']) # remove libgcc*.dll dependency
148
- plugin_env.Append(LINKFLAGS = ['-static-libstdc++']) # remove libstdc++*.dll dependency
158
+ configure_static_libs(plugin_env) # remove libgcc*.dll & libstdc++*.dll dependency
149
159
150
160
plugin_uenv = plugin_env.Clone()
151
161
plugin_uenv.Append(CPPDEFINES = ['_UNICODE', 'UNICODE'])
0 commit comments