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