chiark / gitweb /
sd-bus: fix an assert when running in kdbus mode
[elogind.git] / configure.ac
1 #
2 #  This file is part of systemd.
3 #
4 #  Copyright 2010-2012 Lennart Poettering
5 #  Copyright 2010-2012 Kay Sievers
6 #
7 #  systemd is free software; you can redistribute it and/or modify it
8 #  under the terms of the GNU Lesser General Public License as published by
9 #  the Free Software Foundation; either version 2.1 of the License, or
10 #  (at your option) any later version.
11 #
12 #  systemd is distributed in the hope that it will be useful, but
13 #  WITHOUT ANY WARRANTY; without even the implied warranty of
14 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 #  Lesser General Public License for more details.
16 #
17 #  You should have received a copy of the GNU Lesser General Public License
18 #  along with systemd; If not, see <http://www.gnu.org/licenses/>.
19
20 AC_PREREQ([2.64])
21
22 AC_INIT([systemd],
23         [212],
24         [http://bugs.freedesktop.org/enter_bug.cgi?product=systemd],
25         [systemd],
26         [http://www.freedesktop.org/wiki/Software/systemd])
27
28 AC_CONFIG_SRCDIR([src/core/main.c])
29 AC_CONFIG_MACRO_DIR([m4])
30 AC_CONFIG_HEADERS([config.h])
31 AC_CONFIG_AUX_DIR([build-aux])
32
33 AC_USE_SYSTEM_EXTENSIONS
34 AC_SYS_LARGEFILE
35 AC_PREFIX_DEFAULT([/usr])
36 AM_MAINTAINER_MODE([enable])
37 AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules tar-pax no-dist-gzip dist-xz subdir-objects check-news])
38 AM_SILENT_RULES([yes])
39 AC_CANONICAL_HOST
40 AC_DEFINE_UNQUOTED([CANONICAL_HOST], "$host", [Canonical host string.])
41 AS_IF([test "x$host_cpu" = "xmips" || test "x$host_cpu" = "xmipsel" ||
42        test "x$host_cpu" = "xmips64" || test "x$host_cpu" = "xmips64el"],
43       [AC_DEFINE(ARCH_MIPS, [], [Whether on mips arch])])
44
45 LT_PREREQ(2.2)
46 LT_INIT([disable-static])
47
48 AS_IF([test "x$enable_static" = "xyes"], [AC_MSG_ERROR([--enable-static is not supported by systemd])])
49 AS_IF([test "x$enable_largefile" = "xno"], [AC_MSG_ERROR([--disable-largefile is not supported by systemd])])
50
51 # i18n stuff for the PolicyKit policy files
52 IT_PROG_INTLTOOL([0.40.0])
53
54 GETTEXT_PACKAGE=systemd
55 AC_SUBST(GETTEXT_PACKAGE)
56
57 AC_PROG_MKDIR_P
58 AC_PROG_LN_S
59 AC_PROG_SED
60 AC_PROG_GREP
61 AC_PROG_AWK
62
63 AC_PROG_CC_C99
64
65 AC_PATH_PROG([M4], [m4])
66 AC_PATH_PROG([XSLTPROC], [xsltproc])
67
68 AC_PATH_PROG([QUOTAON], [quotaon], [/usr/sbin/quotaon], [$PATH:/usr/sbin:/sbin])
69 AC_PATH_PROG([QUOTACHECK], [quotacheck], [/usr/sbin/quotacheck], [$PATH:/usr/sbin:/sbin])
70
71 AC_PATH_PROG([SETCAP], [setcap], [/usr/sbin/setcap], [$PATH:/usr/sbin:/sbin])
72
73 AC_PATH_PROG([KILL], [kill], [/usr/bin/kill], [$PATH:/usr/sbin:/sbin])
74
75 AC_PATH_PROG([KMOD], [kmod], [/usr/bin/kmod], [$PATH:/usr/sbin:/sbin])
76
77 AC_PATH_PROG([KEXEC], [kexec], [/usr/sbin/kexec], [$PATH:/usr/sbin:/sbin])
78
79 M4_DEFINES=
80
81 # gtkdocize greps for '^GTK_DOC_CHECK', so it needs to be on its own line
82 m4_ifdef([GTK_DOC_CHECK], [
83 GTK_DOC_CHECK([1.18],[--flavour no-tmpl])],
84          [AM_CONDITIONAL([ENABLE_GTK_DOC], [false])
85           enable_gtk_doc=no])
86
87 AS_IF([test "x$enable_gtk_doc" = "xyes" -a "x$XSLTPROC" = x], [
88         AC_MSG_ERROR([*** GTK doc requested but xsltproc not found])
89 ])
90
91 m4_ifdef([GOBJECT_INTROSPECTION_CHECK], [
92 GOBJECT_INTROSPECTION_CHECK([1.31.1])
93 ], [
94    AM_CONDITIONAL([HAVE_INTROSPECTION], [false])
95    enable_introspection=no])
96
97 AC_CHECK_TOOL(STRINGS, strings)
98 AC_CHECK_TOOL(GPERF, gperf)
99 if test -z "$GPERF" ; then
100         AC_MSG_ERROR([*** gperf not found])
101 fi
102
103 # ------------------------------------------------------------------------------
104 address_sanitizer_cflags=
105 address_sanitizer_cppflags=
106 address_sanitizer_ldflags=
107 AC_ARG_ENABLE(address-sanitizer, AS_HELP_STRING([--enable-address-sanitizer], [enable -fsanitize=address]))
108 AS_IF([test "x$enable_address_sanitizer" = "xyes"], [
109             CC_CHECK_FLAG_APPEND([with_as_cflags], [CFLAGS], [-fsanitize=address])
110             AS_IF([test -z "$with_as_cflags"],
111                   [AC_MSG_ERROR([*** -fsanitize=address is not supported])])
112             address_sanitizer_cflags="$with_as_cflags -fno-omit-frame-pointer -DVALGRIND=1"
113             address_sanitizer_cppflags="-DVALGRIND=1"
114             address_sanitizer_ldflags="-Wc,-fsanitize=address"
115       ])
116
117 undefined_sanitizer_cflags=
118 undefined_sanitizer_cppflags=
119 undefined_sanitizer_ldflags=
120 AC_ARG_ENABLE(undefined-sanitizer, AS_HELP_STRING([--enable-undefined-sanitizer], [enable -fsanitize=undefined]))
121 AS_IF([test "x$enable_undefined_sanitizer" = "xyes"], [
122             CC_CHECK_FLAG_APPEND([with_us_cflags], [CFLAGS], [-fsanitize=undefined])
123             AS_IF([test -z "$with_us_cflags"],
124                   [AC_MSG_ERROR([*** -fsanitize=undefined is not supported])])
125             undefined_sanitizer_cflags="$with_us_cflags -fno-omit-frame-pointer -DVALGRIND=1"
126             undefined_sanitizer_cppflags="-DVALGRIND=1"
127             undefined_sanitizer_ldflags="-Wc,-fsanitize=undefined"
128       ])
129
130 sanitizer_cflags="$address_sanitizer_cflags $undefined_sanitizer_cflags"
131 sanitizer_cppflags="$address_sanitizer_cppflags $undefined_sanitizer_cppflags"
132 sanitizer_ldflags="$address_sanitizer_ldflags $undefined_sanitizer_ldflags"
133
134 CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
135         -pipe \
136         -Wall \
137         -Wextra \
138         -Wno-inline \
139         -Wundef \
140         "-Wformat=2 -Wformat-security -Wformat-nonliteral" \
141         -Wlogical-op \
142         -Wsign-compare \
143         -Wmissing-include-dirs \
144         -Wold-style-definition \
145         -Wpointer-arith \
146         -Winit-self \
147         -Wdeclaration-after-statement \
148         -Wfloat-equal \
149         -Wsuggest-attribute=noreturn \
150         -Wmissing-prototypes \
151         -Wstrict-prototypes \
152         -Wredundant-decls \
153         -Wmissing-declarations \
154         -Wmissing-noreturn \
155         -Wshadow \
156         -Wendif-labels \
157         -Wstrict-aliasing=2 \
158         -Wwrite-strings \
159         -Wno-long-long \
160         -Wno-overlength-strings \
161         -Wno-unused-parameter \
162         -Wno-missing-field-initializers \
163         -Wno-unused-result \
164         -Werror=overflow \
165         -Wdate-time \
166         -Wnested-externs \
167         -ffast-math \
168         -fno-common \
169         -fdiagnostics-show-option \
170         -fdiagnostics-color \
171         -fno-strict-aliasing \
172         -fvisibility=hidden \
173         -ffunction-sections \
174         -fdata-sections \
175         -fstack-protector \
176         -fstack-protector-strong \
177         --param=ssp-buffer-size=4])
178 AS_CASE([$CFLAGS], [*-O[[12345\ ]]*],
179         [CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
180                -flto])],
181         [AC_MSG_RESULT([skipping -flto, optimization not enabled])])
182 AC_SUBST([OUR_CFLAGS], "$with_cflags $sanitizer_cflags")
183
184 AS_CASE([$CFLAGS], [*-O[[12345\ ]]*],
185         [CC_CHECK_FLAGS_APPEND([with_cppflags], [CPPFLAGS], [\
186                -Wp,-D_FORTIFY_SOURCE=2])],
187         [AC_MSG_RESULT([skipping -D_FORTIFY_SOURCE, optimization not enabled])])
188 AC_SUBST([OUR_CPPFLAGS], "$with_cppflags $sanitizer_cppflags")
189
190 CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
191         -Wl,--as-needed \
192         -Wl,--no-undefined \
193         -Wl,--gc-sections \
194         -Wl,-z,relro \
195         -Wl,-z,now \
196         -Wl,-fuse-ld=gold])
197 AC_SUBST([OUR_LDFLAGS], "$with_ldflags $sanitizer_ldflags")
198
199 AC_CHECK_SIZEOF(pid_t)
200 AC_CHECK_SIZEOF(uid_t)
201 AC_CHECK_SIZEOF(gid_t)
202 AC_CHECK_SIZEOF(time_t)
203 AC_CHECK_SIZEOF(rlim_t,,[
204        #include <sys/time.h>
205        #include <sys/resource.h>
206 ])
207
208 # ------------------------------------------------------------------------------
209 # we use python to build the man page index, and for systemd-python
210 have_python=no
211 AC_ARG_WITH([python],
212         [AS_HELP_STRING([--without-python], [Disable building the man page index and systemd-python (default: test)])])
213
214 have_lxml=no
215 AS_IF([test "x$with_python" != "xno"], [
216         AM_PATH_PYTHON(,, [:])
217         AS_IF(["$PYTHON" -c 'import lxml' 2>/dev/null], [have_lxml=yes], [have_lxml=no])
218         AS_IF([test "$PYTHON" != : -a $have_lxml = yes], [have_python=yes])
219 ])
220 AM_CONDITIONAL([HAVE_PYTHON], [test "x$have_python" = "xyes"])
221 AS_IF([test "x$PYTHON_BINARY" = "x"],
222       [AS_IF([test "x$have_python" = "xyes"],
223              [PYTHON_BINARY="$(which "$PYTHON")"],
224              [PYTHON_BINARY=/usr/bin/python])])
225 AC_ARG_VAR(PYTHON_BINARY, [Python binary used to launch installed scripts])
226
227 AS_IF([test "x$have_python" != "xyes" -a "x$enable_python_devel" = "xyes"],
228       [AC_MSG_ERROR([*** python-devel support requires --with-python])])
229
230 have_python_devel=no
231 AC_ARG_ENABLE(python_devel, AS_HELP_STRING([--disable-python-devel], [Do not build python modules]))
232 AS_IF([test "x$have_python" = "xyes" -a "x$enable_python_devel" != "xno"], [
233       PKG_CHECK_MODULES([PYTHON_DEVEL], [python-${PYTHON_VERSION}],
234             [have_python_devel=yes],
235             [PKG_CHECK_MODULES([PYTHON_DEVEL], [python],
236                   [have_python_devel=yes],
237                   [have_python_devel=no])])
238       AS_IF([test "x$have_python_devel" = xno -a "x$enable_python_devel" = xyes],
239             [AC_MSG_ERROR([*** python-devel support requested but libraries not found])])
240       AC_PATH_PROGS(SPHINX_BUILD, sphinx-build-${PYTHON_VERSION} sphinx-build)
241 ])
242 AM_CONDITIONAL([HAVE_PYTHON_DEVEL], [test "$have_python_devel" = "yes"])
243
244 # ------------------------------------------------------------------------------
245
246 AC_SEARCH_LIBS([dlsym], [dl], [], [AC_MSG_ERROR([*** Dynamic linking loader library not found])])
247 AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers not found])])
248 AC_CHECK_HEADERS([linux/btrfs.h], [], [])
249
250 # unconditionally pull-in librt with old glibc versions
251 AC_SEARCH_LIBS([clock_gettime], [rt], [], [])
252
253 save_LIBS="$LIBS"
254 LIBS=
255 AC_SEARCH_LIBS([cap_init], [cap], [], [AC_MSG_ERROR([*** POSIX caps library not found])])
256 CAP_LIBS="$LIBS"
257 AC_SUBST(CAP_LIBS)
258
259 LIBS=
260 AC_SEARCH_LIBS([mq_open], [rt], [], [AC_MSG_ERROR([*** POSIX RT library not found])])
261 RT_LIBS="$LIBS"
262 AC_SUBST(RT_LIBS)
263 LIBS="$save_LIBS"
264
265 AC_CHECK_FUNCS([fanotify_init fanotify_mark])
266 AC_CHECK_FUNCS([__secure_getenv secure_getenv])
267 AC_CHECK_DECLS([gettid, pivot_root, name_to_handle_at, setns, LO_FLAGS_PARTSCAN], [], [], [[#include <sys/types.h>
268 #include <unistd.h>
269 #include <sys/mount.h>
270 #include <fcntl.h>
271 #include <sched.h>
272 #include <linux/loop.h>]])
273
274 # This makes sure pkg.m4 is available.
275 m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
276
277 # ------------------------------------------------------------------------------
278 have_dbus=no
279 AC_ARG_ENABLE(dbus, AS_HELP_STRING([--disable-dbus], [disable usage of dbus-1 in tests]))
280 AS_IF([test "x$enable_dbus" != "xno"], [
281         PKG_CHECK_MODULES(DBUS, [dbus-1 >= 1.3.2],
282                 [AC_DEFINE(HAVE_DBUS, 1, [Define if dbus-1 library is available]) have_dbus=yes],
283                 [have_dbus=no])
284         AS_IF([test "x$have_dbus" = "xno" -a "x$enable_dbus" = "xyes"],
285                 [AC_MSG_ERROR([*** dbus-1 support requested but libraries not found])])])
286 AM_CONDITIONAL(HAVE_DBUS, [test "$have_dbus" = "yes"])
287
288 # ------------------------------------------------------------------------------
289 have_compat_libs=no
290 AC_ARG_ENABLE([compat_libs], AS_HELP_STRING([--enable-compat-libs],[Enable creation of compatibility libraries]),
291                 [case "${enableval}" in
292                         yes) have_compat_libs=yes ;;
293                         no) have_compat_libs=no ;;
294                         *) AC_MSG_ERROR(bad value ${enableval} for --enable-compat-libs) ;;
295                 esac],
296                 [have_compat_libs=no])
297 AM_CONDITIONAL([ENABLE_COMPAT_LIBS], [test "$have_compat_libs" = "yes"])
298
299 # ------------------------------------------------------------------------------
300 have_coverage=no
301 AC_ARG_ENABLE(coverage, AS_HELP_STRING([--enable-coverage], [enable test coverage]))
302 if test "x$enable_coverage" = "xyes" ; then
303         AC_CHECK_PROG(lcov_found, [lcov], [yes], [no])
304         if test "x$lcov_found" = xno ; then
305                 AC_MSG_ERROR([*** lcov support requested but the program was not found])
306         else
307                 lcov_version_major="`lcov --version | cut -d ' ' -f 4 | cut -d '.' -f 1`"
308                 lcov_version_minor="`lcov --version | cut -d ' ' -f 4 | cut -d '.' -f 2`"
309                 if test "$lcov_version_major" -eq 1 -a "$lcov_version_minor" -lt 10; then
310                         AC_MSG_ERROR([*** lcov version is too old. 1.10 required])
311                 else
312                         have_coverage=yes
313                         CC_CHECK_FLAGS_APPEND([with_coverage_cflags], [CFLAGS], [\
314                         -fprofile-arcs \
315                         -ftest-coverage])
316                         AC_SUBST([OUR_CFLAGS], "$with_cflags $with_coverage_cflags")
317                 fi
318         fi
319 fi
320 AM_CONDITIONAL(ENABLE_COVERAGE, [test "$have_coverage" = "yes"])
321
322 # ------------------------------------------------------------------------------
323 have_kmod=no
324 AC_ARG_ENABLE(kmod, AS_HELP_STRING([--disable-kmod], [disable loadable modules support]))
325 if test "x$enable_kmod" != "xno"; then
326         PKG_CHECK_EXISTS([ libkmod ], have_kmod=yes, have_kmod=no)
327         if test "x$have_kmod" = "xyes"; then
328                 PKG_CHECK_MODULES(KMOD, [ libkmod >= 15 ],
329                         [AC_DEFINE(HAVE_KMOD, 1, [Define if kmod is available])],
330                         AC_MSG_ERROR([*** kmod version >= 15 not found]))
331         fi
332         if test "x$have_kmod" = xno -a "x$enable_kmod" = xyes; then
333                 AC_MSG_ERROR([*** kmod support requested, but libraries not found])
334         fi
335 fi
336 AM_CONDITIONAL(HAVE_KMOD, [test "$have_kmod" = "yes"])
337
338 # ------------------------------------------------------------------------------
339 have_blkid=no
340 AC_ARG_ENABLE(blkid, AS_HELP_STRING([--disable-blkid], [disable blkid support]))
341 if test "x$enable_blkid" != "xno"; then
342         PKG_CHECK_MODULES(BLKID, [ blkid >= 2.20 ],
343                 [AC_DEFINE(HAVE_BLKID, 1, [Define if blkid is available]) have_blkid=yes], have_blkid=no)
344         if test "x$have_blkid" = xno -a "x$enable_blkid" = xyes; then
345                 AC_MSG_ERROR([*** blkid support requested but libraries not found])
346         fi
347 fi
348 AM_CONDITIONAL(HAVE_BLKID, [test "$have_blkid" = "yes"])
349
350 # ------------------------------------------------------------------------------
351 have_seccomp=no
352 AC_ARG_ENABLE(seccomp, AS_HELP_STRING([--disable-seccomp], [Disable optional SECCOMP support]))
353 if test "x$enable_seccomp" != "xno"; then
354         PKG_CHECK_MODULES(SECCOMP, [libseccomp >= 1.0.0],
355                [AC_DEFINE(HAVE_SECCOMP, 1, [Define if seccomp is available])
356                 have_seccomp=yes
357                 M4_DEFINES="$M4_DEFINES -DHAVE_SECCOMP"],
358                [have_seccomp=no])
359         if test "x$have_seccomp" = "xno" -a "x$enable_seccomp" = "xyes"; then
360                 AC_MSG_ERROR([*** seccomp support requested but libraries not found])
361         fi
362 fi
363 AM_CONDITIONAL(HAVE_SECCOMP, [test "$have_seccomp" = "yes"])
364
365 # ------------------------------------------------------------------------------
366 have_ima=yes
367 AC_ARG_ENABLE([ima], AS_HELP_STRING([--disable-ima],[Disable optional IMA support]),
368                 [case "${enableval}" in
369                         yes) have_ima=yes ;;
370                         no) have_ima=no ;;
371                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-ima) ;;
372                 esac],
373                 [have_ima=yes])
374
375 if test "x${have_ima}" != xno ; then
376         AC_DEFINE(HAVE_IMA, 1, [Define if IMA is available])
377 fi
378
379 # ------------------------------------------------------------------------------
380 have_chkconfig=yes
381 AC_ARG_ENABLE([chkconfig], AS_HELP_STRING([--disable-chkconfig],[Disable optional chkconfig support]),
382                 [case "${enableval}" in
383                         yes) have_chkconfig=yes ;;
384                         no) have_chkconfig=no ;;
385                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-chkconfig) ;;
386                 esac],
387                 [AC_PATH_PROG(CHKCONFIG, chkconfig)
388                 if test -z "$CHKCONFIG"; then
389                         have_chkconfig=no
390                 else
391                         have_chkconfig=yes
392                 fi])
393
394 if test "x${have_chkconfig}" != xno ; then
395         AC_DEFINE(HAVE_CHKCONFIG, 1, [Define if CHKCONFIG is available])
396 fi
397
398 # ------------------------------------------------------------------------------
399 have_selinux=no
400 AC_ARG_ENABLE(selinux, AS_HELP_STRING([--disable-selinux], [Disable optional SELINUX support]))
401 if test "x$enable_selinux" != "xno"; then
402         PKG_CHECK_MODULES([SELINUX], [libselinux >= 2.1.9],
403                 [AC_DEFINE(HAVE_SELINUX, 1, [Define if SELinux is available])
404                  have_selinux=yes
405                  M4_DEFINES="$M4_DEFINES -DHAVE_SELINUX"],
406                 [have_selinux=no])
407         if test "x$have_selinux" = xno -a "x$enable_selinux" = xyes; then
408                 AC_MSG_ERROR([*** SELinux support requested but libraries not found])
409         fi
410 fi
411 AM_CONDITIONAL(HAVE_SELINUX, [test "$have_selinux" = "yes"])
412
413 have_apparmor=no
414 AC_ARG_ENABLE(apparmor, AS_HELP_STRING([--disable-apparmor], [Disable optional AppArmor support]))
415 if test "x$enable_apparmor" != "xno"; then
416         PKG_CHECK_MODULES([APPARMOR], [libapparmor],
417                 [AC_DEFINE(HAVE_APPARMOR, 1, [Define if AppArmor is available])
418                  have_apparmor=yes
419                  M4_DEFINES="$M4_DEFINES -DHAVE_APPARMOR"],
420                 [have_apparmor=no])
421         if test "x$have_apparmor" = xno -a "x$enable_apparmor" = xyes; then
422                 AC_MSG_ERROR([*** AppArmor support requested but libraries not found])
423         fi
424 fi
425 AM_CONDITIONAL(HAVE_APPARMOR, [test "$have_apparmor" = "yes"])
426
427
428 AC_ARG_WITH(debug-shell,
429         AS_HELP_STRING([--with-debug-shell=PATH],
430                 [Path to debug shell binary]),
431         [SUSHELL="$withval"],[
432         AS_IF([test "x${have_selinux}" != "xno"], [SUSHELL="/sbin/sushell"] , [SUSHELL="/bin/sh"])])
433
434 AC_SUBST(SUSHELL)
435
436 AC_ARG_WITH([debug-tty],
437         AS_HELP_STRING([--with-debug-tty=PATH],
438                 [Specify the tty device for debug shell]),
439         [DEBUGTTY="$withval"],
440         [DEBUGTTY=/dev/tty9])
441
442 AC_SUBST(DEBUGTTY)
443
444 # ------------------------------------------------------------------------------
445 have_xz=no
446 AC_ARG_ENABLE(xz, AS_HELP_STRING([--disable-xz], [Disable optional XZ support]))
447 if test "x$enable_xz" != "xno"; then
448         PKG_CHECK_MODULES(XZ, [ liblzma ],
449                 [AC_DEFINE(HAVE_XZ, 1, [Define if XZ is available]) have_xz=yes], have_xz=no)
450         if test "x$have_xz" = xno -a "x$enable_xz" = xyes; then
451                 AC_MSG_ERROR([*** Xz support requested but libraries not found])
452         fi
453 fi
454 AM_CONDITIONAL(HAVE_XZ, [test "$have_xz" = "yes"])
455
456 # ------------------------------------------------------------------------------
457 AC_ARG_ENABLE([pam],
458         AS_HELP_STRING([--disable-pam],[Disable optional PAM support]),
459                 [case "${enableval}" in
460                         yes) have_pam=yes ;;
461                         no) have_pam=no ;;
462                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-pam) ;;
463                 esac],
464                 [have_pam=auto])
465
466 if test "x${have_pam}" != xno ; then
467         AC_CHECK_HEADERS(
468                 [security/pam_modules.h security/pam_modutil.h security/pam_ext.h],
469                 [have_pam=yes],
470                 [if test "x$have_pam" = xyes ; then
471                         AC_MSG_ERROR([*** PAM headers not found.])
472                 fi])
473
474         AC_CHECK_LIB(
475                 [pam],
476                 [pam_syslog],
477                 [have_pam=yes],
478                 [if test "x$have_pam" = xyes ; then
479                         AC_MSG_ERROR([*** libpam not found.])
480                 fi])
481
482         if test "x$have_pam" = xyes ; then
483                 PAM_LIBS="-lpam -lpam_misc"
484                 AC_DEFINE(HAVE_PAM, 1, [PAM available])
485                 M4_DEFINES="$M4_DEFINES -DHAVE_PAM"
486         else
487                 have_pam=no
488         fi
489 else
490         PAM_LIBS=
491 fi
492 AC_SUBST(PAM_LIBS)
493 AM_CONDITIONAL([HAVE_PAM], [test "x$have_pam" != xno])
494
495 # ------------------------------------------------------------------------------
496 AC_ARG_ENABLE([acl],
497         AS_HELP_STRING([--disable-acl],[Disable optional ACL support]),
498                 [case "${enableval}" in
499                         yes) have_acl=yes ;;
500                         no) have_acl=no ;;
501                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-acl) ;;
502                 esac],
503                 [have_acl=auto])
504
505 if test "x${have_acl}" != xno ; then
506         AC_CHECK_HEADERS(
507                 [sys/acl.h acl/libacl.h],
508                 [have_acl=yes],
509                 [if test "x$have_acl" = xyes ; then
510                         AC_MSG_ERROR([*** ACL headers not found.])
511                 fi])
512
513         AC_CHECK_LIB(
514                 [acl],
515                 [acl_get_file],
516                 [have_acl=yes],
517                 [if test "x$have_acl" = xyes ; then
518                         AC_MSG_ERROR([*** libacl not found.])
519                 fi])
520
521         if test "x$have_acl" = xyes ; then
522                 ACL_LIBS="-lacl"
523                 AC_DEFINE(HAVE_ACL, 1, [ACL available])
524         else
525                 have_acl=no
526         fi
527 else
528         ACL_LIBS=
529 fi
530 AC_SUBST(ACL_LIBS)
531 AM_CONDITIONAL([HAVE_ACL], [test "x$have_acl" != xno])
532
533 # ------------------------------------------------------------------------------
534 AC_ARG_ENABLE([xattr],
535         AS_HELP_STRING([--disable-xattr],[Disable optional XATTR support]),
536                 [case "${enableval}" in
537                         yes) have_xattr=yes ;;
538                         no) have_xattr=no ;;
539                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-xattr) ;;
540                 esac],
541                 [have_xattr=auto])
542
543 if test "x${have_xattr}" != xno ; then
544         AC_CHECK_HEADERS(
545                 [attr/xattr.h],
546                 [have_xattr=yes],
547                 [if test "x$have_xattr" = xyes ; then
548                         AC_MSG_ERROR([*** XATTR headers not found.])
549                 fi])
550
551         AC_CHECK_LIB(
552                 [attr],
553                 [fsetxattr],
554                 [have_xattr=yes],
555                 [if test "x$have_xattr" = xyes ; then
556                         AC_MSG_ERROR([*** libattr not found.])
557                 fi])
558
559         if test "x$have_xattr" = xyes ; then
560                 XATTR_LIBS="-lattr"
561                 AC_DEFINE(HAVE_XATTR, 1, [XATTR available])
562         else
563                 have_xattr=no
564         fi
565 else
566         XATTR_LIBS=
567 fi
568 AC_SUBST(XATTR_LIBS)
569 AM_CONDITIONAL([HAVE_XATTR], [test "x$have_xattr" != xno])
570
571 # ------------------------------------------------------------------------------
572 AC_ARG_ENABLE([smack], AS_HELP_STRING([--disable-smack],[Disable optional SMACK support]),
573                 [case "${enableval}" in
574                         yes) have_smack=yes ;;
575                         no) have_smack=no ;;
576                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-smack) ;;
577                 esac],
578                 [have_smack=auto])
579
580 if test "x${have_xattr}" = xno; then
581         if test "x${have_smack}" = xyes; then
582                 AC_MSG_ERROR(SMACK requires xattr support)
583         else
584                 have_smack=no
585         fi
586 else
587         if test "x${have_smack}" = xauto; then
588                 M4_DEFINES="$M4_DEFINES -DHAVE_SMACK"
589                 have_smack=yes
590         fi
591 fi
592
593 AC_ARG_WITH(smack-run-label,
594 AS_HELP_STRING([--with-smack-run-label=STRING],
595         [run systemd --system with a specific SMACK label]),
596         [AC_DEFINE_UNQUOTED(SMACK_RUN_LABEL, ["$withval"], [Run with a smack label])],
597         [])
598
599 if test "x${have_smack}" = xyes ; then
600         AC_DEFINE(HAVE_SMACK, 1, [Define if SMACK is available])
601 fi
602
603 # ------------------------------------------------------------------------------
604 AC_ARG_ENABLE([gcrypt],
605         AS_HELP_STRING([--disable-gcrypt],[Disable optional GCRYPT support]),
606                 [case "${enableval}" in
607                         yes) have_gcrypt=yes ;;
608                         no) have_gcrypt=no ;;
609                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-gcrypt) ;;
610                 esac],
611                 [have_gcrypt=auto])
612
613 if test "x${have_gcrypt}" != xno ; then
614         AM_PATH_LIBGCRYPT(
615                 [1.4.5],
616                 [have_gcrypt=yes],
617                 [if test "x$have_gcrypt" = xyes ; then
618                         AC_MSG_ERROR([*** GCRYPT headers not found.])
619                 fi])
620
621         if test "x$have_gcrypt" = xyes ; then
622                 GCRYPT_LIBS="$LIBGCRYPT_LIBS"
623                 GCRYPT_CFLAGS="$LIBGCRYPT_CFLAGS"
624                 AC_DEFINE(HAVE_GCRYPT, 1, [GCRYPT available])
625         else
626                 have_gcrypt=no
627         fi
628 else
629         GCRYPT_LIBS=
630         GCRYPT_CFLAGS=
631 fi
632 AC_SUBST(GCRYPT_LIBS)
633 AC_SUBST(GCRYPT_CFLAGS)
634 AM_CONDITIONAL([HAVE_GCRYPT], [test "x$have_gcrypt" != xno])
635
636 # ------------------------------------------------------------------------------
637 AC_ARG_ENABLE([audit],
638         AS_HELP_STRING([--disable-audit],[Disable optional AUDIT support]),
639                 [case "${enableval}" in
640                         yes) have_audit=yes ;;
641                         no) have_audit=no ;;
642                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-audit) ;;
643                 esac],
644                 [have_audit=auto])
645
646 if test "x${have_audit}" != xno ; then
647         AC_CHECK_HEADERS(
648                 [libaudit.h],
649                 [have_audit=yes],
650                 [if test "x$have_audit" = xyes ; then
651                         AC_MSG_ERROR([*** AUDIT headers not found.])
652                 fi])
653
654         AC_CHECK_LIB(
655                 [audit],
656                 [audit_open],
657                 [have_audit=yes],
658                 [if test "x$have_audit" = xyes ; then
659                         AC_MSG_ERROR([*** libaudit not found.])
660                 fi])
661
662         if test "x$have_audit" = xyes ; then
663                 AUDIT_LIBS="-laudit"
664                 AC_DEFINE(HAVE_AUDIT, 1, [AUDIT available])
665         else
666                 have_audit=no
667         fi
668 else
669         AUDIT_LIBS=
670 fi
671 AC_SUBST(AUDIT_LIBS)
672
673 # ------------------------------------------------------------------------------
674 have_libcryptsetup=no
675 AC_ARG_ENABLE(libcryptsetup, AS_HELP_STRING([--disable-libcryptsetup], [disable libcryptsetup tools]))
676 if test "x$enable_libcryptsetup" != "xno"; then
677         PKG_CHECK_MODULES(LIBCRYPTSETUP, [ libcryptsetup >= 1.6.0 ],
678                 [AC_DEFINE(HAVE_LIBCRYPTSETUP, 1, [Define if libcryptsetup is available]) have_libcryptsetup=yes], have_libcryptsetup=no)
679         if test "x$have_libcryptsetup" = xno -a "x$enable_libcryptsetup" = xyes; then
680                 AC_MSG_ERROR([*** libcryptsetup support requested but libraries not found])
681         fi
682 fi
683 AM_CONDITIONAL(HAVE_LIBCRYPTSETUP, [test "$have_libcryptsetup" = "yes"])
684
685 # ------------------------------------------------------------------------------
686 have_qrencode=no
687 AC_ARG_ENABLE(qrencode, AS_HELP_STRING([--disable-qrencode], [disable qrencode support]))
688 if test "x$enable_qrencode" != "xno"; then
689         PKG_CHECK_MODULES(QRENCODE, [ libqrencode ],
690                 [AC_DEFINE(HAVE_QRENCODE, 1, [Define if qrencode is available]) have_qrencode=yes], have_qrencode=no)
691         if test "x$have_qrencode" = xno -a "x$enable_qrencode" = xyes; then
692                 AC_MSG_ERROR([*** qrencode support requested but libraries not found])
693         fi
694 fi
695 AM_CONDITIONAL(HAVE_QRENCODE, [test "$have_qrencode" = "yes"])
696
697 # ------------------------------------------------------------------------------
698 have_microhttpd=no
699 AC_ARG_ENABLE(microhttpd, AS_HELP_STRING([--disable-microhttpd], [disable microhttpd support]))
700 if test "x$enable_microhttpd" != "xno"; then
701         PKG_CHECK_MODULES(MICROHTTPD, [libmicrohttpd >= 0.9.33],
702                 [AC_DEFINE(HAVE_MICROHTTPD, 1, [Define if microhttpd is available]) have_microhttpd=yes], have_microhttpd=no)
703         if test "x$have_microhttpd" = xno -a "x$enable_microhttpd" = xyes; then
704                 AC_MSG_ERROR([*** microhttpd support requested but libraries not found])
705         fi
706 fi
707 AM_CONDITIONAL(HAVE_MICROHTTPD, [test "$have_microhttpd" = "yes"])
708
709 # ------------------------------------------------------------------------------
710 have_gnutls=no
711 AC_ARG_ENABLE(gnutls, AS_HELP_STRING([--disable-gnutls], [disable gnutls support]))
712 if test "x$enable_gnutls" != "xno"; then
713         PKG_CHECK_MODULES(GNUTLS, [gnutls >= 3.1.4],
714                 [AC_DEFINE(HAVE_GNUTLS, 1, [Define if gnutls is available]) have_gnutls=yes], have_gnutls=no)
715         if test "x$have_gnutls" = xno -a "x$enable_gnutls" = xyes; then
716                 AC_MSG_ERROR([*** gnutls support requested but libraries not found])
717         fi
718 fi
719 AM_CONDITIONAL(HAVE_GNUTLS, [test "$have_gnutls" = "yes"])
720
721 # ------------------------------------------------------------------------------
722 have_binfmt=no
723 AC_ARG_ENABLE(binfmt, AS_HELP_STRING([--disable-binfmt], [disable binfmt tool]))
724 if test "x$enable_binfmt" != "xno"; then
725         have_binfmt=yes
726 fi
727 AM_CONDITIONAL(ENABLE_BINFMT, [test "$have_binfmt" = "yes"])
728
729 # ------------------------------------------------------------------------------
730 have_vconsole=no
731 AC_ARG_ENABLE(vconsole, AS_HELP_STRING([--disable-vconsole], [disable vconsole tool]))
732 if test "x$enable_vconsole" != "xno"; then
733         have_vconsole=yes
734 fi
735 AM_CONDITIONAL(ENABLE_VCONSOLE, [test "$have_vconsole" = "yes"])
736
737 # ------------------------------------------------------------------------------
738 have_readahead=no
739 AC_ARG_ENABLE(readahead, AS_HELP_STRING([--disable-readahead], [disable readahead tools]))
740 if test "x$enable_readahead" != "xno"; then
741         have_readahead=yes
742 fi
743 AM_CONDITIONAL(ENABLE_READAHEAD, [test "$have_readahead" = "yes"])
744
745 # ------------------------------------------------------------------------------
746 have_bootchart=no
747 AC_ARG_ENABLE(bootchart, AS_HELP_STRING([--disable-bootchart], [disable bootchart tool]))
748 if test "x$enable_bootchart" != "xno"; then
749         have_bootchart=yes
750 fi
751 AM_CONDITIONAL(ENABLE_BOOTCHART, [test "$have_bootchart" = "yes"])
752
753 # ------------------------------------------------------------------------------
754 have_quotacheck=no
755 AC_ARG_ENABLE(quotacheck, AS_HELP_STRING([--disable-quotacheck], [disable quotacheck tools]))
756 if test "x$enable_quotacheck" != "xno"; then
757         have_quotacheck=yes
758 fi
759 AM_CONDITIONAL(ENABLE_QUOTACHECK, [test "$have_quotacheck" = "yes"])
760
761 # ------------------------------------------------------------------------------
762 have_tmpfiles=no
763 AC_ARG_ENABLE(tmpfiles, AS_HELP_STRING([--disable-tmpfiles], [disable tmpfiles support]))
764 if test "x$enable_tmpfiles" != "xno"; then
765         have_tmpfiles=yes
766 fi
767 AM_CONDITIONAL(ENABLE_TMPFILES, [test "$have_tmpfiles" = "yes"])
768
769 # ------------------------------------------------------------------------------
770 have_randomseed=no
771 AC_ARG_ENABLE(randomseed, AS_HELP_STRING([--disable-randomseed], [disable randomseed tools]))
772 if test "x$enable_randomseed" != "xno"; then
773         have_randomseed=yes
774 fi
775 AM_CONDITIONAL(ENABLE_RANDOMSEED, [test "$have_randomseed" = "yes"])
776
777 # ------------------------------------------------------------------------------
778 have_backlight=no
779 AC_ARG_ENABLE(backlight, AS_HELP_STRING([--disable-backlight], [disable backlight tools]))
780 if test "x$enable_backlight" != "xno"; then
781         have_backlight=yes
782 fi
783 AM_CONDITIONAL(ENABLE_BACKLIGHT, [test "$have_backlight" = "yes"])
784
785 # ------------------------------------------------------------------------------
786 have_rfkill=no
787 AC_ARG_ENABLE(rfkill, AS_HELP_STRING([--disable-rfkill], [disable rfkill tools]))
788 if test "x$enable_rfkill" != "xno"; then
789         have_rfkill=yes
790 fi
791 AM_CONDITIONAL(ENABLE_RFKILL, [test "$have_rfkill" = "yes"])
792
793 # ------------------------------------------------------------------------------
794 have_logind=no
795 AC_ARG_ENABLE(logind, AS_HELP_STRING([--disable-logind], [disable login daemon]))
796 if test "x$enable_logind" != "xno"; then
797         have_logind=yes
798 fi
799 AM_CONDITIONAL(ENABLE_LOGIND, [test "$have_logind" = "yes"])
800 AS_IF([test "$have_logind" = "yes"], [ AC_DEFINE(HAVE_LOGIND, [1], [Logind support available]) ])
801
802 # ------------------------------------------------------------------------------
803 have_machined=no
804 AC_ARG_ENABLE(machined, AS_HELP_STRING([--disable-machined], [disable machine daemon]))
805 if test "x$enable_machined" != "xno"; then
806         have_machined=yes
807 fi
808 AM_CONDITIONAL(ENABLE_MACHINED, [test "$have_machined" = "yes"])
809 AS_IF([test "$have_machined" = "yes"], [ AC_DEFINE(HAVE_MACHINED, [1], [Machined support available]) ])
810
811 # ------------------------------------------------------------------------------
812 have_hostnamed=no
813 AC_ARG_ENABLE(hostnamed, AS_HELP_STRING([--disable-hostnamed], [disable hostname daemon]))
814 if test "x$enable_hostnamed" != "xno"; then
815         have_hostnamed=yes
816 fi
817 AM_CONDITIONAL(ENABLE_HOSTNAMED, [test "$have_hostnamed" = "yes"])
818
819 # ------------------------------------------------------------------------------
820 have_timedated=no
821 AC_ARG_ENABLE(timedated, AS_HELP_STRING([--disable-timedated], [disable timedate daemon]))
822 if test "x$enable_timedated" != "xno"; then
823         have_timedated=yes
824 fi
825 AM_CONDITIONAL(ENABLE_TIMEDATED, [test "$have_timedated" = "yes"])
826
827 # ------------------------------------------------------------------------------
828 have_timesyncd=no
829 AC_ARG_ENABLE(timesyncd, AS_HELP_STRING([--disable-timesyncd], [disable timesync daemon]))
830 if test "x$enable_timesyncd" != "xno"; then
831         have_timesyncd=yes
832 fi
833 AM_CONDITIONAL(ENABLE_TIMESYNCD, [test "$have_timesyncd" = "yes"])
834
835 AC_ARG_WITH(ntp-servers,
836         AS_HELP_STRING([--with-ntp-servers=NTPSERVERS],
837                 [Space-separated list of default NTP servers]),
838         [NTP_SERVERS="$withval"],
839         [NTP_SERVERS="time1.google.com time2.google.com time3.google.com time4.google.com"])
840
841 AC_DEFINE_UNQUOTED(NTP_SERVERS, ["$NTP_SERVERS"], [Default NTP Servers])
842 AC_SUBST(NTP_SERVERS)
843
844 AC_ARG_WITH(time-epoch,
845         AS_HELP_STRING([--with-time-epoch=SECONDS],
846                 [Time epoch for time clients]),
847         [TIME_EPOCH="$withval"],
848         [TIME_EPOCH="`stat -c %Y ${srcdir}/NEWS 2>/dev/null || echo 0`"])
849
850 AC_DEFINE_UNQUOTED(TIME_EPOCH, [$TIME_EPOCH], [Time Epoch])
851
852 # ------------------------------------------------------------------------------
853 have_localed=no
854 AC_ARG_ENABLE(localed, AS_HELP_STRING([--disable-localed], [disable locale daemon]))
855 if test "x$enable_localed" != "xno"; then
856         have_localed=yes
857 fi
858 AM_CONDITIONAL(ENABLE_LOCALED, [test "$have_localed" = "yes"])
859
860 # ------------------------------------------------------------------------------
861 have_coredump=no
862 AC_ARG_ENABLE(coredump, AS_HELP_STRING([--disable-coredump], [disable coredump hook]))
863 if test "x$enable_coredump" != "xno"; then
864         have_coredump=yes
865 fi
866 AM_CONDITIONAL(ENABLE_COREDUMP, [test "$have_coredump" = "yes"])
867
868 # ------------------------------------------------------------------------------
869 have_polkit=no
870 AC_ARG_ENABLE(polkit, AS_HELP_STRING([--disable-polkit], [disable PolicyKit support]))
871 if test "x$enable_polkit" != "xno"; then
872         AC_DEFINE(ENABLE_POLKIT, 1, [Define if PolicyKit support is to be enabled])
873         have_polkit=yes
874 fi
875 AM_CONDITIONAL(ENABLE_POLKIT, [test "x$have_polkit" = "xyes"])
876
877 # ------------------------------------------------------------------------------
878 AC_ARG_ENABLE(networkd, AS_HELP_STRING([--disable-networkd], [disable networkd]))
879 if test "x$enable_networkd" != "xno"; then
880         AC_DEFINE(ENABLE_NETWORKD, 1, [Define if networkd support is to be enabled])
881         have_networkd=yes
882 fi
883 AM_CONDITIONAL(ENABLE_NETWORKD, [test "x$have_networkd" = "xyes"])
884
885 # ------------------------------------------------------------------------------
886 have_efi=no
887 AC_ARG_ENABLE(efi, AS_HELP_STRING([--disable-efi], [disable EFI support]))
888 if test "x$enable_efi" != "xno"; then
889         AC_DEFINE(ENABLE_EFI, 1, [Define if EFI support is to be enabled])
890         have_efi=yes
891 fi
892 AM_CONDITIONAL(ENABLE_EFI, [test "x$have_efi" = "xyes"])
893
894 # ------------------------------------------------------------------------------
895 have_multi_seat_x=no
896 AC_ARG_ENABLE(multi_seat_x, AS_HELP_STRING([--disable-multi-seat-x], [do not build multi-seat-x]))
897 if test "x$enable_multi_seat_x" != "xno"; then
898         have_multi_seat_x=yes
899 fi
900 AM_CONDITIONAL(ENABLE_MULTI_SEAT_X, [test "$have_multi_seat_x" = "yes"])
901
902 # ------------------------------------------------------------------------------
903 have_kdbus=no
904 AC_ARG_ENABLE(kdbus, AS_HELP_STRING([--enable-kdbus], [do connect to kdbus by default]))
905 if test "x$enable_kdbus" = "xyes"; then
906         AC_DEFINE(ENABLE_KDBUS, 1, [Define if kdbus support is to be enabled])
907         have_kdbus=yes
908         M4_DEFINES="$M4_DEFINES -DENABLE_KDBUS"
909 fi
910 AM_CONDITIONAL(ENABLE_KDBUS, [test "$have_kdbus" = "yes"])
911
912 # ------------------------------------------------------------------------------
913 AC_ARG_WITH(rc-local-script-path-start,
914         AS_HELP_STRING([--with-rc-local-script-path-start=PATH],
915                 [Path to /etc/rc.local]),
916         [RC_LOCAL_SCRIPT_PATH_START="$withval"],
917         [RC_LOCAL_SCRIPT_PATH_START="/etc/rc.local"])
918
919 AC_ARG_WITH(rc-local-script-path-stop,
920         AS_HELP_STRING([--with-rc-local-script-path-stop=PATH],
921                 [Path to /usr/sbin/halt.local]),
922         [RC_LOCAL_SCRIPT_PATH_STOP="$withval"],
923         [RC_LOCAL_SCRIPT_PATH_STOP="/usr/sbin/halt.local"])
924
925 AC_DEFINE_UNQUOTED(RC_LOCAL_SCRIPT_PATH_START, ["$RC_LOCAL_SCRIPT_PATH_START"], [Path of /etc/rc.local script])
926 AC_DEFINE_UNQUOTED(RC_LOCAL_SCRIPT_PATH_STOP, ["$RC_LOCAL_SCRIPT_PATH_STOP"], [Path of /usr/sbin/halt.local script])
927
928 AC_SUBST(RC_LOCAL_SCRIPT_PATH_START)
929 AC_SUBST(RC_LOCAL_SCRIPT_PATH_STOP)
930
931 # ------------------------------------------------------------------------------
932 AC_ARG_WITH(kbd-loadkeys,
933         AS_HELP_STRING([--with-kbd-loadkeys=PATH],
934                 [Path to loadkeys]),
935         [KBD_LOADKEYS="$withval"],
936         [KBD_LOADKEYS="/usr/bin/loadkeys"])
937
938 AC_ARG_WITH(kbd-setfont,
939         AS_HELP_STRING([--with-kbd-setfont=PATH],
940                 [Path to setfont]),
941         [KBD_SETFONT="$withval"],
942         [KBD_SETFONT="/usr/bin/setfont"])
943
944 AC_DEFINE_UNQUOTED(KBD_LOADKEYS, ["$KBD_LOADKEYS"], [Path of loadkeys])
945 AC_DEFINE_UNQUOTED(KBD_SETFONT, ["$KBD_SETFONT"], [Path of setfont])
946
947 AC_SUBST(KBD_LOADKEYS)
948 AC_SUBST(KBD_SETFONT)
949
950 AC_ARG_WITH(telinit,
951         AS_HELP_STRING([--with-telinit=PATH],
952                 [Path to telinit]),
953         [TELINIT="$withval"],
954         [TELINIT="/lib/sysvinit/telinit"])
955
956 AC_DEFINE_UNQUOTED(TELINIT, ["$TELINIT"], [Path to telinit])
957
958 AC_SUBST(TELINIT)
959
960 AC_CHECK_HEADERS_ONCE([valgrind/memcheck.h valgrind/valgrind.h])
961
962 # ------------------------------------------------------------------------------
963 have_myhostname=no
964 AC_ARG_ENABLE(myhostname, AS_HELP_STRING([--disable-myhostname], [disable nss-myhostname support]))
965 if test "x$enable_myhostname" != "xno"; then
966         AC_HEADER_STDC
967         AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h unistd.h nss.h sys/ioctl.h sys/auxv.h])
968
969         AC_C_CONST
970         AC_TYPE_SIZE_T
971         AC_HEADER_TIME
972
973         AC_FUNC_MALLOC
974         AC_FUNC_SELECT_ARGTYPES
975         AC_CHECK_FUNCS([gethostbyaddr gethostbyname gettimeofday inet_ntoa memset select socket strcspn strdup strerror strncasecmp strcasecmp strspn])
976
977         have_myhostname=yes
978 fi
979 AM_CONDITIONAL(HAVE_MYHOSTNAME, [test "$have_myhostname" = "yes"])
980
981 # ------------------------------------------------------------------------------
982 AC_ARG_WITH(firmware-path,
983        AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]],
984           [Firmware search path (default="")]),
985        [], [with_firmware_path=""])
986 OLD_IFS=$IFS
987 IFS=:
988 for i in $with_firmware_path; do
989        if test "x${FIRMWARE_PATH}" = "x"; then
990               FIRMWARE_PATH="\\\"${i}/\\\""
991        else
992               FIRMWARE_PATH="${FIRMWARE_PATH}, \\\"${i}/\\\""
993        fi
994 done
995 IFS=$OLD_IFS
996 AC_SUBST(FIRMWARE_PATH)
997 AS_IF([test "x${FIRMWARE_PATH}" != "x"], [ AC_DEFINE(HAVE_FIRMWARE, 1, [Define if FIRMWARE is available]) ])
998 AM_CONDITIONAL(ENABLE_FIRMWARE, [test "x${FIRMWARE_PATH}" != "x"])
999
1000 # ------------------------------------------------------------------------------
1001 AC_ARG_ENABLE([gudev],
1002        AS_HELP_STRING([--disable-gudev], [disable Gobject libudev support @<:@default=enabled@:>@]),
1003        [], [enable_gudev=yes])
1004 AS_IF([test "x$enable_gudev" = "xyes"], [ PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0 gio-2.0]) ])
1005 AM_CONDITIONAL([ENABLE_GUDEV], [test "x$enable_gudev" = "xyes"])
1006 AS_IF([test "x$enable_gudev" = "xyes"], [ AC_DEFINE(HAVE_GLIB, 1, [Define if glib is available]) ])
1007
1008 # ------------------------------------------------------------------------------
1009 have_manpages=no
1010 AC_ARG_ENABLE(manpages, AS_HELP_STRING([--disable-manpages], [disable manpages]))
1011 AS_IF([test "x$enable_manpages" != xno], [have_manpages=yes])
1012 AM_CONDITIONAL(ENABLE_MANPAGES, [test "x$have_manpages" = "xyes"])
1013
1014 # ------------------------------------------------------------------------------
1015
1016 # Location of the init scripts as mandated by LSB
1017 SYSTEM_SYSVINIT_PATH=/etc/init.d
1018 SYSTEM_SYSVRCND_PATH=/etc/rc.d
1019
1020 AC_ARG_WITH([sysvinit-path],
1021         [AS_HELP_STRING([--with-sysvinit-path=PATH],
1022                 [Specify the path to where the SysV init scripts are located])],
1023         [SYSTEM_SYSVINIT_PATH="$withval"],
1024         [])
1025
1026 AC_ARG_WITH([sysvrcnd-path],
1027         [AS_HELP_STRING([--with-sysvrcnd-path=PATH],
1028                 [Specify the path to the base directory for the SysV rcN.d directories])],
1029         [SYSTEM_SYSVRCND_PATH="$withval"],
1030         [])
1031
1032 if test "x${SYSTEM_SYSVINIT_PATH}" != "x" -a "x${SYSTEM_SYSVRCND_PATH}" != "x"; then
1033         AC_DEFINE(HAVE_SYSV_COMPAT, [], [SysV init scripts and rcN.d links are supported.])
1034         SYSTEM_SYSV_COMPAT="yes"
1035         M4_DEFINES="$M4_DEFINES -DHAVE_SYSV_COMPAT"
1036 elif test "x${SYSTEM_SYSVINIT_PATH}" != "x" -o "x${SYSTEM_SYSVRCND_PATH}" != "x"; then
1037         AC_MSG_ERROR([*** You need both --with-sysvinit-path=PATH and --with-sysvrcnd-path=PATH to enable SysV compatibility support, or both empty to disable it.])
1038 else
1039         SYSTEM_SYSV_COMPAT="no"
1040 fi
1041
1042 AC_SUBST(SYSTEM_SYSVINIT_PATH)
1043 AC_SUBST(SYSTEM_SYSVRCND_PATH)
1044 AC_SUBST(M4_DEFINES)
1045
1046 AM_CONDITIONAL(HAVE_SYSV_COMPAT, test "$SYSTEM_SYSV_COMPAT" = "yes")
1047
1048 AC_ARG_WITH([tty-gid],
1049         [AS_HELP_STRING([--with-tty-gid=GID],
1050                 [Specify the numeric GID of the 'tty' group])],
1051         [AC_DEFINE_UNQUOTED(TTY_GID, [$withval], [GID of the 'tty' group])],
1052         [])
1053
1054 AC_ARG_WITH([dbuspolicydir],
1055         AS_HELP_STRING([--with-dbuspolicydir=DIR], [D-Bus policy directory]),
1056         [],
1057         [with_dbuspolicydir=$($PKG_CONFIG --variable=sysconfdir dbus-1)/dbus-1/system.d])
1058
1059 AC_ARG_WITH([dbussessionservicedir],
1060         AS_HELP_STRING([--with-dbussessionservicedir=DIR], [D-Bus session service directory]),
1061         [],
1062         [with_dbussessionservicedir=$($PKG_CONFIG --variable=session_bus_services_dir dbus-1)])
1063
1064 AC_ARG_WITH([dbussystemservicedir],
1065         AS_HELP_STRING([--with-dbussystemservicedir=DIR], [D-Bus system service directory]),
1066         [],
1067         [with_dbussystemservicedir=$(readlink -m $($PKG_CONFIG --variable=session_bus_services_dir dbus-1)/../system-services)])
1068
1069 AC_ARG_WITH([dbusinterfacedir],
1070         AS_HELP_STRING([--with-dbusinterfacedir=DIR], [D-Bus interface directory]),
1071         [],
1072         [with_dbusinterfacedir=$(readlink -m $($PKG_CONFIG --variable=session_bus_services_dir dbus-1)/../interfaces)])
1073
1074 AC_ARG_WITH([bashcompletiondir],
1075         AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]),
1076         [],
1077         [AS_IF([$($PKG_CONFIG --exists bash-completion)], [
1078                 with_bashcompletiondir=$($PKG_CONFIG --variable=completionsdir bash-completion)
1079         ] , [
1080                 with_bashcompletiondir=${datadir}/bash-completion/completions
1081         ])])
1082
1083 AC_ARG_WITH([zshcompletiondir],
1084         AS_HELP_STRING([--with-zshcompletiondir=DIR], [Zsh completions directory]),
1085         [], [with_zshcompletiondir=${datadir}/zsh/site-functions])
1086
1087 AC_ARG_WITH([rootprefix],
1088         AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]),
1089         [], [with_rootprefix=${ac_default_prefix}])
1090
1091 AC_ARG_WITH([rootlibdir],
1092         AS_HELP_STRING([--with-rootlibdir=DIR], [Root directory for libraries necessary for boot]),
1093         [],
1094         [with_rootlibdir=${libdir}])
1095
1096 AC_ARG_WITH([pamlibdir],
1097         AS_HELP_STRING([--with-pamlibdir=DIR], [Directory for PAM modules]),
1098         [],
1099         [with_pamlibdir=${with_rootlibdir}/security])
1100
1101 AC_ARG_WITH([pamconfdir],
1102         AS_HELP_STRING([--with-pamconfdir=DIR], [Directory for PAM configuration]),
1103         [],
1104         [with_pamconfdir=${sysconfdir}/pam.d])
1105
1106 AC_ARG_ENABLE([split-usr],
1107         AS_HELP_STRING([--enable-split-usr], [Assume that /bin, /sbin aren\'t symlinks into /usr]),
1108         [],
1109         [AS_IF([test "x${ac_default_prefix}" != "x${with_rootprefix}"], [
1110                 enable_split_usr=yes
1111         ], [
1112                 enable_split_usr=no
1113         ])])
1114
1115 AS_IF([test "x${enable_split_usr}" = "xyes"], [
1116         AC_DEFINE(HAVE_SPLIT_USR, 1, [Define if /bin, /sbin aren't symlinks into /usr])
1117 ])
1118
1119 # Work around intltoolize and gtk-doc problems in VPATH builds
1120 AM_CONDITIONAL([ENABLE_GTK_DOC_TESTS], [test "x$0" = "x./configure"],
1121                                        [Define to do gtk-doc tests])
1122 AS_IF([test "x$0" != "x./configure"], [
1123         AC_SUBST([INTLTOOL_UPDATE], [/bin/true])
1124 ])
1125
1126 AC_ARG_ENABLE(tests,
1127        [AC_HELP_STRING([--disable-tests], [disable tests])],
1128        enable_tests=$enableval, enable_tests=yes)
1129 AM_CONDITIONAL(ENABLE_TESTS, [test x$enable_tests = xyes])
1130
1131 AC_SUBST([dbuspolicydir], [$with_dbuspolicydir])
1132 AC_SUBST([dbussessionservicedir], [$with_dbussessionservicedir])
1133 AC_SUBST([dbussystemservicedir], [$with_dbussystemservicedir])
1134 AC_SUBST([dbusinterfacedir], [$with_dbusinterfacedir])
1135 AC_SUBST([bashcompletiondir], [$with_bashcompletiondir])
1136 AC_SUBST([zshcompletiondir], [$with_zshcompletiondir])
1137 AC_SUBST([pamlibdir], [$with_pamlibdir])
1138 AC_SUBST([pamconfdir], [$with_pamconfdir])
1139 AC_SUBST([rootprefix], [$with_rootprefix])
1140 AC_SUBST([rootlibdir], [$with_rootlibdir])
1141
1142 AC_CONFIG_FILES([
1143         Makefile po/Makefile.in
1144         docs/libudev/Makefile
1145         docs/libudev/version.xml
1146         docs/gudev/Makefile
1147         docs/gudev/version.xml
1148 ])
1149
1150 AC_OUTPUT
1151 AC_MSG_RESULT([
1152         $PACKAGE_NAME $VERSION
1153
1154         libcryptsetup:           ${have_libcryptsetup}
1155         PAM:                     ${have_pam}
1156         AUDIT:                   ${have_audit}
1157         IMA:                     ${have_ima}
1158         AppArmor:                ${have_apparmor}
1159         SELinux:                 ${have_selinux}
1160         SECCOMP:                 ${have_seccomp}
1161         SMACK:                   ${have_smack}
1162         XZ:                      ${have_xz}
1163         ACL:                     ${have_acl}
1164         XATTR:                   ${have_xattr}
1165         GCRYPT:                  ${have_gcrypt}
1166         QRENCODE:                ${have_qrencode}
1167         MICROHTTPD:              ${have_microhttpd}
1168         CHKCONFIG:               ${have_chkconfig}
1169         GNUTLS:                  ${have_gnutls}
1170         binfmt:                  ${have_binfmt}
1171         vconsole:                ${have_vconsole}
1172         readahead:               ${have_readahead}
1173         bootchart:               ${have_bootchart}
1174         quotacheck:              ${have_quotacheck}
1175         tmpfiles:                ${have_tmpfiles}
1176         randomseed:              ${have_randomseed}
1177         backlight:               ${have_backlight}
1178         rfkill:                  ${have_rfkill}
1179         logind:                  ${have_logind}
1180         machined:                ${have_machined}
1181         hostnamed:               ${have_hostnamed}
1182         timedated:               ${have_timedated}
1183         timesyncd:               ${have_timesyncd}
1184         default NTP servers:     ${NTP_SERVERS}
1185         time epoch:              ${TIME_EPOCH}
1186         localed:                 ${have_localed}
1187         networkd:                ${have_networkd}
1188         coredump:                ${have_coredump}
1189         polkit:                  ${have_polkit}
1190         efi:                     ${have_efi}
1191         kmod:                    ${have_kmod}
1192         blkid:                   ${have_blkid}
1193         dbus:                    ${have_dbus}
1194         nss-myhostname:          ${have_myhostname}
1195         gudev:                   ${enable_gudev}
1196         gintrospection:          ${enable_introspection}
1197         multi-seat-x:            ${have_multi_seat_x}
1198         kdbus:                   ${have_kdbus}
1199         Python:                  ${have_python}
1200         Python Headers:          ${have_python_devel}
1201         man pages:               ${have_manpages}
1202         gtk-doc:                 ${enable_gtk_doc}
1203         test coverage:           ${have_coverage}
1204         Split /usr:              ${enable_split_usr}
1205         SysV compatibility:      ${SYSTEM_SYSV_COMPAT}
1206         compatibility libraries: ${have_compat_libs}
1207
1208         prefix:                  ${prefix}
1209         rootprefix:              ${with_rootprefix}
1210         sysconf dir:             ${sysconfdir}
1211         datarootdir:             ${datarootdir}
1212         includedir:              ${includedir}
1213         include_prefix:          ${INCLUDE_PREFIX}
1214         lib dir:                 ${libdir}
1215         rootlib dir:             ${with_rootlibdir}
1216         SysV init scripts:       ${SYSTEM_SYSVINIT_PATH}
1217         SysV rc?.d directories:  ${SYSTEM_SYSVRCND_PATH}
1218         Build Python:            ${PYTHON}
1219         Installation Python:     ${PYTHON_BINARY}
1220         sphinx binary:           ${SPHINX_BUILD}
1221         firmware path:           ${FIRMWARE_PATH}
1222         PAM modules dir:         ${with_pamlibdir}
1223         PAM configuration dir:   ${with_pamconfdir}
1224         D-Bus policy dir:        ${with_dbuspolicydir}
1225         D-Bus session dir:       ${with_dbussessionservicedir}
1226         D-Bus system dir:        ${with_dbussystemservicedir}
1227         D-Bus interfaces dir:    ${with_dbusinterfacedir}
1228         Bash completions dir:    ${with_bashcompletiondir}
1229         Zsh completions dir:     ${with_zshcompletiondir}
1230         Extra start script:      ${RC_LOCAL_SCRIPT_PATH_START}
1231         Extra stop script:       ${RC_LOCAL_SCRIPT_PATH_STOP}
1232         Debug shell:             ${SUSHELL} @ ${DEBUGTTY}
1233
1234         CFLAGS:                  ${OUR_CFLAGS} ${CFLAGS}
1235         CPPFLAGS:                ${OUR_CPPFLAGS} ${CPPFLAGS}
1236         LDFLAGS:                 ${OUR_LDFLAGS} ${LDFLAGS}
1237         PYTHON_CFLAGS:           ${PYTHON_DEVEL_CFLAGS}
1238         PYTHON_LIBS:             ${PYTHON_DEVEL_LIBS}
1239 ])