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)
30 m4_define([_LT_AC_TAGCONFIG], [])
31 m4_ifdef([AC_LIBTOOL_TAGS], [AC_LIBTOOL_TAGS([])])
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"
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
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"
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")
68 AC_ARG_WITH(openconnect, AC_HELP_STRING([--with-openconnect=PROGRAM],
69 [specify location of openconnect binary]), [path_openconnect=${withval}])
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)
81 OPENCONNECT="${path_openconnect}"
85 AM_CONDITIONAL(OPENCONNECT, test "${enable_openconnect}" != "no")
86 AM_CONDITIONAL(OPENCONNECT_BUILTIN, test "${enable_openconnect}" = "builtin")
88 AC_ARG_WITH(openvpn, AC_HELP_STRING([--with-openvpn=PROGRAM],
89 [specify location of openvpn binary]), [path_openvpn=${withval}])
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)
101 OPENVPN="${path_openvpn}"
105 AM_CONDITIONAL(OPENVPN, test "${enable_openvpn}" != "no")
106 AM_CONDITIONAL(OPENVPN_BUILTIN, test "${enable_openvpn}" = "builtin")
108 AC_ARG_WITH(vpnc, AC_HELP_STRING([--with-vpnc=PROGRAM],
109 [specify location of vpnc binary]), [path_vpnc=${withval}])
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)
125 AM_CONDITIONAL(VPNC, test "${enable_vpnc}" != "no")
126 AM_CONDITIONAL(VPNC_BUILTIN, test "${enable_vpnc}" = "builtin")
128 AC_ARG_WITH(l2tp, AC_HELP_STRING([--with-l2tp=PROGRAM],
129 [specify location of l2tp binary]), [path_l2tp=${withval}])
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)
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)
150 AM_CONDITIONAL(L2TP, test "${enable_l2tp}" != "no")
151 AM_CONDITIONAL(L2TP_BUILTIN, test "${enable_l2tp}" = "builtin")
153 AC_ARG_WITH(pptp, AC_HELP_STRING([--with-pptp=PROGRAM],
154 [specify location of pptp binary]), [path_pptp=${withval}])
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)
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)
175 AM_CONDITIONAL(PPTP, test "${enable_pptp}" != "no")
176 AM_CONDITIONAL(PPTP_BUILTIN, test "${enable_pptp}" = "builtin")
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))
185 AC_CHECK_HEADERS([execinfo.h])
186 AM_CONDITIONAL([BACKTRACE], [test "${ac_cv_header_execinfo_h}" = "yes"])
188 AC_CHECK_FUNC(signalfd, dummy=yes,
189 AC_MSG_ERROR(signalfd support is required))
191 AC_CHECK_LIB(dl, dlopen, dummy=yes,
192 AC_MSG_ERROR(dynamic linking loader is required))
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")
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")
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")
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}])
214 if (test -z "${stats_max_file_size}"); then
215 # default size is 16 kByte
216 stats_max_file_size="16 * 8 * 128"
219 AC_DEFINE_UNQUOTED([STATS_MAX_FILE_SIZE], (${stats_max_file_size}), [Maximal size of a statistics round robin file])
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)
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)
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"
237 DBUS_CONFDIR="${path_dbusconf}/dbus-1/system.d"
239 AC_SUBST(DBUS_CONFDIR)
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"
247 DBUS_DATADIR="${path_dbusdata}/dbus-1/system-services"
249 AC_SUBST(DBUS_DATADIR)
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)
258 AM_CONDITIONAL(SYSTEMD, test -n "${path_systemdunit}")
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)
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"])
273 if (test "${firewall_type}" != "iptables" -a \
274 "${firewall_type}" != "nftables"); then
275 AC_MSG_ERROR(neither nftables nor iptables support enabled)
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)
285 AM_CONDITIONAL(XTABLES, test "${found_iptables}" != "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)
294 AM_CONDITIONAL(NFTABLES, test "${found_nftables}" != "no")
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")
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")
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`"
311 if (test -z "${POLKIT_DATADIR}"); then
312 POLKIT_DATADIR="${datadir}/polkit-1/actions"
314 AC_SUBST(POLKIT_DATADIR)
316 AM_CONDITIONAL(POLKIT, test "${enable_polkit}" != "no")
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")
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")
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")
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")
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")
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")
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")
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")
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")
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")
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")
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")
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")
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
390 AC_SUBST(IPTABLES_SAVE)
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")
397 if (test "${enable_wispr}" != "no"); then
398 PKG_CHECK_MODULES(GNUTLS, gnutls, dummy=yes,
399 AC_MSG_ERROR(GnuTLS library is required))
404 AC_SUBST(GNUTLS_CFLAGS)
405 AC_SUBST(GNUTLS_LIBS)
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))
411 AC_CHECK_LIB(c, inotify_init, dummy=yes,
412 AC_MSG_ERROR(inotify library support is required))
415 if (test "${enable_wifi}" != "no"); then
416 AC_PATH_PROG(WPASUPPLICANT, [wpa_supplicant], [],
417 $PATH:/sbin:/usr/sbin)
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")
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))
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")
436 AC_OUTPUT(Makefile include/version.h connman.pc)