Skip to content

Commit

Permalink
Fixed linking with libpng installed in a non-standard location
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Feb 15, 2016
1 parent 156d34d commit 78606e0
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 @@ -12795,7 +12795,10 @@ fi
$as_echo "no" >&6; }
ac_fn_c_check_header_mongrel "$LINENO" "png.h" "ac_cv_header_png_h" "$ac_includes_default"
if test "x$ac_cv_header_png_h" = xyes; then :
have_png_hdr=yes

have_png_hdr=yes
LIBPNG_CFLAGS=""

fi


Expand Down Expand Up @@ -12836,14 +12839,20 @@ fi
{ $as_echo "$as_me:${as_lineno-$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" = xyes; then :
have_png_lib=yes

have_png_lib=yes
LIBPNG_LIBS="-lpng -lz"

fi


elif test $pkg_failed = untried; then
ac_fn_c_check_header_mongrel "$LINENO" "png.h" "ac_cv_header_png_h" "$ac_includes_default"
if test "x$ac_cv_header_png_h" = xyes; then :
have_png_hdr=yes

have_png_hdr=yes
LIBPNG_CFLAGS=""

fi


Expand Down Expand Up @@ -12884,7 +12893,10 @@ fi
{ $as_echo "$as_me:${as_lineno-$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" = xyes; then :
have_png_lib=yes

have_png_lib=yes
LIBPNG_LIBS="-lpng -lz"

fi


Expand All @@ -12894,7 +12906,6 @@ else
{ $as_echo "$as_me:${as_lineno-$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 @@ -13061,7 +13072,10 @@ fi
$as_echo "no" >&6; }
ac_fn_c_check_header_mongrel "$LINENO" "webp/decode.h" "ac_cv_header_webp_decode_h" "$ac_includes_default"
if test "x$ac_cv_header_webp_decode_h" = xyes; then :
have_webp_hdr=yes

have_webp_hdr=yes
LIBWEBP_CFLAGS=""

fi


Expand Down Expand Up @@ -13102,14 +13116,20 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_webp_WebPGetDecoderVersion" >&5
$as_echo "$ac_cv_lib_webp_WebPGetDecoderVersion" >&6; }
if test "x$ac_cv_lib_webp_WebPGetDecoderVersion" = xyes; then :
have_webp_lib=yes

have_webp_lib=yes
LIBWEBP_LIBS="-lwebp"

fi


elif test $pkg_failed = untried; then
ac_fn_c_check_header_mongrel "$LINENO" "webp/decode.h" "ac_cv_header_webp_decode_h" "$ac_includes_default"
if test "x$ac_cv_header_webp_decode_h" = xyes; then :
have_webp_hdr=yes

have_webp_hdr=yes
LIBWEBP_CFLAGS=""

fi


Expand Down Expand Up @@ -13150,7 +13170,10 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_webp_WebPGetDecoderVersion" >&5
$as_echo "$ac_cv_lib_webp_WebPGetDecoderVersion" >&6; }
if test "x$ac_cv_lib_webp_WebPGetDecoderVersion" = xyes; then :
have_webp_lib=yes

have_webp_lib=yes
LIBWEBP_LIBS="-lwebp"

fi


Expand All @@ -13160,7 +13183,6 @@ else
{ $as_echo "$as_me:${as_lineno-$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 @@ -13236,14 +13258,15 @@ 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"
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 @@ -13274,14 +13297,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 @@ -195,11 +195,16 @@ fi
if test x$enable_png = xyes -a x$enable_imageio != 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 @@ -253,11 +258,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 @@ -319,11 +329,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 @@ -348,11 +359,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 78606e0

Please sign in to comment.