blob: 37e1bb2f6260c32998e7fb955bca78f4806ef1eb [file] [log] [blame]
Dave Wallace2d506672018-01-03 17:09:05 -05001AC_INIT([vpp], [18.04], [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
Damjan Marion04f3db32017-11-10 21:55:45 +0100102# Check if compiler supports specific flag
103AC_DEFUN([CC_CHECK_FLAG],
104[
105 AC_MSG_CHECKING([if $CC supports $1])
106 AC_LANG_PUSH([C])
107 ac_saved_cflags="$CFLAGS"
108 CFLAGS="-Werror $1"
109 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
Damjan Marionbf024e62017-11-14 15:21:19 +0100110 [cc_flag_check=yes],
111 [cc_flag_check=no]
Damjan Marion04f3db32017-11-10 21:55:45 +0100112)
Damjan Marioneecb26d2017-11-15 13:57:20 +0100113 AC_MSG_RESULT([$cc_flag_check])
Damjan Marion04f3db32017-11-10 21:55:45 +0100114 CFLAGS="$ac_saved_cflags"
115 AC_LANG_POP([C])
116])
117
Damjan Marion7cd468a2016-12-19 23:05:39 +0100118###############################################################################
119# configure arguments
120###############################################################################
121
122# --enable-X
123ENABLE_ARG(tests, [Enable unit tests])
124ENABLE_ARG(dpdk_shared, [Enable unit tests])
125ENABLE_ARG(perftool, [Enable perftool])
126ENABLE_ARG(g2, [Enable g2])
127
128# --disable-X
129DISABLE_ARG(vlib, [Disable vlib and dependant libs and binaries])
130DISABLE_ARG(svm, [Disable svm and dependant libs and binaries])
Damjan Marioncb034b92016-12-28 18:38:59 +0100131DISABLE_ARG(papi, [Disable Python API bindings])
132DISABLE_ARG(japi, [Disable Java API bindings])
Dave Barach7b0c6732017-11-06 16:06:05 -0500133DISABLE_ARG(vom, [Disable VPP object model bindings])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100134
135# --with-X
Damjan Marion7cd468a2016-12-19 23:05:39 +0100136
137# --without-X
Damjan Mariona9a951f2017-01-16 22:06:10 +0100138WITHOUT_ARG(libssl, [Disable libssl])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100139WITHOUT_ARG(apicli, [Disable binary api CLI])
Florin Coras371ca502018-02-21 12:07:41 -0800140WITHOUT_ARG(mbedtls, [Disable mbedtls])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100141
142AC_ARG_WITH(unix,
143 AC_HELP_STRING([--with-unix],[Compile unix version of clib]),
144 [],
145 [case $host_os in
146 darwin* | linux*) with_unix=yes;;
147 *) with_unix=no;;
148 esac])
149
150AM_CONDITIONAL(WITH_UNIX, test "$with_unix" = "yes")
151
152AC_ARG_WITH(pre-data,
153 AC_HELP_STRING([--with-pre-data],[Set buffer rewrite space]),
154 [case $with_pre_data in
155 128) ;;
156 256) ;;
157 *) with_pre_data="pre-data-not-set" ;;
158 esac], [with_pre_data=128])
159
160###############################################################################
Damjan Marionba3c7732017-11-10 20:26:50 +0100161# Target CPU flags
162###############################################################################
163
Damjan Marion04f3db32017-11-10 21:55:45 +0100164# Check if compiler supports march=core-avx2
165CC_CHECK_FLAG("-march=core-avx2")
166AS_IF([test "$cc_flag_check" = yes],
167 [march_core_avx2=yes],
168 [march_core_avx2=no])
169AM_CONDITIONAL([CC_SUPPORTS_AVX2], [test "$march_core_avx2" = "yes"])
170
171# Check if compiler supports march=skylake-avx512
172CC_CHECK_FLAG("-march=skylake-avx512")
173AS_IF([test "$cc_flag_check" = yes],
174 [march_skylake_avx512=yes],
175 [march_skylake_avx512=no])
176AM_CONDITIONAL([CC_SUPPORTS_AVX512], [test "$march_skylake_avx512" = "yes"])
177
Damjan Marionba3c7732017-11-10 20:26:50 +0100178AS_CASE([$build_cpu],
179 [x86_64], [CPU_FLAGS="-march=corei7 -mtune=corei7-avx"],
180 [aarch64], [CPU_FLAGS="-march=armv8-a+crc"],
181 [CPU_FLAGS=""],
182)
183AC_SUBST([CPU_FLAGS])
184
Damjan Marion04f3db32017-11-10 21:55:45 +0100185AC_SUBST([CPU_AVX2_FLAGS],"-march=core-avx2 -mtune=core-avx2")
186AC_SUBST([CPU_AVX512_FLAGS],"-march=skylake-avx512 -mtune=skylake-avx512")
187
188AM_CONDITIONAL([CPU_X86_64], [test "$build_cpu" = "x86_64"])
189AM_CONDITIONAL([CPU_AARCH64], [test "$build_cpu" = "aarch64"])
190
Damjan Marionba3c7732017-11-10 20:26:50 +0100191###############################################################################
Damjan Marion7cd468a2016-12-19 23:05:39 +0100192# Substitutions and defines
193###############################################################################
194
195AC_SUBST(PRE_DATA_SIZE, [$with_pre_data])
196AC_SUBST(APICLI, [-DVPP_API_TEST_BUILTIN=${n_with_apicli}])
197
Damjan Marion7cd468a2016-12-19 23:05:39 +0100198AC_DEFINE_UNQUOTED(DPDK_SHARED_LIB, [${n_enable_dpdk_shared}])
Damjan Mariona9a951f2017-01-16 22:06:10 +0100199AC_DEFINE_UNQUOTED(WITH_LIBSSL, [${n_with_libssl}])
Florin Coras371ca502018-02-21 12:07:41 -0800200AC_DEFINE_UNQUOTED(WITH_MBEDTLS, [${n_with_mbedtls}])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100201
Damjan Marioncb034b92016-12-28 18:38:59 +0100202
203# Silence following noise:
204# ar: `u' modifier ignored since `D' is the default (see `U')
205AR_FLAGS=cr
206AC_SUBST(AR_FLAGS)
207
208###############################################################################
209# Plugins
210###############################################################################
211
212# Please keep alphabetical order
213PLUGIN_ENABLED(acl)
Damjan Marion374e2c52017-03-09 20:38:15 +0100214PLUGIN_ENABLED(dpdk)
Ole Troan5c749732017-03-13 13:39:52 +0100215PLUGIN_ENABLED(flowprobe)
Neale Ranns7758bf62018-02-14 06:34:20 -0800216PLUGIN_ENABLED(gbp)
Hongjun Nief486b12017-04-12 19:21:16 +0800217PLUGIN_ENABLED(gtpu)
Damjan Marioncb034b92016-12-28 18:38:59 +0100218PLUGIN_ENABLED(ila)
219PLUGIN_ENABLED(ioam)
Damjan Marion374e2c52017-03-09 20:38:15 +0100220PLUGIN_ENABLED(ixge)
Hongjun Nic91f5022017-08-29 01:00:42 +0800221PLUGIN_ENABLED(kubeproxy)
Neale Ranns7758bf62018-02-14 06:34:20 -0800222PLUGIN_ENABLED(l2e)
Damjan Marioncb034b92016-12-28 18:38:59 +0100223PLUGIN_ENABLED(lb)
Damjan Marion92cdd722017-12-26 13:40:13 +0000224PLUGIN_ENABLED(marvell)
Damjan Marioneaabe072017-03-22 10:18:13 +0100225PLUGIN_ENABLED(memif)
Hongjun Ni62f9cdd2017-07-04 20:11:57 +0800226PLUGIN_ENABLED(pppoe)
Neale Ranns7758bf62018-02-14 06:34:20 -0800227PLUGIN_ENABLED(nat)
Damjan Marioncb034b92016-12-28 18:38:59 +0100228PLUGIN_ENABLED(sixrd)
Francois Cladb4d43d72018-01-17 12:18:41 +0100229PLUGIN_ENABLED(srv6ad)
Francois Clad39d91fe2018-01-17 16:08:41 +0100230PLUGIN_ENABLED(srv6am)
Francois Cladba7992a2018-01-16 17:52:24 +0100231PLUGIN_ENABLED(srv6as)
Pierre Pfister0906c5c2017-09-27 16:17:31 +0200232PLUGIN_ENABLED(stn)
Damjan Marioncb034b92016-12-28 18:38:59 +0100233
Damjan Marion7cd468a2016-12-19 23:05:39 +0100234###############################################################################
235# Dependency checks
236###############################################################################
237
238AM_COND_IF([ENABLE_DPDK_SHARED],
239[
240 AC_CHECK_HEADERS([rte_config.h],
241 [],
242 [AC_MSG_ERROR([DPDK header files not found])],)
243 AC_CHECK_LIB( [dpdk], [rte_eal_init],
244 [],
245 [AC_MSG_ERROR([DPDK shared library not found])],)
246])
247
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100248with_aesni_mb_lib=no
249with_isa_l_crypto_lib=no
250
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100251DPDK_IS_PMD_ENABLED(LIBRTE_PMD_AESNI_MB, dpdk_aesni_mb_pmd)
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100252DPDK_IS_PMD_ENABLED(LIBRTE_PMD_AESNI_GCM, dpdk_aesni_gcm_pmd)
253
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100254AM_COND_IF([WITH_DPDK_AESNI_MB_PMD],
255[
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100256 AC_CHECK_LIB([IPSec_MB], [submit_job_sse],
257 [with_aesni_mb_lib=yes],
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100258 [AC_MSG_ERROR([IPSec_MB library not found])])
259])
260
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100261AM_COND_IF([WITH_DPDK_AESNI_GCM_PMD],
262[
Damjan Marion45b48502017-11-17 09:46:41 +0100263 AC_CHECK_LIB([IPSec_MB], [submit_job_sse],
264 [with_aesni_mb_lib=yes],
265 [AC_MSG_ERROR([IPSec_MB library not found])])
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100266])
267
268m4_append([list_of_with], [aesni_mb_lib], [, ])
269AM_CONDITIONAL(WITH_AESNI_MB_LIB, test "$with_aesni_mb_lib" = "yes")
270
271m4_append([list_of_with], [isa_l_crypto_lib], [, ])
272AM_CONDITIONAL(WITH_ISA_L_CRYPTO_LIB, test "$with_isa_l_crypto_lib" = "yes")
273
274
275with_ibverbs_lib=no
276DPDK_IS_PMD_ENABLED(LIBRTE_MLX4_PMD, dpdk_mlx4_pmd)
277AM_COND_IF([WITH_DPDK_MLX4_PMD],
278[
279 AC_CHECK_LIB([ibverbs], [ibv_fork_init],
280 [with_ibverbs_lib=yes],
281 [AC_MSG_ERROR([ibverbs library not found])])
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100282])
283
284DPDK_IS_PMD_ENABLED(LIBRTE_MLX5_PMD, dpdk_mlx5_pmd)
285AM_COND_IF([WITH_DPDK_MLX5_PMD],
286[
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100287 AC_CHECK_LIB([ibverbs], [ibv_fork_init],
288 [with_ibverbs_lib=yes],
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100289 [AC_MSG_ERROR([ibverbs library not found])])
290])
291
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100292m4_append([list_of_with], [ibverbs_lib], [, ])
293AM_CONDITIONAL(WITH_IBVERBS_LIB, test "$with_ibverbs_lib" = "yes")
294
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100295
Damjan Marion7cd468a2016-12-19 23:05:39 +0100296AM_COND_IF([ENABLE_G2],
297[
298 PKG_CHECK_MODULES(g2, gtk+-2.0)
299])
300
Damjan Marion92cdd722017-12-26 13:40:13 +0000301AM_COND_IF([ENABLE_MARVELL_PLUGIN],
302[
303 AC_CHECK_LIB( [musdk], [pp2_init],
304 [],
305 [
306 AC_MSG_WARN([Marvell MUSDK library with PP2 support not found. Plugin disabled.])
307 enable_marvell_plugin=no
308 AM_CONDITIONAL(ENABLE_MARVELL_PLUGIN, false)
309 ])
310])
311
Florin Coras371ca502018-02-21 12:07:41 -0800312AM_COND_IF([WITH_MBEDTLS],
313[
314 AC_CHECK_HEADERS([mbedtls/ssl.h], [],
315 [
316 AC_MSG_WARN([mbedtls headers not found. TLS app disabled])
317 AM_CONDITIONAL(WITH_MBEDTLS, false)
318 ], [])
319])
320
Ole Troan9d420872017-10-12 13:06:35 +0200321AC_PATH_PROG([VPPAPIGEN], [vppapigen], [no])
322if test "$VPPAPIGEN" = "no"; then
323 VPPAPIGEN=\$\(top_srcdir\)/tools/vppapigen/vppapigen
324fi
Damjan Marion0be5ec32016-12-28 17:51:56 +0100325
Damjan Marion7cd468a2016-12-19 23:05:39 +0100326###############################################################################
Damjan Marioncb034b92016-12-28 18:38:59 +0100327# JAVA
Damjan Marion7cd468a2016-12-19 23:05:39 +0100328###############################################################################
329
Damjan Marioncb034b92016-12-28 18:38:59 +0100330AM_COND_IF([ENABLE_JAPI],
331[
332 AX_VPP_FIND_JDK8
333 AC_SUBST(JAVA_HOME)
334 AC_SUBST(JAVAC)
335 AC_SUBST(JAVAH)
336 AC_SUBST(JAR)
337])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100338
339###############################################################################
Ole Troan3cc49712017-03-08 12:02:24 +0100340# PYTHON
341###############################################################################
342
343AM_COND_IF([ENABLE_PAPI],
344[
345 AM_PATH_PYTHON
346])
347
348###############################################################################
Damjan Marion7cd468a2016-12-19 23:05:39 +0100349# Output
350###############################################################################
351
352AC_OUTPUT
353
354AC_MSG_RESULT([==============================================================================])
355PRINT_VAL([version], $PACKAGE $VERSION)
356PRINT_VAL([prefix], ${prefix})
357PRINT_VAL([libdir], ${libdir})
358PRINT_VAL([includedir], ${includedir})
359PRINT_VAL([CFLAGS], ${CFLAGS})
360PRINT_VAL([CPPFLAGS], ${CPPFLAGS})
361PRINT_VAL([LDFLAGS], ${LDFLAGS})
Damjan Marioncb034b92016-12-28 18:38:59 +0100362AM_COND_IF([ENABLE_JAPI],
363[
364 PRINT_VAL([JAVA_VERSION], ${JAVA_VERSION})
365 PRINT_VAL([JAVA_HOME], ${JAVA_HOME})
366])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100367
368AC_MSG_RESULT([])
369AC_MSG_RESULT([with:])
370m4_foreach([x], m4_dquote(list_of_with), [
371 AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${with_], x, [}])))
372])
373
374AC_MSG_RESULT([])
375AC_MSG_RESULT([enabled:])
376m4_foreach([x], m4_dquote(list_of_enabled), [
377 AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${enable_], x, [}])))
378])
379
380AC_MSG_RESULT([])
381AC_MSG_RESULT([plugins:])
382m4_foreach([x], m4_dquote(list_of_plugins), [
383 AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${enable_], x, [_plugin}])))
384])
385AC_MSG_RESULT([==============================================================================])
386
387