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