VCL: application proxy configuration
[vpp.git] / src / configure.ac
1 AC_INIT([vpp], [18.01], [vpp-dev@fd.io])
2 LT_INIT
3 AC_CONFIG_AUX_DIR([.])
4 AM_INIT_AUTOMAKE([subdir-objects])
5 AM_SILENT_RULES([yes])
6 AC_CONFIG_FILES([Makefile plugins/Makefile vpp-api/python/Makefile vpp-api/java/Makefile vpp-api/vapi/Makefile vpp-api/vom/Makefile])
7 AC_CONFIG_MACRO_DIR([m4])
8
9 AC_PROG_CC
10 AC_PROG_CXX
11 AC_PROG_CPP
12 AM_PROG_AS
13 AM_PROG_LIBTOOL
14 AC_PROG_YACC
15 AM_PATH_PYTHON
16
17 AM_CONDITIONAL([CROSSCOMPILE], [test "$cross_compiling" == "yes"])
18
19 ###############################################################################
20 # Macros
21 ###############################################################################
22
23 AC_DEFUN([ENABLE_ARG],
24 [
25   AC_ARG_ENABLE($1,
26     AC_HELP_STRING(patsubst([--enable-$1],[_],[-]), $2),
27     [enable_$1=yes n_enable_$1=1],
28     [enable_$1=no n_enable_$1=0])
29   AM_CONDITIONAL(m4_toupper(ENABLE_$1), test "$enable_$1" = "yes")
30   m4_append([list_of_enabled], [$1], [, ])
31 ])
32
33 AC_DEFUN([DISABLE_ARG],
34 [
35   AC_ARG_ENABLE($1,
36     AC_HELP_STRING(patsubst([--disable-$1],[_],[-]), $2),
37     [enable_$1=no n_enable_$1=0],
38     [enable_$1=yes n_enable_$1=1])
39   AM_CONDITIONAL(m4_toupper(ENABLE_$1), test "$enable_$1" = "yes")
40   m4_append([list_of_enabled], [$1], [, ])
41 ])
42
43 AC_DEFUN([WITH_ARG],
44 [
45   AC_ARG_WITH($1,
46     AC_HELP_STRING(patsubst([--with-$1],[_],[-]), $2),
47     [with_$1=yes n_with_$1=1],
48     [with_$1=no n_with_$1=0])
49   AM_CONDITIONAL(m4_toupper(WITH_$1), test "$with_$1" = "yes")
50   m4_append([list_of_with], [$1], [, ])
51 ])
52
53 AC_DEFUN([WITHOUT_ARG],
54 [
55   AC_ARG_WITH($1,
56     AC_HELP_STRING(patsubst([--without-$1],[_],[-]), $2),
57     [with_$1=no n_with_$1=0],
58     [with_$1=yes n_with_$1=1])
59   AM_CONDITIONAL(m4_toupper(WITH_$1), test "$with_$1" = "yes")
60   m4_append([list_of_with], [$1], [, ])
61 ])
62
63 AC_DEFUN([PLUGIN_ENABLED],
64 [
65    AC_ARG_ENABLE($1_plugin,
66      AC_HELP_STRING([--disable-$1-plugin], [Do not build $1 plugin]),
67        [enable_$1_plugin=no],
68        [enable_$1_plugin=yes ])
69   AM_CONDITIONAL(m4_toupper(ENABLE_$1_PLUGIN), test "$enable_$1_plugin" = "yes")
70   m4_append([list_of_plugins], [$1], [, ])
71 ])
72
73 AC_DEFUN([PLUGIN_DISABLED],
74 [
75    AC_ARG_ENABLE($1_plugin,
76      AC_HELP_STRING([--enable-$1-plugin], [Build $1 plugin]),
77        [enable_$1_plugin=yes ],
78        [enable_$1_plugin=no])
79   AM_CONDITIONAL(m4_toupper(ENABLE_$1_PLUGIN), test "$enable_$1_plugin" = "yes")
80   m4_append([list_of_plugins], [$1], [, ])
81 ])
82
83 AC_DEFUN([PRINT_VAL], [ AC_MSG_RESULT(AC_HELP_STRING($1,$2)) ])
84
85 AC_DEFUN([DPDK_IS_PMD_ENABLED],
86 [
87   AC_MSG_CHECKING([for $1 in rte_config.h])
88   AC_COMPILE_IFELSE(
89     [AC_LANG_PROGRAM(
90       [[#include <rte_config.h>]],
91       [[return RTE_$1;]],
92     )],
93     [with_$2=yes]
94     [AC_MSG_RESULT([yes])],
95     [with_$2=no]
96     [AC_MSG_RESULT([no])]
97   )
98   AM_CONDITIONAL(m4_toupper(WITH_$2), test "$with_$2" = "yes")
99   m4_append_uniq([list_of_with], [$2], [, ])
100 ])
101
102 AC_DEFUN([DETECT_DPDK_IS_1702_OR_1705],
103 [
104   AC_MSG_CHECKING([for RTE_VERSION 17.02/17.05 in rte_version.h])
105   AC_TRY_RUN(
106     [
107     #include <rte_version.h>
108     int main()
109     {
110       return ((RTE_VER_YEAR != 17) ||
111               (RTE_VER_MONTH != 2 && RTE_VER_MONTH != 5));
112     }
113     ],
114     [dpdk_is_1702_or_1705=yes]
115     [AC_MSG_RESULT([yes])],
116     [dpdk_is_1702_or_1705=no]
117     [AC_MSG_RESULT([no])]
118   )
119   AM_CONDITIONAL(DPDK_IS_1702_OR_1705, test "$dpdk_is_1702_or_1705" = "yes")
120 ])
121
122 ###############################################################################
123 # configure arguments
124 ###############################################################################
125
126 # --enable-X
127 ENABLE_ARG(tests,       [Enable unit tests])
128 ENABLE_ARG(dpdk_shared, [Enable unit tests])
129 ENABLE_ARG(perftool,    [Enable perftool])
130 ENABLE_ARG(g2,          [Enable g2])
131
132 # --disable-X
133 DISABLE_ARG(vlib,       [Disable vlib and dependant libs and binaries])
134 DISABLE_ARG(svm,        [Disable svm and dependant libs and binaries])
135 DISABLE_ARG(papi,       [Disable Python API bindings])
136 DISABLE_ARG(japi,       [Disable Java API bindings])
137
138 # --with-X
139
140 # --without-X
141 WITHOUT_ARG(libssl,     [Disable libssl])
142 WITHOUT_ARG(apicli,     [Disable binary api CLI])
143
144 AC_ARG_WITH(unix,
145             AC_HELP_STRING([--with-unix],[Compile unix version of clib]),
146             [],
147             [case $host_os in
148               darwin* | linux*) with_unix=yes;;
149               *) with_unix=no;;
150               esac])
151
152 AM_CONDITIONAL(WITH_UNIX, test "$with_unix" = "yes")
153
154 AC_ARG_WITH(pre-data,
155             AC_HELP_STRING([--with-pre-data],[Set buffer rewrite space]),
156             [case $with_pre_data in
157                128) ;;
158                256) ;;
159                *) with_pre_data="pre-data-not-set" ;;
160              esac], [with_pre_data=128])
161
162 ###############################################################################
163 # Substitutions and defines
164 ###############################################################################
165
166 AC_SUBST(PRE_DATA_SIZE,         [$with_pre_data])
167 AC_SUBST(APICLI,                [-DVPP_API_TEST_BUILTIN=${n_with_apicli}])
168
169 AC_DEFINE_UNQUOTED(DPDK_SHARED_LIB,     [${n_enable_dpdk_shared}])
170 AC_DEFINE_UNQUOTED(WITH_LIBSSL,         [${n_with_libssl}])
171
172
173 # Silence following noise:
174 # ar: `u' modifier ignored since `D' is the default (see `U')
175 AR_FLAGS=cr
176 AC_SUBST(AR_FLAGS)
177
178 ###############################################################################
179 # Plugins
180 ###############################################################################
181
182 # Please keep alphabetical order
183 PLUGIN_ENABLED(acl)
184 PLUGIN_ENABLED(dpdk)
185 PLUGIN_ENABLED(flowprobe)
186 PLUGIN_ENABLED(gtpu)
187 PLUGIN_ENABLED(ila)
188 PLUGIN_ENABLED(ioam)
189 PLUGIN_ENABLED(ixge)
190 PLUGIN_ENABLED(lb)
191 PLUGIN_ENABLED(memif)
192 PLUGIN_ENABLED(pppoe)
193 PLUGIN_ENABLED(sixrd)
194 PLUGIN_ENABLED(nat)
195 PLUGIN_ENABLED(stn)
196
197 ###############################################################################
198 # Dependency checks
199 ###############################################################################
200
201 AM_COND_IF([ENABLE_DPDK_SHARED],
202 [
203   AC_CHECK_HEADERS([rte_config.h],
204     [],
205     [AC_MSG_ERROR([DPDK header files not found])],)
206   AC_CHECK_LIB( [dpdk], [rte_eal_init],
207     [],
208     [AC_MSG_ERROR([DPDK shared library not found])],)
209 ])
210
211 with_aesni_mb_lib=no
212 with_isa_l_crypto_lib=no
213
214 DPDK_IS_PMD_ENABLED(LIBRTE_PMD_AESNI_MB, dpdk_aesni_mb_pmd)
215 DPDK_IS_PMD_ENABLED(LIBRTE_PMD_AESNI_GCM, dpdk_aesni_gcm_pmd)
216
217 DETECT_DPDK_IS_1702_OR_1705()
218
219 AM_COND_IF([WITH_DPDK_AESNI_MB_PMD],
220 [
221   AC_CHECK_LIB([IPSec_MB], [submit_job_sse],
222                [with_aesni_mb_lib=yes],
223                [AC_MSG_ERROR([IPSec_MB library not found])])
224 ])
225
226 AM_COND_IF([WITH_DPDK_AESNI_GCM_PMD],
227 [
228   AM_COND_IF([DPDK_IS_1702_OR_1705],
229   [
230     AC_CHECK_LIB([isal_crypto], [aesni_gcm128_init],
231                  [with_isa_l_crypto_lib=yes],
232                  [AC_MSG_ERROR([isal_crypto library not found])])
233   ],
234   [
235     AC_CHECK_LIB([IPSec_MB], [submit_job_sse],
236                  [with_aesni_mb_lib=yes],
237                  [AC_MSG_ERROR([IPSec_MB library not found])])
238   ])
239 ])
240
241 m4_append([list_of_with], [aesni_mb_lib], [, ])
242 AM_CONDITIONAL(WITH_AESNI_MB_LIB, test "$with_aesni_mb_lib" = "yes")
243
244 m4_append([list_of_with], [isa_l_crypto_lib], [, ])
245 AM_CONDITIONAL(WITH_ISA_L_CRYPTO_LIB, test "$with_isa_l_crypto_lib" = "yes")
246
247
248 with_ibverbs_lib=no
249 DPDK_IS_PMD_ENABLED(LIBRTE_MLX4_PMD, dpdk_mlx4_pmd)
250 AM_COND_IF([WITH_DPDK_MLX4_PMD],
251 [
252   AC_CHECK_LIB([ibverbs], [ibv_fork_init],
253                [with_ibverbs_lib=yes],
254                [AC_MSG_ERROR([ibverbs library not found])])
255 ])
256
257 DPDK_IS_PMD_ENABLED(LIBRTE_MLX5_PMD, dpdk_mlx5_pmd)
258 AM_COND_IF([WITH_DPDK_MLX5_PMD],
259 [
260   AC_CHECK_LIB([ibverbs], [ibv_fork_init],
261                [with_ibverbs_lib=yes],
262                [AC_MSG_ERROR([ibverbs library not found])])
263 ])
264
265 m4_append([list_of_with], [ibverbs_lib], [, ])
266 AM_CONDITIONAL(WITH_IBVERBS_LIB, test "$with_ibverbs_lib" = "yes")
267
268
269 AM_COND_IF([ENABLE_G2],
270 [
271   PKG_CHECK_MODULES(g2, gtk+-2.0)
272 ])
273
274 # If cross-compiling, we need external vppapigen and we cannot continue without it
275 # For native builds, we just set dependency on vpppaigen binary in top_builddir
276 AM_COND_IF([CROSSCOMPILE],
277 [
278   AC_PATH_PROG([VPPAPIGEN], [vppapigen], [no])
279   if test "$VPPAPIGEN" = "no"; then
280     AC_MSG_ERROR([Externaly built vppapigen is needed when cross-compiling...])
281   fi
282 ],[
283   VPPAPIGEN=\$\(top_builddir\)/vppapigen
284 ])
285 AC_SUBST([VPPAPIGEN])
286
287
288 ###############################################################################
289 # JAVA
290 ###############################################################################
291
292 AM_COND_IF([ENABLE_JAPI],
293 [
294   AX_VPP_FIND_JDK8
295   AC_SUBST(JAVA_HOME)
296   AC_SUBST(JAVAC)
297   AC_SUBST(JAVAH)
298   AC_SUBST(JAR)
299 ])
300
301 ###############################################################################
302 # PYTHON
303 ###############################################################################
304
305 AM_COND_IF([ENABLE_PAPI],
306 [
307   AM_PATH_PYTHON
308 ])
309
310 ###############################################################################
311 # Output
312 ###############################################################################
313
314 AC_OUTPUT
315
316 AC_MSG_RESULT([==============================================================================])
317 PRINT_VAL([version], $PACKAGE $VERSION)
318 PRINT_VAL([prefix], ${prefix})
319 PRINT_VAL([libdir], ${libdir})
320 PRINT_VAL([includedir], ${includedir})
321 PRINT_VAL([CFLAGS], ${CFLAGS})
322 PRINT_VAL([CPPFLAGS], ${CPPFLAGS})
323 PRINT_VAL([LDFLAGS], ${LDFLAGS})
324 AM_COND_IF([ENABLE_JAPI],
325 [
326   PRINT_VAL([JAVA_VERSION], ${JAVA_VERSION})
327   PRINT_VAL([JAVA_HOME], ${JAVA_HOME})
328 ])
329
330 AC_MSG_RESULT([])
331 AC_MSG_RESULT([with:])
332 m4_foreach([x], m4_dquote(list_of_with), [
333   AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${with_], x, [}])))
334 ])
335
336 AC_MSG_RESULT([])
337 AC_MSG_RESULT([enabled:])
338 m4_foreach([x], m4_dquote(list_of_enabled), [
339   AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${enable_], x, [}])))
340 ])
341
342 AC_MSG_RESULT([])
343 AC_MSG_RESULT([plugins:])
344 m4_foreach([x], m4_dquote(list_of_plugins), [
345   AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${enable_], x, [_plugin}])))
346 ])
347 AC_MSG_RESULT([==============================================================================])
348
349