blob: 8b79cff224f3c0d403a2e844c662db4dbd8153f2 [file] [log] [blame]
Florin Corasa3bae4e2017-09-27 23:31:07 -07001AC_INIT([vpp], [18.01], [vpp-dev@fd.io])
Damjan Marion7cd468a2016-12-19 23:05:39 +01002LT_INIT
3AC_CONFIG_AUX_DIR([.])
4AM_INIT_AUTOMAKE([subdir-objects])
5AM_SILENT_RULES([yes])
Neale Ranns812ed392017-10-16 04:20:13 -07006AC_CONFIG_FILES([Makefile plugins/Makefile vpp-api/python/Makefile vpp-api/java/Makefile vpp-api/vapi/Makefile vpp-api/vom/Makefile])
Damjan Marioncb034b92016-12-28 18:38:59 +01007AC_CONFIG_MACRO_DIR([m4])
Damjan Marion7cd468a2016-12-19 23:05:39 +01008
9AC_PROG_CC
Klement Sekeradc15be22017-06-12 06:49:33 +020010AC_PROG_CXX
Neale Ranns812ed392017-10-16 04:20:13 -070011AC_PROG_CPP
Damjan Marion7cd468a2016-12-19 23:05:39 +010012AM_PROG_AS
13AM_PROG_LIBTOOL
14AC_PROG_YACC
Tomofumi Hayashidc90d422017-01-25 13:53:26 +090015AM_PATH_PYTHON
Damjan Marion7cd468a2016-12-19 23:05:39 +010016
Damjan Marion0be5ec32016-12-28 17:51:56 +010017AM_CONDITIONAL([CROSSCOMPILE], [test "$cross_compiling" == "yes"])
18
Damjan Marion7cd468a2016-12-19 23:05:39 +010019###############################################################################
20# Macros
21###############################################################################
22
23AC_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
33AC_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
43AC_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
53AC_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
63AC_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
73AC_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])
Pablo Camarilloa084d622017-03-03 20:47:55 +010079 AM_CONDITIONAL(m4_toupper(ENABLE_$1_PLUGIN), test "$enable_$1_plugin" = "yes")
Damjan Marion7cd468a2016-12-19 23:05:39 +010080 m4_append([list_of_plugins], [$1], [, ])
81])
82
83AC_DEFUN([PRINT_VAL], [ AC_MSG_RESULT(AC_HELP_STRING($1,$2)) ])
84
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +010085AC_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
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100102AC_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
Damjan Marion7cd468a2016-12-19 23:05:39 +0100122###############################################################################
123# configure arguments
124###############################################################################
125
126# --enable-X
127ENABLE_ARG(tests, [Enable unit tests])
128ENABLE_ARG(dpdk_shared, [Enable unit tests])
129ENABLE_ARG(perftool, [Enable perftool])
130ENABLE_ARG(g2, [Enable g2])
131
132# --disable-X
133DISABLE_ARG(vlib, [Disable vlib and dependant libs and binaries])
134DISABLE_ARG(svm, [Disable svm and dependant libs and binaries])
Damjan Marioncb034b92016-12-28 18:38:59 +0100135DISABLE_ARG(papi, [Disable Python API bindings])
136DISABLE_ARG(japi, [Disable Java API bindings])
Dave Barach7b0c6732017-11-06 16:06:05 -0500137DISABLE_ARG(vom, [Disable VPP object model bindings])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100138
139# --with-X
Damjan Marion7cd468a2016-12-19 23:05:39 +0100140
141# --without-X
Damjan Mariona9a951f2017-01-16 22:06:10 +0100142WITHOUT_ARG(libssl, [Disable libssl])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100143WITHOUT_ARG(apicli, [Disable binary api CLI])
144
145AC_ARG_WITH(unix,
146 AC_HELP_STRING([--with-unix],[Compile unix version of clib]),
147 [],
148 [case $host_os in
149 darwin* | linux*) with_unix=yes;;
150 *) with_unix=no;;
151 esac])
152
153AM_CONDITIONAL(WITH_UNIX, test "$with_unix" = "yes")
154
155AC_ARG_WITH(pre-data,
156 AC_HELP_STRING([--with-pre-data],[Set buffer rewrite space]),
157 [case $with_pre_data in
158 128) ;;
159 256) ;;
160 *) with_pre_data="pre-data-not-set" ;;
161 esac], [with_pre_data=128])
162
163###############################################################################
164# Substitutions and defines
165###############################################################################
166
167AC_SUBST(PRE_DATA_SIZE, [$with_pre_data])
168AC_SUBST(APICLI, [-DVPP_API_TEST_BUILTIN=${n_with_apicli}])
169
Damjan Marion7cd468a2016-12-19 23:05:39 +0100170AC_DEFINE_UNQUOTED(DPDK_SHARED_LIB, [${n_enable_dpdk_shared}])
Damjan Mariona9a951f2017-01-16 22:06:10 +0100171AC_DEFINE_UNQUOTED(WITH_LIBSSL, [${n_with_libssl}])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100172
Damjan Marioncb034b92016-12-28 18:38:59 +0100173
174# Silence following noise:
175# ar: `u' modifier ignored since `D' is the default (see `U')
176AR_FLAGS=cr
177AC_SUBST(AR_FLAGS)
178
179###############################################################################
180# Plugins
181###############################################################################
182
183# Please keep alphabetical order
184PLUGIN_ENABLED(acl)
Damjan Marion374e2c52017-03-09 20:38:15 +0100185PLUGIN_ENABLED(dpdk)
Ole Troan5c749732017-03-13 13:39:52 +0100186PLUGIN_ENABLED(flowprobe)
Hongjun Nief486b12017-04-12 19:21:16 +0800187PLUGIN_ENABLED(gtpu)
Damjan Marioncb034b92016-12-28 18:38:59 +0100188PLUGIN_ENABLED(ila)
189PLUGIN_ENABLED(ioam)
Damjan Marion374e2c52017-03-09 20:38:15 +0100190PLUGIN_ENABLED(ixge)
Damjan Marioncb034b92016-12-28 18:38:59 +0100191PLUGIN_ENABLED(lb)
Damjan Marioneaabe072017-03-22 10:18:13 +0100192PLUGIN_ENABLED(memif)
Hongjun Ni62f9cdd2017-07-04 20:11:57 +0800193PLUGIN_ENABLED(pppoe)
Damjan Marioncb034b92016-12-28 18:38:59 +0100194PLUGIN_ENABLED(sixrd)
Matus Fabian2ba92e32017-08-21 07:05:03 -0700195PLUGIN_ENABLED(nat)
Pierre Pfister0906c5c2017-09-27 16:17:31 +0200196PLUGIN_ENABLED(stn)
Damjan Marioncb034b92016-12-28 18:38:59 +0100197
Damjan Marion7cd468a2016-12-19 23:05:39 +0100198###############################################################################
199# Dependency checks
200###############################################################################
201
202AM_COND_IF([ENABLE_DPDK_SHARED],
203[
204 AC_CHECK_HEADERS([rte_config.h],
205 [],
206 [AC_MSG_ERROR([DPDK header files not found])],)
207 AC_CHECK_LIB( [dpdk], [rte_eal_init],
208 [],
209 [AC_MSG_ERROR([DPDK shared library not found])],)
210])
211
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100212with_aesni_mb_lib=no
213with_isa_l_crypto_lib=no
214
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100215DPDK_IS_PMD_ENABLED(LIBRTE_PMD_AESNI_MB, dpdk_aesni_mb_pmd)
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100216DPDK_IS_PMD_ENABLED(LIBRTE_PMD_AESNI_GCM, dpdk_aesni_gcm_pmd)
217
218DETECT_DPDK_IS_1702_OR_1705()
219
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100220AM_COND_IF([WITH_DPDK_AESNI_MB_PMD],
221[
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100222 AC_CHECK_LIB([IPSec_MB], [submit_job_sse],
223 [with_aesni_mb_lib=yes],
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100224 [AC_MSG_ERROR([IPSec_MB library not found])])
225])
226
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100227AM_COND_IF([WITH_DPDK_AESNI_GCM_PMD],
228[
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100229 AM_COND_IF([DPDK_IS_1702_OR_1705],
230 [
231 AC_CHECK_LIB([isal_crypto], [aesni_gcm128_init],
232 [with_isa_l_crypto_lib=yes],
233 [AC_MSG_ERROR([isal_crypto library not found])])
234 ],
235 [
236 AC_CHECK_LIB([IPSec_MB], [submit_job_sse],
237 [with_aesni_mb_lib=yes],
238 [AC_MSG_ERROR([IPSec_MB library not found])])
239 ])
240])
241
242m4_append([list_of_with], [aesni_mb_lib], [, ])
243AM_CONDITIONAL(WITH_AESNI_MB_LIB, test "$with_aesni_mb_lib" = "yes")
244
245m4_append([list_of_with], [isa_l_crypto_lib], [, ])
246AM_CONDITIONAL(WITH_ISA_L_CRYPTO_LIB, test "$with_isa_l_crypto_lib" = "yes")
247
248
249with_ibverbs_lib=no
250DPDK_IS_PMD_ENABLED(LIBRTE_MLX4_PMD, dpdk_mlx4_pmd)
251AM_COND_IF([WITH_DPDK_MLX4_PMD],
252[
253 AC_CHECK_LIB([ibverbs], [ibv_fork_init],
254 [with_ibverbs_lib=yes],
255 [AC_MSG_ERROR([ibverbs library not found])])
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100256])
257
258DPDK_IS_PMD_ENABLED(LIBRTE_MLX5_PMD, dpdk_mlx5_pmd)
259AM_COND_IF([WITH_DPDK_MLX5_PMD],
260[
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100261 AC_CHECK_LIB([ibverbs], [ibv_fork_init],
262 [with_ibverbs_lib=yes],
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100263 [AC_MSG_ERROR([ibverbs library not found])])
264])
265
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100266m4_append([list_of_with], [ibverbs_lib], [, ])
267AM_CONDITIONAL(WITH_IBVERBS_LIB, test "$with_ibverbs_lib" = "yes")
268
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100269
Damjan Marion7cd468a2016-12-19 23:05:39 +0100270AM_COND_IF([ENABLE_G2],
271[
272 PKG_CHECK_MODULES(g2, gtk+-2.0)
273])
274
Damjan Marion0be5ec32016-12-28 17:51:56 +0100275# If cross-compiling, we need external vppapigen and we cannot continue without it
276# For native builds, we just set dependency on vpppaigen binary in top_builddir
277AM_COND_IF([CROSSCOMPILE],
278[
279 AC_PATH_PROG([VPPAPIGEN], [vppapigen], [no])
280 if test "$VPPAPIGEN" = "no"; then
281 AC_MSG_ERROR([Externaly built vppapigen is needed when cross-compiling...])
282 fi
283],[
284 VPPAPIGEN=\$\(top_builddir\)/vppapigen
285])
286AC_SUBST([VPPAPIGEN])
287
288
Damjan Marion7cd468a2016-12-19 23:05:39 +0100289###############################################################################
Damjan Marioncb034b92016-12-28 18:38:59 +0100290# JAVA
Damjan Marion7cd468a2016-12-19 23:05:39 +0100291###############################################################################
292
Damjan Marioncb034b92016-12-28 18:38:59 +0100293AM_COND_IF([ENABLE_JAPI],
294[
295 AX_VPP_FIND_JDK8
296 AC_SUBST(JAVA_HOME)
297 AC_SUBST(JAVAC)
298 AC_SUBST(JAVAH)
299 AC_SUBST(JAR)
300])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100301
302###############################################################################
Ole Troan3cc49712017-03-08 12:02:24 +0100303# PYTHON
304###############################################################################
305
306AM_COND_IF([ENABLE_PAPI],
307[
308 AM_PATH_PYTHON
309])
310
311###############################################################################
Damjan Marion7cd468a2016-12-19 23:05:39 +0100312# Output
313###############################################################################
314
315AC_OUTPUT
316
317AC_MSG_RESULT([==============================================================================])
318PRINT_VAL([version], $PACKAGE $VERSION)
319PRINT_VAL([prefix], ${prefix})
320PRINT_VAL([libdir], ${libdir})
321PRINT_VAL([includedir], ${includedir})
322PRINT_VAL([CFLAGS], ${CFLAGS})
323PRINT_VAL([CPPFLAGS], ${CPPFLAGS})
324PRINT_VAL([LDFLAGS], ${LDFLAGS})
Damjan Marioncb034b92016-12-28 18:38:59 +0100325AM_COND_IF([ENABLE_JAPI],
326[
327 PRINT_VAL([JAVA_VERSION], ${JAVA_VERSION})
328 PRINT_VAL([JAVA_HOME], ${JAVA_HOME})
329])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100330
331AC_MSG_RESULT([])
332AC_MSG_RESULT([with:])
333m4_foreach([x], m4_dquote(list_of_with), [
334 AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${with_], x, [}])))
335])
336
337AC_MSG_RESULT([])
338AC_MSG_RESULT([enabled:])
339m4_foreach([x], m4_dquote(list_of_enabled), [
340 AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${enable_], x, [}])))
341])
342
343AC_MSG_RESULT([])
344AC_MSG_RESULT([plugins:])
345m4_foreach([x], m4_dquote(list_of_plugins), [
346 AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${enable_], x, [_plugin}])))
347])
348AC_MSG_RESULT([==============================================================================])
349
350