forked from virtualsquare/vde-2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
401 lines (355 loc) · 12 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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
# -*- Autoconf -*-/
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT([vde2],[2.3.2],[[email protected]])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_CONFIG_SRCDIR([include/vde.h])
AC_CONFIG_HEADER([include/config.h])
AC_CONFIG_LIBOBJ_DIR(src/common)
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_LIBTOOL
AM_PROG_CC_C_O
AC_DEFINE_UNQUOTED(MODULES_EXT, "$shrext_cmds", [Extension of shared objects])
# Checks for libraries.
AC_CHECK_LIB([dl], [dlopen])
AC_CHECK_LIB([crypto], [EVP_EncryptInit],
[add_cryptcab_support=yes],
[add_cryptcab_support=no ; warn_cryptcab=yes])
AC_CHECK_LIB([pthread], [pthread_create],
[enable_router=yes],
[enable_router=no ; warn_router=yes])
AC_CHECK_LIB([pcap], [pcap_open_dead],
[add_pcap=yes],
[add_pcap=no ; warn_pcap=yes])
# Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stddef.h stdint.h \
stdlib.h string.h strings.h sys/ioctl.h sys/param.h sys/socket.h \
sys/time.h syslog.h termio.h termios.h unistd.h sys/filio.h sys/bitypes.h \
sys/wait.h sys/select.h sys/signal.h sys/stropts.h termios.h sys/type32.h])
AC_CHECK_HEADERS([syslimits.h sys/syslimits.h])
AC_CHECK_HEADERS([wolfssl/wolfcrypt/chacha.h], [],
[add_cryptcab_support=no ; warn_cryptcab=yes])
AC_CHECK_HEADERS([sysexits.h],
[add_over_ns_support=yes],
[add_over_ns_support=no ; warn_over_ns=yes])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_C_BIGENDIAN
AC_C_PROTOTYPES
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
# Checks for library functions.
AC_FUNC_CHOWN
AC_FUNC_FORK
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([atexit dup2 gethostbyname gethostname gettimeofday inet_ntoa \
memmove memset putenv select setenv socket strchr strdup strerror strstr \
uname inet_aton sprintf readv random srandom index bcmp drand48 memmove \
gethostid revoke fchmod getopt_long_only funopen])
AC_REPLACE_FUNCS([open_memstream strndup])
AC_CHECK_FUNC([poll],
[
AC_MSG_CHECKING([for poll sanity])
if expr "$build_os" : "darwin*" > /dev/null; then
AC_MSG_RESULT([present but broken, emulating with select])
AC_LIBOBJ([poll])
AC_DEFINE([poll], [vde_poll],
[Define to vde_poll if the replacement function should be used.])
else
AC_DEFINE([HAVE_POLL], 1, [Define to 1 if your system has a working poll() function.])
AC_MSG_RESULT([yes])
fi
],
[])
# All other nice checks I have to make for recostructing missing parts of
# slirp's config.h file
AC_CHECK_SIZEOF(char)
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(char *)
# Define VDE_LINUX or VDE_DARWIN
case "$build_os" in
linux*)
if expr "$host_os" : ".*android" > /dev/null; then
AC_DEFINE([VDE_BIONIC], 1, [If defined, this is a Linux/bionic system])
else
AC_DEFINE([VDE_LINUX], 1, [If defined, this is a Linux system])
fi
;;
darwin*)
AC_DEFINE([VDE_DARWIN], 1, [If defined, this is a Darwin system])
darwin_gcc=yes
;;
freebsd*)
AC_DEFINE([VDE_FREEBSD], 1, [If defined, this is a FreeBSD system])
;;
*)
AC_MSG_ERROR([Unsupported OS: $build_os. At the moment, only Linux, Darwin
and FreeBSD are supported. Contributions are appreciated! :-)])
;;
esac
# Enable profiling options
AC_ARG_ENABLE([profile],
AS_HELP_STRING([--enable-profile],
[Compile with debugging/profiling options]),
[if test $enableval = "yes"; then enable_profile=yes; fi])
# Enable experimental features
AC_ARG_ENABLE([experimental],
AS_HELP_STRING([--enable-experimental],
[Enable experimental features (async notifies, plugin support, packet counter)]),
[if test $enableval = "yes"; then enable_experimental=yes; fi])
# Disable vde_cryptcab? (depends on wolfssl, maybe unwanted)
AC_ARG_ENABLE([cryptcab],
AS_HELP_STRING([--disable-cryptcab],
[Disable vde_cryptcab compilation]),
[if test $enableval = "no" ; then add_cryptcab_support=no ; warn_cryptcab=no ; fi])
# Disable vde_over_ns? (not working on android, maybe unwanted)
AC_ARG_ENABLE([vde_over_ns],
AS_HELP_STRING([--disable-vde_over_ns],
[Disable vde_over_ns compilation]),
[if test $enableval = "no" ; then add_over_ns_support=no ; warn_over_ns=no ; fi])
# Disable vde_router? (depends on lpthread, maybe unwanted)
AC_ARG_ENABLE([router],
AS_HELP_STRING([--disable-router],
[Disable libpthread-dependent vde_router compilation]),
[if test $enableval = "no" ; then enable_router=no ; warn_router=no ; fi])
enable_vxlan=yes
# Disable vde_vxlan?
AC_ARG_ENABLE([vxlan],
AS_HELP_STRING([--disable-vxlan],
[Disable vde_vxlan compilation]),
[if test $enableval = "no" ; then enable_vxlan=no ; warn_vxlan=no ; fi])
# Check of tuntap device
AC_ARG_ENABLE([tuntap],
AS_HELP_STRING([--disable-tuntap], [Disable tuntap compilation]), [:],
[case "$build_os" in
linux*)
AC_CHECK_HEADER([linux/if_tun.h],
[AC_DEFINE([HAVE_TUNTAP], 1, [If defined, tuntap support is compiled in])],
[warn_tuntap=yes])
can_make_libvdetap=yes
can_make_vdetunctl=yes
;;
darwin*)
# I don't use AC_CHECK_FILES because I need test -e and not test -r
for i in /dev/tap0 /Library/Extensions/tap.kext ; do
AC_MSG_CHECKING([for $i])
if test -e "$i" ; then
AC_MSG_RESULT([yes])
definename="`echo "$i" | tr "a-z*" "A-ZP" | tr -c "0-9A-Z" "_"`"
AC_DEFINE_UNQUOTED([HAVE_$definename])
eval HAVE_$definename=yes
else
AC_MSG_RESULT([no])
warn_tuntap=yes
fi
done
if test "$HAVE__DEV_TAP0_" ; then
AC_DEFINE([HAVE_TUNTAP], 1, [If defined, tuntap support is compiled in])
if ! test "$HAVE__LIBRARY_EXTENSIONS_TAP_KEXT_" || "$HAVE__SYSTEM_LIBRARY_EXTENSIONS_TAP_KEXT_" ; then
AC_MSG_WARN([/dev/tap0 exists, but the kext cannot be found. Let's hope your
configuration does work...])
fi
else
warn_tuntap=yes
AC_MSG_WARN([You do not have tuntap support. You can get it here:
http://tuntaposx.sourceforge.net/])
fi
;;
freebsd*)
AC_CHECK_HEADER([net/if_tun.h],
[AC_DEFINE([HAVE_TUNTAP], 1, [If defined, tuntap support is compiled in])],
[warn_tuntap=yes])
;;
esac])
# Disable pcap support (pdump)? (depends on libpcap, maybe unwanted)
AC_ARG_ENABLE([pcap],
AS_HELP_STRING([--disable-pcap],
[Disable pcap support (pdump plugin)]),
[if test $enableval = "no" ; then add_pcap=no ; warn_pcap=no ; fi])
AC_ARG_ENABLE([kernel-switch],
AS_HELP_STRING([--enable-kernel-switch],
[Compile support for in-kernel switch. ]),
[if test $enableval = "yes"; then
enable_kernel_switch=yes
AC_DEFINE([USE_IPN], 1, [If defined, enable support for IPN socket])
fi])
# python bindings
AC_ARG_ENABLE([python],
AS_HELP_STRING([--disable-python], [Disable python bindings]),
[enable_python=$enableval],
[enable_python=yes]
)
if test x"$enable_python" = x"yes"; then
# check python
AM_PATH_PYTHON([2.5])
AC_PATH_PROG(PYTHON_CONFIG, python$PYTHON_VERSION-config)
if test x"$PYTHON_CONFIG" = x""; then
AC_PATH_PROG(PYTHON_CONFIG, python-config)
fi
if test x"$PYTHON_CONFIG" = x""; then
# not found, give up
enable_python=no
else
PYTHON_CFLAGS=`$PYTHON_CONFIG --includes`
PYTHON_LIBS=`$PYTHON_CONFIG --libs`
PYTHON_INCLUDES="$PYTHON_CFLAGS"
fi
AC_SUBST(PYTHON_CFLAGS)
AC_SUBST(PYTHON_INCLUDES)
AC_SUBST(PYTHON_LIBS)
fi
AM_CONDITIONAL(ENABLE_CRYPTCAB, test "$add_cryptcab_support" = yes)
AM_CONDITIONAL(ENABLE_VDE_OVER_NS, test "$add_over_ns_support" = yes)
AM_CONDITIONAL(ENABLE_ROUTER, test "$enable_router" = yes)
AM_CONDITIONAL(ENABLE_VXLAN, test "$enable_vxlan" = yes)
AM_CONDITIONAL(ENABLE_PYTHON, test "$enable_python" = yes)
AM_CONDITIONAL(ENABLE_PCAP, test "$add_pcap" = yes)
AM_CONDITIONAL(CAN_MAKE_LIBVDETAP, test "$can_make_libvdetap" = yes)
AM_CONDITIONAL(CAN_MAKE_VDETUNCTL, test "$can_make_vdetunctl" = yes)
AM_CONDITIONAL(ENABLE_EXPERIMENTAL, test "$enable_experimental" = yes)
AM_CONDITIONAL(ENABLE_PROFILE, test "$enable_profile" = yes)
AM_CONDITIONAL(DARWIN_GCC, test "$darwin_gcc" = yes)
AM_CONDITIONAL(ENABLE_KERNEL_SWITCH, test "$enable_kernel_switch" = yes)
CFLAGS="-Wall -O2 $CFLAGS"
AC_SUBST(CFLAGS)
AC_CONFIG_FILES(
[Makefile]
[doc/Makefile]
[include/Makefile]
[man/Makefile]
[src/Makefile]
[src/lib/Makefile]
[src/lib/vdesnmp.pc]
[src/lib/vdemgmt.pc]
[src/lib/vdeplug.pc]
[src/lib/vdehist.pc]
[src/lib/python/Makefile]
[src/vde_switch/Makefile]
[src/kvde_switch/Makefile]
[src/vde_over_ns/Makefile]
[src/common/Makefile]
[src/vdetaplib/Makefile]
[src/vde_l3/Makefile]
[src/vde_cryptcab/Makefile]
[src/vde_router/Makefile]
[src/vde_vxlan/Makefile]
[src/slirpvde/Makefile]
[src/vde_switch/plugins/Makefile]
)
AC_OUTPUT
AS_ECHO
AS_ECHO
AS_ECHO "Configure results:"
AS_ECHO
if test x$add_cryptcab_support = "xyes" ; then
AS_ECHO " + VDE CryptCab............ enabled"
else
AS_ECHO " - VDE CryptCab............ disabled"
fi
if test x$enable_router = "xyes" ; then
AS_ECHO " + VDE Router.............. enabled"
else
AS_ECHO " - VDE Router.............. disabled"
fi
if test x$enable_vxlan = "xyes" ; then
AS_ECHO " + VDE VXLAN............... enabled"
else
AS_ECHO " - VDE VXLAN............... disabled"
fi
if test x$enable_python = "xyes" ; then
AS_ECHO " + Python Libraries........ enabled"
else
AS_ECHO " - Python Libraries........ disabled"
fi
if test x$warn_tuntap = "xyes" ; then
AS_ECHO " - TAP support............. disabled"
else
AS_ECHO " + TAP support............. enabled"
fi
if test x$add_pcap = "xyes" ; then
AS_ECHO " + pcap support............ enabled"
else
AS_ECHO " - pcap support............ disabled"
fi
if test x$enable_experimental = "xyes" ; then
AS_ECHO " + Experimental features... enabled"
else
AS_ECHO " - Experimental features... disabled"
fi
if test x$enable_profile = "xyes" ; then
AS_ECHO " + Profiling options....... enabled"
else
AS_ECHO " - Profiling options....... disabled"
fi
if test x$enable_kernel_switch = "xyes" ; then
AS_ECHO " + Kernel switch........... enabled"
else
AS_ECHO " - Kernel switch........... disabled"
fi
AS_ECHO
AS_ECHO
if ! test x$add_cryptcab_support = "xyes" ; then
if test x$warn_cryptcab = "xyes" ; then
AC_MSG_WARN([VDE CryptCab support has been disabled because wolfSSL is
not installed on your system, or because wolfssl/wolfcrypt/chacha.h could not be found.
Please install libwolfssl if you want CryptCab to be compiled and installed.])
AS_ECHO
fi
fi
if ! test x$add_over_ns_support = "xyes" ; then
if test x$warn_over_ns = "xyes" ; then
AC_MSG_WARN([VDE vde_over_ns support has been disabled because your libc
sysexits.h could not be found.])
AS_ECHO
fi
fi
if ! test x$enable_router = "xyes" ; then
if test x$warn_router = "xyes" ; then
AC_MSG_WARN([VDE Router support has been disabled because libpthread is
not installed on your system.])
AS_ECHO
fi
fi
if ! test x$enable_vxlan = "xyes" ; then
if test x$warn_vxlan = "xyes" ; then
AC_MSG_WARN([VDE VXLAN support has been disabled.])
AS_ECHO
fi
fi
if ! test x$enable_python = "xyes" ; then
AC_MSG_WARN([Python libraries support has been disabled because python is
not installed on your system, or because it could not be found. Please install
it if you want Python libraries to be compiled and installed.])
AS_ECHO
fi
if ! test x$add_pcap = "xyes" ; then
if test x$warn_pcap = "xyes" ; then
AC_MSG_WARN([VDE vde_pcapplug and packet dump plugin have been disabled
because libpcap is not installed on your system, or because it is too old.
Please install it if you want vde_pcapplug and pdump to be compiled and
installed.])
AS_ECHO
fi
fi
AS_ECHO
AS_ECHO "Type 'make' to compile $PACKAGE $VERSION,"
AS_ECHO "or type 'make V=1' for verbose compiling"
AS_ECHO "and then type 'make install' to install it into $prefix"
AS_ECHO