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