-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
207 lines (166 loc) · 6.46 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
200
201
202
203
204
205
206
207
AC_INIT([nftables], [1.0.9], [[email protected]])
AC_DEFINE([RELEASE_NAME], ["Old Doc Yak #3"], [Release name])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([-Wall foreign subdir-objects
tar-pax no-dist-gzip dist-xz 1.6])
dnl kernel style compile messages
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_CONFIG_HEADERS([config.h])
AC_ARG_ENABLE([debug],
AS_HELP_STRING([--disable-debug], [Disable debugging symbols]),
[], [enable_debug=yes])
AM_CONDITIONAL([BUILD_DEBUG], [test "x$enable_debug" != xno])
AC_ARG_ENABLE([man-doc],
AS_HELP_STRING([--disable-man-doc], [Disable man page documentation]),
[], [enable_man_doc=yes])
AM_CONDITIONAL([BUILD_MAN], [test "x$enable_man_doc" = "xyes" ])
# Checks for programs.
AC_PROG_CC
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_MKDIR_P
AC_PROG_INSTALL
AC_PROG_SED
AC_PROG_LEX([noyywrap])
AC_PROG_YACC
if test -z "$ac_cv_prog_YACC" -a ! -f "${srcdir}/src/parser_bison.c"
then
echo "*** Error: No suitable bison/yacc found. ***"
echo " Please install the 'bison' package."
exit 1
fi
if test -z "$ac_cv_prog_LEX" -a ! -f "${srcdir}/src/scanner.c"
then
echo "*** Error: No suitable flex/lex found. ***"
echo " Please install the 'flex' package."
exit 1
fi
AM_PROG_AR
LT_INIT([disable-static])
AC_EXEEXT
CHECK_GCC_FVISIBILITY
AS_IF([test "x$enable_man_doc" = "xyes"], [
AC_CHECK_PROG(A2X, [a2x], [a2x], [no])
AS_IF([test "$A2X" = "no" -a ! -f "${srcdir}/doc/nft.8"],
[AC_MSG_ERROR([a2x not found, please install asciidoc])])
])
PKG_CHECK_MODULES([LIBMNL], [libmnl >= 1.0.4])
PKG_CHECK_MODULES([LIBNFTNL], [libnftnl >= 1.2.6])
AC_ARG_WITH([mini-gmp], [AS_HELP_STRING([--with-mini-gmp],
[Use builtin mini-gmp (for embedded builds)])],
[], [with_mini_gmp=no])
AS_IF([test "x$with_mini_gmp" != xyes], [
AC_CHECK_LIB([gmp],[__gmpz_init], , AC_MSG_ERROR([No suitable version of libgmp found]))
])
AM_CONDITIONAL([BUILD_MINIGMP], [test "x$with_mini_gmp" = xyes])
AC_ARG_WITH([cli], [AS_HELP_STRING([--without-cli],
[disable interactive CLI (libreadline, editline or linenoise support)])],
[], [with_cli=editline])
AS_IF([test "x$with_cli" = xreadline], [
AC_CHECK_LIB([readline], [readline], ,
AC_MSG_ERROR([No suitable version of libreadline found]))
AC_DEFINE([HAVE_LIBREADLINE], [1], [])
],
[test "x$with_cli" = xlinenoise], [
AC_CHECK_LIB([linenoise], [linenoise], ,
AC_MSG_ERROR([No suitable version of linenoise found]))
AC_DEFINE([HAVE_LIBLINENOISE], [1], [])
],
[test "x$with_cli" = xeditline], [
AC_CHECK_LIB([edit], [readline], ,
AC_MSG_ERROR([No suitable version of libedit found]))
AC_DEFINE([HAVE_LIBEDIT], [1], [])
],
[test "x$with_cli" != xno], [
AC_MSG_ERROR([unexpected CLI value: $with_cli])
])
AM_CONDITIONAL([BUILD_CLI], [test "x$with_cli" != xno])
AC_ARG_WITH([xtables], [AS_HELP_STRING([--with-xtables],
[Use libxtables for iptables interaction])],
[], [with_xtables=no])
AS_IF([test "x$with_xtables" != xno], [
PKG_CHECK_MODULES([XTABLES], [xtables >= 1.6.1])
AC_DEFINE([HAVE_LIBXTABLES], [1], [0])
])
AM_CONDITIONAL([BUILD_XTABLES], [test "x$with_xtables" = xyes])
AC_ARG_WITH([json], [AS_HELP_STRING([--with-json],
[Enable JSON output support])],
[], [with_json=no])
AS_IF([test "x$with_json" != xno], [
AC_CHECK_LIB([jansson], [json_object], ,
AC_MSG_ERROR([No suitable version of libjansson found]))
AC_DEFINE([HAVE_LIBJANSSON], [1], [Define if you have libjansson])
])
AM_CONDITIONAL([BUILD_JSON], [test "x$with_json" != xno])
AC_CHECK_DECLS([getprotobyname_r, getprotobynumber_r, getservbyport_r], [], [], [[
#include <netdb.h>
]])
AC_ARG_WITH([pkgdst], [AS_HELP_STRING([--with-pkgdst=DIR],
[Where the package will be installed. By default DIR=prefix])],
[pkgdst=$withval], [pkgdst=/usr/local])
AC_ARG_WITH([build-deb], [AS_HELP_STRING([--with-build-deb],
[Build deb package. Required fpm utility])],
[with_builddeb=$withval], [with_builddeb=no])
AC_ARG_WITH([build-rpm], [AS_HELP_STRING([--with-build-rpm],
[Build rpm package. Required fpm utility])],
[with_buildrpm=$withval], [with_buildrpm=no])
AS_IF([test "x$with_builddeb" = "xyes"], [
AC_CHECK_PROG(FPM, fpm, fpm, false)
if test "$FPM" = "false"; then
AC_MSG_ERROR([fpm not available. Required for creating packages.])
fi
AC_PREFIX_DEFAULT([$(pwd)/packages/content/])
BUILD_DEB=1
], [BUILD_DEB=0])
AM_CONDITIONAL([BUILD_DEB], [test "x$with_builddeb" = "xyes"])
AS_IF([test "x$with_buildrpm" = "xyes"], [
AC_CHECK_PROG(FPM, fpm, fpm, false)
if test "$FPM" = "false"; then
AC_MSG_ERROR([fpm not available. Required for creating packages.])
fi
BUILD_RPM=1
], [BUILD_RPM=0])
AS_IF([test "x$with_builddeb" = "xyes" -o "x$with_buildrpm" = "xyes"], [
PKG_NAME=swarm-nft
PKG_VERSION=$(git describe --tags --exact-match 2> /dev/null | cut -d "v" -f 2)
if test -z "$PKG_VERSION"; then
PKG_VERSION=${STRIPPED_VERSION}
fi
if test -z "$PKG_VERSION"; then
PKG_VERSION=$(git tag |tail -n 1 |cut -d "v" -f 2)-$(git symbolic-ref -q --short HEAD || git rev-parse --short HEAD)
fi
AC_MSG_NOTICE([The nft package version is $PKG_VERSION])
LIBNFTNL_VERSION=$(git submodule --quiet foreach git describe --tags --exact-match 2> /dev/null | cut -d "-" -f 2)
if test -z "$LIBNFTNL_VERSION"; then
LIBNFTNL_VERSION=${STRIPPED_VERSION}
fi
if test -z "$LIBNFTNL_VERSION"; then
LIBNFTNL_VERSION=$(git submodule --quiet foreach git tag |tail -n 1 |cut -d "-" -f 2)-$(git submodule --quiet foreach git symbolic-ref -q --short HEAD || git rev-parse --short HEAD)
fi
AC_MSG_NOTICE([The libnftnl package version is $LIBNFTNL_VERSION])
AC_SUBST(PKG_VERSION)
AC_SUBST(PKG_NAME)
AC_SUBST(LIBNFTNL_VERSION)
], [])
AM_CONDITIONAL([BUILD_RPM], [test "x$with_buildrpm" = "xyes"])
AM_CONDITIONAL([BUILD_DEB_OR_RPM], [test "x$with_builddeb" = "xyes" -o "x$with_buildrpm" = "xyes"])
AC_SUBST([pkgdst])
AC_SUBST(BUILD_DEB)
AC_SUBST(BUILD_RPM)
AC_SUBST(BUILD_DEB_OR_RPM)
AC_CONFIG_FILES([ \
Makefile \
libnftables.pc \
packages/Makefile \
packages/deb/Makefile \
packages/rpm/Makefile \
])
AC_OUTPUT
echo "
nft configuration:
cli support: ${with_cli}
enable debugging symbols: ${enable_debug}
use mini-gmp: ${with_mini_gmp}
enable man page: ${enable_man_doc}
libxtables support: ${with_xtables}
json output support: ${with_json}"