From bfb4cc7f38a69f5cf1a2a09614ff81d88772659e Mon Sep 17 00:00:00 2001 From: Alfred Wingate Date: Wed, 9 Jul 2025 20:08:24 +0300 Subject: [PATCH] Handle libtiff the same way as libpng and libjpeg libtiff is the odd one out where support was detected in two places and it was handled a different way than the other two. --- acinclude.m4 | 3 +++ backend/escl/escl_capabilities.c | 2 +- backend/escl/escl_tiff.c | 4 ++-- backend/genesys/image.cpp | 4 ++-- backend/hp3900_debug.c | 4 ++-- configure.ac | 2 +- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index ece9ac788..cea9c29b9 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -313,6 +313,9 @@ AC_DEFUN([SANE_CHECK_TIFF], AC_CHECK_HEADER(tiffio.h, [sane_cv_use_libtiff="yes"; TIFF_LIBS="-ltiff"],) ],) + if test "$sane_cv_use_libtiff" = "yes" ; then + AC_DEFINE(HAVE_LIBTIFF,1,[Define to 1 if you have the libtiff library.]) + fi AC_SUBST(TIFF_LIBS) ]) diff --git a/backend/escl/escl_capabilities.c b/backend/escl/escl_capabilities.c index 05b3fd2a1..7958fd8a7 100644 --- a/backend/escl/escl_capabilities.c +++ b/backend/escl/escl_capabilities.c @@ -232,7 +232,7 @@ find_valor_of_array_variables(xmlNode *node, capabilities_t *scanner, int type) scanner->caps[type].have_png = i; } #endif -#if(defined HAVE_TIFFIO_H) +#if(defined HAVE_LIBTIFF) else if(!strcmp(scanner->caps[type].DocumentFormats[i], "image/tiff")) { have_tiff = SANE_TRUE; diff --git a/backend/escl/escl_tiff.c b/backend/escl/escl_tiff.c index 6270ff499..9d97a011f 100644 --- a/backend/escl/escl_tiff.c +++ b/backend/escl/escl_tiff.c @@ -35,14 +35,14 @@ #include #include -#if(defined HAVE_TIFFIO_H) +#if(defined HAVE_LIBTIFF) #include #endif #include -#if(defined HAVE_TIFFIO_H) +#if(defined HAVE_LIBTIFF) /** * \fn SANE_Status escl_sane_decompressor(escl_sane_t *handler) diff --git a/backend/genesys/image.cpp b/backend/genesys/image.cpp index 431f996c6..5e8f1b300 100644 --- a/backend/genesys/image.cpp +++ b/backend/genesys/image.cpp @@ -22,7 +22,7 @@ #include "image.h" -#if defined(HAVE_TIFFIO_H) +#if defined(HAVE_LIBTIFF) #include #endif @@ -187,7 +187,7 @@ void write_tiff_file(const std::string& filename, const void* data, int depth, i { DBG_HELPER_ARGS(dbg, "depth=%d, channels=%d, ppl=%d, lines=%d", depth, channels, pixels_per_line, lines); -#if defined(HAVE_TIFFIO_H) +#if defined(HAVE_LIBTIFF) auto image = TIFFOpen(filename.c_str(), "w"); if (!image) { dbg.log(DBG_error, "Could not save debug image"); diff --git a/backend/hp3900_debug.c b/backend/hp3900_debug.c index 881f400db..91baa1082 100644 --- a/backend/hp3900_debug.c +++ b/backend/hp3900_debug.c @@ -47,7 +47,7 @@ #define DBG_BLK 0x04 /* USB Bulk data */ #include -#ifdef HAVE_TIFFIO_H +#ifdef HAVE_LIBTIFF #include /* dbg_tiff_save */ #endif @@ -545,7 +545,7 @@ dbg_tiff_save (char *sFile, SANE_Int width, SANE_Int height, SANE_Int depth, SANE_Int colortype, SANE_Int res_x, SANE_Int res_y, SANE_Byte * buffer, SANE_Int size) { -#ifdef HAVE_TIFFIO_H +#ifdef HAVE_LIBTIFF if (buffer != NULL) { char *path = getenv ("HOME"); diff --git a/configure.ac b/configure.ac index 9f5388b94..3a787893d 100644 --- a/configure.ac +++ b/configure.ac @@ -201,7 +201,7 @@ AC_CHECK_HEADERS(fcntl.h unistd.h libc.h sys/dsreq.h sys/select.h \ sys/socket.h sys/io.h sys/hw.h sys/types.h linux/ppdev.h \ dev/ppbus/ppi.h machine/cpufunc.h sys/sem.h poll.h \ windows.h be/kernel/OS.h limits.h sys/ioctl.h asm/types.h\ - netinet/in.h tiffio.h ifaddrs.h pwd.h getopt.h) + netinet/in.h ifaddrs.h pwd.h getopt.h) AC_CHECK_HEADERS([asm/io.h],,,[#include ]) SANE_CHECK_MISSING_HEADERS