session: check for libsystemd and fallback to libsystemd-login
[NetworkManager.git] / configure.ac
1 AC_PREREQ([2.63])
2
3 dnl The NM version number
4 m4_define([nm_major_version], [1])
5 m4_define([nm_minor_version], [1])
6 m4_define([nm_micro_version], [0])
7 m4_define([nm_version],
8           [nm_major_version.nm_minor_version.nm_micro_version])
9 m4_define([nm_git_sha], [m4_esyscmd([ ( [ -d ./.git/ ] && [ "$(readlink -f ./.git/)" = "$(readlink -f "$(git rev-parse --git-dir 2>/dev/null)" 2>/dev/null)" ] && git rev-parse --verify -q HEAD 2>/dev/null ) || true ])])
10
11 AC_INIT([NetworkManager], [nm_version],
12         [http://bugzilla.gnome.org/enter_bug.cgi?product=NetworkManager],
13         [NetworkManager])
14
15 AC_CONFIG_HEADERS([config.h])
16 AC_CONFIG_MACRO_DIR([m4])
17 AC_CONFIG_AUX_DIR([build-aux])
18
19 dnl Initialize automake.  automake < 1.12 didn't have serial-tests and
20 dnl gives an error if it sees this, but for automake >= 1.13
21 dnl serial-tests is required so we have to include it.  Solution is to
22 dnl test for the version of automake (by running an external command)
23 dnl and provide it if necessary.  Note we have to do this entirely using
24 dnl m4 macros since automake queries this macro by running
25 dnl 'autoconf --trace ...'.
26 m4_define([serial_tests], [
27     m4_esyscmd([automake --version |
28                 head -1 |
29                 awk '{split ($NF,a,"."); if (a[1] == 1 && a[2] >= 12) { print "serial-tests" }}'
30     ])
31 ])
32 AM_INIT_AUTOMAKE(1.11 serial_tests tar-ustar no-dist-gzip dist-bzip2 -Wno-portability)  dnl NB: Do not [quote] this parameter.
33 AM_MAINTAINER_MODE([enable])
34 AM_SILENT_RULES([yes])
35
36 dnl Define _SYSTEM_EXTENSIONS for various things like strcasestr()
37 AC_USE_SYSTEM_EXTENSIONS
38
39 dnl
40 dnl Require programs
41 dnl
42 AC_PROG_CC
43 AM_PROG_CC_C_O
44
45 # C++ only required if --enable-qt=yes
46 AC_PROG_CXX
47
48 dnl Initialize libtool
49 LT_PREREQ([2.2])
50 LT_INIT([disable-static])
51
52 dnl Version stuff
53 NM_MAJOR_VERSION=nm_major_version
54 NM_MINOR_VERSION=nm_minor_version
55 NM_MICRO_VERSION=nm_micro_version
56 NM_VERSION=nm_version
57 NM_GIT_SHA=nm_git_sha
58 AC_SUBST(NM_MAJOR_VERSION)
59 AC_SUBST(NM_MINOR_VERSION)
60 AC_SUBST(NM_MICRO_VERSION)
61 AC_SUBST(NM_VERSION)
62 AC_DEFINE_UNQUOTED(NM_GIT_SHA,"$NM_GIT_SHA",[git commit id of the original source code version])
63
64 dnl
65 dnl Checks for typedefs, structures, and compiler characteristics.
66 dnl
67 AC_TYPE_PID_T
68
69 dnl
70 dnl translation support
71 dnl
72 IT_PROG_INTLTOOL([0.40.0])
73
74 AM_GNU_GETTEXT([external])
75 AM_GNU_GETTEXT_VERSION([0.17])
76
77 GETTEXT_PACKAGE=NetworkManager
78 AC_SUBST(GETTEXT_PACKAGE)
79 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
80
81 dnl
82 dnl Make sha1.c happy on big endian systems
83 dnl
84 AC_C_BIGENDIAN
85
86 # NetworkManager paths
87 AC_SUBST(nmbinary, "$sbindir/$PACKAGE", [NetworkManager binary executable])
88 AC_SUBST(nmconfdir, "$sysconfdir/$PACKAGE", [NetworkManager configuration directory])
89 AC_SUBST(nmdatadir, "$datadir/$PACKAGE", [NetworkManager shared data directory])
90 AC_SUBST(nmstatedir, "$localstatedir/lib/$PACKAGE", [NetworkManager persistent state directory])
91 AC_SUBST(nmrundir, "$localstatedir/run/$PACKAGE", [NetworkManager runtime state directory])
92
93 # Alternative configuration plugins
94 AC_ARG_ENABLE(config-plugin-ibft, AS_HELP_STRING([--enable-config-plugin-ibft], [enable ibft configuration plugin]))
95 AC_ARG_ENABLE(ifcfg-rh, AS_HELP_STRING([--enable-ifcfg-rh], [enable ifcfg-rh configuration plugin (Fedora/RHEL)]))
96 AC_ARG_ENABLE(ifcfg-suse, AS_HELP_STRING([--enable-ifcfg-suse], [enable ifcfg-suse configuration plugin (SUSE)]))
97 AC_ARG_ENABLE(ifupdown, AS_HELP_STRING([--enable-ifupdown], [enable ifupdown configuration plugin (Debian/Ubuntu)]))
98 AC_ARG_ENABLE(ifnet, AS_HELP_STRING([--enable-ifnet], [enable ifnet configuration plugin (Gentoo)]))
99 # Default alternative plugins by distribution
100 AS_IF([test -z "$enable_ifcfg_rh"], AC_CHECK_FILE(/etc/redhat-release, enable_ifcfg_rh=yes))
101 AS_IF([test -z "$enable_ifcfg_rh"], AC_CHECK_FILE(/etc/fedora-release, enable_ifcfg_rh=yes))
102 AS_IF([test -z "$enable_ifcfg_rh"], AC_CHECK_FILE(/etc/mandriva-release, enable_ifcfg_rh=yes))
103 AS_IF([test -z "$enable_ifcfg_suse"], AC_CHECK_FILE(/etc/SuSE-release, enable_ifcfg_suse=yes))
104 AS_IF([test -z "$enable_ifupdown"], AC_CHECK_FILE(/etc/debian_version, enable_ifupdown=yes))
105 AS_IF([test -z "$enable_ifnet"], AC_CHECK_FILE(/etc/gentoo-release, enable_ifnet=yes))
106 # Otherwise plugins default to "no"
107 AS_IF([test -z "$enable_ifcfg_rh"], enable_ifcfg_rh=no)
108 AS_IF([test -z "$enable_ifcfg_suse"], enable_ifcfg_suse=no)
109 AS_IF([test -z "$enable_ifupdown"], enable_ifupdown=no)
110 AS_IF([test -z "$enable_ifnet"], enable_ifnet=no)
111 # Enable ibft by default
112 AS_IF([test -z "$enable_config_plugin_ibft"], enable_config_plugin_ibft="yes")
113 # Create automake conditionals
114 AM_CONDITIONAL(CONFIG_PLUGIN_IBFT, test "$enable_config_plugin_ibft" = "yes")
115 AM_CONDITIONAL(CONFIG_PLUGIN_IFCFG_RH, test "$enable_ifcfg_rh" = "yes")
116 AM_CONDITIONAL(CONFIG_PLUGIN_IFCFG_SUSE, test "$enable_ifcfg_suse" = "yes")
117 AM_CONDITIONAL(CONFIG_PLUGIN_IFUPDOWN, test "$enable_ifupdown" = "yes")
118 AM_CONDITIONAL(CONFIG_PLUGIN_IFNET, test "$enable_ifnet" = "yes")
119
120 AC_ARG_WITH(config-plugins-default, AS_HELP_STRING([--with-config-plugins-default=PLUGINS], [Default configuration option for main.plugins setting, used as fallback if the configuration option is unset]), [config_plugins_default="$withval"], [config_plugins_default=""])
121 if test -z "$config_plugins_default" -o "$config_plugins_default" = no; then
122     config_plugins_default=''
123     test "$enable_ifcfg_rh" = "yes"           && config_plugins_default="$config_plugins_default,ifcfg-rh"
124     test "$enable_ifcfg_suse" = "yes"         && config_plugins_default="$config_plugins_default,ifcfg-suse"
125     test "$enable_ifupdown" = "yes"           && config_plugins_default="$config_plugins_default,ifupdown"
126     test "$enable_ifnet" = "yes"              && config_plugins_default="$config_plugins_default,ifnet"
127     test "$enable_config_plugin_ibft" = "yes" && config_plugins_default="$config_plugins_default,ibft"
128     config_plugins_default="${config_plugins_default#,}"
129 fi
130 AC_DEFINE_UNQUOTED(CONFIG_PLUGINS_DEFAULT, "$config_plugins_default", [Default configuration option for main.plugins setting])
131
132 if test "$enable_ifcfg_rh" = "yes"; then
133     DISTRO_NETWORK_SERVICE=network.service
134 fi
135 AC_SUBST(DISTRO_NETWORK_SERVICE)
136
137 # Code coverage
138 GNOME_CODE_COVERAGE
139
140 dnl
141 dnl Distribution version string
142 dnl
143 AC_ARG_WITH(dist-version, AS_HELP_STRING([--with-dist-version=<NM-distribution-version>], [Define the NM''s distribution version string]), ac_distver=$withval, ac_distver="")
144 if ! test x"$ac_distver" = x""; then
145   AC_DEFINE_UNQUOTED(NM_DIST_VERSION, "$ac_distver", [Define the distribution version string])
146 fi
147
148 AC_ARG_ENABLE(wifi, AS_HELP_STRING([--enable-wifi], [enable Wi-Fi support]))
149 if test "${enable_wifi}" != "no"; then
150         enable_wifi='yes'
151         AC_DEFINE(WITH_WIFI, 1, [Define if you have Wi-Fi support])
152 else
153         AC_DEFINE(WITH_WIFI, 0, [Define if you have Wi-Fi support])
154 fi
155 AM_CONDITIONAL(WITH_WIFI, test "${enable_wifi}" = "yes")
156
157 dnl
158 dnl Default to using WEXT but allow it to be disabled
159 dnl
160 AC_ARG_WITH(wext, AS_HELP_STRING([--with-wext=yes], [Enable or disable Linux Wireless Extensions]), ac_with_wext=$withval, ac_with_wext="$enable_wifi")
161 if test "$ac_with_wext" != 'no'; then
162         ac_with_wext='yes'
163 fi
164 if test x"$ac_with_wext" = x"yes"; then
165         if test "$enable_wifi" != "yes"; then
166                 AC_MSG_ERROR(Enabling WEXT support and disabling Wi-Fi makes no sense)
167         fi
168         AC_MSG_CHECKING([Linux kernel WEXT headers])
169         AC_COMPILE_IFELSE(
170                 [AC_LANG_PROGRAM(
171                       [[#ifndef __user
172                         #define __user
173                         #endif
174                         #include <sys/types.h>
175                         #include <linux/types.h>
176                         #include <sys/socket.h>
177                         #include <linux/wireless.h>]],
178                       [[#ifndef IWEVGENIE
179                         #error "not found"
180                         #endif]])],
181                 [ac_have_iwevgenie=yes],
182                 [ac_have_iwevgenie=no])
183         AC_MSG_RESULT($ac_have_iwevgenie)
184         if test "$ac_have_iwevgenie" = no; then
185                AC_MSG_ERROR(Linux kernel development header linux/wireless.h not installed or not functional)
186         fi
187         AC_DEFINE(HAVE_WEXT, 1, [Define if you have Linux Wireless Extensions support])
188 else
189         AC_DEFINE(HAVE_WEXT, 0, [Define if you have Linux Wireless Extensions support])
190 fi
191 AM_CONDITIONAL(WITH_WEXT, test x"${ac_with_wext}" = x"yes")
192
193 AC_MSG_CHECKING([Linux kernel nl80211 headers])
194 AC_COMPILE_IFELSE(
195         [AC_LANG_PROGRAM(
196               [[#ifndef __user
197                 #define __user
198                 #endif
199                 #include <sys/types.h>
200                 #include <linux/types.h>
201                 #include <sys/socket.h>
202                 #include <linux/nl80211.h>]],
203               [[int a = NL80211_RATE_INFO_BITRATE; a++;]])],
204         [ac_have_nl80211=yes],
205         [ac_have_nl80211=no])
206 AC_MSG_RESULT($ac_have_nl80211)
207 if test "$ac_have_nl80211" = no; then
208         AC_MSG_ERROR(Linux kernel development header linux/nl80211.h not installed or not functional)
209 fi
210
211 if test "$with_wifi" = "yes"; then
212         AC_MSG_CHECKING([Linux kernel nl80211 Critical Protocol Start/Stop])
213         AC_COMPILE_IFELSE(
214                 [AC_LANG_PROGRAM(
215                   [[#ifndef __user
216                     #define __user
217                     #endif
218                     #include <sys/types.h>
219                     #include <linux/types.h>
220                     #include <sys/socket.h>
221                     #include <linux/nl80211.h>]],
222                   [[unsigned int a = NL80211_CMD_CRIT_PROTOCOL_START; a++;]])],
223                 [ac_have_nl80211_critproto=yes],
224                 [ac_have_nl80211_critproto=no])
225         AC_MSG_RESULT($ac_have_nl80211_critproto)
226 else
227         ac_have_nl80211_critproto='no'
228 fi
229 if test "$ac_have_nl80211_critproto" = yes; then
230         AC_DEFINE(HAVE_NL80211_CRITICAL_PROTOCOL_CMDS, 1, [Define if nl80211 has critical protocol support])
231 else
232         AC_DEFINE(HAVE_NL80211_CRITICAL_PROTOCOL_CMDS, 0, [Define if nl80211 has critical protocol support])
233 fi
234
235 dnl
236 dnl Check for newer VLAN flags
237 dnl
238 AC_MSG_CHECKING([Linux kernel VLAN_FLAG_LOOSE_BINDING enum value])
239 AC_COMPILE_IFELSE(
240         [AC_LANG_PROGRAM(
241               [[#ifndef __user
242                 #define __user
243                 #endif
244                 #include <sys/types.h>
245                 #include <linux/types.h>
246                 #include <linux/if_vlan.h>]],
247               [[unsigned int a = VLAN_FLAG_LOOSE_BINDING;]])],
248         [ac_have_vlan_flag_loose_binding=yes],
249         [ac_have_vlan_flag_loose_binding=no])
250 AC_MSG_RESULT($ac_have_vlan_flag_loose_binding)
251 if test "$ac_have_vlan_flag_loose_binding" = yes; then
252         AC_DEFINE(HAVE_VLAN_FLAG_LOOSE_BINDING, 1, [Define if you have VLAN_FLAG_LOOSE_BINDING])
253 else
254         AC_DEFINE(HAVE_VLAN_FLAG_LOOSE_BINDING, 0, [Define if you have VLAN_FLAG_LOOSE_BINDING])
255 fi
256
257 dnl
258 dnl Checks for libm - needed for pow()
259 dnl
260 LT_LIB_M
261
262 dnl
263 dnl Checks for libdl - on certain platforms its part of libc
264 dnl
265 AC_CHECK_LIB([dl], [dladdr], LIBDL="-ldl", LIBDL="")
266 AC_SUBST(LIBDL)
267
268 dnl
269 dnl Checks for dbus-glib
270 dnl
271 PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.1 dbus-glib-1 >= 0.94)
272 AC_SUBST(DBUS_CFLAGS)
273 AC_SUBST(DBUS_LIBS)
274
275 AC_CHECK_LIB([dbus-glib-1], [dbus_g_method_invocation_get_g_connection], ac_have_gmi_get_con="1", ac_have_gmi_get_con="0")
276 AC_DEFINE_UNQUOTED(HAVE_DBUS_GLIB_GMI_GET_CONNECTION, $ac_have_gmi_get_con, [Define if you have a dbus-glib with dbus_g_method_invocation_get_g_connection()])
277
278 dnl
279 dnl Only dbus-glib >= 0.100 can use private dbus connections
280 dnl
281 PKG_CHECK_MODULES(DBUS_GLIB_100, [dbus-glib-1 >= 0.100], [have_dbus_glib_100=yes],[have_dbus_glib_100=no])
282 if (test "${have_dbus_glib_100}" = "yes"); then
283         AC_DEFINE(HAVE_DBUS_GLIB_100, 1, [Define if you have dbus-glib >= 0.100])
284 else
285         AC_DEFINE(HAVE_DBUS_GLIB_100, 0, [Define if you have dbus-glib >= 0.100])
286 fi
287 AM_CONDITIONAL(HAVE_DBUS_GLIB_100, test "${have_dbus_glib_100}" = "yes")
288
289 PKG_CHECK_MODULES(GLIB, gio-unix-2.0 >= 2.32 gmodule-2.0)
290
291 dnl GLIB_VERSION_MIN_REQUIRED should match the version above.
292 dnl GLIB_VERSION_MAX_ALLOWED should be set to the same version;
293 dnl nm-glib-compat.h will cause it to be overridden for the functions
294 dnl we have compat versions of.
295 GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32"
296
297 AC_SUBST(GLIB_CFLAGS)
298 AC_SUBST(GLIB_LIBS)
299
300 PKG_CHECK_MODULES(GUDEV, gudev-1.0 >= 165)
301 AC_SUBST(GUDEV_CFLAGS)
302 AC_SUBST(GUDEV_LIBS)
303
304 GOBJECT_INTROSPECTION_CHECK([0.9.6])
305
306 # Qt4
307 PKG_CHECK_MODULES(QT, [QtCore >= 4 QtDBus QtNetwork], [have_qt=yes],[have_qt=no])
308 AC_ARG_ENABLE(qt, AS_HELP_STRING([--enable-qt], [enable Qt examples]),
309                      [enable_qt=${enableval}], [enable_qt=${have_qt}])
310 if (test "${enable_qt}" = "yes"); then
311         if test x"$have_qt" = x"no"; then
312                 AC_MSG_ERROR(Qt development headers are required)
313         fi
314         AC_SUBST(QT_CFLAGS)
315         AC_SUBST(QT_LIBS)
316         # Check for moc-qt4 and if not found then moc
317         QT4_BINDIR=`$PKG_CONFIG QtCore --variable moc_location`
318         AC_CHECK_PROGS(MOC, [moc-qt4 moc],, [$QT4_BINDIR:$PATH])
319 fi
320 AM_CONDITIONAL(WITH_QT, test "${enable_qt}" = "yes")
321
322 AC_ARG_WITH(udev-dir, AS_HELP_STRING([--with-udev-dir=DIR], [Absolute path of the udev base directory. Set to 'no' not to install the udev rules]), [], [with_udev_dir="yes"])
323 if (test "$with_udev_dir" != 'no'); then
324         if (test "$with_udev_dir" != 'yes' && printf '%s' "$with_udev_dir" | grep -v -q '^/'); then
325                 AC_MSG_ERROR([--with-udev-dir must be an absolute path or 'yes' or 'no'. Instead it is '$with_udev_dir'])
326         fi
327         if (test "$with_udev_dir" = 'yes'); then
328                 with_udev_dir="/lib/udev"
329         fi
330         UDEV_DIR="$with_udev_dir"
331         AC_SUBST(UDEV_DIR)
332 fi
333 AM_CONDITIONAL(WITH_UDEV_DIR, test "$with_udev_dir" != 'no')
334
335 # systemd unit support
336 AC_ARG_WITH([systemdsystemunitdir], AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
337         [Directory for systemd service files]))
338 # default location
339 AS_IF([test -z "$with_systemdsystemunitdir" && $PKG_CONFIG systemd],
340         with_systemdsystemunitdir="\$(prefix)/lib/systemd/system")
341 AS_IF([test -z "$with_systemdsystemunitdir"], with_systemdsystemunitdir=no)
342 # add conditional and subst
343 AM_CONDITIONAL(HAVE_SYSTEMD, [test "$with_systemdsystemunitdir" != no])
344 if test "$with_systemdsystemunitdir" != no; then
345         AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
346         AC_DEFINE(HAVE_SYSTEMD, 1, [Define if systemd support is available])
347 else
348         AC_DEFINE(HAVE_SYSTEMD, 0, [Define if systemd support is available])
349 fi
350
351 PKG_CHECK_MODULES(SYSTEMD_200, [systemd >= 200], [have_systemd_200=yes],[have_systemd_200=no])
352 AM_CONDITIONAL(HAVE_SYSTEMD_200, test "${have_systemd_200}" = "yes")
353
354 # Session tracking support
355 AC_ARG_WITH(systemd-logind, AS_HELP_STRING([--with-systemd-logind=yes|no],
356         [Support systemd session tracking]))
357 AC_ARG_WITH(consolekit, AS_HELP_STRING([--with-consolekit=yes|no],
358         [Support consolekit session tracking]))
359 AC_ARG_WITH(session-tracking, AS_HELP_STRING([--with-session-tracking=systemd|consolekit|no],
360         [Compatibility option to choose one session tracking module]))
361 # backwards compatibility
362 AS_IF([test "$with_session_tracking" = "ck"], [use_consolekit="yes" use_systemd_logind="no"])
363 AS_IF([test "$with_session_tracking" = "consolekit"], [use_consolekit="yes" use_systemd_logind="no"])
364 AS_IF([test "$with_session_tracking" = "systemd"], [use_consolekit="no" use_systemd_logind="yes"])
365 AS_IF([test "$with_session_tracking" = "no"], [use_consolekit="no" use_systemd_logind="no"])
366 AS_IF([test "$with_session_tracking" = "none"], [use_consolekit="no" use_systemd_logind="no"])
367 # current options
368 AS_IF([test -n "$with_systemd_logind" ], [use_systemd_logind="$with_systemd_logind"])
369 AS_IF([test -n "$with_consolekit" ], [use_consolekit="$with_consolekit"])
370 # defaults
371 AS_IF([test -z "$use_systemd_logind"], [use_systemd_logind="yes"])
372 AS_IF([test -z "$use_consolekit"], [use_consolekit="yes"])
373 # output
374 session_tracking=
375 if test "$use_systemd_logind" = "yes"; then
376         PKG_CHECK_MODULES(SYSTEMD_LOGIND, [libsystemd], , [PKG_CHECK_MODULES(SYSTEMD_LOGIN, [libsystemd-login])])
377         AC_SUBST(SYSTEMD_LOGIN_CFLAGS)
378         AC_SUBST(SYSTEMD_LOGIN_LIBS)
379         AC_DEFINE([SESSION_TRACKING_SYSTEMD], 1, [Define to 1 if libsystemd-login is available])
380         session_tracking="$session_tracking, systemd-logind"
381 fi
382 if test "$use_consolekit" = "yes"; then
383         AC_DEFINE([SESSION_TRACKING_CONSOLEKIT], 1, [Define to 1 if ConsoleKit is available])
384         AC_DEFINE([CKDB_PATH], "/var/run/ConsoleKit/database", [Path to ConsoleKit database])
385         session_tracking="$session_tracking, consolekit"
386 fi
387 session_tracking="$(printf '%s' "${session_tracking}" | sed 's/^, //')"
388
389 AC_ARG_WITH(suspend-resume, AS_HELP_STRING([--with-suspend-resume=upower|systemd], [Build NetworkManager with specific suspend/resume support]))
390 if test "z$with_suspend_resume" = "z"; then
391     PKG_CHECK_EXISTS([libsystemd >= 209], [have_systemd_inhibit=yes],
392                      [PKG_CHECK_EXISTS([libsystemd-login >= 183], [have_systemd_inhibit=yes], [have_systemd_inhibit=no])])
393     if test "z${have_systemd_inhibit}" = "zyes"; then
394         # Use systemd if it's new enough
395         with_suspend_resume="systemd"
396     else
397         # Fall back to upower
398         with_suspend_resume="upower"
399     fi
400 fi
401
402 case $with_suspend_resume in
403     upower) ;;
404     systemd)
405         PKG_CHECK_MODULES(SYSTEMD_INHIBIT, [libsystemd >= 209],,
406                           [PKG_CHECK_MODULES(SYSTEMD_INHIBIT, [libsystemd-login >= 183])])
407         ;;
408     *)
409         AC_MSG_ERROR(--with-suspend-resume must be one of [upower, systemd])
410         ;;
411 esac
412 AM_CONDITIONAL(SUSPEND_RESUME_UPOWER, test "x$with_suspend_resume" = "xupower")
413 AM_CONDITIONAL(SUSPEND_RESUME_SYSTEMD, test "x$with_suspend_resume" = "xsystemd")
414
415 # SELinux support
416 AC_ARG_WITH(selinux, AS_HELP_STRING([--with-selinux=yes|no|auto], [Build with SELinux (default: auto)]),,[with_selinux=auto])
417 if test "$with_selinux" = "yes" -o "$with_selinux" = "auto"; then
418     PKG_CHECK_MODULES(SELINUX, libselinux, [have_selinux=yes], [have_selinux=no])
419 else
420     have_selinux=no
421 fi
422 if test "$with_selinux" = "yes" -a "$have_selinux" = "no"; then
423     AC_MSG_ERROR([You must have libselinux installed to build --with-selinux=yes.])
424 fi
425 if test "$have_selinux" = "yes"; then
426     AC_DEFINE(HAVE_SELINUX, 1, [Define if you have SELinux support])
427 else
428     AC_DEFINE(HAVE_SELINUX, 0, [Define if you have SELinux support])
429 fi
430 AM_CONDITIONAL(HAVE_SELINUX, test "${have_selinux}" = "yes")
431
432 # libnl support for the linux platform
433 PKG_CHECK_MODULES(LIBNL, libnl-3.0 >= 3.2.8 libnl-route-3.0 libnl-genl-3.0)
434 AC_SUBST(LIBNL_CFLAGS)
435 AC_SUBST(LIBNL_LIBS)
436
437 AC_CHECK_LIB([nl-route-3], [rtnl_link_inet6_get_addr_gen_mode],
438         ac_have_addr_gen_mode="1",
439         ac_have_addr_gen_mode="0")
440 AC_DEFINE_UNQUOTED(HAVE_LIBNL_INET6_ADDR_GEN_MODE,
441         $ac_have_addr_gen_mode, [Define if libnl has rtnl_link_inet6_get_addr_gen_mode()])
442
443 AC_MSG_CHECKING([Linux kernel IN6_ADDR_GEN_MODE enum])
444 AC_COMPILE_IFELSE(
445         [AC_LANG_PROGRAM(
446               [[#ifndef __user
447                 #define __user
448                 #endif
449                 #include <linux/if_link.h>]],
450               [[int a = IN6_ADDR_GEN_MODE_EUI64; a++;]])],
451         [ac_have_kernel_gen_mode=yes],
452         [ac_have_kernel_gen_mode=no])
453 AC_MSG_RESULT($ac_have_kernel_gen_mode)
454 if test "$ac_have_kernel_gen_mode" = yes; then
455         AC_DEFINE(HAVE_KERNEL_INET6_ADDR_GEN_MODE, 1, [Define if the kernel has IN6_ADDR_GEN_MODE_*])
456 else
457         AC_DEFINE(HAVE_KERNEL_INET6_ADDR_GEN_MODE, 0, [Define if the kernel has IN6_ADDR_GEN_MODE_*])
458 fi
459
460 # IPv6 tokenized identifiers support in libnl
461 AC_CHECK_LIB([nl-route-3], [rtnl_link_inet6_get_token],
462         ac_have_ipv6_token="1",
463         ac_have_ipv6_token="0")
464 AC_DEFINE_UNQUOTED(HAVE_LIBNL_INET6_TOKEN,
465         $ac_have_ipv6_token, [Define if libnl has rtnl_link_inet6_get_token()])
466
467 # uuid library
468 PKG_CHECK_MODULES(UUID, uuid)
469 AC_SUBST(UUID_CFLAGS)
470 AC_SUBST(UUID_LIBS)
471
472 dnl Checks for readline library - used by nmcli
473 AX_LIB_READLINE
474
475 # Intel WiMAX SDK checks
476 PKG_CHECK_MODULES(IWMX_SDK, [libiWmxSdk-0 >= 1.5.1], [have_wimax=yes],[have_wimax=no])
477 AC_ARG_ENABLE(wimax, AS_HELP_STRING([--enable-wimax], [enable WiMAX support]),
478                      [enable_wimax=${enableval}], [enable_wimax=${have_wimax}])
479 if (test "${enable_wimax}" = "yes"); then
480         if test x"$have_wimax" = x"no"; then
481                 AC_MSG_ERROR(Intel WiMAX SDK is required)
482         fi
483
484         # Ensure the WiMAX stack is built with libnl3; otherwise crashes happen
485         # due to symbol conflicts
486         WMX_LIB_PATH=`$PKG_CONFIG --variable=libdir libiWmxSdk-0`
487         FOO=`ldd $WMX_LIB_PATH/libiWmxSdk.so.0.0.0 | grep libnl-3 2>&1`
488         if test "$?" != "0"; then
489                 AC_MSG_ERROR([Intel WiMAX stack built with incompatible libnl version!])
490         fi
491
492         AC_SUBST(IWMX_SDK_CFLAGS)
493         AC_SUBST(IWMX_SDK_LIBS)
494         AC_DEFINE(WITH_WIMAX, 1, [Define if you have WiMAX support])
495 else
496         AC_DEFINE(WITH_WIMAX, 0, [Define if you have WiMAX support])
497 fi
498 AM_CONDITIONAL(WITH_WIMAX, test "${enable_wimax}" = "yes")
499
500 # Teamd control checks
501 PKG_CHECK_MODULES(LIBTEAMDCTL, [libteamdctl >= 1.9], [have_teamdctl=yes],[have_teamdctl=no])
502 AC_ARG_ENABLE(teamdctl, AS_HELP_STRING([--enable-teamdctl], [enable Teamd control support]),
503                      [enable_teamdctl=${enableval}], [enable_teamdctl=${have_teamdctl}])
504 if (test "${enable_teamdctl}" = "yes"); then
505         if test x"$have_teamdctl" = x"no"; then
506                 AC_MSG_ERROR(Teamd control is required)
507         fi
508
509         AC_SUBST(LIBTEAMDCTL_CFLAGS)
510         AC_SUBST(LIBTEAMDCTL_LIBS)
511         # temporary bug workaround
512         LIBTEAMDCTL_CFLAGS=`echo $LIBTEAMDCTL_CFLAGS | sed -e 's:/teamdctl.h::'`
513         AC_DEFINE(WITH_TEAMDCTL, 1, [Define if you have Teamd control support])
514 else
515         AC_DEFINE(WITH_TEAMDCTL, 0, [Define if you have Teamd control support])
516 fi
517 AM_CONDITIONAL(WITH_TEAMDCTL, test "${enable_teamdctl}" = "yes")
518
519 # we usually compile with polkit support. --enable-polkit=yes|no only sets the
520 # default configuration for main.auth-polkit. User can always enable/disable polkit
521 # autorization via config. Only when specifying --enable-polkit=disabled, we do
522 # not compile support. In this case, the user cannot enable polkit authorization via
523 # configuration.
524 AC_ARG_ENABLE(polkit, AS_HELP_STRING([--enable-polkit=yes|no|disabled], [set default value for auth-polkit configuration option. This value can be overwritten by NM configuration. 'disabled' compiles NM without any support]),
525                      [enable_polkit=${enableval}], [enable_polkit=yes])
526 if (test "${enable_polkit}" != "no" -a "${enable_polkit}" != "disabled"); then
527         enable_polkit=yes
528         AC_DEFINE(NM_CONFIG_DEFAULT_AUTH_POLKIT, TRUE, [The default value of the auth-polkit configuration option])
529         NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT='true'
530 else
531         AC_DEFINE(NM_CONFIG_DEFAULT_AUTH_POLKIT, FALSE, [The default value of the auth-polkit configuration option])
532         NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT='false'
533 fi
534 if (test "${enable_polkit}" != "disabled"); then
535         AC_DEFINE(WITH_POLKIT, 1, [whether to compile polkit support])
536 else
537         AC_DEFINE(WITH_POLKIT, 0, [whether to compile polkit support])
538 fi
539 AC_SUBST(NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT)
540
541 PKG_CHECK_MODULES(POLKIT, [polkit-agent-1 >= 0.97], [have_pk_agent=yes],[have_pk_agent=no])
542 AC_ARG_ENABLE(polkit-agent, AS_HELP_STRING([--enable-polkit-agent], [enable polkit agent for clients]),
543                      [enable_polkit_agent=${enableval}], [enable_polkit_agent=${have_pk_agent}])
544 if (test "${enable_polkit_agent}" = "yes"); then
545         if test x"$have_pk_agent" = x"no"; then
546                 AC_MSG_ERROR(Polkit agent is required)
547         fi
548
549         AC_SUBST(POLKIT_CFLAGS)
550         AC_SUBST(POLKIT_LIBS)
551         AC_DEFINE(WITH_POLKIT_AGENT, 1, [Define if you have polkit agent])
552 else
553         AC_DEFINE(WITH_POLKIT_AGENT, 0, [Define if you have polkit agent])
554 fi
555 AM_CONDITIONAL(WITH_POLKIT_AGENT, test "${enable_polkit_agent}" = "yes")
556
557 AC_ARG_ENABLE(modify-system,
558               AS_HELP_STRING([--enable-modify-system], [Allow users to modify system connections]))
559 if test "${enable_modify_system}" = "yes"; then
560         NM_MODIFY_SYSTEM_POLICY="yes"
561 else
562         NM_MODIFY_SYSTEM_POLICY="auth_admin_keep"
563 fi
564 AC_SUBST(NM_MODIFY_SYSTEM_POLICY)
565
566 AC_ARG_WITH(crypto, AS_HELP_STRING([--with-crypto=nss|gnutls], [Cryptography library to use for certificate and key operations]),ac_crypto=$withval, ac_crypto=nss)
567
568 with_nss=no
569 with_gnutls=no
570 if test x"$ac_crypto" = xnss; then
571   PKG_CHECK_MODULES(NSS, [nss >= 3.11])
572
573   # Work around a pkg-config bug (fdo #29801) where exists != usable
574   FOO=`$PKG_CONFIG --cflags --libs nss`
575   if test x"$?" != "x0"; then
576     AC_MSG_ERROR([No usable NSS found])
577   fi
578
579   AC_SUBST(NSS_CFLAGS)
580   AC_SUBST(NSS_LIBS)
581   AC_DEFINE(HAVE_NSS, 1, [Define if you have NSS])
582   with_nss=yes
583 elif test x"$ac_crypto" = xgnutls; then
584   PKG_CHECK_MODULES(GNUTLS, [gnutls >= 1.2])
585   AC_PATH_PROG(LIBGCRYPT_CONFIG, libgcrypt-config, no)
586   if test x"$LIBGCRYPT_CONFIG" = xno; then
587     AC_MSG_ERROR([gnutls explicitly requested but gcrypt not found on system])
588   else
589     AC_DEFINE(HAVE_GNUTLS, 1, [Define if you have libgnutls])
590     LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags`
591     LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs`
592     AC_SUBST(LIBGCRYPT_CFLAGS)
593     AC_SUBST(LIBGCRYPT_LIBS)
594     with_gnutls=yes
595   fi
596 else
597   AC_MSG_ERROR([Please choose either 'nss' or 'gnutls' for certificate and crypto operations])
598 fi
599 AM_CONDITIONAL(WITH_NSS, test x"$with_nss" != xno)
600 AM_CONDITIONAL(WITH_GNUTLS, test x"$with_gnutls" != xno)
601
602 # Shouldn't ever trigger this, but just in case...
603 if test x"$ac_nss" = xno -a x"$ac_gnutls" = xno; then
604   AC_MSG_ERROR([Could not find required development headers and libraries for '$ac_crypto'])
605 fi
606
607 GLIB_MAKEFILE='$(top_srcdir)/Makefile.glib'
608 AC_SUBST(GLIB_MAKEFILE)
609 GLIB_GENMARSHAL=`pkg-config --variable=glib_genmarshal glib-2.0`
610 AC_SUBST(GLIB_GENMARSHAL)
611 GLIB_MKENUMS=`pkg-config --variable=glib_mkenums glib-2.0`
612 AC_SUBST(GLIB_MKENUMS)
613
614 AC_ARG_WITH(dbus-sys-dir, AS_HELP_STRING([--with-dbus-sys-dir=DIR], [where D-BUS system.d directory is]))
615
616 if test -n "$with_dbus_sys_dir" ; then
617     DBUS_SYS_DIR="$with_dbus_sys_dir"
618 else
619     DBUS_SYS_DIR="${sysconfdir}/dbus-1/system.d"
620 fi
621 AC_SUBST(DBUS_SYS_DIR)
622
623 # pppd
624 AC_ARG_ENABLE(ppp, AS_HELP_STRING([--enable-ppp], [enable PPP/PPPoE support]),
625                      [enable_ppp=${enableval}], [enable_ppp=yes])
626 if (test "${enable_ppp}" = "yes"); then
627         AC_CHECK_HEADERS(pppd/pppd.h,,
628                 AC_MSG_ERROR("couldn't find pppd.h. pppd development headers are required."))
629
630         AC_DEFINE(WITH_PPP, 1, [Define if you have PPP support])
631 else
632         AC_DEFINE(WITH_PPP, 0, [Define if you have PPP support])
633 fi
634 AM_CONDITIONAL(WITH_PPP, test "${enable_ppp}" = "yes")
635
636 AC_ARG_WITH([pppd-plugin-dir], AS_HELP_STRING([--with-pppd-plugin-dir=DIR], [path to the pppd plugins directory]))
637
638 if test -n "$with_pppd_plugin_dir" ; then
639         PPPD_PLUGIN_DIR="$with_pppd_plugin_dir"
640 else
641         PPPD_PLUGIN_DIR="${libdir}/pppd/2.4.5"
642 fi
643 AC_SUBST(PPPD_PLUGIN_DIR)
644
645 AC_ARG_WITH(pppd, AS_HELP_STRING([--with-pppd=/path/to/pppd], [path to pppd binary]))
646 if test "x${with_pppd}" = x; then
647   AC_PATH_PROG(PPPD_PATH, pppd, [], $PATH:/sbin:/usr/sbin)
648 else
649   PPPD_PATH="$with_pppd"
650 fi
651 AC_DEFINE_UNQUOTED(PPPD_PATH, "$PPPD_PATH", [Define to path of pppd binary])
652 AC_SUBST(PPPD_PATH)
653
654 AC_ARG_WITH(pppoe, AS_HELP_STRING([--with-pppoe=/path/to/pppoe], [path to pppoe binary]))
655 if test "x${with_pppoe}" = x; then
656   AC_PATH_PROG(PPPOE_PATH, pppoe, [], $PATH:/sbin:/usr/sbin)
657 else
658   PPPOE_PATH="$with_pppoe"
659 fi
660 AC_DEFINE_UNQUOTED(PPPOE_PATH, "$PPPOE_PATH", [Define to path of pppoe binary])
661 AC_SUBST(PPPOE_PATH)
662
663 # ModemManager1 with libmm-glib
664 AC_ARG_WITH(modem-manager-1, AS_HELP_STRING([--with-modem-manager-1], [Enable new ModemManager1 interface support]),,[with_modem_manager_1=auto])
665 if (test "${with_modem_manager_1}" != "no"); then
666     PKG_CHECK_MODULES(MM_GLIB,
667                       [mm-glib >= 0.7.991],
668                       [have_libmm_glib=yes],
669                       [have_libmm_glib=no])
670     AC_SUBST(MM_GLIB_CFLAGS)
671     AC_SUBST(MM_GLIB_LIBS)
672
673     if (test "${have_libmm_glib}" = "no"); then
674         if (test "${with_modem_manager_1}" = "yes"); then
675             AC_MSG_ERROR([Couldn't find libmm-glib])
676         else
677             with_modem_manager_1="no"
678         fi
679     else
680         with_modem_manager_1="yes"
681     fi
682 fi
683
684 if (test "${with_modem_manager_1}" = "yes"); then
685     AC_DEFINE(WITH_MODEM_MANAGER_1, 1, [Define if you have ModemManager1 support])
686 else
687         AC_DEFINE(WITH_MODEM_MANAGER_1, 0, [Define if you have ModemManager1 support])
688 fi
689 AM_CONDITIONAL(WITH_MODEM_MANAGER_1, test "${with_modem_manager_1}" = "yes")
690
691 # Bluez5 DUN support
692 PKG_CHECK_MODULES(BLUEZ5, [bluez >= 5], [have_bluez5=yes],[have_bluez5=no])
693 AC_ARG_ENABLE(bluez5-dun, AS_HELP_STRING([--enable-bluez5-dun], [enable Bluez5 DUN support]),
694                 [enable_bluez5_dun=${enableval}], [enable_bluez5_dun=${have_bluez5}])
695 if (test "${enable_bluez5_dun}" = "yes"); then
696         if test x"$have_bluez5" = x"no"; then
697                 AC_MSG_ERROR(Bluez 5.x development headers are required)
698         fi
699         AC_DEFINE(WITH_BLUEZ5_DUN, 1, [Define if you have Bluez 5 libraries])
700 else
701         AC_DEFINE(WITH_BLUEZ5_DUN, 0, [Define if you have Bluez 5 libraries])
702 fi
703 AM_CONDITIONAL(WITH_BLUEZ5_DUN, test "${enable_bluez5_dun}" = "yes")
704
705 # DHCP client support
706 AC_ARG_WITH([dhclient], AS_HELP_STRING([--with-dhclient=yes|no|path], [Enable dhclient 4.x support]))
707 AC_ARG_WITH([dhcpcd], AS_HELP_STRING([--with-dhcpcd=yes|no|path], [Enable dhcpcd 4.x support]))
708 # Default to "yes"
709 AS_IF([test -z "$with_dhclient"], with_dhclient=yes)
710 AS_IF([test -z "$with_dhcpcd"], with_dhcpcd=yes)
711 # Search and check the executables
712 if test "$with_dhclient" = "yes"; then
713         AC_PATH_PROGS(with_dhclient, dhclient, no, /sbin:/usr/sbin:/usr/local/sbin)
714         if test "$with_dhclient" != "no"; then
715                 if ! $with_dhclient --version 2>&1 | grep -q "^isc-dhclient-4\."; then
716                         AC_MSG_WARN([Cannot use dhclient, version 4.x is required])
717                         with_dhclient=no
718                 fi
719         fi
720 fi
721 if test "$with_dhcpcd" = "yes"; then
722         AC_PATH_PROGS(with_dhcpcd, dhcpcd, no, /sbin:/usr/sbin:/usr/local/sbin)
723         if test "$with_dhcpcd" != "no"; then
724                 if ! $with_dhcpcd --version 2>&1 | grep -q "^dhcpcd [456789]\."; then
725                         AC_MSG_WARN([Cannot use dhcpcd, version 4.x or higher is required])
726                         with_dhcpcd=no
727                 elif $with_dhcpcd --version 2>&1 | grep -q "^dhcpcd [6789]\."; then
728                         AC_DEFINE(DHCPCD_SUPPORTS_IPV6, 1, [Define if dhcpcd supports IPv6 (6.x+)])
729                 fi
730         fi
731 fi
732 # Fallback
733 if test "$with_dhclient" = "no" -a "$with_dhcpcd" = "no"; then
734         AC_MSG_WARN([Could not find a suitable DHCP client, falling back to dhclient])
735         with_dhclient=/sbin/dhclient
736 fi
737 # Add substitutions
738 if test "$with_dhclient" != "no"; then
739         AC_DEFINE(WITH_DHCLIENT, TRUE, [Define if you have dhclient])
740         AC_SUBST(DHCLIENT_PATH, $with_dhclient)
741 else
742         AC_DEFINE(WITH_DHCLIENT, FALSE, [Define if you have dhclient])
743 fi
744 if test "$with_dhcpcd" != "no"; then
745         AC_DEFINE(WITH_DHCPCD, TRUE, [Define if you have dhcpcd])
746         AC_SUBST(DHCPCD_PATH, $with_dhcpcd)
747 else
748         AC_DEFINE(WITH_DHCPCD, FALSE, [Define if you have dhcpcd])
749 fi
750
751 # resolvconf and netconfig support
752 AC_ARG_WITH(resolvconf, AS_HELP_STRING([--with-resolvconf=yes|no|path], [Enable resolvconf support]))
753 AC_ARG_WITH(netconfig, AS_HELP_STRING([--with-netconfig=yes|no], [Enable SUSE netconfig support]))
754 # Use netconfig by default on SUSE
755 AS_IF([test -z "$with_netconfig"], AC_CHECK_FILE(/etc/SuSE-release, with_netconfig=yes))
756 # Otherwise default to "no"
757 AS_IF([test -z "$with_resolvconf"], with_resolvconf=no)
758 AS_IF([test -z "$with_netconfig"], with_netconfig=no)
759 # Find resolvconf and netconfig
760 if test "$with_resolvconf" = "yes"; then
761         AC_PATH_PROGS(with_resolvconf, resolvconf, no, /sbin:/usr/sbin:/usr/local/sbin)
762 fi
763 if test "$with_netconfig" = "yes"; then
764         AC_PATH_PROGS(with_netconfig, netconfig, no, /sbin:/usr/sbin:/usr/local/sbin)
765 fi
766 # Define resolvconf and netconfig paths
767 if test "$with_resolvconf" != "no"; then
768         AC_DEFINE_UNQUOTED(RESOLVCONF_PATH, "$with_resolvconf", [Path to resolvconf (if enabled)])
769 fi
770 if test "$with_netconfig" != "no"; then
771         AC_DEFINE_UNQUOTED(NETCONFIG_PATH, "$with_netconfig", [Path to netconfig (if enabled)])
772 fi
773
774 # iptables path
775 AC_ARG_WITH(iptables, AS_HELP_STRING([--with-iptables=/path/to/iptables], [path to iptables]))
776 if test "x${with_iptables}" = x; then
777   AC_PATH_PROG(IPTABLES_PATH, iptables, [], $PATH:/sbin:/usr/sbin)
778   if ! test -x "$IPTABLES_PATH"; then
779         AC_MSG_ERROR(iptables was not installed.)
780   fi
781 else
782   IPTABLES_PATH="$with_iptables"
783 fi
784 AC_DEFINE_UNQUOTED(IPTABLES_PATH, "$IPTABLES_PATH", [Define to path of iptables binary])
785 AC_SUBST(IPTABLES_PATH)
786
787 # dnsmasq path
788 AC_ARG_WITH(dnsmasq, AS_HELP_STRING([--with-dnsmasq=/path/to/dnsmasq], [path to dnsmasq]))
789 if test "x${with_dnsmasq}" = x; then
790   AC_PATH_PROG(DNSMASQ_PATH, dnsmasq, [], $PATH:/sbin:/usr/sbin)
791 else
792   DNSMASQ_PATH="$with_dnsmasq"
793 fi
794 AC_DEFINE_UNQUOTED(DNSMASQ_PATH, "$DNSMASQ_PATH", [Define to path of dnsmasq binary])
795 AC_SUBST(DNSMASQ_PATH)
796
797 # system CA certificates path
798 AC_ARG_WITH(system-ca-path, AS_HELP_STRING([--with-system-ca-path=/path/to/ssl/certs], [path to system CA certificates])) 
799 if test "x${with_system_ca_path}" = x; then
800   SYSTEM_CA_PATH=/etc/ssl/certs
801 else
802   SYSTEM_CA_PATH="$with_system_ca_path"
803 fi
804 AC_DEFINE_UNQUOTED(SYSTEM_CA_PATH, "$SYSTEM_CA_PATH", [Define to path to system CA certificates])
805 AC_SUBST(SYSTEM_CA_PATH)
806
807 AC_ARG_WITH(kernel-firmware-dir, AS_HELP_STRING([--with-kernel-firmware-dir=DIR], [where kernel firmware directory is (default is /lib/firmware)]))
808
809 if test -n "$with_kernel_firmware_dir" ; then
810     KERNEL_FIRMWARE_DIR="$with_kernel_firmware_dir"
811 else
812     KERNEL_FIRMWARE_DIR="/lib/firmware"
813 fi
814 AC_DEFINE_UNQUOTED(KERNEL_FIRMWARE_DIR, "$KERNEL_FIRMWARE_DIR", [Define to path of the kernel firmware directory])
815 AC_SUBST(KERNEL_FIRMWARE_DIR)
816
817 PKG_CHECK_MODULES(LIBSOUP, [libsoup-2.4 >= 2.26], [have_libsoup=yes],[have_libsoup=no])
818 AC_ARG_WITH(libsoup, AS_HELP_STRING([--with-libsoup=yes|no], [Link against libsoup]), [], [with_libsoup=${have_libsoup}])
819 if test "$with_libsoup" != "no"; then
820         if test "$have_libsoup" != "yes"; then
821                 AC_MSG_ERROR(libsoup library not found)
822         fi
823         with_libsoup='yes'
824         AC_DEFINE(WITH_LIBSOUP, 1, [Define if you have libsoup])
825 else
826         AC_DEFINE(WITH_LIBSOUP, 0, [Define if you have libsoup])
827 fi
828 AM_CONDITIONAL(WITH_LIBSOUP, test "$with_libsoup" != "no")
829
830 AC_ARG_ENABLE(concheck, AS_HELP_STRING([--enable-concheck], [enable connectivity checking support]),
831                      [enable_concheck=${enableval}], [enable_concheck=${with_libsoup}])
832 if (test "${enable_concheck}" = "yes"); then
833         if test x"$with_libsoup" = x"no"; then
834                 AC_MSG_ERROR(Connectivity checking requires libsoup)
835         fi
836         AC_SUBST(LIBSOUP_CFLAGS)
837         AC_SUBST(LIBSOUP_LIBS)
838         AC_DEFINE(WITH_CONCHECK, 1, [Define if you want connectivity checking support])
839 else
840         AC_DEFINE(WITH_CONCHECK, 0, [Define if you want connectivity checking support])
841 fi
842 AM_CONDITIONAL(WITH_CONCHECK, test "${enable_concheck}" = "yes")
843
844 PKG_CHECK_MODULES(LIBNDP, [libndp])
845
846 AC_ARG_WITH(nmtui, AS_HELP_STRING([--with-nmtui=yes|no], [Build nmtui]))
847 if test "$with_nmtui" != no; then
848     PKG_CHECK_MODULES(NEWT, [libnewt >= 0.52.15], [build_nmtui=yes], [build_nmtui=no])
849 else
850     build_nmtui=no
851 fi
852 if test "$with_nmtui" = yes -a "$build_nmtui" = no; then
853     AC_MSG_ERROR([You must have libnewt installed to build nmtui.])
854 fi
855 AM_CONDITIONAL(BUILD_NMTUI, test "$build_nmtui" = yes)
856
857
858 NM_COMPILER_WARNINGS
859
860 AC_ARG_ENABLE(lto, AS_HELP_STRING([--enable-lto], [Enable Link Time Optimization for smaller size (default: no)]))
861 if (test "${enable_lto}" = "yes"); then
862     CFLAGS="-flto $CFLAGS"
863 else
864     enable_lto='no'
865 fi
866
867
868 dnl -------------------------
869 dnl Vala bindings
870 dnl -------------------------
871
872 VAPIGEN_CHECK(0.17.1.24)
873
874 # Tests, utilities and documentation
875 AC_ARG_ENABLE(tests, AS_HELP_STRING([--enable-tests=root|yes|no], [Build NetworkManager tests (default: yes)]))
876 AC_ARG_WITH(valgrind, AS_HELP_STRING([--with-valgrind=yes|no|path], [Use valgrind to memory-check the tests (default: no)]))
877 # Fallback to --with-tests
878 AC_ARG_WITH(tests, AS_HELP_STRING([--with-tests], [Build NetworkManager tests (deprecated)]))
879 AS_IF([test -n "$with_tests"], enable_tests="$with_tests")
880 # Default to --enable-tests --with-valgrind=no
881 AS_IF([test -z "$enable_tests"], enable_tests="yes")
882 AS_IF([test -z "$with_valgrind"], with_valgrind="no")
883 # Normalize values
884 AS_IF([test "$enable_tests" != "yes" -a "$enable_tests" != "root"], enable_tests="no")
885 # Search for tools
886 AS_IF([test "$with_valgrind" == "yes"],
887         [AC_PATH_PROGS(with_valgrind, valgrind, no)])
888 # Add conditionals and substitutions
889 AM_CONDITIONAL(ENABLE_TESTS, test "$enable_tests" != "no")
890 AM_CONDITIONAL(REQUIRE_ROOT_TESTS, test "$enable_tests" == "root")
891 AS_IF([test "$with_valgrind" != "no"],
892         AC_SUBST(VALGRIND_RULES, 'TESTS_ENVIRONMENT = "$(top_srcdir)/tools/run-test-valgrind.sh" "$(LIBTOOL)" "$(with_valgrind)" "$(top_srcdir)/valgrind.suppressions"'),
893         AC_SUBST(VALGRIND_RULES, []))
894 AM_CONDITIONAL(WITH_VALGRIND, test "${with_valgrind}" != "no")
895
896 GTK_DOC_CHECK(1.0)
897
898 # check for pregenerated manpages to be installed
899 install_pregen_manpages=no
900 if test "$enable_gtk_doc" != "yes" \
901         -a -f man/NetworkManager.conf.5 \
902         -a -f man/nm-settings.5 \
903         -a -f man/nm-settings-keyfile.5 \
904         -a -f man/nm-settings-ifcfg-rh.5 \
905         -a -f man/nmcli-examples.5 \
906         -a -f man/NetworkManager.8; then
907         install_pregen_manpages=yes
908 fi
909 AM_CONDITIONAL(INSTALL_PREGEN_MANPAGES, test "x${install_pregen_manpages}" = "xyes")
910
911 # check if we can build setting property documentation
912 if test -n "$INTROSPECTION_MAKEFILE" -a "$enable_gtk_doc" = "yes"; then
913     # If g-i is installed we know we have python, but we might not have pygobject
914     if python -c 'from gi.repository import GObject' >& /dev/null; then
915         have_pyobject=yes
916     fi
917
918     # gtk-doc depends on perl, but we can check for it anyway
919     AC_PATH_PROG(PERL, perl, no)
920     # check for needed perl modules (use YAML; YAML::XS is better, but may not be so widespread)
921     required_perl_modules="YAML"
922     for module in $required_perl_modules; do
923       AC_MSG_CHECKING([checking for perl module '$module'])
924       if ${PERL} -e 'use '$module 2>/dev/null ; then
925           AC_MSG_RESULT([Ok])
926           have_perl_modules=yes
927       else
928           AC_MSG_RESULT([Failed])
929           AC_MSG_ERROR([You must have Perl modules to build settings plugin docs: $required_perl_modules.])
930       fi
931     done
932
933     if test "$have_pyobject" = "yes" -a "$have_perl_modules" = "yes"; then
934         AC_DEFINE(BUILD_SETTING_DOCS, [1], [Define if you we can build nm-setting-docs.xml, nm-keyfile-docs.xml and nm-ifcfg-rh-docs.xml])
935         build_setting_docs=yes
936     fi
937 fi
938
939 # check for pre-built setting docs
940 if test "$build_setting_docs" != "yes" \
941         -a -f man/nm-settings.xml \
942         -a -f man/nm-settings-keyfile.xml \
943         -a -f man/nm-settings-ifcfg-rh.xml \
944         -a -f docs/api/settings-spec.xml \
945         -a -f clients/cli/settings-docs.c; then
946     AC_DEFINE(HAVE_SETTING_DOCS, [1], [Define if you have pre-built settings docs])
947     have_setting_docs=yes
948 fi
949
950 AM_CONDITIONAL(BUILD_SETTING_DOCS, test "$build_setting_docs" = "yes")
951 AM_CONDITIONAL(SETTING_DOCS_AVAILABLE, test "$build_setting_docs" = "yes" -o "$have_setting_docs" = "yes")
952
953
954 AC_CONFIG_FILES([
955 Makefile
956 include/Makefile
957 src/Makefile
958 src/tests/Makefile
959 src/tests/config/Makefile
960 src/dhcp-manager/Makefile
961 src/dhcp-manager/tests/Makefile
962 src/dnsmasq-manager/tests/Makefile
963 src/supplicant-manager/tests/Makefile
964 src/ppp-manager/Makefile
965 src/settings/plugins/Makefile
966 src/settings/plugins/ifupdown/Makefile
967 src/settings/plugins/ifupdown/tests/Makefile
968 src/settings/plugins/ifnet/Makefile
969 src/settings/plugins/ifnet/tests/Makefile
970 src/settings/plugins/ifcfg-rh/Makefile
971 src/settings/plugins/ifcfg-rh/tests/Makefile
972 src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile
973 src/settings/plugins/ibft/Makefile
974 src/settings/plugins/ibft/tests/Makefile
975 src/settings/plugins/ifcfg-suse/Makefile
976 src/settings/plugins/keyfile/Makefile
977 src/settings/plugins/keyfile/tests/Makefile
978 src/settings/plugins/keyfile/tests/keyfiles/Makefile
979 src/settings/plugins/example/Makefile
980 src/platform/Makefile
981 src/platform/tests/Makefile
982 src/rdisc/Makefile
983 src/rdisc/tests/Makefile
984 src/devices/adsl/Makefile
985 src/devices/wimax/Makefile
986 src/devices/bluetooth/Makefile
987 src/devices/team/Makefile
988 src/devices/wifi/Makefile
989 src/devices/wifi/tests/Makefile
990 src/devices/wwan/Makefile
991 libnm-core/nm-version.h
992 libnm-core/Makefile
993 libnm-core/tests/Makefile
994 libnm/libnm.pc
995 libnm/Makefile
996 libnm/tests/Makefile
997 libnm-util/libnm-util.pc
998 libnm-util/nm-version.h
999 libnm-util/Makefile
1000 libnm-util/tests/Makefile
1001 libnm-glib/libnm-glib.pc
1002 libnm-glib/libnm-glib-vpn.pc
1003 libnm-glib/Makefile
1004 libnm-glib/tests/Makefile
1005 callouts/Makefile
1006 callouts/tests/Makefile
1007 tools/Makefile
1008 clients/Makefile
1009 clients/cli/Makefile
1010 clients/tui/Makefile
1011 clients/tui/newt/Makefile
1012 initscript/RedHat/NetworkManager
1013 initscript/Debian/NetworkManager
1014 initscript/Slackware/rc.networkmanager
1015 initscript/SUSE/networkmanager
1016 initscript/Arch/networkmanager
1017 initscript/Mandriva/networkmanager
1018 initscript/linexa/networkmanager
1019 introspection/Makefile
1020 introspection/all.xml
1021 man/Makefile
1022 man/NetworkManager.conf.xml
1023 man/nm-system-settings.conf.5
1024 man/nm-online.1
1025 man/nmcli.1
1026 man/nmtui.1
1027 po/Makefile.in
1028 policy/Makefile
1029 policy/org.freedesktop.NetworkManager.policy.in
1030 data/Makefile
1031 docs/Makefile
1032 docs/api/Makefile
1033 docs/api/version.xml
1034 docs/libnm-glib/Makefile
1035 docs/libnm-glib/version.xml
1036 docs/libnm-util/Makefile
1037 docs/libnm-util/version.xml
1038 docs/libnm/Makefile
1039 docs/libnm/version.xml
1040 NetworkManager.pc
1041 examples/Makefile
1042 examples/shell/Makefile
1043 examples/python/Makefile
1044 examples/python/dbus/Makefile
1045 examples/python/gi/Makefile
1046 examples/ruby/Makefile
1047 examples/lua/Makefile
1048 examples/lua/lgi/Makefile
1049 examples/C/Makefile
1050 examples/C/glib/Makefile
1051 examples/C/qt/Makefile
1052 examples/dispatcher/Makefile
1053 vapi/Makefile
1054 ])
1055 AC_CONFIG_SUBDIRS([libndp])
1056 AC_OUTPUT
1057
1058 # Print build configuration
1059 echo
1060 echo "System paths:"
1061 echo "  prefix: $prefix"
1062 echo "  exec_prefix: $exec_prefix"
1063 echo "  systemdunitdir: $with_systemdsystemunitdir"
1064 echo "  nmbinary: $nmbinary"
1065 echo "  nmconfdir: $nmconfdir"
1066 echo "  nmdatadir: $nmdatadir"
1067 echo "  nmstatedir: $nmstatedir"
1068 echo "  nmrundir: $nmrundir"
1069 echo
1070
1071 echo "Platform:"
1072 echo "  session tracking: $session_tracking"
1073 echo "  suspend/resume: $with_suspend_resume"
1074 if test "${enable_polkit}" = "yes"; then
1075         if test "${enable_modify_system}" = "yes"; then
1076                 echo "  policykit: yes (permissive modify.system) (default=${enable_polkit})"
1077         else
1078                 echo "  policykit: yes (restrictive modify.system) (default=${enable_polkit})"
1079         fi
1080 else
1081         echo  "  policykit: no"
1082 fi
1083 echo "  polkit agent: ${enable_polkit_agent}"
1084 echo "  selinux: $have_selinux"
1085 echo
1086
1087 echo "Features:"
1088 echo "  wext: $ac_with_wext"
1089 echo "  wifi: $enable_wifi"
1090 echo "  wimax: $enable_wimax"
1091 echo "  ppp: $enable_ppp"
1092 echo "  modemmanager-1: $with_modem_manager_1"
1093 echo "  concheck: $enable_concheck"
1094 echo "  libteamdctl: $enable_teamdctl"
1095 echo "  nmtui: $build_nmtui"
1096 echo
1097
1098 echo "Configuration plugins (main.plugins=${config_plugins_default})"
1099 echo "  ibft: ${enable_config_plugin_ibft}"
1100 echo "  ifcfg-rh: ${enable_ifcfg_rh}"
1101 echo "  ifcfg-suse: ${enable_ifcfg_suse}"
1102 echo "  ifupdown: ${enable_ifupdown}"
1103 echo "  ifnet: ${enable_ifnet}"
1104 echo
1105
1106 echo "Handlers for /etc/resolv.conf:"
1107 echo "  resolvconf: ${with_resolvconf}"
1108 echo "  netconfig: ${with_netconfig}"
1109 echo
1110
1111 echo "DHCP clients:"
1112 echo "  dhclient: $with_dhclient"
1113 echo "  dhcpcd: $with_dhcpcd"
1114 echo
1115
1116 echo "Miscellaneous:"
1117 echo "  documentation: $enable_gtk_doc"
1118 echo "  tests: $enable_tests"
1119 echo "  valgrind: $with_valgrind"
1120 echo "  code coverage: $enable_code_coverage"
1121 echo "  LTO: $enable_lto"
1122 echo