1 AC_INIT([vpp], [18.07], [vpp-dev@fd.io])
4 AM_INIT_AUTOMAKE([subdir-objects])
9 vpp-api/python/Makefile \
10 vpp-api/java/Makefile \
11 vpp-api/vapi/Makefile \
14 AC_CONFIG_MACRO_DIR([m4])
22 AM_CONDITIONAL([CROSSCOMPILE], [test "$cross_compiling" == "yes"])
24 ###############################################################################
26 ###############################################################################
28 AC_DEFUN([ENABLE_ARG],
31 AC_HELP_STRING(patsubst([--enable-$1],[_],[-]), $2),
32 [enable_$1=yes n_enable_$1=1],
33 [enable_$1=no n_enable_$1=0])
34 AM_CONDITIONAL(m4_toupper(ENABLE_$1), test "$enable_$1" = "yes")
35 m4_append([list_of_enabled], [$1], [, ])
38 AC_DEFUN([DISABLE_ARG],
41 AC_HELP_STRING(patsubst([--disable-$1],[_],[-]), $2),
42 [enable_$1=no n_enable_$1=0],
43 [enable_$1=yes n_enable_$1=1])
44 AM_CONDITIONAL(m4_toupper(ENABLE_$1), test "$enable_$1" = "yes")
45 m4_append([list_of_enabled], [$1], [, ])
51 AC_HELP_STRING(patsubst([--with-$1],[_],[-]), $2),
52 [with_$1=yes n_with_$1=1],
53 [with_$1=no n_with_$1=0])
54 AM_CONDITIONAL(m4_toupper(WITH_$1), test "$with_$1" = "yes")
55 m4_append([list_of_with], [$1], [, ])
58 AC_DEFUN([WITHOUT_ARG],
61 AC_HELP_STRING(patsubst([--without-$1],[_],[-]), $2),
62 [with_$1=no n_with_$1=0],
63 [with_$1=yes n_with_$1=1])
64 AM_CONDITIONAL(m4_toupper(WITH_$1), test "$with_$1" = "yes")
65 m4_append([list_of_with], [$1], [, ])
68 AC_DEFUN([PLUGIN_ENABLED],
70 AC_ARG_ENABLE($1_plugin,
71 AC_HELP_STRING([--disable-$1-plugin], [Do not build $1 plugin]),
72 [enable_$1_plugin=no],
73 [enable_$1_plugin=yes ])
74 AM_CONDITIONAL(m4_toupper(ENABLE_$1_PLUGIN), test "$enable_$1_plugin" = "yes")
75 m4_append([list_of_plugins], [$1], [, ])
78 AC_DEFUN([PLUGIN_DISABLED],
80 AC_ARG_ENABLE($1_plugin,
81 AC_HELP_STRING([--enable-$1-plugin], [Build $1 plugin]),
82 [enable_$1_plugin=yes ],
83 [enable_$1_plugin=no])
84 AM_CONDITIONAL(m4_toupper(ENABLE_$1_PLUGIN), test "$enable_$1_plugin" = "yes")
85 m4_append([list_of_plugins], [$1], [, ])
88 AC_DEFUN([PRINT_VAL], [ AC_MSG_RESULT(AC_HELP_STRING($1,$2)) ])
90 AC_DEFUN([DPDK_IS_PMD_ENABLED],
92 AC_MSG_CHECKING([for $1 in rte_config.h])
95 [[#include <rte_config.h>]],
99 [AC_MSG_RESULT([yes])],
101 [AC_MSG_RESULT([no])]
103 AM_CONDITIONAL(m4_toupper(WITH_$2), test "$with_$2" = "yes")
104 m4_append_uniq([list_of_with], [$2], [, ])
107 # Check if compiler supports specific flag
108 AC_DEFUN([CC_CHECK_FLAG],
110 AC_MSG_CHECKING([if $CC supports $1])
112 ac_saved_cflags="$CFLAGS"
114 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
118 AC_MSG_RESULT([$cc_flag_check])
119 CFLAGS="$ac_saved_cflags"
123 # This function deduces the BUILD HOST cache-line size by
124 # inspecting /sys and/or /proc depending on the kernel / arch in use
125 as_fn_log2_cache_line_size_p()
127 sysfs_cache_path="/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size"
128 m4_define([read_cache_line_size_from_sysfs], [`head -n 1 $1`])
129 m4_define([read_midr_implementer],
130 [`awk '/implementer/ {print $[]4;exit}' /proc/cpuinfo`])
131 m4_define([read_midr_cpuid],
132 [`awk '/part/ {print $[]4;exit}' /proc/cpuinfo`])
134 #Check if sysfs path exists,to ignore warning, else do manual mapping
135 AC_CHECK_FILE($sysfs_cache_path,
137 cache_line_size=read_cache_line_size_from_sysfs($sysfs_cache_path);
138 if test $cache_line_size = "32" ; then
139 log2_cache_line_size="5";
140 elif test $cache_line_size = "64" ; then
141 log2_cache_line_size="6";
142 elif test $cache_line_size = "128" ; then
143 log2_cache_line_size="7";
145 AC_MSG_NOTICE([cache_line_size/log2_cache_line_size deduced as $cache_line_size/$log2_cache_line_size])
148 #Define Implementer Ids here
149 implementer_id_cavium=0x43
152 cpu_id_cavium_thunderx_cn88xx=0x0a1
153 cpu_id_cavium_thunderx2_cn99xx=0x0af
155 implementer=read_midr_implementer()
156 cpuid=read_midr_cpuid()
158 AC_MSG_CHECKING([for implementerid/cpuid to set log2_cache_line_size])
160 # Switch case to map log2_cache_line_size for implementer/cpuid combination.
161 # Default case of Switch sets log2_cache_line_size to 6
162 AS_CASE($implementer,
163 #Switch Case for Cavium SoC's
164 [$implementer_id_cavium],
166 #Only ThunderX2 is 64B. Remaining chips are 128B
167 [$cpu_id_cavium_thunderx2_cn99xx],
168 [AC_MSG_RESULT([Cavium/ThunderX2]);log2_cache_line_size=6],
169 [$cpu_id_cavium_thunderx_cn88xx],
170 [AC_MSG_RESULT([Cavium/ThunderX]);log2_cache_line_size=7],
171 [log2_cache_line_size=7;AC_MSG_RESULT([Cavium/OCTEONTx($cpuid)])]
173 #Add implementer specific case here:
175 #Default case: 64B for all SoC's
176 [log2_cache_line_size=6;AC_MSG_RESULT([$implementer/$cpuid])]
178 AC_MSG_NOTICE([log2_cache_line_size deduced as $log2_cache_line_size])
181 echo $log2_cache_line_size
184 ###############################################################################
185 # configure arguments
186 ###############################################################################
189 ENABLE_ARG(tests, [Enable unit tests])
190 ENABLE_ARG(dpdk_shared, [Enable unit tests])
191 ENABLE_ARG(perftool, [Enable perftool])
192 ENABLE_ARG(g2, [Enable g2])
195 DISABLE_ARG(vlib, [Disable vlib and dependant libs and binaries])
196 DISABLE_ARG(svm, [Disable svm and dependant libs and binaries])
197 DISABLE_ARG(papi, [Disable Python API bindings])
198 DISABLE_ARG(japi, [Disable Java API bindings])
203 WITHOUT_ARG(libssl, [Disable libssl])
204 WITHOUT_ARG(apicli, [Disable binary api CLI])
205 WITHOUT_ARG(mbedtls, [Disable mbedtls])
206 WITHOUT_ARG(libnuma, [for non numa architectures])
208 AC_ARG_WITH(log2-cache-line-bytes,
209 AC_HELP_STRING([--with-log2-cache-line-bytes],[Set the cache line size, --with-log2-cache-line-bytes=5|6|7|auto]),
210 [case $with_log2_cache_line_bytes in
212 auto) with_log2_cache_line_bytes=`as_fn_log2_cache_line_size_p`;;
213 *) with_log2_cache_line_bytes="CONFIG_ERROR";;
215 [with_log2_cache_line_bytes=`as_fn_log2_cache_line_size_p`])
218 AC_HELP_STRING([--with-unix],[Compile unix version of clib]),
221 darwin* | linux*) with_unix=yes;;
225 AM_CONDITIONAL(WITH_UNIX, test "$with_unix" = "yes")
227 AC_ARG_WITH(pre-data,
228 AC_HELP_STRING([--with-pre-data],[Set buffer rewrite space]),
229 [case $with_pre_data in
232 *) with_pre_data="pre-data-not-set" ;;
233 esac], [with_pre_data=128])
235 ###############################################################################
237 ###############################################################################
239 # Check if compiler supports march=core-avx2
240 CC_CHECK_FLAG("-march=core-avx2")
241 AS_IF([test "$cc_flag_check" = yes],
242 [march_core_avx2=yes],
243 [march_core_avx2=no])
244 AM_CONDITIONAL([CC_SUPPORTS_AVX2], [test "$march_core_avx2" = "yes"])
246 # Check if compiler supports march=skylake-avx512
247 CC_CHECK_FLAG("-march=skylake-avx512")
248 AS_IF([test "$cc_flag_check" = yes],
249 [march_skylake_avx512=yes],
250 [march_skylake_avx512=no])
251 AM_CONDITIONAL([CC_SUPPORTS_AVX512], [test "$march_skylake_avx512" = "yes"])
254 [x86_64], [CPU_FLAGS="-march=corei7 -mtune=corei7-avx"],
255 [aarch64], [CPU_FLAGS="-march=armv8-a+crc"],
258 AC_SUBST([CPU_FLAGS])
260 AC_SUBST([CPU_AVX2_FLAGS],"-march=core-avx2 -mtune=core-avx2")
261 AC_SUBST([CPU_AVX512_FLAGS],"-march=skylake-avx512 -mtune=skylake-avx512")
263 AM_CONDITIONAL([CPU_X86_64], [test "$host_cpu" = "x86_64"])
264 AM_CONDITIONAL([CPU_AARCH64], [test "$host_cpu" = "aarch64"])
266 ###############################################################################
267 # misc compiler flags
268 ###############################################################################
270 CC_CHECK_FLAG("-Wno-address-of-packed-member")
271 AS_IF([test "$cc_flag_check" = yes],
272 [CFLAGS="${CFLAGS} -Wno-address-of-packed-member"], [])
274 ###############################################################################
275 # Substitutions and defines
276 ###############################################################################
278 AC_SUBST(PRE_DATA_SIZE, [$with_pre_data])
279 AC_SUBST(LOG2_CACHE_LINE_BYTES, [$with_log2_cache_line_bytes])
280 AC_SUBST(APICLI, [-DVPP_API_TEST_BUILTIN=${n_with_apicli}])
282 AC_DEFINE_UNQUOTED(DPDK_SHARED_LIB, [${n_enable_dpdk_shared}])
283 AC_DEFINE_UNQUOTED(WITH_LIBSSL, [${n_with_libssl}])
284 AC_DEFINE_UNQUOTED(WITH_MBEDTLS, [${n_with_mbedtls}])
285 AC_DEFINE_UNQUOTED(WITH_LIBNUMA, [${n_with_libnuma}])
288 # Silence following noise:
289 # ar: `u' modifier ignored since `D' is the default (see `U')
293 ###############################################################################
295 ###############################################################################
297 # Please keep alphabetical order
303 PLUGIN_ENABLED(flowprobe)
313 PLUGIN_ENABLED(mactime)
314 PLUGIN_ENABLED(marvell)
315 PLUGIN_ENABLED(memif)
316 PLUGIN_ENABLED(pppoe)
318 PLUGIN_ENABLED(srv6ad)
319 PLUGIN_ENABLED(srv6am)
320 PLUGIN_ENABLED(srv6as)
322 PLUGIN_ENABLED(tlsmbedtls)
323 PLUGIN_ENABLED(tlsopenssl)
325 ###############################################################################
327 ###############################################################################
328 AC_CHECK_FUNC([memfd_create], [AC_DEFINE([HAVE_MEMFD_CREATE], [1], [Define if memfd exists])])
330 AM_COND_IF([ENABLE_DPDK_SHARED],
332 AC_CHECK_HEADERS([rte_config.h],
334 [AC_MSG_ERROR([DPDK header files not found])],)
335 AC_CHECK_LIB( [dpdk], [rte_eal_init],
337 [AC_MSG_ERROR([DPDK shared library not found])],)
341 with_isa_l_crypto_lib=no
343 DPDK_IS_PMD_ENABLED(LIBRTE_PMD_AESNI_MB, dpdk_aesni_mb_pmd)
344 DPDK_IS_PMD_ENABLED(LIBRTE_PMD_AESNI_GCM, dpdk_aesni_gcm_pmd)
346 AM_COND_IF([WITH_DPDK_AESNI_MB_PMD],
348 AC_CHECK_LIB([IPSec_MB], [submit_job_sse],
349 [with_aesni_mb_lib=yes],
350 [AC_MSG_ERROR([IPSec_MB library not found])])
353 AM_COND_IF([WITH_DPDK_AESNI_GCM_PMD],
355 AC_CHECK_LIB([IPSec_MB], [submit_job_sse],
356 [with_aesni_mb_lib=yes],
357 [AC_MSG_ERROR([IPSec_MB library not found])])
360 m4_append([list_of_with], [aesni_mb_lib], [, ])
361 AM_CONDITIONAL(WITH_AESNI_MB_LIB, test "$with_aesni_mb_lib" = "yes")
363 m4_append([list_of_with], [isa_l_crypto_lib], [, ])
364 AM_CONDITIONAL(WITH_ISA_L_CRYPTO_LIB, test "$with_isa_l_crypto_lib" = "yes")
366 AM_COND_IF([ENABLE_G2],
368 PKG_CHECK_MODULES(g2, gtk+-2.0)
371 AM_COND_IF([ENABLE_MARVELL_PLUGIN],
373 AC_CHECK_LIB( [musdk], [pp2_init],
376 AC_MSG_WARN([Marvell MUSDK library with PP2 support not found. Plugin disabled.])
377 enable_marvell_plugin=no
378 AM_CONDITIONAL(ENABLE_MARVELL_PLUGIN, false)
382 AM_COND_IF([WITH_MBEDTLS], [],
384 AC_MSG_WARN([mbedtls not enabled. Disabling tlsmbedtls plugin])
385 enable_tlsmbedtls_plugin=no
386 AM_CONDITIONAL(ENABLE_TLSMBEDTLS_PLUGIN, false)
389 AM_COND_IF([ENABLE_TLSMBEDTLS_PLUGIN],
391 AC_CHECK_HEADERS([mbedtls/ssl.h], [],
393 AC_MSG_WARN([mbedtls headers not found. TLS engine implementation disabled])
394 enable_tlsmbedtls_plugin=no
395 AM_CONDITIONAL(ENABLE_TLSMBEDTLS_PLUGIN, false)
399 AM_COND_IF([WITH_LIBSSL],
401 AC_CHECK_LIB([ssl -lcrypto], [SSL_set_async_callback],
403 AC_DEFINE([HAVE_OPENSSL_ASYNC], [1], [Define if new openssl interface exists])
407 AC_MSG_WARN([openssl not enabled. Disabling tlsopenssl plugin])
408 enable_tlsopenssl_plugin=no
409 AM_CONDITIONAL(ENABLE_TLSOPENSSL_PLUGIN, false)
412 ###############################################################################
414 ###############################################################################
416 AM_COND_IF([ENABLE_JAPI],
425 ###############################################################################
427 ###############################################################################
429 AM_COND_IF([ENABLE_PAPI],
434 ###############################################################################
436 ###############################################################################
440 AC_MSG_RESULT([==============================================================================])
441 PRINT_VAL([version], $PACKAGE $VERSION)
442 PRINT_VAL([prefix], ${prefix})
443 PRINT_VAL([libdir], ${libdir})
444 PRINT_VAL([includedir], ${includedir})
445 PRINT_VAL([CFLAGS], ${CFLAGS})
446 PRINT_VAL([CPPFLAGS], ${CPPFLAGS})
447 PRINT_VAL([LDFLAGS], ${LDFLAGS})
448 PRINT_VAL([LOG2_CACHE_LINE_BYTES], ${with_log2_cache_line_bytes})
449 AM_COND_IF([ENABLE_JAPI],
451 PRINT_VAL([JAVA_VERSION], ${JAVA_VERSION})
452 PRINT_VAL([JAVA_HOME], ${JAVA_HOME})
456 AC_MSG_RESULT([with:])
457 m4_foreach([x], m4_dquote(list_of_with), [
458 AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${with_], x, [}])))
462 AC_MSG_RESULT([enabled:])
463 m4_foreach([x], m4_dquote(list_of_enabled), [
464 AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${enable_], x, [}])))
468 AC_MSG_RESULT([plugins:])
469 m4_foreach([x], m4_dquote(list_of_plugins), [
470 AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${enable_], x, [_plugin}])))
472 AC_MSG_RESULT([==============================================================================])