--- a/configure.ac +++ b/configure.ac @@ -29,7 +29,6 @@ AC_PROG_INSTALL m4_include([m4/slg_searchdirs.m4]) -m4_include([m4/slg_gcc_all_warnings.m4]) # use C++11 mode if available; HAVE_CXX11 is defined in config.h if so. Don't @@ -96,96 +95,6 @@ fi ################################################################ -# -# Enable all the compiler debugging we can find -# -# This is originally from PhotoRec, but modified substantially by Simson -# Figure out which flags we can use with the compiler. -# -# These I don't like: -# -Wdeclaration-after-statement -Wconversion -# doesn't work: -Wunreachable-code -# causes configure to crash on gcc-4.2.1: -Wsign-compare-Winline -# causes warnings with unistd.h: -Wnested-externs -# Just causes too much annoyance: -Wmissing-format-attribute -# Check GCC -WARNINGS_TO_TEST="-MD -D_FORTIFY_SOURCE=2 -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes \ - -Wshadow -Wwrite-strings -Wcast-align -Waggregate-return \ - -Wbad-function-cast -Wcast-qual -Wundef -Wredundant-decls -Wdisabled-optimization \ - -Wfloat-equal -Wmultichar -Wc++-compat -Wmissing-noreturn " - -if test $mingw = "no" ; then - # add the warnings we do not want to do on mingw - WARNINGS_TO_TEST="$WARNINGS_TO_TEST -Wall -Wstrict-prototypes" -fi - -echo "Warnings to test: $WARNINGS_TO_TEST" - -for option in $WARNINGS_TO_TEST -do - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $option" - AC_MSG_CHECKING([whether gcc understands $option]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], - [has_option=yes], - [has_option=no; CFLAGS="$SAVE_CFLAGS"]) - AC_MSG_RESULT($has_option) - unset has_option - unset SAVE_CFLAGS - if test $option = "-Wmissing-format-attribute" ; then - AC_DEFINE(HAVE_MISSING_FORMAT_ATTRIBUTE_WARNING,1, - [Indicates that we have the -Wmissing-format-attribute G++ warning]) - fi -done -unset option - - -# C++ -# We don't use these warnings: -# -Waggregate-return -- aggregate returns are GOOD; they simplify code design -# We can use these warnings after ZLIB gets upgraded: -# -Wundef --- causes problems with zlib -# -Wcast-qual -# -Wmissing-format-attribute --- Just too annoying -AC_LANG_PUSH(C++) -WARNINGS_TO_TEST="-Wall -MD -D_FORTIFY_SOURCE=2 -Wpointer-arith \ - -Wshadow -Wwrite-strings -Wcast-align \ - -Wredundant-decls -Wdisabled-optimization \ - -Wfloat-equal -Wmultichar -Wmissing-noreturn \ - -Woverloaded-virtual -Wsign-promo \ - -funit-at-a-time" - -if $CXX -dM -E - < /dev/null | grep -q __clang__ ; then - AC_MSG_RESULT([Using clang]) - clang='yes' - else - AC_MSG_RESULT([not using clang]) - clang='no' - # -Wstrict-null-sentinel is not supported under clang or under Darwin's gcc - WARNINGS_TO_TEST="$WARNINGS_TO_TEST -Wstrict-null-sentinel" -fi - -if test $mingw = "no" ; then - # add the warnings we don't want to do on mingw - WARNINGS_TO_TEST="$WARNINGS_TO_TEST -Weffc++" -fi - -for option in $WARNINGS_TO_TEST -do - SAVE_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS $option" - AC_MSG_CHECKING([whether g++ understands $option]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], - [has_option=yes], - [has_option=no; CXXFLAGS="$SAVE_CXXFLAGS"]) - AC_MSG_RESULT($has_option) - unset has_option - unset SAVE_CXXFLAGS -done -unset option -AC_LANG_POP() - -################################################################ ## @@ -396,7 +305,12 @@ AC_CHECK_HEADERS(cap-ng.h) fi +################################################################ +# http-parser +AC_CHECK_LIB(http_parser,http_parser_init,, + AC_MSG_ERROR([http-parser library not installed])) +AC_CHECK_HEADERS(http_parser.h) ################################################################ # Specify our other headers @@ -603,35 +517,6 @@ Mmissing_library="$Mmissing_library python27" # Not sure: https://github.com/macports/macports-ports/blob/master/lang/python27/Portfile ]) -############## drop optimization flags if requested ################ - -# Should we disable optimization? -AC_ARG_WITH([opt], AC_HELP_STRING([--without-opt], [Drop all -O C flags])) -# Or maybe just tone it down a bit? -AC_ARG_WITH([o3], AC_HELP_STRING([--without-o3], [Do not force O3 optimization; use default level])) - -if test x"${AFF_NOOPT}" != "x" ; then - AC_MSG_NOTICE([Dropping optimization flags because AFF_NOOPT is set.]) - with_opt="no"; -fi - -if test "${with_opt}" = "no" ; then - AC_MSG_NOTICE([Dropping optimization flags]) - CFLAGS=`echo "$CFLAGS" | sed s/-O[[0-9]]//` # note the double quoting! - CXXFLAGS=`echo "$CXXFLAGS" | sed s/-O[[0-9]]//` - - AC_MSG_NOTICE([Removing -D_FORTIFY_SOURCE=2]) - CPPFLAGS=`echo $CPPFLAGS | sed s/-D_FORTIFY_SOURCE=2//` - CXXFLAGS=`echo $CXXFLAGS | sed s/-D_FORTIFY_SOURCE=2//` - CFLAGS=`echo $CFLAGS | sed s/-D_FORTIFY_SOURCE=2//` -else - # and increase optimizer from -O2 to -O3 if not explicitly forbidden - if test "${with_o3}" != "no" ; then - CFLAGS=`echo -g "$CFLAGS" | sed s/-O2/-O3/` # note the double quoting! - CXXFLAGS=`echo -g "$CXXFLAGS" | sed s/-O2/-O3/` - fi -fi - AC_OUTPUT ## Finally, record the values of CFLAGS, CPPFLAGS, and CXXFLAGS for DFXML --- a/src/Makefile.am +++ b/src/Makefile.am @@ -90,18 +90,10 @@ scan_netviz.cpp \ pcap_writer.h \ iptree.h \ - http-parser/http_parser.c \ - http-parser/http_parser.h \ mime_map.cpp \ mime_map.h EXTRA_DIST =\ - http-parser/AUTHORS \ - http-parser/CONTRIBUTIONS \ - http-parser/LICENSE-MIT \ - http-parser/Makefile \ - http-parser/README.md \ - http-parser/http_parser.gyp \ wifipcap/README.txt \ wifipcap/TimeVal.cpp \ wifipcap/TimeVal.h \ --- a/src/scan_http.cpp +++ b/src/scan_http.cpp @@ -11,7 +11,11 @@ #include "tcpip.h" #include "tcpdemux.h" +#ifdef HAVE_HTTP_PARSER_H +#include "http_parser.h" +#else #include "http-parser/http_parser.h" +#endif #include "mime_map.h"