[tlbuild] Bug in libpng affecting Solaris 10

Mojca Miklavec mojca.miklavec.lists at gmail.com
Wed Mar 23 09:48:10 CET 2016


On 15 March 2016 at 22:08, Karl Berry wrote:
>     Would it be possible to include it into TL sources to avoid having to
>     set additional flags when building on Solaris?
>
> This is software, anything's possible.  Before I merge it, though, do
> you know if another libpng release is planned for the near-ish future?
> Thanks, K.

They released 1.6.22beta03 two weeks ago. In the 1.6.21 series it took
them about a month to go from beta01 to the final release (which of
course doesn't mean that one should naively extrapolate).

I'm attaching a patch for TL (it applies with an offset of 7 lines),
but I don't know how to properly regenerate the configure files
(running autoreconf didn't change anything).

Mojca
-------------- next part --------------
Index: libs/libpng/libpng-PATCHES/ChangeLog
===================================================================
--- libs/libpng/libpng-PATCHES/ChangeLog	(revision 40105)
+++ libs/libpng/libpng-PATCHES/ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+2016-03-23  Mojca Miklavec <mojca.miklavec.lists at gmail.com>
+
+	Create patch-02-backport-20160314-12e63e9:
+	* libpng-src/configure.ac: Force back to C89 if needed
+	(needed on Solaris with GCC 5 and later)
+
 2009-08-13  Martin Schröder <martin at oneiros.de>
 
 	* patch-01-static: Remove; has been integrated into libpng-1.2.39.
Index: libs/libpng/libpng-PATCHES/patch-02-backport-20160314-12e63e9
===================================================================
--- libs/libpng/libpng-PATCHES/patch-02-backport-20160314-12e63e9	(nonexistent)
+++ libs/libpng/libpng-PATCHES/patch-02-backport-20160314-12e63e9	(working copy)
@@ -0,0 +1,36 @@
+https://github.com/glennrp/libpng/commit/12e63e91af1378225993b36e25ce3252b54e751a.patch
+
+From 12e63e91af1378225993b36e25ce3252b54e751a Mon Sep 17 00:00:00 2001
+From: Dagobert Michelsen <dam at opencsw.org>
+Date: Mon, 14 Mar 2016 16:21:06 +0100
+Subject: [PATCH] Force back to C89 if needed. This fixes #245
+
+---
+ configure.ac | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index 3b8746a..ee3ea05 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -114,6 +114,20 @@ AC_ARG_ENABLE(werror,
+       CFLAGS="$sav_CFLAGS"
+     fi],)
+ 
++# For GCC 5 the default mode for C is -std=gnu11 instead of -std=gnu89
++# In pngpriv.h we request just the POSIX 1003.1 and C89 APIs by defining _POSIX_SOURCE to 1
++# This is incompatible with the new default mode, so we test for that and force the 
++AC_MSG_CHECKING([if we need to force back C standard to C89])
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#define _POSIX_SOURCE 1
++#include <stdio.h>
++])],AC_MSG_RESULT(no),[
++if test "x$GCC" != "xyes"; then
++  AC_MSG_ERROR([Forcing back to C89 is required but the flags are unknown for other compilers than GCC])
++fi
++AC_MSG_RESULT(yes)
++CFLAGS="$CFLAGS -std=c89"
++])
++
+ # Checks for header files.
+ AC_HEADER_STDC
+ 
Index: libs/libpng/libpng-src/configure.ac
===================================================================
--- libs/libpng/libpng-src/configure.ac	(revision 40105)
+++ libs/libpng/libpng-src/configure.ac	(working copy)
@@ -107,6 +107,20 @@
       CFLAGS="$sav_CFLAGS"
     fi],)
 
+# For GCC 5 the default mode for C is -std=gnu11 instead of -std=gnu89
+# In pngpriv.h we request just the POSIX 1003.1 and C89 APIs by defining _POSIX_SOURCE to 1
+# This is incompatible with the new default mode, so we test for that and force the 
+AC_MSG_CHECKING([if we need to force back C standard to C89])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#define _POSIX_SOURCE 1
+#include <stdio.h>
+])],AC_MSG_RESULT(no),[
+if test "x$GCC" != "xyes"; then
+  AC_MSG_ERROR([Forcing back to C89 is required but the flags are unknown for other compilers than GCC])
+fi
+AC_MSG_RESULT(yes)
+CFLAGS="$CFLAGS -std=c89"
+])
+
 # Checks for header files.
 AC_HEADER_STDC
 


More information about the tlbuild mailing list