There are several "patch kits" for X11R5 under Solaris 2.1.
Most of them require gcc 2.3.3 or later and unless you are
running gcc 2.8.0 or later you must have run "fixincludes"
when you install the gcc software.
The recommended patchkit is R5.SunOS5.patch.tar.Z available
from ftp.x.org:/R5contrib. It works with gcc (2.3.3 or later)
and SunPRO C.
X11R6 compiles out-of-the-box on Solaris 2.3.