configure: Add a pkg-config check for libpng.

This commit is contained in:
Alexandre Julliard 2013-05-16 16:47:16 +02:00
parent 1527eeb720
commit b9921eb370
4 changed files with 56 additions and 169 deletions

4
aclocal.m4 vendored
View File

@ -75,13 +75,13 @@ AC_ARG_VAR([$1]_CFLAGS, [C compiler flags for $2, overriding pkg-config])dnl
AS_IF([test -n "$[$1]_CFLAGS"],[],
[test -n "$PKG_CONFIG"],
[[$1]_CFLAGS=`$PKG_CONFIG --cflags [$2] 2>/dev/null`])
m4_ifval([$4],[[$1]_CFLAGS=[$]{[$1]_CFLAGS:-`[$4] 2>/dev/null`}])
m4_ifval([$4],[[$1]_CFLAGS=[$]{[$1]_CFLAGS:-[$4]}])
CPPFLAGS="$CPPFLAGS $[$1]_CFLAGS"
AC_ARG_VAR([$1]_LIBS, [Linker flags for $2, overriding pkg-config])dnl
AS_IF([test -n "$[$1]_LIBS"],[],
[test -n "$PKG_CONFIG"],
[[$1]_LIBS=`$PKG_CONFIG --libs [$2] 2>/dev/null`])
m4_ifval([$5],[[$1]_LIBS=[$]{[$1]_LIBS:-`[$5] 2>/dev/null`}])
m4_ifval([$5],[[$1]_LIBS=[$]{[$1]_LIBS:-[$5]}])
m4_ifval([$3],[[$1]_LIBS=[$]{[$1]_LIBS:-"$3"}])])
dnl **** Link C code with an assembly file ****

173
configure vendored
View File

@ -641,7 +641,8 @@ EXTRACFLAGS
LIBKSTAT
LIBOPENAL
LIBMPG123
PNGINCL
PNG_LIBS
PNG_CFLAGS
FONTCONFIGINCL
CUPSINCL
OSS4INCL
@ -883,7 +884,9 @@ LCMS_LIBS
FREETYPE_CFLAGS
FREETYPE_LIBS
GSTREAMER_CFLAGS
GSTREAMER_LIBS'
GSTREAMER_LIBS
PNG_CFLAGS
PNG_LIBS'
# Initialize some variables set by options.
@ -1602,6 +1605,8 @@ Some influential environment variables:
C compiler flags for gstreamer-app-0.10, overriding pkg-config
GSTREAMER_LIBS
Linker flags for gstreamer-app-0.10, overriding pkg-config
PNG_CFLAGS C compiler flags for libpng, overriding pkg-config
PNG_LIBS Linker flags for libpng, overriding pkg-config
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
@ -2745,7 +2750,7 @@ fi
# Check whether --with-png was given.
if test "${with_png+set}" = set; then :
withval=$with_png; if test "x$withval" = "xno"; then ac_cv_header_png_h=no; fi
withval=$with_png;
fi
@ -5885,7 +5890,6 @@ for ac_header in \
netinet/in_systm.h \
netinet/tcp.h \
netinet/tcp_fsm.h \
png.h \
poll.h \
port.h \
process.h \
@ -11824,109 +11828,23 @@ This is an error since --with-jpeg was requested." "$LINENO" 5 ;;
esac
fi
if test "$ac_cv_header_png_h" = "yes"
if test "x$with_png" != "xno"
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -lpng" >&5
$as_echo_n "checking for -lpng... " >&6; }
if ${ac_cv_lib_soname_png+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_soname_save_LIBS=$LIBS
LIBS="-lpng -lm -lz $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
ac_save_CPPFLAGS="$CPPFLAGS"
if test -n "$PNG_CFLAGS"; then :
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char png_create_read_struct ();
int
main ()
{
return png_create_read_struct ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
case "$LIBEXT" in
dll) ac_cv_lib_soname_png=`$ac_cv_path_LDD conftest.exe | grep "png" | sed -e "s/dll.*/dll/"';2,$d'` ;;
dylib) ac_cv_lib_soname_png=`otool -L conftest$ac_exeext | grep "libpng[0-9]*\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libpng[0-9]*\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;;
*) ac_cv_lib_soname_png=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libpng[0-9]*\\.$LIBEXT" | sed -e "s/^.*\\[\\(libpng[0-9]*\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'`
if test "x$ac_cv_lib_soname_png" = x; then :
ac_cv_lib_soname_png=`$LDD conftest$ac_exeext | grep "libpng[0-9]*\\.$LIBEXT" | sed -e "s/^.*\(libpng[0-9]*\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'`
fi ;;
esac
elif test -n "$PKG_CONFIG"; then :
PNG_CFLAGS=`$PKG_CONFIG --cflags libpng 2>/dev/null`
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_soname_save_LIBS
PNG_CFLAGS=${PNG_CFLAGS:-$X_CFLAGS}
CPPFLAGS="$CPPFLAGS $PNG_CFLAGS"
if test -n "$PNG_LIBS"; then :
elif test -n "$PKG_CONFIG"; then :
PNG_LIBS=`$PKG_CONFIG --libs libpng 2>/dev/null`
fi
if test "x$ac_cv_lib_soname_png" = "x"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
$as_echo "not found" >&6; }
PNG_LIBS=${PNG_LIBS:-$X_LIBS}
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_png" >&5
$as_echo "$ac_cv_lib_soname_png" >&6; }
cat >>confdefs.h <<_ACEOF
#define SONAME_LIBPNG "$ac_cv_lib_soname_png"
_ACEOF
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for png_set_expand_gray_1_2_4_to_8 in -lpng" >&5
$as_echo_n "checking for png_set_expand_gray_1_2_4_to_8 in -lpng... " >&6; }
if ${ac_cv_lib_png_png_set_expand_gray_1_2_4_to_8+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lpng -lm -lz $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char png_set_expand_gray_1_2_4_to_8 ();
int
main ()
{
return png_set_expand_gray_1_2_4_to_8 ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_png_png_set_expand_gray_1_2_4_to_8=yes
else
ac_cv_lib_png_png_set_expand_gray_1_2_4_to_8=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_png_png_set_expand_gray_1_2_4_to_8" >&5
$as_echo "$ac_cv_lib_png_png_set_expand_gray_1_2_4_to_8" >&6; }
if test "x$ac_cv_lib_png_png_set_expand_gray_1_2_4_to_8" = xyes; then :
$as_echo "#define HAVE_PNG_SET_EXPAND_GRAY_1_2_4_TO_8 1" >>confdefs.h
fi
elif test -n "$X_CFLAGS" -a "x$with_png" != "xno"
then
ac_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
$as_unset ac_cv_header_png_h
for ac_header in png.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "png.h" "ac_cv_header_png_h" "$ac_includes_default"
@ -11939,18 +11857,15 @@ fi
done
CPPFLAGS="$ac_save_CPPFLAGS"
if test "$ac_cv_header_png_h" = "yes"
then
PNGINCL="$X_CFLAGS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -lpng" >&5
$as_echo_n "checking for -lpng... " >&6; }
if ${ac_cv_lib_soname_png+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_soname_save_LIBS=$LIBS
LIBS="-lpng $X_LIBS -lm -lz $LIBS"
LIBS="-lpng $PNG_LIBS -lm -lz $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@ -11986,7 +11901,7 @@ fi
if test "x$ac_cv_lib_soname_png" = "x"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
$as_echo "not found" >&6; }
PNG_CFLAGS=""
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_png" >&5
$as_echo "$ac_cv_lib_soname_png" >&6; }
@ -11995,50 +11910,28 @@ cat >>confdefs.h <<_ACEOF
#define SONAME_LIBPNG "$ac_cv_lib_soname_png"
_ACEOF
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for png_set_expand_gray_1_2_4_to_8 in -lpng" >&5
$as_echo_n "checking for png_set_expand_gray_1_2_4_to_8 in -lpng... " >&6; }
if ${ac_cv_lib_png_png_set_expand_gray_1_2_4_to_8+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lpng $X_LIBS -lm -lz $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char png_set_expand_gray_1_2_4_to_8 ();
#include <png.h>
int
main ()
{
return png_set_expand_gray_1_2_4_to_8 ();
typeof(png_set_expand_gray_1_2_4_to_8) *p
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_png_png_set_expand_gray_1_2_4_to_8=yes
else
ac_cv_lib_png_png_set_expand_gray_1_2_4_to_8=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_png_png_set_expand_gray_1_2_4_to_8" >&5
$as_echo "$ac_cv_lib_png_png_set_expand_gray_1_2_4_to_8" >&6; }
if test "x$ac_cv_lib_png_png_set_expand_gray_1_2_4_to_8" = xyes; then :
$as_echo "#define HAVE_PNG_SET_EXPAND_GRAY_1_2_4_TO_8 1" >>confdefs.h
if ac_fn_c_try_compile "$LINENO"; then :
$as_echo "#define HAVE_PNG_SET_EXPAND_GRAY_1_2_4_TO_8 1" >>confdefs.h
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
else
PNG_CFLAGS=""
fi
CPPFLAGS="$ac_save_CPPFLAGS"
fi
if test "x$ac_cv_lib_soname_png" = "x"; then :
case "x$with_png" in

View File

@ -67,8 +67,7 @@ AC_ARG_WITH(opencl, AS_HELP_STRING([--without-opencl],[do not use OpenCL]),
AC_ARG_WITH(opengl, AS_HELP_STRING([--without-opengl],[do not use OpenGL]))
AC_ARG_WITH(osmesa, AS_HELP_STRING([--without-osmesa],[do not use the OSMesa library]))
AC_ARG_WITH(oss, AS_HELP_STRING([--without-oss],[do not use the OSS sound support]))
AC_ARG_WITH(png, AS_HELP_STRING([--without-png],[do not use PNG]),
[if test "x$withval" = "xno"; then ac_cv_header_png_h=no; fi])
AC_ARG_WITH(png, AS_HELP_STRING([--without-png],[do not use PNG]))
AC_ARG_WITH(pthread, AS_HELP_STRING([--without-pthread],[do not use the pthread library]),
[if test "x$withval" = "xno"; then ac_cv_header_pthread_h=no; fi])
AC_ARG_WITH(sane, AS_HELP_STRING([--without-sane],[do not use SANE (scanner support)]))
@ -463,7 +462,6 @@ AC_CHECK_HEADERS(\
netinet/in_systm.h \
netinet/tcp.h \
netinet/tcp_fsm.h \
png.h \
poll.h \
port.h \
process.h \
@ -1263,7 +1261,8 @@ dnl **** Check for libxml2 ****
if test "x$with_xml" != "xno"
then
ac_save_CPPFLAGS="$CPPFLAGS"
WINE_PACKAGE_FLAGS(XML2,[libxml-2.0],[-lxml2],[xml2-config --cflags],[xml2-config --libs])
WINE_PACKAGE_FLAGS(XML2,[libxml-2.0],[-lxml2],
[`xml2-config --cflags 2>/dev/null`],[`xml2-config --libs 2>/dev/null`])
AC_CHECK_HEADERS([libxml/parser.h libxml/xmlsave.h libxml/SAX2.h])
if test "$ac_cv_header_libxml_parser_h" = "yes" -a "$ac_cv_header_libxml_xmlsave_h" = "yes" -a "$ac_cv_header_libxml_SAX2_h" = "yes"
then
@ -1293,7 +1292,8 @@ WINE_WARNING_WITH(xml,[test "$ac_cv_lib_xml2_xmlParseMemory" != "yes"],
if test "x$with_xslt" != "xno"
then
ac_save_CPPFLAGS="$CPPFLAGS"
WINE_PACKAGE_FLAGS(XSLT,[libxslt],[-lxml2],[xslt-config --cflags],[xslt-config --libs])
WINE_PACKAGE_FLAGS(XSLT,[libxslt],[-lxml2],
[`xslt-config --cflags 2>/dev/null`],[`xslt-config --libs 2>/dev/null`])
AC_CHECK_HEADERS([libxslt/pattern.h libxslt/transform.h],,,
[#ifdef HAVE_LIBXSLT_PATTERN_H
# include <libxslt/pattern.h>
@ -1371,7 +1371,7 @@ dnl **** Check for SANE ****
if test "x$with_sane" != "xno"
then
ac_save_CPPFLAGS="$CPPFLAGS"
WINE_PACKAGE_FLAGS(SANE,[libsane],,[sane-config --cflags],[sane-config --ldflags])
WINE_PACKAGE_FLAGS(SANE,[libsane],,[`sane-config --cflags 2>/dev/null`],[`sane-config --ldflags 2>/dev/null`])
AC_CHECK_HEADER(sane/sane.h,
[WINE_CHECK_SONAME(sane,sane_init,,[SANE_CFLAGS=""],[$SANE_LIBS])],
[SANE_CFLAGS=""])
@ -1393,7 +1393,7 @@ if test "x$with_gphoto" != "xno"
then
ac_save_CPPFLAGS="$CPPFLAGS"
WINE_PACKAGE_FLAGS(GPHOTO2,[libgphoto2],[-lgphoto2],
[gphoto2-config --cflags], [gphoto2-config --libs])
[`gphoto2-config --cflags 2>/dev/null`],[`gphoto2-config --libs 2>/dev/null`])
AC_CHECK_HEADER(gphoto2-camera.h,
[AC_CHECK_LIB(gphoto2,gp_camera_new,
[AC_DEFINE(HAVE_GPHOTO2, 1, [Define if we have the libgphoto2 development environment])],
@ -1401,8 +1401,8 @@ then
[$GPHOTO2_LIBS])],
[GPHOTO2_LIBS=""; GPHOTO2_CFLAGS=""])
WINE_PACKAGE_FLAGS(GPHOTO2_PORT,[libgphoto2_port],[-lgphoto2_port],
[gphoto2-port-config --cflags],
[gphoto2-port-config --libs])
[`gphoto2-port-config --cflags 2>/dev/null`],
[`gphoto2-port-config --libs 2>/dev/null`])
AC_CHECK_HEADER(gphoto2-port.h,
[AC_CHECK_LIB(gphoto2_port,gp_port_info_list_new,
[AC_DEFINE(HAVE_GPHOTO2_PORT, 1, [Define if we have the libgphoto2_port development environment])],
@ -1461,8 +1461,8 @@ if test "x$with_freetype" != "xno"
then
ac_save_CPPFLAGS="$CPPFLAGS"
WINE_PACKAGE_FLAGS(FREETYPE,[freetype2],[-lfreetype],
[(freetype-config --cflags || freetype2-config --cflags)],
[(freetype-config --libs || freetype2-config --libs)])
[`(freetype-config --cflags || freetype2-config --cflags) 2>/dev/null`],
[`(freetype-config --libs || freetype2-config --libs) 2>/dev/null`])
WINE_CHECK_SONAME(freetype,FT_Init_FreeType,[ft_lib=yes],[ft_lib=no],[$FREETYPE_LIBS])
if test "$ft_lib" = "yes"
then
@ -1671,27 +1671,21 @@ WINE_WARNING_WITH(jpeg,[test "x$ac_cv_lib_soname_jpeg" = "x"],
[libjpeg ${notice_platform}development files not found, JPEG won't be supported.])
dnl **** Check for libpng ****
if test "$ac_cv_header_png_h" = "yes"
if test "x$with_png" != "xno"
then
WINE_CHECK_SONAME(png,png_create_read_struct,,,-lm -lz,[[libpng[[0-9]]*]])
AC_CHECK_LIB(png,png_set_expand_gray_1_2_4_to_8,
[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.])]
,,-lm -lz)
elif test -n "$X_CFLAGS" -a "x$with_png" != "xno"
then
dnl libpng is in the X directory on Mac OS X
ac_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
$as_unset ac_cv_header_png_h
WINE_PACKAGE_FLAGS(PNG,[libpng],,[$X_CFLAGS],[$X_LIBS])
AC_CHECK_HEADERS([png.h])
CPPFLAGS="$ac_save_CPPFLAGS"
if test "$ac_cv_header_png_h" = "yes"
then
AC_SUBST(PNGINCL,"$X_CFLAGS")
WINE_CHECK_SONAME(png,png_create_read_struct,,,[$X_LIBS -lm -lz],[[libpng[[0-9]]*]])
AC_CHECK_LIB(png,png_set_expand_gray_1_2_4_to_8,
[AC_DEFINE(HAVE_PNG_SET_EXPAND_GRAY_1_2_4_TO_8,1)],,[$X_LIBS -lm -lz])
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_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
PNG_CFLAGS=""
fi
CPPFLAGS="$ac_save_CPPFLAGS"
fi
WINE_WARNING_WITH(png,[test "x$ac_cv_lib_soname_png" = "x"],
[libpng ${notice_platform}development files not found, PNG won't be supported.])

View File

@ -1,7 +1,7 @@
MODULE = windowscodecs.dll
IMPORTLIB = windowscodecs
IMPORTS = uuid ole32 oleaut32 rpcrt4 shlwapi user32 gdi32 advapi32
EXTRAINCL = @PNGINCL@
EXTRAINCL = @PNG_CFLAGS@
EXTRADEFS = -DENTRY_PREFIX=WIC_ -DPROXY_DELEGATION -DWINE_REGISTER_DLL
EXTRALIBS = @APPLICATIONSERVICESLIB@