blob: eb380d8bf205cf34485773e6fede6b8625626e3f [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
13
Damjan Marion0be5ec32016-12-28 17:51:56 +010014AM_CONDITIONAL([CROSSCOMPILE], [test "$cross_compiling" == "yes"])
15
Damjan Marion7cd468a2016-12-19 23:05:39 +010016###############################################################################
17# Macros
18###############################################################################
19
20AC_DEFUN([ENABLE_ARG],
21[
22 AC_ARG_ENABLE($1,
23 AC_HELP_STRING(patsubst([--enable-$1],[_],[-]), $2),
24 [enable_$1=yes n_enable_$1=1],
25 [enable_$1=no n_enable_$1=0])
26 AM_CONDITIONAL(m4_toupper(ENABLE_$1), test "$enable_$1" = "yes")
27 m4_append([list_of_enabled], [$1], [, ])
28])
29
30AC_DEFUN([DISABLE_ARG],
31[
32 AC_ARG_ENABLE($1,
33 AC_HELP_STRING(patsubst([--disable-$1],[_],[-]), $2),
34 [enable_$1=no n_enable_$1=0],
35 [enable_$1=yes n_enable_$1=1])
36 AM_CONDITIONAL(m4_toupper(ENABLE_$1), test "$enable_$1" = "yes")
37 m4_append([list_of_enabled], [$1], [, ])
38])
39
40AC_DEFUN([WITH_ARG],
41[
42 AC_ARG_WITH($1,
43 AC_HELP_STRING(patsubst([--with-$1],[_],[-]), $2),
44 [with_$1=yes n_with_$1=1],
45 [with_$1=no n_with_$1=0])
46 AM_CONDITIONAL(m4_toupper(WITH_$1), test "$with_$1" = "yes")
47 m4_append([list_of_with], [$1], [, ])
48])
49
50AC_DEFUN([WITHOUT_ARG],
51[
52 AC_ARG_WITH($1,
53 AC_HELP_STRING(patsubst([--without-$1],[_],[-]), $2),
54 [with_$1=no n_with_$1=0],
55 [with_$1=yes n_with_$1=1])
56 AM_CONDITIONAL(m4_toupper(WITH_$1), test "$with_$1" = "yes")
57 m4_append([list_of_with], [$1], [, ])
58])
59
60AC_DEFUN([PLUGIN_ENABLED],
61[
62 AC_ARG_ENABLE($1_plugin,
63 AC_HELP_STRING([--disable-$1-plugin], [Do not build $1 plugin]),
64 [enable_$1_plugin=no],
65 [enable_$1_plugin=yes ])
66 AM_CONDITIONAL(m4_toupper(ENABLE_$1_PLUGIN), test "$enable_$1_plugin" = "yes")
67 m4_append([list_of_plugins], [$1], [, ])
68])
69
70AC_DEFUN([PLUGIN_DISABLED],
71[
72 AC_ARG_ENABLE($1_plugin,
73 AC_HELP_STRING([--enable-$1-plugin], [Build $1 plugin]),
74 [enable_$1_plugin=yes ],
75 [enable_$1_plugin=no])
76 AM_CONDITIONAL(m4_toupper((ENABLE_$1_PLUGIN), test "$enable_$1_plugin" = "yes")
77 m4_append([list_of_plugins], [$1], [, ])
78])
79
80AC_DEFUN([PRINT_VAL], [ AC_MSG_RESULT(AC_HELP_STRING($1,$2)) ])
81
82###############################################################################
83# configure arguments
84###############################################################################
85
86# --enable-X
87ENABLE_ARG(tests, [Enable unit tests])
88ENABLE_ARG(dpdk_shared, [Enable unit tests])
89ENABLE_ARG(perftool, [Enable perftool])
90ENABLE_ARG(g2, [Enable g2])
91
92# --disable-X
93DISABLE_ARG(vlib, [Disable vlib and dependant libs and binaries])
94DISABLE_ARG(svm, [Disable svm and dependant libs and binaries])
Damjan Marioncb034b92016-12-28 18:38:59 +010095DISABLE_ARG(papi, [Disable Python API bindings])
96DISABLE_ARG(japi, [Disable Java API bindings])
Damjan Marion7cd468a2016-12-19 23:05:39 +010097
98# --with-X
99WITH_ARG(dpdk, [Use use DPDK])
100WITH_ARG(dpdk_crypto, [Use DPDK cryptodev])
101WITH_ARG(dpdk_mlx5_pmd, [Use DPDK with mlx5 PMD])
102
103# --without-X
104WITHOUT_ARG(ipsec, [Disable IPSec])
105WITHOUT_ARG(ipv6sr, [Disable IPv6 SR])
106WITHOUT_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}])
136AC_DEFINE_UNQUOTED(IPSEC, [${n_with_ipsec}])
137AC_DEFINE_UNQUOTED(IPV6SR, [${n_with_ipv6sr}])
138
Damjan Marioncb034b92016-12-28 18:38:59 +0100139
140# Silence following noise:
141# ar: `u' modifier ignored since `D' is the default (see `U')
142AR_FLAGS=cr
143AC_SUBST(AR_FLAGS)
144
145###############################################################################
146# Plugins
147###############################################################################
148
149# Please keep alphabetical order
150PLUGIN_ENABLED(acl)
151PLUGIN_ENABLED(flowperpkt)
152PLUGIN_ENABLED(ila)
153PLUGIN_ENABLED(ioam)
154PLUGIN_ENABLED(lb)
155PLUGIN_ENABLED(sixrd)
156PLUGIN_ENABLED(snat)
157
Damjan Marion7cd468a2016-12-19 23:05:39 +0100158###############################################################################
159# Dependency checks
160###############################################################################
161
162AM_COND_IF([ENABLE_DPDK_SHARED],
163[
164 AC_CHECK_HEADERS([rte_config.h],
165 [],
166 [AC_MSG_ERROR([DPDK header files not found])],)
167 AC_CHECK_LIB( [dpdk], [rte_eal_init],
168 [],
169 [AC_MSG_ERROR([DPDK shared library not found])],)
170])
171
172AM_COND_IF([ENABLE_G2],
173[
174 PKG_CHECK_MODULES(g2, gtk+-2.0)
175])
176
Damjan Marion0be5ec32016-12-28 17:51:56 +0100177# If cross-compiling, we need external vppapigen and we cannot continue without it
178# For native builds, we just set dependency on vpppaigen binary in top_builddir
179AM_COND_IF([CROSSCOMPILE],
180[
181 AC_PATH_PROG([VPPAPIGEN], [vppapigen], [no])
182 if test "$VPPAPIGEN" = "no"; then
183 AC_MSG_ERROR([Externaly built vppapigen is needed when cross-compiling...])
184 fi
185],[
186 VPPAPIGEN=\$\(top_builddir\)/vppapigen
187])
188AC_SUBST([VPPAPIGEN])
189
190
Damjan Marion7cd468a2016-12-19 23:05:39 +0100191###############################################################################
Damjan Marioncb034b92016-12-28 18:38:59 +0100192# JAVA
Damjan Marion7cd468a2016-12-19 23:05:39 +0100193###############################################################################
194
Damjan Marioncb034b92016-12-28 18:38:59 +0100195AM_COND_IF([ENABLE_JAPI],
196[
197 AX_VPP_FIND_JDK8
198 AC_SUBST(JAVA_HOME)
199 AC_SUBST(JAVAC)
200 AC_SUBST(JAVAH)
201 AC_SUBST(JAR)
202])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100203
204###############################################################################
205# Output
206###############################################################################
207
208AC_OUTPUT
209
210AC_MSG_RESULT([==============================================================================])
211PRINT_VAL([version], $PACKAGE $VERSION)
212PRINT_VAL([prefix], ${prefix})
213PRINT_VAL([libdir], ${libdir})
214PRINT_VAL([includedir], ${includedir})
215PRINT_VAL([CFLAGS], ${CFLAGS})
216PRINT_VAL([CPPFLAGS], ${CPPFLAGS})
217PRINT_VAL([LDFLAGS], ${LDFLAGS})
Damjan Marioncb034b92016-12-28 18:38:59 +0100218AM_COND_IF([ENABLE_JAPI],
219[
220 PRINT_VAL([JAVA_VERSION], ${JAVA_VERSION})
221 PRINT_VAL([JAVA_HOME], ${JAVA_HOME})
222])
Damjan Marion7cd468a2016-12-19 23:05:39 +0100223
224AC_MSG_RESULT([])
225AC_MSG_RESULT([with:])
226m4_foreach([x], m4_dquote(list_of_with), [
227 AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${with_], x, [}])))
228])
229
230AC_MSG_RESULT([])
231AC_MSG_RESULT([enabled:])
232m4_foreach([x], m4_dquote(list_of_enabled), [
233 AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${enable_], x, [}])))
234])
235
236AC_MSG_RESULT([])
237AC_MSG_RESULT([plugins:])
238m4_foreach([x], m4_dquote(list_of_plugins), [
239 AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${enable_], x, [_plugin}])))
240])
241AC_MSG_RESULT([==============================================================================])
242
243