5b6124e659988ac047a0c87d7c39c7f18791da39
[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_ENABLE(telephony,
65         AC_HELP_STRING([--enable-telephony], [enable Telephony support]),
66                         [enable_telephony=${enableval}], [enable_telephony="yes"])
67 AM_CONDITIONAL(TELEPHONY, test "${enable_telephony}" != "no")
68 AM_CONDITIONAL(TELEPHONY_BUILTIN, test "${enable_telephony}" = "builtin")
69
70 AC_ARG_ENABLE(tizen-ext,
71         AC_HELP_STRING([--enable-tizen-ext], [enable TIZEN extensions]),
72                         [if (test "${enableval}" = "yes"); then
73                                 CFLAGS="$CFLAGS -DTIZEN_EXT"
74                                 LIBS="$LIBS -lsmack"
75                         fi])
76 AM_CONDITIONAL(TIZEN_EXT, test "${enable-tizen-ext}" != "no")
77
78 AC_ARG_WITH(openconnect, AC_HELP_STRING([--with-openconnect=PROGRAM],
79         [specify location of openconnect binary]), [path_openconnect=${withval}])
80
81 AC_ARG_ENABLE(openconnect,
82         AC_HELP_STRING([--enable-openconnect], [enable openconnect support]),
83                         [enable_openconnect=${enableval}], [enable_openconnect="no"])
84 if (test "${enable_openconnect}" != "no"); then
85         if (test -z "${path_openconnect}"); then
86                 AC_PATH_PROG(OPENCONNECT, [openconnect], [], $PATH:/bin:/usr/bin)
87                 if (test -z "${OPENCONNECT}"); then
88                         AC_MSG_ERROR(openconnect binary not found)
89                 fi
90         else
91                 OPENCONNECT="${path_openconnect}"
92                 AC_SUBST(OPENCONNECT)
93         fi
94 fi
95 AM_CONDITIONAL(OPENCONNECT, test "${enable_openconnect}" != "no")
96 AM_CONDITIONAL(OPENCONNECT_BUILTIN, test "${enable_openconnect}" = "builtin")
97
98 AC_ARG_WITH(openvpn, AC_HELP_STRING([--with-openvpn=PROGRAM],
99         [specify location of openvpn binary]), [path_openvpn=${withval}])
100
101 AC_ARG_ENABLE(openvpn,
102         AC_HELP_STRING([--enable-openvpn], [enable openvpn support]),
103                         [enable_openvpn=${enableval}], [enable_openvpn="no"])
104 if (test "${enable_openvpn}" != "no"); then
105         if (test -z "${path_openvpn}"); then
106                 AC_PATH_PROG(OPENVPN, [openvpn], [/usr/bin/openvpn], $PATH:/bin:/usr/bin)
107                 if (test -z "${OPENVPN}"); then
108                         AC_MSG_ERROR(openvpn binary not found)
109                 fi
110         else
111                 OPENVPN="${path_openvpn}"
112                 AC_SUBST(OPENVPN)
113         fi
114 fi
115 AM_CONDITIONAL(OPENVPN, test "${enable_openvpn}" != "no")
116 AM_CONDITIONAL(OPENVPN_BUILTIN, test "${enable_openvpn}" = "builtin")
117
118 AC_ARG_WITH(ipsec, AC_HELP_STRING([--with-ipsec=PROGRAM],
119         [specify location of ipsec binary]), [path_ipsec=${withval}])
120
121 AC_ARG_ENABLE(ipsec,
122         AC_HELP_STRING([--enable-ipsec], [enable ipsec support]),
123                         [enable_ipsec=${enableval}], [enable_ipsec="no"])
124 if (test "${enable_ipsec}" != "no"); then
125         PKG_CHECK_MODULES(GIO, gio-2.0 >= 2.28, dummy=yes,
126                                         AC_MSG_ERROR(GIO >= 2.28 is required))
127         AC_SUBST(GIO_CFLAGS)
128         AC_SUBST(GIO_LIBS)
129         PKG_CHECK_MODULES(OPENSSL, openssl, dummy=yes,
130                                         AC_MSG_ERROR(openssl library is required))
131         AC_SUBST(OPENSSL_CFLAGS)
132         AC_SUBST(OPENSSL_LIBS)
133         if (test -z "${path_ipsec}"); then
134                 AC_PATH_PROG(IPSEC, [charon], [/usr/bin/charon], $PATH:/usr/bin)
135                 if (test -z "${IPSEC}"); then
136                         AC_MSG_ERROR(ipsec binary not found)
137                 fi
138         else
139                 IPSEC="${path_ipsec}"
140                 AC_SUBST(IPSEC)
141         fi
142 fi
143 AM_CONDITIONAL(IPSEC, test "${enable_ipsec}" != "no")
144 AM_CONDITIONAL(IPSEC_BUILTIN, test "${enable_ipsec}" = "builtin")
145
146 AC_ARG_WITH(vpnc, AC_HELP_STRING([--with-vpnc=PROGRAM],
147         [specify location of vpnc binary]), [path_vpnc=${withval}])
148
149 AC_ARG_ENABLE(vpnc,
150         AC_HELP_STRING([--enable-vpnc], [enable vpnc support]),
151                 [enable_vpnc=${enableval}], [enable_vpnc="no"])
152 if (test "${enable_vpnc}" != "no"); then
153         if (test -z "${path_vpnc}"); then
154                 AC_PATH_PROG(VPNC, [vpnc], [], $PATH:/bin:/usr/bin)
155                 if (test -z "${VPNC}"); then
156                         AC_MSG_ERROR(vpnc binary not found)
157                 fi
158         else
159                 VPNC="${path_vpnc}"
160                 AC_SUBST(VPNC)
161         fi
162 fi
163 AM_CONDITIONAL(VPNC, test "${enable_vpnc}" != "no")
164 AM_CONDITIONAL(VPNC_BUILTIN, test "${enable_vpnc}" = "builtin")
165
166 AC_ARG_WITH(l2tp, AC_HELP_STRING([--with-l2tp=PROGRAM],
167         [specify location of l2tp binary]), [path_l2tp=${withval}])
168
169 AC_ARG_ENABLE(l2tp,
170         AC_HELP_STRING([--enable-l2tp], [enable l2tp support]),
171                         [enable_l2tp=${enableval}], [enable_l2tp="no"])
172 if (test "${enable_l2tp}" != "no"); then
173         if (test -z "${path_pppd}"); then
174                 AC_PATH_PROG(PPPD, [pppd], [/usr/bin/pppd], $PATH:/bin:/usr/bin)
175         else
176                 PPPD="${path_pppd}"
177                 AC_SUBST(PPPD)
178         fi
179         AC_CHECK_HEADERS(pppd/pppd.h, dummy=yes,
180                         AC_MSG_ERROR(ppp header files are required))
181         if (test -z "${path_l2tp}"); then
182                 AC_PATH_PROG(L2TP, [xl2tpd], [/usr/bin/xl2tpd], $PATH:/bin:/usr/bin)
183         else
184                 L2TP="${path_l2tp}"
185                 AC_SUBST(L2TP)
186         fi
187 fi
188 AM_CONDITIONAL(L2TP, test "${enable_l2tp}" != "no")
189 AM_CONDITIONAL(L2TP_BUILTIN, test "${enable_l2tp}" = "builtin")
190
191 AC_ARG_WITH(pptp, AC_HELP_STRING([--with-pptp=PROGRAM],
192         [specify location of pptp binary]), [path_pptp=${withval}])
193
194 AC_ARG_ENABLE(pptp,
195         AC_HELP_STRING([--enable-pptp], [enable pptp support]),
196                         [enable_pptp=${enableval}], [enable_pptp="no"])
197 if (test "${enable_pptp}" != "no"); then
198         if (test -z "${path_pppd}"); then
199                 AC_PATH_PROG(PPPD, [pppd], [/usr/bin/pppd], $PATH:/bin:/usr/bin)
200         else
201                 PPPD="${path_pppd}"
202                 AC_SUBST(PPPD)
203         fi
204         AC_CHECK_HEADERS(pppd/pppd.h, dummy=yes,
205                         AC_MSG_ERROR(ppp header files are required))
206         if (test -z "${path_pptp}"); then
207                 AC_PATH_PROG(PPTP, [pptp], [/usr/bin/pptp], $PATH:/bin:/usr/bin)
208         else
209                 PPTP="${path_pptp}"
210                 AC_SUBST(PPTP)
211         fi
212 fi
213 AM_CONDITIONAL(PPTP, test "${enable_pptp}" != "no")
214 AM_CONDITIONAL(PPTP_BUILTIN, test "${enable_pptp}" = "builtin")
215
216 AC_CHECK_HEADERS(resolv.h, dummy=yes,
217         AC_MSG_ERROR(resolver header files are required))
218 AC_CHECK_LIB(resolv, ns_initparse, dummy=yes, [
219         AC_CHECK_LIB(resolv, __ns_initparse, dummy=yes,
220                 AC_MSG_ERROR(resolver library support is required))
221 ])
222
223 AC_CHECK_FUNC(signalfd, dummy=yes,
224                         AC_MSG_ERROR(signalfd support is required))
225
226 AC_CHECK_LIB(dl, dlopen, dummy=yes,
227                         AC_MSG_ERROR(dynamic linking loader is required))
228
229 AC_ARG_ENABLE(iospm, AC_HELP_STRING([--enable-iospm],
230                 [enable Intel OSPM support]), [enable_iospm=${enableval}])
231 AM_CONDITIONAL(IOSPM, test "${enable_iospm}" = "yes")
232
233 AC_ARG_ENABLE(tist,
234         AC_HELP_STRING([--enable-tist], [enable TI Shared Transport support]),
235                         [enable_tist=${enableval}], [enable_tist="no"])
236 AM_CONDITIONAL(TIST, test "${enable_tist}" != "no")
237 AM_CONDITIONAL(TIST_BUILTIN, test "${enable_tist}" = "builtin")
238
239 AC_ARG_ENABLE(session-policy-local,
240         AC_HELP_STRING([--enable-session-policy-local], [enable local file Session policy configuration support]),
241                         [enable_session_policy_local=${enableval}], [enable_session_policy_local="no"])
242 AM_CONDITIONAL(SESSION_POLICY_LOCAL, test "${enable_session_policy_local}" != "no")
243 AM_CONDITIONAL(SESSION_POLICY_LOCAL_BUILTIN, test "${enable_session_policy_local}" = "builtin")
244
245 AC_ARG_WITH(stats-max-file-size, AC_HELP_STRING([--with-stats-max-file-size=SIZE],
246                         [Maximal size of a statistics round robin file]),
247                         [stats_max_file_size=${withval}])
248
249 if (test -z "${stats_max_file_size}"); then
250    # default size is 16 kByte
251    stats_max_file_size="16 * 8 * 128"
252 fi
253
254 AC_DEFINE_UNQUOTED([STATS_MAX_FILE_SIZE], (${stats_max_file_size}), [Maximal size of a statistics round robin file])
255
256 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28, dummy=yes,
257                                 AC_MSG_ERROR(GLib >= 2.28 is required))
258 AC_SUBST(GLIB_CFLAGS)
259 AC_SUBST(GLIB_LIBS)
260
261 PKG_CHECK_MODULES(LIBSYSTEMD, libsystemd-daemon, dummy=yes,
262                                 AC_MSG_ERROR(libsystemd-daemon library is required))
263 AC_SUBST(LIBSYSTEMD_CFLAGS)
264 AC_SUBST(LIBSYSTEMD_LIBS)
265
266 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.4, dummy=yes,
267                                 AC_MSG_ERROR(D-Bus >= 1.4 is required))
268 AC_SUBST(DBUS_CFLAGS)
269 AC_SUBST(DBUS_LIBS)
270
271 AC_ARG_WITH(dbusconfdir, AC_HELP_STRING([--with-dbusconfdir=PATH],
272         [path to D-Bus config directory]), [path_dbusconf=${withval}],
273                 [path_dbusconf="`$PKG_CONFIG --variable=sysconfdir dbus-1`"])
274 if (test -z "${path_dbusconf}"); then
275         DBUS_CONFDIR="${sysconfdir}/dbus-1/system.d"
276 else
277         DBUS_CONFDIR="${path_dbusconf}/dbus-1/system.d"
278 fi
279 AC_SUBST(DBUS_CONFDIR)
280
281 AC_ARG_WITH(dbusdatadir, AC_HELP_STRING([--with-dbusdatadir=PATH],
282         [path to D-Bus data directory]), [path_dbusdata=${withval}],
283                 [path_dbusdata="`$PKG_CONFIG --variable=datadir dbus-1`"])
284 if (test -z "${path_dbusdata}"); then
285         DBUS_DATADIR="${datadir}/dbus-1/system-services"
286 else
287         DBUS_DATADIR="${path_dbusdata}/dbus-1/system-services"
288 fi
289 AC_SUBST(DBUS_DATADIR)
290
291 AC_ARG_WITH([systemdunitdir], AC_HELP_STRING([--with-systemdunitdir=DIR],
292         [path to systemd service directory]), [path_systemdunit=${withval}],
293                 [path_systemdunit="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"])
294 if (test -n "${path_systemdunit}"); then
295         SYSTEMD_UNITDIR="${path_systemdunit}"
296         AC_SUBST(SYSTEMD_UNITDIR)
297 fi
298 AM_CONDITIONAL(SYSTEMD, test -n "${path_systemdunit}")
299
300 PKG_CHECK_MODULES(XTABLES, xtables >= 1.4.11, dummy=yes,
301                                 AC_MSG_ERROR(Xtables library is required))
302 AC_SUBST(XTABLES_CFLAGS)
303 AC_SUBST(XTABLES_LIBS)
304
305 PKG_CHECK_MODULES(TPKP_GNUTLS, tpkp-gnutls, dummy=yes,
306                                                                 AC_MSG_ERROR(tpkp-gnutls library is required))
307 AC_SUBST(TPKP_GNUTLS_CFLAGS)
308 AC_SUBST(TPKP_GNUTLS_LIBS)
309
310 AC_ARG_ENABLE(test, AC_HELP_STRING([--enable-test],
311                 [enable test/example scripts]), [enable_test=${enableval}])
312 AM_CONDITIONAL(TEST, test "${enable_test}" = "yes")
313
314 AC_ARG_ENABLE(nmcompat, AC_HELP_STRING([--enable-nmcompat],
315                                 [enable Network Manager support]),
316                         [enable_nmcompat=${enableval}], [enable_nmcompat="no"])
317 AM_CONDITIONAL(NMCOMPAT, test "${enable_nmcompat}" != "no")
318
319 AC_ARG_ENABLE(polkit, AC_HELP_STRING([--enable-polkit],
320                                 [enable PolicyKit support]),
321                         [enable_polkit=${enableval}], [enable_polkit="no"])
322 if (test "${enable_polkit}" != "no"); then
323         POLKIT_DATADIR="`$PKG_CONFIG --variable=actiondir polkit`"
324         POLKIT_DATADIR=""
325         if (test -z "${POLKIT_DATADIR}"); then
326                 POLKIT_DATADIR="${datadir}/polkit-1/actions"
327         fi
328         AC_SUBST(POLKIT_DATADIR)
329 fi
330 AM_CONDITIONAL(POLKIT, test "${enable_polkit}" != "no")
331
332 AC_ARG_ENABLE(selinux, AC_HELP_STRING([--enable-selinux],
333                                 [enable selinux support]),
334                         [enable_selinux=${enableval}], [enable_selinux="no"])
335 AM_CONDITIONAL(SELINUX, test "${enable_selinux}" != "no")
336
337 AC_ARG_ENABLE(loopback, AC_HELP_STRING([--disable-loopback],
338                                 [disable loopback support]),
339                                         [enable_loopback=${enableval}])
340 AM_CONDITIONAL(LOOPBACK, test "${enable_loopback}" != "no")
341
342 AC_ARG_ENABLE(ethernet, AC_HELP_STRING([--disable-ethernet],
343                                 [disable Ethernet support]),
344                                         [enable_ethernet=${enableval}])
345 AM_CONDITIONAL(ETHERNET, test "${enable_ethernet}" != "no")
346
347 AC_ARG_ENABLE(gadget, AC_HELP_STRING([--disable-gadget],
348                                 [disable USB Gadget support]),
349                                         [enable_gadget=${enableval}])
350 AM_CONDITIONAL(GADGET, test "${enable_gadget}" != "no")
351
352 AC_ARG_ENABLE(wifi, AC_HELP_STRING([--disable-wifi],
353                                 [disable WiFi support]),
354                                         [enable_wifi=${enableval}])
355 AM_CONDITIONAL(WIFI, test "${enable_wifi}" != "no")
356
357 AC_ARG_ENABLE(bluetooth, AC_HELP_STRING([--disable-bluetooth],
358                                 [disable Bluetooth support]),
359                                         [enable_bluetooth=${enableval}])
360 AM_CONDITIONAL(BLUETOOTH, test "${enable_bluetooth}" != "no")
361
362 AC_ARG_ENABLE(ofono, AC_HELP_STRING([--disable-ofono],
363                                 [disable oFono support]),
364                                         [enable_ofono=${enableval}])
365 AM_CONDITIONAL(OFONO, test "${enable_ofono}" != "no")
366
367 AC_ARG_ENABLE(dundee, AC_HELP_STRING([--disable-dundee],
368                                 [disable dundee support (Bluetooth DUN)]),
369                                         [enable_dundee=${enableval}])
370 AM_CONDITIONAL(DUNDEE, test "${enable_dundee}" != "no")
371
372 AC_ARG_ENABLE(pacrunner, AC_HELP_STRING([--disable-pacrunner],
373                                 [disable PACrunner support]),
374                                         [enable_pacrunner=${enableval}])
375 AM_CONDITIONAL(PACRUNNER, test "${enable_pacrunner}" != "no")
376
377 AC_ARG_ENABLE(neard, AC_HELP_STRING([--disable-neard],
378                                 [disable Neard support]),
379                                         [enable_neard=${enableval}])
380 AM_CONDITIONAL(NEARD, test "${enable_neard}" != "no")
381
382 AC_ARG_ENABLE(wispr, AC_HELP_STRING([--disable-wispr],
383                                 [disable WISPr support]),
384                                         [enable_wispr=${enableval}])
385 AM_CONDITIONAL(WISPR, test "${enable_wispr}" != "no")
386
387 AC_ARG_ENABLE(tools, AC_HELP_STRING([--disable-tools],
388                                 [disable testing tools]),
389                                         [enable_tools=${enableval}])
390 AM_CONDITIONAL(TOOLS, test "${enable_tools}" != "no")
391
392 if (test "${enable_tools}" != "no"); then
393         AC_PATH_PROGS(IPTABLES_SAVE, [iptables-save], [],
394                                                 $PATH:/bin:/usr/bin)
395         IPTABLES_SAVE=$ac_cv_path_IPTABLES_SAVE
396 else
397         IPTABLES_SAVE=""
398 fi
399 AC_SUBST(IPTABLES_SAVE)
400
401 AC_ARG_ENABLE(client, AC_HELP_STRING([--disable-client],
402                                 [disable command line client]),
403                                         [enable_client=${enableval}])
404 AM_CONDITIONAL(CLIENT, test "${enable_client}" != "no")
405
406 if (test "${enable_wispr}" != "no"); then
407         PKG_CHECK_MODULES(GNUTLS, gnutls, dummy=yes,
408                                 AC_MSG_ERROR(GnuTLS library is required))
409 else
410         GNUTLS_CFLAGS=""
411         GNUTLS_LIBS=""
412 fi
413 AC_SUBST(GNUTLS_CFLAGS)
414 AC_SUBST(GNUTLS_LIBS)
415
416 if (test "${enable_loopback}" != "no"); then
417         AC_CHECK_HEADERS(sys/inotify.h, dummy=yes,
418                         AC_MSG_ERROR(inotify header files are required))
419
420         AC_CHECK_LIB(c, inotify_init, dummy=yes,
421                         AC_MSG_ERROR(inotify library support is required))
422 fi
423
424 if (test "${enable_wifi}" != "no"); then
425         AC_PATH_PROG(WPASUPPLICANT, [wpa_supplicant], [],
426                                                 $PATH:/bin:/usr/bin)
427 fi
428
429 AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
430                         [don't install configuration and data files]),
431                                         [enable_datafiles=${enableval}])
432 AM_CONDITIONAL(DATAFILES, test "${enable_datafiles}" != "no")
433
434 if (test "${enable_client}" != "no"); then
435         AC_CHECK_HEADERS(readline/readline.h, dummy=yes,
436                 AC_MSG_ERROR(readline header files are required))
437 fi
438
439 AM_CONDITIONAL(VPN, test "${enable_openconnect}" != "no" -o \
440                         "${enable_openvpn}" != "no" -o \
441                         "${enable_ipsec}" != "no" -o \
442                         "${enable_vpnc}" != "no" -o \
443                         "${enable_l2tp}" != "no" -o \
444                         "${enable_pptp}" != "no")
445
446 AC_OUTPUT(Makefile include/version.h connman.pc src/connman.service src/connman_tv.service vpn/connman-vpn.service)