Fix breakage caused by -Werror=unused-variable

Daniel Santos daniel.santos at
Sun Sep 6 03:52:35 CDT 2015

When configuring with CFLAGS="-Wunused-variable -Werror", the configure
test for HAVE_PNG_SET_EXPAND_GRAY_1_2_4_TO_8 fails with unused variable.
In turn, this results in the build failing with something like:

pngformat.c:62: error: ‘png_set_gray_1_2_4_to_8’ undeclared here (not in a function)
pngformat.c:62: warning: type defaults to ‘int’ in declaration of ‘ppng_set_gray_1_2_4_to_8’
pngformat.c: In function ‘PngDecoder_Initialize’:
pngformat.c:285: error: called object ‘ppng_set_gray_1_2_4_to_8’ is not a function

This small change prevents the test from failing due to
-Werror=unused-variable, but the build is still broken for cases where
png_set_gray_1_2_4_to_8 isn't present.

See also
 configure    | 2 +- | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 15a122b..20371dc 100755
--- a/configure
+++ b/configure
@@ -13327,7 +13327,7 @@ _ACEOF
 main ()
-typeof(png_set_expand_gray_1_2_4_to_8) *p
+typeof(png_set_expand_gray_1_2_4_to_8) *p=NULL;return (long)p;
   return 0;
diff --git a/ b/
index aec53f6..1173190 100644
--- a/
+++ b/
@@ -1690,7 +1690,7 @@ then
         if test "$ac_cv_header_png_h" = "yes"
-                [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <png.h>]],[[typeof(png_set_expand_gray_1_2_4_to_8) *p]])],
+                [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <png.h>]],[[typeof(png_set_expand_gray_1_2_4_to_8) *p=NULL;return (long)p;]])],
                     [AC_DEFINE(HAVE_PNG_SET_EXPAND_GRAY_1_2_4_TO_8,1,[Define to 1 if libpng has the png_set_expand_gray_1_2_4_to_8 function.])])],
                 [PNG_CFLAGS=""],[$PNG_LIBS -lm -lz],[[libpng[[0-9]]*]])

More information about the wine-patches mailing list