From c02f439d73f33c727909131cb4d9d01029d7492f Mon Sep 17 00:00:00 2001 From: "Gerd v. Egidy" Date: Mon, 11 Jul 2022 20:40:03 +0200 Subject: [PATCH] implement autoconf/automake support for libz and fopencookie usage --- configure.ac | 25 +++++++++++++++++++++++++ src/Makefile.am | 5 +++++ 2 files changed, 30 insertions(+) diff --git a/configure.ac b/configure.ac index e66fd9e..d950587 100644 --- a/configure.ac +++ b/configure.ac @@ -29,6 +29,9 @@ AC_PROG_EGREP AC_LANG(C) AM_PROG_CC_C_O +# we might want to use this with zlib for compressed pcap support +AC_CHECK_FUNCS([fopencookie]) + ####################################################################### # Check for other REQUIRED libraries AC_CHECK_LIB([pthread], [pthread_create], [], [ @@ -255,12 +258,33 @@ AS_IF([test "x$USE_EEP" = "xyes"], [ AC_DEFINE([USE_EEP],[],[Compile With EEP support]) ], []) +#### +#### zlib Support +#### +AC_ARG_WITH([zlib], + AS_HELP_STRING([--with-zlib], [Enable zlib to support gzip compressed pcap files]), + [AC_SUBST(WITH_ZLIB, $withval)], + [AC_SUBST(WITH_ZLIB, no)] +) + +AS_IF([test "x$WITH_ZLIB" = "xyes"], [ + AC_CHECK_HEADER([zlib.h], [], [ + AC_MSG_ERROR([ You need libz header files installed to compile with zlib support.]) + ]) + AC_CHECK_LIB([z], [gzdopen], [], [ + AC_MSG_ERROR([ You need libz library installed to compile with zlib support.]) + ]) + AC_DEFINE([WITH_ZLIB],[],[Compile With zlib support]) +], []) + + # Conditional Source inclusion AM_CONDITIONAL([WITH_PCRE2], [test "x$WITH_PCRE2" = "xyes"]) AM_CONDITIONAL([WITH_GNUTLS], [test "x$WITH_GNUTLS" = "xyes"]) AM_CONDITIONAL([WITH_OPENSSL], [test "x$WITH_OPENSSL" = "xyes"]) AM_CONDITIONAL([USE_EEP], [test "x$USE_EEP" = "xyes"]) +AM_CONDITIONAL([WITH_ZLIB], [test "x$WITH_ZLIB" = "xyes"]) ###################################################################### @@ -291,6 +315,7 @@ AC_MSG_NOTICE( Perl Expressions Support : ${WITH_PCRE} ) AC_MSG_NOTICE( Perl Expressions Support (v2): ${WITH_PCRE2} ) AC_MSG_NOTICE( IPv6 Support : ${USE_IPV6} ) AC_MSG_NOTICE( EEP Support : ${USE_EEP} ) +AC_MSG_NOTICE( Zlib Support : ${WITH_ZLIB} ) AC_MSG_NOTICE( ====================================================== ) AC_MSG_NOTICE diff --git a/src/Makefile.am b/src/Makefile.am index c6d7a1d..309c707 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -20,6 +20,11 @@ if WITH_PCRE2 sngrep_CFLAGS+=$(PCRE2_CFLAGS) sngrep_LDADD+=$(PCRE2_LIBS) endif +if WITH_ZLIB +sngrep_CFLAGS+=$(ZLIB_CFLAGS) +sngrep_LDADD+=$(ZLIB_LIBS) +endif + sngrep_SOURCES+=address.c packet.c sip.c sip_call.c sip_msg.c sip_attr.c main.c sngrep_SOURCES+=option.c group.c filter.c keybinding.c media.c setting.c rtp.c sngrep_SOURCES+=util.c hash.c vector.c curses/ui_panel.c curses/scrollbar.c