Subject: Emacs 30.0.93 build failure if -lz but not <zlib.h>

From: Paul Eggert <[email-masked]>
Date: Sun, 19 Jan 2025 00:29:28 -0800

In the emacs-30.0.93 pretest, the build fails on cfarm119.cfarm.net 
which is running AIX 7.3. To reproduce the problem on that platform:

   /configure CC=/opt/IBM/openxlC/17.1.1/bin/ibm-clang 
--with-jpeg=ifavailable --with-png=ifavailable --with-gif=ifavailable 
--with-tiff=ifavailable --with-gnutls=ifavailable
   gmake

The build eventually fails with:

   CC       decompress.o
decompress.c:23:10: fatal error: 'zlib.h' file not found
#include <zlib.h>
          ^~~~~~~~

As the #include is protected by "#ifdef HAVE_ZLIB", it appears that 
'configure' assumes that if gcc -lz works then "#include <zlib.h>" will 
work too. That assumption is incorrect on this platform.

I suppose HAVE_ZLIB could be changed to be true only if zlib.h can be 
included; or perhaps the #include should be protected by #ifdef 
HAVE_ZLIB_H (though this sounds more complicated). Up to whoever did the 
zlib stuff.