Description: Use system libndpi, and discover path by using pkg-config.
Author: Ludovico Cavedon <cavedon@debian.org>

Index: ntopng/configure.ac.in
===================================================================
--- ntopng.orig/configure.ac.in
+++ ntopng/configure.ac.in
@@ -233,55 +233,7 @@
    echo "WARNING: /usr/local/include/ndpi is present and might lead to compile errors"
 fi
 
-PKG_CHECK_MODULES([NDPI], [libndpi >= 2.0], [
-   NDPI_INC=`echo $NDPI_CFLAGS | sed -e "s/[ ]*$//"`
-   # Use static libndpi library as building against the dynamic library fails
-   NDPI_LIB="-Wl,-Bstatic $NDPI_LIBS -Wl,-Bdynamic"
-   #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 :
-         NDPI_HOME=../nDPI
-      elif test -d "$HOME/nDPI" ; then :
-         NDPI_HOME=$HOME/nDPI
-      fi
-
-      if test ! -z "$NDPI_HOME" ; then :
-         AC_MSG_RESULT(found in $NDPI_HOME)
-         NDPI_LIB=$NDPI_HOME/src/lib/libndpi.a
-         AC_MSG_CHECKING(for $NDPI_LIB)
-         if test -r $NDPI_LIB ; then :
-            AC_MSG_RESULT(found $NDPI_LIB)
-         else
-            AC_MSG_RESULT(not found $NDPI_LIB: compiling)
-            cd $NDPI_HOME; ./autogen.sh; ${MAKE}; cd -
-         fi
-         NDPI_INC="-I$NDPI_HOME/src/include -I$NDPI_HOME/src/lib/third_party/include"
-         NDPI_LIB=$NDPI_HOME/src/lib/libndpi.a
-         NDPI_LIB_DEP=$NDPI_LIB
-      else
-         AC_MSG_RESULT(not found)
-      fi
-   ])
-
-if test ! -z "$NDPI_CUST_INC" ; then :
-  NDPI_INC=$NDPI_CUST_INC
-fi
-
-if test ! -z "$NDPI_CUST_LIB" ; then :
-  NDPI_LIB=$NDPI_CUST_LIB
-fi
-
-if test -z "$NDPI_INC" || test -z "$NDPI_LIB" ; then :
-  echo "Could not find nDPI"
-  echo "Please do cd ..; git clone https://github.com/ntop/nDPI.git; cd nDPI; ./autogen.sh; ${MAKE}; cd ../ntopng"
-  echo "and try again"
-  exit 1
-fi
-dnl finish: nDPI handling
+PKG_CHECK_MODULES([NDPI], [libndpi >= 2.6])
 
 if test $SYSTEM = "FreeBSD"; then
    JSON_LIB=/usr/local/lib/libjson-c.a
@@ -778,8 +730,8 @@
 AC_SUBST(INSTALL_DIR)
 AC_SUBST(MAN_DIR)
 AC_SUBST(NDPI_HOME)
-AC_SUBST(NDPI_INC)
-AC_SUBST(NDPI_LIB)
+AC_SUBST(NDPI_INC, [$NDPI_CFLAGS])
+AC_SUBST(NDPI_LIB, [$NDPI_LIBS])
 AC_SUBST(NDPI_LIB_DEP)
 AC_SUBST(HIREDIS_INC)
 AC_SUBST(HIREDIS_LIB)
