Remove WPA2 and WPA3 service together
[platform/upstream/connman.git] / configure.ac
index 2be097d..9a2f65d 100644 (file)
@@ -1,5 +1,7 @@
 AC_PREREQ(2.60)
-AC_INIT(connman, 1.12)
+AC_INIT(connman, 1.41)
+
+AC_CONFIG_MACRO_DIR([m4])
 
 AM_INIT_AUTOMAKE([foreign subdir-objects color-tests])
 AC_CONFIG_HEADERS([config.h])
@@ -18,6 +20,7 @@ AC_SUBST(abs_top_srcdir)
 AC_SUBST(abs_top_builddir)
 
 AC_LANG_C
+AC_USE_SYSTEM_EXTENSIONS
 
 AC_PROG_CC
 AM_PROG_CC_C_O
@@ -31,16 +34,16 @@ m4_ifdef([AC_LIBTOOL_TAGS], [AC_LIBTOOL_TAGS([])])
 AC_DISABLE_STATIC
 AC_PROG_LIBTOOL
 
-AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization],
+gl_CONFIGMAKE_PREP
+
+AC_ARG_ENABLE(optimization, AS_HELP_STRING([--disable-optimization],
                        [disable code optimization through compiler]), [
        if (test "${enableval}" = "no"); then
                CFLAGS="$CFLAGS -O0 -U_FORTIFY_SOURCE"
        fi
 ])
 
-GTK_DOC_CHECK
-
-AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
+AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug],
                        [enable compiling with debugging information]), [
        if (test "${enableval}" = "yes" &&
                                test "${ac_cv_prog_cc_g}" = "yes"); then
@@ -48,7 +51,7 @@ AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug],
        fi
 ])
 
-AC_ARG_ENABLE(pie, AC_HELP_STRING([--enable-pie],
+AC_ARG_ENABLE(pie, AS_HELP_STRING([--enable-pie],
                        [enable position independent executables flag]), [
        if (test "${enableval}" = "yes" &&
                                test "${ac_cv_prog_cc_pie}" = "yes"); then
@@ -57,25 +60,52 @@ AC_ARG_ENABLE(pie, AC_HELP_STRING([--enable-pie],
        fi
 ])
 
-AC_ARG_ENABLE(threads,
-       AC_HELP_STRING([--enable-threads], [enable threading support]),
-                       [enable_threads=${enableval}], [enable_threads="no"])
-
 AC_ARG_ENABLE(hh2serial-gps,
-       AC_HELP_STRING([--enable-hh2serial-gps], [enable hh2serial GPS support]),
+       AS_HELP_STRING([--enable-hh2serial-gps], [enable hh2serial GPS support]),
                        [enable_hh2serial_gps=${enableval}], [enable_hh2serial_gps="no"])
 AM_CONDITIONAL(HH2SERIAL_GPS, test "${enable_hh2serial_gps}" != "no")
 AM_CONDITIONAL(HH2SERIAL_GPS_BUILTIN, test "${enable_hh2serial_gps}" = "builtin")
 
-AC_ARG_WITH(openconnect, AC_HELP_STRING([--with-openconnect=PROGRAM],
+AC_ARG_ENABLE(telephony,
+       AS_HELP_STRING([--enable-telephony], [enable Telephony support]),
+                       [enable_telephony=${enableval}], [enable_telephony="yes"])
+AM_CONDITIONAL(TELEPHONY, test "${enable_telephony}" != "no")
+AM_CONDITIONAL(TELEPHONY_BUILTIN, test "${enable_telephony}" = "builtin")
+
+AC_ARG_ENABLE(tizen-ext,
+       AS_HELP_STRING([--enable-tizen-ext], [enable TIZEN extensions]),
+                       [if (test "${enableval}" = "yes"); then
+                               CFLAGS="$CFLAGS -DTIZEN_EXT"
+                               LIBS="$LIBS -lsmack"
+                       fi])
+AM_CONDITIONAL(TIZEN_EXT, test "${enable-tizen-ext}" != "no")
+
+AC_ARG_ENABLE(tizen-ext-wifi-mesh,
+       AS_HELP_STRING([--enable-tizen-ext-wifi-mesh], [enable TIZEN extensions for Wi-Fi Mesh]),
+                       [CFLAGS="$CFLAGS -DTIZEN_EXT_WIFI_MESH"], [enable_tizen_ext_wifi_mesh="no"])
+AM_CONDITIONAL(TIZEN_EXT_WIFI_MESH, test "${enable_tizen_ext_wifi_mesh}" != "no")
+
+AC_ARG_ENABLE(tizen-ext-eap-on-ethernet,
+       AS_HELP_STRING([--enable-tizen-ext-eap-on-ethernet], [enable TIZEN extensions for EAP on Ethernet]),
+                       [CFLAGS="$CFLAGS -DTIZEN_EXT_EAP_ON_ETHERNET"], [enable_tizen_ext_eap_on_ethernet="no"])
+AM_CONDITIONAL(TIZEN_EXT_EAP_ON_ETHERNET, test "${enable_tizen_ext_eap_on_ethernet}" != "no")
+
+AC_ARG_ENABLE(tizen-maintain-online,
+       AS_HELP_STRING([--enable-tizen-maintain-online], [enable TIZEN extensions]),
+                       [if (test "${enableval}" = "yes"); then
+                               CFLAGS="$CFLAGS -DTIZEN_MAINTAIN_ONLINE"
+                               LIBS="$LIBS -lsmack"
+                       fi])
+
+AC_ARG_WITH(openconnect, AS_HELP_STRING([--with-openconnect=PROGRAM],
         [specify location of openconnect binary]), [path_openconnect=${withval}])
 
 AC_ARG_ENABLE(openconnect,
-       AC_HELP_STRING([--enable-openconnect], [enable openconnect support]),
+       AS_HELP_STRING([--enable-openconnect], [enable openconnect support]),
                        [enable_openconnect=${enableval}], [enable_openconnect="no"])
 if (test "${enable_openconnect}" != "no"); then
        if (test -z "${path_openconnect}"); then
-               AC_PATH_PROG(OPENCONNECT, [openconnect], [], $PATH:/sbin:/usr/sbin)
+               AC_PATH_PROG(OPENCONNECT, [openconnect], [], $PATH:/bin:/usr/bin)
                if (test -z "${OPENCONNECT}"); then
                        AC_MSG_ERROR(openconnect binary not found)
                fi
@@ -83,19 +113,21 @@ if (test "${enable_openconnect}" != "no"); then
                OPENCONNECT="${path_openconnect}"
                AC_SUBST(OPENCONNECT)
        fi
+       PKG_CHECK_MODULES(LIBOPENCONNECT, openconnect >= 8, [],
+               AC_MSG_ERROR(openconnect >= 8 is required))
 fi
 AM_CONDITIONAL(OPENCONNECT, test "${enable_openconnect}" != "no")
 AM_CONDITIONAL(OPENCONNECT_BUILTIN, test "${enable_openconnect}" = "builtin")
 
-AC_ARG_WITH(openvpn, AC_HELP_STRING([--with-openvpn=PROGRAM],
+AC_ARG_WITH(openvpn, AS_HELP_STRING([--with-openvpn=PROGRAM],
         [specify location of openvpn binary]), [path_openvpn=${withval}])
 
 AC_ARG_ENABLE(openvpn,
-       AC_HELP_STRING([--enable-openvpn], [enable openvpn support]),
+       AS_HELP_STRING([--enable-openvpn], [enable openvpn support]),
                        [enable_openvpn=${enableval}], [enable_openvpn="no"])
 if (test "${enable_openvpn}" != "no"); then
        if (test -z "${path_openvpn}"); then
-               AC_PATH_PROG(OPENVPN, [openvpn], [], $PATH:/sbin:/usr/sbin)
+               AC_PATH_PROG(OPENVPN, [openvpn], [/usr/bin/openvpn], $PATH:/bin:/usr/bin)
                if (test -z "${OPENVPN}"); then
                        AC_MSG_ERROR(openvpn binary not found)
                fi
@@ -107,15 +139,39 @@ fi
 AM_CONDITIONAL(OPENVPN, test "${enable_openvpn}" != "no")
 AM_CONDITIONAL(OPENVPN_BUILTIN, test "${enable_openvpn}" = "builtin")
 
-AC_ARG_WITH(vpnc, AC_HELP_STRING([--with-vpnc=PROGRAM],
+AC_ARG_WITH(ipsec, AS_HELP_STRING([--with-ipsec=PROGRAM],
+        [specify location of ipsec binary]), [path_ipsec=${withval}])
+
+AC_ARG_ENABLE(ipsec,
+       AS_HELP_STRING([--enable-ipsec], [enable ipsec support]),
+                       [enable_ipsec=${enableval}], [enable_ipsec="no"])
+if (test "${enable_ipsec}" != "no"); then
+       PKG_CHECK_MODULES(GIO, gio-2.0 >= 2.28, dummy=yes,
+                                       AC_MSG_ERROR(GIO >= 2.28 is required))
+       AC_SUBST(GIO_CFLAGS)
+       AC_SUBST(GIO_LIBS)
+       if (test -z "${path_ipsec}"); then
+               AC_PATH_PROG(IPSEC, [charon], [/usr/bin/charon], $PATH:/usr/bin)
+               if (test -z "${IPSEC}"); then
+                       AC_MSG_ERROR(ipsec binary not found)
+               fi
+       else
+               IPSEC="${path_ipsec}"
+               AC_SUBST(IPSEC)
+       fi
+fi
+AM_CONDITIONAL(IPSEC, test "${enable_ipsec}" != "no")
+AM_CONDITIONAL(IPSEC_BUILTIN, test "${enable_ipsec}" = "builtin")
+
+AC_ARG_WITH(vpnc, AS_HELP_STRING([--with-vpnc=PROGRAM],
        [specify location of vpnc binary]), [path_vpnc=${withval}])
 
 AC_ARG_ENABLE(vpnc,
-       AC_HELP_STRING([--enable-vpnc], [enable vpnc support]),
+       AS_HELP_STRING([--enable-vpnc], [enable vpnc support]),
                [enable_vpnc=${enableval}], [enable_vpnc="no"])
 if (test "${enable_vpnc}" != "no"); then
        if (test -z "${path_vpnc}"); then
-               AC_PATH_PROG(VPNC, [vpnc], [], $PATH:/sbin:/usr/sbin)
+               AC_PATH_PROG(VPNC, [vpnc], [], $PATH:/bin:/usr/bin)
                if (test -z "${VPNC}"); then
                        AC_MSG_ERROR(vpnc binary not found)
                fi
@@ -127,12 +183,15 @@ fi
 AM_CONDITIONAL(VPNC, test "${enable_vpnc}" != "no")
 AM_CONDITIONAL(VPNC_BUILTIN, test "${enable_vpnc}" = "builtin")
 
+AC_ARG_WITH(l2tp, AS_HELP_STRING([--with-l2tp=PROGRAM],
+        [specify location of l2tp binary]), [path_l2tp=${withval}])
+
 AC_ARG_ENABLE(l2tp,
-       AC_HELP_STRING([--enable-l2tp], [enable l2tp support]),
+       AS_HELP_STRING([--enable-l2tp], [enable l2tp support]),
                        [enable_l2tp=${enableval}], [enable_l2tp="no"])
 if (test "${enable_l2tp}" != "no"); then
        if (test -z "${path_pppd}"); then
-               AC_PATH_PROG(PPPD, [pppd], [/usr/sbin/pppd], $PATH:/sbin:/usr/sbin)
+               AC_PATH_PROG(PPPD, [pppd], [/usr/bin/pppd], $PATH:/bin:/usr/bin)
        else
                PPPD="${path_pppd}"
                AC_SUBST(PPPD)
@@ -140,7 +199,7 @@ if (test "${enable_l2tp}" != "no"); then
        AC_CHECK_HEADERS(pppd/pppd.h, dummy=yes,
                        AC_MSG_ERROR(ppp header files are required))
        if (test -z "${path_l2tp}"); then
-               AC_PATH_PROG(L2TP, [xl2tpd], [/usr/sbin/xl2tpd], $PATH:/sbin:/usr/sbin)
+               AC_PATH_PROG(L2TP, [xl2tpd], [/usr/bin/xl2tpd], $PATH:/bin:/usr/bin)
        else
                L2TP="${path_l2tp}"
                AC_SUBST(L2TP)
@@ -149,12 +208,15 @@ fi
 AM_CONDITIONAL(L2TP, test "${enable_l2tp}" != "no")
 AM_CONDITIONAL(L2TP_BUILTIN, test "${enable_l2tp}" = "builtin")
 
+AC_ARG_WITH(pptp, AS_HELP_STRING([--with-pptp=PROGRAM],
+        [specify location of pptp binary]), [path_pptp=${withval}])
+
 AC_ARG_ENABLE(pptp,
-       AC_HELP_STRING([--enable-pptp], [enable pptp support]),
+       AS_HELP_STRING([--enable-pptp], [enable pptp support]),
                        [enable_pptp=${enableval}], [enable_pptp="no"])
 if (test "${enable_pptp}" != "no"); then
        if (test -z "${path_pppd}"); then
-               AC_PATH_PROG(PPPD, [pppd], [/usr/sbin/pppd], $PATH:/sbin:/usr/sbin)
+               AC_PATH_PROG(PPPD, [pppd], [/usr/bin/pppd], $PATH:/bin:/usr/bin)
        else
                PPPD="${path_pppd}"
                AC_SUBST(PPPD)
@@ -162,7 +224,7 @@ if (test "${enable_pptp}" != "no"); then
        AC_CHECK_HEADERS(pppd/pppd.h, dummy=yes,
                        AC_MSG_ERROR(ppp header files are required))
        if (test -z "${path_pptp}"); then
-               AC_PATH_PROG(PPTP, [pptp], [/usr/sbin/pptp], $PATH:/sbin:/usr/sbin)
+               AC_PATH_PROG(PPTP, [pptp], [/usr/bin/pptp], $PATH:/bin:/usr/bin)
        else
                PPTP="${path_pptp}"
                AC_SUBST(PPTP)
@@ -178,29 +240,34 @@ AC_CHECK_LIB(resolv, ns_initparse, dummy=yes, [
                AC_MSG_ERROR(resolver library support is required))
 ])
 
+AC_CHECK_HEADERS([execinfo.h])
+AM_CONDITIONAL([BACKTRACE], [test "${ac_cv_header_execinfo_h}" = "yes"])
+
+AC_CHECK_MEMBERS([struct in6_pktinfo.ipi6_addr], [], [], [[#include <netinet/in.h>]])
+
 AC_CHECK_FUNC(signalfd, dummy=yes,
                        AC_MSG_ERROR(signalfd support is required))
 
 AC_CHECK_LIB(dl, dlopen, dummy=yes,
                        AC_MSG_ERROR(dynamic linking loader is required))
 
-AC_ARG_ENABLE(iospm, AC_HELP_STRING([--enable-iospm],
+AC_ARG_ENABLE(iospm, AS_HELP_STRING([--enable-iospm],
                [enable Intel OSPM support]), [enable_iospm=${enableval}])
 AM_CONDITIONAL(IOSPM, test "${enable_iospm}" = "yes")
 
 AC_ARG_ENABLE(tist,
-       AC_HELP_STRING([--enable-tist], [enable TI Shared Transport support]),
+       AS_HELP_STRING([--enable-tist], [enable TI Shared Transport support]),
                        [enable_tist=${enableval}], [enable_tist="no"])
 AM_CONDITIONAL(TIST, test "${enable_tist}" != "no")
 AM_CONDITIONAL(TIST_BUILTIN, test "${enable_tist}" = "builtin")
 
 AC_ARG_ENABLE(session-policy-local,
-       AC_HELP_STRING([--enable-session-policy-local], [enable local file Session policy configuration support]),
+       AS_HELP_STRING([--enable-session-policy-local], [enable local file Session policy configuration support]),
                        [enable_session_policy_local=${enableval}], [enable_session_policy_local="no"])
 AM_CONDITIONAL(SESSION_POLICY_LOCAL, test "${enable_session_policy_local}" != "no")
 AM_CONDITIONAL(SESSION_POLICY_LOCAL_BUILTIN, test "${enable_session_policy_local}" = "builtin")
 
-AC_ARG_WITH(stats-max-file-size, AC_HELP_STRING([--with-stats-max-file-size=SIZE],
+AC_ARG_WITH(stats-max-file-size, AS_HELP_STRING([--with-stats-max-file-size=SIZE],
                        [Maximal size of a statistics round robin file]),
                        [stats_max_file_size=${withval}])
 
@@ -211,25 +278,37 @@ fi
 
 AC_DEFINE_UNQUOTED([STATS_MAX_FILE_SIZE], (${stats_max_file_size}), [Maximal size of a statistics round robin file])
 
-PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28, dummy=yes,
-                               AC_MSG_ERROR(GLib >= 2.28 is required))
+PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.40, dummy=yes,
+                               AC_MSG_ERROR(GLib >= 2.40 is required))
 AC_SUBST(GLIB_CFLAGS)
 AC_SUBST(GLIB_LIBS)
 
-if (test "${enable_threads}" = "yes"); then
-       AC_DEFINE(NEED_THREADS, 1, [Define if threading support is required])
-       PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes,
-                               AC_MSG_ERROR(GThread >= 2.16 is required))
-       GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS"
-       GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS"
-fi
+PKG_CHECK_MODULES(LIBNL, libnl-3.0, dummy=yes,
+                               AC_MSG_ERROR(libnl-3.0 is required))
+AC_SUBST(LIBNL_CFLAGS)
+AC_SUBST(LIBNL_LIBS)
+
+PKG_CHECK_MODULES(LIBNL_GENL, libnl-genl-3.0, dummy=yes,
+                               AC_MSG_ERROR(libnl-genl-3.0 is required))
+AC_SUBST(LIBNL_GENL_CFLAGS)
+AC_SUBST(LIBNL_GENL_LIBS)
+
+PKG_CHECK_MODULES(LIBSYSTEMD, libsystemd, dummy=yes,
+                               AC_MSG_ERROR(libsystemd library is required))
+AC_SUBST(LIBSYSTEMD_CFLAGS)
+AC_SUBST(LIBSYSTEMD_LIBS)
 
 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.4, dummy=yes,
                                AC_MSG_ERROR(D-Bus >= 1.4 is required))
 AC_SUBST(DBUS_CFLAGS)
 AC_SUBST(DBUS_LIBS)
 
-AC_ARG_WITH(dbusconfdir, AC_HELP_STRING([--with-dbusconfdir=PATH],
+PKG_CHECK_MODULES(DLOG, dlog, dummy=yes,
+                               AC_MSG_ERROR(dlog is required))
+AC_SUBST(DLOG_CFLAGS)
+AC_SUBST(DLOG_LIBS)
+
+AC_ARG_WITH(dbusconfdir, AS_HELP_STRING([--with-dbusconfdir=PATH],
        [path to D-Bus config directory]), [path_dbusconf=${withval}],
                [path_dbusconf="`$PKG_CONFIG --variable=sysconfdir dbus-1`"])
 if (test -z "${path_dbusconf}"); then
@@ -239,7 +318,7 @@ else
 fi
 AC_SUBST(DBUS_CONFDIR)
 
-AC_ARG_WITH(dbusdatadir, AC_HELP_STRING([--with-dbusdatadir=PATH],
+AC_ARG_WITH(dbusdatadir, AS_HELP_STRING([--with-dbusdatadir=PATH],
        [path to D-Bus data directory]), [path_dbusdata=${withval}],
                [path_dbusdata="`$PKG_CONFIG --variable=datadir dbus-1`"])
 if (test -z "${path_dbusdata}"); then
@@ -249,7 +328,7 @@ else
 fi
 AC_SUBST(DBUS_DATADIR)
 
-AC_ARG_WITH([systemdunitdir], AC_HELP_STRING([--with-systemdunitdir=DIR],
+AC_ARG_WITH([systemdunitdir], AS_HELP_STRING([--with-systemdunitdir=DIR],
        [path to systemd service directory]), [path_systemdunit=${withval}],
                [path_systemdunit="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"])
 if (test -n "${path_systemdunit}"); then
@@ -258,21 +337,62 @@ if (test -n "${path_systemdunit}"); then
 fi
 AM_CONDITIONAL(SYSTEMD, test -n "${path_systemdunit}")
 
-PKG_CHECK_MODULES(XTABLES, xtables, dummy=yes,
-                               AC_MSG_ERROR(Xtables library is required))
-AC_SUBST(XTABLES_CFLAGS)
-AC_SUBST(XTABLES_LIBS)
+AC_ARG_WITH([tmpfilesdir], AS_HELP_STRING([--with-tmpfilesdir=DIR],
+       [path to systemd tmpfiles.d directory]), [path_tmpfiles=${withval}],
+               [path_tmpfiles="`$PKG_CONFIG --variable=tmpfilesdir systemd`"])
+if (test -n "${path_tmpfiles}"); then
+       SYSTEMD_TMPFILESDIR="${path_tmpfiles}"
+       AC_SUBST(SYSTEMD_TMPFILESDIR)
+fi
+
+AC_ARG_WITH(firewall, AS_HELP_STRING([--with-firewall=TYPE],
+                       [specify which firewall type is used iptables or nftables [default=iptables]]),
+               [firewall_type=${withval}],
+               [firewall_type="iptables"])
+
+if (test "${firewall_type}" != "iptables" -a \
+               "${firewall_type}" != "nftables"); then
+       AC_MSG_ERROR(neither nftables nor iptables support enabled)
+fi
+
+found_iptables="no"
+if (test "${firewall_type}" = "iptables"); then
+       PKG_CHECK_MODULES(XTABLES, xtables >= 1.4.11, [found_iptables="yes"],
+                       AC_MSG_ERROR(Xtables library is required))
+       AC_SUBST(XTABLES_CFLAGS)
+       AC_SUBST(XTABLES_LIBS)
+fi
+AM_CONDITIONAL(XTABLES, test "${found_iptables}" != "no")
+
+found_libmnl="no"
+if (test "${firewall_type}" = "nftables" -o \
+               "${enable_wireguard}" != "no"); then
+       PKG_CHECK_MODULES(LIBMNL, [libmnl >= 1.0.0], [found_libmnl="yes"],
+               AC_MSG_ERROR([libmnl >= 1.0.0 not found]))
+       AC_SUBST(LIBMNL_CFLAGS)
+       AC_SUBST(LIBMNL_LIBS)
+fi
+AM_CONDITIONAL(LIBMNL, test "${found_libmnl}" != "no")
+
+found_nftables="no"
+if (test "${firewall_type}" = "nftables"); then
+       PKG_CHECK_MODULES(NFTABLES, [libnftnl >= 1.0.4], [found_nftables="yes"],
+               AC_MSG_ERROR([libnftnl >= 1.0.4]))
+       AC_SUBST(NFTABLES_CFLAGS)
+       AC_SUBST(NFTABLES_LIBS)
+fi
+AM_CONDITIONAL(NFTABLES, test "${found_nftables}" != "no")
 
-AC_ARG_ENABLE(test, AC_HELP_STRING([--enable-test],
+AC_ARG_ENABLE(test, AS_HELP_STRING([--enable-test],
                [enable test/example scripts]), [enable_test=${enableval}])
 AM_CONDITIONAL(TEST, test "${enable_test}" = "yes")
 
-AC_ARG_ENABLE(nmcompat, AC_HELP_STRING([--enable-nmcompat],
+AC_ARG_ENABLE(nmcompat, AS_HELP_STRING([--enable-nmcompat],
                                [enable Network Manager support]),
                        [enable_nmcompat=${enableval}], [enable_nmcompat="no"])
 AM_CONDITIONAL(NMCOMPAT, test "${enable_nmcompat}" != "no")
 
-AC_ARG_ENABLE(polkit, AC_HELP_STRING([--enable-polkit],
+AC_ARG_ENABLE(polkit, AS_HELP_STRING([--enable-polkit],
                                [enable PolicyKit support]),
                        [enable_polkit=${enableval}], [enable_polkit="no"])
 if (test "${enable_polkit}" != "no"); then
@@ -285,62 +405,102 @@ if (test "${enable_polkit}" != "no"); then
 fi
 AM_CONDITIONAL(POLKIT, test "${enable_polkit}" != "no")
 
-AC_ARG_ENABLE(selinux, AC_HELP_STRING([--enable-selinux],
+AC_ARG_ENABLE(selinux, AS_HELP_STRING([--enable-selinux],
                                [enable selinux support]),
                        [enable_selinux=${enableval}], [enable_selinux="no"])
 AM_CONDITIONAL(SELINUX, test "${enable_selinux}" != "no")
 
-AC_ARG_ENABLE(loopback, AC_HELP_STRING([--disable-loopback],
+AC_ARG_ENABLE(loopback, AS_HELP_STRING([--disable-loopback],
                                [disable loopback support]),
                                        [enable_loopback=${enableval}])
 AM_CONDITIONAL(LOOPBACK, test "${enable_loopback}" != "no")
 
-AC_ARG_ENABLE(ethernet, AC_HELP_STRING([--disable-ethernet],
+AC_ARG_ENABLE(ethernet, AS_HELP_STRING([--disable-ethernet],
                                [disable Ethernet support]),
                                        [enable_ethernet=${enableval}])
 AM_CONDITIONAL(ETHERNET, test "${enable_ethernet}" != "no")
 
-AC_ARG_ENABLE(wifi, AC_HELP_STRING([--disable-wifi],
+AC_ARG_ENABLE(wireguard, AS_HELP_STRING([--disable-wireguard],
+                               [disable Wireguard support]),
+                                       [enable_wireguard=${enableval}])
+AM_CONDITIONAL(WIREGUARD, test "${enable_wireguard}" != "no")
+AM_CONDITIONAL(WIREGUARD_BUILTIN, test "${enable_wireguard}" = "builtin")
+
+AC_ARG_ENABLE(gadget, AS_HELP_STRING([--disable-gadget],
+                               [disable USB Gadget support]),
+                                       [enable_gadget=${enableval}])
+AM_CONDITIONAL(GADGET, test "${enable_gadget}" != "no")
+
+AC_ARG_ENABLE(wifi, AS_HELP_STRING([--disable-wifi],
                                [disable WiFi support]),
                                        [enable_wifi=${enableval}])
 AM_CONDITIONAL(WIFI, test "${enable_wifi}" != "no")
 
-AC_ARG_ENABLE(bluetooth, AC_HELP_STRING([--disable-bluetooth],
+AC_ARG_ENABLE(iwd, AS_HELP_STRING([--enable-iwd],
+                               [enable iwd support]),
+                                       [enable_iwd=${enableval}])
+AM_CONDITIONAL(IWD, test "${enable_iwd}" = "yes")
+
+AC_ARG_ENABLE(bluetooth, AS_HELP_STRING([--disable-bluetooth],
                                [disable Bluetooth support]),
                                        [enable_bluetooth=${enableval}])
 AM_CONDITIONAL(BLUETOOTH, test "${enable_bluetooth}" != "no")
 
-AC_ARG_ENABLE(ofono, AC_HELP_STRING([--disable-ofono],
+AC_ARG_ENABLE(ofono, AS_HELP_STRING([--disable-ofono],
                                [disable oFono support]),
                                        [enable_ofono=${enableval}])
 AM_CONDITIONAL(OFONO, test "${enable_ofono}" != "no")
 
-AC_ARG_ENABLE(dundee, AC_HELP_STRING([--disable-dundee],
+AC_ARG_ENABLE(dundee, AS_HELP_STRING([--disable-dundee],
                                [disable dundee support (Bluetooth DUN)]),
                                        [enable_dundee=${enableval}])
 AM_CONDITIONAL(DUNDEE, test "${enable_dundee}" != "no")
 
-AC_ARG_ENABLE(pacrunner, AC_HELP_STRING([--disable-pacrunner],
+AC_ARG_ENABLE(pacrunner, AS_HELP_STRING([--disable-pacrunner],
                                [disable PACrunner support]),
                                        [enable_pacrunner=${enableval}])
 AM_CONDITIONAL(PACRUNNER, test "${enable_pacrunner}" != "no")
 
-AC_ARG_ENABLE(neard, AC_HELP_STRING([--disable-neard],
+AC_ARG_ENABLE(neard, AS_HELP_STRING([--disable-neard],
                                [disable Neard support]),
                                        [enable_neard=${enableval}])
 AM_CONDITIONAL(NEARD, test "${enable_neard}" != "no")
 
-AC_ARG_ENABLE(wispr, AC_HELP_STRING([--disable-wispr],
+AC_ARG_ENABLE(wispr, AS_HELP_STRING([--disable-wispr],
                                [disable WISPr support]),
                                        [enable_wispr=${enableval}])
 AM_CONDITIONAL(WISPR, test "${enable_wispr}" != "no")
 
-AC_ARG_ENABLE(tools, AC_HELP_STRING([--disable-tools],
+AC_ARG_ENABLE(backtrace, AS_HELP_STRING([--disable-backtrace],
+                               [disable backtrace support]),
+                                       [enable_backtrace=${enableval}])
+AM_CONDITIONAL(BACKTRACE, test "${enable_backtrace}" != "no")
+
+AC_ARG_ENABLE(tools, AS_HELP_STRING([--disable-tools],
                                [disable testing tools]),
                                        [enable_tools=${enableval}])
 AM_CONDITIONAL(TOOLS, test "${enable_tools}" != "no")
 
-AC_ARG_ENABLE(client, AC_HELP_STRING([--disable-client],
+AC_ARG_ENABLE(stats, AS_HELP_STRING([--disable-stats],
+                               [disable statistics round robin file generation]),
+                                       [enable_stats=${enableval}])
+AM_CONDITIONAL(STATS, test "${enable_stats}" != "no")
+
+if (test "${enable_tools}" != "no"); then
+       AC_PATH_PROGS(IPTABLES_SAVE, [iptables-save], [],
+                                               $PATH:/bin:/usr/bin)
+       AC_PATH_PROGS(IP6TABLES_SAVE, [ip6tables-save], [],
+                                               $PATH:/bin:/usr/bin)
+       IPTABLES_SAVE=$ac_cv_path_IPTABLES_SAVE
+       IP6TABLES_SAVE=$ac_cv_path_IP6TABLES_SAVE
+else
+       IPTABLES_SAVE=""
+       IP6TABLES_SAVE=""
+fi
+AC_SUBST(IPTABLES_SAVE)
+AC_SUBST(IP6TABLES_SAVE)
+
+AC_ARG_ENABLE(client, AS_HELP_STRING([--disable-client],
                                [disable command line client]),
                                        [enable_client=${enableval}])
 AM_CONDITIONAL(CLIENT, test "${enable_client}" != "no")
@@ -365,10 +525,10 @@ fi
 
 if (test "${enable_wifi}" != "no"); then
        AC_PATH_PROG(WPASUPPLICANT, [wpa_supplicant], [],
-                                               $PATH:/sbin:/usr/sbin)
+                                               $PATH:/bin:/usr/bin)
 fi
 
-AC_ARG_ENABLE(datafiles, AC_HELP_STRING([--disable-datafiles],
+AC_ARG_ENABLE(datafiles, AS_HELP_STRING([--disable-datafiles],
                        [don't install configuration and data files]),
                                        [enable_datafiles=${enableval}])
 AM_CONDITIONAL(DATAFILES, test "${enable_datafiles}" != "no")
@@ -380,10 +540,24 @@ fi
 
 AM_CONDITIONAL(VPN, test "${enable_openconnect}" != "no" -o \
                        "${enable_openvpn}" != "no" -o \
+                       "${enable_ipsec}" != "no" -o \
                        "${enable_vpnc}" != "no" -o \
                        "${enable_l2tp}" != "no" -o \
-                       "${enable_pptp}" != "no")
+                       "${enable_pptp}" != "no" -o \
+                       "${enable_wireguard}" != "no")
+
+AC_MSG_CHECKING(which DNS backend to use)
+AC_ARG_WITH(dns-backend, AS_HELP_STRING([--with-dns-backend=TYPE],
+            [specify which DNS backend to use: internal or systemd-resolved [default=internal]]),
+               [dns_backend=${withval}],
+               [dns_backend="internal"])
+
+if (test "${dns_backend}" != "internal" -a \
+               "${dns_backend}" != "systemd-resolved"); then
+       AC_MSG_ERROR(no suitable DNS backend defined)
+fi
+AM_CONDITIONAL(INTERNAL_DNS_BACKEND, test "${dns_backend}" = "internal")
+AM_CONDITIONAL(SYSTEMD_RESOLVED_DNS_BACKEND, test "${dns_backend}" = "systemd-resolved")
+AC_MSG_RESULT(${dns_backend})
 
-AC_OUTPUT(Makefile include/version.h src/connman.service
-               vpn/connman-vpn.service vpn/net.connman.vpn.service
-               scripts/connman doc/version.xml connman.pc)
+AC_OUTPUT(Makefile include/version.h connman.pc src/connman.service src/connman_tv.service vpn/connman-vpn.service)