forked from max197616/nfqfilter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
133 lines (103 loc) · 3.51 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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT(nfqfilter, 0.1, max1976@mail.ru)
AM_INIT_AUTOMAKE
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++0x -O2 -g -Wall"
else
CXXFLAGS="$CXXFLAGS -std=c++0x -O2"
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_CHECK_LIB([netfilter_queue], [nfq_open],,AC_MSG_ERROR([Netfilter_queue library not found!]))
AC_CHECK_LIB([nfnetlink], [nfnl_fd],,AC_MSG_ERROR([Nfnetlink library not found!]))
AC_CHECK_LIB([ndpi], [ndpi_init_detection_module],,AC_MSG_ERROR([nDPI library not found!]))
AC_OUTPUT(Makefile src/Makefile include/Makefile)