-
Notifications
You must be signed in to change notification settings - Fork 43
/
configure.ac
287 lines (235 loc) · 9.58 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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
#
# This file is part of bgpstream
#
# CAIDA, UC San Diego
#
# Copyright (C) 2015 The Regents of the University of California.
# Authors: Alistair King, Chiara Orsini
#
# 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 2 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/>.
#
AC_PREREQ([2.68])
AC_INIT([bgpstream], [1.2.3], [[email protected]])
BGPSTREAM_MAJOR_VERSION=1
BGPSTREAM_MID_VERSION=2
BGPSTREAM_MINOR_VERSION=3
LIBBGPSTREAM_MAJOR_VERSION=2
LIBBGPSTREAM_MID_VERSION=0
LIBBGPSTREAM_MINOR_VERSION=0
AC_DEFINE_UNQUOTED([BGPSTREAM_MAJOR_VERSION],$BGPSTREAM_MAJOR_VERSION,
[bgpstream major version])
AC_DEFINE_UNQUOTED([BGPSTREAM_MID_VERSION],$BGPSTREAM_MID_VERSION,
[bgpstream mid version])
AC_DEFINE_UNQUOTED([BGPSTREAM_MINOR_VERSION],$BGPSTREAM_MINOR_VERSION,
[bgpstream minor version])
AC_SUBST([BGPSTREAM_MAJOR_VERSION])
AC_SUBST([BGPSTREAM_MID_VERSION])
AC_SUBST([BGPSTREAM_MINOR_VERSION])
AC_DEFINE_UNQUOTED([LIBBGPSTREAM_MAJOR_VERSION],$LIBBGPSTREAM_MAJOR_VERSION,
[libbgpstream major version])
AC_DEFINE_UNQUOTED([LIBBGPSTREAM_MID_VERSION],$LIBBGPSTREAM_MID_VERSION,
[libbgpstream mid version])
AC_DEFINE_UNQUOTED([LIBBGPSTREAM_MINOR_VERSION],$LIBBGPSTREAM_MINOR_VERSION,
[libbgpstream minor version])
AC_SUBST([LIBBGPSTREAM_MAJOR_VERSION])
AC_SUBST([LIBBGPSTREAM_MID_VERSION])
AC_SUBST([LIBBGPSTREAM_MINOR_VERSION])
LT_INIT
# Check if we should disable rpath.
#
# For advanced users: In certain configurations (e.g. when one of BGPStream's
# dependencies is located in a directory which also holds an old
# libbgpstream.so), the rpath attributes added by libtool cause problems with
# make check (or indeed with any non-installed binaries) as rpath will be
# preferred over LD_LIBRARY_PATH. This does not seem to be a problem with
# clang. When using --disable-rpath you will likely need to set LD_LIBRARY_PATH
# if you are using libraries in non-system locations. YMMV.
#
DISABLE_RPATH
AM_INIT_AUTOMAKE
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([lib/bgpstream.c])
AC_CONFIG_HEADERS([config.h])
# Checks for programs.
AC_PROG_LIBTOOL
AC_PROG_CXX
AM_PROG_LIBTOOL
AC_PROG_CC_C99 # C99 is required because of bool
AC_SYS_LARGEFILE
AH_VERBATIM([_GNU_SOURCE],
[/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif])
AC_CHECK_FUNCS([gettimeofday memset strdup strstr strsep strlcpy vasprintf])
# should we dump debug output to stderr and not optmize the build?
AC_MSG_CHECKING([whether to build with debug information])
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],
[enable debug data generation (def=no)])],
[debugit="$enableval"],
[debugit=no])
AC_MSG_RESULT([$debugit])
if test x"$debugit" = x"yes"; then
AC_DEFINE([DEBUG],[],[Debug Mode])
fi
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC
# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h inttypes.h limits.h math.h stdlib.h string.h \
time.h sys/time.h])
# Checks for mandatory libraries
# this code is needed to get the right threading library on a mac
STASH_CFLAGS="$CFLAGS"
CFLAGS=
AX_PTHREAD(, [AC_MSG_ERROR([pthreads required])])
CFLAGS="$STASH_CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"
# check that wandio is installed and HTTP support is enabled
AC_SEARCH_LIBS([wandio_create], [wandio], [with_wandio=yes],
[AC_MSG_ERROR(
[libwandio required (http://research.wand.net.nz/software/libwandio.php)]
)])
AM_CONDITIONAL([WITH_WANDIO], [test "x$with_wandio" == xyes])
AC_MSG_NOTICE([])
AC_MSG_NOTICE([---- BGPStream configuration ----])
BS_WITH_DI([bgpstream_broker],[broker],[BROKER],[yes])
BS_WITH_DI([bgpstream_singlefile],[singlefile],[SINGLEFILE],[yes])
BS_WITH_DI([bgpstream_csvfile],[csvfile],[CSVFILE],[yes])
BS_WITH_DI([bgpstream_sqlite],[sqlite],[SQLITE],[no])
if test "x$bs_di_valid" != xyes; then
AC_MSG_ERROR([At least one data interface must be enabled])
fi
# check for data interface dependencies
AC_MSG_NOTICE([checking data interface dependencies...])
if test "x$with_di_broker" == xyes; then
CHECK_WANDIO_HTTP("https://broker.bgpstream.caida.org/v1/")
fi
if test "x$with_di_sqlite" == xyes; then
# check for sqlite library
AC_CHECK_LIB([sqlite3], [sqlite3_open_v2], ,
[AC_MSG_ERROR( [libsqlite3 required for sqlite data interface])])
fi
# configure enabled data interfaces
AC_MSG_NOTICE([configuring data interface parameters...])
# broker options
if test "x$with_di_broker" == xyes; then
BS_DI_OPT(broker-url, BROKER_URL, Broker URL, https://broker.bgpstream.caida.org/v1)
AC_ARG_WITH([broker-debug],
[AS_HELP_STRING([--with-broker-debug], [Enable broker debugging output])],
[with_broker_debug=$with_broker_debug],
[with_broker_debug=no])
AS_IF([test "x$with_broker_debug" != xno],
[
AC_DEFINE_UNQUOTED([WITH_BROKER_DEBUG],[1],
[Enable broker debugging output])
])
fi
# singlefile options
if test "x$with_di_singlefile" == xyes; then
BS_DI_OPT(singlefile-rib-file, SINGLEFILE_RIB_FILE, RIB MRT file to read, not-set)
BS_DI_OPT(singlefile-upd-file, SINGLEFILE_UPDATE_FILE, Updates MRT to read, not-set)
fi
# sqlite options
if test "x$with_di_sqlite" == xyes; then
BS_DI_OPT(sqlite-db-file, SQLITE_DB_FILE, SQLite database, bgp_data.db)
fi
# csvfile options
if test "x$with_di_csvfile" == xyes; then
BS_DI_OPT(csvfile-csv-file, CSVFILE_CSV_FILE, CSV file listing the MRT data to read, not-set)
fi
AC_MSG_NOTICE([---------------------------------])
# BGPCorsaro configuration
AC_MSG_NOTICE([])
AC_MSG_NOTICE([---- BGPCorsaro configuration ----])
# monitor name
AC_MSG_CHECKING([for the monitor name to use])
AC_ARG_WITH([bgpcorsaro-monitorname],
[AS_HELP_STRING([--with-bgpcorsaro-monitorname=NAME],
[explicitly define the monitor name (defaults to system hostname)])],
[if test "x$withval" == xyes || test "x$withval" == ""; then
with_monitorname=`hostname`
else
with_monitorname=$withval
fi],
[with_monitorname=`hostname`])
AC_MSG_RESULT([$with_monitorname])
AC_DEFINE_UNQUOTED([BGPCORSARO_MONITOR_NAME],[$with_monitorname],[Monitor Name])
# are we going to dump some plugin timing information? (useful for debugging
# where bgpcorsaro spends its time given a complicated plugin chain)
AC_MSG_CHECKING([whether to monitor plugin runtimes])
AC_ARG_WITH([bgpcorsaro-plugin-timing],
[AS_HELP_STRING([--with-bgpcorsaro-plugin-timing],
[time how long each plugin takes to process packets (defaults to no)])],
[],
[with_plugin_timing=no])
AS_IF([test "x$with_plugin_timing" != xno],
[
AC_DEFINE_UNQUOTED([WITH_PLUGIN_TIMING],[1],
[Monitor plugin timing])
])
AC_MSG_RESULT([$with_plugin_timing])
# configure options to disable plugins
#AC_DEFINE([ED_PLUGIN_INIT_ALL_ENABLED],[],[Plugin init functions])
################################################################################
# Plugin Configuration Macros #
# --------------------------- #
# #
# Each ED_WITH_PLUGIN macro defines a plugin which can be compiled into #
# Bgpcorsaro. #
# #
# The order in which these plugins are listed is the _default_ order in which #
# they will be run. #
################################################################################
ED_WITH_PLUGIN([bgpcorsaro_pfxmonitor],[pfxmonitor],[PFXMONITOR],[yes])
ED_WITH_PLUGIN([bgpcorsaro_pacifier],[pacifier],[PACIFIER],[yes])
ED_WITH_PLUGIN([bgpcorsaro_asmonitor],[asmonitor],[ASMONITOR],[yes])
# this MUST go after all the ED_WITH_PLUGIN macro calls
AC_DEFINE_UNQUOTED([ED_PLUGIN_INIT_ALL_ENABLED], $ED_PLUGIN_INIT_ALL_ENABLED,
[plugins to call the init macro for in bgpcorsaro_plugin.c])
#------------------------------------------------------------------------------#
# Extra tests or config needed for plugins should go below here #
#------------------------------------------------------------------------------#
AC_MSG_NOTICE([----------------------------------])
# we may want to come back later and add compile-time configuration for things
# like datastructure providers, but for now it will all get compiled
AC_HEADER_ASSERT
AC_CONFIG_FILES([Makefile
bgpcorsaro/Makefile
bgpcorsaro/lib/Makefile
bgpcorsaro/lib/plugins/Makefile
bgpcorsaro/tools/Makefile
common/Makefile
common/libpatricia/Makefile
common/libinterval3/Makefile
common/libinterval3/rb_tree/Makefile
common/libcsv/Makefile
common/libjsmn/Makefile
lib/Makefile
lib/bgpdump/Makefile
lib/datasources/Makefile
lib/utils/Makefile
tools/Makefile
test/Makefile])
AC_OUTPUT