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" -o \
292 "${enable_wireguard}" != "no"); then
293 PKG_CHECK_MODULES(LIBMNL, [libmnl >= 1.0.0], [found_libmnl="yes"],
294 AC_MSG_ERROR([libmnl >= 1.0.0 not found]))
295 AC_SUBST(LIBMNL_CFLAGS)
296 AC_SUBST(LIBMNL_LIBS)
298 AM_CONDITIONAL(LIBMNL, test "${found_libmnl}" != "no")
301 if (test "${firewall_type}" = "nftables"); then
302 PKG_CHECK_MODULES(NFTABLES, [libnftnl >= 1.0.4], [found_nftables="yes"],
303 AC_MSG_ERROR([libnftnl >= 1.0.4]))
304 AC_SUBST(NFTABLES_CFLAGS)
305 AC_SUBST(NFTABLES_LIBS)
307 AM_CONDITIONAL(NFTABLES, test "${found_nftables}" != "no")
309 AC_ARG_ENABLE(test, AC_HELP_STRING([--enable-test],
310 [enable test/example scripts]), [enable_test=${enableval}])
311 AM_CONDITIONAL(TEST, test "${enable_test}" = "yes")
313 AC_ARG_ENABLE(nmcompat, AC_HELP_STRING([--enable-nmcompat],
314 [enable Network Manager support]),
315 [enable_nmcompat=${enableval}], [enable_nmcompat="no"])
316 AM_CONDITIONAL(NMCOMPAT, test "${enable_nmcompat}" != "no")
318 AC_ARG_ENABLE(polkit, AC_HELP_STRING([--enable-polkit],
319 [enable PolicyKit support]),
320 [enable_polkit=${enableval}], [enable_polkit="no"])
321 if (test "${enable_polkit}" != "no"); then
322 POLKIT_DATADIR="`$PKG_CONFIG --variable=actiondir polkit`"
324 if (test -z "${POLKIT_DATADIR}"); then
325 POLKIT_DATADIR="${datadir}/polkit-1/actions"
327 AC_SUBST(POLKIT_DATADIR)
329 AM_CONDITIONAL(POLKIT, test "${enable_polkit}" != "no")
331 AC_ARG_ENABLE(selinux, AC_HELP_STRING([--enable-selinux],
332 [enable selinux support]),
333 [enable_selinux=${enableval}], [enable_selinux="no"])
334 AM_CONDITIONAL(SELINUX, test "${enable_selinux}" != "no")
336 AC_ARG_ENABLE(loopback, AC_HELP_STRING([--disable-loopback],
337 [disable loopback support]),
338 [enable_loopback=${enableval}])
339 AM_CONDITIONAL(LOOPBACK, test "${enable_loopback}" != "no")
341 AC_ARG_ENABLE(ethernet, AC_HELP_STRING([--disable-ethernet],
342 [disable Ethernet support]),
343 [enable_ethernet=${enableval}])
344 AM_CONDITIONAL(ETHERNET, test "${enable_ethernet}" != "no")
346 AC_ARG_ENABLE(wireguard, AC_HELP_STRING([--disable-wireguard],
347 [disable Wireguard support]),
348 [enable_wireguard=${enableval}])
349 AM_CONDITIONAL(WIREGUARD, test "${enable_wireguard}" != "no")
350 AM_CONDITIONAL(WIREGUARD_BUILTIN, test "${enable_wireguard}" = "builtin")
352 AC_ARG_ENABLE(gadget, AC_HELP_STRING([--disable-gadget],
353 [disable USB Gadget support]),
354 [enable_gadget=${enableval}])
355 AM_CONDITIONAL(GADGET, test "${enable_gadget}" != "no")
357 AC_ARG_ENABLE(wifi, AC_HELP_STRING([--disable-wifi],
358 [disable WiFi support]),
359 [enable_wifi=${enableval}])
360 AM_CONDITIONAL(WIFI, test "${enable_wifi}" != "no")
362 AC_ARG_ENABLE(iwd, AC_HELP_STRING([--enable-iwd],
363 [enable iwd support]),
364 [enable_iwd=${enableval}])
365 AM_CONDITIONAL(IWD, test "${enable_iwd}" = "yes")
367 AC_ARG_ENABLE(bluetooth, AC_HELP_STRING([--disable-bluetooth],
368 [disable Bluetooth support]),
369 [enable_bluetooth=${enableval}])
370 AM_CONDITIONAL(BLUETOOTH, test "${enable_bluetooth}" != "no")
372 AC_ARG_ENABLE(ofono, AC_HELP_STRING([--disable-ofono],
373 [disable oFono support]),
374 [enable_ofono=${enableval}])
375 AM_CONDITIONAL(OFONO, test "${enable_ofono}" != "no")
377 AC_ARG_ENABLE(dundee, AC_HELP_STRING([--disable-dundee],
378 [disable dundee support (Bluetooth DUN)]),
379 [enable_dundee=${enableval}])
380 AM_CONDITIONAL(DUNDEE, test "${enable_dundee}" != "no")
382 AC_ARG_ENABLE(pacrunner, AC_HELP_STRING([--disable-pacrunner],
383 [disable PACrunner support]),
384 [enable_pacrunner=${enableval}])
385 AM_CONDITIONAL(PACRUNNER, test "${enable_pacrunner}" != "no")
387 AC_ARG_ENABLE(neard, AC_HELP_STRING([--disable-neard],
388 [disable Neard support]),
389 [enable_neard=${enableval}])
390 AM_CONDITIONAL(NEARD, test "${enable_neard}" != "no")
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")
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")
402 AC_ARG_ENABLE(stats, AC_HELP_STRING([--disable-stats],
403 [disable statistics round robin file generation]),
404 [enable_stats=${enableval}])
405 AM_CONDITIONAL(STATS, test "${enable_stats}" != "no")
407 if (test "${enable_tools}" != "no"); then
408 AC_PATH_PROGS(IPTABLES_SAVE, [iptables-save], [],
409 $PATH:/sbin:/usr/sbin)
410 AC_PATH_PROGS(IP6TABLES_SAVE, [ip6tables-save], [],
411 $PATH:/sbin:/usr/sbin)
412 IPTABLES_SAVE=$ac_cv_path_IPTABLES_SAVE
413 IP6TABLES_SAVE=$ac_cv_path_IP6TABLES_SAVE
418 AC_SUBST(IPTABLES_SAVE)
419 AC_SUBST(IP6TABLES_SAVE)
421 AC_ARG_ENABLE(client, AC_HELP_STRING([--disable-client],
422 [disable command line client]),
423 [enable_client=${enableval}])
424 AM_CONDITIONAL(CLIENT, test "${enable_client}" != "no")
426 if (test "${enable_wispr}" != "no"); then
427 PKG_CHECK_MODULES(GNUTLS, gnutls, dummy=yes,
428 AC_MSG_ERROR(GnuTLS library is required))
433 AC_SUBST(GNUTLS_CFLAGS)
434 AC_SUBST(GNUTLS_LIBS)
436 if (test "${enable_loopback}" != "no"); then
437 AC_CHECK_HEADERS(sys/inotify.h, dummy=yes,
438 AC_MSG_ERROR(inotify header files are required))
440 AC_CHECK_LIB(c, inotify_init, dummy=yes,
441 AC_MSG_ERROR(inotify library support is required))
444 if (test "${enable_wifi}" != "no"); then
445 AC_PATH_PROG(WPASUPPLICANT, [wpa_supplicant], [],
446 $PATH:/sbin:/usr/sbin)
449 AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
450 [don't install configuration and data files]),
451 [enable_datafiles=${enableval}])
452 AM_CONDITIONAL(DATAFILES, test "${enable_datafiles}" != "no")
454 if (test "${enable_client}" != "no"); then
455 AC_CHECK_HEADERS(readline/readline.h, dummy=yes,
456 AC_MSG_ERROR(readline header files are required))
459 AM_CONDITIONAL(VPN, test "${enable_openconnect}" != "no" -o \
460 "${enable_openvpn}" != "no" -o \
461 "${enable_vpnc}" != "no" -o \
462 "${enable_l2tp}" != "no" -o \
463 "${enable_pptp}" != "no" -o \
464 "${enable_wireguard}" != "no")
466 AC_MSG_CHECKING(which DNS backend to use)
467 AC_ARG_WITH(dns-backend, AC_HELP_STRING([--with-dns-backend=TYPE],
468 [specify which DNS backend to use: internal or systemd-resolved [default=internal]]),
469 [dns_backend=${withval}],
470 [dns_backend="internal"])
472 if (test "${dns_backend}" != "internal" -a \
473 "${dns_backend}" != "systemd-resolved"); then
474 AC_MSG_ERROR(no suitable DNS backend defined)
476 AM_CONDITIONAL(INTERNAL_DNS_BACKEND, test "${dns_backend}" = "internal")
477 AM_CONDITIONAL(SYSTEMD_RESOLVED_DNS_BACKEND, test "${dns_backend}" = "systemd-resolved")
478 AC_MSG_RESULT(${dns_backend})
480 AC_OUTPUT(Makefile include/version.h connman.pc)