blob: fbedabf09a84fa756fe81b00928266f74f26d9fc [file] [log] [blame]
Damjan Marion7cd468a2016-12-19 23:05:39 +01001AC_INIT([vpp], [17.04], [vpp-dev@fd.io])
2LT_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])
77 AM_CONDITIONAL(m4_toupper((ENABLE_$1_PLUGIN), test "$enable_$1_plugin" = "yes")
78 m4_append([list_of_plugins], [$1], [, ])
79])
80
81AC_DEFUN([PRINT_VAL], [ AC_MSG_RESULT(AC_HELP_STRING($1,$2)) ])
82
83###############################################################################
84# configure arguments
85###############################################################################
86
87# --enable-X
88ENABLE_ARG(tests, [Enable unit tests])
89ENABLE_ARG(dpdk_shared, [Enable unit tests])
90ENABLE_ARG(perftool, [Enable perftool])
91ENABLE_ARG(g2, [Enable g2])
92
93# --disable-X
94DISABLE_ARG(vlib, [Disable vlib and dependant libs and binaries])
95DISABLE_ARG(svm, [Disable svm and dependant libs and binaries])
Damjan Marioncb034b92016-12-28 18:38:59 +010096DISABLE_ARG(papi, [Disable Python API bindings])
97DISABLE_ARG(japi, [Disable Java API bindings])
Damjan Marion7cd468a2016-12-19 23:05:39 +010098
99# --with-X
100WITH_ARG(dpdk, [Use use DPDK])
101WITH_ARG(dpdk_crypto, [Use DPDK cryptodev])
102WITH_ARG(dpdk_mlx5_pmd, [Use DPDK with mlx5 PMD])
103
104# --without-X
Damjan Mariona9a951f2017-01-16 22:06:10 +0100105WITHOUT_ARG(libssl, [Disable libssl])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100106WITHOUT_ARG(apicli, [Disable binary api CLI])
107
108AC_ARG_WITH(unix,
109 AC_HELP_STRING([--with-unix],[Compile unix version of clib]),
110 [],
111 [case $host_os in
112 darwin* | linux*) with_unix=yes;;
113 *) with_unix=no;;
114 esac])
115
116AM_CONDITIONAL(WITH_UNIX, test "$with_unix" = "yes")
117
118AC_ARG_WITH(pre-data,
119 AC_HELP_STRING([--with-pre-data],[Set buffer rewrite space]),
120 [case $with_pre_data in
121 128) ;;
122 256) ;;
123 *) with_pre_data="pre-data-not-set" ;;
124 esac], [with_pre_data=128])
125
126###############################################################################
127# Substitutions and defines
128###############################################################################
129
130AC_SUBST(PRE_DATA_SIZE, [$with_pre_data])
131AC_SUBST(APICLI, [-DVPP_API_TEST_BUILTIN=${n_with_apicli}])
132
133AC_DEFINE_UNQUOTED(DPDK, [${n_with_dpdk}])
134AC_DEFINE_UNQUOTED(DPDK_SHARED_LIB, [${n_enable_dpdk_shared}])
135AC_DEFINE_UNQUOTED(DPDK_CRYPTO, [${n_with_dpdk_crypto}])
Damjan Mariona9a951f2017-01-16 22:06:10 +0100136AC_DEFINE_UNQUOTED(WITH_LIBSSL, [${n_with_libssl}])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100137
Damjan Marioncb034b92016-12-28 18:38:59 +0100138
139# Silence following noise:
140# ar: `u' modifier ignored since `D' is the default (see `U')
141AR_FLAGS=cr
142AC_SUBST(AR_FLAGS)
143
144###############################################################################
145# Plugins
146###############################################################################
147
148# Please keep alphabetical order
149PLUGIN_ENABLED(acl)
150PLUGIN_ENABLED(flowperpkt)
151PLUGIN_ENABLED(ila)
152PLUGIN_ENABLED(ioam)
153PLUGIN_ENABLED(lb)
154PLUGIN_ENABLED(sixrd)
155PLUGIN_ENABLED(snat)
156
Damjan Marion7cd468a2016-12-19 23:05:39 +0100157###############################################################################
158# Dependency checks
159###############################################################################
160
161AM_COND_IF([ENABLE_DPDK_SHARED],
162[
163 AC_CHECK_HEADERS([rte_config.h],
164 [],
165 [AC_MSG_ERROR([DPDK header files not found])],)
166 AC_CHECK_LIB( [dpdk], [rte_eal_init],
167 [],
168 [AC_MSG_ERROR([DPDK shared library not found])],)
169])
170
171AM_COND_IF([ENABLE_G2],
172[
173 PKG_CHECK_MODULES(g2, gtk+-2.0)
174])
175
Damjan Marion0be5ec32016-12-28 17:51:56 +0100176# If cross-compiling, we need external vppapigen and we cannot continue without it
177# For native builds, we just set dependency on vpppaigen binary in top_builddir
178AM_COND_IF([CROSSCOMPILE],
179[
180 AC_PATH_PROG([VPPAPIGEN], [vppapigen], [no])
181 if test "$VPPAPIGEN" = "no"; then
182 AC_MSG_ERROR([Externaly built vppapigen is needed when cross-compiling...])
183 fi
184],[
185 VPPAPIGEN=\$\(top_builddir\)/vppapigen
186])
187AC_SUBST([VPPAPIGEN])
188
189
Damjan Marion7cd468a2016-12-19 23:05:39 +0100190###############################################################################
Damjan Marioncb034b92016-12-28 18:38:59 +0100191# JAVA
Damjan Marion7cd468a2016-12-19 23:05:39 +0100192###############################################################################
193
Damjan Marioncb034b92016-12-28 18:38:59 +0100194AM_COND_IF([ENABLE_JAPI],
195[
196 AX_VPP_FIND_JDK8
197 AC_SUBST(JAVA_HOME)
198 AC_SUBST(JAVAC)
199 AC_SUBST(JAVAH)
200 AC_SUBST(JAR)
201])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100202
203###############################################################################
204# Output
205###############################################################################
206
207AC_OUTPUT
208
209AC_MSG_RESULT([==============================================================================])
210PRINT_VAL([version], $PACKAGE $VERSION)
211PRINT_VAL([prefix], ${prefix})
212PRINT_VAL([libdir], ${libdir})
213PRINT_VAL([includedir], ${includedir})
214PRINT_VAL([CFLAGS], ${CFLAGS})
215PRINT_VAL([CPPFLAGS], ${CPPFLAGS})
216PRINT_VAL([LDFLAGS], ${LDFLAGS})
Damjan Marioncb034b92016-12-28 18:38:59 +0100217AM_COND_IF([ENABLE_JAPI],
218[
219 PRINT_VAL([JAVA_VERSION], ${JAVA_VERSION})
220 PRINT_VAL([JAVA_HOME], ${JAVA_HOME})
221])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100222
223AC_MSG_RESULT([])
224AC_MSG_RESULT([with:])
225m4_foreach([x], m4_dquote(list_of_with), [
226 AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${with_], x, [}])))
227])
228
229AC_MSG_RESULT([])
230AC_MSG_RESULT([enabled:])
231m4_foreach([x], m4_dquote(list_of_enabled), [
232 AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${enable_], x, [}])))
233])
234
235AC_MSG_RESULT([])
236AC_MSG_RESULT([plugins:])
237m4_foreach([x], m4_dquote(list_of_plugins), [
238 AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${enable_], x, [_plugin}])))
239])
240AC_MSG_RESULT([==============================================================================])
241
242