I can't compile X11R6 on Solaris 2.4

There are several possible problems when compiling X11R6 on Solaris 2.4,
all are solved after applying R6 fixes upto and including fix-12.
These problems are:

The compilation of xc/programs/Xserver/Xext/shm.c will fail with
a redefinition of shmat().

Compilation errors when using SC 2.0.x.

See also 6.6

[an error occurred while processing this directive]