Don’t search for X11 when cross compiling (#110345)
This is undesirable because X11 development headers and libraries
found by searching /usr are much more likely to belong to the build
operating system than the host operating system (being cross-compiled
for). A particularly problematic case, from the original bug report,
is “using a sysroot where the target is binary compatible with the
host. In this case AC_PATH_X will happily look at /usr and say that
yes, X is available, even if the sysroot doesn't have X.”
To cross-compile X client applications, the recommended procedure is
to put X11 headers and libraries for the host system in the cross
compiler’s default search path; alternatively, --x-includes and
--x-libraries can be used.
Fixes bug #110345. Problem reported by Ross Burton.
* lib/autoconf/libs.m4 (_AC_PATH_X): Before doing anything else,
see whether a test compilation with no special options (just -lX11)
will work. If it doesn’t, only invoke _AC_PATH_X_XMKMF and
_AC_PATH_X_DIRECT when not cross compiling.