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

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