Move java,lua api and remaining plugins to src/
[vpp.git] / src / configure.ac
1 AC_INIT([vpp], [17.04], [vpp-dev@fd.io])
2 LT_INIT
3 AC_CONFIG_AUX_DIR([.])
4 AM_INIT_AUTOMAKE([subdir-objects])
5 AM_SILENT_RULES([yes])
6 AC_CONFIG_FILES([Makefile plugins/Makefile vpp-api/python/Makefile vpp-api/java/Makefile])
7 AC_CONFIG_MACRO_DIR([m4])
8
9 AC_PROG_CC
10 AM_PROG_AS
11 AM_PROG_LIBTOOL
12 AC_PROG_YACC
13
14 ###############################################################################
15 # Macros
16 ###############################################################################
17
18 AC_DEFUN([ENABLE_ARG],
19 [
20   AC_ARG_ENABLE($1,
21     AC_HELP_STRING(patsubst([--enable-$1],[_],[-]), $2),
22     [enable_$1=yes n_enable_$1=1],
23     [enable_$1=no n_enable_$1=0])
24   AM_CONDITIONAL(m4_toupper(ENABLE_$1), test "$enable_$1" = "yes")
25   m4_append([list_of_enabled], [$1], [, ])
26 ])
27
28 AC_DEFUN([DISABLE_ARG],
29 [
30   AC_ARG_ENABLE($1,
31     AC_HELP_STRING(patsubst([--disable-$1],[_],[-]), $2),
32     [enable_$1=no n_enable_$1=0],
33     [enable_$1=yes n_enable_$1=1])
34   AM_CONDITIONAL(m4_toupper(ENABLE_$1), test "$enable_$1" = "yes")
35   m4_append([list_of_enabled], [$1], [, ])
36 ])
37
38 AC_DEFUN([WITH_ARG],
39 [
40   AC_ARG_WITH($1,
41     AC_HELP_STRING(patsubst([--with-$1],[_],[-]), $2),
42     [with_$1=yes n_with_$1=1],
43     [with_$1=no n_with_$1=0])
44   AM_CONDITIONAL(m4_toupper(WITH_$1), test "$with_$1" = "yes")
45   m4_append([list_of_with], [$1], [, ])
46 ])
47
48 AC_DEFUN([WITHOUT_ARG],
49 [
50   AC_ARG_WITH($1,
51     AC_HELP_STRING(patsubst([--without-$1],[_],[-]), $2),
52     [with_$1=no n_with_$1=0],
53     [with_$1=yes n_with_$1=1])
54   AM_CONDITIONAL(m4_toupper(WITH_$1), test "$with_$1" = "yes")
55   m4_append([list_of_with], [$1], [, ])
56 ])
57
58 AC_DEFUN([PLUGIN_ENABLED],
59 [
60    AC_ARG_ENABLE($1_plugin,
61      AC_HELP_STRING([--disable-$1-plugin], [Do not build $1 plugin]),
62        [enable_$1_plugin=no],
63        [enable_$1_plugin=yes ])
64   AM_CONDITIONAL(m4_toupper(ENABLE_$1_PLUGIN), test "$enable_$1_plugin" = "yes")
65   m4_append([list_of_plugins], [$1], [, ])
66 ])
67
68 AC_DEFUN([PLUGIN_DISABLED],
69 [
70    AC_ARG_ENABLE($1_plugin,
71      AC_HELP_STRING([--enable-$1-plugin], [Build $1 plugin]),
72        [enable_$1_plugin=yes ],
73        [enable_$1_plugin=no])
74   AM_CONDITIONAL(m4_toupper((ENABLE_$1_PLUGIN), test "$enable_$1_plugin" = "yes")
75   m4_append([list_of_plugins], [$1], [, ])
76 ])
77
78 AC_DEFUN([PRINT_VAL], [ AC_MSG_RESULT(AC_HELP_STRING($1,$2)) ])
79
80 ###############################################################################
81 # configure arguments
82 ###############################################################################
83
84 # --enable-X
85 ENABLE_ARG(tests,       [Enable unit tests])
86 ENABLE_ARG(dpdk_shared, [Enable unit tests])
87 ENABLE_ARG(perftool,    [Enable perftool])
88 ENABLE_ARG(g2,          [Enable g2])
89
90 # --disable-X
91 DISABLE_ARG(vlib,       [Disable vlib and dependant libs and binaries])
92 DISABLE_ARG(svm,        [Disable svm and dependant libs and binaries])
93 DISABLE_ARG(papi,       [Disable Python API bindings])
94 DISABLE_ARG(japi,       [Disable Java API bindings])
95
96 # --with-X
97 WITH_ARG(dpdk,          [Use use DPDK])
98 WITH_ARG(dpdk_crypto,   [Use DPDK cryptodev])
99 WITH_ARG(dpdk_mlx5_pmd, [Use DPDK with mlx5 PMD])
100
101 # --without-X
102 WITHOUT_ARG(ipsec,      [Disable IPSec])
103 WITHOUT_ARG(ipv6sr,     [Disable IPv6 SR])
104 WITHOUT_ARG(apicli,     [Disable binary api CLI])
105
106 AC_ARG_WITH(unix,
107             AC_HELP_STRING([--with-unix],[Compile unix version of clib]),
108             [],
109             [case $host_os in
110               darwin* | linux*) with_unix=yes;;
111               *) with_unix=no;;
112               esac])
113
114 AM_CONDITIONAL(WITH_UNIX, test "$with_unix" = "yes")
115
116 AC_ARG_WITH(pre-data,
117             AC_HELP_STRING([--with-pre-data],[Set buffer rewrite space]),
118             [case $with_pre_data in
119                128) ;;
120                256) ;;
121                *) with_pre_data="pre-data-not-set" ;;
122              esac], [with_pre_data=128])
123
124 ###############################################################################
125 # Substitutions and defines
126 ###############################################################################
127
128 AC_SUBST(PRE_DATA_SIZE,         [$with_pre_data])
129 AC_SUBST(APICLI,                [-DVPP_API_TEST_BUILTIN=${n_with_apicli}])
130
131 AC_DEFINE_UNQUOTED(DPDK,                [${n_with_dpdk}])
132 AC_DEFINE_UNQUOTED(DPDK_SHARED_LIB,     [${n_enable_dpdk_shared}])
133 AC_DEFINE_UNQUOTED(DPDK_CRYPTO,         [${n_with_dpdk_crypto}])
134 AC_DEFINE_UNQUOTED(IPSEC,               [${n_with_ipsec}])
135 AC_DEFINE_UNQUOTED(IPV6SR,              [${n_with_ipv6sr}])
136
137
138 # Silence following noise:
139 # ar: `u' modifier ignored since `D' is the default (see `U')
140 AR_FLAGS=cr
141 AC_SUBST(AR_FLAGS)
142
143 ###############################################################################
144 # Plugins
145 ###############################################################################
146
147 # Please keep alphabetical order
148 PLUGIN_ENABLED(acl)
149 PLUGIN_ENABLED(flowperpkt)
150 PLUGIN_ENABLED(ila)
151 PLUGIN_ENABLED(ioam)
152 PLUGIN_ENABLED(lb)
153 PLUGIN_ENABLED(sixrd)
154 PLUGIN_ENABLED(snat)
155
156 ###############################################################################
157 # Dependency checks
158 ###############################################################################
159
160 AM_COND_IF([ENABLE_DPDK_SHARED],
161 [
162   AC_CHECK_HEADERS([rte_config.h],
163     [],
164     [AC_MSG_ERROR([DPDK header files not found])],)
165   AC_CHECK_LIB( [dpdk], [rte_eal_init],
166     [],
167     [AC_MSG_ERROR([DPDK shared library not found])],)
168 ])
169
170 AM_COND_IF([ENABLE_G2],
171 [
172   PKG_CHECK_MODULES(g2, gtk+-2.0)
173 ])
174
175 ###############################################################################
176 # JAVA
177 ###############################################################################
178
179 AM_COND_IF([ENABLE_JAPI],
180 [
181   AX_VPP_FIND_JDK8
182   AC_SUBST(JAVA_HOME)
183   AC_SUBST(JAVAC)
184   AC_SUBST(JAVAH)
185   AC_SUBST(JAR)
186 ])
187
188 ###############################################################################
189 # Output
190 ###############################################################################
191
192 AC_OUTPUT
193
194 AC_MSG_RESULT([==============================================================================])
195 PRINT_VAL([version], $PACKAGE $VERSION)
196 PRINT_VAL([prefix], ${prefix})
197 PRINT_VAL([libdir], ${libdir})
198 PRINT_VAL([includedir], ${includedir})
199 PRINT_VAL([CFLAGS], ${CFLAGS})
200 PRINT_VAL([CPPFLAGS], ${CPPFLAGS})
201 PRINT_VAL([LDFLAGS], ${LDFLAGS})
202 AM_COND_IF([ENABLE_JAPI],
203 [
204   PRINT_VAL([JAVA_VERSION], ${JAVA_VERSION})
205   PRINT_VAL([JAVA_HOME], ${JAVA_HOME})
206 ])
207
208 AC_MSG_RESULT([])
209 AC_MSG_RESULT([with:])
210 m4_foreach([x], m4_dquote(list_of_with), [
211   AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${with_], x, [}])))
212 ])
213
214 AC_MSG_RESULT([])
215 AC_MSG_RESULT([enabled:])
216 m4_foreach([x], m4_dquote(list_of_enabled), [
217   AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${enable_], x, [}])))
218 ])
219
220 AC_MSG_RESULT([])
221 AC_MSG_RESULT([plugins:])
222 m4_foreach([x], m4_dquote(list_of_plugins), [
223   AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${enable_], x, [_plugin}])))
224 ])
225 AC_MSG_RESULT([==============================================================================])
226
227