-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconfigure.f2k
144 lines (117 loc) · 6.09 KB
/
configure.f2k
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
#!/bin/bash
#
mkl_require good_cflags
mkl_require atomics must pass
mkl_require socket
mkl_require gitversion as GITVERSION
mkl_mkvar_append CPPFLAGS CPPFLAGS "-D_GNU_SOURCE -DFORTIFY_SOURCE=2"
mkl_mkvar_append CPPFLAGS CPPFLAGS "-DNDEBUG"
#mkl_mkvar_append CPPFLAGS CPPFLAGS "-ftrack-macro-expansion=2 -Wsign-conversion"
#mkl_mkvar_append CPPFLAGS CPPFLAGS "-Wjump-misses-init" # New in gcc 4.5
#mkl_mkvar_append CPPFLAGS CPPFLAGS "-Wdouble-promotion" # New in gcc 4.6
#mkl_mkvar_append CPPFLAGS CPPFLAGS "-Wunused-local-typedefs" # New in gcc 4.7
mkl_mkvar_append CPPFLAGS CPPFLAGS "-Wcast-align -Wdisabled-optimization"
mkl_mkvar_append CPPFLAGS CPPFLAGS "-Winit-self -Wlogical-op"
mkl_mkvar_append CPPFLAGS CPPFLAGS "-Wmissing-include-dirs -Wstrict-overflow=5"
mkl_mkvar_append CPPFLAGS CPPFLAGS "-Wundef -Wswitch-default"
mkl_mkvar_append CPPFLAGS CPPFLAGS "-Wmissing-declarations"
mkl_mkvar_append CPPFLAGS CPPFLAGS "-Wdisabled-optimization -Wshadow"
mkl_mkvar_append CPPFLAGS CPPFLAGS "-Wcast-qual -Wunused -Wextra"
mkl_toggle_option "Standard" WITH_LIBRDKAFKA "--enable-librdkafka" "librdkafka: For kafka export" "y"
mkl_toggle_option "Standard" WITH_RBMAC_VENDOR "--enable-rbmacvendor" "RedBorder MACs vendor library" "y"
mkl_toggle_option "Standard" WITH_GEOIP "--enable-geoip" "MaxMind (r) GeoIP library" "y"
mkl_toggle_option "Standard" WITH_SFLOW "--enable-sflow" "S-FLOW Support" "n"
mkl_toggle_option "Standard" WITH_ZOOKEEPER "--enable-zookeeper" "Apache Zookeeper support" "y"
mkl_toggle_option "Standard" WITH_UDNS "--enable-udns" "Michael Tokarev reverse-DNS support" "y"
mkl_toggle_option "Feature" WITH_INTEGRATION_TESTS "--enable-integration-tests" "Run integration tests" "n"
mkl_toggle_option "Feature" WITH_PRINT_BOUND_CHECKS "--enable-export-bounds-chks" "Checks bound in export functions (SLOW!)" "n"
mkl_toggle_option "Feature" WITH_COVERAGE "--enable-coverage" "Coverage build" "n"
function checks_librdkafka {
# Check that librdkafka is available, and allow to link it statically.
mkl_meta_set "librdkafka" "desc" "librdkafka is available at http://github.com/edenhill/librdkafka."
mkl_meta_set "librdkafka" "deb" "librdkafka-dev"
mkl_lib_check --static=-lrdkafka "librdkafka" "" fail CC "-lrdkafka -lpthread -lz" \
"#include <librdkafka/rdkafka.h>"
}
function checks_no_missing_initializers {
# GCC<4.7 throws this warning if with >1 members are initialized = {0}
# TODO check with clang
MAJOR=$(echo __GNUC__ | ${CC} -E -x c - | tail -n 1)
MINOR=$(echo __GNUC_MINOR__ | ${CC} -E -x c - | tail -n 1)
if [ $MAJOR -le 5 ] || ([ $MAJOR -eq 5 ] && [ $MINOR -lt 1 ]); then
mkl_mkvar_append CPPFLAGS CPPFLAGS "-Wno-missing-field-initializers"
fi
}
function checks {
mkl_define_set "OS name" "osName" "`uname`"
checks_no_missing_initializers
mkl_lib_check --static=-lrd "librd" "" fail CC "-lrd -lpthread -lz -lrt" \
"#include <librd/rd.h>"
mkl_lib_check "pcap" "" fail CC "-lpcap"
# -lrd required
if [ "x$WITH_LIBRDKAFKA" == "xy" ]; then
checks_librdkafka
mkl_define_set "Magnus Edenhill librdkafka" "HAVE_LIBRDKAFKA" "1"
fi
if [ "x$WITH_RBMAC_VENDOR" == "xy" ]; then
mkl_lib_check "rb_mac_vendor" HAVE_RB_MAC_VENDORS fail CC "-lrb_mac_vendors" \
"#include <rb_mac_vendors.h>"\
#mkl_define_set "RedBorder Macs vendors library" "HAVE_RB_MACS_VENDOR" "1"
fi
if [ "x$WITH_GEOIP" == "xy" ]; then
mkl_lib_check "geoip" HAVE_GEOIP fail CC "-lGeoIP" \
"#include <GeoIP.h>
void *f();void *f(){return GeoIP_org_by_ipnum;}
void *g();void *g(){return GeoIP_org_by_ipnum_v6;}"
mkl_define_set "GeoIP V6 Support" "HAVE_GEOIP_IPv6" "1"
fi
if [ "x$WITH_ZOOKEEPER" == "xy" ]; then
mkl_lib_check "zookeeper" HAVE_ZOOKEEPER fail CC "-lzookeeper_mt" \
"#include <zookeeper/zookeeper.h>"
mkl_define_set "Zookeeper Support" "HAVE_ZOOKEEPER" "1"
fi
if [ "x$WITH_SFLOW" == "xy" ]; then
mkl_err "Sflow support is in a experimental phase"
fi
if [ "x$WITH_UDNS" == "xy" ]; then
mkl_lib_check "udns" HAVE_UDNS fail CC "-ludns" \
"#include <udns.h>
void *f();void *f(){return dns_init;}"
fi
if [[ "x$WITH_INTEGRATION_TESTS" == "xy" ]]; then
mkl_define_set "" "TESTS_ZK_HOST" "172.26.0.2:2181"
fi
mkl_lib_check HAVE_JSON HAVE_JSON fail CC "-ljansson" "#include <jansson.h>"
mkl_compile_check optreset "HAVE_OPTRESET" disable CC "" "optreset = 1;"
mkl_lib_check pthread HAVE_LIBPTHREAD fail CC "-lpthread" \
"#include <pthread.h>
void *f();void *f(){return pthread_mutex_init;}"
mkl_compile_check pthread_setaffinity_np HAVE_PTHREAD_SET_AFFINITY disable CC "-lpthread" \
"#include <pthread.h>
void *f(){return pthread_setaffinity_np;}"
mkl_compile_check sin6_len HAVE_SIN6_LEN disable CC "" \
"#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/ip6.h>
int f(){struct sockaddr_in6 addr;addr.sin6_len = sizeof(struct sockaddr_in6);}"
mkl_lib_check "netfilter" HAVE_NETFILTER disable CC "-lnetfilter_queue" \
"#include <netinet/in.h>
#include <libnetfilter_queue/libnetfilter_queue.h>"
mkl_compile_check sctp HAVE_SCTP disable CC "" \
"#include <netinet/in.h>
#include <netinet/sctp.h>
#include <sys/socket.h>"
mkl_compile_check pcap_next_ex HAVE_PCAP_NEXT_EX disable CC "-lpcap" \
"#include <pcap/pcap.h>
void *f();void *f(){return pcap_next_ex;}"
mkl_lib_check pf_ring HAVE_PF_RING disable CC "-lpfring" \
"#include <pfring.h>
void *f();void *f(){return pfring_open;}"
if [[ "x$WITHOUT_OPTIMIZATION" != "xy" || "x$WITH_COVERAGE" != "xy" ]]; then
mkl_mkvar_append CPPFLAGS CPPFLAGS "-DNDEBUG"
fi
if [[ "x$WITH_COVERAGE" != "xn" ]]; then
mkl_mkvar_append CPPFLAGS CPPFLAGS "--coverage"
mkl_mkvar_append LDFLAGS LDFLAGS "--coverage"
fi
}