diff options
author | Benoît Canet <benoit@scylladb.com> | 2016-09-26 16:25:11 +0200 |
---|---|---|
committer | Pascal Quantin <pascal.quantin@gmail.com> | 2016-10-17 18:28:45 +0000 |
commit | 47649d1c7fb6ba48b805e19268a711404eb6908b (patch) | |
tree | 603eea5969a564511df482a2d8d6a9525cfea74b /acinclude.m4 | |
parent | 5c42d8a24c863549166bc1d0875e87a07bedf53e (diff) |
cql: add lz4 and snappy decompression
We do not use the STARTUP negotiation since a stream
can be captured in its middle but try to decompress
if the flag is present and fallback if it fails.
Change-Id: Iecbf49a45220b04be7808869c9884548eb1e7694
Signed-off-by: Benoît Canet <benoit@scylladb.com>
Reviewed-on: https://code.wireshark.org/review/17952
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Diffstat (limited to 'acinclude.m4')
-rw-r--r-- | acinclude.m4 | 160 |
1 files changed, 160 insertions, 0 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index 8d5efd37de..38cc9f2713 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1920,3 +1920,163 @@ AC_DEFUN([AC_WIRESHARK_QT_TOOL_CHECK_LRELEASE], ]) AC_MSG_RESULT([ok, $lrelease_version]) ]) + +# +# AC_WIRESHARK_LZ4_CHECK +# +AC_DEFUN([AC_WIRESHARK_LZ4_CHECK], +[ + AC_WIRESHARK_PUSH_FLAGS + + if test "x$lz4_dir" != "x" + then + # + # The user specified a directory in which lz4 resides, + # so add the "include" subdirectory of that directory to + # the include file search path and the "lib" subdirectory + # of that directory to the library search path. + # + # XXX - if there's also a lz4 in a directory that's + # already in CPPFLAGS or LDFLAGS, this won't make us find + # the version in the specified directory, as the compiler + # and/or linker will search that other directory before it + # searches the specified directory. + # + LZ4_CFLAGS="-I$lz4_dir/include" + fi + + # + # Make sure we have "lz4.h". If we don't, it means we probably + # don't have lz4, so don't use it. + # + AC_CHECK_HEADER(lz4.h,, + [ + if test "x$lz4_dir" != "x" + then + # + # The user used "--with-lz4=" to specify a directory + # containing lz4, but we didn't find the header file + # there; that either means they didn't specify the + # right directory or are confused about whether lz4 + # is, in fact, installed. Report the error and give up. + # + AC_MSG_ERROR([lz4 header not found in directory specified in --with-lz4]) + else + if test "x$want_lz4" = "xyes" + then + # + # The user tried to force us to use the library, but we + # couldn't find the header file; report an error. + # + AC_MSG_ERROR(Header file lz4.h not found.) + else + # + # We couldn't find the header file; don't use the + # library, as it's probably not present. + # + want_lz4=no + fi + fi + ]) + + if test "x$want_lz4" != "xno" + then + # + # Well, we at least have the lz4 header file. + # We link with lz4 to support uncompression of + # CQL traffic. + # + LZ4_LIBS="-llz4" + ac_save_LIBS="$LIBS" + LIBS="$LZ4_LIBS $LIBS" + AC_DEFINE(HAVE_LZ4, 1, [Define to use lz4 library]) + # + # Check for "LZ4_decompress_safe()" in lz4, which we need + # in order to read compressed capture files. + # + AC_CHECK_FUNCS(LZ4_decompress_safe) + LIBS="$ac_save_LIBS" + fi + + AC_WIRESHARK_POP_FLAGS +]) + +# +# AC_WIRESHARK_SNAPPY_CHECK +# +AC_DEFUN([AC_WIRESHARK_SNAPPY_CHECK], +[ + AC_WIRESHARK_PUSH_FLAGS + + if test "x$snappy_dir" != "x" + then + # + # The user specified a directory in which snappy resides, + # so add the "include" subdirectory of that directory to + # the include file search path and the "lib" subdirectory + # of that directory to the library search path. + # + # XXX - if there's also a snappy in a directory that's + # already in CPPFLAGS or LDFLAGS, this won't make us find + # the version in the specified directory, as the compiler + # and/or linker will search that other directory before it + # searches the specified directory. + # + SNAPPY_CFLAGS="-I$snappy_dir/include" + fi + + # + # Make sure we have "snappy-c.h". If we don't, it means we probably + # don't have snappy, so don't use it. + # + AC_CHECK_HEADER(snappy-c.h,, + [ + if test "x$snappy_dir" != "x" + then + # + # The user used "--with-snappy=" to specify a directory + # containing snappy, but we didn't find the header file + # there; that either means they didn't specify the + # right directory or are confused about whether snappy + # is, in fact, installed. Report the error and give up. + # + AC_MSG_ERROR([snappy-c.header not found in directory specified in --with-snappy]) + else + if test "x$want_snappy" = "xyes" + then + # + # The user tried to force us to use the library, but we + # couldn't find the header file; report an error. + # + AC_MSG_ERROR(Header file snappy-c.h not found.) + else + # + # We couldn't find the header file; don't use the + # library, as it's probably not present. + # + want_snappy=no + fi + fi + ]) + + if test "x$want_snappy" != "xno" + then + # + # Well, we at least have the snappy-c.header file. + # We link with snappy to support uncompression of + # compressed CQL traffic. + # + SNAPPY_LIBS=-lsnappy + ac_save_LIBS="$LIBS" + LIBS="$SNAPPY_LIBS $LIBS" + AC_DEFINE(HAVE_SNAPPY, 1, [Define to use snappy library]) + # + # Check for "snappy_uncompress()" in snappy, which we need + # in order to read compressed capture files. + # + AC_CHECK_FUNCS(snappy_uncompress) + LIBS="$ac_save_LIBS" + fi + + AC_WIRESHARK_POP_FLAGS +]) |