diff options
author | Karl Berry <karl@freefriends.org> | 2016-03-28 17:02:56 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-03-28 17:02:56 +0000 |
commit | 5c68eb3b6da219ed651a20cd3b4439c051460429 (patch) | |
tree | eaf9f0033e98252cea58858192586c3ffeb68ab0 | |
parent | 093f60855e738f9e4b6f9a06e495c331ff9dc574 (diff) |
check for -std=c89 needed, from Mojca
git-svn-id: svn://tug.org/texlive/trunk@40161 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Build/source/libs/libpng/ChangeLog | 5 | ||||
-rwxr-xr-x | Build/source/libs/libpng/configure | 33 | ||||
-rw-r--r-- | Build/source/libs/libpng/configure.ac | 17 | ||||
-rw-r--r-- | Build/source/libs/libpng/libpng-PATCHES/ChangeLog | 7 | ||||
-rw-r--r-- | Build/source/libs/libpng/libpng-PATCHES/patch-02-backport-20160314-12e63e9 | 36 |
5 files changed, 97 insertions, 1 deletions
diff --git a/Build/source/libs/libpng/ChangeLog b/Build/source/libs/libpng/ChangeLog index 5c34fa6d895..84d1018da13 100644 --- a/Build/source/libs/libpng/ChangeLog +++ b/Build/source/libs/libpng/ChangeLog @@ -1,3 +1,7 @@ +2016-03-28 Karl Berry <karl@tug.org> + + * configure.ac: insert check for -std=c89 from Mojca. + 2016-02-15 Karl Berry <karl@tug.org> * libpng-PATCHES: rename from libpng-src-PATCHES. @@ -248,3 +252,4 @@ Adapt to TL2009 build system. +(This ChangeLog file is public domain.) diff --git a/Build/source/libs/libpng/configure b/Build/source/libs/libpng/configure index 58d5f32c791..820370835f3 100755 --- a/Build/source/libs/libpng/configure +++ b/Build/source/libs/libpng/configure @@ -4889,6 +4889,39 @@ esac ac_config_headers="$ac_config_headers config.h" +# 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we need to force back C standard to C89" >&5 +$as_echo_n "checking if we need to force back C standard to C89... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _POSIX_SOURCE 1 +#include <stdio.h> + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +else + +if test "x$GCC" != "xyes"; then + as_fn_error $? "Forcing back to C89 is required but the flags are unknown for other compilers than GCC" "$LINENO" 5 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +CFLAGS="$CFLAGS -std=c89" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + # Checks for header files. ac_ext=c ac_cpp='$CPP $CPPFLAGS' diff --git a/Build/source/libs/libpng/configure.ac b/Build/source/libs/libpng/configure.ac index dfefa551145..d5a03db7dcd 100644 --- a/Build/source/libs/libpng/configure.ac +++ b/Build/source/libs/libpng/configure.ac @@ -1,6 +1,7 @@ dnl Process this file with autoconf to produce a configure script. dnl -dnl Copyright (C) 2009-2014 Peter Breitenlohner <tex-live@tug.org> +dnl Copyright (C) 2016 Karl Berry <tex-live@tug.org> +dnl Copyright (C) 2009-2015 Peter Breitenlohner <tex-live@tug.org> dnl dnl This file is free software; the copyright holder dnl gives unlimited permission to copy and/or distribute it, @@ -23,6 +24,20 @@ KPSE_COMPILER_VISIBILITY AC_CONFIG_HEADERS([config.h]) +# 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 AC_CHECK_HEADERS([malloc.h stdlib.h string.h strings.h]) diff --git a/Build/source/libs/libpng/libpng-PATCHES/ChangeLog b/Build/source/libs/libpng/libpng-PATCHES/ChangeLog index 26311ea5079..e3a942b01f0 100644 --- a/Build/source/libs/libpng/libpng-PATCHES/ChangeLog +++ b/Build/source/libs/libpng/libpng-PATCHES/ChangeLog @@ -1,3 +1,9 @@ +2016-03-28 Mojca Miklavec <mojca.miklavec.lists@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@oneiros.de> * patch-01-static: Remove; has been integrated into libpng-1.2.39. @@ -12,3 +18,4 @@ * libpng-1.2.37/png.c (png_64bit_product): declare as static to avoid compiler warning. +(This ChangeLog is public domain.) diff --git a/Build/source/libs/libpng/libpng-PATCHES/patch-02-backport-20160314-12e63e9 b/Build/source/libs/libpng/libpng-PATCHES/patch-02-backport-20160314-12e63e9 new file mode 100644 index 00000000000..6941ae0019f --- /dev/null +++ b/Build/source/libs/libpng/libpng-PATCHES/patch-02-backport-20160314-12e63e9 @@ -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@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 + |