emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master a94988c01d4 1/2: Port better to AIX 7.3 with -lz but not zlib.h


From: Paul Eggert
Subject: master a94988c01d4 1/2: Port better to AIX 7.3 with -lz but not zlib.h
Date: Sun, 19 Jan 2025 19:24:40 -0500 (EST)

branch: master
commit a94988c01d45e4e494789d8715eed7ff7b383341
Author: Paul Eggert <eggert@cs.ucla.edu>
Commit: Paul Eggert <eggert@cs.ucla.edu>

    Port better to AIX 7.3 with -lz but not zlib.h
    
    * configure.ac (HAVE_ZLIB, LIBZ):
    Define only if zlib.h can be included (Bug#75667).
---
 configure.ac | 39 +++++++++++++++++++++++----------------
 1 file changed, 23 insertions(+), 16 deletions(-)

diff --git a/configure.ac b/configure.ac
index debdaadfc7b..1d8c281ee21 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5036,22 +5036,29 @@ AC_SUBST([LCMS2_LIBS])
 
 HAVE_ZLIB=no
 LIBZ=
-if test "${with_zlib}" != "no"; then
-  OLIBS=$LIBS
-  AC_SEARCH_LIBS([inflateEnd], [z], [HAVE_ZLIB=yes])
-  LIBS=$OLIBS
-  case $ac_cv_search_inflateEnd in
-    -*) LIBZ=$ac_cv_search_inflateEnd ;;
-  esac
-fi
-if test "${HAVE_ZLIB}" = "yes"; then
-  AC_DEFINE([HAVE_ZLIB], [1],
-    [Define to 1 if you have the zlib library (-lz).])
-  ### mingw32 doesn't use -lz, since it loads the library dynamically.
-  if test "${opsys}" = "mingw32"; then
-     LIBZ=
-  fi
-fi
+AS_IF([test "${with_zlib}" != "no"],
+  [AC_CACHE_CHECK([for library containing inflateEnd],
+     [emacs_cv_libz],
+     [AC_LANG_CONFTEST([AC_LANG_PROGRAM([[#include <zlib.h>
+                                         z_stream stream;]],
+                                       [[return inflateEnd (&stream);]])])
+      OLIBS=$LIBS
+      for emacs_cv_libz in '' -lz no; do
+       test "$emacs_cv_libz" = no && break
+       LIBS="$emacs_cv_libz $OLIBS"
+       AC_LINK_IFELSE([], [break])
+      done
+      LIBS=$OLIBS])
+
+   AS_CASE([$emacs_cv_libz],
+     [-* | ''],
+       [# mingw32 doesn't use -lz, since it loads the library dynamically.
+       AS_CASE([$opsys],
+         [mingw32], [LIBZ=],
+         [LIBZ=$emacs_cv_libz])
+       HAVE_ZLIB=yes
+       AC_DEFINE([HAVE_ZLIB], [1],
+         [Define to 1 if you have the zlib library (-lz).])])])
 AC_SUBST([LIBZ])
 
 ### Dynamic library support



reply via email to

[Prev in Thread] Current Thread [Next in Thread]