4 AC_CONFIG_MACRO_DIR([m4])
6 AM_INIT_AUTOMAKE([foreign subdir-objects color-tests])
7 AC_CONFIG_HEADERS([config.h])
9 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
13 AC_PREFIX_DEFAULT(/usr/local)
19 AC_SUBST(abs_top_srcdir)
20 AC_SUBST(abs_top_builddir)
23 AC_USE_SYSTEM_EXTENSIONS
31 m4_define([_LT_AC_TAGCONFIG], [])
32 m4_ifdef([AC_LIBTOOL_TAGS], [AC_LIBTOOL_TAGS([])])
39 AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization],
40 [disable code optimization through compiler]), [
41 if (test "${enableval}" = "no"); then
42 CFLAGS="$CFLAGS -O0 -U_FORTIFY_SOURCE"
46 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
47 [enable compiling with debugging information]), [
48 if (test "${enableval}" = "yes" &&
49 test "${ac_cv_prog_cc_g}" = "yes"); then
54 AC_ARG_ENABLE(pie, AC_HELP_STRING([--enable-pie],
55 [enable position independent executables flag]), [
56 if (test "${enableval}" = "yes" &&
57 test "${ac_cv_prog_cc_pie}" = "yes"); then
58 CFLAGS="$CFLAGS -fPIE"
59 LDFLAGS="$LDFLAGS -pie"
63 AC_ARG_ENABLE(hh2serial-gps,
64 AC_HELP_STRING([--enable-hh2serial-gps], [enable hh2serial GPS support]),
65 [enable_hh2serial_gps=${enableval}], [enable_hh2serial_gps="no"])
66 AM_CONDITIONAL(HH2SERIAL_GPS, test "${enable_hh2serial_gps}" != "no")
67 AM_CONDITIONAL(HH2SERIAL_GPS_BUILTIN, test "${enable_hh2serial_gps}" = "builtin")
69 AC_ARG_WITH(openconnect, AC_HELP_STRING([--with-openconnect=PROGRAM],
70 [specify location of openconnect binary]), [path_openconnect=${withval}])
72 AC_ARG_ENABLE(openconnect,
73 AC_HELP_STRING([--enable-openconnect], [enable openconnect support]),
74 [enable_openconnect=${enableval}], [enable_openconnect="no"])
75 if (test "${enable_openconnect}" != "no"); then
76 if (test -z "${path_openconnect}"); then
77 AC_PATH_PROG(OPENCONNECT, [openconnect], [], $PATH:/sbin:/usr/sbin)
78 if (test -z "${OPENCONNECT}"); then
79 AC_MSG_ERROR(openconnect binary not found)
82 OPENCONNECT="${path_openconnect}"
86 AM_CONDITIONAL(OPENCONNECT, test "${enable_openconnect}" != "no")
87 AM_CONDITIONAL(OPENCONNECT_BUILTIN, test "${enable_openconnect}" = "builtin")
89 AC_ARG_WITH(openvpn, AC_HELP_STRING([--with-openvpn=PROGRAM],
90 [specify location of openvpn binary]), [path_openvpn=${withval}])
92 AC_ARG_ENABLE(openvpn,
93 AC_HELP_STRING([--enable-openvpn], [enable openvpn support]),
94 [enable_openvpn=${enableval}], [enable_openvpn="no"])
95 if (test "${enable_openvpn}" != "no"); then
96 if (test -z "${path_openvpn}"); then
97 AC_PATH_PROG(OPENVPN, [openvpn], [], $PATH:/sbin:/usr/sbin)
98 if (test -z "${OPENVPN}"); then
99 AC_MSG_ERROR(openvpn binary not found)
102 OPENVPN="${path_openvpn}"
106 AM_CONDITIONAL(OPENVPN, test "${enable_openvpn}" != "no")
107 AM_CONDITIONAL(OPENVPN_BUILTIN, test "${enable_openvpn}" = "builtin")
109 AC_ARG_WITH(vpnc, AC_HELP_STRING([--with-vpnc=PROGRAM],
110 [specify location of vpnc binary]), [path_vpnc=${withval}])
113 AC_HELP_STRING([--enable-vpnc], [enable vpnc support]),
114 [enable_vpnc=${enableval}], [enable_vpnc="no"])
115 if (test "${enable_vpnc}" != "no"); then
116 if (test -z "${path_vpnc}"); then
117 AC_PATH_PROG(VPNC, [vpnc], [], $PATH:/sbin:/usr/sbin)
118 if (test -z "${VPNC}"); then
119 AC_MSG_ERROR(vpnc binary not found)
126 AM_CONDITIONAL(VPNC, test "${enable_vpnc}" != "no")
127 AM_CONDITIONAL(VPNC_BUILTIN, test "${enable_vpnc}" = "builtin")
129 AC_ARG_WITH(l2tp, AC_HELP_STRING([--with-l2tp=PROGRAM],
130 [specify location of l2tp binary]), [path_l2tp=${withval}])
133 AC_HELP_STRING([--enable-l2tp], [enable l2tp support]),
134 [enable_l2tp=${enableval}], [enable_l2tp="no"])
135 if (test "${enable_l2tp}" != "no"); then
136 if (test -z "${path_pppd}"); then
137 AC_PATH_PROG(PPPD, [pppd], [/usr/sbin/pppd], $PATH:/sbin:/usr/sbin)
142 AC_CHECK_HEADERS(pppd/pppd.h, dummy=yes,
143 AC_MSG_ERROR(ppp header files are required))
144 if (test -z "${path_l2tp}"); then
145 AC_PATH_PROG(L2TP, [xl2tpd], [/usr/sbin/xl2tpd], $PATH:/sbin:/usr/sbin)
151 AM_CONDITIONAL(L2TP, test "${enable_l2tp}" != "no")
152 AM_CONDITIONAL(L2TP_BUILTIN, test "${enable_l2tp}" = "builtin")
154 AC_ARG_WITH(pptp, AC_HELP_STRING([--with-pptp=PROGRAM],
155 [specify location of pptp binary]), [path_pptp=${withval}])
158 AC_HELP_STRING([--enable-pptp], [enable pptp support]),
159 [enable_pptp=${enableval}], [enable_pptp="no"])
160 if (test "${enable_pptp}" != "no"); then
161 if (test -z "${path_pppd}"); then
162 AC_PATH_PROG(PPPD, [pppd], [/usr/sbin/pppd], $PATH:/sbin:/usr/sbin)
167 AC_CHECK_HEADERS(pppd/pppd.h, dummy=yes,
168 AC_MSG_ERROR(ppp header files are required))
169 if (test -z "${path_pptp}"); then
170 AC_PATH_PROG(PPTP, [pptp], [/usr/sbin/pptp], $PATH:/sbin:/usr/sbin)
176 AM_CONDITIONAL(PPTP, test "${enable_pptp}" != "no")
177 AM_CONDITIONAL(PPTP_BUILTIN, test "${enable_pptp}" = "builtin")
179 AC_CHECK_HEADERS(resolv.h, dummy=yes,
180 AC_MSG_ERROR(resolver header files are required))
181 AC_CHECK_LIB(resolv, ns_initparse, dummy=yes, [
182 AC_CHECK_LIB(resolv, __ns_initparse, dummy=yes,
183 AC_MSG_ERROR(resolver library support is required))
186 AC_CHECK_HEADERS([execinfo.h])
187 AM_CONDITIONAL([BACKTRACE], [test "${ac_cv_header_execinfo_h}" = "yes"])
189 AC_CHECK_MEMBERS([struct in6_pktinfo.ipi6_addr], [], [], [[#include <netinet/in.h>]])
191 AC_CHECK_FUNC(signalfd, dummy=yes,
192 AC_MSG_ERROR(signalfd support is required))
194 AC_CHECK_LIB(dl, dlopen, dummy=yes,
195 AC_MSG_ERROR(dynamic linking loader is required))
197 AC_ARG_ENABLE(iospm, AC_HELP_STRING([--enable-iospm],
198 [enable Intel OSPM support]), [enable_iospm=${enableval}])
199 AM_CONDITIONAL(IOSPM, test "${enable_iospm}" = "yes")
202 AC_HELP_STRING([--enable-tist], [enable TI Shared Transport support]),
203 [enable_tist=${enableval}], [enable_tist="no"])
204 AM_CONDITIONAL(TIST, test "${enable_tist}" != "no")
205 AM_CONDITIONAL(TIST_BUILTIN, test "${enable_tist}" = "builtin")
207 AC_ARG_ENABLE(session-policy-local,
208 AC_HELP_STRING([--enable-session-policy-local], [enable local file Session policy configuration support]),
209 [enable_session_policy_local=${enableval}], [enable_session_policy_local="no"])
210 AM_CONDITIONAL(SESSION_POLICY_LOCAL, test "${enable_session_policy_local}" != "no")
211 AM_CONDITIONAL(SESSION_POLICY_LOCAL_BUILTIN, test "${enable_session_policy_local}" = "builtin")
213 AC_ARG_WITH(stats-max-file-size, AC_HELP_STRING([--with-stats-max-file-size=SIZE],
214 [Maximal size of a statistics round robin file]),
215 [stats_max_file_size=${withval}])
217 if (test -z "${stats_max_file_size}"); then
218 # default size is 16 kByte
219 stats_max_file_size="16 * 8 * 128"
222 AC_DEFINE_UNQUOTED([STATS_MAX_FILE_SIZE], (${stats_max_file_size}), [Maximal size of a statistics round robin file])
224 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.40, dummy=yes,
225 AC_MSG_ERROR(GLib >= 2.40 is required))
226 AC_SUBST(GLIB_CFLAGS)
229 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.4, dummy=yes,
230 AC_MSG_ERROR(D-Bus >= 1.4 is required))
231 AC_SUBST(DBUS_CFLAGS)
234 AC_ARG_WITH(dbusconfdir, AC_HELP_STRING([--with-dbusconfdir=PATH],
235 [path to D-Bus config directory]), [path_dbusconf=${withval}],
236 [path_dbusconf="`$PKG_CONFIG --variable=datadir dbus-1`"])
237 if (test -z "${path_dbusconf}"); then
238 DBUS_CONFDIR="${datadir}/dbus-1/system.d"
240 DBUS_CONFDIR="${path_dbusconf}/dbus-1/system.d"
242 AC_SUBST(DBUS_CONFDIR)
244 AC_ARG_WITH(dbusdatadir, AC_HELP_STRING([--with-dbusdatadir=PATH],
245 [path to D-Bus data directory]), [path_dbusdata=${withval}],
246 [path_dbusdata="`$PKG_CONFIG --variable=datadir dbus-1`"])
247 if (test -z "${path_dbusdata}"); then
248 DBUS_DATADIR="${datadir}/dbus-1/system-services"
250 DBUS_DATADIR="${path_dbusdata}/dbus-1/system-services"
252 AC_SUBST(DBUS_DATADIR)
254 AC_ARG_WITH([systemdunitdir], AC_HELP_STRING([--with-systemdunitdir=DIR],
255 [path to systemd service directory]), [path_systemdunit=${withval}],
256 [path_systemdunit="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"])
257 if (test -n "${path_systemdunit}"); then
258 SYSTEMD_UNITDIR="${path_systemdunit}"
259 AC_SUBST(SYSTEMD_UNITDIR)
261 AM_CONDITIONAL(SYSTEMD, test -n "${path_systemdunit}")
263 AC_ARG_WITH([tmpfilesdir], AC_HELP_STRING([--with-tmpfilesdir=DIR],
264 [path to systemd tmpfiles.d directory]), [path_tmpfiles=${withval}],
265 [path_tmpfiles="`$PKG_CONFIG --variable=tmpfilesdir systemd`"])
266 if (test -n "${path_tmpfiles}"); then
267 SYSTEMD_TMPFILESDIR="${path_tmpfiles}"
268 AC_SUBST(SYSTEMD_TMPFILESDIR)
271 AC_ARG_WITH(firewall, AC_HELP_STRING([--with-firewall=TYPE],
272 [specify which firewall type is used iptables or nftables [default=iptables]]),
273 [firewall_type=${withval}],
274 [firewall_type="iptables"])
276 if (test "${firewall_type}" != "iptables" -a \
277 "${firewall_type}" != "nftables"); then
278 AC_MSG_ERROR(neither nftables nor iptables support enabled)
282 if (test "${firewall_type}" = "iptables"); then
283 PKG_CHECK_MODULES(XTABLES, xtables >= 1.4.11, [found_iptables="yes"],
284 AC_MSG_ERROR(Xtables library is required))
285 AC_SUBST(XTABLES_CFLAGS)
286 AC_SUBST(XTABLES_LIBS)
288 AM_CONDITIONAL(XTABLES, test "${found_iptables}" != "no")
291 if (test "${firewall_type}" = "nftables"); then
292 PKG_CHECK_MODULES(NFTABLES, [libnftnl >= 1.0.4 libmnl >= 1.0.0], [found_nftables="yes"],
293 AC_MSG_ERROR([libnftnl >= 1.0.4 or libmnl >= 1.0.0 not found]))
294 AC_SUBST(NFTABLES_CFLAGS)
295 AC_SUBST(NFTABLES_LIBS)
297 AM_CONDITIONAL(NFTABLES, test "${found_nftables}" != "no")
299 AC_ARG_ENABLE(test, AC_HELP_STRING([--enable-test],
300 [enable test/example scripts]), [enable_test=${enableval}])
301 AM_CONDITIONAL(TEST, test "${enable_test}" = "yes")
303 AC_ARG_ENABLE(nmcompat, AC_HELP_STRING([--enable-nmcompat],
304 [enable Network Manager support]),
305 [enable_nmcompat=${enableval}], [enable_nmcompat="no"])
306 AM_CONDITIONAL(NMCOMPAT, test "${enable_nmcompat}" != "no")
308 AC_ARG_ENABLE(polkit, AC_HELP_STRING([--enable-polkit],
309 [enable PolicyKit support]),
310 [enable_polkit=${enableval}], [enable_polkit="no"])
311 if (test "${enable_polkit}" != "no"); then
312 POLKIT_DATADIR="`$PKG_CONFIG --variable=actiondir polkit`"
314 if (test -z "${POLKIT_DATADIR}"); then
315 POLKIT_DATADIR="${datadir}/polkit-1/actions"
317 AC_SUBST(POLKIT_DATADIR)
319 AM_CONDITIONAL(POLKIT, test "${enable_polkit}" != "no")
321 AC_ARG_ENABLE(selinux, AC_HELP_STRING([--enable-selinux],
322 [enable selinux support]),
323 [enable_selinux=${enableval}], [enable_selinux="no"])
324 AM_CONDITIONAL(SELINUX, test "${enable_selinux}" != "no")
326 AC_ARG_ENABLE(loopback, AC_HELP_STRING([--disable-loopback],
327 [disable loopback support]),
328 [enable_loopback=${enableval}])
329 AM_CONDITIONAL(LOOPBACK, test "${enable_loopback}" != "no")
331 AC_ARG_ENABLE(ethernet, AC_HELP_STRING([--disable-ethernet],
332 [disable Ethernet support]),
333 [enable_ethernet=${enableval}])
334 AM_CONDITIONAL(ETHERNET, test "${enable_ethernet}" != "no")
336 AC_ARG_ENABLE(gadget, AC_HELP_STRING([--disable-gadget],
337 [disable USB Gadget support]),
338 [enable_gadget=${enableval}])
339 AM_CONDITIONAL(GADGET, test "${enable_gadget}" != "no")
341 AC_ARG_ENABLE(wifi, AC_HELP_STRING([--disable-wifi],
342 [disable WiFi support]),
343 [enable_wifi=${enableval}])
344 AM_CONDITIONAL(WIFI, test "${enable_wifi}" != "no")
346 AC_ARG_ENABLE(iwd, AC_HELP_STRING([--enable-iwd],
347 [enable iwd support]),
348 [enable_iwd=${enableval}])
349 AM_CONDITIONAL(IWD, test "${enable_iwd}" = "yes")
351 AC_ARG_ENABLE(bluetooth, AC_HELP_STRING([--disable-bluetooth],
352 [disable Bluetooth support]),
353 [enable_bluetooth=${enableval}])
354 AM_CONDITIONAL(BLUETOOTH, test "${enable_bluetooth}" != "no")
356 AC_ARG_ENABLE(ofono, AC_HELP_STRING([--disable-ofono],
357 [disable oFono support]),
358 [enable_ofono=${enableval}])
359 AM_CONDITIONAL(OFONO, test "${enable_ofono}" != "no")
361 AC_ARG_ENABLE(dundee, AC_HELP_STRING([--disable-dundee],
362 [disable dundee support (Bluetooth DUN)]),
363 [enable_dundee=${enableval}])
364 AM_CONDITIONAL(DUNDEE, test "${enable_dundee}" != "no")
366 AC_ARG_ENABLE(pacrunner, AC_HELP_STRING([--disable-pacrunner],
367 [disable PACrunner support]),
368 [enable_pacrunner=${enableval}])
369 AM_CONDITIONAL(PACRUNNER, test "${enable_pacrunner}" != "no")
371 AC_ARG_ENABLE(neard, AC_HELP_STRING([--disable-neard],
372 [disable Neard support]),
373 [enable_neard=${enableval}])
374 AM_CONDITIONAL(NEARD, test "${enable_neard}" != "no")
376 AC_ARG_ENABLE(wispr, AC_HELP_STRING([--disable-wispr],
377 [disable WISPr support]),
378 [enable_wispr=${enableval}])
379 AM_CONDITIONAL(WISPR, test "${enable_wispr}" != "no")
381 AC_ARG_ENABLE(tools, AC_HELP_STRING([--disable-tools],
382 [disable testing tools]),
383 [enable_tools=${enableval}])
384 AM_CONDITIONAL(TOOLS, test "${enable_tools}" != "no")
386 AC_ARG_ENABLE(stats, AC_HELP_STRING([--disable-stats],
387 [disable statistics round robin file generation]),
388 [enable_stats=${enableval}])
389 AM_CONDITIONAL(STATS, test "${enable_stats}" != "no")
391 if (test "${enable_tools}" != "no"); then
392 AC_PATH_PROGS(IPTABLES_SAVE, [iptables-save], [],
393 $PATH:/sbin:/usr/sbin)
394 AC_PATH_PROGS(IP6TABLES_SAVE, [ip6tables-save], [],
395 $PATH:/sbin:/usr/sbin)
396 IPTABLES_SAVE=$ac_cv_path_IPTABLES_SAVE
397 IP6TABLES_SAVE=$ac_cv_path_IP6TABLES_SAVE
402 AC_SUBST(IPTABLES_SAVE)
403 AC_SUBST(IP6TABLES_SAVE)
405 AC_ARG_ENABLE(client, AC_HELP_STRING([--disable-client],
406 [disable command line client]),
407 [enable_client=${enableval}])
408 AM_CONDITIONAL(CLIENT, test "${enable_client}" != "no")
410 if (test "${enable_wispr}" != "no"); then
411 PKG_CHECK_MODULES(GNUTLS, gnutls, dummy=yes,
412 AC_MSG_ERROR(GnuTLS library is required))
417 AC_SUBST(GNUTLS_CFLAGS)
418 AC_SUBST(GNUTLS_LIBS)
420 if (test "${enable_loopback}" != "no"); then
421 AC_CHECK_HEADERS(sys/inotify.h, dummy=yes,
422 AC_MSG_ERROR(inotify header files are required))
424 AC_CHECK_LIB(c, inotify_init, dummy=yes,
425 AC_MSG_ERROR(inotify library support is required))
428 if (test "${enable_wifi}" != "no"); then
429 AC_PATH_PROG(WPASUPPLICANT, [wpa_supplicant], [],
430 $PATH:/sbin:/usr/sbin)
433 AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
434 [don't install configuration and data files]),
435 [enable_datafiles=${enableval}])
436 AM_CONDITIONAL(DATAFILES, test "${enable_datafiles}" != "no")
438 if (test "${enable_client}" != "no"); then
439 AC_CHECK_HEADERS(readline/readline.h, dummy=yes,
440 AC_MSG_ERROR(readline header files are required))
443 AM_CONDITIONAL(VPN, test "${enable_openconnect}" != "no" -o \
444 "${enable_openvpn}" != "no" -o \
445 "${enable_vpnc}" != "no" -o \
446 "${enable_l2tp}" != "no" -o \
447 "${enable_pptp}" != "no")
449 AC_MSG_CHECKING(which DNS backend to use)
450 AC_ARG_WITH(dns-backend, AC_HELP_STRING([--with-dns-backend=TYPE],
451 [specify which DNS backend to use: internal or systemd-resolved [default=internal]]),
452 [dns_backend=${withval}],
453 [dns_backend="internal"])
455 if (test "${dns_backend}" != "internal" -a \
456 "${dns_backend}" != "systemd-resolved"); then
457 AC_MSG_ERROR(no suitable DNS backend defined)
459 AM_CONDITIONAL(INTERNAL_DNS_BACKEND, test "${dns_backend}" = "internal")
460 AM_CONDITIONAL(SYSTEMD_RESOLVED_DNS_BACKEND, test "${dns_backend}" = "systemd-resolved")
461 AC_MSG_RESULT(${dns_backend})
463 AC_OUTPUT(Makefile include/version.h connman.pc)