Blame SOURCES/0004-configure-add-disable-open-zfile-instead-of-requirin.patch

f8f308
From 6fd1ea0d559a433aecccb21b63e91776e05a0831 Mon Sep 17 00:00:00 2001
f8f308
From: Alan Coopersmith <alan.coopersmith@oracle.com>
f8f308
Date: Thu, 5 Jan 2023 15:42:36 -0800
f8f308
Subject: [PATCH libXpm 4/6] configure: add --disable-open-zfile instead of
f8f308
 requiring -DNO_ZPIPE
f8f308
f8f308
Documents the two compression options in the README, makes their
f8f308
configure options reflect the interdependency of their implementation,
f8f308
and makes the configure script report their configuration.
f8f308
f8f308
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
f8f308
---
f8f308
 README.md    | 15 +++++++++++++++
f8f308
 configure.ac | 36 +++++++++++++++++++++++-------------
f8f308
 2 files changed, 38 insertions(+), 13 deletions(-)
f8f308
f8f308
diff --git a/README.md b/README.md
f8f308
index f661e15..f3f4c93 100644
f8f308
--- a/README.md
f8f308
+++ b/README.md
f8f308
@@ -16,3 +16,18 @@ For patch submission instructions, see:
f8f308
 
f8f308
   https://www.x.org/wiki/Development/Documentation/SubmittingPatches
f8f308
 
f8f308
+------------------------------------------------------------------------------
f8f308
+
f8f308
+libXpm supports two optional features to handle compressed pixmap files.
f8f308
+
f8f308
+--enable-open-zfile makes libXpm recognize file names ending in .Z and .gz
f8f308
+and open a pipe to the appropriate command to compress the file when writing
f8f308
+and uncompress the file when reading. This is enabled by default on platforms
f8f308
+other than MinGW and can be disabled by passing the --disable-open-zfile flag
f8f308
+to the configure script.
f8f308
+
f8f308
+--enable-stat-zfile make libXpm search for a file name with .Z or .gz added
f8f308
+if it can't find the file it was asked to open.  It relies on the
f8f308
+--enable-open-zfile feature to open the file, and is enabled by default
f8f308
+when --enable-open-zfile is enabled, and can be disabled by passing the
f8f308
+--disable-stat-zfile flag to the configure script.
f8f308
diff --git a/configure.ac b/configure.ac
f8f308
index 365544b..85e2c73 100644
f8f308
--- a/configure.ac
f8f308
+++ b/configure.ac
f8f308
@@ -49,25 +49,35 @@ if test "x$USE_GETTEXT" = "xyes" ; then
f8f308
 fi
f8f308
 AM_CONDITIONAL(USE_GETTEXT, test "x$USE_GETTEXT" = "xyes")
f8f308
 
f8f308
+# Optional feature: When a filename ending in .Z or .gz is requested,
f8f308
+# open a pipe to a newly forked compress/uncompress/gzip/gunzip command to
f8f308
+# handle it.
f8f308
+AC_MSG_CHECKING([whether to handle compressed pixmaps])
f8f308
+case $host_os in
f8f308
+        *mingw*)        zpipe_default="no" ;;
f8f308
+        *)              zpipe_default="yes" ;;
f8f308
+esac
f8f308
+AC_ARG_ENABLE(open-zfile,
f8f308
+        AS_HELP_STRING([--enable-open-zfile],
f8f308
+                        [Search for files with .Z & .gz extensions automatically @<:@default=auto@:>@]),
f8f308
+              [OPEN_ZFILE=$enableval], [OPEN_ZFILE=yes])
f8f308
+AC_MSG_RESULT([$OPEN_ZFILE])
f8f308
+if test x$OPEN_ZFILE = xno ; then
f8f308
+        AC_DEFINE(NO_ZPIPE, 1, [Define to 1 to disable decompression via pipes])
f8f308
+fi
f8f308
+
f8f308
 # Optional feature: When ___.xpm is requested, also look for ___.xpm.Z & .gz
f8f308
 # Replaces ZFILEDEF = -DSTAT_ZFILE in old Imakefile
f8f308
+AC_MSG_CHECKING([whether to search for compressed pixmaps])
f8f308
 AC_ARG_ENABLE(stat-zfile,
f8f308
-	AS_HELP_STRING([--enable-stat-zfile],
f8f308
-			[Search for files with .Z & .gz extensions automatically @<:@default=yes@:>@]),
f8f308
-              [STAT_ZFILE=$enableval], [STAT_ZFILE=yes])
f8f308
+        AS_HELP_STRING([--enable-stat-zfile],
f8f308
+                        [Search for files with .Z & .gz extensions automatically @<:@default=auto@:>@]),
f8f308
+              [STAT_ZFILE=$enableval], [STAT_ZFILE=$OPEN_ZFILE])
f8f308
+AC_MSG_RESULT([$STAT_ZFILE])
f8f308
 if test x$STAT_ZFILE = xyes ; then
f8f308
-	AC_DEFINE(STAT_ZFILE, 1, [Define to 1 to automatically look for files with .Z & .gz extensions])
f8f308
+        AC_DEFINE(STAT_ZFILE, 1, [Define to 1 to automatically look for files with .Z & .gz extensions])
f8f308
 fi
f8f308
 
f8f308
-
f8f308
-case $host_os in
f8f308
-	*mingw*)
f8f308
-                AC_DEFINE(NO_ZPIPE, 1, [Define to 1 to disable decompression via pipes])
f8f308
-	;;
f8f308
-	*)
f8f308
-	;;
f8f308
-esac
f8f308
-
f8f308
 AC_CONFIG_FILES([Makefile
f8f308
                  doc/Makefile
f8f308
                  include/Makefile
f8f308
-- 
f8f308
2.39.0
f8f308