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