Control: reassign -1 vice 3.5.0.dfsg-3
Control: retitle -1 vice: FTBFS: needs to include stdio.h when checking for 
jpeglib.h

On Sun, 26 Sep 2021 at 12:25:57 +0200, László Böszörményi wrote:
> On Tue, Sep 21, 2021 at 6:00 PM Alastair McKinstry <mckins...@debian.org> 
> wrote:
> > checking for jpeglib.h... no
> > configure: error: JPEG support is missing
> > make[1]: *** [debian/rules:18: override_dh_auto_configure] Error 1
>
>  The reason is simple, src:libjpeg-turbo started to use FILE in its
> jpeglib.h header without including stdio.h first. See the minimal
> reproducer (similar to what vice configure script tries to find out if
> jpeglib.h is present) below.
> -- jpegtest.c --
> #include <stddef.h>
> #include <jpeglib.h>
> 
> int main(void) {
>     return 0;
> }
> -- jpegtest.c --

In general it's a good idea for headers to be
self-contained, but according to upstream issue
<https://github.com/libjpeg-turbo/libjpeg-turbo/issues/17> this
non-self-contained header is documented behaviour inherited from IJG
libjpeg, and is considered "wontfix" upstream:

    Per libjpeg.txt:

    Applications using the JPEG library should include the header file jpeglib.h
    to obtain declarations of data types and routines. Before including
    jpeglib.h, include system headers that define at least the typedefs FILE and
    size_t. On ANSI-conforming systems, including <stdio.h> is sufficient; on
    older Unix systems, you may need <sys/types.h> to define size_t.

>From the timing of Alastair's bug report, I suspect this might be a
regression triggered by upgrading to autoconf 2.71 - perhaps older versions
of autoconf implicitly included more headers when checking for jpeglib.h?

I attach a patch (compiled successfully, not otherwise tested).

    smcv
>From 46a048cb38d79e21870366d8c54f5702a1a09c40 Mon Sep 17 00:00:00 2001
From: Simon McVittie <s...@debian.org>
Date: Wed, 27 Oct 2021 12:15:01 +0100
Subject: [PATCH] Add patch to fix detection of jpeglib.h

Closes: #994835
---
 ...-stdio.h-when-checking-for-jpeglib.h.patch | 25 +++++++++++++++++++
 debian/patches/series                         |  1 +
 2 files changed, 26 insertions(+)
 create mode 100644 debian/patches/build-Include-stdio.h-when-checking-for-jpeglib.h.patch

diff --git a/debian/patches/build-Include-stdio.h-when-checking-for-jpeglib.h.patch b/debian/patches/build-Include-stdio.h-when-checking-for-jpeglib.h.patch
new file mode 100644
index 0000000..3e0f21c
--- /dev/null
+++ b/debian/patches/build-Include-stdio.h-when-checking-for-jpeglib.h.patch
@@ -0,0 +1,25 @@
+From: Simon McVittie <s...@debian.org>
+Date: Wed, 27 Oct 2021 12:14:35 +0100
+Subject: build: Include stdio.h when checking for jpeglib.h
+
+jpeglib.h is documented to require prior inclusion of stdio.h:
+see <https://github.com/libjpeg-turbo/libjpeg-turbo/issues/17>.
+
+Bug-Debian: https://bugs.debian.org/994835
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 2d28464..a89f662 100755
+--- a/configure.ac
++++ b/configure.ac
+@@ -3141,7 +3141,7 @@ fi
+ dnl check for jpeg support
+ if test x"$with_jpeg" = "xyes" ; then
+   dnl Check for the JPEG library.
+-  AC_CHECK_HEADER(jpeglib.h,,)
++  AC_CHECK_HEADER([jpeglib.h], [], [], [#include <stdio.h>])
+ 
+   if test x"$ac_cv_header_jpeglib_h" = "xyes" ; then
+     AC_CHECK_LIB(jpeg, jpeg_CreateCompress, [
diff --git a/debian/patches/series b/debian/patches/series
index 73e5a50..efc30d8 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 exclude_linenoise-ng.patch
 revert_linenoise-ng.patch
+build-Include-stdio.h-when-checking-for-jpeglib.h.patch
-- 
2.33.1

Reply via email to