sync with experimental
[luatex.git] / source / libs / libpng / libpng-PATCHES / patch-02-backport-20160314-12e63e9
blob6941ae0019f85b9eb0c455fa5f837bda5242ed80
1 https://github.com/glennrp/libpng/commit/12e63e91af1378225993b36e25ce3252b54e751a.patch
3 From 12e63e91af1378225993b36e25ce3252b54e751a Mon Sep 17 00:00:00 2001
4 From: Dagobert Michelsen <dam@opencsw.org>
5 Date: Mon, 14 Mar 2016 16:21:06 +0100
6 Subject: [PATCH] Force back to C89 if needed. This fixes #245
8 ---
9  configure.ac | 14 ++++++++++++++
10  1 file changed, 14 insertions(+)
12 diff --git a/configure.ac b/configure.ac
13 index 3b8746a..ee3ea05 100644
14 --- a/configure.ac
15 +++ b/configure.ac
16 @@ -114,6 +114,20 @@ AC_ARG_ENABLE(werror,
17        CFLAGS="$sav_CFLAGS"
18      fi],)
20 +# For GCC 5 the default mode for C is -std=gnu11 instead of -std=gnu89
21 +# In pngpriv.h we request just the POSIX 1003.1 and C89 APIs by defining _POSIX_SOURCE to 1
22 +# This is incompatible with the new default mode, so we test for that and force the 
23 +AC_MSG_CHECKING([if we need to force back C standard to C89])
24 +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#define _POSIX_SOURCE 1
25 +#include <stdio.h>
26 +])],AC_MSG_RESULT(no),[
27 +if test "x$GCC" != "xyes"; then
28 +  AC_MSG_ERROR([Forcing back to C89 is required but the flags are unknown for other compilers than GCC])
29 +fi
30 +AC_MSG_RESULT(yes)
31 +CFLAGS="$CFLAGS -std=c89"
32 +])
34  # Checks for header files.
35  AC_HEADER_STDC