forked from max197616/extfilter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
199 lines (157 loc) · 4.85 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT(extFilter, 0.86.1, [email protected])
DPDK_HOME=
DPDK_TARGET=
PEAFOWL_HOME=./peafowl
AM_INIT_AUTOMAKE()
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(no)])
AC_CONFIG_SRCDIR([src/main.cpp])
AC_CONFIG_HEADERS([include/config.h])
AC_LANG([C++])
AC_LANG_PUSH([C++])
# store current user given compiler flags to avoid default setup via AC_PROG_CXX
OLD_CXXFLAGS=$CXXFLAGS
OLD_CFLAGS=$CFLAGS
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
CXXFLAGS=$OLD_CXXFLAGS
CFLAGS=$OLD_CFLAGS
CFLAGS="$CFLAGS --pedantic -Wall -O2"
AC_ARG_ENABLE(debug,
AS_HELP_STRING(
[--enable-debug],
[enable debugging, default: no]),
[case "${enableval}" in
yes) debug=true ;;
no) debug=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
esac],
[debug=false])
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"
else
CXXFLAGS="$CXXFLAGS -std=c++11 -O3 -Wall -fno-stack-protector -pthread -msse -msse2 -msse3 -mssse3 -march=native"
fi
AC_COMPILE_IFELSE([AC_LANG_SOURCE(
[[template <typename T>
struct check
{
static_assert(sizeof(int) <= sizeof(T), "not big enough");
};
typedef check<check<bool>> right_angle_brackets;
int a;
decltype(a) b;
typedef check<int> check_type;
check_type c;
check_type&& cr = static_cast<check_type&&>(c);]])],,
AC_MSG_FAILURE(['$CXX $CXXFLAGS' does not accept ISO C++11]))
# Checks for libraries.
# Checks for header files.
AC_CHECK_HEADERS([netinet/in.h stdint.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_HEADER_STDBOOL
# Checks for library functions.
AC_FUNC_ERROR_AT_LINE
AC_CHECK_FUNCS([strerror])
# Check for methods in library and check for header files
AC_CHECK_HEADERS([Poco/Foundation.h Poco/Net/HTTPCookie.h Poco/Util/Timer.h],
[],
AC_MSG_ERROR([Poco include files not found.])
)
AC_CHECK_LIB([PocoFoundation],[main],[HAVE_POCOFOUNDATION=1],AC_MSG_ERROR([PocoFoundation library not found.]))
if test "$HAVE_POCOFOUNDATION"; then
save_libs="${LIBS}"
LIBS="-lPocoFoundation"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[#include "Poco/UnicodeConverter.h"],
[std::wstring wstr; Poco::UnicodeConverter::toUTF16("hello", wstr);]
)],
[LIBS="$LIBS $save_libs"],
[AC_MSG_ERROR([linking with PocoFoundation failed.])]
)
fi
AC_CHECK_LIB([PocoUtil],[main],[HAVE_POCOUTIL=1],AC_MSG_ERROR([PocoUtil library not found.]))
if test "$HAVE_POCOUTIL"; then
save_libs="${LIBS}"
LIBS="-lPocoUtil"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[#include "Poco/Util/Option.h"],
[Poco::Util::Option();]
)],
[LIBS="$LIBS $save_libs"],
[AC_MSG_ERROR([linking with PocoUtil failed.])]
)
fi
AC_CHECK_LIB([PocoNet],[main],[HAVE_POCONET=1],AC_MSG_ERROR([PocoNet library not found.]))
if test "$HAVE_POCONET"; then
save_libs="${LIBS}"
LIBS="-lPocoNet"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[#include "Poco/Net/HTTPClientSession.h"],
[Poco::Net::HTTPClientSession();]
)],
[LIBS="$LIBS $save_libs"],
[AC_MSG_ERROR([linking with PocoNET failed.])]
)
fi
AC_ARG_WITH(
[dpdk_home],
AS_HELP_STRING(
[--with-dpdk_home=DIR],
[Path to DPDK library]
),
[DPDK_HOME="$withval"]
)
AC_ARG_WITH(
[dpdk_target],
AS_HELP_STRING(
[--with-dpdk_target=target],
[DPDK target]
),
[DPDK_TARGET="$withval"]
)
if test -z "$DPDK_TARGET"; then
AC_MSG_ERROR([dpdk_target must be set])
fi
if test -z "$DPDK_HOME"; then
AC_MSG_ERROR([dpdk_home must be set])
fi
AC_SUBST(DPDK_LIB,$DPDK_HOME/$DPDK_TARGET/lib)
AC_SUBST(DPDK_INCLUDE,$DPDK_HOME/$DPDK_TARGET/include)
dnl peafowl checks...
AC_MSG_CHECKING(for peafowl $PEAFOWL_HOME)
if test -d "$PEAFOWL_HOME" ; then :
AC_MSG_RESULT(found in $PEAFOWL_HOME)
else
AC_MSG_RESULT(not found)
AC_MSG_NOTICE(Getting peafowl from git)
git clone https://github.com/max197616/Peafowl.git $PEAFOWL_HOME
AC_MSG_CHECKING(for peafowl $PEAFOWL_HOME)
if test -d "$PEAFOWL_HOME" ; then :
AC_MSG_RESULT(found in $PEAFOWL_HOME)
else
AC_MSG_ERROR(Install peafowl manually)
fi
fi
PEAFOWL_LIB=$PEAFOWL_HOME/lib/libdpi.a
AC_MSG_CHECKING(for $PEAFOWL_LIB)
if test -f "$PEAFOWL_LIB" ; then :
else
AC_MSG_RESULT([not found, compiling...])
cd $PEAFOWL_HOME; make; cd -
if test -f "$PEAFOWL_LIB" ; then :
else
AC_MSG_ERROR([Peafowl library not found!])
fi
fi
AC_MSG_RESULT(yes)
AC_SUBST(PEAFOWL_INCLUDE, $PEAFOWL_HOME/src)
AC_SUBST(PEAFOWL_LIB, $PEAFOWL_LIB)
AC_OUTPUT(Makefile src/Makefile include/Makefile)