blob: cb00d0bdb2c005fdd68463bf953c407ba4fe50fd [file] [log] [blame]
Neale Ranns39f92402017-06-22 14:43:55 -07001AC_INIT([vpp], [17.10], [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 Marioncb034b92016-12-28 18:38:59 +01006AC_CONFIG_FILES([Makefile plugins/Makefile vpp-api/python/Makefile vpp-api/java/Makefile])
7AC_CONFIG_MACRO_DIR([m4])
Damjan Marion7cd468a2016-12-19 23:05:39 +01008
9AC_PROG_CC
10AM_PROG_AS
11AM_PROG_LIBTOOL
12AC_PROG_YACC
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 Marion7cd468a2016-12-19 23:05:39 +0100100###############################################################################
101# configure arguments
102###############################################################################
103
104# --enable-X
105ENABLE_ARG(tests, [Enable unit tests])
106ENABLE_ARG(dpdk_shared, [Enable unit tests])
107ENABLE_ARG(perftool, [Enable perftool])
108ENABLE_ARG(g2, [Enable g2])
109
110# --disable-X
111DISABLE_ARG(vlib, [Disable vlib and dependant libs and binaries])
112DISABLE_ARG(svm, [Disable svm and dependant libs and binaries])
Damjan Marioncb034b92016-12-28 18:38:59 +0100113DISABLE_ARG(papi, [Disable Python API bindings])
114DISABLE_ARG(japi, [Disable Java API bindings])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100115
116# --with-X
Damjan Marion7cd468a2016-12-19 23:05:39 +0100117
118# --without-X
Damjan Mariona9a951f2017-01-16 22:06:10 +0100119WITHOUT_ARG(libssl, [Disable libssl])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100120WITHOUT_ARG(apicli, [Disable binary api CLI])
121
122AC_ARG_WITH(unix,
123 AC_HELP_STRING([--with-unix],[Compile unix version of clib]),
124 [],
125 [case $host_os in
126 darwin* | linux*) with_unix=yes;;
127 *) with_unix=no;;
128 esac])
129
130AM_CONDITIONAL(WITH_UNIX, test "$with_unix" = "yes")
131
132AC_ARG_WITH(pre-data,
133 AC_HELP_STRING([--with-pre-data],[Set buffer rewrite space]),
134 [case $with_pre_data in
135 128) ;;
136 256) ;;
137 *) with_pre_data="pre-data-not-set" ;;
138 esac], [with_pre_data=128])
139
140###############################################################################
141# Substitutions and defines
142###############################################################################
143
144AC_SUBST(PRE_DATA_SIZE, [$with_pre_data])
145AC_SUBST(APICLI, [-DVPP_API_TEST_BUILTIN=${n_with_apicli}])
146
Damjan Marion7cd468a2016-12-19 23:05:39 +0100147AC_DEFINE_UNQUOTED(DPDK_SHARED_LIB, [${n_enable_dpdk_shared}])
Damjan Mariona9a951f2017-01-16 22:06:10 +0100148AC_DEFINE_UNQUOTED(WITH_LIBSSL, [${n_with_libssl}])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100149
Damjan Marioncb034b92016-12-28 18:38:59 +0100150
151# Silence following noise:
152# ar: `u' modifier ignored since `D' is the default (see `U')
153AR_FLAGS=cr
154AC_SUBST(AR_FLAGS)
155
156###############################################################################
157# Plugins
158###############################################################################
159
160# Please keep alphabetical order
161PLUGIN_ENABLED(acl)
Damjan Marion374e2c52017-03-09 20:38:15 +0100162PLUGIN_ENABLED(dpdk)
Ole Troan5c749732017-03-13 13:39:52 +0100163PLUGIN_ENABLED(flowprobe)
Hongjun Nief486b12017-04-12 19:21:16 +0800164PLUGIN_ENABLED(gtpu)
Damjan Marioncb034b92016-12-28 18:38:59 +0100165PLUGIN_ENABLED(ila)
166PLUGIN_ENABLED(ioam)
Damjan Marion374e2c52017-03-09 20:38:15 +0100167PLUGIN_ENABLED(ixge)
Damjan Marioncb034b92016-12-28 18:38:59 +0100168PLUGIN_ENABLED(lb)
Damjan Marioneaabe072017-03-22 10:18:13 +0100169PLUGIN_ENABLED(memif)
Damjan Marioncb034b92016-12-28 18:38:59 +0100170PLUGIN_ENABLED(sixrd)
171PLUGIN_ENABLED(snat)
172
Damjan Marion7cd468a2016-12-19 23:05:39 +0100173###############################################################################
174# Dependency checks
175###############################################################################
176
177AM_COND_IF([ENABLE_DPDK_SHARED],
178[
179 AC_CHECK_HEADERS([rte_config.h],
180 [],
181 [AC_MSG_ERROR([DPDK header files not found])],)
182 AC_CHECK_LIB( [dpdk], [rte_eal_init],
183 [],
184 [AC_MSG_ERROR([DPDK shared library not found])],)
185])
186
Sergio Gonzalez Monroy3b12cdc2017-06-06 15:29:16 +0100187DPDK_IS_PMD_ENABLED(LIBRTE_PMD_AESNI_MB, dpdk_aesni_mb_pmd)
188AM_COND_IF([WITH_DPDK_AESNI_MB_PMD],
189[
190 AC_CHECK_LIB([IPSec_MB], [submit_job_sse], [],
191 [AC_MSG_ERROR([IPSec_MB library not found])])
192])
193
194DPDK_IS_PMD_ENABLED(LIBRTE_PMD_AESNI_GCM, dpdk_aesni_gcm_pmd)
195AM_COND_IF([WITH_DPDK_AESNI_GCM_PMD],
196[
197 AC_CHECK_LIB([isal_crypto], [aesni_gcm128_init], [],
198 [AC_MSG_ERROR([isal_crypto library not found])])
199])
200
201DPDK_IS_PMD_ENABLED(LIBRTE_MLX5_PMD, dpdk_mlx5_pmd)
202AM_COND_IF([WITH_DPDK_MLX5_PMD],
203[
204 AC_CHECK_LIB([ibverbs], [ibv_fork_init], [],
205 [AC_MSG_ERROR([ibverbs library not found])])
206])
207
208DPDK_IS_PMD_ENABLED(LIBRTE_MLX4_PMD, dpdk_mlx4_pmd)
209AM_COND_IF([WITH_DPDK_MLX4_PMD],
210[
211 AC_CHECK_LIB([ibverbs], [ibv_fork_init], [],
212 [AC_MSG_ERROR([ibverbs library not found])])
213])
214
Damjan Marion7cd468a2016-12-19 23:05:39 +0100215AM_COND_IF([ENABLE_G2],
216[
217 PKG_CHECK_MODULES(g2, gtk+-2.0)
218])
219
Damjan Marion0be5ec32016-12-28 17:51:56 +0100220# If cross-compiling, we need external vppapigen and we cannot continue without it
221# For native builds, we just set dependency on vpppaigen binary in top_builddir
222AM_COND_IF([CROSSCOMPILE],
223[
224 AC_PATH_PROG([VPPAPIGEN], [vppapigen], [no])
225 if test "$VPPAPIGEN" = "no"; then
226 AC_MSG_ERROR([Externaly built vppapigen is needed when cross-compiling...])
227 fi
228],[
229 VPPAPIGEN=\$\(top_builddir\)/vppapigen
230])
231AC_SUBST([VPPAPIGEN])
232
233
Damjan Marion7cd468a2016-12-19 23:05:39 +0100234###############################################################################
Damjan Marioncb034b92016-12-28 18:38:59 +0100235# JAVA
Damjan Marion7cd468a2016-12-19 23:05:39 +0100236###############################################################################
237
Damjan Marioncb034b92016-12-28 18:38:59 +0100238AM_COND_IF([ENABLE_JAPI],
239[
240 AX_VPP_FIND_JDK8
241 AC_SUBST(JAVA_HOME)
242 AC_SUBST(JAVAC)
243 AC_SUBST(JAVAH)
244 AC_SUBST(JAR)
245])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100246
247###############################################################################
Ole Troan3cc49712017-03-08 12:02:24 +0100248# PYTHON
249###############################################################################
250
251AM_COND_IF([ENABLE_PAPI],
252[
253 AM_PATH_PYTHON
254])
255
256###############################################################################
Damjan Marion7cd468a2016-12-19 23:05:39 +0100257# Output
258###############################################################################
259
260AC_OUTPUT
261
262AC_MSG_RESULT([==============================================================================])
263PRINT_VAL([version], $PACKAGE $VERSION)
264PRINT_VAL([prefix], ${prefix})
265PRINT_VAL([libdir], ${libdir})
266PRINT_VAL([includedir], ${includedir})
267PRINT_VAL([CFLAGS], ${CFLAGS})
268PRINT_VAL([CPPFLAGS], ${CPPFLAGS})
269PRINT_VAL([LDFLAGS], ${LDFLAGS})
Damjan Marioncb034b92016-12-28 18:38:59 +0100270AM_COND_IF([ENABLE_JAPI],
271[
272 PRINT_VAL([JAVA_VERSION], ${JAVA_VERSION})
273 PRINT_VAL([JAVA_HOME], ${JAVA_HOME})
274])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100275
276AC_MSG_RESULT([])
277AC_MSG_RESULT([with:])
278m4_foreach([x], m4_dquote(list_of_with), [
279 AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${with_], x, [}])))
280])
281
282AC_MSG_RESULT([])
283AC_MSG_RESULT([enabled:])
284m4_foreach([x], m4_dquote(list_of_enabled), [
285 AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${enable_], x, [}])))
286])
287
288AC_MSG_RESULT([])
289AC_MSG_RESULT([plugins:])
290m4_foreach([x], m4_dquote(list_of_plugins), [
291 AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${enable_], x, [_plugin}])))
292])
293AC_MSG_RESULT([==============================================================================])
294
295