blob: f6ec44bb76985c18a9c267899580b3291730a231 [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 Marionc0c919c2018-05-30 09:55:05 +02006AC_CONFIG_FILES([ \
7 Makefile \
8 plugins/Makefile \
9 vpp-api/python/Makefile \
10 vpp-api/java/Makefile \
11 vpp-api/vapi/Makefile \
12 vlib/config.h \
13])
Damjan Marioncb034b92016-12-28 18:38:59 +010014AC_CONFIG_MACRO_DIR([m4])
Damjan Marion7cd468a2016-12-19 23:05:39 +010015
16AC_PROG_CC
Neale Ranns812ed392017-10-16 04:20:13 -070017AC_PROG_CPP
Damjan Marion7cd468a2016-12-19 23:05:39 +010018AM_PROG_AS
19AM_PROG_LIBTOOL
Tomofumi Hayashidc90d422017-01-25 13:53:26 +090020AM_PATH_PYTHON
Damjan Marion7cd468a2016-12-19 23:05:39 +010021
Damjan Marion0be5ec32016-12-28 17:51:56 +010022AM_CONDITIONAL([CROSSCOMPILE], [test "$cross_compiling" == "yes"])
23
Damjan Marion7cd468a2016-12-19 23:05:39 +010024###############################################################################
25# Macros
26###############################################################################
27
28AC_DEFUN([ENABLE_ARG],
29[
30 AC_ARG_ENABLE($1,
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], [, ])
36])
37
38AC_DEFUN([DISABLE_ARG],
39[
40 AC_ARG_ENABLE($1,
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], [, ])
46])
47
48AC_DEFUN([WITH_ARG],
49[
50 AC_ARG_WITH($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], [, ])
56])
57
58AC_DEFUN([WITHOUT_ARG],
59[
60 AC_ARG_WITH($1,
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], [, ])
66])
67
68AC_DEFUN([PLUGIN_ENABLED],
69[
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], [, ])
76])
77
78AC_DEFUN([PLUGIN_DISABLED],
79[
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])
Pablo Camarilloa084d622017-03-03 20:47:55 +010084 AM_CONDITIONAL(m4_toupper(ENABLE_$1_PLUGIN), test "$enable_$1_plugin" = "yes")
Damjan Marion7cd468a2016-12-19 23:05:39 +010085 m4_append([list_of_plugins], [$1], [, ])
86])
87
88AC_DEFUN([PRINT_VAL], [ AC_MSG_RESULT(AC_HELP_STRING($1,$2)) ])
89
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +010090AC_DEFUN([DPDK_IS_PMD_ENABLED],
91[
92 AC_MSG_CHECKING([for $1 in rte_config.h])
93 AC_COMPILE_IFELSE(
94 [AC_LANG_PROGRAM(
95 [[#include <rte_config.h>]],
96 [[return RTE_$1;]],
97 )],
98 [with_$2=yes]
99 [AC_MSG_RESULT([yes])],
100 [with_$2=no]
101 [AC_MSG_RESULT([no])]
102 )
103 AM_CONDITIONAL(m4_toupper(WITH_$2), test "$with_$2" = "yes")
104 m4_append_uniq([list_of_with], [$2], [, ])
105])
106
Damjan Marion04f3db32017-11-10 21:55:45 +0100107# Check if compiler supports specific flag
108AC_DEFUN([CC_CHECK_FLAG],
109[
110 AC_MSG_CHECKING([if $CC supports $1])
111 AC_LANG_PUSH([C])
112 ac_saved_cflags="$CFLAGS"
113 CFLAGS="-Werror $1"
114 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
Damjan Marionbf024e62017-11-14 15:21:19 +0100115 [cc_flag_check=yes],
116 [cc_flag_check=no]
Damjan Marion04f3db32017-11-10 21:55:45 +0100117)
Damjan Marioneecb26d2017-11-15 13:57:20 +0100118 AC_MSG_RESULT([$cc_flag_check])
Damjan Marion04f3db32017-11-10 21:55:45 +0100119 CFLAGS="$ac_saved_cflags"
120 AC_LANG_POP([C])
121])
122
Damjan Marion7cd468a2016-12-19 23:05:39 +0100123###############################################################################
124# configure arguments
125###############################################################################
126
127# --enable-X
128ENABLE_ARG(tests, [Enable unit tests])
129ENABLE_ARG(dpdk_shared, [Enable unit tests])
130ENABLE_ARG(perftool, [Enable perftool])
131ENABLE_ARG(g2, [Enable g2])
132
133# --disable-X
134DISABLE_ARG(vlib, [Disable vlib and dependant libs and binaries])
135DISABLE_ARG(svm, [Disable svm and dependant libs and binaries])
Damjan Marioncb034b92016-12-28 18:38:59 +0100136DISABLE_ARG(papi, [Disable Python API bindings])
137DISABLE_ARG(japi, [Disable Java API 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])
Florin Coras371ca502018-02-21 12:07:41 -0800144WITHOUT_ARG(mbedtls, [Disable mbedtls])
Sachin Saxenaee6ddce2018-05-10 16:22:09 +0530145WITHOUT_ARG(libnuma, [for non numa architectures])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100146
147AC_ARG_WITH(unix,
148 AC_HELP_STRING([--with-unix],[Compile unix version of clib]),
149 [],
150 [case $host_os in
151 darwin* | linux*) with_unix=yes;;
152 *) with_unix=no;;
153 esac])
154
155AM_CONDITIONAL(WITH_UNIX, test "$with_unix" = "yes")
156
157AC_ARG_WITH(pre-data,
158 AC_HELP_STRING([--with-pre-data],[Set buffer rewrite space]),
159 [case $with_pre_data in
160 128) ;;
161 256) ;;
162 *) with_pre_data="pre-data-not-set" ;;
163 esac], [with_pre_data=128])
164
165###############################################################################
Damjan Marionba3c7732017-11-10 20:26:50 +0100166# Target CPU flags
167###############################################################################
168
Damjan Marion04f3db32017-11-10 21:55:45 +0100169# Check if compiler supports march=core-avx2
170CC_CHECK_FLAG("-march=core-avx2")
171AS_IF([test "$cc_flag_check" = yes],
172 [march_core_avx2=yes],
173 [march_core_avx2=no])
174AM_CONDITIONAL([CC_SUPPORTS_AVX2], [test "$march_core_avx2" = "yes"])
175
176# Check if compiler supports march=skylake-avx512
177CC_CHECK_FLAG("-march=skylake-avx512")
178AS_IF([test "$cc_flag_check" = yes],
179 [march_skylake_avx512=yes],
180 [march_skylake_avx512=no])
181AM_CONDITIONAL([CC_SUPPORTS_AVX512], [test "$march_skylake_avx512" = "yes"])
182
Sachin Saxena432bf672018-05-04 15:08:29 +0530183AS_CASE([$host_cpu],
Damjan Marionba3c7732017-11-10 20:26:50 +0100184 [x86_64], [CPU_FLAGS="-march=corei7 -mtune=corei7-avx"],
185 [aarch64], [CPU_FLAGS="-march=armv8-a+crc"],
186 [CPU_FLAGS=""],
187)
188AC_SUBST([CPU_FLAGS])
189
Damjan Marion04f3db32017-11-10 21:55:45 +0100190AC_SUBST([CPU_AVX2_FLAGS],"-march=core-avx2 -mtune=core-avx2")
191AC_SUBST([CPU_AVX512_FLAGS],"-march=skylake-avx512 -mtune=skylake-avx512")
192
Sachin Saxena432bf672018-05-04 15:08:29 +0530193AM_CONDITIONAL([CPU_X86_64], [test "$host_cpu" = "x86_64"])
194AM_CONDITIONAL([CPU_AARCH64], [test "$host_cpu" = "aarch64"])
Damjan Marion04f3db32017-11-10 21:55:45 +0100195
Damjan Marionba3c7732017-11-10 20:26:50 +0100196###############################################################################
Damjan Marion74a6dab2018-03-26 13:36:46 +0200197# misc compiler flags
198###############################################################################
199
200CC_CHECK_FLAG("-Wno-address-of-packed-member")
201AS_IF([test "$cc_flag_check" = yes],
202 [CFLAGS="${CFLAGS} -Wno-address-of-packed-member"], [])
203
204###############################################################################
Damjan Marion7cd468a2016-12-19 23:05:39 +0100205# Substitutions and defines
206###############################################################################
207
208AC_SUBST(PRE_DATA_SIZE, [$with_pre_data])
209AC_SUBST(APICLI, [-DVPP_API_TEST_BUILTIN=${n_with_apicli}])
210
Damjan Marion7cd468a2016-12-19 23:05:39 +0100211AC_DEFINE_UNQUOTED(DPDK_SHARED_LIB, [${n_enable_dpdk_shared}])
Damjan Mariona9a951f2017-01-16 22:06:10 +0100212AC_DEFINE_UNQUOTED(WITH_LIBSSL, [${n_with_libssl}])
Florin Coras371ca502018-02-21 12:07:41 -0800213AC_DEFINE_UNQUOTED(WITH_MBEDTLS, [${n_with_mbedtls}])
Sachin Saxenaee6ddce2018-05-10 16:22:09 +0530214AC_DEFINE_UNQUOTED(WITH_LIBNUMA, [${n_with_libnuma}])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100215
Damjan Marioncb034b92016-12-28 18:38:59 +0100216
217# Silence following noise:
218# ar: `u' modifier ignored since `D' is the default (see `U')
219AR_FLAGS=cr
220AC_SUBST(AR_FLAGS)
221
222###############################################################################
223# Plugins
224###############################################################################
225
226# Please keep alphabetical order
Andrew Yourtchenko669d07d2017-11-17 14:38:18 +0100227PLUGIN_ENABLED(abf)
Damjan Marioncb034b92016-12-28 18:38:59 +0100228PLUGIN_ENABLED(acl)
Damjan Marionb4ff07a2018-02-07 22:35:06 +0100229PLUGIN_ENABLED(avf)
Dave Barachaaacfbc2018-03-10 14:57:00 -0500230PLUGIN_ENABLED(cdp)
Damjan Marion374e2c52017-03-09 20:38:15 +0100231PLUGIN_ENABLED(dpdk)
Ole Troan5c749732017-03-13 13:39:52 +0100232PLUGIN_ENABLED(flowprobe)
Neale Ranns7758bf62018-02-14 06:34:20 -0800233PLUGIN_ENABLED(gbp)
Hongjun Nief486b12017-04-12 19:21:16 +0800234PLUGIN_ENABLED(gtpu)
Jakub Grajciar7b867a82017-12-08 16:28:42 +0100235PLUGIN_ENABLED(igmp)
Damjan Marioncb034b92016-12-28 18:38:59 +0100236PLUGIN_ENABLED(ila)
237PLUGIN_ENABLED(ioam)
Damjan Marion374e2c52017-03-09 20:38:15 +0100238PLUGIN_ENABLED(ixge)
Neale Ranns7758bf62018-02-14 06:34:20 -0800239PLUGIN_ENABLED(l2e)
Steven9cd2d7a2017-12-20 12:43:01 -0800240PLUGIN_ENABLED(lacp)
Damjan Marioncb034b92016-12-28 18:38:59 +0100241PLUGIN_ENABLED(lb)
Damjan Marion92cdd722017-12-26 13:40:13 +0000242PLUGIN_ENABLED(marvell)
Damjan Marioneaabe072017-03-22 10:18:13 +0100243PLUGIN_ENABLED(memif)
Hongjun Ni62f9cdd2017-07-04 20:11:57 +0800244PLUGIN_ENABLED(pppoe)
Neale Ranns7758bf62018-02-14 06:34:20 -0800245PLUGIN_ENABLED(nat)
Francois Cladb4d43d72018-01-17 12:18:41 +0100246PLUGIN_ENABLED(srv6ad)
Francois Clad39d91fe2018-01-17 16:08:41 +0100247PLUGIN_ENABLED(srv6am)
Francois Cladba7992a2018-01-16 17:52:24 +0100248PLUGIN_ENABLED(srv6as)
Pierre Pfister0906c5c2017-09-27 16:17:31 +0200249PLUGIN_ENABLED(stn)
Florin Corasd77eee62018-03-07 08:49:27 -0800250PLUGIN_ENABLED(tlsmbedtls)
Florin Coras58d36f02018-03-09 13:05:53 -0800251PLUGIN_ENABLED(tlsopenssl)
Damjan Marioncb034b92016-12-28 18:38:59 +0100252
Damjan Marion7cd468a2016-12-19 23:05:39 +0100253###############################################################################
254# Dependency checks
255###############################################################################
Marco Varlese3f6ede32018-03-06 08:09:04 +0100256AC_CHECK_FUNC([memfd_create], [AC_DEFINE([HAVE_MEMFD_CREATE], [1], [Define if memfd exists])])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100257
258AM_COND_IF([ENABLE_DPDK_SHARED],
259[
260 AC_CHECK_HEADERS([rte_config.h],
261 [],
262 [AC_MSG_ERROR([DPDK header files not found])],)
263 AC_CHECK_LIB( [dpdk], [rte_eal_init],
264 [],
265 [AC_MSG_ERROR([DPDK shared library not found])],)
266])
267
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100268with_aesni_mb_lib=no
269with_isa_l_crypto_lib=no
270
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100271DPDK_IS_PMD_ENABLED(LIBRTE_PMD_AESNI_MB, dpdk_aesni_mb_pmd)
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100272DPDK_IS_PMD_ENABLED(LIBRTE_PMD_AESNI_GCM, dpdk_aesni_gcm_pmd)
273
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100274AM_COND_IF([WITH_DPDK_AESNI_MB_PMD],
275[
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100276 AC_CHECK_LIB([IPSec_MB], [submit_job_sse],
277 [with_aesni_mb_lib=yes],
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100278 [AC_MSG_ERROR([IPSec_MB library not found])])
279])
280
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100281AM_COND_IF([WITH_DPDK_AESNI_GCM_PMD],
282[
Damjan Marion45b48502017-11-17 09:46:41 +0100283 AC_CHECK_LIB([IPSec_MB], [submit_job_sse],
284 [with_aesni_mb_lib=yes],
285 [AC_MSG_ERROR([IPSec_MB library not found])])
Sergio Gonzalez Monroyacdc3062017-08-24 14:09:17 +0100286])
287
288m4_append([list_of_with], [aesni_mb_lib], [, ])
289AM_CONDITIONAL(WITH_AESNI_MB_LIB, test "$with_aesni_mb_lib" = "yes")
290
291m4_append([list_of_with], [isa_l_crypto_lib], [, ])
292AM_CONDITIONAL(WITH_ISA_L_CRYPTO_LIB, test "$with_isa_l_crypto_lib" = "yes")
293
Damjan Marion7cd468a2016-12-19 23:05:39 +0100294AM_COND_IF([ENABLE_G2],
295[
296 PKG_CHECK_MODULES(g2, gtk+-2.0)
297])
298
Damjan Marion92cdd722017-12-26 13:40:13 +0000299AM_COND_IF([ENABLE_MARVELL_PLUGIN],
300[
301 AC_CHECK_LIB( [musdk], [pp2_init],
302 [],
303 [
304 AC_MSG_WARN([Marvell MUSDK library with PP2 support not found. Plugin disabled.])
305 enable_marvell_plugin=no
306 AM_CONDITIONAL(ENABLE_MARVELL_PLUGIN, false)
307 ])
308])
309
Florin Corasd77eee62018-03-07 08:49:27 -0800310AM_COND_IF([WITH_MBEDTLS], [],
311[
312 AC_MSG_WARN([mbedtls not enabled. Disabling tlsmbedtls plugin])
313 enable_tlsmbedtls_plugin=no
314 AM_CONDITIONAL(ENABLE_TLSMBEDTLS_PLUGIN, false)
315])
316
317AM_COND_IF([ENABLE_TLSMBEDTLS_PLUGIN],
Florin Coras371ca502018-02-21 12:07:41 -0800318[
319 AC_CHECK_HEADERS([mbedtls/ssl.h], [],
320 [
Florin Corasd77eee62018-03-07 08:49:27 -0800321 AC_MSG_WARN([mbedtls headers not found. TLS engine implementation disabled])
322 enable_tlsmbedtls_plugin=no
323 AM_CONDITIONAL(ENABLE_TLSMBEDTLS_PLUGIN, false)
Florin Coras371ca502018-02-21 12:07:41 -0800324 ], [])
325])
326
Florin Coras58d36f02018-03-09 13:05:53 -0800327AM_COND_IF([WITH_LIBSSL], [],
328[
329 AC_MSG_WARN([openssl not enabled. Disabling tlsopenssl plugin])
330 enable_tlsopenssl_plugin=no
331 AM_CONDITIONAL(ENABLE_TLSOPENSSL_PLUGIN, false)
332])
Florin Corasd77eee62018-03-07 08:49:27 -0800333
Damjan Marion7cd468a2016-12-19 23:05:39 +0100334###############################################################################
Damjan Marioncb034b92016-12-28 18:38:59 +0100335# JAVA
Damjan Marion7cd468a2016-12-19 23:05:39 +0100336###############################################################################
337
Damjan Marioncb034b92016-12-28 18:38:59 +0100338AM_COND_IF([ENABLE_JAPI],
339[
340 AX_VPP_FIND_JDK8
341 AC_SUBST(JAVA_HOME)
342 AC_SUBST(JAVAC)
343 AC_SUBST(JAVAH)
344 AC_SUBST(JAR)
345])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100346
347###############################################################################
Ole Troan3cc49712017-03-08 12:02:24 +0100348# PYTHON
349###############################################################################
350
351AM_COND_IF([ENABLE_PAPI],
352[
353 AM_PATH_PYTHON
354])
355
356###############################################################################
Damjan Marion7cd468a2016-12-19 23:05:39 +0100357# Output
358###############################################################################
359
360AC_OUTPUT
361
362AC_MSG_RESULT([==============================================================================])
363PRINT_VAL([version], $PACKAGE $VERSION)
364PRINT_VAL([prefix], ${prefix})
365PRINT_VAL([libdir], ${libdir})
366PRINT_VAL([includedir], ${includedir})
367PRINT_VAL([CFLAGS], ${CFLAGS})
368PRINT_VAL([CPPFLAGS], ${CPPFLAGS})
369PRINT_VAL([LDFLAGS], ${LDFLAGS})
Damjan Marioncb034b92016-12-28 18:38:59 +0100370AM_COND_IF([ENABLE_JAPI],
371[
372 PRINT_VAL([JAVA_VERSION], ${JAVA_VERSION})
373 PRINT_VAL([JAVA_HOME], ${JAVA_HOME})
374])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100375
376AC_MSG_RESULT([])
377AC_MSG_RESULT([with:])
378m4_foreach([x], m4_dquote(list_of_with), [
379 AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${with_], x, [}])))
380])
381
382AC_MSG_RESULT([])
383AC_MSG_RESULT([enabled:])
384m4_foreach([x], m4_dquote(list_of_enabled), [
385 AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${enable_], x, [}])))
386])
387
388AC_MSG_RESULT([])
389AC_MSG_RESULT([plugins:])
390m4_foreach([x], m4_dquote(list_of_plugins), [
391 AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${enable_], x, [_plugin}])))
392])
393AC_MSG_RESULT([==============================================================================])
394
395