SDl Compile Question

New to the list, so this might have been asked already. I am using
Mandrake 8.0 with XFree 4.0.1. I have installed libggi and libgii, plus
and Mesa 3.5 with the SGI GL. I have compiled and installed SDL 1.2.2
with no problem, but every once in a while I get the following and the
program I am compiling will error out

(not all the errors, too long)
SDL_x11video.lo(.text+0x17): undefined reference to “XOpenDisplay"
SDL_x11video.lo(.text+0x17): undefined reference to XF40VidModeSwitchtoMode”

and a whole bunch more. It seems to me like I’m missing some kind of
library for X, but I can’t figure out what. Any help would be appreciated.

Matt