diff --git a/configure.ac b/configure.ac index bf09d330..ddb7c8fa 100644 --- a/configure.ac +++ b/configure.ac @@ -268,6 +268,14 @@ AC_ARG_ENABLE([experimental-libwebpdemux], AC_MSG_RESULT(${enable_experimental_libwebpdemux-no}) AM_CONDITIONAL([WANT_DEMUX], [test "$enable_experimental_libwebpdemux" = "yes"]) +dnl === Check whether decoder library should be built. +AC_MSG_CHECKING(whether decoder library is to be built) +AC_ARG_ENABLE([libwebpdecoder], + AS_HELP_STRING([--enable-libwebpdecoder], + [Building libwebpdecoder @<:@default=no@:>@])) +AC_MSG_RESULT(${enable_libwebpdecoder-no}) +AM_CONDITIONAL([BUILD_LIBWEBPDECODER], [test "$enable_libwebpdecoder" = "yes"]) + dnl ========================= AC_CONFIG_MACRO_DIR([m4]) @@ -290,6 +298,7 @@ Shared libraries: ${enable_shared} Static libraries: ${enable_static} Threaded decode: ${enable_threading-no} libwebp: yes +libwebpdecoder: ${enable_libwebpdecoder-no} libwebpdemux: ${enable_experimental_libwebpdemux-no} libwebpmux: ${enable_experimental_libwebpmux-no} diff --git a/examples/Makefile.am b/examples/Makefile.am index 202f9c4e..3cc106b9 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -1,6 +1,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/src bin_PROGRAMS = dwebp cwebp + if WANT_MUX bin_PROGRAMS += webpmux endif @@ -18,7 +19,13 @@ libexampleutilincludedir = dwebp_SOURCES = dwebp.c stopwatch.h dwebp_CPPFLAGS = $(AM_CPPFLAGS) $(USE_EXPERIMENTAL_CODE) dwebp_CPPFLAGS += $(JPEG_INCLUDES) $(PNG_INCLUDES) -dwebp_LDADD = libexampleutil.la ../src/libwebp.la $(PNG_LIBS) $(JPEG_LIBS) +dwebp_LDADD = libexampleutil.la $(PNG_LIBS) $(JPEG_LIBS) + +if BUILD_LIBWEBPDECODER + dwebp_LDADD += ../src/libwebpdecoder.la +else + dwebp_LDADD += ../src/libwebp.la +endif cwebp_SOURCES = cwebp.c metadata.c metadata.h stopwatch.h cwebp_SOURCES += jpegdec.c jpegdec.h diff --git a/src/Makefile.am b/src/Makefile.am index 6012a5e9..7cd031ce 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,5 @@ SUBDIRS = dec enc dsp utils + if WANT_MUX SUBDIRS += mux endif @@ -9,6 +10,10 @@ endif AM_CPPFLAGS = -I$(top_srcdir)/src lib_LTLIBRARIES = libwebp.la +if BUILD_LIBWEBPDECODER + lib_LTLIBRARIES += libwebpdecoder.la +endif + libwebp_la_SOURCES = libwebpinclude_HEADERS = libwebpinclude_HEADERS += webp/decode.h @@ -30,5 +35,20 @@ libwebp_la_LIBADD += utils/libwebputils.la libwebp_la_LDFLAGS = -no-undefined -version-info 4:1:0 libwebpincludedir = $(includedir)/webp +if BUILD_LIBWEBPDECODER + libwebpdecoder_la_SOURCES = + libwebpdecoderinclude_HEADERS = + libwebpdecoderinclude_HEADERS += webp/decode.h + libwebpdecoderinclude_HEADERS += webp/types.h + + libwebpdecoder_la_LIBADD = + libwebpdecoder_la_LIBADD += dec/libwebpdecode.la + libwebpdecoder_la_LIBADD += dsp/libwebpdspdecode.la + libwebpdecoder_la_LIBADD += utils/libwebputilsdecode.la + + libwebpdecoder_la_LDFLAGS = -no-undefined -version-info 4:1:0 + libwebpdecoderincludedir = $(includedir)/webp +endif + pkgconfig_DATA = libwebp.pc ${pkgconfig_DATA}: ${top_builddir}/config.status diff --git a/src/dsp/Makefile.am b/src/dsp/Makefile.am index e28e3e08..86239b02 100644 --- a/src/dsp/Makefile.am +++ b/src/dsp/Makefile.am @@ -1,23 +1,31 @@ AM_CPPFLAGS = -I$(top_srcdir)/src noinst_LTLIBRARIES = libwebpdsp.la -libwebpdsp_la_SOURCES = -libwebpdsp_la_SOURCES += cpu.c -libwebpdsp_la_SOURCES += dec.c -libwebpdsp_la_SOURCES += dec_neon.c -libwebpdsp_la_SOURCES += dec_sse2.c -libwebpdsp_la_SOURCES += dsp.h -libwebpdsp_la_SOURCES += enc.c -libwebpdsp_la_SOURCES += enc_neon.c -libwebpdsp_la_SOURCES += enc_sse2.c -libwebpdsp_la_SOURCES += lossless.c -libwebpdsp_la_SOURCES += lossless.h -libwebpdsp_la_SOURCES += upsampling.c -libwebpdsp_la_SOURCES += upsampling_sse2.c -libwebpdsp_la_SOURCES += yuv.c -libwebpdsp_la_SOURCES += yuv.h +if BUILD_LIBWEBPDECODER + noinst_LTLIBRARIES += libwebpdspdecode.la +endif +COMMON_SOURCES = +COMMON_SOURCES += cpu.c +COMMON_SOURCES += dec.c +COMMON_SOURCES += dec_neon.c +COMMON_SOURCES += dec_sse2.c +COMMON_SOURCES += dsp.h +COMMON_SOURCES += lossless.c +COMMON_SOURCES += lossless.h +COMMON_SOURCES += upsampling.c +COMMON_SOURCES += upsampling_sse2.c +COMMON_SOURCES += yuv.c +COMMON_SOURCES += yuv.h + +ENC_SOURCES = +ENC_SOURCES += enc.c +ENC_SOURCES += enc_neon.c +ENC_SOURCES += enc_sse2.c + +libwebpdsp_la_SOURCES = $(COMMON_SOURCES) $(ENC_SOURCES) libwebpdspinclude_HEADERS = ../webp/types.h + noinst_HEADERS = noinst_HEADERS += ../dec/decode_vp8.h noinst_HEADERS += ../webp/decode.h @@ -25,3 +33,12 @@ noinst_HEADERS += ../webp/decode.h libwebpdsp_la_LDFLAGS = -lm libwebpdsp_la_CPPFLAGS = $(USE_EXPERIMENTAL_CODE) $(USE_SWAP_16BIT_CSP) libwebpdspincludedir = $(includedir)/webp + +if BUILD_LIBWEBPDECODER + libwebpdspdecode_la_SOURCES = $(COMMON_SOURCES) + libwebpdspdecodeinclude_HEADERS = $(libwebpdspinclude_HEADERS) + + libwebpdspdecode_la_LDFLAGS = $(libwebpdsp_la_LDFLAGS) + libwebpdspdecode_la_CPPFLAGS = $(libwebpdsp_la_CPPFLAGS) + libwebpdspdecodeincludedir = $(libwebpdspincludedir) +endif diff --git a/src/utils/Makefile.am b/src/utils/Makefile.am index 65054c03..96429b03 100644 --- a/src/utils/Makefile.am +++ b/src/utils/Makefile.am @@ -1,27 +1,43 @@ AM_CPPFLAGS = -I$(top_srcdir)/src noinst_LTLIBRARIES = libwebputils.la -libwebputils_la_SOURCES = -libwebputils_la_SOURCES += bit_reader.c -libwebputils_la_SOURCES += bit_reader.h -libwebputils_la_SOURCES += bit_writer.c -libwebputils_la_SOURCES += bit_writer.h -libwebputils_la_SOURCES += color_cache.c -libwebputils_la_SOURCES += color_cache.h -libwebputils_la_SOURCES += filters.c -libwebputils_la_SOURCES += filters.h -libwebputils_la_SOURCES += huffman.c -libwebputils_la_SOURCES += huffman.h -libwebputils_la_SOURCES += huffman_encode.c -libwebputils_la_SOURCES += huffman_encode.h -libwebputils_la_SOURCES += quant_levels.c -libwebputils_la_SOURCES += quant_levels.h -libwebputils_la_SOURCES += rescaler.c -libwebputils_la_SOURCES += rescaler.h -libwebputils_la_SOURCES += thread.c -libwebputils_la_SOURCES += thread.h -libwebputils_la_SOURCES += utils.c -libwebputils_la_SOURCES += utils.h +if BUILD_LIBWEBPDECODER + noinst_LTLIBRARIES += libwebputilsdecode.la +endif + +COMMON_SOURCES = +COMMON_SOURCES += bit_reader.c +COMMON_SOURCES += bit_reader.h +COMMON_SOURCES += color_cache.c +COMMON_SOURCES += color_cache.h +COMMON_SOURCES += filters.c +COMMON_SOURCES += filters.h +COMMON_SOURCES += huffman.c +COMMON_SOURCES += huffman.h +COMMON_SOURCES += quant_levels.c +COMMON_SOURCES += quant_levels.h +COMMON_SOURCES += rescaler.c +COMMON_SOURCES += rescaler.h +COMMON_SOURCES += thread.c +COMMON_SOURCES += thread.h +COMMON_SOURCES += utils.c +COMMON_SOURCES += utils.h + +ENC_SOURCES = +ENC_SOURCES += bit_writer.c +ENC_SOURCES += bit_writer.h +ENC_SOURCES += huffman_encode.c +ENC_SOURCES += huffman_encode.h + + +libwebputils_la_SOURCES = $(COMMON_SOURCES) $(ENC_SOURCES) libwebputilsinclude_HEADERS = ../webp/types.h libwebputilsincludedir = $(includedir)/webp + +if BUILD_LIBWEBPDECODER + libwebputilsdecode_la_SOURCES = $(COMMON_SOURCES) + + libwebputilsdecodeinclude_HEADERS = $(libwebputilsinclude_HEADERS) + libwebputilsdecodeincludedir = $(libwebputilsincludedir) +endif