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