• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1diff -urN a/setup.py b/setup.py
2--- a/setup.py	2012-06-24 21:00:44.404442659 +0100
3+++ b/setup.py	2012-06-24 21:00:44.607444094 +0100
4@@ -504,7 +504,7 @@
5         if host_platform in ['osf1', 'unixware7', 'openunix8']:
6             lib_dirs += ['/usr/ccs/lib']
7
8-        if host_platform == 'darwin':
9+        if host_platform in ['darwin', 'mingw', 'win32']:
10             # This should work on any unixy platform ;-)
11             # If the user has bothered specifying additional -I and -L flags
12             # in OPT and LDFLAGS we might as well use them here.
13@@ -514,6 +514,8 @@
14             # FIXME: Why LDFLAGS again ?
15             cflags, ldflags = sysconfig.get_config_vars(
16                     'CFLAGS', 'LDFLAGS')
17+            cflags = cflags + ' ' + ('',os.environ.get('CC'))[os.environ.get('CC') != None]
18+            ldflags = ldflags + ' ' + ('',os.environ.get('LDSHARED'))[os.environ.get('LDSHARED') != None]
19             for item in cflags.split():
20                 if item.startswith('-I'):
21                     inc_dirs.append(item[2:])
22@@ -1851,14 +1853,19 @@
23         # The versions with dots are used on Unix, and the versions without
24         # dots on Windows, for detection by cygwin.
25         tcllib = tklib = tcl_includes = tk_includes = None
26-        for version in ['8.6', '86', '8.5', '85', '8.4', '84', '8.3', '83',
27-                        '8.2', '82', '8.1', '81', '8.0', '80']:
28-            tklib = self.compiler.find_library_file(lib_dirs,
29-                                                        'tk' + version)
30-            tcllib = self.compiler.find_library_file(lib_dirs,
31-                                                         'tcl' + version)
32-            if tklib and tcllib:
33-                # Exit the loop when we've found the Tcl/Tk libraries
34+        tcltk_suffix = None
35+        for suffix in ['', 's']:
36+            for version in ['8.6', '86', '8.5', '85', '8.4', '84', '8.3', '83',
37+                            '8.2', '82', '8.1', '81', '8.0', '80', '']:
38+                tklib = self.compiler.find_library_file(lib_dirs,
39+                                                            'tk' + version + suffix)
40+                tcllib = self.compiler.find_library_file(lib_dirs,
41+                                                             'tcl' + version + suffix)
42+                if tklib and tcllib:
43+                    # Exit the loop when we've found the Tcl/Tk libraries
44+                    tcltk_suffix = suffix
45+                    break
46+            if tcltk_suffix != None:
47                 break
48
49         # Now check for the header files
50@@ -1927,15 +1934,21 @@
51             libs.append('BLT')
52
53         # Add the Tcl/Tk libraries
54-        libs.append('tk'+ version)
55-        libs.append('tcl'+ version)
56+        libs.append('tk'+ version + tcltk_suffix)
57+        libs.append('tcl'+ version + tcltk_suffix)
58+        if host_platform in ['mingw', 'win32']:
59+            for winlib in ['ws2_32','gdi32','comctl32','comdlg32','imm32','uuid','oleaut32','ole32']:
60+                libs.append( winlib )
61
62         if host_platform in ['aix3', 'aix4']:
63             libs.append('ld')
64
65         # Finally, link with the X11 libraries (not appropriate on cygwin, mingw)
66+        # ...on those platforms, define STATIC_BUILD if linking to static tcl/tk.
67         if not host_platform in ['cygwin', 'mingw', 'win32']:
68             libs.append('X11')
69+        elif tcllib.endswith('s.a'):
70+            defs.append( ('STATIC_BUILD',1) )
71
72         ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
73                         define_macros=[('WITH_APPINIT', 1)] + defs,
74