forked from sonic-net/sonic-swss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
169 lines (143 loc) · 4.88 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
AC_INIT([sonic-swss],[1.0])
AC_CONFIG_SRCDIR([])
AC_CONFIG_AUX_DIR(config)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE([foreign])
AC_LANG_C
AC_LANG([C++])
AC_PROG_CC
AC_PROG_CXX
AC_PROG_LIBTOOL
AC_HEADER_STDC
AC_CHECK_LIB([hiredis], [redisConnect],,
AC_MSG_ERROR([libhiredis is not installed.]))
AC_CHECK_LIB([team], [team_alloc],
AM_CONDITIONAL(HAVE_LIBTEAM, true),
[AC_MSG_WARN([libteam is not installed.])
AM_CONDITIONAL(HAVE_LIBTEAM, false)])
PKG_CHECK_MODULES([JANSSON], [jansson])
AC_CHECK_LIB([sai], [sai_object_type_query],
AM_CONDITIONAL(HAVE_SAI, true),
[AC_MSG_WARN([libsai is not installed.])
AM_CONDITIONAL(HAVE_SAI, false)])
AC_ARG_ENABLE(debug,
[ --enable-debug Compile with debugging flags],
[case "${enableval}" in
yes) debug=true ;;
no) debug=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
esac],[debug=false])
AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
AC_ARG_WITH(extra-inc,
[ --with-extra-inc=DIR
prefix where extra includes are installed],
[AC_SUBST(CPPFLAGS, "$CPPFLAGS -I${withval} -I${withval}/swss -I${withval}/sai")])
AC_ARG_WITH(extra-lib,
[ --with-extra-lib=DIR
prefix where extra libraries are installed],
[AC_SUBST(LDFLAGS, "$LDFLAGS -L${withval}")])
AC_ARG_WITH(extra-usr-lib,
[ --with-extra-usr-lib=DIR
prefix where extra libraries are installed],
[AC_SUBST(LDFLAGS, "$LDFLAGS -L${withval}")])
AC_CHECK_LIB([nl-3], [nl_addr_alloc])
AC_CHECK_LIB([nl-genl-3], [nl_socket_get_cb])
AC_CHECK_LIB([nl-route-3], [rtnl_route_nh_get_encap_mpls_dst])
AC_CHECK_LIB([nl-nf-3], [nfnl_connect])
CFLAGS_COMMON="-std=c++14 -Wall -fPIC -Wno-write-strings -I/usr/include/swss"
AC_ARG_WITH(libnl-3.0-inc,
[ --with-libnl-3.0-inc=DIR
prefix where libnl-3.0 includes are installed],
[AC_SUBST(CPPFLAGS, "$CPPFLAGS -I${withval}")
AC_SUBST(LIBNL_INC_DIR, "${withval}")])
if test "${with_libnl_3_0_inc+set}" != set; then
CFLAGS_COMMON+=" -I/usr/include/libnl3"
fi
CFLAGS_COMMON+=" -Werror"
CFLAGS_COMMON+=" -Wno-reorder"
CFLAGS_COMMON+=" -Wcast-align"
CFLAGS_COMMON+=" -Wcast-qual"
CFLAGS_COMMON+=" -Wconversion"
CFLAGS_COMMON+=" -Wdisabled-optimization"
CFLAGS_COMMON+=" -Wextra"
CFLAGS_COMMON+=" -Wfloat-equal"
CFLAGS_COMMON+=" -Wformat=2"
CFLAGS_COMMON+=" -Wformat-nonliteral"
CFLAGS_COMMON+=" -Wformat-security"
CFLAGS_COMMON+=" -Wformat-y2k"
CFLAGS_COMMON+=" -Wimport"
CFLAGS_COMMON+=" -Winit-self"
CFLAGS_COMMON+=" -Winvalid-pch"
CFLAGS_COMMON+=" -Wlong-long"
CFLAGS_COMMON+=" -Wmissing-field-initializers"
CFLAGS_COMMON+=" -Wmissing-format-attribute"
CFLAGS_COMMON+=" -Wno-aggregate-return"
CFLAGS_COMMON+=" -Wno-padded"
CFLAGS_COMMON+=" -Wno-switch-enum"
CFLAGS_COMMON+=" -Wno-unused-parameter"
CFLAGS_COMMON+=" -Wpacked"
CFLAGS_COMMON+=" -Wpointer-arith"
CFLAGS_COMMON+=" -Wredundant-decls"
CFLAGS_COMMON+=" -Wstack-protector"
CFLAGS_COMMON+=" -Wstrict-aliasing=3"
CFLAGS_COMMON+=" -Wswitch"
CFLAGS_COMMON+=" -Wswitch-default"
CFLAGS_COMMON+=" -Wunreachable-code"
CFLAGS_COMMON+=" -Wunused"
CFLAGS_COMMON+=" -Wvariadic-macros"
CFLAGS_COMMON+=" -Wno-switch-default"
CFLAGS_COMMON+=" -Wno-long-long"
CFLAGS_COMMON+=" -Wno-redundant-decls"
# Code testing coverage with gcov
AC_MSG_CHECKING(whether to build with gcov testing)
AC_ARG_ENABLE(gcov, AS_HELP_STRING([--enable-gcov], [Whether to enable gcov testing]),, enable_gcov=no)
if test "x$enable_gcov" = "xyes"; then
if test "$GCC" = "no"; then
AC_MSG_ERROR(not compiling with gcc, which is required for gcov testing)
fi
CFLAGS_COMMON+=" -fprofile-arcs -ftest-coverage"
AC_SUBST(CFLAGS_COMMON)
LDFLAGS+=" -fprofile-arcs -lgcov"
AC_SUBST(LDFLAGS)
fi
AM_CONDITIONAL(GCOV_ENABLED, test x$enable_gcov = xyes)
AC_MSG_RESULT($enable_gcov)
AC_ARG_ENABLE(asan,
[ --enable-asan Compile with address sanitizer],
[case "${enableval}" in
yes) asan_enabled=true ;;
no) asan_enabled=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-asan) ;;
esac],[asan_enabled=false])
if test "x$asan_enabled" = "xtrue"; then
CFLAGS_ASAN+=" -fsanitize=address"
CFLAGS_ASAN+=" -DASAN_ENABLED"
CFLAGS_ASAN+=" -ggdb -fno-omit-frame-pointer -U_FORTIFY_SOURCE"
CFLAGS_ASAN+=" -Wno-maybe-uninitialized"
AC_SUBST(CFLAGS_ASAN)
LDFLAGS_ASAN+=" -lasan"
AC_SUBST(LDFLAGS_ASAN)
fi
AM_CONDITIONAL(ASAN_ENABLED, test x$asan_enabled = xtrue)
AC_SUBST(CFLAGS_COMMON)
AC_CONFIG_FILES([
Makefile
orchagent/Makefile
fpmsyncd/Makefile
neighsyncd/Makefile
gearsyncd/Makefile
fdbsyncd/Makefile
natsyncd/Makefile
portsyncd/Makefile
teamsyncd/Makefile
tlm_teamd/Makefile
mclagsyncd/Makefile
swssconfig/Makefile
cfgmgr/Makefile
tests/Makefile
orchagent/p4orch/tests/Makefile
])
# If no SAI library is installed, compile with SAIVS and run unit tests
AM_COND_IF([HAVE_SAI],[],
[AC_CONFIG_FILES([tests/mock_tests/Makefile])])
AC_OUTPUT