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