mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-02 00:40:10 +00:00
739 lines
21 KiB
Text
739 lines
21 KiB
Text
odnl> Do not add anything above
|
|
AC_INIT([ntopng],[@VERSION@])
|
|
dnl> Do not add anything above
|
|
|
|
AC_ARG_WITH(llvm_sanitizer, [ --with-llvm-sanitizer Build with support for the LLVM address sanitizer])
|
|
|
|
AS_IF([test "${with_llvm_sanitizer+set}" = set],[
|
|
CPPFLAGS="${CPPFLAGS} -O2 -Wno-unused-value -fsanitize=address -fno-omit-frame-pointer"
|
|
LDFLAGS="${LDFLAGS} -fsanitize=address"
|
|
CC=clang
|
|
CXX=clang++
|
|
])
|
|
|
|
AC_PROG_CPP
|
|
|
|
AC_PROG_CXX
|
|
|
|
dnl> Add /usr/local/ /opt/local
|
|
CFLAGS="-I${PWD} -I${PWD}/include"
|
|
CPPFLAGS="${CPPFLAGS} -I${PWD} -I${PWD}/include"
|
|
NTOPNG_VERSION="@VERSION@"
|
|
NTOPNG_SHORT_VERSION="@SHORT_VERSION@"
|
|
|
|
MACHINE=`uname -m`
|
|
SYSTEM=`uname -s`
|
|
|
|
PRO_MAKEFILE_INC=
|
|
PRO_INCS=
|
|
PRO_LIBS=
|
|
ADDITIONAL_PRO_OBJECTS=
|
|
PRO_OBJECTS=
|
|
PRO_HEADERS=
|
|
PRO_LIBS=
|
|
|
|
AC_ARG_WITH(nedge, [ --with-nedge Enable nEdge device build])
|
|
AC_ARG_WITH(nedge, [ --with-test-mode Enable ntopng/nEdge test mode])
|
|
|
|
if test "${with_test_mode+set}" = set; then
|
|
AC_DEFINE(HAVE_TEST_MODE, 1, [ntopng/nEdge test mode enabled])
|
|
fi
|
|
|
|
NEDGE=0
|
|
if test "${with_nedge+set}" = set; then
|
|
AC_DEFINE(HAVE_NEDGE, 1, [nedge support is present])
|
|
NEDGE=1
|
|
|
|
AC_CHECK_HEADERS([netinet/in.h libnetfilter_queue/libnetfilter_queue.h])
|
|
AC_CHECK_LIB([netfilter_queue], [nfq_create_queue])
|
|
AC_CHECK_LIB([nfnetlink], [nfnl_rcvbufsiz])
|
|
AC_CHECK_LIB([netfilter_conntrack], [nfct_filter_dump_create], nfct=true)
|
|
AC_CHECK_FUNC([nfq_set_verdict2], [AC_DEFINE([HAVE_NFQ_SET_VERDICT2],[1],[Define if nfq_set_verdict2 exists in netfilter_queue.])])
|
|
|
|
if test "x$ac_cv_lib_netfilter_queue_nfq_create_queue" != xyes; then
|
|
AC_MSG_RESULT(Cannot build nedge without Netfilter, exiting.)
|
|
exit 1
|
|
fi
|
|
|
|
if test x$nfct = x; then
|
|
AC_MSG_RESULT(Cannot build nedge without Conntrack, exiting.)
|
|
exit 1
|
|
fi
|
|
|
|
LDFLAGS="${LDFLAGS} -lnetfilter_queue -lnfnetlink -lnetfilter_conntrack"
|
|
fi
|
|
|
|
#
|
|
# On CentOS 6 `git rev-list HEAD --count` does not work
|
|
#
|
|
#
|
|
REVISION=`git log --pretty=oneline | wc -l`
|
|
|
|
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
|
|
LDFLAGS="${LDFLAGS} -L/usr/local/lib"
|
|
fi
|
|
|
|
if test -d /opt/local/include; then :
|
|
CFLAGS="${CFLAGS} -I/opt/local/include"
|
|
CPPFLAGS="${CPPFLAGS} -I/opt/local/include"
|
|
fi
|
|
|
|
if test -d /opt/local/lib; then :
|
|
LDFLAGS="${LDFLAGS} -L/opt/local/lib"
|
|
fi
|
|
|
|
if [ test -f /usr/bin/lsb_release ]; then
|
|
CODENAME=`/usr/bin/lsb_release -c|cut -f 2`
|
|
if [[ $CODENAME == "wheezy" ]]; then :
|
|
CPPFLAGS="${CPPFLAGS} -DOLD_NETFILTER_INTERFACE=1"
|
|
fi
|
|
fi
|
|
|
|
SHORT_MACHINE=`uname -m | cut -b1-3`
|
|
|
|
GIT_RELEASE="@GIT_RELEASE@"
|
|
GIT_DATE="@GIT_DATE@"
|
|
GIT_BRANCH="@GIT_BRANCH@"
|
|
PRO_GIT_RELEASE="@PRO_GIT_RELEASE@"
|
|
PRO_GIT_DATE="@PRO_GIT_DATE@"
|
|
|
|
dnl start: nDPI handling
|
|
AC_ARG_WITH(ndpi-static-lib,
|
|
[ --with-ndpi-static-lib=DIR Search the specified directory for nDPI static library],
|
|
[
|
|
if test -d $withval ; then :
|
|
AC_MSG_CHECKING(your own nDPI library)
|
|
if test -r $withval/libndpi.a; then
|
|
AC_MSG_RESULT(ok)
|
|
NDPI_CUST_LIB=$withval/libndpi.a
|
|
else
|
|
AC_MSG_RESULT(no)
|
|
AC_MSG_ERROR(ERROR: Unable to find custom nDPI static library in $withval)
|
|
fi
|
|
else
|
|
AC_MSG_ERROR(ERROR: Can't open custom nDPI static library directory $withval)
|
|
fi
|
|
])
|
|
AC_ARG_WITH(ndpi-includes,
|
|
[ --with-ndpi-includes=DIR Search the specified directory for nDPI header files],
|
|
[
|
|
if test ! -d $withval ; then :
|
|
AC_MSG_ERROR(ERROR: Can't open custom nDPI header files directory $withval)
|
|
fi
|
|
if test ! -r $withval/ndpi_main.h ; then :
|
|
AC_MSG_ERROR(ERROR: Can't read ndpi_main.h in custom nDPI header files directory $withval)
|
|
fi
|
|
NDPI_CUST_INC="-I$withval -I$withval/../lib/third_party/include"
|
|
])
|
|
|
|
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_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-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
|
|
|
|
|
|
pkg-config --exists libssl
|
|
if test "$?" -ne 1; then
|
|
AC_DEFINE_UNQUOTED(NO_SSL_DL, 1, [has openssl])
|
|
SSL_INC="`pkg-config --cflags libssl` -I/usr/include/openssl"
|
|
SSL_LIB="`pkg-config --libs libssl` -lssl -lcrypto"
|
|
else
|
|
dnl Workaround for MacOS Brew
|
|
if test -d "/usr/local/opt/openssl/lib"; then
|
|
AC_DEFINE_UNQUOTED(NO_SSL_DL, 1, [has openssl])
|
|
SSL_INC="-I/usr/local/opt/openssl/include"
|
|
SSL_LIB="-L/usr/local/opt/openssl/lib -lssl"
|
|
else
|
|
echo "Please install openssl-dev(el) package prerequisite"
|
|
exit -1
|
|
fi
|
|
fi
|
|
|
|
AC_MSG_CHECKING(for ntopng professional edition)
|
|
|
|
REDIS_SERVICE="redis.service"
|
|
if [ test -f /usr/bin/lsb_release ]; then
|
|
UBUNTU_RELEASE=`lsb_release -r|cut -f 2`
|
|
UBUNTU_SUB_RELEASE=`echo $UBUNTU_RELEASE|cut -f 1 -d '.'`
|
|
if test "$UBUNTU_SUB_RELEASE" = "8"; then
|
|
REDIS_SERVICE="redis-server.service"
|
|
fi
|
|
fi
|
|
|
|
SERVICE_ALIAS=
|
|
SERVICE_REQUIRES=${REDIS_SERVICE}
|
|
SERVICE_WANTS=
|
|
if test "$MACHINE" = "armv7l"; then
|
|
SERVICE_AFTER="network.target syslog.target ${REDIS_SERVICE}"
|
|
if test "${with_nedge+set}" = "set"; then
|
|
SERVICE_ALIAS="nedge.service"
|
|
fi
|
|
elif test "${with_nedge+set}" = "set"; then
|
|
SERVICE_AFTER="network-online.target syslog.target ${REDIS_SERVICE}"
|
|
SERVICE_REQUIRES="${SERVICE_REQUIRES} nedge_pinger.service"
|
|
SERVICE_ALIAS="nedge.service"
|
|
else
|
|
SERVICE_AFTER="network.target syslog.target ${REDIS_SERVICE} pf_ring.service cluster.service mysql.service"
|
|
SERVICE_WANTS="pf_ring.service cluster.service"
|
|
fi
|
|
|
|
APP=
|
|
if test "${with_nedge+set}" = "set"; then
|
|
APP=nedge
|
|
else
|
|
APP=ntopng
|
|
fi
|
|
|
|
if test -d "pro"; then :
|
|
AC_MSG_RESULT(yes)
|
|
PRO_OBJECTS='$(patsubst pro/%.cpp, pro/%.o, $(wildcard pro/*.cpp))'
|
|
|
|
if test "${with_nedge+set}" != set; then
|
|
if test $SYSTEM = "FreeBSD" || test $SYSTEM = "Darwin" || test $MACHINE = "armv7l" ; then
|
|
cd ../PF_RING/userland/nbpf; ./configure; make; cd -
|
|
|
|
dnl> nbpf for FreeBSD is linked statically
|
|
if test $SYSTEM != "FreeBSD"; then
|
|
LDFLAGS="${LDFLAGS} -L../PF_RING/userland/nbpf -lnbpf"
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
if test "${with_nedge+set}" != set; then
|
|
NINDEX_HOME=
|
|
if test -d "${HOME}/nIndex"; then
|
|
NINDEX_HOME=${HOME}/nIndex
|
|
else
|
|
if test -d "${PWD}/../nIndex"; then
|
|
NINDEX_HOME=${PWD}/../nIndex
|
|
fi
|
|
fi
|
|
|
|
if test -f "${NINDEX_HOME}/libnindex.a"; then
|
|
PRO_INCS="${PRO_INCS} -I ${NINDEX_HOME}/include"
|
|
PRO_LIBS="${PRO_LIBS} ${NINDEX_HOME}/libnindex.a ${NINDEX_HOME}/CRoaring/build/src/libroaring.a"
|
|
AC_DEFINE_UNQUOTED(HAVE_NINDEX, 1, [nIndex support is present])
|
|
echo "checking for nIndex... found on ${NINDEX_HOME}"
|
|
fi
|
|
fi
|
|
|
|
CFLAGS="${CFLAGS} -I../PF_RING/userland/nbpf"
|
|
PRO_HEADERS='$(wildcard pro/*.h)'
|
|
PRO_MAKEFILE_INC="include ./pro/inc.Makefile"
|
|
PWD=`pwd`
|
|
dnl> Remove heading spaces
|
|
AC_DEFINE_UNQUOTED(NTOPNG_PRO, 1, [Building ntopng professional])
|
|
AC_DEFINE_UNQUOTED(NTOPNG_PRO_GIT_RELEASE, "r${PRO_GIT_RELEASE}", [ntopng professional release])
|
|
AC_DEFINE_UNQUOTED(NTOPNG_PRO_GIT_DATE, "${PRO_GIT_DATE}", [ntopng professional date])
|
|
DUMMY=`cd ./pro; make build`
|
|
PRO_INCS="${PRO_INCS} -I${PWD}/pro -I${PWD}/pro/utils -I${PWD}/pro/third-party/libb64-1.2.1/include"
|
|
|
|
if test -r "../license/systemId.c"; then :
|
|
LICENSELIBS="-L`pwd`/../license -llicense"
|
|
AC_DEFINE_UNQUOTED(NTOPNG_PRO_HAVE_LICENSE, 1, [ntopng has license])
|
|
PRO_LIBS="${PRO_LIBS} ${LICENSELIBS}"
|
|
fi
|
|
else
|
|
AC_MSG_RESULT(not found)
|
|
fi
|
|
|
|
GIT_COMMITS=`git rev-list --all |wc -l | tr -d '[[:space:]]'`
|
|
AC_DEFINE_UNQUOTED(PACKAGE_REVISION, "${GIT_COMMITS}", [Package Revision])
|
|
|
|
AC_DEFINE_UNQUOTED(NTOPNG_GIT_RELEASE, "${GIT_BRANCH}:${GIT_RELEASE}", [GIT Release])
|
|
AC_DEFINE_UNQUOTED(NTOPNG_GIT_DATE, "${GIT_DATE}", [Last GIT change])
|
|
|
|
if test -z `which pkg-config`; then
|
|
echo "#!/bin/sh\n" > pkg-config
|
|
fi
|
|
|
|
if test -f ".git/index"; then
|
|
GIT_INDEX=".git/index"
|
|
fi
|
|
|
|
if test $SYSTEM = "Linux"; then
|
|
if test -f /etc/debian_version; then
|
|
DEBIAN_VERSION=`cat /etc/debian_version`
|
|
OSNAME="Debian $DEBIAN_VERSION"
|
|
else
|
|
OSNAME=`./config.guess`
|
|
fi
|
|
else
|
|
dnl> wget -O config.guess 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD'
|
|
OSNAME=`./config.guess`
|
|
fi
|
|
AC_DEFINE_UNQUOTED(PACKAGE_OSNAME, "${OSNAME}", [OS name])
|
|
|
|
if test $MACHINE = "x86_64"; then
|
|
EXTN="amd64"
|
|
else
|
|
if test $MACHINE = "i686"; then
|
|
EXTN="i386"
|
|
fi
|
|
fi
|
|
|
|
DATE=`date +"%Y-%m-%d"`
|
|
|
|
if test -d "/usr/include/hiredis"; then
|
|
AC_DEFINE_UNQUOTED(HAVE_HIREDIS, 1, [Local hiredis package present])
|
|
HIREDIS_INC="`pkg-config --cflags hiredis` -I/usr/include/hiredis"
|
|
HIREDIS_LIB="`pkg-config --libs hiredis` -lhiredis"
|
|
else
|
|
HIREDIS_INC="-I ${PWD}/third-party/hiredis"
|
|
fi
|
|
|
|
if test "${with_nedge+set}" != set; then
|
|
PF_RING_HOME=${HOME}/PF_RING
|
|
if test -d ${PF_RING_HOME}; then
|
|
AC_MSG_CHECKING(for PF_RING source installed in $PF_RING_HOME)
|
|
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
|
|
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"
|
|
if test -f "${PF_RING_HOME}/userland/libpcap/libpcap.a"; then
|
|
LDFLAGS="${LDFLAGS} ${PF_RING_HOME}/userland/lib/libpfring.a -L${PF_RING_HOME}/userland/libpcap/ `${PF_RING_HOME}/userland/lib/pfring_config --libs`"
|
|
CPPFLAGS="${CPPFLAGS} -I${PF_RING_HOME}/kernel -I${PF_RING_HOME}/userland/lib -I${PF_RING_HOME}/userland/libpcap"
|
|
echo "Using PF_RING installed in ${PF_RING_HOME}"
|
|
else
|
|
echo "Found PF_RING but the userland libs have not been compiled"
|
|
exit 1
|
|
fi
|
|
else
|
|
if test -d "/opt/pfring"; then
|
|
if test -f "/opt/pfring/lib/libpfring.a"; then
|
|
echo "/opt/pfring/lib/libpfring.a"
|
|
LDFLAGS="${LDFLAGS} /opt/pfring/lib/libpfring.a -L/opt/pfring/lib"
|
|
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
|
|
LDFLAGS="${LDFLAGS} /usr/local/lib/libpfring.a"
|
|
echo "Using PF_RING installed in /usr/local/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."
|
|
exit 1
|
|
fi
|
|
else
|
|
echo "Found /usr/local/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
|
|
fi
|
|
fi
|
|
else
|
|
LDFLAGS="${LDFLAGS} -lpfring -lpcap"
|
|
echo "Compiling ntopng with PF_RING support [${LDFLAGS}]"
|
|
fi
|
|
fi
|
|
else
|
|
AC_CHECK_LIB([pcap], [pcap_open_live], pcap=true)
|
|
if test x$pcap = x
|
|
then
|
|
echo "Please install libpcap(-dev) (http://tcpdump.org)"
|
|
exit 1
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
if test "${with_nedge+set}" != set; then
|
|
PFRING_GIT_RELEASE=""
|
|
if test -d $HOME/PF_RING; then
|
|
PFRING_GIT_RELEASE=`$HOME/PF_RING/package/version.sh --revision`
|
|
fi
|
|
|
|
PFRING_VERSION=""
|
|
if test -f "$HOME/PF_RING/kernel/linux/pf_ring.h"; then
|
|
PFRING_VERSION=`$HOME/PF_RING/package/version.sh --release`
|
|
fi
|
|
fi
|
|
|
|
AC_CHECK_LIB([cap], [cap_get_proc], cap=true)
|
|
if test x$cap != x
|
|
then
|
|
LDFLAGS="${LDFLAGS} -lcap"
|
|
AC_DEFINE([HAVE_LIBCAP],[1],[Support for privilege drop])
|
|
fi
|
|
|
|
if test "${with_nedge+set}" != set; then
|
|
AC_CHECK_LIB([ldap], [ldap_initialize], [LDFLAGS="${LDFLAGS} -lldap -llber"])
|
|
if test "x$ac_cv_lib_ldap_ldap_initialize" = xyes; then
|
|
AC_DEFINE_UNQUOTED(HAVE_LDAP, 1, [LDAP support is present])
|
|
fi
|
|
fi
|
|
|
|
UGLIFYJS=`which uglifyjs`
|
|
if test x$UGLIFYJS != x
|
|
then
|
|
UGLIFYJS_VERSION=`$UGLIFYJS --version | cut -f 2 -d" "`
|
|
UGLIFYJS_MAJOR_VERSION="${UGLIFYJS_VERSION%%.*}"
|
|
fi
|
|
|
|
AC_CHECK_LIB([rrd_th], [rrd_update_r], [LIBRRD_LD_FLAGS=-lrrd_th], [LIBRRD_LD_FLAGS=`pkg-config --libs librrd`])
|
|
|
|
AC_CHECK_LIB([nl], [nl_handle_alloc], [LDFLAGS="${LDFLAGS} -lnl"])
|
|
AC_CHECK_LIB([rt], [clock_gettime], [LDFLAGS="${LDFLAGS} -lrt"])
|
|
|
|
AC_CHECK_LIB([z], [zlibVersion], [LDFLAGS="${LDFLAGS} -lz"; AC_DEFINE_UNQUOTED(HAVE_ZLIB, 1, [zlib is present])])
|
|
|
|
dnl> ldl (used by edjdb)
|
|
AC_CHECK_LIB([dl], [dlopen], [LDFLAGS="${LDFLAGS} -ldl"])
|
|
|
|
AC_CHECK_LIB([curl], [curl_easy_perform], [LDFLAGS="${LDFLAGS} -lcurl"])
|
|
if test ${ac_cv_lib_curl_curl_easy_perform} = "no"; then
|
|
echo "Please install libcurl(-dev) (http://curl.haxx.se/)"
|
|
exit 1
|
|
else
|
|
dnl> libcurl has CURLOPT_MAIL_RCPT only starting at version 7.20.0
|
|
dnl> https://github.com/curl/curl/blob/curl-7_20_0/TODO-RELEASE
|
|
|
|
AC_MSG_CHECKING(for curl SMTP support)
|
|
if `pkg-config --atleast-version="7.20.0" libcurl` ; then
|
|
AC_DEFINE_UNQUOTED(HAVE_CURL_SMTP, 1, [curl supports SMTP])
|
|
AC_MSG_RESULT(yes)
|
|
else
|
|
AC_MSG_RESULT(no)
|
|
fi
|
|
fi
|
|
|
|
RPM_SIGN_CMD="rpm --addsign"
|
|
if test -f "/etc/centos-release"; then
|
|
CENTOS_RELEASE=`cat /etc/centos-release | cut -d ' ' -f 3|cut -d '.' -f 1`
|
|
if test $CENTOS_RELEASE = "release"; then
|
|
CENTOS_RELEASE=`cat /etc/centos-release | cut -d ' ' -f 4|cut -d '.' -f 1`
|
|
fi
|
|
|
|
if test "$CENTOS_RELEASE" -ne 8; then
|
|
RPM_SIGN_CMD="./packages/rpm-sign.exp"
|
|
fi
|
|
fi
|
|
|
|
CENTOS_N2N_DEP=""
|
|
CFLAGS="-Wall $CFLAGS"
|
|
OS=""
|
|
if test $SYSTEM = "Darwin"; then
|
|
dnl> https://github.com/google/sanitizers/wiki/AddressSanitizerFlags
|
|
CXX=clang++
|
|
dnl> CXX=clang++ -fsanitize=address -fsanitize-address-use-after-scope
|
|
OSXV=`sw_vers -productVersion`
|
|
OS="MacOSX $OSXV"
|
|
if test $MACHINE = "x86_64"; then
|
|
LINK_OPTS="-pagezero_size 10000 -image_base 100000000 -image_base 7fff04c4a000"
|
|
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
|
|
else
|
|
if test $SYSTEM = "Linux"; then
|
|
if [ test -f /etc/redhat-release ]; then
|
|
if [ test -f /usr/bin/lsb_release ]; then
|
|
dnl> CentOS 7
|
|
CENTOS_N2N_DEP=", n2n"
|
|
fi
|
|
else
|
|
if [ test -f /usr/bin/lsb_release ]; then
|
|
OS=`/usr/bin/lsb_release -d|cut -d ':' -f 2`
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
dnl> Remove spaces
|
|
OS="${OS#"${OS%%[![:space:]]*}"}"
|
|
|
|
AC_CHECK_LIB([maxminddb], [MMDB_lookup_sockaddr])
|
|
AC_HAVE_HEADERS(maxminddb.h)
|
|
if test ".${ac_cv_lib_maxminddb_MMDB_lookup_sockaddr}" = ".yes" &&
|
|
test ".${ac_cv_header_maxminddb_h}" = ".yes"; then
|
|
DOWNLOAD_GEOIP=1
|
|
MAXMINDDB_LIB=-lmaxminddb
|
|
AC_DEFINE_UNQUOTED(HAVE_MAXMINDDB, 1, [MaxMind DB support])
|
|
else
|
|
AC_MSG_RESULT(Please install libmaxminddb-dev (https://github.com/maxmind/libmaxminddb) and try again)
|
|
exit 1
|
|
fi
|
|
|
|
AC_CHECK_LIB([sqlite3], [sqlite3_open], sqlite=true)
|
|
if test x$sqlite = xtrue
|
|
then
|
|
AC_DEFINE_UNQUOTED([HAVE_SQLITE], 1, [We have sqlite])
|
|
SQLITE_LIB="-lsqlite3"
|
|
else
|
|
echo "SQLite 3.x missing (libsqlite3-dev): please install it and try again"
|
|
exit 1
|
|
fi
|
|
|
|
if test "${with_nedge+set}" != set; then
|
|
AC_CHECK_TOOL(MARIADB, mariadb_config)
|
|
if test "x$ac_cv_prog_ac_ct_MARIADB" = "xmariadb_config"; then
|
|
MYSQLTOOL="mariadb_config"
|
|
else
|
|
PATH=$PATH:/usr/local/mysql/bin
|
|
AC_CHECK_TOOL(MYSQL, mysql_config)
|
|
if test "x$ac_cv_prog_ac_ct_MYSQL" = "xmysql_config"; then
|
|
MYSQLTOOL="mysql_config"
|
|
else
|
|
MYSQLTOOL=""
|
|
fi
|
|
fi
|
|
|
|
if test -n "$MYSQLTOOL"; then
|
|
MYSQLLIBS="`$MYSQLTOOL --libs_r`"
|
|
if test ".$MYSQLLIBS" != "."; then
|
|
MYSQL_LIB="`$MYSQLTOOL --libs`"
|
|
else
|
|
MYSQL_LIB="`$MYSQLTOOL --libs_r`"
|
|
fi
|
|
|
|
MYSQL_INC="`$MYSQLTOOL --include`"
|
|
AC_DEFINE_UNQUOTED(HAVE_MYSQL, 1, [use mysql])
|
|
AC_CHECK_LIB([wrap], [main])
|
|
else
|
|
echo "MySQL libraries not found. Please install them as specified in README.compilation"
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
AC_CHECK_LIB([radcli], [rc_read_config], radcli=true)
|
|
if test x$radcli = xtrue
|
|
then
|
|
RADCLI_LIB="-lradcli"
|
|
AC_DEFINE_UNQUOTED(HAVE_RADIUS, 1, [RADIUS support is present])
|
|
|
|
AC_CHECK_LIB([radcli], [rc_test_config], rc_test_config=true)
|
|
if test x$rc_test_config = xtrue
|
|
then
|
|
AC_DEFINE_UNQUOTED(HAVE_RC_TEST_CONFIG, 1, [rc_test_config exists in radcli])
|
|
fi
|
|
fi
|
|
|
|
AC_CACHE_CHECK([if pthread rwlocks are supported], [my_cv_rw_locks_supported], [
|
|
AC_TRY_RUN([
|
|
#include <pthread.h>
|
|
|
|
int main() {
|
|
pthread_rwlock_t t;
|
|
return 0;
|
|
}
|
|
]
|
|
, [my_cv_rw_locks_supported=yes], [my_cv_rw_locks_supported=no])
|
|
]
|
|
)
|
|
|
|
if test "$my_cv_rw_locks_supported" = yes; then
|
|
AC_DEFINE_UNQUOTED(HAVE_RW_LOCK, 1, [pthread rwlocks supported])
|
|
fi
|
|
|
|
if test -f /usr/bin/lsb_release; then
|
|
LINUX_OS_RELEASE=`lsb_release -r | cut -f 2|cut -d '.' -f 1`
|
|
else
|
|
LINUX_OS_RELEASE=0
|
|
fi
|
|
|
|
if test "${with_nedge+set}" != set; then
|
|
if test $LINUX_OS_RELEASE -eq 7; then
|
|
MYSQL_DEP="mariadb-libs >= 5.5 tcp_wrappers-libs >= 7.6"
|
|
else
|
|
MYSQL_DEP="mysql-libs >= 5.1.0 tcp_wrappers-libs >= 7.6"
|
|
fi
|
|
fi
|
|
|
|
AC_DEFINE_UNQUOTED(_CRT_SECURE_NO_WARNINGS, 1, [Disable warning on windows])
|
|
|
|
GMAKE=`which gmake`
|
|
if test x$GMAKE = x
|
|
then
|
|
GMAKE="make"
|
|
fi
|
|
|
|
GIT=`which git`
|
|
if test x$GIT = x
|
|
then
|
|
AC_MSG_RESULT(FATAL ERROR: git is not installed on your host)
|
|
fi
|
|
|
|
WGET=`which wget`
|
|
if test x$WGET = x
|
|
then
|
|
AC_MSG_RESULT(ERROR. wget is not installed on your host: you cannot download GeoIP data)
|
|
fi
|
|
|
|
umask 002
|
|
|
|
INSTALL_DIR=${prefix}
|
|
if test $INSTALL_DIR = "NONE"
|
|
then
|
|
INSTALL_DIR=${ac_default_prefix}
|
|
fi
|
|
|
|
if test $SYSTEM = "Darwin"; then
|
|
MAN_DIR=$INSTALL_DIR/share/man
|
|
else
|
|
MAN_DIR=$INSTALL_DIR/man
|
|
fi
|
|
|
|
if test $SYSTEM = "OpenBSD"; then
|
|
INSTALL_DIR=${prefix}
|
|
MAN_DIR=${prefix}
|
|
fi
|
|
|
|
AC_DEFINE_UNQUOTED(PACKAGE_RELEASE, "r$GIT_RELEASE", [GIT release of this package])
|
|
AC_DEFINE_UNQUOTED(PACKAGE_MACHINE, "$MACHINE", [Architecture of this host])
|
|
AC_DEFINE_UNQUOTED(PACKAGE_OS, "${OS}", [OS Name])
|
|
AC_SUBST(PWD)
|
|
AC_SUBST(MACHINE)
|
|
AC_SUBST(SYSTEM)
|
|
AC_SUBST(EXTN)
|
|
AC_SUBST(DATE)
|
|
AC_SUBST(KERNEL)
|
|
AC_SUBST(GIT_RELEASE)
|
|
AC_SUBST(LINK_OPTS)
|
|
AC_SUBST(SQLITE_LIB)
|
|
AC_SUBST(GMAKE)
|
|
AC_SUBST(GPP)
|
|
AC_SUBST(CXX)
|
|
AC_SUBST(CFLAGS)
|
|
AC_SUBST(CXXFLAGS)
|
|
AC_SUBST(CPPFLAGS)
|
|
AC_SUBST(LDFLAGS)
|
|
AC_SUBST(PACKAGE_VERSION)
|
|
AC_SUBST(NTOPNG_VERSION)
|
|
AC_SUBST(NTOPNG_SHORT_VERSION)
|
|
AC_SUBST(GIT_RELEASE)
|
|
AC_SUBST(GIT_DATE)
|
|
AC_SUBST(GIT_INDEX)
|
|
AC_SUBST(INSTALL_DIR)
|
|
AC_SUBST(MAN_DIR)
|
|
AC_SUBST(NDPI_HOME)
|
|
AC_SUBST(NDPI_INC)
|
|
AC_SUBST(NDPI_LIB)
|
|
AC_SUBST(NDPI_LIB_DEP)
|
|
AC_SUBST(HIREDIS_INC)
|
|
AC_SUBST(HIREDIS_LIB)
|
|
AC_SUBST(MAXMINDDB_LIB)
|
|
AC_SUBST(RADCLI_LIB)
|
|
AC_SUBST(SSL_INC)
|
|
AC_SUBST(SSL_LIB)
|
|
AC_SUBST(PRO_OBJECTS)
|
|
AC_SUBST(PRO_HEADERS)
|
|
AC_SUBST(PRO_MAKEFILE_INC)
|
|
AC_SUBST(PRO_LIBS)
|
|
AC_SUBST(PRO_INCS)
|
|
AC_SUBST(REVISION)
|
|
AC_SUBST(MYSQL_LIB)
|
|
AC_SUBST(MYSQL_INC)
|
|
AC_SUBST(MYSQL_DEP)
|
|
AC_SUBST(JSON_INC)
|
|
AC_SUBST(JSON_LIB)
|
|
AC_SUBST(PFRING_GIT_RELEASE)
|
|
AC_SUBST(PFRING_VERSION)
|
|
AC_SUBST(NEDGE)
|
|
AC_SUBST(UGLIFYJS_MAJOR_VERSION)
|
|
AC_SUBST(SERVICE_AFTER)
|
|
AC_SUBST(SERVICE_REQUIRES)
|
|
AC_SUBST(SERVICE_WANTS)
|
|
AC_SUBST(SERVICE_ALIAS)
|
|
AC_SUBST(APP)
|
|
AC_SUBST(CENTOS_N2N_DEP)
|
|
AC_SUBST(RPM_SIGN_CMD)
|
|
AC_SUBST(LIBRRD_LD_FLAGS)
|
|
AC_CONFIG_HEADERS(include/config.h)
|
|
AC_CONFIG_FILES(packages/ntopng.spec)
|
|
AC_CONFIG_FILES(packages/ntopng-data.spec)
|
|
AC_CONFIG_FILES(Makefile)
|
|
AC_CONFIG_FILES(tools/json2tlv/Makefile)
|
|
AC_CONFIG_FILES(doc/doxygen.conf)
|
|
AC_CONFIG_FILES(httpdocs/misc/ntopng-utils-manage-config)
|
|
AC_CONFIG_FILES(packages/etc/systemd/system/ntopng.service)
|
|
|
|
AC_OUTPUT
|
|
|
|
if test -f "httpdocs/misc/ntopng-utils-manage-config"; then
|
|
chmod +x httpdocs/misc/ntopng-utils-manage-config
|
|
fi
|
|
|
|
echo ""
|
|
echo "You are now ready to compile typing $GMAKE"
|
|
|
|
if test "$DOWNLOAD_GEOIP" = "1"
|
|
then
|
|
if ! test -f "./httpdocs/geoip/GeoLite2-ASN.mmdb"; then
|
|
echo "Please do not forget to download GeoIP databases doing: $GMAKE geoip"
|
|
fi
|
|
fi
|
|
|
|
dnl>
|
|
dnl> ntopng release history
|
|
dnl>
|
|
dnl> 0.1 r6089 2013-03-25
|
|
dnl> 1.0 r6533 2013-06-30
|
|
dnl> 1.1 r6929 2013-11-03
|
|
dnl> 1.2 r8114 2014-08-13
|
|
dnl> 1.2.1 r8202 2014-09-06
|
|
dnl> 2.0 2015-06-01
|
|
dnl> 2.2 2015-11-30
|
|
dnl> 2.4 2016-06-27
|
|
dnl> 3.0 2017-06-01
|