https://bugs.gentoo.org/909834
https://hg.osdn.net/view/graphicsmagick/GM/rev/f07f6a9c3a58

# HG changeset patch
# User Bob Friesenhahn <bfriesen@GraphicsMagick.org>
# Date 1675529318 21600
# Node ID f07f6a9c3a5862971b17d1481bb53f0666b0b66c
# Parent  166bc6d3500ddeb243c7c1b25ca0d9eade8e3b55
configure.ac: Test for interesting libjpeg-turbo 3.0 functions

--- a/configure
+++ b/configure
@@ -26116,6 +26116,20 @@
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
         have_jpeg='yes'
+        # Test for interesting libjpeg-turbo 3.0 functions (which may also appear in other JPEG libraries)
+        for ac_func in jpeg_enable_lossless jpeg12_write_scanlines jpeg16_write_scanlines \
+                        jpeg12_read_scanlines jpeg16_read_scanlines
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
     fi
     else
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
--- a/configure.ac
+++ b/configure.ac
@@ -2250,6 +2250,9 @@
         AC_DEFINE([HasJPEG],[1],[Define if you have JPEG library])
         AC_MSG_RESULT([yes])
         have_jpeg='yes'
+        # Test for interesting libjpeg-turbo 3.0 functions (which may also appear in other JPEG libraries)
+        AC_CHECK_FUNCS([jpeg_enable_lossless jpeg12_write_scanlines jpeg16_write_scanlines \
+                        jpeg12_read_scanlines jpeg16_read_scanlines])
     fi
     else
         AC_MSG_RESULT([no])
--- a/magick/magick_config.h.in
+++ b/magick/magick_config.h.in
@@ -149,6 +149,21 @@
 /* Define to 1 if you have the `jas_init_library' function. */
 #undef HAVE_JAS_INIT_LIBRARY
 
+/* Define to 1 if you have the `jpeg12_read_scanlines' function. */
+#undef HAVE_JPEG12_READ_SCANLINES
+
+/* Define to 1 if you have the `jpeg12_write_scanlines' function. */
+#undef HAVE_JPEG12_WRITE_SCANLINES
+
+/* Define to 1 if you have the `jpeg16_read_scanlines' function. */
+#undef HAVE_JPEG16_READ_SCANLINES
+
+/* Define to 1 if you have the `jpeg16_write_scanlines' function. */
+#undef HAVE_JPEG16_WRITE_SCANLINES
+
+/* Define to 1 if you have the `jpeg_enable_lossless' function. */
+#undef HAVE_JPEG_ENABLE_LOSSLESS
+
 /* Define if you have the <lcms2.h> header file. */
 #undef HAVE_LCMS2_H
 
