matplotlib under cygwin - problems with Tk.

After adding the paths for cygwin to 'basedir' in setupext.py (see
attached patch), I can now compile matplotlib 0.84 under cygwin. I do
however have problems with Tk.

I get the following error if I try to compile with Tk:

c++ -shared -Wl,--enable-auto-image-base build/temp.cygwin-1.5.18-i686-2.4/src/_tkagg.o build/temp.cygwin-1.5.18-i686-2.4/CXX/cxxsupport.o build/temp.cygwin-1.5.18-i686-2.4/CXX/cxx_extensions.o build/temp.cygwin-1.5.18-i686-2.4/CXX/IndirectPythonInterface.o build/temp.cygwin-1.5.18-i686-2.4/CXX/cxxextensions.o -LC:/cygwin/usr/share/tcl8.4/../ -LC:/cygwin/usr/share/tk8.4/../ -L/usr/local/lib -L/usr/lib -L/usr/local/lib -L/usr/lib -L/usr/lib/python2.4/config -ltk8.4 -ltcl8.4 -lpng -lz -lstdc++ -lm -lfreetype -lz -lstdc++ -lm -lpython2.4 -o build/lib.cygwin-1.5.18-i686-2.4/matplotlib/backends/_tkagg.dll
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -ltk8.4
collect2: ld returned 1 exit status
error: command 'c++' failed with exit status 1

The problem with Tk, seems to comes from the fact that when it is
linked, the flags -ltk8.4 and -ltcl8.4 are used.

However, although /usr/lib/tk8.4 exists, the libs seem to be '84', not '8.4':

$ ls -l /usr/lib/libtk*
lrwxrwxrwx 1 walker Users 9 Feb 29 2004 /usr/lib/libtk.a -> libtk84.a
-rwxr-x---+ 1 walker Users 490984 Sep 2 2003 /usr/lib/libtk84.a
lrwxrwxrwx 1 walker Users 13 Feb 29 2004 /usr/lib/libtkstub.a -> libtkstub84.a
-rwxr-x---+ 1 walker Users 2058 Sep 2 2003 /usr/lib/libtkstub84.a

If I link with the flags -ltk -ltcl, then it all seems to work:

  c++ -shared -Wl,--enable-auto-image-base build/temp.cygwin-1.5.18-i686-2.4/src/_tkagg.o build/temp.cygwin-1.5.18-i686-2.4/CXX/cxxsupport.o build/temp.cygwin-1.5.18-i686-2.4/CXX/cxx_extensions.o build/temp.cygwin-1.5.18-i686-2.4/CXX/IndirectPythonInterface.o build/temp.cygwin-1.5.18-i686-2.4/CXX/cxxextensions.o -LC:/cygwin/usr/share/tcl8.4/../ -LC:/cygwin/usr/share/tk8.4/../ -L/usr/local/lib -L/usr/lib -L/usr/local/lib -L/usr/lib -L/usr/lib/python2.4/config -ltk -ltcl -lpng -lz -lstdc++ -lm -lfreetype -lz -lstdc++ -lm -lpython2.4 -o build/lib.cygwin-1.5.18-i686-2.4/matplotlib/backends/_tkagg.dll

I'm not sure if this is a bug in the tcl/tk implementation on cygwin,
or a problem with matplotlib.

Chris

PS Cygwin doesn't come with things like numeric - these have to be compiled separately

PPS This is the patch fof setupext:

--- matplotlib-0.84/setupext.py 2005-09-09 19:12:33.000000000 +0100
+++ matplotlib-0.84.n2/setupext.py 2005-11-07 22:54:29.162923200 +0000
@@ -35,6 +35,7 @@

  basedir = {
      'win32' : ['win32_static',],
+ 'cygwin' : ['/usr/local', '/usr',],
      'linux2' : ['/usr/local', '/usr',],
      'linux' : ['/usr/local', '/usr',],
      # Charles Moad recommends not putting in /usr/X11R6 for darwin