2010-09-30 15:34:38 +02:00
|
|
|
AC_INIT([webpdecode], [0.1])
|
2011-06-07 02:56:50 +02:00
|
|
|
AC_CANONICAL_TARGET
|
2011-03-29 17:34:09 +02:00
|
|
|
AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
|
2010-09-30 15:34:38 +02:00
|
|
|
AC_PROG_LIBTOOL
|
2011-02-01 07:00:33 +01:00
|
|
|
AM_PROG_CC_C_O
|
|
|
|
|
2011-03-26 18:15:44 +01:00
|
|
|
AC_ARG_WITH([pkgconfigdir], AS_HELP_STRING([--with-pkgconfigdir=PATH],
|
|
|
|
[Path to the pkgconfig directory [[LIBDIR/pkgconfig]]]),
|
|
|
|
[pkgconfigdir="$withval"], [pkgconfigdir='${libdir}/pkgconfig'])
|
|
|
|
AC_SUBST([pkgconfigdir])
|
|
|
|
|
EXPERIMENTAL: add support for alpha channel
This is a (minor) bitstream change: if the 'color_space' bit is set to '1'
(which is normally an undefined/invalid behaviour), we add extra data at the
end of partition #0 (so-called 'extensions')
Namely, we add the size of the extension data as 3 bytes (little-endian),
followed by a set of bits telling which extensions we're incorporating.
The data then _preceeds_ this trailing tags.
This is all experimental, and you'll need to have
'#define WEBP_EXPERIMENTAL_FEATURES' in webp/types.h to enable this code
(at your own risk! :))
Still, this hack produces almost-valid WebP file for decoders that don't
check this color_space bit. In particular, previous 'dwebp' (and for instance
Chrome) will recognize this files and decode them, but without the alpha
of course. Other decoder will just see random extra stuff at the end of
partition #0.
To experiment with the alpha-channel, you need to compile on Unix platform
and use PNGs for input/output.
If 'alpha.png' is a source with alpha channel, then you can try (on Unix):
cwebp alpha.png -o alpha.webp
dwebp alpha.webp -o test.png
cwebp now has a '-noalpha' flag to ignore any alpha information from the
source, if present.
More hacking and experimenting welcome!
Change-Id: I3c7b1fd8411c9e7a9f77690e898479ad85c52f3e
2011-04-26 01:58:04 +02:00
|
|
|
dnl === Check libz is present
|
|
|
|
|
2011-06-03 21:39:14 +02:00
|
|
|
if test "$enable_experimental" = "yes"; then
|
|
|
|
AC_CHECK_HEADER(zlib.h,
|
|
|
|
AC_CHECK_LIB(z, gzsetparams,,AC_MSG_ERROR(zlib library not found)),
|
|
|
|
AC_MSG_ERROR(zlib not available - no zlib.h)
|
|
|
|
)
|
|
|
|
fi
|
EXPERIMENTAL: add support for alpha channel
This is a (minor) bitstream change: if the 'color_space' bit is set to '1'
(which is normally an undefined/invalid behaviour), we add extra data at the
end of partition #0 (so-called 'extensions')
Namely, we add the size of the extension data as 3 bytes (little-endian),
followed by a set of bits telling which extensions we're incorporating.
The data then _preceeds_ this trailing tags.
This is all experimental, and you'll need to have
'#define WEBP_EXPERIMENTAL_FEATURES' in webp/types.h to enable this code
(at your own risk! :))
Still, this hack produces almost-valid WebP file for decoders that don't
check this color_space bit. In particular, previous 'dwebp' (and for instance
Chrome) will recognize this files and decode them, but without the alpha
of course. Other decoder will just see random extra stuff at the end of
partition #0.
To experiment with the alpha-channel, you need to compile on Unix platform
and use PNGs for input/output.
If 'alpha.png' is a source with alpha channel, then you can try (on Unix):
cwebp alpha.png -o alpha.webp
dwebp alpha.webp -o test.png
cwebp now has a '-noalpha' flag to ignore any alpha information from the
source, if present.
More hacking and experimenting welcome!
Change-Id: I3c7b1fd8411c9e7a9f77690e898479ad85c52f3e
2011-04-26 01:58:04 +02:00
|
|
|
|
2011-02-01 07:00:33 +01:00
|
|
|
dnl === check for PNG support ===
|
|
|
|
|
|
|
|
PNG_INCLUDES=""
|
|
|
|
PNG_LIBS=""
|
|
|
|
AC_PATH_PROG(LIBPNG_CONFIG, libpng-config)
|
|
|
|
if test -n "$LIBPNG_CONFIG"; then
|
|
|
|
PNG_INCLUDES=`$LIBPNG_CONFIG --cflags`
|
|
|
|
PNG_PREFIX=`$LIBPNG_CONFIG --prefix`
|
|
|
|
if test "${PNG_PREFIX}/lib" != "/usr/lib" ; then
|
|
|
|
PNG_LIBS="-L${PNG_PREFIX}/lib"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_ARG_WITH(pngincludedir,
|
|
|
|
[--with-pngincludedir=DIR use PNG includes from DIR],
|
|
|
|
PNG_INCLUDES="-I$withval")
|
|
|
|
AC_ARG_WITH(pnglibdir,
|
|
|
|
[--with-pnglibdir=DIR use PNG libraries from DIR],
|
|
|
|
[PNG_LIBS="-L$withval"])
|
|
|
|
|
2011-08-02 02:05:57 +02:00
|
|
|
SAVED_CPPFLAGS=$CPPFLAGS
|
|
|
|
SAVED_LIBS=$LIBS
|
|
|
|
CPPFLAGS="$PNG_INCLUDES $CPPFLAGS"
|
|
|
|
LIBS="$PNG_LIBS $LIBS"
|
|
|
|
|
2011-02-01 07:00:33 +01:00
|
|
|
AC_CHECK_HEADER(png.h,
|
|
|
|
AC_CHECK_LIB(png, main,
|
|
|
|
[PNG_LIBS="$PNG_LIBS -lpng"
|
|
|
|
PNG_INCLUDES="$PNG_INCLUDES -DWEBP_HAVE_PNG"
|
|
|
|
AC_DEFINE(WEBP_HAVE_PNG, [1], [Set to 1 if PNG library is installed])
|
|
|
|
],
|
|
|
|
AC_MSG_WARN(Optional png library not found),
|
|
|
|
[$MATH_LIBS]),
|
|
|
|
AC_MSG_WARN(png library not available - no png.h)
|
|
|
|
)
|
|
|
|
AC_SUBST(PNG_LIBS)
|
|
|
|
AC_SUBST(PNG_INCLUDES)
|
|
|
|
|
2011-08-02 02:05:57 +02:00
|
|
|
CPPFLAGS=$SAVED_CPPFLAGS
|
|
|
|
LIBS=$SAVED_LIBS
|
|
|
|
|
2011-02-19 08:33:46 +01:00
|
|
|
dnl === check for JPEG support ===
|
|
|
|
|
|
|
|
JPEG_INCLUDES=""
|
|
|
|
JPEG_LIBS=""
|
|
|
|
AC_ARG_WITH(jpegincludedir,
|
|
|
|
[--with-jpegincludedir=DIR use JPEG includes from DIR],
|
|
|
|
JPEG_INCLUDES="-I$withval")
|
|
|
|
AC_ARG_WITH(jpeglibdir,
|
|
|
|
[--with-jpeglibdir=DIR use JPEG libraries from DIR],
|
|
|
|
[JPEG_LIBS="-L$withval"])
|
|
|
|
|
2011-08-02 02:05:57 +02:00
|
|
|
SAVED_CPPFLAGS=$CPPFLAGS
|
|
|
|
SAVED_LIBS=$LIBS
|
|
|
|
CPPFLAGS="$JPEG_INCLUDES $CPPFLAGS"
|
|
|
|
LIBS="$JPEG_LIBS $LIBS"
|
|
|
|
|
2011-02-19 08:33:46 +01:00
|
|
|
AC_CHECK_HEADER(jpeglib.h,
|
|
|
|
AC_CHECK_LIB(jpeg, jpeg_set_defaults,
|
|
|
|
[JPEG_LIBS="$JPEG_LIBS -ljpeg"
|
|
|
|
JPEG_INCLUDES="$JPEG_INCLUDES -DWEBP_HAVE_JPEG"
|
|
|
|
AC_DEFINE(WEBP_HAVE_JPEG, [1], [Set to 1 if JPEG library is installed])
|
|
|
|
],
|
|
|
|
AC_MSG_WARN(Optional jpeg library not found),
|
|
|
|
[$MATH_LIBS]),
|
|
|
|
AC_MSG_WARN(jpeg library not available - no jpeglib.h)
|
|
|
|
)
|
|
|
|
AC_SUBST(JPEG_LIBS)
|
|
|
|
AC_SUBST(JPEG_INCLUDES)
|
|
|
|
|
2011-08-02 02:05:57 +02:00
|
|
|
CPPFLAGS=$SAVED_CPPFLAGS
|
|
|
|
LIBS=$SAVED_LIBS
|
|
|
|
|
2011-06-07 02:56:50 +02:00
|
|
|
dnl === check for WIC support ===
|
|
|
|
|
|
|
|
if test "$target_os" = "mingw32"; then
|
|
|
|
AC_CHECK_HEADERS([wincodec.h shlwapi.h windows.h])
|
|
|
|
if test "$ac_cv_header_wincodec_h" = "yes"; then
|
|
|
|
AC_MSG_CHECKING(for Windows Imaging Component support)
|
2011-08-02 02:05:57 +02:00
|
|
|
SAVED_LIBS=$LIBS
|
2011-06-07 02:56:50 +02:00
|
|
|
LIBS="-lshlwapi -lole32 $LIBS"
|
|
|
|
# match include structure from [cd]webp.c
|
|
|
|
wic_headers="
|
|
|
|
#define INITGUID
|
|
|
|
#define CINTERFACE
|
|
|
|
#define COBJMACROS
|
|
|
|
#define _WIN32_IE 0x500
|
|
|
|
|
|
|
|
#include <shlwapi.h>
|
|
|
|
#include <windows.h>
|
|
|
|
#include <wincodec.h>
|
|
|
|
"
|
|
|
|
# test for functions from each lib and the GUID is created properly
|
|
|
|
wic_main="
|
|
|
|
int main(void) {
|
|
|
|
CLSID_WICImagingFactory;
|
|
|
|
CoInitialize(NULL);
|
|
|
|
SHCreateStreamOnFile(NULL, 0, NULL);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
"
|
|
|
|
AC_LANG_PUSH(C)
|
|
|
|
AC_LINK_IFELSE(
|
|
|
|
[AC_LANG_SOURCE([
|
|
|
|
$wic_headers
|
|
|
|
$wic_main])],
|
|
|
|
[wic_support=yes],
|
|
|
|
[wic_support=no]
|
|
|
|
)
|
|
|
|
AC_LANG_POP
|
|
|
|
|
2011-08-02 02:05:57 +02:00
|
|
|
test "$wic_support" = "yes" || LIBS=$SAVED_LIBS
|
2011-06-07 02:56:50 +02:00
|
|
|
AC_MSG_RESULT(${wic_support-no})
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2011-05-05 00:17:54 +02:00
|
|
|
dnl === If --enable-experimental is defined, add the flag WEBP_EXPERIMENTAL_FEATURES
|
|
|
|
|
|
|
|
USE_EXPERIMENTAL_CODE=""
|
|
|
|
AC_MSG_CHECKING(if --enable-experimental option is specified)
|
|
|
|
AC_ARG_ENABLE(experimental, [ --enable-experimental Activate experimental features])
|
|
|
|
if test "$enable_experimental" = "yes"; then
|
|
|
|
AC_DEFINE(EXPERIMENTAL,,[Enable experimental code])
|
|
|
|
USE_EXPERIMENTAL_CODE="-DWEBP_EXPERIMENTAL_FEATURES"
|
|
|
|
fi
|
|
|
|
AC_MSG_RESULT(${enable_experimental-no})
|
|
|
|
AC_SUBST(USE_EXPERIMENTAL_CODE)
|
|
|
|
|
|
|
|
dnl =========================
|
|
|
|
|
2011-01-06 16:25:43 +01:00
|
|
|
AC_CONFIG_MACRO_DIR([m4])
|
2010-09-30 15:34:38 +02:00
|
|
|
AC_CONFIG_HEADERS([config.h])
|
2011-09-02 23:30:08 +02:00
|
|
|
AC_CONFIG_FILES([Makefile src/Makefile man/Makefile \
|
|
|
|
examples/Makefile src/dec/Makefile \
|
|
|
|
src/enc/Makefile src/dsp/Makefile \
|
|
|
|
src/libwebp.pc])
|
2011-02-19 08:33:46 +01:00
|
|
|
|
|
|
|
|
2010-09-30 15:34:38 +02:00
|
|
|
AC_OUTPUT
|