Skip to content

Commit

Permalink
backport fix for linking with libpng installed in a non-standard loca…
Browse files Browse the repository at this point in the history
…tion

(default 2.0 branch commit: 4088a517f9a5)
  • Loading branch information
sezero committed Oct 13, 2018
1 parent 4fb1b20 commit d9d6a7f
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 20 deletions.
48 changes: 36 additions & 12 deletions configure
Expand Up @@ -14084,7 +14084,10 @@ $as_echo "$ac_cv_header_png_h" >&6; }
fi
if test "x$ac_cv_header_png_h" = x""yes; then
have_png_hdr=yes
have_png_hdr=yes
LIBPNG_CFLAGS=""
fi
Expand Down Expand Up @@ -14154,7 +14157,10 @@ fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_png_png_create_read_struct" >&5
$as_echo "$ac_cv_lib_png_png_create_read_struct" >&6; }
if test "x$ac_cv_lib_png_png_create_read_struct" = x""yes; then
have_png_lib=yes
have_png_lib=yes
LIBPNG_LIBS="-lpng -lz"
fi
Expand Down Expand Up @@ -14287,7 +14293,10 @@ $as_echo "$ac_cv_header_png_h" >&6; }
fi
if test "x$ac_cv_header_png_h" = x""yes; then
have_png_hdr=yes
have_png_hdr=yes
LIBPNG_CFLAGS=""
fi
Expand Down Expand Up @@ -14357,7 +14366,10 @@ fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_png_png_create_read_struct" >&5
$as_echo "$ac_cv_lib_png_png_create_read_struct" >&6; }
if test "x$ac_cv_lib_png_png_create_read_struct" = x""yes; then
have_png_lib=yes
have_png_lib=yes
LIBPNG_LIBS="-lpng -lz"
fi
Expand All @@ -14367,7 +14379,6 @@ else
{ $as_echo "$as_me:$LINENO: result: yes" >&5
$as_echo "yes" >&6; }
have_png_hdr=yes
CFLAGS="$LIBPNG_CFLAGS $CFLAGS"
have_png_lib=yes
fi
Expand Down Expand Up @@ -14825,7 +14836,10 @@ $as_echo "$ac_cv_header_webp_decode_h" >&6; }
fi
if test "x$ac_cv_header_webp_decode_h" = x""yes; then
have_webp_hdr=yes
have_webp_hdr=yes
LIBWEBP_CFLAGS=""
fi
Expand Down Expand Up @@ -14895,7 +14909,10 @@ fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_webp_WebPGetDecoderVersion" >&5
$as_echo "$ac_cv_lib_webp_WebPGetDecoderVersion" >&6; }
if test "x$ac_cv_lib_webp_WebPGetDecoderVersion" = x""yes; then
have_webp_lib=yes
have_webp_lib=yes
LIBWEBP_LIBS="-lwebp"
fi
Expand Down Expand Up @@ -15028,7 +15045,10 @@ $as_echo "$ac_cv_header_webp_decode_h" >&6; }
fi
if test "x$ac_cv_header_webp_decode_h" = x""yes; then
have_webp_hdr=yes
have_webp_hdr=yes
LIBWEBP_CFLAGS=""
fi
Expand Down Expand Up @@ -15098,7 +15118,10 @@ fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_webp_WebPGetDecoderVersion" >&5
$as_echo "$ac_cv_lib_webp_WebPGetDecoderVersion" >&6; }
if test "x$ac_cv_lib_webp_WebPGetDecoderVersion" = x""yes; then
have_webp_lib=yes
have_webp_lib=yes
LIBWEBP_LIBS="-lwebp"
fi
Expand All @@ -15108,7 +15131,6 @@ else
{ $as_echo "$as_me:$LINENO: result: yes" >&5
$as_echo "yes" >&6; }
have_webp_hdr=yes
CFLAGS="$LIBWEBP_CFLAGS $CFLAGS"
have_webp_lib=yes
fi
Expand Down Expand Up @@ -15210,14 +15232,15 @@ _ACEOF
fi
if test x$enable_webp = xyes -a x$have_webp_hdr = xyes -a x$have_webp_lib = xyes; then
CFLAGS="$LIBWEBP_CFLAGS $CFLAGS"
if test x$enable_webp_shared = xyes && test x$webp_lib != x; then
echo "-- dynamic libwebp -> $webp_lib"
cat >>confdefs.h <<_ACEOF
#define LOAD_WEBP_DYNAMIC "$webp_lib"
_ACEOF
else
IMG_LIBS="-lwebp $IMG_LIBS"
IMG_LIBS="$LIBWEBP_LIBS $IMG_LIBS"
fi
fi
Expand Down Expand Up @@ -15248,14 +15271,15 @@ _ACEOF
fi
fi
if test x$enable_png = xyes -a x$have_png_hdr = xyes -a x$have_png_lib = xyes; then
CFLAGS="$LIBPNG_CFLAGS $CFLAGS"
if test x$enable_png_shared = xyes && test x$png_lib != x; then
echo "-- dynamic libpng -> $png_lib"
cat >>confdefs.h <<_ACEOF
#define LOAD_PNG_DYNAMIC "$png_lib"
_ACEOF
else
IMG_LIBS="-lpng -lz $IMG_LIBS"
IMG_LIBS="$LIBPNG_LIBS $IMG_LIBS"
fi
fi
Expand Down
28 changes: 20 additions & 8 deletions configure.in
Expand Up @@ -194,11 +194,16 @@ fi
if test "x$enable_png" = xyes; then
PKG_CHECK_MODULES([LIBPNG], [libpng], [dnl
have_png_hdr=yes
CFLAGS="$LIBPNG_CFLAGS $CFLAGS"
have_png_lib=yes
], [dnl
AC_CHECK_HEADER([png.h], [have_png_hdr=yes])
AC_CHECK_LIB([png], [png_create_read_struct], [have_png_lib=yes], [], [-lz])
AC_CHECK_HEADER([png.h], [
have_png_hdr=yes
LIBPNG_CFLAGS=""
])
AC_CHECK_LIB([png], [png_create_read_struct], [
have_png_lib=yes
LIBPNG_LIBS="-lpng -lz"
], [], [-lz])
])
if test x$have_png_hdr = xyes -a x$have_png_lib = xyes; then
AC_DEFINE([LOAD_PNG])
Expand Down Expand Up @@ -258,11 +263,16 @@ fi
if test x$enable_webp = xyes; then
PKG_CHECK_MODULES([LIBWEBP], [libwebp], [dnl
have_webp_hdr=yes
CFLAGS="$LIBWEBP_CFLAGS $CFLAGS"
have_webp_lib=yes
], [dnl
AC_CHECK_HEADER([webp/decode.h], [have_webp_hdr=yes])
AC_CHECK_LIB([webp], [WebPGetDecoderVersion], [have_webp_lib=yes], [], [-lm])
AC_CHECK_HEADER([webp/decode.h], [
have_webp_hdr=yes
LIBWEBP_CFLAGS=""
])
AC_CHECK_LIB([webp], [WebPGetDecoderVersion], [
have_webp_lib=yes
LIBWEBP_LIBS="-lwebp"
], [], [-lm])
])
if test x$have_webp_hdr = xyes -a x$have_webp_lib = xyes; then
AC_DEFINE([LOAD_WEBP])
Expand Down Expand Up @@ -330,11 +340,12 @@ if test x$enable_xv = xyes; then
fi

if test x$enable_webp = xyes -a x$have_webp_hdr = xyes -a x$have_webp_lib = xyes; then
CFLAGS="$LIBWEBP_CFLAGS $CFLAGS"
if test x$enable_webp_shared = xyes && test x$webp_lib != x; then
echo "-- dynamic libwebp -> $webp_lib"
AC_DEFINE_UNQUOTED(LOAD_WEBP_DYNAMIC, "$webp_lib")
else
IMG_LIBS="-lwebp $IMG_LIBS"
IMG_LIBS="$LIBWEBP_LIBS $IMG_LIBS"
fi
fi

Expand All @@ -359,11 +370,12 @@ if test x$enable_jpg = xyes -a x$have_jpg_hdr = xyes -a x$have_jpg_lib = xyes; t
fi
fi
if test x$enable_png = xyes -a x$have_png_hdr = xyes -a x$have_png_lib = xyes; then
CFLAGS="$LIBPNG_CFLAGS $CFLAGS"
if test x$enable_png_shared = xyes && test x$png_lib != x; then
echo "-- dynamic libpng -> $png_lib"
AC_DEFINE_UNQUOTED(LOAD_PNG_DYNAMIC, "$png_lib")
else
IMG_LIBS="-lpng -lz $IMG_LIBS"
IMG_LIBS="$LIBPNG_LIBS $IMG_LIBS"
fi
fi

Expand Down

0 comments on commit d9d6a7f

Please sign in to comment.