--- configure.ac.in.orig 2023-05-31 14:54:04 UTC +++ configure.ac.in @@ -90,40 +90,8 @@ LIBPCAP=-lpcap MAKE=make BIN_PATH=/usr/bin LIBPCAP=-lpcap +OS=`uname -or | cut -d '-' -f 1` -if test $SYSTEM = "FreeBSD" || test $SYSTEM = "Darwin"; then - CFLAGS="${CFLAGS} -I/usr/local/include" - LDFLAGS="${LDFLAGS} -L/usr/local/lib" - - dnl> https://github.com/google/sanitizers/wiki/AddressSanitizerFlags - CC=clang - CXX="clang++ -fpie -fno-color-diagnostics $CLANG_STDLIB" - if test $SYSTEM = "FreeBSD"; then - MAKE=gmake - BIN_PATH=/usr/local/bin - else - dnl> Adds /opt if MacPorts is installed - if [ test -f /opt/local/bin/port ]; then - CFLAGS="${CFLAGS} -I/opt/local/include" - LDFLAGS="${LDFLAGS} -L/opt/local/lib" - fi - fi - dnl> CXX=clang++ -fsanitize=address -fsanitize-address-use-after-scope - OSXV=`sw_vers -productVersion` - if test $SYSTEM = "Darwin"; then - OS="macOS $OSXV" - else - OS=`uname -or | cut -d '-' -f 1` - fi - if test $MACHINE = "x86_64"; then - LDFLAGS="${LDFLAGS} -L/usr/local/opt/ntopng" - RES=`g++ -Wall -fno-color-diagnostics Prefs.cpp 2>&1 | grep "unrecognized command line option "|wc -l` - if test $RES -eq 0; then - CFLAGS="-fno-color-diagnostics $CFLAGS" - fi - fi -fi - dnl> Remove spaces OS="${OS#"${OS%%[![:space:]]*}"}" @@ -165,15 +133,6 @@ fi LIBS="${LIBS} -lnetfilter_queue -lnfnetlink -lnetfilter_conntrack" fi -if test -d "/usr/local/include"; then - CFLAGS="${CFLAGS} -I/usr/local/include" - CPPFLAGS="${CPPFLAGS} -I/usr/local/include" -fi - -if test -d "/usr/local/lib"; then - LIBS="${LIBS} -L/usr/local/lib" -fi - if test -d /opt/local/include; then : CFLAGS="${CFLAGS} -I/opt/local/include" CPPFLAGS="${CPPFLAGS} -I/opt/local/include" @@ -227,15 +186,12 @@ AC_ARG_WITH(ndpi-includes, NDPI_CUST_INC="-I$withval -I$withval/../lib/third_party/include" ]) -if test -d /usr/local/include/ndpi ; then : - echo "WARNING: /usr/local/include/ndpi is present and might lead to compile errors" -fi - -NDPI_INC=`echo $NDPI_CFLAGS | sed -e "s/[ ]*$//"` -NDPI_LIB= -NDPI_LIB_DEP= - -AC_MSG_CHECKING(for nDPI source) +PKG_CHECK_MODULES([NDPI], [libndpi >= 2.0], [ + NDPI_INC=`echo $NDPI_CFLAGS | sed -e "s/[ ]*$//"` + NDPI_LIB="$NDPI_LIBS" + NDPI_LIB_DEP= + ], [ + AC_MSG_CHECKING(for nDPI source) if test -d "./nDPI" ; then : NDPI_HOME=./nDPI elif test -d "../nDPI" ; then : @@ -260,8 +216,8 @@ AC_MSG_CHECKING(for nDPI source) else AC_MSG_RESULT(not found) fi + ]) - if test ! -z "$NDPI_CUST_INC" ; then : NDPI_INC=$NDPI_CUST_INC fi @@ -278,18 +234,14 @@ dnl finish: nDPI handling fi dnl finish: nDPI handling -if test $SYSTEM = "FreeBSD"; then - JSON_LIB=/usr/local/lib/libjson-c.a - JSON_INC=`pkg-config --cflags json-c` + +pkg-config --exists json-c +if test "$?" -ne 1; then + JSON_INC=`pkg-config --cflags json-c` + JSON_LIB=`pkg-config --libs json-c` else - pkg-config --exists json-c - if test "$?" -ne 1; then - JSON_INC=`pkg-config --cflags json-c` - JSON_LIB=`pkg-config --libs json-c` - else - echo "Please install libjson-c-dev package prerequisite" - exit -1 - fi + echo "Please install libjson-c-dev package prerequisite" + exit -1 fi pkg-config --exists libssl @@ -447,11 +399,7 @@ if test "$?" -ne 1; then pkg-config --exists hiredis if test "$?" -ne 1; then HIREDIS_INC="`pkg-config --cflags hiredis` -I/usr/include/hiredis" - if test $SYSTEM = "FreeBSD"; then - HIREDIS_LIB="/usr/local/lib/libhiredis.a" - else - HIREDIS_LIB="`pkg-config --libs hiredis`" - fi + HIREDIS_LIB="`pkg-config --libs hiredis`" else echo "Please install hiredis package prerequisite" exit -1 @@ -469,14 +417,14 @@ if test "${with_nedge+set}" != set; then fi if test $SYSTEM = "FreeBSD"; then - LIBPCAP="${PF_RING_HOME}/userland/libpcap/libpcap.a" + # Use pcap from base else if test -d ${PF_RING_HOME}; then AC_MSG_CHECKING(for PF_RING source installed in $PF_RING_HOME) fi fi - if test -f "/usr/local/lib/libpfring.a" || test -f "/opt/pfring/lib/libpfring.a" || test -f "${PF_RING_HOME}/userland/lib/libpfring.a"; then + if test -f "%%LOCALBASE%%/lib/libpfring.a" || test -f "/opt/pfring/lib/libpfring.a" || test -f "${PF_RING_HOME}/userland/lib/libpfring.a"; then AC_DEFINE_UNQUOTED(HAVE_PF_RING, 1, [Native PF_RING support]) if test -f "${PF_RING_HOME}/userland/lib/libpfring.a"; then echo "${PF_RING_HOME}/userland/libpcap/libpcap.a" @@ -496,18 +444,18 @@ if test "${with_nedge+set}" != set; then CPPFLAGS="${CPPFLAGS} -I/opt/pfring/include" echo "Using PF_RING installed in /opt/pfring" else - if test -f "/usr/local/lib/libpfring.a"; then - if test -f "/usr/local/lib/libpcap.a"; then - LIBS="${LIBS} /usr/local/lib/libpfring.a" - echo "Using PF_RING installed in /usr/local/lib" + if test -f "%%LOCALBASE%%/lib/libpfring.a"; then + if test -f "%%LOCALBASE%%/lib/libpcap.a"; then + LIBS="${LIBS} %%LOCALBASE%%/lib/libpfring.a" + echo "Using PF_RING installed in %%LOCALBASE%%/lib" AC_CHECK_LIB([pcap], [pcap_open_live], pcap=true) if test x$pcap = x then - echo "Found /usr/local/lib/libpfring.a but missing header files." + echo "Found %%LOCALBASE%%/lib/libpfring.a but missing header files." exit 1 fi else - echo "Found /usr/local/lib/libpfring.a but missing libpcap.a in the same directory" + echo "Found %%LOCALBASE%%/lib/libpfring.a but missing libpcap.a in the same directory" echo "Please make sure you have installed your PF_RING libraries and try again" exit 1 fi @@ -656,9 +604,9 @@ dnl> FreeBSD fi dnl> FreeBSD -dnl> MYSQL_LIB=/usr/local/lib/mysql/libmysqlclient.a -dnl> MYSQL_INC="-I /usr/local/include/mysql/" -dnl> AC_DEFINE_UNQUOTED(HAVE_MYSQL, 1, [use mysql]) +MYSQL_LIB="-L%%LOCALBASE%%/lib/mysql -lmysqlclient" +MYSQL_INC="-I%%LOCALBASE%%/include/mysql" +AC_DEFINE_UNQUOTED(HAVE_MYSQL, 1, [use mysql]) if test $SYSTEM != "FreeBSD"; then if test "${with_nedge+set}" != set; then