add FIND_LIBWEBP
some platforms are missing a .pc file for libwebp ... add a FIND_LIBWEBP macro as a fallback see https://github.com/jcupitt/libvips/issues/440
This commit is contained in:
parent
d568c204a2
commit
d307e38863
120
acinclude.m4
120
acinclude.m4
@ -684,3 +684,123 @@ fi
|
||||
|
||||
])dnl
|
||||
|
||||
|
||||
dnl From FIND_MOTIF and ACX_PTHREAD, without much understanding
|
||||
dnl
|
||||
dnl FIND_LIBWEBP[ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]
|
||||
dnl ---------------------------------------------------
|
||||
dnl
|
||||
dnl Find webp libraries and headers ... useful for platforms which are missing
|
||||
dnl the webp .pc file
|
||||
dnl
|
||||
dnl Put compile stuff in LIBWEBP_INCLUDES
|
||||
dnl Put link stuff in LIBWEBP_LIBS
|
||||
dnl Define HAVE_LIBWEBP if found.
|
||||
dnl
|
||||
AC_DEFUN([FIND_LIBWEBP], [
|
||||
AC_REQUIRE([AC_PATH_XTRA])
|
||||
|
||||
LIBWEBP_INCLUDES=""
|
||||
LIBWEBP_LIBS=""
|
||||
|
||||
AC_ARG_WITH(libwebp,
|
||||
AS_HELP_STRING([--without-libwebp], [build without libwebp (default: test)]))
|
||||
# Treat --without-libwebp like --without-libwebp-includes --without-libwebp-libraries.
|
||||
if test "$with_libwebp" = "no"; then
|
||||
LIBWEBP_INCLUDES=no
|
||||
LIBWEBP_LIBS=no
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(libwebp-includes,
|
||||
AS_HELP_STRING([--with-libwebp-includes=DIR], [libwebp includes are in DIR]),
|
||||
LIBWEBP_INCLUDES="-I$withval")
|
||||
AC_ARG_WITH(libwebp-libraries,
|
||||
AS_HELP_STRING([--with-libwebp-libraries=DIR], [libwebp libraries are in DIR]),
|
||||
LIBWEBP_LIBS="-L$withval -lwebp")
|
||||
|
||||
AC_MSG_CHECKING(for libwebp)
|
||||
|
||||
# Look for webp/decode.h
|
||||
if test "$LIBWEBP_INCLUDES" = ""; then
|
||||
# Check the standard search path
|
||||
AC_TRY_COMPILE([#include <webp/decode.h>],[int a;],[
|
||||
LIBWEBP_INCLUDES=""
|
||||
], [
|
||||
# webp/decode.h is not in the standard search path, try
|
||||
# $prefix
|
||||
libwebp_save_INCLUDES="$INCLUDES"
|
||||
|
||||
INCLUDES="-I${prefix}/include $INCLUDES"
|
||||
|
||||
AC_TRY_COMPILE([#include <webp/decode.h>],[int a;],[
|
||||
LIBWEBP_INCLUDES="-I${prefix}/include"
|
||||
], [
|
||||
LIBWEBP_INCLUDES="no"
|
||||
])
|
||||
|
||||
INCLUDES=$libwebp_save_INCLUDES
|
||||
])
|
||||
fi
|
||||
|
||||
# Now for the libraries
|
||||
if test "$LIBWEBP_LIBS" = ""; then
|
||||
libwebp_save_LIBS="$LIBS"
|
||||
libwebp_save_INCLUDES="$INCLUDES"
|
||||
|
||||
LIBS="-lwebp $LIBS"
|
||||
INCLUDES="$LIBWEBP_INCLUDES $INCLUDES"
|
||||
|
||||
# Try the standard search path first
|
||||
AC_TRY_LINK([#include <webp/decode.h>],[WebPInitDecoderConfig(0)], [
|
||||
LIBWEBP_LIBS="-lwebp"
|
||||
], [
|
||||
# libwebp is not in the standard search path, try $prefix
|
||||
|
||||
LIBS="-L${prefix}/lib $LIBS"
|
||||
|
||||
AC_TRY_LINK([#include <webp/decode.h>],[WebPInitDecoderConfig(0)], [
|
||||
LIBWEBP_LIBS="-L${prefix}/lib -lwebp"
|
||||
], [
|
||||
LIBWEBP_LIBS=no
|
||||
])
|
||||
])
|
||||
|
||||
LIBS="$libwebp_save_LIBS"
|
||||
INCLUDES="$libwebp_save_INCLUDES"
|
||||
fi
|
||||
|
||||
AC_SUBST(LIBWEBP_LIBS)
|
||||
AC_SUBST(LIBWEBP_INCLUDES)
|
||||
|
||||
# Print a helpful message
|
||||
libwebp_libraries_result="$LIBWEBP_LIBS"
|
||||
libwebp_includes_result="$LIBWEBP_INCLUDES"
|
||||
|
||||
if test x"$libwebp_libraries_result" = x""; then
|
||||
libwebp_libraries_result="in default path"
|
||||
fi
|
||||
if test x"$libwebp_includes_result" = x""; then
|
||||
libwebp_includes_result="in default path"
|
||||
fi
|
||||
|
||||
if test "$libwebp_libraries_result" = "no"; then
|
||||
libwebp_libraries_result="(none)"
|
||||
fi
|
||||
if test "$libwebp_includes_result" = "no"; then
|
||||
libwebp_includes_result="(none)"
|
||||
fi
|
||||
|
||||
AC_MSG_RESULT([libraries $libwebp_libraries_result, headers $libwebp_includes_result])
|
||||
|
||||
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
|
||||
if test "$LIBWEBP_INCLUDES" != "no" && test "$LIBWEBP_LIBS" != "no"; then
|
||||
AC_DEFINE(HAVE_LIBWEBP,1,[Define if you have libwebp libraries and header files.])
|
||||
$1
|
||||
else
|
||||
LIBWEBP_INCLUDES=""
|
||||
LIBWEBP_LIBS=""
|
||||
$2
|
||||
fi
|
||||
|
||||
])dnl
|
||||
|
||||
|
@ -673,6 +673,8 @@ if test x"$with_cfitsio" != "xno"; then
|
||||
fi
|
||||
|
||||
# libwebp
|
||||
# some platforms, like ubuntu 12.04, are missing the .pc files for libwebp, so
|
||||
# we fall back to FIND_LIBWEBP
|
||||
AC_ARG_WITH([libwebp],
|
||||
AS_HELP_STRING([--without-libwebp], [build without libwebp (default: test)]))
|
||||
|
||||
@ -681,9 +683,14 @@ if test x"$with_libwebp" != "xno"; then
|
||||
[AC_DEFINE(HAVE_LIBWEBP,1,[define if you have libwebp installed.])
|
||||
with_libwebp=yes
|
||||
PACKAGES_USED="$PACKAGES_USED libwebp"],
|
||||
[AC_MSG_WARN([libwebp not found; disabling libwebp support])
|
||||
[FIND_LIBWEBP([
|
||||
with_libwebp="yes (found by search)"
|
||||
], [
|
||||
AC_MSG_WARN([libwebp not found; disabling WEBP support])
|
||||
with_libwebp=no
|
||||
])
|
||||
]
|
||||
)
|
||||
fi
|
||||
|
||||
# pangoft2
|
||||
|
Loading…
Reference in New Issue
Block a user