session_policy_local: Rename session_policy_ivi
[platform/upstream/connman.git] / configure.ac
1 AC_PREREQ(2.60)
2 AC_INIT(connman, 1.9)
3
4 AM_INIT_AUTOMAKE([foreign subdir-objects color-tests])
5 AM_CONFIG_HEADER(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 GTK_DOC_CHECK
42
43 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
44                         [enable compiling with debugging information]), [
45         if (test "${enableval}" = "yes" &&
46                                 test "${ac_cv_prog_cc_g}" = "yes"); then
47                 CFLAGS="$CFLAGS -g"
48         fi
49 ])
50
51 AC_ARG_ENABLE(pie, AC_HELP_STRING([--enable-pie],
52                         [enable position independent executables flag]), [
53         if (test "${enableval}" = "yes" &&
54                                 test "${ac_cv_prog_cc_pie}" = "yes"); then
55                 CFLAGS="$CFLAGS -fPIE"
56                 LDFLAGS="$LDFLAGS -pie"
57         fi
58 ])
59
60 AC_ARG_ENABLE(threads,
61         AC_HELP_STRING([--enable-threads], [enable threading support]),
62                         [enable_threads=${enableval}], [enable_threads="no"])
63
64 AC_ARG_ENABLE(hh2serial-gps,
65         AC_HELP_STRING([--enable-hh2serial-gps], [enable hh2serial GPS support]),
66                         [enable_hh2serial_gps=${enableval}], [enable_hh2serial_gps="no"])
67 AM_CONDITIONAL(HH2SERIAL_GPS, test "${enable_hh2serial_gps}" != "no")
68 AM_CONDITIONAL(HH2SERIAL_GPS_BUILTIN, test "${enable_hh2serial_gps}" = "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(vpnc, AC_HELP_STRING([--with-vpnc=PROGRAM],
111         [specify location of vpnc binary]), [path_vpnc=${withval}])
112
113 AC_ARG_ENABLE(vpnc,
114         AC_HELP_STRING([--enable-vpnc], [enable vpnc support]),
115                 [enable_vpnc=${enableval}], [enable_vpnc="no"])
116 if (test "${enable_vpnc}" != "no"); then
117         if (test -z "${path_vpnc}"); then
118                 AC_PATH_PROG(VPNC, [vpnc], [], $PATH:/sbin:/usr/sbin)
119                 if (test -z "${VPNC}"); then
120                         AC_MSG_ERROR(vpnc binary not found)
121                 fi
122         else
123                 VPNC="${path_vpnc}"
124                 AC_SUBST(VPNC)
125         fi
126 fi
127 AM_CONDITIONAL(VPNC, test "${enable_vpnc}" != "no")
128 AM_CONDITIONAL(VPNC_BUILTIN, test "${enable_vpnc}" = "builtin")
129
130 AC_ARG_ENABLE(l2tp,
131         AC_HELP_STRING([--enable-l2tp], [enable l2tp support]),
132                         [enable_l2tp=${enableval}], [enable_l2tp="no"])
133 if (test "${enable_l2tp}" != "no"); then
134         if (test -z "${path_pppd}"); then
135                 AC_PATH_PROG(PPPD, [pppd], [/usr/sbin/pppd], $PATH:/sbin:/usr/sbin)
136         else
137                 PPPD="${path_pppd}"
138                 AC_SUBST(PPPD)
139         fi
140         AC_CHECK_HEADERS(pppd/pppd.h, dummy=yes,
141                         AC_MSG_ERROR(ppp header files are required))
142         if (test -z "${path_l2tp}"); then
143                 AC_PATH_PROG(L2TP, [xl2tpd], [/usr/sbin/xl2tpd], $PATH:/sbin:/usr/sbin)
144         else
145                 L2TP="${path_l2tp}"
146                 AC_SUBST(L2TP)
147         fi
148 fi
149 AM_CONDITIONAL(L2TP, test "${enable_l2tp}" != "no")
150 AM_CONDITIONAL(L2TP_BUILTIN, test "${enable_l2tp}" = "builtin")
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_WITH(iwmxsdk, AC_HELP_STRING([--with-iwmxsdk=PATH],
188                                                 [path to Intel WiMAX SDK]),
189                                 [pkgconfig_iwmxsdk=${withval}/lib/pkgconfig])
190
191 AC_ARG_ENABLE(iwmx, AC_HELP_STRING([--enable-iwmx],
192                 [enable Intel WiMAX support]), [enable_iwmx=${enableval}])
193 if (test "${enable_iwmx}" = "yes"); then
194         enable_threads="yes"
195         export PKG_CONFIG_PATH="${pkgconfig_iwmxsdk}"
196         PKG_CHECK_MODULES(IWMXSDK, libiWmxSdk-0, dummy=yes,
197                                 AC_MSG_ERROR(Intel WiMAX SDK is required))
198         PKG_CONFIG_PATH=""
199         AC_SUBST(IWMXSDK_CFLAGS)
200         AC_SUBST(IWMXSDK_LIBS)
201
202         # Fix API compat breakage from 1.4 to 1.5...
203         CPPFLAGS_save=$CPPFLAGS
204         CPPFLAGS="$IWMXSDK_CFLAGS $CPPFLAGS"
205         AH_TEMPLATE([HAVE_IWMXSDK_STATUS_IDLE],
206                     [WIMAX_API_DEVICE_STATUS_Connection_Idle is present])
207         AC_CHECK_DECL(WIMAX_API_DEVICE_STATUS_Connection_Idle,
208                       [AC_DEFINE([HAVE_IWMXSDK_STATUS_IDLE], [1], [])],
209                       [],
210                       [[#include <WiMaxType.h>]])
211
212         AH_TEMPLATE([HAVE_WIMAX_API_DEVICE_ID],
213                     [WIMAX_API_DEVICE_ID is present])
214         AC_CHECK_TYPE(WIMAX_API_DEVICE_ID,
215                       [AC_DEFINE([HAVE_WIMAX_API_DEVICE_ID], [1], [])],
216                       [],
217                       [[#include <WiMaxType.h>]])
218
219         AH_TEMPLATE([HAVE_WIMAX_API_HW_DEVICE_ID],
220                     [WIMAX_API_HW_DEVICE_ID is present])
221         AC_CHECK_TYPE(WIMAX_API_HW_DEVICE_ID,
222                       [AC_DEFINE([HAVE_WIMAX_API_HW_DEVICE_ID], [1], [])],
223                       [],
224                       [[#include <WiMaxType.h>]])
225
226         AH_TEMPLATE([HAVE_WIMAX_API_NSP_INFO_EX],
227                     [WIMAX_API_NSP_INFO_EX is present])
228         AC_CHECK_TYPE(WIMAX_API_NSP_INFO_EX,
229                       [AC_DEFINE([HAVE_WIMAX_API_NSP_INFO_EX], [1], [])],
230                       [],
231                       [[#include <WiMaxType.h>] 
232                        [#include <WiMaxTypesEx.h>]])
233
234         AH_TEMPLATE([HAVE_WIMAX_API_CONNECTED_NSP_INFO],
235                     [WIMAX_API_CONNECTED_NSP_INFO is present])
236         AC_CHECK_TYPE(WIMAX_API_CONNECTED_NSP_INFO,
237                       [AC_DEFINE([HAVE_WIMAX_API_CONNECTED_NSP_INFO], [1], [])],
238                       [],
239                       [[#include <WiMaxType.h>]])
240
241         CPPFLAGS=$CPPFLAGS_save
242 fi
243 AM_CONDITIONAL(IWMX, test "${enable_iwmx}" = "yes")
244
245 AC_ARG_ENABLE(iospm, AC_HELP_STRING([--enable-iospm],
246                 [enable Intel OSPM support]), [enable_iospm=${enableval}])
247 AM_CONDITIONAL(IOSPM, test "${enable_iospm}" = "yes")
248
249 AC_ARG_ENABLE(tist,
250         AC_HELP_STRING([--enable-tist], [enable TI Shared Transport support]),
251                         [enable_tist=${enableval}], [enable_tist="no"])
252 AM_CONDITIONAL(TIST, test "${enable_tist}" != "no")
253 AM_CONDITIONAL(TIST_BUILTIN, test "${enable_tist}" = "builtin")
254
255 AC_ARG_ENABLE(session-policy,
256         AC_HELP_STRING([--enable-session-policy], [enable default Session policy configuration support]),
257                         [enable_session_policy=${enableval}], [enable_session_policy="no"])
258 AM_CONDITIONAL(SESSION_POLICY, test "${enable_session_policy}" != "no")
259 AM_CONDITIONAL(SESSION_POLICY_BUILTIN, test "${enable_session_policy}" = "builtin")
260
261 AC_ARG_ENABLE(session-policy-local,
262         AC_HELP_STRING([--enable-session-policy-local], [enable local file Session policy configuration support]),
263                         [enable_session_policy_local=${enableval}], [enable_session_policy_local="no"])
264 AM_CONDITIONAL(SESSION_POLICY_LOCAL, test "${enable_session_policy_local}" != "no")
265 AM_CONDITIONAL(SESSION_POLICY_LOCAL_BUILTIN, test "${enable_session_policy_local}" = "builtin")
266
267 AC_ARG_WITH(stats-max-file-size, AC_HELP_STRING([--with-stats-max-file-size=SIZE],
268                         [Maximal size of a statistics round robin file]),
269                         [stats_max_file_size=${withval}])
270
271 if (test -z "${stats_max_file_size}"); then
272    # default size is 16 kByte
273    stats_max_file_size="16 * 8 * 128"
274 fi
275
276 AC_DEFINE_UNQUOTED([STATS_MAX_FILE_SIZE], (${stats_max_file_size}), [Maximal size of a statistics round robin file])
277
278 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28, dummy=yes,
279                                 AC_MSG_ERROR(GLib >= 2.28 is required))
280 AC_SUBST(GLIB_CFLAGS)
281 AC_SUBST(GLIB_LIBS)
282
283 if (test "${enable_threads}" = "yes"); then
284         AC_DEFINE(NEED_THREADS, 1, [Define if threading support is required])
285         PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes,
286                                 AC_MSG_ERROR(GThread >= 2.16 is required))
287         GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS"
288         GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS"
289 fi
290
291 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.4, dummy=yes,
292                                 AC_MSG_ERROR(D-Bus >= 1.4 is required))
293 AC_SUBST(DBUS_CFLAGS)
294 AC_SUBST(DBUS_LIBS)
295
296 AC_ARG_WITH(dbusconfdir, AC_HELP_STRING([--with-dbusconfdir=PATH],
297         [path to D-Bus config directory]), [path_dbusconf=${withval}],
298                 [path_dbusconf="`$PKG_CONFIG --variable=sysconfdir dbus-1`"])
299 if (test -z "${path_dbusconf}"); then
300         DBUS_CONFDIR="${sysconfdir}/dbus-1/system.d"
301 else
302         DBUS_CONFDIR="${path_dbusconf}/dbus-1/system.d"
303 fi
304 AC_SUBST(DBUS_CONFDIR)
305
306 AC_ARG_WITH(dbusdatadir, AC_HELP_STRING([--with-dbusdatadir=PATH],
307         [path to D-Bus data directory]), [path_dbusdata=${withval}],
308                 [path_dbusdata="`$PKG_CONFIG --variable=datadir dbus-1`"])
309 if (test -z "${path_dbusdata}"); then
310         DBUS_DATADIR="${datadir}/dbus-1/system-services"
311 else
312         DBUS_DATADIR="${path_dbusdata}/dbus-1/system-services"
313 fi
314 AC_SUBST(DBUS_DATADIR)
315
316 AC_ARG_WITH([systemdunitdir], AC_HELP_STRING([--with-systemdunitdir=DIR],
317         [path to systemd service directory]), [path_systemdunit=${withval}],
318                 [path_systemdunit="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"])
319 if (test -n "${path_systemdunit}"); then
320         SYSTEMD_UNITDIR="${path_systemdunit}"
321         AC_SUBST(SYSTEMD_UNITDIR)
322 fi
323 AM_CONDITIONAL(SYSTEMD, test -n "${path_systemdunit}")
324
325 PKG_CHECK_MODULES(XTABLES, xtables, dummy=yes,
326                                 AC_MSG_ERROR(Xtables library is required))
327 AC_SUBST(XTABLES_CFLAGS)
328 AC_SUBST(XTABLES_LIBS)
329
330 AC_ARG_ENABLE(test, AC_HELP_STRING([--enable-test],
331                 [enable test/example scripts]), [enable_test=${enableval}])
332 AM_CONDITIONAL(TEST, test "${enable_test}" = "yes")
333
334 AC_ARG_ENABLE(nmcompat, AC_HELP_STRING([--enable-nmcompat],
335                                 [enable Network Manager support]),
336                         [enable_nmcompat=${enableval}], [enable_nmcompat="no"])
337 AM_CONDITIONAL(NMCOMPAT, test "${enable_nmcompat}" != "no")
338
339 AC_ARG_ENABLE(polkit, AC_HELP_STRING([--enable-polkit],
340                                 [enable PolicyKit support]),
341                         [enable_polkit=${enableval}], [enable_polkit="no"])
342 if (test "${enable_polkit}" != "no"); then
343         POLKIT_DATADIR="`$PKG_CONFIG --variable=actiondir polkit`"
344         POLKIT_DATADIR=""
345         if (test -z "${POLKIT_DATADIR}"); then
346                 POLKIT_DATADIR="${datadir}/polkit-1/actions"
347         fi
348         AC_SUBST(POLKIT_DATADIR)
349 fi
350 AM_CONDITIONAL(POLKIT, test "${enable_polkit}" != "no")
351
352 AC_ARG_ENABLE(selinux, AC_HELP_STRING([--enable-selinux],
353                                 [enable selinux support]),
354                         [enable_selinux=${enableval}], [enable_selinux="no"])
355 AM_CONDITIONAL(SELINUX, test "${enable_selinux}" != "no")
356
357 AC_ARG_ENABLE(loopback, AC_HELP_STRING([--disable-loopback],
358                                 [disable loopback support]),
359                                         [enable_loopback=${enableval}])
360 AM_CONDITIONAL(LOOPBACK, test "${enable_loopback}" != "no")
361
362 AC_ARG_ENABLE(ethernet, AC_HELP_STRING([--disable-ethernet],
363                                 [disable Ethernet support]),
364                                         [enable_ethernet=${enableval}])
365 AM_CONDITIONAL(ETHERNET, test "${enable_ethernet}" != "no")
366
367 AC_ARG_ENABLE(wifi, AC_HELP_STRING([--disable-wifi],
368                                 [disable WiFi support]),
369                                         [enable_wifi=${enableval}])
370 AM_CONDITIONAL(WIFI, test "${enable_wifi}" != "no")
371
372 AC_ARG_ENABLE(bluetooth, AC_HELP_STRING([--disable-bluetooth],
373                                 [disable Bluetooth support]),
374                                         [enable_bluetooth=${enableval}])
375 AM_CONDITIONAL(BLUETOOTH, test "${enable_bluetooth}" != "no")
376
377 AC_ARG_ENABLE(ofono, AC_HELP_STRING([--disable-ofono],
378                                 [disable oFono support]),
379                                         [enable_ofono=${enableval}])
380 AM_CONDITIONAL(OFONO, test "${enable_ofono}" != "no")
381
382 AC_ARG_ENABLE(dundee, AC_HELP_STRING([--disable-dundee],
383                                 [disable dundee support (Bluetooth DUN)]),
384                                         [enable_dundee=${enableval}])
385 AM_CONDITIONAL(DUNDEE, test "${enable_dundee}" != "no")
386
387 AC_ARG_ENABLE(pacrunner, AC_HELP_STRING([--disable-pacrunner],
388                                 [disable PACrunner support]),
389                                         [enable_pacrunner=${enableval}])
390 AM_CONDITIONAL(PACRUNNER, test "${enable_pacrunner}" != "no")
391
392 AC_ARG_ENABLE(wispr, AC_HELP_STRING([--disable-wispr],
393                                 [disable WISPr support]),
394                                         [enable_wispr=${enableval}])
395 AM_CONDITIONAL(WISPR, test "${enable_wispr}" != "no")
396
397 AC_ARG_ENABLE(tools, AC_HELP_STRING([--disable-tools],
398                                 [disable testing tools]),
399                                         [enable_tools=${enableval}])
400 AM_CONDITIONAL(TOOLS, test "${enable_tools}" != "no")
401
402 AC_ARG_ENABLE(client, AC_HELP_STRING([--disable-client],
403                                 [disable command line client]),
404                                         [disable_client=${enableval}])
405 AM_CONDITIONAL(CLIENT, test "${enable_client}" != "no")
406
407 if (test "${enable_wispr}" != "no"); then
408         PKG_CHECK_MODULES(GNUTLS, gnutls, dummy=yes,
409                                 AC_MSG_ERROR(GnuTLS library is required))
410 else
411         GNUTLS_CFLAGS=""
412         GNUTLS_LIBS=""
413 fi
414 AC_SUBST(GNUTLS_CFLAGS)
415 AC_SUBST(GNUTLS_LIBS)
416
417 if (test "${enable_loopback}" != "no"); then
418         AC_CHECK_HEADERS(sys/inotify.h, dummy=yes,
419                         AC_MSG_ERROR(inotify header files are required))
420
421         AC_CHECK_LIB(c, inotify_init, dummy=yes,
422                         AC_MSG_ERROR(inotify library support is required))
423 fi
424
425 if (test "${enable_wifi}" != "no"); then
426         AC_PATH_PROG(WPASUPPLICANT, [wpa_supplicant], [],
427                                                 $PATH:/sbin:/usr/sbin)
428 fi
429
430 AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
431                         [don't install configuration and data files]),
432                                         [enable_datafiles=${enableval}])
433 AM_CONDITIONAL(DATAFILES, test "${enable_datafiles}" != "no")
434
435 if (test "${enable_client}" != "no"); then
436         AC_CHECK_HEADERS(readline/readline.h, dummy=yes,
437                 AC_MSG_ERROR(readline header files are required))
438 fi
439
440 AM_CONDITIONAL(VPN, test "${enable_openconnect}" != "no" -o \
441                         "${enable_openvpn}" != "no" -o \
442                         "${enable_vpnc}" != "no" -o \
443                         "${enable_l2tp}" != "no" -o \
444                         "${enable_pptp}" != "no")
445
446 AC_OUTPUT(Makefile include/version.h src/connman.service
447                 vpn/connman-vpn.service vpn/net.connman.vpn.service
448                 scripts/connman doc/version.xml connman.pc)