-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
3,577 additions
and
1,328 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,13 +2,15 @@ | |
# Process this file with autoconf to produce a configure script. | ||
|
||
AC_PREREQ([2.69]) | ||
AC_INIT(extFilter, 0.89, [email protected]) | ||
AC_INIT(extFilter, 0.95, [email protected]) | ||
|
||
DPDK_HOME= | ||
DPDK_TARGET= | ||
|
||
PEAFOWL_HOME=./peafowl | ||
|
||
MARISA_HOME=./marisa | ||
|
||
AM_INIT_AUTOMAKE() | ||
|
||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(no)]) | ||
|
@@ -47,9 +49,9 @@ AC_MSG_CHECKING([for debug enabled]) | |
|
||
|
||
if test x"$debug" = x"true"; then | ||
CXXFLAGS="$CXXFLAGS -std=c++11 -O0 -g -Wall -pthread -msse -msse2 -msse3 -mssse3" | ||
CXXFLAGS="$CXXFLAGS -std=c++11 -O0 -g -Wall -pthread" | ||
else | ||
CXXFLAGS="$CXXFLAGS -std=c++11 -O3 -Wall -fno-stack-protector -pthread -msse -msse2 -msse3 -mssse3 -march=native" | ||
CXXFLAGS="$CXXFLAGS -std=c++11 -O3 -Wall -fno-stack-protector -pthread" | ||
fi | ||
|
||
AC_COMPILE_IFELSE([AC_LANG_SOURCE( | ||
|
@@ -70,6 +72,243 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE( | |
AC_MSG_FAILURE(['$CXX $CXXFLAGS' does not accept ISO C++11])) | ||
|
||
|
||
# Macros for SSE availability check. | ||
AC_DEFUN([EXTFILTER_ENABLE_SSE2], | ||
[AC_EGREP_CPP([yes], [ | ||
#ifdef __SSE2__ | ||
yes | ||
#endif | ||
], [enable_sse2="yes"], [enable_sse2="no"])]) | ||
AC_DEFUN([EXTFILTER_ENABLE_SSE3], | ||
[AC_EGREP_CPP([yes], [ | ||
#ifdef __SSE3__ | ||
yes | ||
#endif | ||
], [enable_sse3="yes"], [enable_sse3="no"])]) | ||
AC_DEFUN([EXTFILTER_ENABLE_SSSE3], | ||
[AC_EGREP_CPP([yes], [ | ||
#ifdef __SSSE3__ | ||
yes | ||
#endif | ||
], [enable_ssse3="yes"], [enable_ssse3="no"])]) | ||
AC_DEFUN([EXTFILTER_ENABLE_SSE4_1], | ||
[AC_EGREP_CPP([yes], [ | ||
#ifdef __SSE4_1__ | ||
yes | ||
#endif | ||
], [enable_sse4_1="yes"], [enable_sse4_1="no"])]) | ||
AC_DEFUN([EXTFILTER_ENABLE_SSE4_2], | ||
[AC_EGREP_CPP([yes], [ | ||
#ifdef __SSE4_2__ | ||
yes | ||
#endif | ||
], [enable_sse4_2="yes"], [enable_sse4_2="no"])]) | ||
AC_DEFUN([EXTFILTER_ENABLE_SSE4], | ||
[AC_EGREP_CPP([yes], [ | ||
#if defined(__POPCNT__) && defined(__SSE4_2__) | ||
yes | ||
#endif | ||
], [enable_sse4="yes"], [enable_sse4="no"])]) | ||
AC_DEFUN([EXTFILTER_ENABLE_SSE4A], | ||
[AC_EGREP_CPP([yes], [ | ||
#ifdef __SSE4A__ | ||
yes | ||
#endif | ||
], [enable_sse4a="yes"], [enable_sse4a="no"])]) | ||
AC_DEFUN([EXTFILTER_ENABLE_AVX], | ||
[AC_EGREP_CPP([yes], [ | ||
#ifdef __AVX__ | ||
yes | ||
#endif | ||
], [enable_avx="yes"], [enable_avx="no"])]) | ||
AC_DEFUN([EXTFILTER_ENABLE_AVX2], | ||
[AC_EGREP_CPP([yes], [ | ||
#ifdef __AVX2__ | ||
yes | ||
#endif | ||
], [enable_avx2="yes"], [enable_avx2="no"])]) | ||
|
||
|
||
AC_DEFUN([EXTFILTER_ENABLE_POPCNT], | ||
[AC_EGREP_CPP([yes], [ | ||
#ifdef __POPCNT__ | ||
yes | ||
#endif | ||
], [enable_popcnt="yes"], [enable_popcnt="no"])]) | ||
|
||
# Enable native cpu instructions. | ||
AC_MSG_CHECKING([whether to enable optimization for native cpu]) | ||
AC_ARG_ENABLE([native-code], | ||
[AS_HELP_STRING([--enable-native-code], | ||
[generate instructions for native cpu [default=no]])], | ||
[], | ||
[enable_native_code="no"]) | ||
AS_IF([test "x${enable_native_code}" != "xno"], [ | ||
CFLAGS="$CPPFLAGS -march=native -mtune=native" | ||
CPPFLAGS="$CPPFLAGS -march=native -mtune=native" | ||
CXXFLAGS="$CXXFLAGS -march=native -mtune=native" | ||
EXTFILTER_ENABLE_SSE2 | ||
EXTFILTER_ENABLE_SSE3 | ||
EXTFILTER_ENABLE_SSE4_1 | ||
EXTFILTER_ENABLE_SSE4_2 | ||
EXTFILTER_ENABLE_SSE4 | ||
EXTFILTER_ENABLE_SSE4A | ||
EXTFILTER_ENABLE_AVX | ||
EXTFILTER_ENABLE_AVX2 | ||
EXTFILTER_ENABLE_POPCNT | ||
]) | ||
AC_MSG_RESULT([${enable_native_code}]) | ||
|
||
# Checks for SSE availability. | ||
AC_MSG_CHECKING([whether to use SSE2]) | ||
AC_ARG_ENABLE([sse2], | ||
[AS_HELP_STRING([--enable-sse2], | ||
[use SSE2 [default=no]])], | ||
[], | ||
[enable_sse2="no"]) | ||
AS_IF([test "x${enable_sse2}" != "xno"], [EXTFILTER_ENABLE_SSE2]) | ||
AC_MSG_RESULT([${enable_sse2}]) | ||
|
||
AC_MSG_CHECKING([whether to use SSE3]) | ||
AC_ARG_ENABLE([sse3], | ||
[AS_HELP_STRING([--enable-sse3], | ||
[use SSE3 [default=no]])], | ||
[], | ||
[enable_sse3="no"]) | ||
AS_IF([test "x${enable_sse3}" != "xno"], [EXTFILTER_ENABLE_SSE3]) | ||
AC_MSG_RESULT([${enable_sse3}]) | ||
|
||
AC_MSG_CHECKING([whether to use SSSE3]) | ||
AC_ARG_ENABLE([ssse3], | ||
[AS_HELP_STRING([--enable-ssse3], | ||
[use SSSE3 [default=no]])], | ||
[], | ||
[enable_ssse3="no"]) | ||
AS_IF([test "x${enable_ssse3}" != "xno"], [EXTFILTER_ENABLE_SSSE3]) | ||
AC_MSG_RESULT([${enable_ssse3}]) | ||
|
||
AC_MSG_CHECKING([whether to use SSE4.1]) | ||
AC_ARG_ENABLE([sse4.1], | ||
[AS_HELP_STRING([--enable-sse4.1], | ||
[use SSE4.1 [default=no]])], | ||
[], | ||
[enable_sse4_1="no"]) | ||
AS_IF([test "x${enable_sse4_1}" != "xno"], [EXTFILTER_ENABLE_SSE4_1]) | ||
AC_MSG_RESULT([${enable_sse4_1}]) | ||
|
||
AC_MSG_CHECKING([whether to use SSE4.2]) | ||
AC_ARG_ENABLE([sse4.2], | ||
[AS_HELP_STRING([--enable-sse4.2], | ||
[use SSE4.2 [default=no]])], | ||
[], | ||
[enable_sse4_2="no"]) | ||
AS_IF([test "x${enable_sse4_2}" != "xno"], [EXTFILTER_ENABLE_SSE4_2]) | ||
AC_MSG_RESULT([${enable_sse4_2}]) | ||
|
||
AC_MSG_CHECKING([whether to use SSE4]) | ||
AC_ARG_ENABLE([sse4], | ||
[AS_HELP_STRING([--enable-sse4], | ||
[use SSE4 [default=no]])], | ||
[], | ||
[enable_sse4="no"]) | ||
AS_IF([test "x${enable_sse4}" != "xno"], [EXTFILTER_ENABLE_SSE4]) | ||
AC_MSG_RESULT([${enable_sse4}]) | ||
|
||
AC_MSG_CHECKING([whether to use SSE4a]) | ||
AC_ARG_ENABLE([sse4a], | ||
[AS_HELP_STRING([--enable-sse4a], | ||
[use SSE4a [default=no]])], | ||
[], | ||
[enable_sse4a="no"]) | ||
AS_IF([test "x${enable_sse4a}" != "xno"], [EXTFILTER_ENABLE_SSE4A]) | ||
AC_MSG_RESULT([${enable_sse4a}]) | ||
|
||
AC_MSG_CHECKING([whether to use AVX]) | ||
AC_ARG_ENABLE([avx], | ||
[AS_HELP_STRING([--enable-avx], | ||
[use AVX [default=no]])], | ||
[], | ||
[enable_avx="no"]) | ||
AS_IF([test "x${enable_avx}" != "xno"], [EXTFILTER_ENABLE_AVX]) | ||
AC_MSG_RESULT([${enable_avx}]) | ||
|
||
AC_MSG_CHECKING([whether to use AVX2]) | ||
AC_ARG_ENABLE([avx2], | ||
[AS_HELP_STRING([--enable-avx2], | ||
[use AVX2 [default=no]])], | ||
[], | ||
[enable_avx2="no"]) | ||
AS_IF([test "x${enable_avx2}" != "xno"], [EXTFILTER_ENABLE_AVX2]) | ||
AC_MSG_RESULT([${enable_avx2}]) | ||
|
||
AC_MSG_CHECKING([whether to use popcnt]) | ||
AC_ARG_ENABLE([popcnt], | ||
[AS_HELP_STRING([--enable-popcnt], | ||
[use POPCNT [default=no]])], | ||
[], | ||
[enable_popcnt="no"]) | ||
AS_IF([test "x${enable_popcnt}" != "xno"], [EXTFILTER_ENABLE_POPCNT]) | ||
AC_MSG_RESULT([${enable_popcnt}]) | ||
|
||
|
||
|
||
AS_IF([test "x${enable_popcnt}" != "xno"], [ | ||
enable_sse3="yes" | ||
]) | ||
|
||
AS_IF([test "x${enable_avx2}" != "xno"], [ | ||
enable_popcnt="yes" | ||
enable_avx2="yes" | ||
]) | ||
AS_IF([test "x${enable_avx}" != "xno"], [ | ||
enable_popcnt="yes" | ||
enable_avx="yes" | ||
]) | ||
AS_IF([test "x${enable_sse4a}" != "xno"], [ | ||
enable_popcnt="yes" | ||
enable_sse3="yes" | ||
]) | ||
AS_IF([test "x${enable_sse4}" != "xno"], [ | ||
enable_popcnt="yes" | ||
enable_sse4_2="yes" | ||
]) | ||
AS_IF([test "x${enable_sse4_2}" != "xno"], [ | ||
enable_popcnt="yes" | ||
enable_sse4_1="yes" | ||
]) | ||
AS_IF([test "x${enable_sse4_1}" != "xno"], [ | ||
enable_ssse3="yes" | ||
]) | ||
AS_IF([test "x${enable_ssse3}" != "xno"], [ | ||
enable_sse3="yes" | ||
]) | ||
AS_IF([test "x${enable_sse3}" != "xno"], [ | ||
enable_sse2="yes" | ||
]) | ||
|
||
AS_IF([test "x${enable_popcnt}" != "xno"], [ | ||
CXXFLAGS="$CXXFLAGS -mpopcnt" | ||
]) | ||
|
||
if test "x${enable_avx2}" != "xno"; then | ||
CXXFLAGS="$CXXFLAGS -mavx2" | ||
elif test "x${enable_avx}" != "xno"; then | ||
CXXFLAGS="$CXXFLAGS -mavx" | ||
elif test "x${enable_sse4a}" != "xno"; then | ||
CXXFLAGS="$CXXFLAGS -msse4a" | ||
elif test "x${enable_sse4}" != "xno"; then | ||
CXXFLAGS="$CXXFLAGS -msse4" | ||
elif test "x${enable_sse4_2}" != "xno"; then | ||
CXXFLAGS="$CXXFLAGS -msse4.2" | ||
elif test "x${enable_sse4_1}" != "xno"; then | ||
CXXFLAGS="$CXXFLAGS -msse4.1" | ||
elif test "x${enable_ssse3}" != "xno"; then | ||
CXXFLAGS="$CXXFLAGS -mssse3" | ||
elif test "x${enable_sse3}" != "xno"; then | ||
CXXFLAGS="$CXXFLAGS -msse3" | ||
elif test "x${enable_sse2}" != "xno"; then | ||
CXXFLAGS="$CXXFLAGS -msse2" | ||
fi | ||
|
||
|
||
# Checks for libraries. | ||
|
@@ -196,4 +435,43 @@ AC_MSG_RESULT(yes) | |
AC_SUBST(PEAFOWL_INCLUDE, $PEAFOWL_HOME/src) | ||
AC_SUBST(PEAFOWL_LIB, $PEAFOWL_LIB) | ||
|
||
MARISA_LIB=$MARISA_HOME/lib/marisa/.libs/libmarisa.a | ||
AC_MSG_CHECKING(for $MARISA_LIB) | ||
if test -f "$MARISA_LIB" ; then : | ||
|
||
else | ||
AC_MSG_RESULT([not found, compiling...]) | ||
cd $MARISA_HOME; autoreconf -i; ./configure --enable-native-code; make; cd - | ||
if test -f "$MARISA_LIB" ; then : | ||
|
||
else | ||
AC_MSG_ERROR([Marisa-trie library not found!]) | ||
fi | ||
fi | ||
AC_MSG_RESULT(yes) | ||
|
||
AC_SUBST(MARISA_INCLUDE, $MARISA_HOME/include) | ||
AC_SUBST(MARISA_LIB, $MARISA_LIB) | ||
|
||
AC_OUTPUT(Makefile src/Makefile include/Makefile) | ||
|
||
AS_ECHO([]) | ||
AS_ECHO(["${PACKAGE_NAME} ${PACKAGE_VERSION} configuration:"]) | ||
AS_ECHO(["-------------------------------"]) | ||
AS_ECHO([" HOST: ${HOST}"]) | ||
AS_ECHO([" CXX: ${CXX}"]) | ||
AS_ECHO([" CXXFLAGS: ${CXXFLAGS}"]) | ||
AS_ECHO([" LDFLAGS: ${LDFLAGS}"]) | ||
AS_ECHO([" PREFIX: ${prefix}"]) | ||
AS_ECHO([]) | ||
AS_ECHO([" NATIVE: ${enable_native_code}"]) | ||
AS_ECHO([" SSE2: ${enable_sse2}"]) | ||
AS_ECHO([" SSE3: ${enable_sse3}"]) | ||
AS_ECHO([" SSSE3: ${enable_ssse3}"]) | ||
AS_ECHO([" SSE4.1: ${enable_sse4_1}"]) | ||
AS_ECHO([" SSE4.2: ${enable_sse4_2}"]) | ||
AS_ECHO([" SSE4a: ${enable_sse4a}"]) | ||
AS_ECHO([" AVX: ${enable_avx}"]) | ||
AS_ECHO([" AVX2: ${enable_avx2}"]) | ||
AS_ECHO([" POPCNT: ${enable_popcnt}"]) | ||
AS_ECHO([]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
|
||
noinst_HEADERS = main.h worker.h AhoCorasickPlus.h actypes.h ahocorasick.h node.h statistictask.h sender.h sendertask.h stats.h reloadtask.h flow.h dtypes.h replace.h mpool.h dpdk.h acl.h cmdlinetask.h notification.h dpi.h | ||
noinst_HEADERS = main.h worker.h statistictask.h sender.h sendertask.h stats.h reloadtask.h flow.h dtypes.h dpdk.h acl.h cmdlinetask.h notification.h tries.h cfg.h utils.h http.h params.h arr.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,21 @@ | ||
/* | ||
* | ||
* Copyright (C) Max <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
#pragma once | ||
|
||
#include <Poco/Logger.h> | ||
|
Oops, something went wrong.