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