configure.ac: Fix breakage caused by -Werror=unused-variable

Daniel Santos daniel.santos at pobox.com
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
https://www.winehq.org/pipermail/wine-devel/2010-February/081526.html
---
 configure    | 2 +-
 configure.ac | 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
 int
 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/configure.ac b/configure.ac
index aec53f6..1173190 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1690,7 +1690,7 @@ then
         if test "$ac_cv_header_png_h" = "yes"
         then
             WINE_CHECK_SONAME(png,png_create_read_struct,
-                [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]]*]])
         else
-- 
2.4.6




More information about the wine-patches mailing list