libpng checks using pkg-config :)

SVN revision: 23921
This commit is contained in:
Carsten Haitzler 2006-07-14 20:37:05 +00:00
parent 1ce85d7f7f
commit 1ddc6a0160
1 changed files with 22 additions and 24 deletions

View File

@ -646,11 +646,15 @@ AM_CONDITIONAL(BUILD_LOADER_GIF, test x$have_gif = xyes)
####################################### #######################################
## PNG ## PNG
have_png="no"; have_png="no";
AC_CHECK_HEADER(png.h,
[ have_png="yes" ],
[ have_png="no" ]
)
AC_MSG_CHECKING(whether to enable png image loader) AC_MSG_CHECKING(whether to enable png image loader)
if pkg-config --exists libpng12; then
have_png="yes";
elif pkg-config --exists libpng10; then
have_png="yes";
elif pkg-config --exists libpng; then
have_png="yes";
fi
AC_ARG_ENABLE(image-loader-png, AC_ARG_ENABLE(image-loader-png,
[ --enable-image-loader-png enable PNG image loader], [ [ --enable-image-loader-png enable PNG image loader], [
if test x"$enableval" = x"yes" ; then if test x"$enableval" = x"yes" ; then
@ -665,26 +669,20 @@ AC_ARG_ENABLE(image-loader-png,
] ]
) )
if test "x$have_png" = "xyes"; then if test "x$have_png" = "xyes"; then
AC_CHECK_HEADER(png.h, if pkg-config --exists libpng12; then
[ have_png="yes" ], png_cflags=`pkg-config --cflags libpng12`
[ have_png="no" ] png_libs=`pkg-config --libs libpng12`
) AC_MSG_CHECKING(libpng 1.2.x)
fi elif pkg-config --exists libpng10; then
# RHEL 3 has broken png libs. the default /usr/include/png*.h files are from png_cflags=`pkg-config --cflags libpng10`
# libpng 1.0 but the default libpng.so is from 1.2 - bad bad. need to try link png_libs=`pkg-config --libs libpng10`
# to libpng10 first. AC_MSG_CHECKING(libpng 1.0.x)
if test "x$have_png" = "xyes"; then elif pkg-config --exists libpng; then
AC_DEFINE(BUILD_LOADER_PNG, 1, [PNG Image Loader Support]) png_cflags=`pkg-config --cflags libpng`
png_cflags="" png_libs=`pkg-config --libs libpng`
AC_CHECK_LIB(png10, png_check_sig, [ AC_MSG_CHECKING(generic system libpng)
png_libs="-lpng10 -lz -lm" fi
], [ AC_MSG_RESULT($have_png)
AC_CHECK_LIB(png, png_check_sig, [
png_libs="-lpng -lz -lm"
], [
have_png="no"
], -lz -lm)
], -lz -lm)
fi fi
AM_CONDITIONAL(BUILD_LOADER_PNG, test x$have_png = xyes) AM_CONDITIONAL(BUILD_LOADER_PNG, test x$have_png = xyes)