libtiff: test/Makefile.am: make sure that all test images are bundled by make dist even if JPEG or JBIG is not available

From ac0dc616425c79a00329e887e9b4c7896724f87a Mon Sep 17 00:00:00 2001
From: Even Rouault <[EMAIL REDACTED]>
Date: Wed, 22 May 2024 04:36:34 +0200
Subject: [PATCH] test/Makefile.am: make sure that all test images are bundled
 by make dist even if JPEG or JBIG is not available

---
 test/Makefile.am | 34 ++++++++++++++++++++++------------
 1 file changed, 22 insertions(+), 12 deletions(-)

diff --git a/test/Makefile.am b/test/Makefile.am
index 63d72de8..487a8eee 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -45,7 +45,7 @@ EXTRA_DIST = \
 
 # All of the tests to execute via 'make check'
 if TIFF_TESTS
-TESTS = $(check_PROGRAMS) $(TESTSCRIPTS)
+TESTS = $(check_PROGRAMS) $(TESTSCRIPTS_TO_RUN)
 endif
 
 # Tests which are expected to fail
@@ -54,9 +54,6 @@ XFAIL_TESTS =
 # Extra files which should be cleaned by 'make clean'
 CLEANFILES = test_packbits.tif o-*
 
-if HAVE_JPEG
-if TIFF_TOOLS
-JPEG_DEPENDENT_CHECK_PROG=raw_decode
 JPEG_DEPENDENT_TESTSCRIPTS=\
 	tiff2rgba-quad-tile.jpg.sh \
 	tiff2rgba-ojpeg_zackthecat_subsamp22_single_strip.sh \
@@ -65,19 +62,26 @@ JPEG_DEPENDENT_TESTSCRIPTS=\
 	tiff2rgba-32bpp-None-jpeg.sh \
 	tiffcp-32bpp-None-jpeg.sh \
 	tiffcrop-32bpp-None-jpeg.sh
+
+if HAVE_JPEG
+if TIFF_TOOLS
+JPEG_DEPENDENT_CHECK_PROG=raw_decode
+JPEG_DEPENDENT_TESTSCRIPTS_TO_RUN=$(JPEG_DEPENDENT_TESTSCRIPTS)
 endif
 else
 JPEG_DEPENDENT_CHECK_PROG=
-JPEG_DEPENDENT_TESTSCRIPTS=
+JPEG_DEPENDENT_TESTSCRIPTS_TO_RUN=
 endif
 
-if HAVE_JBIG
-if TIFF_TOOLS
 JBIG_DEPENDENT_TESTSCRIPTS=\
 	tiffcp-lzw-single-strip-jbig.sh
+
+if HAVE_JBIG
+if TIFF_TOOLS
+JBIG_DEPENDENT_TESTSCRIPTS_TO_RUN=$(JBIG_DEPENDENT_TESTSCRIPTS)
 endif
 else
-JBIG_DEPENDENT_TESTSCRIPTS=
+JBIG_DEPENDENT_TESTSCRIPTS_TO_RUN=
 endif
 
 if BUILD_STATIC
@@ -93,8 +97,7 @@ check_PROGRAMS = \
 endif
 
 # Test scripts to execute
-if TIFF_TOOLS
-TESTSCRIPTS = \
+BASE_TESTSCRIPTS = \
 	ppm2tiff_pbm.sh \
 	ppm2tiff_pgm.sh \
 	ppm2tiff_ppm.sh \
@@ -173,11 +176,18 @@ TESTSCRIPTS = \
 	tiff2rgba-rgb-3c-8b.sh \
 	testfax4.sh \
 	testfax3_bug_513.sh \
-	testdeflatelaststripextradata.sh \
+	testdeflatelaststripextradata.sh
+
+TESTSCRIPTS =$(BASE_TESTSCRIPTS) \
 	$(JPEG_DEPENDENT_TESTSCRIPTS) \
 	$(JBIG_DEPENDENT_TESTSCRIPTS)
+
+if TIFF_TOOLS
+TESTSCRIPTS_TO_RUN=$(BASE_TESTSCRIPTS) \
+	$(JPEG_DEPENDENT_TESTSCRIPTS_TO_RUN) \
+	$(JBIG_DEPENDENT_TESTSCRIPTS_TO_RUN)
 else
-TESTSCRIPTS=
+TESTSCRIPTS_TO_RUN=
 endif
 
 # This list should contain the references files