Reorganize source tree to use single autotools instance
[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])
7
8 AC_PROG_CC
9 AM_PROG_AS
10 AM_PROG_LIBTOOL
11 AC_PROG_YACC
12
13 ###############################################################################
14 # Macros
15 ###############################################################################
16
17 AC_DEFUN([ENABLE_ARG],
18 [
19   AC_ARG_ENABLE($1,
20     AC_HELP_STRING(patsubst([--enable-$1],[_],[-]), $2),
21     [enable_$1=yes n_enable_$1=1],
22     [enable_$1=no n_enable_$1=0])
23   AM_CONDITIONAL(m4_toupper(ENABLE_$1), test "$enable_$1" = "yes")
24   m4_append([list_of_enabled], [$1], [, ])
25 ])
26
27 AC_DEFUN([DISABLE_ARG],
28 [
29   AC_ARG_ENABLE($1,
30     AC_HELP_STRING(patsubst([--disable-$1],[_],[-]), $2),
31     [enable_$1=no n_enable_$1=0],
32     [enable_$1=yes n_enable_$1=1])
33   AM_CONDITIONAL(m4_toupper(ENABLE_$1), test "$enable_$1" = "yes")
34   m4_append([list_of_enabled], [$1], [, ])
35 ])
36
37 AC_DEFUN([WITH_ARG],
38 [
39   AC_ARG_WITH($1,
40     AC_HELP_STRING(patsubst([--with-$1],[_],[-]), $2),
41     [with_$1=yes n_with_$1=1],
42     [with_$1=no n_with_$1=0])
43   AM_CONDITIONAL(m4_toupper(WITH_$1), test "$with_$1" = "yes")
44   m4_append([list_of_with], [$1], [, ])
45 ])
46
47 AC_DEFUN([WITHOUT_ARG],
48 [
49   AC_ARG_WITH($1,
50     AC_HELP_STRING(patsubst([--without-$1],[_],[-]), $2),
51     [with_$1=no n_with_$1=0],
52     [with_$1=yes n_with_$1=1])
53   AM_CONDITIONAL(m4_toupper(WITH_$1), test "$with_$1" = "yes")
54   m4_append([list_of_with], [$1], [, ])
55 ])
56
57 AC_DEFUN([PLUGIN_ENABLED],
58 [
59    AC_ARG_ENABLE($1_plugin,
60      AC_HELP_STRING([--disable-$1-plugin], [Do not build $1 plugin]),
61        [enable_$1_plugin=no],
62        [enable_$1_plugin=yes ])
63   AM_CONDITIONAL(m4_toupper(ENABLE_$1_PLUGIN), test "$enable_$1_plugin" = "yes")
64   m4_append([list_of_plugins], [$1], [, ])
65 ])
66
67 AC_DEFUN([PLUGIN_DISABLED],
68 [
69    AC_ARG_ENABLE($1_plugin,
70      AC_HELP_STRING([--enable-$1-plugin], [Build $1 plugin]),
71        [enable_$1_plugin=yes ],
72        [enable_$1_plugin=no])
73   AM_CONDITIONAL(m4_toupper((ENABLE_$1_PLUGIN), test "$enable_$1_plugin" = "yes")
74   m4_append([list_of_plugins], [$1], [, ])
75 ])
76
77 AC_DEFUN([PRINT_VAL], [ AC_MSG_RESULT(AC_HELP_STRING($1,$2)) ])
78
79 ###############################################################################
80 # configure arguments
81 ###############################################################################
82
83 # --enable-X
84 ENABLE_ARG(tests,       [Enable unit tests])
85 ENABLE_ARG(dpdk_shared, [Enable unit tests])
86 ENABLE_ARG(perftool,    [Enable perftool])
87 ENABLE_ARG(g2,          [Enable g2])
88
89 # --disable-X
90 DISABLE_ARG(vlib,       [Disable vlib and dependant libs and binaries])
91 DISABLE_ARG(svm,        [Disable svm and dependant libs and binaries])
92
93 # --with-X
94 WITH_ARG(dpdk,          [Use use DPDK])
95 WITH_ARG(dpdk_crypto,   [Use DPDK cryptodev])
96 WITH_ARG(dpdk_mlx5_pmd, [Use DPDK with mlx5 PMD])
97
98 # --without-X
99 WITHOUT_ARG(ipsec,      [Disable IPSec])
100 WITHOUT_ARG(ipv6sr,     [Disable IPv6 SR])
101 WITHOUT_ARG(apicli,     [Disable binary api CLI])
102
103 AC_ARG_WITH(unix,
104             AC_HELP_STRING([--with-unix],[Compile unix version of clib]),
105             [],
106             [case $host_os in
107               darwin* | linux*) with_unix=yes;;
108               *) with_unix=no;;
109               esac])
110
111 AM_CONDITIONAL(WITH_UNIX, test "$with_unix" = "yes")
112
113 AC_ARG_WITH(pre-data,
114             AC_HELP_STRING([--with-pre-data],[Set buffer rewrite space]),
115             [case $with_pre_data in
116                128) ;;
117                256) ;;
118                *) with_pre_data="pre-data-not-set" ;;
119              esac], [with_pre_data=128])
120
121 ###############################################################################
122 # Substitutions and defines
123 ###############################################################################
124
125 AC_SUBST(PRE_DATA_SIZE,         [$with_pre_data])
126 AC_SUBST(APICLI,                [-DVPP_API_TEST_BUILTIN=${n_with_apicli}])
127
128 AC_DEFINE_UNQUOTED(DPDK,                [${n_with_dpdk}])
129 AC_DEFINE_UNQUOTED(DPDK_SHARED_LIB,     [${n_enable_dpdk_shared}])
130 AC_DEFINE_UNQUOTED(DPDK_CRYPTO,         [${n_with_dpdk_crypto}])
131 AC_DEFINE_UNQUOTED(IPSEC,               [${n_with_ipsec}])
132 AC_DEFINE_UNQUOTED(IPV6SR,              [${n_with_ipv6sr}])
133
134 ###############################################################################
135 # Dependency checks
136 ###############################################################################
137
138 AM_COND_IF([ENABLE_DPDK_SHARED],
139 [
140   AC_CHECK_HEADERS([rte_config.h],
141     [],
142     [AC_MSG_ERROR([DPDK header files not found])],)
143   AC_CHECK_LIB( [dpdk], [rte_eal_init],
144     [],
145     [AC_MSG_ERROR([DPDK shared library not found])],)
146 ])
147
148 AM_COND_IF([ENABLE_G2],
149 [
150   PKG_CHECK_MODULES(g2, gtk+-2.0)
151 ])
152
153 ###############################################################################
154 # Plugins
155 ###############################################################################
156
157 PLUGIN_ENABLED(sixrd)
158 PLUGIN_ENABLED(ila)
159 PLUGIN_ENABLED(flowperpkt)
160
161 ###############################################################################
162 # Output
163 ###############################################################################
164
165 AC_OUTPUT
166
167 AC_MSG_RESULT([==============================================================================])
168 PRINT_VAL([version], $PACKAGE $VERSION)
169 PRINT_VAL([prefix], ${prefix})
170 PRINT_VAL([libdir], ${libdir})
171 PRINT_VAL([includedir], ${includedir})
172 PRINT_VAL([CFLAGS], ${CFLAGS})
173 PRINT_VAL([CPPFLAGS], ${CPPFLAGS})
174 PRINT_VAL([LDFLAGS], ${LDFLAGS})
175
176 AC_MSG_RESULT([])
177 AC_MSG_RESULT([with:])
178 m4_foreach([x], m4_dquote(list_of_with), [
179   AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${with_], x, [}])))
180 ])
181
182 AC_MSG_RESULT([])
183 AC_MSG_RESULT([enabled:])
184 m4_foreach([x], m4_dquote(list_of_enabled), [
185   AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${enable_], x, [}])))
186 ])
187
188 AC_MSG_RESULT([])
189 AC_MSG_RESULT([plugins:])
190 m4_foreach([x], m4_dquote(list_of_plugins), [
191   AC_MSG_RESULT(AC_HELP_STRING(x, m4_join([], [${enable_], x, [_plugin}])))
192 ])
193 AC_MSG_RESULT([==============================================================================])
194
195