configure.ac 53.4 KB
Newer Older
1
AC_PREREQ([2.63])
Dan Williams's avatar
Dan Williams committed
2

3
dnl The NM version number
4
dnl
5
dnl NOTE: When incrementing version also:
6 7 8
dnl  - add corresponding NM_VERSION_x_y_z macros in
dnl    "shared/nm-version-macros.h.in"
dnl  - update number in meson.build
9
m4_define([nm_major_version], [1])
10
m4_define([nm_minor_version], [13])
11
m4_define([nm_micro_version], [90])
12
m4_define([nm_version],
Dan Williams's avatar
Dan Williams committed
13
          [nm_major_version.nm_minor_version.nm_micro_version])
14 15

AC_INIT([NetworkManager], [nm_version],
Dan Williams's avatar
Dan Williams committed
16
        [http://bugzilla.gnome.org/enter_bug.cgi?product=NetworkManager],
17
        [NetworkManager])
Dan Williams's avatar
Dan Williams committed
18

19
AC_CONFIG_HEADERS([config.h])
Michael Biebl's avatar
Michael Biebl committed
20
AC_CONFIG_MACRO_DIR([m4])
21
AC_CONFIG_AUX_DIR([build-aux])
Lubomir Rintel's avatar
Lubomir Rintel committed
22
AC_REQUIRE_AUX_FILE([tap-driver.sh])
Michael Biebl's avatar
Michael Biebl committed
23

24
AM_INIT_AUTOMAKE(1.12 tar-ustar no-dist-gzip dist-xz -Wno-portability)  dnl NB: Do not [quote] this parameter.
25
AM_MAINTAINER_MODE([enable])
Adrian Bunk's avatar
Adrian Bunk committed
26
AM_SILENT_RULES([yes])
27 28 29

dnl Define _SYSTEM_EXTENSIONS for various things like strcasestr()
AC_USE_SYSTEM_EXTENSIONS
Michael Biebl's avatar
Michael Biebl committed
30

31 32 33
dnl
dnl Require programs
dnl
Dan Williams's avatar
Dan Williams committed
34
AC_PROG_CC
35
AM_PROG_CC_C_O
36

37 38 39
# C++ only required if --enable-qt=yes
AC_PROG_CXX

Michael Biebl's avatar
Michael Biebl committed
40
AC_PROG_LN_S
41
AC_PROG_MKDIR_P
Michael Biebl's avatar
Michael Biebl committed
42

43 44 45
# Prefer gcc-* variants; the ones libtool would choose don't work with LTO
AC_CHECK_TOOLS(AR, [gcc-ar ar], false)
AC_CHECK_TOOLS(RANLIB, [gcc-ranlib ranlib], :)
46
AC_CHECK_TOOLS(NM, [$BINUTILS_NM gcc-nm nm])
47

48 49
dnl Initialize libtool
LT_PREREQ([2.2])
50
LT_INIT([disable-static])
51

52 53 54 55 56 57 58 59 60
dnl Version stuff
NM_MAJOR_VERSION=nm_major_version
NM_MINOR_VERSION=nm_minor_version
NM_MICRO_VERSION=nm_micro_version
NM_VERSION=nm_version
AC_SUBST(NM_MAJOR_VERSION)
AC_SUBST(NM_MINOR_VERSION)
AC_SUBST(NM_MICRO_VERSION)
AC_SUBST(NM_VERSION)
61 62

GIT_SHA_RECORD(NM_GIT_SHA)
63

64 65 66 67
dnl
dnl Checks for typedefs, structures, and compiler characteristics.
dnl
AC_TYPE_PID_T
68
AC_CHECK_SIZEOF(dev_t)
69
AC_CHECK_SIZEOF(time_t)
70
AC_CHECK_SIZEOF(pid_t)
71

72 73 74 75 76
AC_CHECK_DECLS([
	explicit_bzero],
	[], [], [[
#include <string.h>
]])
77

78 79 80 81 82 83
AC_CHECK_DECLS([
	reallocarray],
	[], [], [[
#include <malloc.h>
]])

84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
AC_CHECK_HEADERS(sys/auxv.h)

AC_CHECK_DECLS([getrandom],
               [AC_DEFINE([USE_SYS_RANDOM_H], [1], [sys/random.h is usable])
                AC_DEFINE([HAVE_GETRANDOM], [1], [has getrandom])
               ],
               [AC_CHECK_DECLS([getrandom],
                               [AC_DEFINE([USE_SYS_RANDOM_H], [0], [sys/random.h is usable])
                                AC_DEFINE([HAVE_GETRANDOM], [1], [has getrandom])],
                               [AC_DEFINE([USE_SYS_RANDOM_H], [0], [sys/random.h is usable])
                                AC_DEFINE([HAVE_GETRANDOM], [0], [has getrandom])],
                               [[#include <linux/random.h>
                                 ]])],
               [[#include <sys/random.h>
                 ]])
99

100 101 102
dnl
dnl translation support
dnl
103 104 105 106 107
IT_PROG_INTLTOOL([0.40.0])

AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.17])

108 109 110 111
GETTEXT_PACKAGE=NetworkManager
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])

112 113 114 115
# Add runstatedir if not specified manually in autoconf < 2.70
AS_IF([test -z "$runstatedir"], runstatedir="$localstatedir/run")
AC_SUBST(runstatedir)

116
# NetworkManager paths
117 118 119 120 121 122
AC_SUBST(nmbinary, '${sbindir}'/$PACKAGE, [NetworkManager binary executable])
AC_SUBST(nmconfdir, '${sysconfdir}'/$PACKAGE, [NetworkManager configuration directory])
AC_SUBST(nmlibdir, '${prefix}'/lib/$PACKAGE, [NetworkManager library directory])
AC_SUBST(nmdatadir, '${datadir}'/$PACKAGE, [NetworkManager shared data directory])
AC_SUBST(nmstatedir, '${localstatedir}'/lib/$PACKAGE, [NetworkManager persistent state directory])
AC_SUBST(nmrundir, '${runstatedir}'/$PACKAGE, [NetworkManager runtime state directory])
123

124 125 126
AC_GNU_SOURCE
AC_CHECK_FUNCS([__secure_getenv secure_getenv])

127
# Alternative configuration plugins
128
AC_ARG_ENABLE(config-plugin-ibft, AS_HELP_STRING([--enable-config-plugin-ibft], [enable ibft configuration plugin]))
129 130 131
AC_ARG_ENABLE(ifcfg-rh, AS_HELP_STRING([--enable-ifcfg-rh], [enable ifcfg-rh configuration plugin (Fedora/RHEL)]))
AC_ARG_ENABLE(ifupdown, AS_HELP_STRING([--enable-ifupdown], [enable ifupdown configuration plugin (Debian/Ubuntu)]))
# Default alternative plugins by distribution
132 133
AS_IF([test -z "$enable_ifcfg_rh" -a -d /etc/sysconfig/network-scripts], enable_ifcfg_rh=yes)
AS_IF([test -z "$enable_ifupdown" -a -f /etc/debian_version],            enable_ifupdown=yes)
134 135 136
# Otherwise plugins default to "no"
AS_IF([test -z "$enable_ifcfg_rh"], enable_ifcfg_rh=no)
AS_IF([test -z "$enable_ifupdown"], enable_ifupdown=no)
137 138
# Enable ibft by default
AS_IF([test -z "$enable_config_plugin_ibft"], enable_config_plugin_ibft="yes")
139
# Create automake conditionals
140
AM_CONDITIONAL(CONFIG_PLUGIN_IBFT, test "$enable_config_plugin_ibft" = "yes")
141 142
AM_CONDITIONAL(CONFIG_PLUGIN_IFCFG_RH, test "$enable_ifcfg_rh" = "yes")
AM_CONDITIONAL(CONFIG_PLUGIN_IFUPDOWN, test "$enable_ifupdown" = "yes")
143

144 145 146 147
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=""])
148
if test -z "$config_plugins_default" -o "$config_plugins_default" = no; then
149 150 151 152 153
	config_plugins_default=''
	test "$enable_ifcfg_rh" = "yes"           && config_plugins_default="$config_plugins_default,ifcfg-rh"
	test "$enable_ifupdown" = "yes"           && config_plugins_default="$config_plugins_default,ifupdown"
	test "$enable_config_plugin_ibft" = "yes" && config_plugins_default="$config_plugins_default,ibft"
	config_plugins_default="${config_plugins_default#,}"
154
fi
155 156 157 158 159

test "$enable_ifcfg_rh" = "yes"           && distro_plugins="$distro_plugins,ifcfg-rh"
test "$enable_ifupdown" = "yes"           && distro_plugins="$distro_plugins,ifupdown"
distro_plugins="${distro_plugins#,}"

160
AC_DEFINE_UNQUOTED(NM_CONFIG_DEFAULT_MAIN_PLUGINS, "$config_plugins_default", [Default configuration option for main.plugins setting])
161 162 163 164 165
if test "${enable_config_plugin_ibft}" = yes; then
	AC_DEFINE(WITH_SETTINGS_PLUGIN_IBFT, 1, [Whether compilation of ibft setting plugin is enabled])
else
	AC_DEFINE(WITH_SETTINGS_PLUGIN_IBFT, 0, [Whether compilation of ibft setting plugin is enabled])
fi
166

167
if test "$enable_ifcfg_rh" = "yes"; then
168
	DISTRO_NETWORK_SERVICE=network.service
169 170 171
fi
AC_SUBST(DISTRO_NETWORK_SERVICE)

172 173
# Code coverage
GNOME_CODE_COVERAGE
174

175 176 177
dnl
dnl Distribution version string
dnl
178 179 180
AC_ARG_WITH(dist-version,
            AS_HELP_STRING([--with-dist-version=<NM-distribution-version>],
                           [Define the NM''s distribution version string]),
181 182 183
            ac_distver=$withval, ac_distver=$NM_VERSION)
AC_DEFINE_UNQUOTED(NM_DIST_VERSION, "$ac_distver", [Define the distribution version string])
AC_SUBST(NM_DIST_VERSION, "$ac_distver")
184

185 186 187 188 189 190 191 192 193
AC_ARG_ENABLE(wifi, AS_HELP_STRING([--enable-wifi], [enable Wi-Fi support]))
if test "${enable_wifi}" != "no"; then
	enable_wifi='yes'
	AC_DEFINE(WITH_WIFI, 1, [Define if you have Wi-Fi support])
else
	AC_DEFINE(WITH_WIFI, 0, [Define if you have Wi-Fi support])
fi
AM_CONDITIONAL(WITH_WIFI, test "${enable_wifi}" = "yes")

194 195 196
dnl
dnl Default to using WEXT but allow it to be disabled
dnl
197 198 199 200
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")
201 202 203
if test "$ac_with_wext" != 'no'; then
	ac_with_wext='yes'
fi
204
if test x"$ac_with_wext" = x"yes"; then
205 206 207
	if test "$enable_wifi" != "yes"; then
		AC_MSG_ERROR(Enabling WEXT support and disabling Wi-Fi makes no sense)
	fi
208 209 210
	AC_DEFINE(HAVE_WEXT, 1, [Define if you have Linux Wireless Extensions support])
else
	AC_DEFINE(HAVE_WEXT, 0, [Define if you have Linux Wireless Extensions support])
Dan Williams's avatar
Dan Williams committed
211
fi
212
AM_CONDITIONAL(WITH_WEXT, test x"${ac_with_wext}" = x"yes")
Dan Williams's avatar
Dan Williams committed
213

214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
dnl
dnl Default to using wpa_supplicant but allow IWD as wifi backend
dnl
AC_ARG_WITH(iwd,
            AS_HELP_STRING([--with-iwd=yes],
                           [Support IWD as wifi-backend in addition to wpa_supplicant (experimental)]),
            ac_with_iwd=$withval, ac_with_iwd="no")
if test "$ac_with_iwd" != 'no'; then
	ac_with_iwd='yes'
fi
if test x"$ac_with_iwd" = x"yes"; then
	if test "$enable_wifi" != "yes"; then
		AC_MSG_ERROR(Enabling IWD support and disabling Wi-Fi makes no sense)
	fi
	AC_DEFINE(WITH_IWD, 1, [Define to compile with the IWD wifi-backend])
else
	AC_DEFINE(WITH_IWD, 0, [Define to compile without the IWD wifi-backend])
fi
AM_CONDITIONAL(WITH_IWD, test x"${ac_with_iwd}" = x"yes")

234 235 236
dnl
dnl Checks for libdl - on certain platforms its part of libc
dnl
237 238
AC_SEARCH_LIBS([dlopen], [dl dld], [], [ac_cv_search_dlopen=])
AC_SUBST([DL_LIBS], "$ac_cv_search_dlopen")
239

240
PKG_CHECK_MODULES(GLIB, [gio-unix-2.0 >= 2.37.6 gmodule-2.0],
241 242
                  [AC_SUBST(LOG_DRIVER, '$(top_srcdir)/build-aux/tap-driver.sh')
                   AC_SUBST(AM_TESTS_FD_REDIRECT, '--tap')],
Lubomir Rintel's avatar
Lubomir Rintel committed
243
                  [PKG_CHECK_MODULES(GLIB, gio-unix-2.0 >= 2.40 gmodule-2.0)
244
                   AC_SUBST(LOG_DRIVER, '$(top_srcdir)/build-aux/test-driver')])
245

Lubomir Rintel's avatar
Lubomir Rintel committed
246
GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_40 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_40"
247

248 249 250
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)

251 252
GOBJECT_INTROSPECTION_CHECK([0.9.6])

253
AC_ARG_WITH(libnm-glib,
254 255
            AS_HELP_STRING([--with-libnm-glib],
                           [build legacy libraries]))
256
fake_typelibs=no
257
if test "$with_libnm_glib" == "yes"; then
258 259
	PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.1 dbus-glib-1 >= 0.94, :,
	                  [AC_MSG_FAILURE([$DBUS_PKG_ERRORS
260

261 262 263
Configure with --without-libnm-glib if you do not need the legacy libraries])
	                  ])

264 265 266 267 268 269
	if test "${found_introspection}" = "yes"; then
		AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources)
		if ! test x"$GLIB_COMPILE_RESOURCES" = x""; then
			fake_typelibs=yes
		fi
	fi
270 271
else
	with_libnm_glib=no
272
fi
273
AM_CONDITIONAL(WITH_LEGACY_LIBRARIES, test "$with_libnm_glib" == "yes")
274 275 276 277 278 279
if test "$fake_typelibs" = "yes"; then
	AC_DEFINE(WITH_FAKE_TYPELIBS, 1, [Define for libnm to prevent GIR from loading libnm-glib])
else
	AC_DEFINE(WITH_FAKE_TYPELIBS, 0, [Define for libnm to prevent GIR from loading libnm-glib])
fi
AM_CONDITIONAL(WITH_FAKE_TYPELIBS, test "${fake_typelibs}" = "yes")
280

281
PKG_CHECK_MODULES([LIBUDEV], [libudev >= 175])
Dan Williams's avatar
Dan Williams committed
282

283
# Qt4
284
PKG_CHECK_MODULES(QT, [QtCore >= 4 QtDBus QtNetwork], [have_qt=yes],[have_qt=no])
285 286 287
AC_ARG_ENABLE(qt,
              AS_HELP_STRING([--enable-qt], [enable Qt examples]),
              [enable_qt=${enableval}], [enable_qt=${have_qt}])
288 289 290 291
if (test "${enable_qt}" = "yes"); then
	if test x"$have_qt" = x"no"; then
		AC_MSG_ERROR(Qt development headers are required)
	fi
292
	# Check for moc-qt4 and if not found then moc
293
	QT4_BINDIR=`$PKG_CONFIG QtCore --variable moc_location`
294
	AC_CHECK_PROGS(MOC, [moc-qt4 moc],, [$QT4_BINDIR:$PATH])
295 296 297
fi
AM_CONDITIONAL(WITH_QT, test "${enable_qt}" = "yes")

298 299 300 301
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"])
302
if (test "$with_udev_dir" != 'no'); then
303
	if (test "$with_udev_dir" != 'yes' && printf '%s' "$with_udev_dir" | grep -v -q '^/'); then
304 305 306
		AC_MSG_ERROR([--with-udev-dir must be an absolute path or 'yes' or 'no'. Instead it is '$with_udev_dir'])
	fi
	if (test "$with_udev_dir" = 'yes'); then
307
		with_udev_dir="\$(prefix)/lib/udev"
308 309 310
	fi
	UDEV_DIR="$with_udev_dir"
	AC_SUBST(UDEV_DIR)
311
fi
312
AM_CONDITIONAL(WITH_UDEV_DIR, test "$with_udev_dir" != 'no')
313

314
# systemd unit support
315 316 317
AC_ARG_WITH([systemdsystemunitdir],
            AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
                           [Directory for systemd service files]))
318 319
# default location
AS_IF([test -z "$with_systemdsystemunitdir" && $PKG_CONFIG systemd],
320
      with_systemdsystemunitdir="\$(prefix)/lib/systemd/system")
321 322 323 324
AS_IF([test -z "$with_systemdsystemunitdir"], with_systemdsystemunitdir=no)
# add conditional and subst
AM_CONDITIONAL(HAVE_SYSTEMD, [test "$with_systemdsystemunitdir" != no])
if test "$with_systemdsystemunitdir" != no; then
325
	AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
326 327 328
	AC_DEFINE(HAVE_SYSTEMD, 1, [Define if systemd support is available])
else
	AC_DEFINE(HAVE_SYSTEMD, 0, [Define if systemd support is available])
329
fi
Dan Williams's avatar
Dan Williams committed
330

331
PKG_CHECK_MODULES(SYSTEMD_200, [systemd >= 200], [have_systemd_200=yes], [have_systemd_200=no])
332 333
AM_CONDITIONAL(HAVE_SYSTEMD_200, test "${have_systemd_200}" = "yes")

334
# Hostname persist mode
335 336 337
AC_ARG_WITH(hostname-persist,
            AS_HELP_STRING([--with-hostname-persist=default|suse|gentoo|slackware],
                           [Hostname persist method]))
338 339 340

AS_IF([test "$with_hostname_persist" = "suse"], hostname_persist=suse)
AS_IF([test "$with_hostname_persist" = "gentoo"], hostname_persist=gentoo)
341
AS_IF([test "$with_hostname_persist" = "slackware"], hostname_persist=slackware)
342 343
AS_IF([test "$with_hostname_persist" = "default"], hostname_persist=default)
# if the method was not explicitly set, try to guess it from the enabled plugins
344
AS_IF([test -z "$hostname_persist" -a -f /etc/SuSE-release], hostname_persist=suse)
345
AS_IF([test -z "$hostname_persist" -a -f /etc/gentoo-release], hostname_persist=gentoo)
346
AS_IF([test -z "$hostname_persist" -a -f /etc/slackware-version], hostname_persist=slackware)
347 348 349 350 351 352
AS_IF([test -z "$hostname_persist"], hostname_persist=default)

if test "$hostname_persist" = suse; then
	AC_DEFINE(HOSTNAME_PERSIST_SUSE, 1, [Enable SuSE hostname persist method])
elif test "$hostname_persist" = gentoo; then
	AC_DEFINE(HOSTNAME_PERSIST_GENTOO, 1, [Enable Gentoo hostname persist method])
353 354
elif test "$hostname_persist" = slackware; then
	AC_DEFINE(HOSTNAME_PERSIST_SLACKWARE, 1, [Enable Slackware hostname persist method])
355 356
fi

357
PKG_CHECK_MODULES(LIBSYSTEMD, [libsystemd >= 209],
358 359
                  [AC_DEFINE([HAVE_LIBSYSTEMD], 1, [Define to 1 if libsystemd is available])],
                  [AC_DEFINE([HAVE_LIBSYSTEMD], 0, [Define to 1 if libsystemd is available])])
360

361 362 363
AC_ARG_WITH(systemd-journal,
            AS_HELP_STRING([--with-systemd-journal=yes|no],
                           [Use systemd journal for logging]))
364 365
have_systemd_journal=no
if test "$with_systemd_journal" != "no"; then
366
	PKG_CHECK_MODULES(SYSTEMD_JOURNAL, [libsystemd >= 209], [have_systemd_journal=yes],
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382
	                  [PKG_CHECK_MODULES(SYSTEMD_JOURNAL,
	                                     [libsystemd-journal],
	                                     [have_systemd_journal=yes],
	                                     [have_systemd_journal=no])])
	if test "$have_systemd_journal" != "yes"; then
		if test "$with_systemd_journal" = "yes"; then
			AC_MSG_ERROR([Missing systemd-journald support])
		fi
	fi
fi
if test "$have_systemd_journal" = "yes"; then
	AC_DEFINE([SYSTEMD_JOURNAL], 1, [Define to 1 if libsystemd-journald is available])
else
	AC_DEFINE([SYSTEMD_JOURNAL], 0, [Define to 1 if libsystemd-journald is available])
fi

383 384 385 386 387
AC_ARG_WITH(config-logging-backend-default,
            AS_HELP_STRING([--with-config-logging-backend-default=backend],
                           [Default value for logging.backend]),
            nm_config_logging_backend_default="$withval",
            nm_config_logging_backend_default="")
388

389 390
if test "$nm_config_logging_backend_default" != 'syslog' \
     -a "$nm_config_logging_backend_default" != 'journal'; then
391 392 393 394 395 396
	# unknown backend. Reset to default. Silently accept the invalid value to
	# be future proof.
	nm_config_logging_backend_default=''
fi
if test "$nm_config_logging_backend_default" = ""; then
	if test "$have_systemd_journal" = "yes"; then
397
		nm_config_logging_backend_default='journal'
398 399 400 401
	else
		nm_config_logging_backend_default='syslog'
	fi
fi
402 403 404
AC_DEFINE_UNQUOTED(NM_CONFIG_DEFAULT_LOGGING_BACKEND, "$nm_config_logging_backend_default", [Default configuration option for logging.backend])
NM_CONFIG_DEFAULT_LOGGING_BACKEND_TEXT="$nm_config_logging_backend_default"
AC_SUBST(NM_CONFIG_DEFAULT_LOGGING_BACKEND_TEXT)
405

406
# Session tracking support
407 408 409 410 411 412 413 414 415
AC_ARG_WITH(systemd-logind,
            AS_HELP_STRING([--with-systemd-logind=yes|no],
                           [Support systemd session tracking]))
AC_ARG_WITH(consolekit,
            AS_HELP_STRING([--with-consolekit=yes|no],
                           [Support consolekit session tracking]))
AC_ARG_WITH(session-tracking,
            AS_HELP_STRING([--with-session-tracking=systemd|elogind|consolekit|no],
                           [Compatibility option to choose one session tracking module]))
416
# backwards compatibility
Sven Eden's avatar
Sven Eden committed
417 418 419 420 421 422
AS_IF([test "$with_session_tracking" = "ck"], [use_consolekit="yes" use_systemd_logind="no" use_elogind="no"])
AS_IF([test "$with_session_tracking" = "consolekit"], [use_consolekit="yes" use_systemd_logind="no" use_elogind="no"])
AS_IF([test "$with_session_tracking" = "systemd"], [use_consolekit="no" use_systemd_logind="yes" use_elogind="no"])
AS_IF([test "$with_session_tracking" = "elogind"], [use_consolekit="no" use_systemd_logind="no" use_elogind="yes"])
AS_IF([test "$with_session_tracking" = "no"], [use_consolekit="no" use_systemd_logind="no" use_elogind="no"])
AS_IF([test "$with_session_tracking" = "none"], [use_consolekit="no" use_systemd_logind="no" use_elogind="no"])
423 424 425 426
# current options
AS_IF([test -n "$with_systemd_logind" ], [use_systemd_logind="$with_systemd_logind"])
AS_IF([test -n "$with_consolekit" ], [use_consolekit="$with_consolekit"])
# defaults
427
AS_IF([test -z "$use_systemd_logind"], [use_systemd_logind="auto"])
428
AS_IF([test -z "$use_consolekit"], [use_consolekit="yes"])
429 430
# output
session_tracking=
431
if test "$use_systemd_logind" = "yes" -o "$use_systemd_logind" = "auto"; then
432
	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])])
433
else
434
	have_systemd_logind=no
435 436
fi
if test "$use_systemd_logind" = "yes" -a "$have_systemd_logind" = "no"; then
437
	AC_MSG_ERROR([You must have libsystemd installed to build with systemd-logind support.])
438 439
fi
if test "$have_systemd_logind" = "yes"; then
440 441
	AC_DEFINE([SESSION_TRACKING_SYSTEMD], 1, [Define to 1 if libsystemd-login is available])
	session_tracking="$session_tracking, systemd-logind"
442 443
else
	AC_DEFINE([SESSION_TRACKING_SYSTEMD], 0, [Define to 1 if libsystemd-login is available])
444
fi
Sven Eden's avatar
Sven Eden committed
445

446
if test "$use_elogind" = "yes" -a "$have_systemd_logind" = "yes"; then
447
	AC_MSG_ERROR([Cannot enable systemd-logind together with elogind.])
448 449
fi
if test "$use_elogind" = "yes"; then
450
	PKG_CHECK_MODULES(SYSTEMD_LOGIN, [libelogind], [have_elogind=yes], [PKG_CHECK_MODULES(SYSTEMD_LOGIN, [libelogind], [have_elogind=yes], [have_elogind=no])])
Sven Eden's avatar
Sven Eden committed
451
else
452
	have_elogind=no
Sven Eden's avatar
Sven Eden committed
453 454
fi
if test "$use_elogind" = "yes" -a "$have_elogind" = "no"; then
455
	AC_MSG_ERROR([You must have libelogind installed to build with elogind support.])
Sven Eden's avatar
Sven Eden committed
456 457
fi
if test "$have_elogind" = "yes"; then
458 459
	AC_DEFINE([SESSION_TRACKING_ELOGIND], 1, [Define to 1 if libelogin is available])
	session_tracking="$session_tracking, elogind"
460 461
else
	AC_DEFINE([SESSION_TRACKING_ELOGIND], 0, [Define to 1 if libelogin is available])
Sven Eden's avatar
Sven Eden committed
462 463
fi

464
if test "$use_consolekit" = "yes"; then
465 466
	AC_DEFINE([SESSION_TRACKING_CONSOLEKIT], 1, [Define to 1 if ConsoleKit is available])
	session_tracking="$session_tracking, consolekit"
467 468
else
	AC_DEFINE([SESSION_TRACKING_CONSOLEKIT], 0, [Define to 1 if ConsoleKit is available])
469
fi
470
session_tracking="$(printf '%s' "${session_tracking}" | sed 's/^, //')"
471

472 473 474
AC_ARG_WITH(suspend-resume,
            AS_HELP_STRING([--with-suspend-resume=upower|systemd|elogind|consolekit],
                           [Build NetworkManager with specific suspend/resume support]))
475
if test "z$with_suspend_resume" = "z"; then
476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496
	PKG_CHECK_EXISTS([libsystemd >= 209], [have_systemd_inhibit=yes],
	                 [PKG_CHECK_EXISTS([libsystemd-login >= 183], [have_systemd_inhibit=yes], [have_systemd_inhibit=no])])
	if test "z${have_systemd_inhibit}" = "zyes"; then
		# Use systemd if it's new enough
		with_suspend_resume="systemd"
	else
		PKG_CHECK_EXISTS([libelogind >= 219], [have_elogind_inhibit=yes],
		                 [PKG_CHECK_EXISTS([libelogind >= 219], [have_elogind_inhibit=yes], [have_elogind_inhibit=no])])
		if test "z${have_elogind_inhibit}" = "zyes"; then
			# Use elogind if it's new enough
			with_suspend_resume="elogind"
		else
			if test "$use_consolekit" = "yes"; then
				# Use consolekit suspend if session tracking is consolekit
				with_suspend_resume="consolekit"
			else
				# Fall back to upower
				with_suspend_resume="upower"
			fi
		fi
	fi
Sven Eden's avatar
Sven Eden committed
497
fi
498 499

case $with_suspend_resume in
500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518
	upower)
		AC_DEFINE([SUSPEND_RESUME_UPOWER], 1, [Define to 1 to use UPower suspend api])
		;;
	systemd)
		PKG_CHECK_MODULES(SYSTEMD_INHIBIT, [libsystemd >= 209],,
		                  [PKG_CHECK_MODULES(SYSTEMD_INHIBIT, [libsystemd-login >= 183])])
		AC_DEFINE([SUSPEND_RESUME_SYSTEMD], 1, [Define to 1 to use systemd suspend api])
		;;
	elogind)
		PKG_CHECK_MODULES(ELOGIND_INHIBIT, [libelogind >= 219],,
		                  [PKG_CHECK_MODULES(ELOGIND_INHIBIT, [libelogind >= 219])])
		AC_DEFINE([SUSPEND_RESUME_ELOGIND], 1, [Define to 1 to use elogind suspend api])
		;;
	consolekit)
		AC_DEFINE([SUSPEND_RESUME_CONSOLEKIT], 1, [Define to 1 to use ConsoleKit2 suspend api])
		;;
	*)
		AC_MSG_ERROR(--with-suspend-resume must be one of [upower, systemd, elogind, consolekit])
		;;
519 520
esac

521
# SELinux support
522 523 524
AC_ARG_WITH(selinux,
            AS_HELP_STRING([--with-selinux=yes|no|auto], [Build with SELinux (default: auto)]),
            [], [with_selinux=auto])
525
if test "$with_selinux" = "yes" -o "$with_selinux" = "auto"; then
526
	PKG_CHECK_MODULES(SELINUX, libselinux, [have_selinux=yes], [have_selinux=no])
527
else
528
	have_selinux=no
529 530
fi
if test "$with_selinux" = "yes" -a "$have_selinux" = "no"; then
531
	AC_MSG_ERROR([You must have libselinux installed to build --with-selinux=yes.])
532 533
fi
if test "$have_selinux" = "yes"; then
534
	AC_DEFINE(HAVE_SELINUX, 1, [Define if you have SELinux support])
535
else
536
	AC_DEFINE(HAVE_SELINUX, 0, [Define if you have SELinux support])
537 538
fi

Beniamino Galvani's avatar
Beniamino Galvani committed
539
# libaudit support
540
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])
541
if test "$with_libaudit" = "yes" -o "$with_libaudit" = "yes-disabled-by-default" -o "$with_libaudit" = "auto"; then
542 543 544 545
	PKG_CHECK_MODULES(LIBAUDIT, audit, [have_libaudit=yes], [have_libaudit=no])
	if test "$with_libaudit" != "auto" -a "$have_libaudit" = "no"; then
		AC_MSG_ERROR([You must have libaudit installed to build --with-libaudit=$with_libaudit.])
	fi
Beniamino Galvani's avatar
Beniamino Galvani committed
546
else
547
	have_libaudit=no
Beniamino Galvani's avatar
Beniamino Galvani committed
548 549
fi
if test "$have_libaudit" = "yes"; then
550 551 552 553 554 555 556 557
	AC_DEFINE(HAVE_LIBAUDIT, 1, [Define if you have libaudit support])
	if test "$with_libaudit" = "yes-disabled-by-default"; then
		AC_DEFINE(NM_CONFIG_DEFAULT_LOGGING_AUDIT, "false", [The default value of the logging.audit configuration option])
		NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT='false'
	else
		AC_DEFINE(NM_CONFIG_DEFAULT_LOGGING_AUDIT, "true",  [The default value of the logging.audit configuration option])
		NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT='true'
	fi
Beniamino Galvani's avatar
Beniamino Galvani committed
558
else
559 560 561
	AC_DEFINE(HAVE_LIBAUDIT, 0, [Define if you have libaudit support])
	AC_DEFINE(NM_CONFIG_DEFAULT_LOGGING_AUDIT, "false", [The default value of the logging.audit configuration option])
	NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT='false'
Beniamino Galvani's avatar
Beniamino Galvani committed
562
fi
563
AC_SUBST(NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT)
Beniamino Galvani's avatar
Beniamino Galvani committed
564

565
# uuid library
566 567
PKG_CHECK_MODULES(UUID, uuid)

Jiri Pirko's avatar
Jiri Pirko committed
568
# Teamd control checks
569

Lubomir Rintel's avatar
Lubomir Rintel committed
570
PKG_CHECK_MODULES(JANSSON, [jansson >= 2.5], [have_jansson=yes], [have_jansson=no])
571 572
if test "$have_jansson" = "yes"; then
	AC_DEFINE(WITH_JANSSON, 1, [Define if JANSSON is enabled])
Lubomir Rintel's avatar
Lubomir Rintel committed
573 574 575 576 577 578 579 580 581

	AC_CHECK_TOOLS(READELF, [eu-readelf readelf])
	JANSSON_LIBDIR=`$PKG_CONFIG --variable=libdir jansson`
	JANSSON_SONAME=`$READELF -d $JANSSON_LIBDIR/libjansson.so |sed -n 's/.*SONAME.*\[[\([^]]*\)]]/\1/p'`

	if test "$JANSSON_SONAME" = ""; then
		AC_MSG_ERROR(Unable to locate the Jansson library)
	fi
	AC_DEFINE_UNQUOTED(JANSSON_SONAME, "$JANSSON_SONAME", [Define to path to the Jansson shared library])
582 583 584 585 586
else
	AC_DEFINE(WITH_JANSSON, 0, [Define if JANSSON is enabled])
fi
AM_CONDITIONAL(WITH_JANSSON, test "${have_jansson}" = "yes")

587
PKG_CHECK_MODULES(LIBTEAMDCTL, [libteamdctl >= 1.9], [have_teamdctl=yes],[have_teamdctl=no])
588 589 590 591 592 593
if test "$have_jansson" = "yes" -a "$have_teamdctl" = "yes"; then
	have_team_prereq=yes
else
	have_team_prereq=no
fi

594 595 596 597
AC_ARG_ENABLE(teamdctl,
              AS_HELP_STRING([--enable-teamdctl], [enable Teamd control support]),
              [enable_teamdctl=${enableval}], [enable_teamdctl=${have_team_prereq}])
if (test "${enable_teamdctl}" = "yes"); then
598 599 600 601 602
	if test "$have_teamdctl" = "no"; then
		AC_MSG_ERROR(Libteamdctl is required for team support)
	fi
	if test "$have_jansson" = "no"; then
		AC_MSG_ERROR(Jansson is required for team support)
Jiri Pirko's avatar
Jiri Pirko committed
603 604 605
	fi
	# temporary bug workaround
	LIBTEAMDCTL_CFLAGS=`echo $LIBTEAMDCTL_CFLAGS | sed -e 's:/teamdctl.h::'`
606 607 608 609 610 611 612 613 614 615 616 617 618 619 620
fi
AM_CONDITIONAL(WITH_TEAMDCTL, test "${enable_teamdctl}" = "yes")

# Jansson for team configuration validation
AC_ARG_ENABLE(json-validation,
              AS_HELP_STRING([--enable-json-validation], [Enable JSON validation in libnm]),
              [enable_json_validation=${enableval}],
              [enable_json_validation=${have_jansson}])
if (test "${enable_json_validation}" == "no"); then
	AC_DEFINE(WITH_JSON_VALIDATION, 0, [Define if JSON validation in libnm is enabled])
else
	if test "$have_jansson" = "no"; then
		AC_MSG_ERROR([jansson is needed for team configuration validation. Use --disable-json-validation to build without it.])
	fi
		AC_DEFINE(WITH_JSON_VALIDATION, 1, [Define if JSON validation in libnm is enabled])
621
fi
622
AM_CONDITIONAL(WITH_JSON_VALIDATION, test "${enable_json_validation}" != "no")
623

624 625
# we usually compile with polkit support. --enable-polkit=yes|no only sets the
# default configuration for main.auth-polkit. User can always enable/disable polkit
626
# autorization via config.
627
AC_ARG_ENABLE(polkit,
628 629
              AS_HELP_STRING([--enable-polkit=yes|no],
                             [set default value for auth-polkit configuration option. This value can be overwritten by NM configuration. 'disabled' is an alias for 'no']),
630
              [enable_polkit=${enableval}], [enable_polkit=yes])
631
if (test "${enable_polkit}" != "no" -a "${enable_polkit}" != "disabled"); then
632
	enable_polkit=true
633 634
	AC_DEFINE(NM_CONFIG_DEFAULT_MAIN_AUTH_POLKIT, "true", [The default value of the auth-polkit configuration option])
	AC_SUBST(NM_CONFIG_DEFAULT_MAIN_AUTH_POLKIT_TEXT, true)
635
else
636
	enable_polkit=false
637 638
	AC_DEFINE(NM_CONFIG_DEFAULT_MAIN_AUTH_POLKIT, "false", [The default value of the auth-polkit configuration option])
	AC_SUBST(NM_CONFIG_DEFAULT_MAIN_AUTH_POLKIT_TEXT, false)
639
fi
640

641
PKG_CHECK_MODULES(POLKIT, [polkit-agent-1 >= 0.97], [have_pk_agent=yes],[have_pk_agent=no])
642 643 644
AC_ARG_ENABLE(polkit-agent,
              AS_HELP_STRING([--enable-polkit-agent], [enable polkit agent for clients]),
              [enable_polkit_agent=${enableval}], [enable_polkit_agent=${have_pk_agent}])
645 646 647 648 649 650 651 652 653 654
if (test "${enable_polkit_agent}" = "yes"); then
	if test x"$have_pk_agent" = x"no"; then
		AC_MSG_ERROR(Polkit agent is required)
	fi
	AC_DEFINE(WITH_POLKIT_AGENT, 1, [Define if you have polkit agent])
else
	AC_DEFINE(WITH_POLKIT_AGENT, 0, [Define if you have polkit agent])
fi
AM_CONDITIONAL(WITH_POLKIT_AGENT, test "${enable_polkit_agent}" = "yes")

655
AC_ARG_ENABLE(modify-system, AS_HELP_STRING([--enable-modify-system], [Allow users to modify system connections]))
656 657 658 659 660 661 662
if test "${enable_modify_system}" = "yes"; then
	NM_MODIFY_SYSTEM_POLICY="yes"
else
	NM_MODIFY_SYSTEM_POLICY="auth_admin_keep"
fi
AC_SUBST(NM_MODIFY_SYSTEM_POLICY)

663 664 665 666 667 668 669 670 671 672 673 674
PKG_CHECK_MODULES(GNUTLS, [gnutls >= 2.12], [have_crypto_gnutls=yes], [have_crypto_gnutls=no])
PKG_CHECK_MODULES(NSS, [nss], [have_crypto_nss=yes], [have_crypto_nss=yes])
if test "${have_crypto_nss}" = "yes"; then
	# Work around a pkg-config bug (fdo #29801) where exists != usable
	FOO=`$PKG_CONFIG --cflags --libs nss`
	if test x"$?" != "x0"; then
		have_crypto_nss=no
	fi
fi
AM_CONDITIONAL(HAVE_CRYPTO_GNUTLS, test "${have_crypto_gnutls}" = 'yes')
AM_CONDITIONAL(HAVE_CRYPTO_NSS, test "${have_crypto_nss}" = 'yes')

675 676 677
AC_ARG_WITH(crypto,
            AS_HELP_STRING([--with-crypto=nss|gnutls],
                           [Cryptography library to use for certificate and key operations]),
678 679 680
            with_crypto=$withval,
            with_crypto=nss)
if test "$with_crypto" = 'nss'; then
681 682
	if test "${have_crypto_nss}" != "yes"; then
		AC_MSG_ERROR([No usable NSS found for --with-crypto=nss])
683
	fi
684
elif test "$with_crypto" = 'gnutls'; then
685 686 687
	if test "${have_crypto_gnutls}" != "yes"; then
		AC_MSG_ERROR([No usable gnutls found for --with-crypto=gnutls])
	fi
688
else
689
	AC_MSG_ERROR([Please choose either 'nss' or 'gnutls' for certificate and crypto operations])
690
fi
691 692
AM_CONDITIONAL(WITH_NSS, test "$with_crypto" = 'nss')
AM_CONDITIONAL(WITH_GNUTLS, test "$with_crypto" = 'gnutls')
693

694 695
GLIB_MAKEFILE='$(top_srcdir)/Makefile.glib'
AC_SUBST(GLIB_MAKEFILE)
696
GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
697
AC_SUBST(GLIB_MKENUMS)
698

699 700
AC_ARG_WITH(dbus-sys-dir,
            AS_HELP_STRING([--with-dbus-sys-dir=DIR], [where D-BUS system.d directory is]))
Bryan W. Clark's avatar
Bryan W. Clark committed
701

702
if test -n "$with_dbus_sys_dir" ; then
703
	DBUS_SYS_DIR="$with_dbus_sys_dir"
Bryan W. Clark's avatar
Bryan W. Clark committed
704
else
705
	DBUS_SYS_DIR="${sysconfdir}/dbus-1/system.d"
Bryan W. Clark's avatar
Bryan W. Clark committed
706 707 708
fi
AC_SUBST(DBUS_SYS_DIR)

709
# pppd
710 711 712
AC_ARG_ENABLE(ppp,
              AS_HELP_STRING([--enable-ppp], [enable PPP/PPPoE support]),
              [enable_ppp=${enableval}], [enable_ppp=yes])
713 714
if (test "${enable_ppp}" = "yes"); then
	AC_CHECK_HEADERS(pppd/pppd.h,,
715
	                 AC_MSG_ERROR("couldn't find pppd.h. pppd development headers are required."))
716 717

	AC_DEFINE(WITH_PPP, 1, [Define if you have PPP support])
718 719
else
	AC_DEFINE(WITH_PPP, 0, [Define if you have PPP support])
720 721
fi
AM_CONDITIONAL(WITH_PPP, test "${enable_ppp}" = "yes")
722

723 724
AC_ARG_WITH([pppd-plugin-dir],
            AS_HELP_STRING([--with-pppd-plugin-dir=DIR], [path to the pppd plugins directory]))
725 726 727 728

if test -n "$with_pppd_plugin_dir" ; then
	PPPD_PLUGIN_DIR="$with_pppd_plugin_dir"
else
729
	PPPD_PLUGIN_DIR="${libdir}/pppd/2.4.5"
730 731
fi
AC_SUBST(PPPD_PLUGIN_DIR)
732

733 734
AC_ARG_WITH(pppd, AS_HELP_STRING([--with-pppd=/path/to/pppd], [path to pppd binary]))
if test "x${with_pppd}" = x; then
735
	AC_PATH_PROG(PPPD_PATH, pppd, [], $PATH:/sbin:/usr/sbin)
736
else
737
	PPPD_PATH="$with_pppd"
738 739 740 741
fi
AC_DEFINE_UNQUOTED(PPPD_PATH, "$PPPD_PATH", [Define to path of pppd binary])
AC_SUBST(PPPD_PATH)

742
# ModemManager1 with libmm-glib
743 744 745 746
AC_ARG_WITH(modem-manager-1,
            AS_HELP_STRING([--with-modem-manager-1],
                           [Enable new ModemManager1 interface support]),
            [], [with_modem_manager_1=auto])
747
if (test "${with_modem_manager_1}" != "no"); then
748 749 750 751 752 753 754 755 756 757 758 759 760 761
	PKG_CHECK_MODULES(MM_GLIB,
	                  [mm-glib >= 0.7.991],
	                  [have_libmm_glib=yes],
	                  [have_libmm_glib=no])

	if (test "${have_libmm_glib}" = "no"); then
		if (test "${with_modem_manager_1}" = "yes"); then
			AC_MSG_ERROR([Couldn't find libmm-glib])
		else
			with_modem_manager_1="no"
		fi
	else
		with_modem_manager_1="yes"
	fi
762 763
fi
AM_CONDITIONAL(WITH_MODEM_MANAGER_1, test "${with_modem_manager_1}" = "yes")
764

765 766
# Bluez5 DUN support
PKG_CHECK_MODULES(BLUEZ5, [bluez >= 5], [have_bluez5=yes],[have_bluez5=no])
767 768 769
AC_ARG_ENABLE(bluez5-dun,
              AS_HELP_STRING([--enable-bluez5-dun], [enable Bluez5 DUN support]),
              [enable_bluez5_dun=${enableval}], [enable_bluez5_dun=${have_bluez5}])
770 771 772 773 774 775
if (test "${enable_bluez5_dun}" = "yes"); then
	if test x"$have_bluez5" = x"no"; then
		AC_MSG_ERROR(Bluez 5.x development headers are required)
	fi
	AC_DEFINE(WITH_BLUEZ5_DUN, 1, [Define if you have Bluez 5 libraries])
else
776
	AC_DEFINE(WITH_BLUEZ5_DUN, 0, [Define if you have Bluez 5 libraries])
777 778 779
fi
AM_CONDITIONAL(WITH_BLUEZ5_DUN, test "${enable_bluez5_dun}" = "yes")

780
# OFONO
781 782 783
AC_ARG_WITH(ofono,
            AS_HELP_STRING([--with-ofono], [Enable oFono support (experimental)]),
            [], [with_ofono=no])
784
if (test "${with_ofono}" = "yes"); then
785
	AC_DEFINE(WITH_OFONO, 1, [Define if you have oFono support (experimental)])
786
else
787
	AC_DEFINE(WITH_OFONO, 0, [Define if you have oFono support (experimental)])
788 789 790
fi
AM_CONDITIONAL(WITH_OFONO, test "${with_ofono}" = "yes")

juga's avatar
juga committed
791 792 793 794 795 796 797 798 799 800 801 802 803 804 805
# DHCP client support with dhcpcanon
AC_ARG_WITH([dhcpcanon],
            AS_HELP_STRING([--with-dhcpcanon=yes|no|path], [Enable dhcpcanon support (experimental)]))
if test "$with_dhcpcanon" != "no"; then
    with_dhcpcanon_="$with_dhcpcanon"
    AC_PATH_PROGS(with_dhcpcanon, dhcpcanon, no, /sbin:/usr/sbin:/usr/local/sbin:/usr/bin:/usr/local/bin)
    if test "$with_dhcpcanon" == "no"; then
        if test "$with_dhcpcanon_" == yes; then
            AC_MSG_WARN([dhcpcanon not found, assume path /sbin/dhcpcanon])
            with_dhcpcanon=/sbin/dhcpcanon
        fi
    fi
fi
if test "$with_dhcpcanon" != "no"; then
    AC_DEFINE(WITH_DHCPCANON, 1, [Define if you have dhcpcanon])
806
    AC_DEFINE_UNQUOTED(DHCPCANON_PATH, "$with_dhcpcanon", [Define path to dhcpcanon])
juga's avatar
juga committed
807 808 809
else
    AC_DEFINE(WITH_DHCPCANON, 0, [Define if you have dhcpcanon])
fi
810 811 812 813 814 815 816 817 818 819 820

# OpenVSwitch integration
AC_ARG_ENABLE(ovs, AS_HELP_STRING([--enable-ovs], [enable OpenVSwitch support]))
if test "${enable_ovs}" != "no"; then
	enable_ovs='yes'
	if test "$have_jansson" = "no"; then
		AC_MSG_ERROR(Jansson is required for ovs support)
	fi
fi
AM_CONDITIONAL(WITH_OPENVSWITCH, test "${enable_ovs}" = "yes")

821
# DHCP client support
822
AC_ARG_WITH([dhclient],
823
            AS_HELP_STRING([--with-dhclient=yes|no|path], [Enable dhclient support]))
824 825
if test "$with_dhclient" != "no"; then
	with_dhclient_="$with_dhclient"
826
	AC_PATH_PROGS(with_dhclient, dhclient, no, /sbin:/usr/sbin:/usr/local/sbin)
827 828 829 830 831
	if test "$with_dhclient" == "no"; then
		if test "$with_dhclient_" == yes; then
			AC_MSG_WARN([dhclient not found, assume path /usr/sbin/dhclient])
			with_dhclient=/usr/sbin/dhclient
		fi
832 833
	fi
fi
834 835
if test "$with_dhclient" != "no"; then
	AC_DEFINE(WITH_DHCLIENT, 1, [Define if you have dhclient])
836
	AC_DEFINE_UNQUOTED(DHCLIENT_PATH, "$with_dhclient", [Define path to dhclient])
837 838 839 840
else
	AC_DEFINE(WITH_DHCLIENT, 0, [Define if you have dhclient])
fi

841 842
AC_ARG_WITH([dhcpcd],
            AS_HELP_STRING([--with-dhcpcd=yes|no|path], [Enable dhcpcd 4.x support]))
843 844
if test "$with_dhcpcd" != "no"; then
	with_dhcpcd_="$with_dhcpcd"
845
	AC_PATH_PROGS(with_dhcpcd, dhcpcd, no, /sbin:/usr/sbin:/usr/local/sbin)
846 847 848 849
	if test "$with_dhcpcd" == "no"; then
		if test "$with_dhcpcd_" == yes; then
			AC_MSG_WARN([dhcpcd not found, assume path /usr/sbin/dhcpcd])
			with_dhcpcd=/usr/sbin/dhcpcd
850 851 852 853
		fi
	fi
fi
if test "$with_dhcpcd" != "no"; then
854
	AC_DEFINE(WITH_DHCPCD, 1, [Define if you have dhcpcd])
855
	AC_DEFINE_UNQUOTED(DHCPCD_PATH, "$with_dhcpcd", [Define path to dhcpcd])
856
else
857
	AC_DEFINE(WITH_DHCPCD, 0, [Define if you have dhcpcd])
858 859
fi

860 861 862 863
AC_ARG_WITH(config-dhcp-default,
            AS_HELP_STRING([--with-config-dhcp-default=dhclient|dhcpcd|internal],
                           [Default configuration option for main.dhcp setting, used as fallback if the configuration option is unset]),
            [config_dhcp_default="$withval"], [config_dhcp_default=""])
864 865 866
if test "$config_dhcp_default" = yes -o "$config_dhcp_default" = no; then
	config_dhcp_default=''
fi
juga's avatar
juga committed
867
test -z "$config_dhcp_default" -a "$with_dhcpcanon" != "no" && config_dhcp_default='dhcpcanon'
868 869 870
test -z "$config_dhcp_default" -a "$with_dhclient" != "no" && config_dhcp_default='dhclient'
test -z "$config_dhcp_default" -a "$with_dhcpcd"   != "no" && config_dhcp_default='dhcpcd'
test -z "$config_dhcp_default"                             && config_dhcp_default='internal'
871 872
AC_DEFINE_UNQUOTED(NM_CONFIG_DEFAULT_MAIN_DHCP, "$config_dhcp_default", [Default configuration option for main.dhcp setting])
AC_SUBST(NM_CONFIG_DEFAULT_MAIN_DHCP, $config_dhcp_default)
873

874 875
AC_ARG_WITH(resolvconf, AS_HELP_STRING([--with-resolvconf=yes|no|path], [Enable resolvconf support]))
AC_ARG_WITH(netconfig, AS_HELP_STRING([--with-netconfig=yes|no], [Enable SUSE netconfig support]))
876
AC_ARG_WITH(config-dns-rc-manager-default, AS_HELP_STRING([--with-config-dns-rc-manager-default=symlink|file|netconfig|resolvconf], [Configure default value for main.rc-manager setting]), [config_dns_rc_manager_default=$withval])
877
if test "$config_dns_rc_manager_default" != "" -a \
878
        "$config_dns_rc_manager_default" != file -a \
879
        "$config_dns_rc_manager_default" != symlink -a \
880 881
        "$config_dns_rc_manager_default" != netconfig -a \
        "$config_dns_rc_manager_default" != resolvconf; then
882 883 884
	AC_MSG_WARN([Unknown --with-config-dns-rc-manager-default=$config_dns_rc_manager_default setting.])
	config_dns_rc_manager_default=
fi
885
# Use netconfig by default on SUSE
886
AS_IF([test -z "$with_netconfig" -a -f /etc/SuSE-release], with_netconfig=yes)
887 888 889
# Otherwise default to "no"
AS_IF([test -z "$with_resolvconf"], with_resolvconf=no)
AS_IF([test -z "$with_netconfig"], with_netconfig=no)
890

891
if test "$with_resolvconf" = "yes"; then
892 893 894 895
	AC_PATH_PROGS(with_resolvconf, resolvconf, 'yes', /sbin:/usr/sbin:/usr/local/sbin)
	if test "$with_resolvconf" = "yes"; then
		AC_MSG_ERROR(cannot find resolvconf in path. Set the path explicitly via --with-resolvconf=PATH.)
	fi
896
fi
897 898 899
if test "$with_resolvconf" != "no"; then
	AS_IF([test -z "$config_dns_rc_manager_default"], config_dns_rc_manager_default=resolvconf)
fi
900

901
if test "$with_netconfig" = "yes"; then
902 903 904 905
	AC_PATH_PROGS(with_netconfig, netconfig, yes, /sbin:/usr/sbin:/usr/local/sbin)
	if test "$with_netconfig" = "yes"; then
		AC_MSG_ERROR(cannot find netconfig in path. Set the path explicitly via --with-netconfig=PATH.)
	fi
906
fi
907 908 909
if test "$with_netconfig" != "no"; then
	AS_IF([test -z "$config_dns_rc_manager_default"], config_dns_rc_manager_default=netconfig)
fi
910

911
AS_IF([test -z "$config_dns_rc_manager_default"], config_dns_rc_manager_default=symlink)
912

913
if test "$with_resolvconf" != "no"; then
914
	AC_DEFINE_UNQUOTED(RESOLVCONF_PATH, "$with_resolvconf", [Path to resolvconf])
915
fi
916
if test "$with_netconfig" != "no"; then
917
	AC_DEFINE_UNQUOTED(NETCONFIG_PATH, "$with_netconfig", [Path to netconfig])
918
fi
919 920
AC_DEFINE_UNQUOTED(NM_CONFIG_DEFAULT_MAIN_RC_MANAGER, "$config_dns_rc_manager_default", [Default value for main.rc-manager setting (--with-config-dns-rc-manager-default)])
AC_SUBST(NM_CONFIG_DEFAULT_MAIN_RC_MANAGER, $config_dns_rc_manager_default)
921

922
# iptables path
923 924
AC_ARG_WITH(iptables,
            AS_HELP_STRING([--with-iptables=/path/to/iptables], [path to iptables]))
925
if test "x${with_iptables}" = x; then
926 927 928 929
	AC_PATH_PROG(IPTABLES_PATH, iptables, [], $PATH:/sbin:/usr/sbin)
	if ! test -x "$IPTABLES_PATH"; then
		AC_MSG_ERROR(iptables was not installed.)
	fi
930
else
931
	IPTABLES_PATH="$with_iptables"
932 933 934 935
fi
AC_DEFINE_UNQUOTED(IPTABLES_PATH, "$IPTABLES_PATH", [Define to path of iptables binary])
AC_SUBST(IPTABLES_PATH)

936
# dnsmasq path
937 938
AC_ARG_WITH(dnsmasq,
            AS_HELP_STRING([--with-dnsmasq=/path/to/dnsmasq], [path to dnsmasq]))
939
if test "x${with_dnsmasq}" = x; then
940
	AC_PATH_PROG(DNSMASQ_PATH, dnsmasq, [], $PATH:/sbin:/usr/sbin)
941
else
942
	DNSMASQ_PATH="$with_dnsmasq"
943 944 945 946
fi
AC_DEFINE_UNQUOTED(DNSMASQ_PATH, "$DNSMASQ_PATH", [Define to path of dnsmasq binary])
AC_SUBST(DNSMASQ_PATH)

947
# dnssec-trigger-script path
948 949
AC_ARG_WITH(dnssec_trigger,
            AS_HELP_STRING([--with-dnssec-trigger=/path/to/dnssec-trigger-script], [path to unbound dnssec-trigger-script]))
950
if test "x${with_dnssec_trigger}" = x; then
951
	AC_PATH_PROG(DNSSEC_TRIGGER_PATH, dnssec-trigger-script, /usr/libexec/dnssec-trigger-script,
952
	             /usr/local/libexec:/usr/local/lib:/usr/local/lib/dnssec-trigger:/usr/libexec:/usr/lib:/usr/lib/dnssec-trigger)
953
else
954
	DNSSEC_TRIGGER_PATH="$with_dnssec_trigger"
955
fi
956 957
AC_DEFINE_UNQUOTED(DNSSEC_TRIGGER_PATH, "$DNSSEC_TRIGGER_PATH", [Define to path of unbound dnssec-trigger-script])
AC_SUBST(DNSSEC_TRIGGER_PATH)
958

959
# system CA certificates path
960
AC_ARG_WITH(system-ca-path,
juga's avatar
juga committed
961
            AS_HELP_STRING([--with-system-ca-path=/path/to/ssl/certs], [path to system CA certificates]))
962
if test "x${with_system_ca_path}" = x; then
963
	SYSTEM_CA_PATH=/etc/ssl/certs
964
else
965
	SYSTEM_CA_PATH="$with_system_ca_path"
966 967 968 969
fi
AC_DEFINE_UNQUOTED(SYSTEM_CA_PATH, "$SYSTEM_CA_PATH", [Define to path to system CA certificates])
AC_SUBST(SYSTEM_CA_PATH)

970 971
AC_ARG_WITH(kernel-firmware-dir,
            AS_HELP_STRING([--with-kernel-firmware-dir=DIR], [where kernel firmware directory is (default is /lib/firmware)]))
972
if test -n "$with_kernel_firmware_dir" ; then
973
	KERNEL_FIRMWARE_DIR="$with_kernel_firmware_dir"
974
else
975
	KERNEL_FIRMWARE_DIR="/lib/firmware"
976 977 978 979
fi
AC_DEFINE_UNQUOTED(KERNEL_FIRMWARE_DIR, "$KERNEL_FIRMWARE_DIR", [Define to path of the kernel firmware directory])
AC_SUBST(KERNEL_FIRMWARE_DIR)

980
PKG_CHECK_MODULES(LIBPSL, [libpsl >= 0.1], [have_libpsl=yes],[have_libpsl=no])
981 982 983
AC_ARG_WITH(libpsl,
            AS_HELP_STRING([--with-libpsl=yes|no], [Link against libpsl]),
            [], [with_libpsl=${have_libpsl}])
984 985 986 987 988 989 990 991 992 993 994
if test "$with_libpsl" != "no"; then
	if test "$have_libpsl" != "yes"; then
		AC_MSG_ERROR(libpsl library not found)
	fi
	with_libpsl='yes'
	AC_DEFINE(WITH_LIBPSL, 1, [Define if you have libpsl])
else
	AC_DEFINE(WITH_LIBPSL, 0, [Define if you have libpsl])
fi
AM_CONDITIONAL(WITH_LIBPSL, test "$with_libpsl" != "no")

995

996 997
AC_ARG_ENABLE(concheck,
              AS_HELP_STRING([--enable-concheck], [enable connectivity checking support]),
998
              [enable_concheck=${enableval}], [enable_concheck=yes])
999
if test "${enable_concheck}" = "yes"; then
1000
	PKG_CHECK_MODULES(LIBCURL, [libcurl >= 7.24.0], [have_libcurl=yes], [have_libcurl=no])
1001
	if test "$have_libcurl" != "yes"; then
1002
		AC_MSG_ERROR(--enable-concheck requires libcurl library.)
1003
	fi
1004 1005
	AC_DEFINE(WITH_CONCHECK, 1, [Define if you want connectivity checking support])
else
1006
	enable_concheck=no
1007 1008 1009
	AC_DEFINE(WITH_CONCHECK, 0, [Define if you want connectivity checking support])
fi

Dan Winship's avatar
Dan Winship committed
1010
PKG_CHECK_MODULES(LIBNDP, [libndp])
1011

1012 1013
AC_ARG_WITH(nmcli,
            AS_HELP_STRING([--with-nmcli=yes|no], [Build nmcli]))
1014
if test "$with_nmcli" != no; then
1015 1016
	AX_LIB_READLINE
	build_nmcli=yes
1017
else
1018
	build_nmcli=no
1019 1020 1021
fi
AM_CONDITIONAL(BUILD_NMCLI, test "$build_nmcli" = yes)

1022 1023
AC_ARG_WITH(nmtui,
            AS_HELP_STRING([--with-nmtui=yes|no], [Build nmtui]))
Dan Winship's avatar
Dan Winship committed
1024
if test "$with_nmtui" != no; then
1025
	PKG_CHECK_MODULES(NEWT, [libnewt >= 0.52.15], [build_nmtui=yes], [build_nmtui=no])
Dan Winship's avatar
Dan Winship committed
1026
else
1027
	build_nmtui=no
Dan Winship's avatar
Dan Winship committed
1028 1029
fi
if test "$with_nmtui" = yes -a "$build_nmtui" = no; then
1030
	AC_MSG_ERROR([You must have libnewt installed to build nmtui.])
Dan Winship's avatar
Dan Winship committed
1031 1032 1033
fi
AM_CONDITIONAL(BUILD_NMTUI, test "$build_nmtui" = yes)

1034
if test $(( ${NM_MINOR_VERSION} % 2 )) = "1"; then
1035 1036 1037 1038
	# A development version
	more_warnings_default=error
	more_asserts_default=100
	more_logging_default=yes
1039
else
1040 1041 1042 1043
	# A release version
	more_warnings_default=yes
	more_asserts_default=0
	more_logging_default=no
1044
fi
1045

1046
NM_COMPILER_WARNINGS(CFLAGS, ${more_warnings_default})
1047

1048 1049 1050
NM_COMPILER_FLAG(LIBSYSTEMD_NM_CFLAGS, "-Wno-gnu-variable-sized-type-not-at-end")
AC_SUBST(LIBSYSTEMD_NM_CFLAGS)

1051 1052 1053 1054 1055
CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
	-fno-strict-aliasing \
])
CFLAGS="$CFLAGS $with_cflags"

1056
AC_ARG_ENABLE(more-asserts,
1057 1058
              AS_HELP_STRING([--enable-more-asserts],
                             [Enable more assertions for debugging (default: auto). Deprecated option. Use --with-more-asserts=level]))
1059
if test "${enable_more_asserts}" = "yes"; then
1060
	more_asserts=100
1061 1062
fi
AC_ARG_WITH(more-asserts,
1063
            AS_HELP_STRING([--with-more-asserts=level], [Enable more assertions for debugging (0 = none, 100 = all, default: auto)]),
1064 1065 1066
            [more_asserts=${with_more_asserts}],
            [])
if test "${more_asserts}" = "no"; then
1067
	more_asserts=0
1068
else
1069 1070 1071
	if test "${more_asserts}" = "yes"; then
		more_asserts=100
	fi
1072
fi
1073
if test "${more_asserts}" = ""; then
1074
	more_asserts=${more_asserts_default}
1075
fi
1076
AC_DEFINE_UNQUOTED(NM_MORE_ASSERTS, $more_asserts, [Define if more asserts are enabled])
1077

1078
AC_ARG_ENABLE(more-logging, AS_HELP_STRING([--enable-more-logging], [Enable more debug logging (default: auto)]))
1079
if test "${enable_more_logging}" = ""; then
1080
	enable_more_logging=${more_logging_default}
1081
fi
1082
if test "${enable_more_logging}" = "yes"; then
1083
	AC_DEFINE(NM_MORE_LOGGING, [1], [Define if more debug logging is enabled])
1084 1085
else
	AC_DEFINE(NM_MORE_LOGGING, [0], [Define if more debug logging is enabled])
1086 1087
fi

1088 1089
NM_LTO
NM_LD_GC
1090

Beniamino Galvani's avatar