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