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