blob: ca967bb0a9d30205624317a4c3e63bfd51d1be8b [file] [log] [blame]
Chris Luke7c6df392018-04-04 16:41:56 -04001AC_INIT([vpp], [18.07], [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])
Damjan Marion164e5f82018-04-25 19:11:15 +02006AC_CONFIG_FILES([Makefile plugins/Makefile vpp-api/python/Makefile vpp-api/java/Makefile vpp-api/vapi/Makefile])
Damjan Marioncb034b92016-12-28 18:38:59 +01007AC_CONFIG_MACRO_DIR([m4])
Damjan Marion7cd468a2016-12-19 23:05:39 +01008
9AC_PROG_CC
Neale Ranns812ed392017-10-16 04:20:13 -070010AC_PROG_CPP
Damjan Marion7cd468a2016-12-19 23:05:39 +010011AM_PROG_AS
12AM_PROG_LIBTOOL
Tomofumi Hayashidc90d422017-01-25 13:53:26 +090013AM_PATH_PYTHON
Damjan Marion7cd468a2016-12-19 23:05:39 +010014
Damjan Marion0be5ec32016-12-28 17:51:56 +010015AM_CONDITIONAL([CROSSCOMPILE], [test "$cross_compiling" == "yes"])
16
Damjan Marion7cd468a2016-12-19 23:05:39 +010017###############################################################################
18# Macros
19###############################################################################
20
21AC_DEFUN([ENABLE_ARG],
22[
23 AC_ARG_ENABLE($1,
24 AC_HELP_STRING(patsubst([--enable-$1],[_],[-]), $2),
25 [enable_$1=yes n_enable_$1=1],
26 [enable_$1=no n_enable_$1=0])
27 AM_CONDITIONAL(m4_toupper(ENABLE_$1), test "$enable_$1" = "yes")
28 m4_append([list_of_enabled], [$1], [, ])
29])
30
31AC_DEFUN([DISABLE_ARG],
32[
33 AC_ARG_ENABLE($1,
34 AC_HELP_STRING(patsubst([--disable-$1],[_],[-]), $2),
35 [enable_$1=no n_enable_$1=0],
36 [enable_$1=yes n_enable_$1=1])
37 AM_CONDITIONAL(m4_toupper(ENABLE_$1), test "$enable_$1" = "yes")
38 m4_append([list_of_enabled], [$1], [, ])
39])
40
41AC_DEFUN([WITH_ARG],
42[
43 AC_ARG_WITH($1,
44 AC_HELP_STRING(patsubst([--with-$1],[_],[-]), $2),
45 [with_$1=yes n_with_$1=1],
46 [with_$1=no n_with_$1=0])
47 AM_CONDITIONAL(m4_toupper(WITH_$1), test "$with_$1" = "yes")
48 m4_append([list_of_with], [$1], [, ])
49])
50
51AC_DEFUN([WITHOUT_ARG],
52[
53 AC_ARG_WITH($1,
54 AC_HELP_STRING(patsubst([--without-$1],[_],[-]), $2),
55 [with_$1=no n_with_$1=0],
56 [with_$1=yes n_with_$1=1])
57 AM_CONDITIONAL(m4_toupper(WITH_$1), test "$with_$1" = "yes")
58 m4_append([list_of_with], [$1], [, ])
59])
60
61AC_DEFUN([PLUGIN_ENABLED],
62[
63 AC_ARG_ENABLE($1_plugin,
64 AC_HELP_STRING([--disable-$1-plugin], [Do not build $1 plugin]),
65 [enable_$1_plugin=no],
66 [enable_$1_plugin=yes ])
67 AM_CONDITIONAL(m4_toupper(ENABLE_$1_PLUGIN), test "$enable_$1_plugin" = "yes")
68 m4_append([list_of_plugins], [$1], [, ])
69])
70
71AC_DEFUN([PLUGIN_DISABLED],
72[
73 AC_ARG_ENABLE($1_plugin,
74 AC_HELP_STRING([--enable-$1-plugin], [Build $1 plugin]),
75 [enable_$1_plugin=yes ],
76 [enable_$1_plugin=no])
Pablo Camarilloa084d622017-03-03 20:47:55 +010077 AM_CONDITIONAL(m4_toupper(ENABLE_$1_PLUGIN), test "$enable_$1_plugin" = "yes")
Damjan Marion7cd468a2016-12-19 23:05:39 +010078 m4_append([list_of_plugins], [$1], [, ])
79])
80
81AC_DEFUN([PRINT_VAL], [ AC_MSG_RESULT(AC_HELP_STRING($1,$2)) ])
82
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +010083AC_DEFUN([DPDK_IS_PMD_ENABLED],
84[
85 AC_MSG_CHECKING([for $1 in rte_config.h])
86 AC_COMPILE_IFELSE(
87 [AC_LANG_PROGRAM(
88 [[#include <rte_config.h>]],
89 [[return RTE_$1;]],
90 )],
91 [with_$2=yes]
92 [AC_MSG_RESULT([yes])],
93 [with_$2=no]
94 [AC_MSG_RESULT([no])]
95 )
96 AM_CONDITIONAL(m4_toupper(WITH_$2), test "$with_$2" = "yes")
97 m4_append_uniq([list_of_with], [$2], [, ])
98])
99
Damjan Marion04f3db32017-11-10 21:55:45 +0100100# Check if compiler supports specific flag
101AC_DEFUN([CC_CHECK_FLAG],
102[
103 AC_MSG_CHECKING([if $CC supports $1])
104 AC_LANG_PUSH([C])
105 ac_saved_cflags="$CFLAGS"
106 CFLAGS="-Werror $1"
107 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
Damjan Marionbf024e62017-11-14 15:21:19 +0100108 [cc_flag_check=yes],
109 [cc_flag_check=no]
Damjan Marion04f3db32017-11-10 21:55:45 +0100110)
Damjan Marioneecb26d2017-11-15 13:57:20 +0100111 AC_MSG_RESULT([$cc_flag_check])
Damjan Marion04f3db32017-11-10 21:55:45 +0100112 CFLAGS="$ac_saved_cflags"
113 AC_LANG_POP([C])
114])
115
Damjan Marion7cd468a2016-12-19 23:05:39 +0100116###############################################################################
117# configure arguments
118###############################################################################
119
120# --enable-X
121ENABLE_ARG(tests, [Enable unit tests])
122ENABLE_ARG(dpdk_shared, [Enable unit tests])
123ENABLE_ARG(perftool, [Enable perftool])
124ENABLE_ARG(g2, [Enable g2])
125
126# --disable-X
127DISABLE_ARG(vlib, [Disable vlib and dependant libs and binaries])
128DISABLE_ARG(svm, [Disable svm and dependant libs and binaries])
Damjan Marioncb034b92016-12-28 18:38:59 +0100129DISABLE_ARG(papi, [Disable Python API bindings])
130DISABLE_ARG(japi, [Disable Java API bindings])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100131
132# --with-X
Damjan Marion7cd468a2016-12-19 23:05:39 +0100133
134# --without-X
Damjan Mariona9a951f2017-01-16 22:06:10 +0100135WITHOUT_ARG(libssl, [Disable libssl])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100136WITHOUT_ARG(apicli, [Disable binary api CLI])
Florin Coras371ca502018-02-21 12:07:41 -0800137WITHOUT_ARG(mbedtls, [Disable mbedtls])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100138
139AC_ARG_WITH(unix,
140 AC_HELP_STRING([--with-unix],[Compile unix version of clib]),
141 [],
142 [case $host_os in
143 darwin* | linux*) with_unix=yes;;
144 *) with_unix=no;;
145 esac])
146
147AM_CONDITIONAL(WITH_UNIX, test "$with_unix" = "yes")
148
149AC_ARG_WITH(pre-data,
150 AC_HELP_STRING([--with-pre-data],[Set buffer rewrite space]),
151 [case $with_pre_data in
152 128) ;;
153 256) ;;
154 *) with_pre_data="pre-data-not-set" ;;
155 esac], [with_pre_data=128])
156
157###############################################################################
Damjan Marionba3c7732017-11-10 20:26:50 +0100158# Target CPU flags
159###############################################################################
160
Damjan Marion04f3db32017-11-10 21:55:45 +0100161# Check if compiler supports march=core-avx2
162CC_CHECK_FLAG("-march=core-avx2")
163AS_IF([test "$cc_flag_check" = yes],
164 [march_core_avx2=yes],
165 [march_core_avx2=no])
166AM_CONDITIONAL([CC_SUPPORTS_AVX2], [test "$march_core_avx2" = "yes"])
167
168# Check if compiler supports march=skylake-avx512
169CC_CHECK_FLAG("-march=skylake-avx512")
170AS_IF([test "$cc_flag_check" = yes],
171 [march_skylake_avx512=yes],
172 [march_skylake_avx512=no])
173AM_CONDITIONAL([CC_SUPPORTS_AVX512], [test "$march_skylake_avx512" = "yes"])
174
Sachin Saxena432bf672018-05-04 15:08:29 +0530175AS_CASE([$host_cpu],
Damjan Marionba3c7732017-11-10 20:26:50 +0100176 [x86_64], [CPU_FLAGS="-march=corei7 -mtune=corei7-avx"],
177 [aarch64], [CPU_FLAGS="-march=armv8-a+crc"],
178 [CPU_FLAGS=""],
179)
180AC_SUBST([CPU_FLAGS])
181
Damjan Marion04f3db32017-11-10 21:55:45 +0100182AC_SUBST([CPU_AVX2_FLAGS],"-march=core-avx2 -mtune=core-avx2")
183AC_SUBST([CPU_AVX512_FLAGS],"-march=skylake-avx512 -mtune=skylake-avx512")
184
Sachin Saxena432bf672018-05-04 15:08:29 +0530185AM_CONDITIONAL([CPU_X86_64], [test "$host_cpu" = "x86_64"])
186AM_CONDITIONAL([CPU_AARCH64], [test "$host_cpu" = "aarch64"])
Damjan Marion04f3db32017-11-10 21:55:45 +0100187
Damjan Marionba3c7732017-11-10 20:26:50 +0100188###############################################################################
Damjan Marion74a6dab2018-03-26 13:36:46 +0200189# misc compiler flags
190###############################################################################
191
192CC_CHECK_FLAG("-Wno-address-of-packed-member")
193AS_IF([test "$cc_flag_check" = yes],
194 [CFLAGS="${CFLAGS} -Wno-address-of-packed-member"], [])
195
196###############################################################################
Damjan Marion7cd468a2016-12-19 23:05:39 +0100197# Substitutions and defines
198###############################################################################
199
200AC_SUBST(PRE_DATA_SIZE, [$with_pre_data])
201AC_SUBST(APICLI, [-DVPP_API_TEST_BUILTIN=${n_with_apicli}])
202
Damjan Marion7cd468a2016-12-19 23:05:39 +0100203AC_DEFINE_UNQUOTED(DPDK_SHARED_LIB, [${n_enable_dpdk_shared}])
Damjan Mariona9a951f2017-01-16 22:06:10 +0100204AC_DEFINE_UNQUOTED(WITH_LIBSSL, [${n_with_libssl}])
Florin Coras371ca502018-02-21 12:07:41 -0800205AC_DEFINE_UNQUOTED(WITH_MBEDTLS, [${n_with_mbedtls}])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100206
Damjan Marioncb034b92016-12-28 18:38:59 +0100207
208# Silence following noise:
209# ar: `u' modifier ignored since `D' is the default (see `U')
210AR_FLAGS=cr
211AC_SUBST(AR_FLAGS)
212
213###############################################################################
214# Plugins
215###############################################################################
216
217# Please keep alphabetical order
Andrew Yourtchenko669d07d2017-11-17 14:38:18 +0100218PLUGIN_ENABLED(abf)
Damjan Marioncb034b92016-12-28 18:38:59 +0100219PLUGIN_ENABLED(acl)
Damjan Marionb4ff07a2018-02-07 22:35:06 +0100220PLUGIN_ENABLED(avf)
Dave Barachaaacfbc2018-03-10 14:57:00 -0500221PLUGIN_ENABLED(cdp)
Damjan Marion374e2c52017-03-09 20:38:15 +0100222PLUGIN_ENABLED(dpdk)
Ole Troan5c749732017-03-13 13:39:52 +0100223PLUGIN_ENABLED(flowprobe)
Neale Ranns7758bf62018-02-14 06:34:20 -0800224PLUGIN_ENABLED(gbp)
Hongjun Nief486b12017-04-12 19:21:16 +0800225PLUGIN_ENABLED(gtpu)
Jakub Grajciar7b867a82017-12-08 16:28:42 +0100226PLUGIN_ENABLED(igmp)
Damjan Marioncb034b92016-12-28 18:38:59 +0100227PLUGIN_ENABLED(ila)
228PLUGIN_ENABLED(ioam)
Damjan Marion374e2c52017-03-09 20:38:15 +0100229PLUGIN_ENABLED(ixge)
Hongjun Nic91f5022017-08-29 01:00:42 +0800230PLUGIN_ENABLED(kubeproxy)
Neale Ranns7758bf62018-02-14 06:34:20 -0800231PLUGIN_ENABLED(l2e)
Steven9cd2d7a2017-12-20 12:43:01 -0800232PLUGIN_ENABLED(lacp)
Damjan Marioncb034b92016-12-28 18:38:59 +0100233PLUGIN_ENABLED(lb)
Damjan Marion92cdd722017-12-26 13:40:13 +0000234PLUGIN_ENABLED(marvell)
Damjan Marioneaabe072017-03-22 10:18:13 +0100235PLUGIN_ENABLED(memif)
Hongjun Ni62f9cdd2017-07-04 20:11:57 +0800236PLUGIN_ENABLED(pppoe)
Neale Ranns7758bf62018-02-14 06:34:20 -0800237PLUGIN_ENABLED(nat)
Francois Cladb4d43d72018-01-17 12:18:41 +0100238PLUGIN_ENABLED(srv6ad)
Francois Clad39d91fe2018-01-17 16:08:41 +0100239PLUGIN_ENABLED(srv6am)
Francois Cladba7992a2018-01-16 17:52:24 +0100240PLUGIN_ENABLED(srv6as)
Pierre Pfister0906c5c2017-09-27 16:17:31 +0200241PLUGIN_ENABLED(stn)
Florin Corasd77eee62018-03-07 08:49:27 -0800242PLUGIN_ENABLED(tlsmbedtls)
Florin Coras58d36f02018-03-09 13:05:53 -0800243PLUGIN_ENABLED(tlsopenssl)
Damjan Marioncb034b92016-12-28 18:38:59 +0100244
Damjan Marion7cd468a2016-12-19 23:05:39 +0100245###############################################################################
246# Dependency checks
247###############################################################################
Marco Varlese3f6ede32018-03-06 08:09:04 +0100248AC_CHECK_FUNC([memfd_create], [AC_DEFINE([HAVE_MEMFD_CREATE], [1], [Define if memfd exists])])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100249
250AM_COND_IF([ENABLE_DPDK_SHARED],
251[
252 AC_CHECK_HEADERS([rte_config.h],
253 [],
254 [AC_MSG_ERROR([DPDK header files not found])],)
255 AC_CHECK_LIB( [dpdk], [rte_eal_init],
256 [],
257 [AC_MSG_ERROR([DPDK shared library not found])],)
258])
259
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100260with_aesni_mb_lib=no
261with_isa_l_crypto_lib=no
262
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100263DPDK_IS_PMD_ENABLED(LIBRTE_PMD_AESNI_MB, dpdk_aesni_mb_pmd)
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100264DPDK_IS_PMD_ENABLED(LIBRTE_PMD_AESNI_GCM, dpdk_aesni_gcm_pmd)
265
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100266AM_COND_IF([WITH_DPDK_AESNI_MB_PMD],
267[
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100268 AC_CHECK_LIB([IPSec_MB], [submit_job_sse],
269 [with_aesni_mb_lib=yes],
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100270 [AC_MSG_ERROR([IPSec_MB library not found])])
271])
272
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100273AM_COND_IF([WITH_DPDK_AESNI_GCM_PMD],
274[
Damjan Marion45b48502017-11-17 09:46:41 +0100275 AC_CHECK_LIB([IPSec_MB], [submit_job_sse],
276 [with_aesni_mb_lib=yes],
277 [AC_MSG_ERROR([IPSec_MB library not found])])
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100278])
279
280m4_append([list_of_with], [aesni_mb_lib], [, ])
281AM_CONDITIONAL(WITH_AESNI_MB_LIB, test "$with_aesni_mb_lib" = "yes")
282
283m4_append([list_of_with], [isa_l_crypto_lib], [, ])
284AM_CONDITIONAL(WITH_ISA_L_CRYPTO_LIB, test "$with_isa_l_crypto_lib" = "yes")
285
Damjan Marion7cd468a2016-12-19 23:05:39 +0100286AM_COND_IF([ENABLE_G2],
287[
288 PKG_CHECK_MODULES(g2, gtk+-2.0)
289])
290
Damjan Marion92cdd722017-12-26 13:40:13 +0000291AM_COND_IF([ENABLE_MARVELL_PLUGIN],
292[
293 AC_CHECK_LIB( [musdk], [pp2_init],
294 [],
295 [
296 AC_MSG_WARN([Marvell MUSDK library with PP2 support not found. Plugin disabled.])
297 enable_marvell_plugin=no
298 AM_CONDITIONAL(ENABLE_MARVELL_PLUGIN, false)
299 ])
300])
301
Florin Corasd77eee62018-03-07 08:49:27 -0800302AM_COND_IF([WITH_MBEDTLS], [],
303[
304 AC_MSG_WARN([mbedtls not enabled. Disabling tlsmbedtls plugin])
305 enable_tlsmbedtls_plugin=no
306 AM_CONDITIONAL(ENABLE_TLSMBEDTLS_PLUGIN, false)
307])
308
309AM_COND_IF([ENABLE_TLSMBEDTLS_PLUGIN],
Florin Coras371ca502018-02-21 12:07:41 -0800310[
311 AC_CHECK_HEADERS([mbedtls/ssl.h], [],
312 [
Florin Corasd77eee62018-03-07 08:49:27 -0800313 AC_MSG_WARN([mbedtls headers not found. TLS engine implementation disabled])
314 enable_tlsmbedtls_plugin=no
315 AM_CONDITIONAL(ENABLE_TLSMBEDTLS_PLUGIN, false)
Florin Coras371ca502018-02-21 12:07:41 -0800316 ], [])
317])
318
Florin Coras58d36f02018-03-09 13:05:53 -0800319AM_COND_IF([WITH_LIBSSL], [],
320[
321 AC_MSG_WARN([openssl not enabled. Disabling tlsopenssl plugin])
322 enable_tlsopenssl_plugin=no
323 AM_CONDITIONAL(ENABLE_TLSOPENSSL_PLUGIN, false)
324])
Florin Corasd77eee62018-03-07 08:49:27 -0800325
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