install problem: xlib link error

I've been trying to install matplotlib with interactive plotting
support on a non-standard linux distribution (sidious.isani.org). I
have successfully installed matplotlib 0.90.1 with python 2.4.3 and
IPython 0.7.2. I can make plots with any of the image backends, but
the TkAgg backend fails with an "undefined symbol" error.

To install with TkAgg support I edited setup.py as follows:

BUILD_AGG = 1
BUILD_GTKAGG = 0
BUILD_GTK = 0
BUILD_TKAGG = 1

I run the build and install steps as root, getting no errors. If I
set the backend to Agg I can produce pdf or png plots just fine.
However, when I try to import the TkAgg backend, I get the following
error:

Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.4/site-packages/pylab.py", line 1, in ?
   from matplotlib.pylab import *
File "/usr/lib/python2.4/site-packages/matplotlib/pylab.py", line 222, in ?
   new_figure_manager, draw_if_interactive, show = pylab_setup()
File "/usr/lib/python2.4/site-packages/matplotlib/backends/__init__.py",
line 24, in pylab_setup
   globals(),locals(),[backend_name])
File "/usr/lib/python2.4/site-packages/matplotlib/backends/backend_tkagg.py",
line 8, in ?
   import tkagg # Paint image to Tk photo blitter extension
File "/usr/lib/python2.4/site-packages/matplotlib/backends/tkagg.py",
line 1, in ?
   import _tkagg
ImportError: /usr/lib/python2.4/site-packages/matplotlib/backends/_tkagg.so:
undefined symbol: XSetInputFocus

(I get the same error when testing as root or with my own user account)

This looks to me like a linker error. Maybe the xlib library is not
properly linked? I've checked that xsetinputfocus appears in
/usr/X11R7/include/X11/Xlib.h and I have added this directory to
setupext.py as:

basedir = {
   'win32' : ['win32_static',],
   'linux2' : ['/usr/local', '/usr','/usr/X11R7/include/X11',],
   'linux' : ['/usr/local', '/usr','/usr/X11R7/include/X11',],

Is there some other file I should be locating and linking, or some
other way to include xlib?

Thanks,
-steve