Imported Upstream version 1.29
[platform/upstream/connman.git] / configure.ac
1 AC_PREREQ(2.60)
2 AC_INIT(connman, 1.29)
3
4 AM_INIT_AUTOMAKE([foreign subdir-objects color-tests])
5 AC_CONFIG_HEADERS([config.h])
6
7 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
8
9 AM_MAINTAINER_MODE
10
11 AC_PREFIX_DEFAULT(/usr/local)
12
13 PKG_PROG_PKG_CONFIG
14
15 COMPILER_FLAGS
16
17 AC_SUBST(abs_top_srcdir)
18 AC_SUBST(abs_top_builddir)
19
20 AC_LANG_C
21
22 AC_PROG_CC
23 AM_PROG_CC_C_O
24 AC_PROG_CC_PIE
25 AC_PROG_INSTALL
26 AC_PROG_MKDIR_P
27
28 m4_define([_LT_AC_TAGCONFIG], [])
29 m4_ifdef([AC_LIBTOOL_TAGS], [AC_LIBTOOL_TAGS([])])
30
31 AC_DISABLE_STATIC
32 AC_PROG_LIBTOOL
33
34 AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization],
35                         [disable code optimization through compiler]), [
36         if (test "${enableval}" = "no"); then
37                 CFLAGS="$CFLAGS -O0 -U_FORTIFY_SOURCE"
38         fi
39 ])
40
41 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
42                         [enable compiling with debugging information]), [
43         if (test "${enableval}" = "yes" &&
44                                 test "${ac_cv_prog_cc_g}" = "yes"); then
45                 CFLAGS="$CFLAGS -g"
46         fi
47 ])
48
49 AC_ARG_ENABLE(pie, AC_HELP_STRING([--enable-pie],
50                         [enable position independent executables flag]), [
51         if (test "${enableval}" = "yes" &&
52                                 test "${ac_cv_prog_cc_pie}" = "yes"); then
53                 CFLAGS="$CFLAGS -fPIE"
54                 LDFLAGS="$LDFLAGS -pie"
55         fi
56 ])
57
58 AC_ARG_ENABLE(hh2serial-gps,
59         AC_HELP_STRING([--enable-hh2serial-gps], [enable hh2serial GPS support]),
60                         [enable_hh2serial_gps=${enableval}], [enable_hh2serial_gps="no"])
61 AM_CONDITIONAL(HH2SERIAL_GPS, test "${enable_hh2serial_gps}" != "no")
62 AM_CONDITIONAL(HH2SERIAL_GPS_BUILTIN, test "${enable_hh2serial_gps}" = "builtin")
63
64 AC_ARG_WITH(openconnect, AC_HELP_STRING([--with-openconnect=PROGRAM],
65         [specify location of openconnect binary]), [path_openconnect=${withval}])
66
67 AC_ARG_ENABLE(openconnect,
68         AC_HELP_STRING([--enable-openconnect], [enable openconnect support]),
69                         [enable_openconnect=${enableval}], [enable_openconnect="no"])
70 if (test "${enable_openconnect}" != "no"); then
71         if (test -z "${path_openconnect}"); then
72                 AC_PATH_PROG(OPENCONNECT, [openconnect], [], $PATH:/sbin:/usr/sbin)
73                 if (test -z "${OPENCONNECT}"); then
74                         AC_MSG_ERROR(openconnect binary not found)
75                 fi
76         else
77                 OPENCONNECT="${path_openconnect}"
78                 AC_SUBST(OPENCONNECT)
79         fi
80 fi
81 AM_CONDITIONAL(OPENCONNECT, test "${enable_openconnect}" != "no")
82 AM_CONDITIONAL(OPENCONNECT_BUILTIN, test "${enable_openconnect}" = "builtin")
83
84 AC_ARG_WITH(openvpn, AC_HELP_STRING([--with-openvpn=PROGRAM],
85         [specify location of openvpn binary]), [path_openvpn=${withval}])
86
87 AC_ARG_ENABLE(openvpn,
88         AC_HELP_STRING([--enable-openvpn], [enable openvpn support]),
89                         [enable_openvpn=${enableval}], [enable_openvpn="no"])
90 if (test "${enable_openvpn}" != "no"); then
91         if (test -z "${path_openvpn}"); then
92                 AC_PATH_PROG(OPENVPN, [openvpn], [], $PATH:/sbin:/usr/sbin)
93                 if (test -z "${OPENVPN}"); then
94                         AC_MSG_ERROR(openvpn binary not found)
95                 fi
96         else
97                 OPENVPN="${path_openvpn}"
98                 AC_SUBST(OPENVPN)
99         fi
100 fi
101 AM_CONDITIONAL(OPENVPN, test "${enable_openvpn}" != "no")
102 AM_CONDITIONAL(OPENVPN_BUILTIN, test "${enable_openvpn}" = "builtin")
103
104 AC_ARG_WITH(vpnc, AC_HELP_STRING([--with-vpnc=PROGRAM],
105         [specify location of vpnc binary]), [path_vpnc=${withval}])
106
107 AC_ARG_ENABLE(vpnc,
108         AC_HELP_STRING([--enable-vpnc], [enable vpnc support]),
109                 [enable_vpnc=${enableval}], [enable_vpnc="no"])
110 if (test "${enable_vpnc}" != "no"); then
111         if (test -z "${path_vpnc}"); then
112                 AC_PATH_PROG(VPNC, [vpnc], [], $PATH:/sbin:/usr/sbin)
113                 if (test -z "${VPNC}"); then
114                         AC_MSG_ERROR(vpnc binary not found)
115                 fi
116         else
117                 VPNC="${path_vpnc}"
118                 AC_SUBST(VPNC)
119         fi
120 fi
121 AM_CONDITIONAL(VPNC, test "${enable_vpnc}" != "no")
122 AM_CONDITIONAL(VPNC_BUILTIN, test "${enable_vpnc}" = "builtin")
123
124 AC_ARG_WITH(l2tp, AC_HELP_STRING([--with-l2tp=PROGRAM],
125         [specify location of l2tp binary]), [path_l2tp=${withval}])
126
127 AC_ARG_ENABLE(l2tp,
128         AC_HELP_STRING([--enable-l2tp], [enable l2tp support]),
129                         [enable_l2tp=${enableval}], [enable_l2tp="no"])
130 if (test "${enable_l2tp}" != "no"); then
131         if (test -z "${path_pppd}"); then
132                 AC_PATH_PROG(PPPD, [pppd], [/usr/sbin/pppd], $PATH:/sbin:/usr/sbin)
133         else
134                 PPPD="${path_pppd}"
135                 AC_SUBST(PPPD)
136         fi
137         AC_CHECK_HEADERS(pppd/pppd.h, dummy=yes,
138                         AC_MSG_ERROR(ppp header files are required))
139         if (test -z "${path_l2tp}"); then
140                 AC_PATH_PROG(L2TP, [xl2tpd], [/usr/sbin/xl2tpd], $PATH:/sbin:/usr/sbin)
141         else
142                 L2TP="${path_l2tp}"
143                 AC_SUBST(L2TP)
144         fi
145 fi
146 AM_CONDITIONAL(L2TP, test "${enable_l2tp}" != "no")
147 AM_CONDITIONAL(L2TP_BUILTIN, test "${enable_l2tp}" = "builtin")
148
149 AC_ARG_WITH(pptp, AC_HELP_STRING([--with-pptp=PROGRAM],
150         [specify location of pptp binary]), [path_pptp=${withval}])
151
152 AC_ARG_ENABLE(pptp,
153         AC_HELP_STRING([--enable-pptp], [enable pptp support]),
154                         [enable_pptp=${enableval}], [enable_pptp="no"])
155 if (test "${enable_pptp}" != "no"); then
156         if (test -z "${path_pppd}"); then
157                 AC_PATH_PROG(PPPD, [pppd], [/usr/sbin/pppd], $PATH:/sbin:/usr/sbin)
158         else
159                 PPPD="${path_pppd}"
160                 AC_SUBST(PPPD)
161         fi
162         AC_CHECK_HEADERS(pppd/pppd.h, dummy=yes,
163                         AC_MSG_ERROR(ppp header files are required))
164         if (test -z "${path_pptp}"); then
165                 AC_PATH_PROG(PPTP, [pptp], [/usr/sbin/pptp], $PATH:/sbin:/usr/sbin)
166         else
167                 PPTP="${path_pptp}"
168                 AC_SUBST(PPTP)
169         fi
170 fi
171 AM_CONDITIONAL(PPTP, test "${enable_pptp}" != "no")
172 AM_CONDITIONAL(PPTP_BUILTIN, test "${enable_pptp}" = "builtin")
173
174 AC_CHECK_HEADERS(resolv.h, dummy=yes,
175         AC_MSG_ERROR(resolver header files are required))
176 AC_CHECK_LIB(resolv, ns_initparse, dummy=yes, [
177         AC_CHECK_LIB(resolv, __ns_initparse, dummy=yes,
178                 AC_MSG_ERROR(resolver library support is required))
179 ])
180
181 AC_CHECK_FUNC(signalfd, dummy=yes,
182                         AC_MSG_ERROR(signalfd support is required))
183
184 AC_CHECK_LIB(dl, dlopen, dummy=yes,
185                         AC_MSG_ERROR(dynamic linking loader is required))
186
187 AC_ARG_ENABLE(iospm, AC_HELP_STRING([--enable-iospm],
188                 [enable Intel OSPM support]), [enable_iospm=${enableval}])
189 AM_CONDITIONAL(IOSPM, test "${enable_iospm}" = "yes")
190
191 AC_ARG_ENABLE(tist,
192         AC_HELP_STRING([--enable-tist], [enable TI Shared Transport support]),
193                         [enable_tist=${enableval}], [enable_tist="no"])
194 AM_CONDITIONAL(TIST, test "${enable_tist}" != "no")
195 AM_CONDITIONAL(TIST_BUILTIN, test "${enable_tist}" = "builtin")
196
197 AC_ARG_ENABLE(session-policy-local,
198         AC_HELP_STRING([--enable-session-policy-local], [enable local file Session policy configuration support]),
199                         [enable_session_policy_local=${enableval}], [enable_session_policy_local="no"])
200 AM_CONDITIONAL(SESSION_POLICY_LOCAL, test "${enable_session_policy_local}" != "no")
201 AM_CONDITIONAL(SESSION_POLICY_LOCAL_BUILTIN, test "${enable_session_policy_local}" = "builtin")
202
203 AC_ARG_WITH(stats-max-file-size, AC_HELP_STRING([--with-stats-max-file-size=SIZE],
204                         [Maximal size of a statistics round robin file]),
205                         [stats_max_file_size=${withval}])
206
207 if (test -z "${stats_max_file_size}"); then
208    # default size is 16 kByte
209    stats_max_file_size="16 * 8 * 128"
210 fi
211
212 AC_DEFINE_UNQUOTED([STATS_MAX_FILE_SIZE], (${stats_max_file_size}), [Maximal size of a statistics round robin file])
213
214 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28, dummy=yes,
215                                 AC_MSG_ERROR(GLib >= 2.28 is required))
216 AC_SUBST(GLIB_CFLAGS)
217 AC_SUBST(GLIB_LIBS)
218
219 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.4, dummy=yes,
220                                 AC_MSG_ERROR(D-Bus >= 1.4 is required))
221 AC_SUBST(DBUS_CFLAGS)
222 AC_SUBST(DBUS_LIBS)
223
224 AC_ARG_WITH(dbusconfdir, AC_HELP_STRING([--with-dbusconfdir=PATH],
225         [path to D-Bus config directory]), [path_dbusconf=${withval}],
226                 [path_dbusconf="`$PKG_CONFIG --variable=sysconfdir dbus-1`"])
227 if (test -z "${path_dbusconf}"); then
228         DBUS_CONFDIR="${sysconfdir}/dbus-1/system.d"
229 else
230         DBUS_CONFDIR="${path_dbusconf}/dbus-1/system.d"
231 fi
232 AC_SUBST(DBUS_CONFDIR)
233
234 AC_ARG_WITH(dbusdatadir, AC_HELP_STRING([--with-dbusdatadir=PATH],
235         [path to D-Bus data directory]), [path_dbusdata=${withval}],
236                 [path_dbusdata="`$PKG_CONFIG --variable=datadir dbus-1`"])
237 if (test -z "${path_dbusdata}"); then
238         DBUS_DATADIR="${datadir}/dbus-1/system-services"
239 else
240         DBUS_DATADIR="${path_dbusdata}/dbus-1/system-services"
241 fi
242 AC_SUBST(DBUS_DATADIR)
243
244 AC_ARG_WITH([systemdunitdir], AC_HELP_STRING([--with-systemdunitdir=DIR],
245         [path to systemd service directory]), [path_systemdunit=${withval}],
246                 [path_systemdunit="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"])
247 if (test -n "${path_systemdunit}"); then
248         SYSTEMD_UNITDIR="${path_systemdunit}"
249         AC_SUBST(SYSTEMD_UNITDIR)
250 fi
251 AM_CONDITIONAL(SYSTEMD, test -n "${path_systemdunit}")
252
253 PKG_CHECK_MODULES(XTABLES, xtables >= 1.4.11, dummy=yes,
254                                 AC_MSG_ERROR(Xtables library is required))
255 AC_SUBST(XTABLES_CFLAGS)
256 AC_SUBST(XTABLES_LIBS)
257
258 AC_ARG_ENABLE(test, AC_HELP_STRING([--enable-test],
259                 [enable test/example scripts]), [enable_test=${enableval}])
260 AM_CONDITIONAL(TEST, test "${enable_test}" = "yes")
261
262 AC_ARG_ENABLE(nmcompat, AC_HELP_STRING([--enable-nmcompat],
263                                 [enable Network Manager support]),
264                         [enable_nmcompat=${enableval}], [enable_nmcompat="no"])
265 AM_CONDITIONAL(NMCOMPAT, test "${enable_nmcompat}" != "no")
266
267 AC_ARG_ENABLE(polkit, AC_HELP_STRING([--enable-polkit],
268                                 [enable PolicyKit support]),
269                         [enable_polkit=${enableval}], [enable_polkit="no"])
270 if (test "${enable_polkit}" != "no"); then
271         POLKIT_DATADIR="`$PKG_CONFIG --variable=actiondir polkit`"
272         POLKIT_DATADIR=""
273         if (test -z "${POLKIT_DATADIR}"); then
274                 POLKIT_DATADIR="${datadir}/polkit-1/actions"
275         fi
276         AC_SUBST(POLKIT_DATADIR)
277 fi
278 AM_CONDITIONAL(POLKIT, test "${enable_polkit}" != "no")
279
280 AC_ARG_ENABLE(selinux, AC_HELP_STRING([--enable-selinux],
281                                 [enable selinux support]),
282                         [enable_selinux=${enableval}], [enable_selinux="no"])
283 AM_CONDITIONAL(SELINUX, test "${enable_selinux}" != "no")
284
285 AC_ARG_ENABLE(loopback, AC_HELP_STRING([--disable-loopback],
286                                 [disable loopback support]),
287                                         [enable_loopback=${enableval}])
288 AM_CONDITIONAL(LOOPBACK, test "${enable_loopback}" != "no")
289
290 AC_ARG_ENABLE(ethernet, AC_HELP_STRING([--disable-ethernet],
291                                 [disable Ethernet support]),
292                                         [enable_ethernet=${enableval}])
293 AM_CONDITIONAL(ETHERNET, test "${enable_ethernet}" != "no")
294
295 AC_ARG_ENABLE(gadget, AC_HELP_STRING([--disable-gadget],
296                                 [disable USB Gadget support]),
297                                         [enable_gadget=${enableval}])
298 AM_CONDITIONAL(GADGET, test "${enable_gadget}" != "no")
299
300 AC_ARG_ENABLE(wifi, AC_HELP_STRING([--disable-wifi],
301                                 [disable WiFi support]),
302                                         [enable_wifi=${enableval}])
303 AM_CONDITIONAL(WIFI, test "${enable_wifi}" != "no")
304
305 AC_ARG_ENABLE(bluetooth, AC_HELP_STRING([--disable-bluetooth],
306                                 [disable Bluetooth support]),
307                                         [enable_bluetooth=${enableval}])
308 AM_CONDITIONAL(BLUETOOTH, test "${enable_bluetooth}" != "no")
309
310 AC_ARG_ENABLE(ofono, AC_HELP_STRING([--disable-ofono],
311                                 [disable oFono support]),
312                                         [enable_ofono=${enableval}])
313 AM_CONDITIONAL(OFONO, test "${enable_ofono}" != "no")
314
315 AC_ARG_ENABLE(dundee, AC_HELP_STRING([--disable-dundee],
316                                 [disable dundee support (Bluetooth DUN)]),
317                                         [enable_dundee=${enableval}])
318 AM_CONDITIONAL(DUNDEE, test "${enable_dundee}" != "no")
319
320 AC_ARG_ENABLE(pacrunner, AC_HELP_STRING([--disable-pacrunner],
321                                 [disable PACrunner support]),
322                                         [enable_pacrunner=${enableval}])
323 AM_CONDITIONAL(PACRUNNER, test "${enable_pacrunner}" != "no")
324
325 AC_ARG_ENABLE(neard, AC_HELP_STRING([--disable-neard],
326                                 [disable Neard support]),
327                                         [enable_neard=${enableval}])
328 AM_CONDITIONAL(NEARD, test "${enable_neard}" != "no")
329
330 AC_ARG_ENABLE(wispr, AC_HELP_STRING([--disable-wispr],
331                                 [disable WISPr support]),
332                                         [enable_wispr=${enableval}])
333 AM_CONDITIONAL(WISPR, test "${enable_wispr}" != "no")
334
335 AC_ARG_ENABLE(tools, AC_HELP_STRING([--disable-tools],
336                                 [disable testing tools]),
337                                         [enable_tools=${enableval}])
338 AM_CONDITIONAL(TOOLS, test "${enable_tools}" != "no")
339
340 if (test "${enable_tools}" != "no"); then
341         AC_PATH_PROGS(IPTABLES_SAVE, [iptables-save], [],
342                                                 $PATH:/sbin:/usr/sbin)
343         IPTABLES_SAVE=$ac_cv_path_IPTABLES_SAVE
344 else
345         IPTABLES_SAVE=""
346 fi
347 AC_SUBST(IPTABLES_SAVE)
348
349 AC_ARG_ENABLE(client, AC_HELP_STRING([--disable-client],
350                                 [disable command line client]),
351                                         [enable_client=${enableval}])
352 AM_CONDITIONAL(CLIENT, test "${enable_client}" != "no")
353
354 if (test "${enable_wispr}" != "no"); then
355         PKG_CHECK_MODULES(GNUTLS, gnutls, dummy=yes,
356                                 AC_MSG_ERROR(GnuTLS library is required))
357 else
358         GNUTLS_CFLAGS=""
359         GNUTLS_LIBS=""
360 fi
361 AC_SUBST(GNUTLS_CFLAGS)
362 AC_SUBST(GNUTLS_LIBS)
363
364 if (test "${enable_loopback}" != "no"); then
365         AC_CHECK_HEADERS(sys/inotify.h, dummy=yes,
366                         AC_MSG_ERROR(inotify header files are required))
367
368         AC_CHECK_LIB(c, inotify_init, dummy=yes,
369                         AC_MSG_ERROR(inotify library support is required))
370 fi
371
372 if (test "${enable_wifi}" != "no"); then
373         AC_PATH_PROG(WPASUPPLICANT, [wpa_supplicant], [],
374                                                 $PATH:/sbin:/usr/sbin)
375 fi
376
377 AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
378                         [don't install configuration and data files]),
379                                         [enable_datafiles=${enableval}])
380 AM_CONDITIONAL(DATAFILES, test "${enable_datafiles}" != "no")
381
382 if (test "${enable_client}" != "no"); then
383         AC_CHECK_HEADERS(readline/readline.h, dummy=yes,
384                 AC_MSG_ERROR(readline header files are required))
385 fi
386
387 AM_CONDITIONAL(VPN, test "${enable_openconnect}" != "no" -o \
388                         "${enable_openvpn}" != "no" -o \
389                         "${enable_vpnc}" != "no" -o \
390                         "${enable_l2tp}" != "no" -o \
391                         "${enable_pptp}" != "no")
392
393 AC_OUTPUT(Makefile include/version.h connman.pc)