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

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