From c52082c6e4811958dd741d67e1178b4e36a09923 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 5 Feb 2023 12:14:43 -0800 Subject: open-zfile: Make compress & uncompress commands optional If compress is not found, we disable writing to .Z files, but leave the rest of the compression code active. If uncompress is not found, we use gzip to read .Z files. Signed-off-by: Alan Coopersmith --- configure.ac | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 61a5f08..60f959c 100644 --- a/configure.ac +++ b/configure.ac @@ -52,9 +52,8 @@ AM_CONDITIONAL(USE_GETTEXT, test "x$USE_GETTEXT" = "xyes") dnl Helper macro to find absolute path to program and add a #define for it AC_DEFUN([XPM_PATH_PROG],[ AC_PATH_PROG([$1], [$2], []) -AS_IF([test "x$$1" = "x"], - [AC_MSG_ERROR([$2 not found, set $1 or use --disable-open-zfile])]) -AC_DEFINE_UNQUOTED([$1], ["$$1"], [Path to $2]) +AS_IF([test "x$$1" = "x"], [$3], + [AC_DEFINE_UNQUOTED([$1], ["$$1"], [Path to $2])]) ]) dnl End of AC_DEFUN([XPM_PATH_PROG]... # Optional feature: When a filename ending in .Z or .gz is requested, @@ -74,9 +73,17 @@ AM_CONDITIONAL(COMPRESSED_PIXMAPS, test "x$OPEN_ZFILE" = "xyes") if test x$OPEN_ZFILE = xno ; then AC_DEFINE(NO_ZPIPE, 1, [Define to 1 to disable decompression via pipes]) else - XPM_PATH_PROG([XPM_PATH_COMPRESS], [compress]) + # gzip is absolutely required for the compressed file handling code + XPM_PATH_PROG([XPM_PATH_GZIP], [gzip], + [AC_MSG_ERROR([gzip not found, set XPM_PATH_GZIP or use --disable-open-zfile])]) + + # if compress is not found, we disable writing to .Z files, + # but leave the rest of the compression code active + XPM_PATH_PROG([XPM_PATH_COMPRESS], [compress], + [AC_MSG_WARN([compress not found, disabling writing of .Z files])]) + # if uncompress is not found, we use gzip to read .Z files XPM_PATH_PROG([XPM_PATH_UNCOMPRESS], [uncompress]) - XPM_PATH_PROG([XPM_PATH_GZIP], [gzip]) + AC_CHECK_FUNCS([closefrom close_range], [break]) fi -- cgit v1.2.1