diff --git a/configure.ac b/configure.ac index e5722a2b..c7f64d6a 100644 --- a/configure.ac +++ b/configure.ac @@ -28,6 +28,7 @@ AC_ARG_ENABLE([everything], disabled with --disable-target]), [SET_IF_UNSET([enable_libwebpdecoder], [$enableval]) SET_IF_UNSET([enable_libwebpdemux], [$enableval]) + SET_IF_UNSET([enable_libwebpextras], [$enableval]) SET_IF_UNSET([enable_libwebpmux], [$enableval])]) AC_ARG_WITH([pkgconfigdir], AS_HELP_STRING([--with-pkgconfigdir=DIR], @@ -527,6 +528,14 @@ AC_ARG_ENABLE([libwebpdecoder], AC_MSG_RESULT(${enable_libwebpdecoder-no}) AM_CONDITIONAL([BUILD_LIBWEBPDECODER], [test "$enable_libwebpdecoder" = "yes"]) +dnl === Check whether libwebpextras should be built +AC_MSG_CHECKING(whether libwebpextras is to be built) +AC_ARG_ENABLE([libwebpextras], + AS_HELP_STRING([--enable-libwebpextras], + [Build libwebpextras @<:@default=no@:>@])) +AC_MSG_RESULT(${enable_libwebpextras-no}) +AM_CONDITIONAL([WANT_EXTRAS], [test "$enable_libwebpextras" = "yes"]) + dnl ========================= AC_CONFIG_MACRO_DIR([m4]) @@ -535,9 +544,10 @@ AC_CONFIG_FILES([Makefile src/Makefile man/Makefile \ examples/Makefile src/dec/Makefile \ src/enc/Makefile src/dsp/Makefile \ src/demux/Makefile src/mux/Makefile \ - src/utils/Makefile \ + src/utils/Makefile src/extras/Makefile \ src/libwebp.pc src/libwebpdecoder.pc \ - src/demux/libwebpdemux.pc src/mux/libwebpmux.pc]) + src/demux/libwebpdemux.pc src/mux/libwebpmux.pc \ + src/extras/libwebpextras.pc]) AC_OUTPUT @@ -553,6 +563,7 @@ libwebp: yes libwebpdecoder: ${enable_libwebpdecoder-no} libwebpdemux: ${enable_libwebpdemux-no} libwebpmux: ${enable_libwebpmux-no} +libwebpextras: ${enable_libwebpextras-no} Tools: cwebp : yes diff --git a/src/Makefile.am b/src/Makefile.am index daa6688c..579d7b7a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,5 +1,5 @@ -# The mux and demux libraries depend on libwebp, thus the '.' to force the -# build order so it's available to them. +# The mux, demux and extras libraries depend on libwebp, thus the '.' to force +# the build order so it's available to them. SUBDIRS = dec enc dsp utils . if WANT_MUX SUBDIRS += mux @@ -7,6 +7,9 @@ endif if WANT_DEMUX SUBDIRS += demux endif +if WANT_EXTRAS + SUBDIRS += extras +endif lib_LTLIBRARIES = libwebp.la diff --git a/src/extras/Makefile.am b/src/extras/Makefile.am new file mode 100644 index 00000000..6598676e --- /dev/null +++ b/src/extras/Makefile.am @@ -0,0 +1,13 @@ +lib_LTLIBRARIES = libwebpextras.la + +libwebpextras_la_SOURCES = +libwebpextras_la_SOURCES += extras.c + +libwebpextrasinclude_HEADERS = +libwebpextrasinclude_HEADERS += ../webp/extras.h +libwebpextrasinclude_HEADERS += ../webp/types.h + +libwebpextras_la_LIBADD = ../libwebp.la +libwebpextras_la_LDFLAGS = -no-undefined -version-info 0:0:0 +libwebpextrasincludedir = $(includedir)/webp +pkgconfig_DATA = libwebpextras.pc diff --git a/src/extras/extras.c b/src/extras/extras.c new file mode 100644 index 00000000..63a38c05 --- /dev/null +++ b/src/extras/extras.c @@ -0,0 +1,23 @@ +// Copyright 2015 Google Inc. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the COPYING file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. +// ----------------------------------------------------------------------------- +// +// Additional WebP utilities. +// + +#include "../webp/extras.h" + +#define XTRA_MAJ_VERSION 0 +#define XTRA_MIN_VERSION 0 +#define XTRA_REV_VERSION 0 + +//------------------------------------------------------------------------------ + +int WebPGetExtrasVersion(void) { + return (XTRA_MAJ_VERSION << 16) | (XTRA_MIN_VERSION << 8) | XTRA_REV_VERSION; +} diff --git a/src/extras/libwebpextras.pc.in b/src/extras/libwebpextras.pc.in new file mode 100644 index 00000000..a2e28f2e --- /dev/null +++ b/src/extras/libwebpextras.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: libwebpextras +Description: Additional utility functions useful in processing WebP files +Version: @PACKAGE_VERSION@ +Requires: libwebp >= 0.5.0 +Cflags: -I${includedir} +Libs: -L${libdir} -lwebpextras diff --git a/src/webp/extras.h b/src/webp/extras.h new file mode 100644 index 00000000..b62cd582 --- /dev/null +++ b/src/webp/extras.h @@ -0,0 +1,34 @@ +// Copyright 2015 Google Inc. All Rights Reserved. +// +// Use of this source code is governed by a BSD-style license +// that can be found in the COPYING file in the root of the source +// tree. An additional intellectual property rights grant can be found +// in the file PATENTS. All contributing project authors may +// be found in the AUTHORS file in the root of the source tree. +// ----------------------------------------------------------------------------- +// + +#ifndef WEBP_WEBP_EXTRAS_H_ +#define WEBP_WEBP_EXTRAS_H_ + +#include "./types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define WEBP_EXTRAS_ABI_VERSION 0x0000 // MAJOR(8b) + MINOR(8b) + +//------------------------------------------------------------------------------ + +// Returns the version number of the extras library, packed in hexadecimal using +// 8bits for each of major/minor/revision. E.g: v2.5.7 is 0x020507. +WEBP_EXTERN(int) WebPGetExtrasVersion(void); + +//------------------------------------------------------------------------------ + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif /* WEBP_WEBP_EXTRAS_H_ */