test for system libz and libpng versions and not just for their existence (backported from the trunk)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@18358 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
80
configure.in
80
configure.in
@@ -1697,13 +1697,49 @@ if test "$wxUSE_ZLIB" != "no" ; then
|
||||
AC_DEFINE(wxUSE_ZLIB)
|
||||
|
||||
if test "$wxUSE_ZLIB" = "sys" -o "$wxUSE_ZLIB" = "yes" ; then
|
||||
AC_CHECK_HEADER(zlib.h, AC_CHECK_LIB(z, deflate, ZLIB_LINK=" -lz"))
|
||||
dnl we have troubles with ancient zlib versions (e.g. 1.0.4 is known
|
||||
dnl to not work) and although I don't know which is the minimal
|
||||
dnl required version it's safer to test for 1.1.4 as it fixes a
|
||||
dnl security problem in 1.1.3 -- and hopefully nobody has anything
|
||||
dnl more ancient (1.1.3 was released in July 1998) anyow
|
||||
AC_CACHE_CHECK([for zlib.h >= 1.1.4], ac_cv_header_zlib_h,
|
||||
AC_TRY_RUN(
|
||||
[
|
||||
dnl zlib.h defines ZLIB_VERSION="x.y.z"
|
||||
#include <zlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
dnl don't use the brackets as quotes, we need them
|
||||
changequote(,)
|
||||
int main()
|
||||
{
|
||||
FILE *f=fopen("conftestval", "w");
|
||||
if (!f) exit(1);
|
||||
fprintf(f, "%s",
|
||||
ZLIB_VERSION[0] == '1' &&
|
||||
(ZLIB_VERSION[2] > '1' ||
|
||||
(ZLIB_VERSION[2] == '1' &&
|
||||
ZLIB_VERSION[4] >= '4')) ? "yes" : "no");
|
||||
exit(0);
|
||||
}
|
||||
changequote([,])
|
||||
],
|
||||
ac_cv_header_zlib_h=`cat conftestval`,
|
||||
ac_cv_header_zlib_h=no,
|
||||
dnl cross-compiling: test if we have any zlib.h
|
||||
AC_CHECK_HEADER(zlib.h)
|
||||
)
|
||||
)
|
||||
|
||||
if test "$ac_cv_header_zlib_h" = "yes"; then
|
||||
AC_CHECK_LIB(z, deflate, ZLIB_LINK=" -lz")
|
||||
fi
|
||||
|
||||
if test "x$ZLIB_LINK" = "x" ; then
|
||||
if test "$wxUSE_ZLIB" = "sys" ; then
|
||||
AC_MSG_ERROR([system zlib compression library not found! Use --with-zlib=builtin to use built-in version])
|
||||
AC_MSG_ERROR([zlib library not found or too old! Use --with-zlib=builtin to use built-in version])
|
||||
else
|
||||
AC_MSG_WARN([system zlib compression library not found, will use built-in instead])
|
||||
AC_MSG_WARN([zlib library not found or too old, will use built-in instead])
|
||||
wxUSE_ZLIB=builtin
|
||||
fi
|
||||
else
|
||||
@@ -1742,18 +1778,40 @@ if test "$wxUSE_LIBPNG" != "no" ; then
|
||||
if test "$wxUSE_MGL" != 1 ; then
|
||||
dnl Don't check for libpng when building wxMGL, libmgl contains it
|
||||
if test "$wxUSE_LIBPNG" = "sys" -o "$wxUSE_LIBPNG" = "yes" ; then
|
||||
AC_CHECK_HEADER(png.h,
|
||||
AC_CHECK_LIB(png, png_check_sig,
|
||||
PNG_LINK=" -lpng",
|
||||
,
|
||||
[-lz -lm])
|
||||
)
|
||||
dnl libpng version 0.9 is known to not work, if an even newer
|
||||
dnl version is required, just bump it up in the test below
|
||||
AC_CACHE_CHECK([for png.h > 0.90], ac_cv_header_png_h,
|
||||
AC_TRY_RUN(
|
||||
[
|
||||
dnl png.h defines PNG_LIBPNG_VER=number
|
||||
#include <png.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
FILE *f=fopen("conftestval", "w");
|
||||
if (!f) exit(1);
|
||||
fprintf(f, "%s",
|
||||
PNG_LIBPNG_VER > 90 ? "yes" : "no");
|
||||
exit(0);
|
||||
}
|
||||
],
|
||||
ac_cv_header_png_h=`cat conftestval`,
|
||||
ac_cv_header_png_h=no,
|
||||
dnl cross-compiling: test if we have any png.h
|
||||
AC_CHECK_HEADER(png.h)
|
||||
)
|
||||
)
|
||||
|
||||
if test "$ac_cv_header_png_h" = "yes"; then
|
||||
AC_CHECK_LIB(png, png_check_sig, PNG_LINK=" -lpng", , [-lz -lm])
|
||||
fi
|
||||
|
||||
if test "x$PNG_LINK" = "x" ; then
|
||||
if test "$wxUSE_LIBPNG" = "sys" ; then
|
||||
AC_MSG_ERROR([system png library not found! Use --with-libpng=builtin to use built-in version])
|
||||
AC_MSG_ERROR([system png library not found or too old! Use --with-libpng=builtin to use built-in version])
|
||||
else
|
||||
AC_MSG_WARN([system png library not found, will use built-in instead])
|
||||
AC_MSG_WARN([system png library not found or too old, will use built-in instead])
|
||||
wxUSE_LIBPNG=builtin
|
||||
fi
|
||||
else
|
||||
|
Reference in New Issue
Block a user