This article is from the GNU Chess and XBoard FAQ, by Tim Mann email@example.com with numerous contributions by others.
Perhaps you have the X server and client programs installed on your
machine, but not the X header files and link-time libraries. If so, you
can run existing X programs, but you cannot compile a new X program from
source code. In this case the XBoard configure script will fail and will
tell you to look at this question in the FAQ. Many Linux distributions
put the headers and libraries in a separate package, which you might not
have installed. If you are using RedHat Linux, install the XFree86-devel
package. If you are using some other kind of Unix, ask your system
administrator where to find the X header files and link-time libraries.
If this is not your problem, read on.
The configure script for XBoard looks for X libraries and header files
in some common places. Sometimes it fails: If yours are installed in an
odd place, it may not find them at all. If you have more than one
version of X installed on your system, it may find the "wrong" one, or
occasionally it may find libraries from one version and incompatible
header files from another. You can work around these problems by telling
the configure script where the files are. For example:
configure --x-includes=/odd/place/include \ --x-libraries=/odd/place/lib