chiark / gitweb /
core: check the right variable for failed open()
[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
203 # ------------------------------------------------------------------------------
204 # we use python to build the man page index, and for systemd-python
205 have_python=no
206 AC_ARG_WITH([python],
207         [AS_HELP_STRING([--without-python], [Disable building the man page index and systemd-python (default: test)])])
208
209 have_lxml=no
210 AS_IF([test "x$with_python" != "xno"], [
211         AM_PATH_PYTHON(,, [:])
212         AS_IF(["$PYTHON" -c 'import lxml' 2>/dev/null], [have_lxml=yes], [have_lxml=no])
213         AS_IF([test "$PYTHON" != : -a $have_lxml = yes], [have_python=yes])
214 ])
215 AM_CONDITIONAL([HAVE_PYTHON], [test "x$have_python" = "xyes"])
216 AS_IF([test "x$PYTHON_BINARY" = "x"],
217       [AS_IF([test "x$have_python" = "xyes"],
218              [PYTHON_BINARY="$(which "$PYTHON")"],
219              [PYTHON_BINARY=/usr/bin/python])])
220 AC_ARG_VAR(PYTHON_BINARY, [Python binary used to launch installed scripts])
221
222 AS_IF([test "x$have_python" != "xyes" -a "x$enable_python_devel" = "xyes"],
223       [AC_MSG_ERROR([*** python-devel support requires --with-python])])
224
225 have_python_devel=no
226 AC_ARG_ENABLE(python_devel, AS_HELP_STRING([--disable-python-devel], [Do not build python modules]))
227 AS_IF([test "x$have_python" = "xyes" -a "x$enable_python_devel" != "xno"], [
228       PKG_CHECK_MODULES([PYTHON_DEVEL], [python-${PYTHON_VERSION}],
229             [have_python_devel=yes],
230             [PKG_CHECK_MODULES([PYTHON_DEVEL], [python],
231                   [have_python_devel=yes],
232                   [have_python_devel=no])])
233       AS_IF([test "x$have_python_devel" = xno -a "x$enable_python_devel" = xyes],
234             [AC_MSG_ERROR([*** python-devel support requested but libraries not found])])
235       AC_PATH_PROGS(SPHINX_BUILD, sphinx-build-${PYTHON_VERSION} sphinx-build)
236 ])
237 AM_CONDITIONAL([HAVE_PYTHON_DEVEL], [test "$have_python_devel" = "yes"])
238
239 # ------------------------------------------------------------------------------
240
241 AC_SEARCH_LIBS([dlsym], [dl], [], [AC_MSG_ERROR([*** Dynamic linking loader library not found])])
242 AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers not found])])
243 AC_CHECK_HEADERS([linux/btrfs.h], [], [])
244
245 # unconditionally pull-in librt with old glibc versions
246 AC_SEARCH_LIBS([clock_gettime], [rt], [], [])
247
248 save_LIBS="$LIBS"
249 LIBS=
250 AC_SEARCH_LIBS([cap_init], [cap], [], [AC_MSG_ERROR([*** POSIX caps library not found])])
251 CAP_LIBS="$LIBS"
252 AC_SUBST(CAP_LIBS)
253
254 LIBS=
255 AC_SEARCH_LIBS([mq_open], [rt], [], [AC_MSG_ERROR([*** POSIX RT library not found])])
256 RT_LIBS="$LIBS"
257 AC_SUBST(RT_LIBS)
258 LIBS="$save_LIBS"
259
260 AC_CHECK_FUNCS([fanotify_init fanotify_mark])
261 AC_CHECK_FUNCS([__secure_getenv secure_getenv])
262 AC_CHECK_DECLS([gettid, pivot_root, name_to_handle_at, setns, LO_FLAGS_PARTSCAN], [], [], [[#include <sys/types.h>
263 #include <unistd.h>
264 #include <sys/mount.h>
265 #include <fcntl.h>
266 #include <sched.h>
267 #include <linux/loop.h>]])
268
269 # This makes sure pkg.m4 is available.
270 m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
271
272 # ------------------------------------------------------------------------------
273 have_dbus=no
274 AC_ARG_ENABLE(dbus, AS_HELP_STRING([--disable-dbus], [disable usage of dbus-1 in tests]))
275 AS_IF([test "x$enable_dbus" != "xno"], [
276         PKG_CHECK_MODULES(DBUS, [dbus-1 >= 1.3.2],
277                 [AC_DEFINE(HAVE_DBUS, 1, [Define if dbus-1 library is available]) have_dbus=yes],
278                 [have_dbus=no])
279         AS_IF([test "x$have_dbus" = "xno" -a "x$enable_dbus" = "xyes"],
280                 [AC_MSG_ERROR([*** dbus-1 support requested but libraries not found])])])
281 AM_CONDITIONAL(HAVE_DBUS, [test "$have_dbus" = "yes"])
282
283 # ------------------------------------------------------------------------------
284 have_compat_libs=no
285 AC_ARG_ENABLE([compat_libs], AS_HELP_STRING([--enable-compat-libs],[Enable creation of compatibility libraries]),
286                 [case "${enableval}" in
287                         yes) have_compat_libs=yes ;;
288                         no) have_compat_libs=no ;;
289                         *) AC_MSG_ERROR(bad value ${enableval} for --enable-compat-libs) ;;
290                 esac],
291                 [have_compat_libs=no])
292 AM_CONDITIONAL([ENABLE_COMPAT_LIBS], [test "$have_compat_libs" = "yes"])
293
294 # ------------------------------------------------------------------------------
295 have_coverage=no
296 AC_ARG_ENABLE(coverage, AS_HELP_STRING([--enable-coverage], [enable test coverage]))
297 if test "x$enable_coverage" = "xyes" ; then
298         AC_CHECK_PROG(lcov_found, [lcov], [yes], [no])
299         if test "x$lcov_found" = xno ; then
300                 AC_MSG_ERROR([*** lcov support requested but the program was not found])
301         else
302                 lcov_version_major="`lcov --version | cut -d ' ' -f 4 | cut -d '.' -f 1`"
303                 lcov_version_minor="`lcov --version | cut -d ' ' -f 4 | cut -d '.' -f 2`"
304                 if test "$lcov_version_major" -eq 1 -a "$lcov_version_minor" -lt 10; then
305                         AC_MSG_ERROR([*** lcov version is too old. 1.10 required])
306                 else
307                         have_coverage=yes
308                         CC_CHECK_FLAGS_APPEND([with_coverage_cflags], [CFLAGS], [\
309                         -fprofile-arcs \
310                         -ftest-coverage])
311                         AC_SUBST([OUR_CFLAGS], "$with_cflags $with_coverage_cflags")
312                 fi
313         fi
314 fi
315 AM_CONDITIONAL(ENABLE_COVERAGE, [test "$have_coverage" = "yes"])
316
317 # ------------------------------------------------------------------------------
318 have_kmod=no
319 AC_ARG_ENABLE(kmod, AS_HELP_STRING([--disable-kmod], [disable loadable modules support]))
320 if test "x$enable_kmod" != "xno"; then
321         PKG_CHECK_EXISTS([ libkmod ], have_kmod=yes, have_kmod=no)
322         if test "x$have_kmod" = "xyes"; then
323                 PKG_CHECK_MODULES(KMOD, [ libkmod >= 15 ],
324                         [AC_DEFINE(HAVE_KMOD, 1, [Define if kmod is available])],
325                         AC_MSG_ERROR([*** kmod version >= 15 not found]))
326         fi
327         if test "x$have_kmod" = xno -a "x$enable_kmod" = xyes; then
328                 AC_MSG_ERROR([*** kmod support requested, but libraries not found])
329         fi
330 fi
331 AM_CONDITIONAL(HAVE_KMOD, [test "$have_kmod" = "yes"])
332
333 # ------------------------------------------------------------------------------
334 have_blkid=no
335 AC_ARG_ENABLE(blkid, AS_HELP_STRING([--disable-blkid], [disable blkid support]))
336 if test "x$enable_blkid" != "xno"; then
337         PKG_CHECK_MODULES(BLKID, [ blkid >= 2.20 ],
338                 [AC_DEFINE(HAVE_BLKID, 1, [Define if blkid is available]) have_blkid=yes], have_blkid=no)
339         if test "x$have_blkid" = xno -a "x$enable_blkid" = xyes; then
340                 AC_MSG_ERROR([*** blkid support requested but libraries not found])
341         fi
342 fi
343 AM_CONDITIONAL(HAVE_BLKID, [test "$have_blkid" = "yes"])
344
345 # ------------------------------------------------------------------------------
346 have_seccomp=no
347 AC_ARG_ENABLE(seccomp, AS_HELP_STRING([--disable-seccomp], [Disable optional SECCOMP support]))
348 if test "x$enable_seccomp" != "xno"; then
349         PKG_CHECK_MODULES(SECCOMP, [libseccomp >= 1.0.0],
350                [AC_DEFINE(HAVE_SECCOMP, 1, [Define if seccomp is available])
351                 have_seccomp=yes
352                 M4_DEFINES="$M4_DEFINES -DHAVE_SECCOMP"],
353                [have_seccomp=no])
354         if test "x$have_seccomp" = "xno" -a "x$enable_seccomp" = "xyes"; then
355                 AC_MSG_ERROR([*** seccomp support requested but libraries not found])
356         fi
357 fi
358 AM_CONDITIONAL(HAVE_SECCOMP, [test "$have_seccomp" = "yes"])
359
360 # ------------------------------------------------------------------------------
361 have_ima=yes
362 AC_ARG_ENABLE([ima], AS_HELP_STRING([--disable-ima],[Disable optional IMA support]),
363                 [case "${enableval}" in
364                         yes) have_ima=yes ;;
365                         no) have_ima=no ;;
366                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-ima) ;;
367                 esac],
368                 [have_ima=yes])
369
370 if test "x${have_ima}" != xno ; then
371         AC_DEFINE(HAVE_IMA, 1, [Define if IMA is available])
372 fi
373
374 # ------------------------------------------------------------------------------
375 have_chkconfig=yes
376 AC_ARG_ENABLE([chkconfig], AS_HELP_STRING([--disable-chkconfig],[Disable optional chkconfig support]),
377                 [case "${enableval}" in
378                         yes) have_chkconfig=yes ;;
379                         no) have_chkconfig=no ;;
380                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-chkconfig) ;;
381                 esac],
382                 [AC_PATH_PROG(CHKCONFIG, chkconfig)
383                 if test -z "$CHKCONFIG"; then
384                         have_chkconfig=no
385                 else
386                         have_chkconfig=yes
387                 fi])
388
389 if test "x${have_chkconfig}" != xno ; then
390         AC_DEFINE(HAVE_CHKCONFIG, 1, [Define if CHKCONFIG is available])
391 fi
392
393 # ------------------------------------------------------------------------------
394 have_selinux=no
395 AC_ARG_ENABLE(selinux, AS_HELP_STRING([--disable-selinux], [Disable optional SELINUX support]))
396 if test "x$enable_selinux" != "xno"; then
397         PKG_CHECK_MODULES([SELINUX], [libselinux >= 2.1.9],
398                 [AC_DEFINE(HAVE_SELINUX, 1, [Define if SELinux is available])
399                  have_selinux=yes
400                  M4_DEFINES="$M4_DEFINES -DHAVE_SELINUX"],
401                 [have_selinux=no])
402         if test "x$have_selinux" = xno -a "x$enable_selinux" = xyes; then
403                 AC_MSG_ERROR([*** SELinux support requested but libraries not found])
404         fi
405 fi
406 AM_CONDITIONAL(HAVE_SELINUX, [test "$have_selinux" = "yes"])
407
408 have_apparmor=no
409 AC_ARG_ENABLE(apparmor, AS_HELP_STRING([--disable-apparmor], [Disable optional AppArmor support]))
410 if test "x$enable_apparmor" != "xno"; then
411         PKG_CHECK_MODULES([APPARMOR], [libapparmor],
412                 [AC_DEFINE(HAVE_APPARMOR, 1, [Define if AppArmor is available])
413                  have_apparmor=yes
414                  M4_DEFINES="$M4_DEFINES -DHAVE_APPARMOR"],
415                 [have_apparmor=no])
416         if test "x$have_apparmor" = xno -a "x$enable_apparmor" = xyes; then
417                 AC_MSG_ERROR([*** AppArmor support requested but libraries not found])
418         fi
419 fi
420 AM_CONDITIONAL(HAVE_APPARMOR, [test "$have_apparmor" = "yes"])
421
422
423 AC_ARG_WITH(debug-shell,
424         AS_HELP_STRING([--with-debug-shell=PATH],
425                 [Path to debug shell binary]),
426         [SUSHELL="$withval"],[
427         AS_IF([test "x${have_selinux}" != "xno"], [SUSHELL="/sbin/sushell"] , [SUSHELL="/bin/sh"])])
428
429 AC_SUBST(SUSHELL)
430
431 AC_ARG_WITH([debug-tty],
432         AS_HELP_STRING([--with-debug-tty=PATH],
433                 [Specify the tty device for debug shell]),
434         [DEBUGTTY="$withval"],
435         [DEBUGTTY=/dev/tty9])
436
437 AC_SUBST(DEBUGTTY)
438
439 # ------------------------------------------------------------------------------
440 have_xz=no
441 AC_ARG_ENABLE(xz, AS_HELP_STRING([--disable-xz], [Disable optional XZ support]))
442 if test "x$enable_xz" != "xno"; then
443         PKG_CHECK_MODULES(XZ, [ liblzma ],
444                 [AC_DEFINE(HAVE_XZ, 1, [Define if XZ is available]) have_xz=yes], have_xz=no)
445         if test "x$have_xz" = xno -a "x$enable_xz" = xyes; then
446                 AC_MSG_ERROR([*** Xz support requested but libraries not found])
447         fi
448 fi
449 AM_CONDITIONAL(HAVE_XZ, [test "$have_xz" = "yes"])
450
451 # ------------------------------------------------------------------------------
452 AC_ARG_ENABLE([pam],
453         AS_HELP_STRING([--disable-pam],[Disable optional PAM support]),
454                 [case "${enableval}" in
455                         yes) have_pam=yes ;;
456                         no) have_pam=no ;;
457                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-pam) ;;
458                 esac],
459                 [have_pam=auto])
460
461 if test "x${have_pam}" != xno ; then
462         AC_CHECK_HEADERS(
463                 [security/pam_modules.h security/pam_modutil.h security/pam_ext.h],
464                 [have_pam=yes],
465                 [if test "x$have_pam" = xyes ; then
466                         AC_MSG_ERROR([*** PAM headers not found.])
467                 fi])
468
469         AC_CHECK_LIB(
470                 [pam],
471                 [pam_syslog],
472                 [have_pam=yes],
473                 [if test "x$have_pam" = xyes ; then
474                         AC_MSG_ERROR([*** libpam not found.])
475                 fi])
476
477         if test "x$have_pam" = xyes ; then
478                 PAM_LIBS="-lpam -lpam_misc"
479                 AC_DEFINE(HAVE_PAM, 1, [PAM available])
480                 M4_DEFINES="$M4_DEFINES -DHAVE_PAM"
481         else
482                 have_pam=no
483         fi
484 else
485         PAM_LIBS=
486 fi
487 AC_SUBST(PAM_LIBS)
488 AM_CONDITIONAL([HAVE_PAM], [test "x$have_pam" != xno])
489
490 # ------------------------------------------------------------------------------
491 AC_ARG_ENABLE([acl],
492         AS_HELP_STRING([--disable-acl],[Disable optional ACL support]),
493                 [case "${enableval}" in
494                         yes) have_acl=yes ;;
495                         no) have_acl=no ;;
496                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-acl) ;;
497                 esac],
498                 [have_acl=auto])
499
500 if test "x${have_acl}" != xno ; then
501         AC_CHECK_HEADERS(
502                 [sys/acl.h acl/libacl.h],
503                 [have_acl=yes],
504                 [if test "x$have_acl" = xyes ; then
505                         AC_MSG_ERROR([*** ACL headers not found.])
506                 fi])
507
508         AC_CHECK_LIB(
509                 [acl],
510                 [acl_get_file],
511                 [have_acl=yes],
512                 [if test "x$have_acl" = xyes ; then
513                         AC_MSG_ERROR([*** libacl not found.])
514                 fi])
515
516         if test "x$have_acl" = xyes ; then
517                 ACL_LIBS="-lacl"
518                 AC_DEFINE(HAVE_ACL, 1, [ACL available])
519         else
520                 have_acl=no
521         fi
522 else
523         ACL_LIBS=
524 fi
525 AC_SUBST(ACL_LIBS)
526 AM_CONDITIONAL([HAVE_ACL], [test "x$have_acl" != xno])
527
528 # ------------------------------------------------------------------------------
529 AC_ARG_ENABLE([xattr],
530         AS_HELP_STRING([--disable-xattr],[Disable optional XATTR support]),
531                 [case "${enableval}" in
532                         yes) have_xattr=yes ;;
533                         no) have_xattr=no ;;
534                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-xattr) ;;
535                 esac],
536                 [have_xattr=auto])
537
538 if test "x${have_xattr}" != xno ; then
539         AC_CHECK_HEADERS(
540                 [attr/xattr.h],
541                 [have_xattr=yes],
542                 [if test "x$have_xattr" = xyes ; then
543                         AC_MSG_ERROR([*** XATTR headers not found.])
544                 fi])
545
546         AC_CHECK_LIB(
547                 [attr],
548                 [fsetxattr],
549                 [have_xattr=yes],
550                 [if test "x$have_xattr" = xyes ; then
551                         AC_MSG_ERROR([*** libattr not found.])
552                 fi])
553
554         if test "x$have_xattr" = xyes ; then
555                 XATTR_LIBS="-lattr"
556                 AC_DEFINE(HAVE_XATTR, 1, [XATTR available])
557         else
558                 have_xattr=no
559         fi
560 else
561         XATTR_LIBS=
562 fi
563 AC_SUBST(XATTR_LIBS)
564 AM_CONDITIONAL([HAVE_XATTR], [test "x$have_xattr" != xno])
565
566 # ------------------------------------------------------------------------------
567 AC_ARG_ENABLE([smack], AS_HELP_STRING([--disable-smack],[Disable optional SMACK support]),
568                 [case "${enableval}" in
569                         yes) have_smack=yes ;;
570                         no) have_smack=no ;;
571                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-smack) ;;
572                 esac],
573                 [have_smack=auto])
574
575 if test "x${have_xattr}" = xno; then
576         if test "x${have_smack}" = xyes; then
577                 AC_MSG_ERROR(SMACK requires xattr support)
578         else
579                 have_smack=no
580         fi
581 else
582         if test "x${have_smack}" = xauto; then
583                 M4_DEFINES="$M4_DEFINES -DHAVE_SMACK"
584                 have_smack=yes
585         fi
586 fi
587
588 AC_ARG_WITH(smack-run-label,
589 AS_HELP_STRING([--with-smack-run-label=STRING],
590         [run systemd --system with a specific SMACK label]),
591         [AC_DEFINE_UNQUOTED(SMACK_RUN_LABEL, ["$withval"], [Run with a smack label])],
592         [])
593
594 if test "x${have_smack}" = xyes ; then
595         AC_DEFINE(HAVE_SMACK, 1, [Define if SMACK is available])
596 fi
597
598 # ------------------------------------------------------------------------------
599 AC_ARG_ENABLE([gcrypt],
600         AS_HELP_STRING([--disable-gcrypt],[Disable optional GCRYPT support]),
601                 [case "${enableval}" in
602                         yes) have_gcrypt=yes ;;
603                         no) have_gcrypt=no ;;
604                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-gcrypt) ;;
605                 esac],
606                 [have_gcrypt=auto])
607
608 if test "x${have_gcrypt}" != xno ; then
609         AM_PATH_LIBGCRYPT(
610                 [1.4.5],
611                 [have_gcrypt=yes],
612                 [if test "x$have_gcrypt" = xyes ; then
613                         AC_MSG_ERROR([*** GCRYPT headers not found.])
614                 fi])
615
616         if test "x$have_gcrypt" = xyes ; then
617                 GCRYPT_LIBS="$LIBGCRYPT_LIBS"
618                 GCRYPT_CFLAGS="$LIBGCRYPT_CFLAGS"
619                 AC_DEFINE(HAVE_GCRYPT, 1, [GCRYPT available])
620         else
621                 have_gcrypt=no
622         fi
623 else
624         GCRYPT_LIBS=
625         GCRYPT_CFLAGS=
626 fi
627 AC_SUBST(GCRYPT_LIBS)
628 AC_SUBST(GCRYPT_CFLAGS)
629 AM_CONDITIONAL([HAVE_GCRYPT], [test "x$have_gcrypt" != xno])
630
631 # ------------------------------------------------------------------------------
632 AC_ARG_ENABLE([audit],
633         AS_HELP_STRING([--disable-audit],[Disable optional AUDIT support]),
634                 [case "${enableval}" in
635                         yes) have_audit=yes ;;
636                         no) have_audit=no ;;
637                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-audit) ;;
638                 esac],
639                 [have_audit=auto])
640
641 if test "x${have_audit}" != xno ; then
642         AC_CHECK_HEADERS(
643                 [libaudit.h],
644                 [have_audit=yes],
645                 [if test "x$have_audit" = xyes ; then
646                         AC_MSG_ERROR([*** AUDIT headers not found.])
647                 fi])
648
649         AC_CHECK_LIB(
650                 [audit],
651                 [audit_open],
652                 [have_audit=yes],
653                 [if test "x$have_audit" = xyes ; then
654                         AC_MSG_ERROR([*** libaudit not found.])
655                 fi])
656
657         if test "x$have_audit" = xyes ; then
658                 AUDIT_LIBS="-laudit"
659                 AC_DEFINE(HAVE_AUDIT, 1, [AUDIT available])
660         else
661                 have_audit=no
662         fi
663 else
664         AUDIT_LIBS=
665 fi
666 AC_SUBST(AUDIT_LIBS)
667
668 # ------------------------------------------------------------------------------
669 have_libcryptsetup=no
670 AC_ARG_ENABLE(libcryptsetup, AS_HELP_STRING([--disable-libcryptsetup], [disable libcryptsetup tools]))
671 if test "x$enable_libcryptsetup" != "xno"; then
672         PKG_CHECK_MODULES(LIBCRYPTSETUP, [ libcryptsetup >= 1.6.0 ],
673                 [AC_DEFINE(HAVE_LIBCRYPTSETUP, 1, [Define if libcryptsetup is available]) have_libcryptsetup=yes], have_libcryptsetup=no)
674         if test "x$have_libcryptsetup" = xno -a "x$enable_libcryptsetup" = xyes; then
675                 AC_MSG_ERROR([*** libcryptsetup support requested but libraries not found])
676         fi
677 fi
678 AM_CONDITIONAL(HAVE_LIBCRYPTSETUP, [test "$have_libcryptsetup" = "yes"])
679
680 # ------------------------------------------------------------------------------
681 have_qrencode=no
682 AC_ARG_ENABLE(qrencode, AS_HELP_STRING([--disable-qrencode], [disable qrencode support]))
683 if test "x$enable_qrencode" != "xno"; then
684         PKG_CHECK_MODULES(QRENCODE, [ libqrencode ],
685                 [AC_DEFINE(HAVE_QRENCODE, 1, [Define if qrencode is available]) have_qrencode=yes], have_qrencode=no)
686         if test "x$have_qrencode" = xno -a "x$enable_qrencode" = xyes; then
687                 AC_MSG_ERROR([*** qrencode support requested but libraries not found])
688         fi
689 fi
690 AM_CONDITIONAL(HAVE_QRENCODE, [test "$have_qrencode" = "yes"])
691
692 # ------------------------------------------------------------------------------
693 have_microhttpd=no
694 AC_ARG_ENABLE(microhttpd, AS_HELP_STRING([--disable-microhttpd], [disable microhttpd support]))
695 if test "x$enable_microhttpd" != "xno"; then
696         PKG_CHECK_MODULES(MICROHTTPD, [libmicrohttpd >= 0.9.33],
697                 [AC_DEFINE(HAVE_MICROHTTPD, 1, [Define if microhttpd is available]) have_microhttpd=yes], have_microhttpd=no)
698         if test "x$have_microhttpd" = xno -a "x$enable_microhttpd" = xyes; then
699                 AC_MSG_ERROR([*** microhttpd support requested but libraries not found])
700         fi
701 fi
702 AM_CONDITIONAL(HAVE_MICROHTTPD, [test "$have_microhttpd" = "yes"])
703
704 # ------------------------------------------------------------------------------
705 have_gnutls=no
706 AC_ARG_ENABLE(gnutls, AS_HELP_STRING([--disable-gnutls], [disable gnutls support]))
707 if test "x$enable_gnutls" != "xno"; then
708         PKG_CHECK_MODULES(GNUTLS, [gnutls >= 3.1.4],
709                 [AC_DEFINE(HAVE_GNUTLS, 1, [Define if gnutls is available]) have_gnutls=yes], have_gnutls=no)
710         if test "x$have_gnutls" = xno -a "x$enable_gnutls" = xyes; then
711                 AC_MSG_ERROR([*** gnutls support requested but libraries not found])
712         fi
713 fi
714 AM_CONDITIONAL(HAVE_GNUTLS, [test "$have_gnutls" = "yes"])
715
716 # ------------------------------------------------------------------------------
717 have_binfmt=no
718 AC_ARG_ENABLE(binfmt, AS_HELP_STRING([--disable-binfmt], [disable binfmt tool]))
719 if test "x$enable_binfmt" != "xno"; then
720         have_binfmt=yes
721 fi
722 AM_CONDITIONAL(ENABLE_BINFMT, [test "$have_binfmt" = "yes"])
723
724 # ------------------------------------------------------------------------------
725 have_vconsole=no
726 AC_ARG_ENABLE(vconsole, AS_HELP_STRING([--disable-vconsole], [disable vconsole tool]))
727 if test "x$enable_vconsole" != "xno"; then
728         have_vconsole=yes
729 fi
730 AM_CONDITIONAL(ENABLE_VCONSOLE, [test "$have_vconsole" = "yes"])
731
732 # ------------------------------------------------------------------------------
733 have_readahead=no
734 AC_ARG_ENABLE(readahead, AS_HELP_STRING([--disable-readahead], [disable readahead tools]))
735 if test "x$enable_readahead" != "xno"; then
736         have_readahead=yes
737 fi
738 AM_CONDITIONAL(ENABLE_READAHEAD, [test "$have_readahead" = "yes"])
739
740 # ------------------------------------------------------------------------------
741 have_bootchart=no
742 AC_ARG_ENABLE(bootchart, AS_HELP_STRING([--disable-bootchart], [disable bootchart tool]))
743 if test "x$enable_bootchart" != "xno"; then
744         have_bootchart=yes
745 fi
746 AM_CONDITIONAL(ENABLE_BOOTCHART, [test "$have_bootchart" = "yes"])
747
748 # ------------------------------------------------------------------------------
749 have_quotacheck=no
750 AC_ARG_ENABLE(quotacheck, AS_HELP_STRING([--disable-quotacheck], [disable quotacheck tools]))
751 if test "x$enable_quotacheck" != "xno"; then
752         have_quotacheck=yes
753 fi
754 AM_CONDITIONAL(ENABLE_QUOTACHECK, [test "$have_quotacheck" = "yes"])
755
756 # ------------------------------------------------------------------------------
757 have_tmpfiles=no
758 AC_ARG_ENABLE(tmpfiles, AS_HELP_STRING([--disable-tmpfiles], [disable tmpfiles support]))
759 if test "x$enable_tmpfiles" != "xno"; then
760         have_tmpfiles=yes
761 fi
762 AM_CONDITIONAL(ENABLE_TMPFILES, [test "$have_tmpfiles" = "yes"])
763
764 # ------------------------------------------------------------------------------
765 have_randomseed=no
766 AC_ARG_ENABLE(randomseed, AS_HELP_STRING([--disable-randomseed], [disable randomseed tools]))
767 if test "x$enable_randomseed" != "xno"; then
768         have_randomseed=yes
769 fi
770 AM_CONDITIONAL(ENABLE_RANDOMSEED, [test "$have_randomseed" = "yes"])
771
772 # ------------------------------------------------------------------------------
773 have_backlight=no
774 AC_ARG_ENABLE(backlight, AS_HELP_STRING([--disable-backlight], [disable backlight tools]))
775 if test "x$enable_backlight" != "xno"; then
776         have_backlight=yes
777 fi
778 AM_CONDITIONAL(ENABLE_BACKLIGHT, [test "$have_backlight" = "yes"])
779
780 # ------------------------------------------------------------------------------
781 have_rfkill=no
782 AC_ARG_ENABLE(rfkill, AS_HELP_STRING([--disable-rfkill], [disable rfkill tools]))
783 if test "x$enable_rfkill" != "xno"; then
784         have_rfkill=yes
785 fi
786 AM_CONDITIONAL(ENABLE_RFKILL, [test "$have_rfkill" = "yes"])
787
788 # ------------------------------------------------------------------------------
789 have_logind=no
790 AC_ARG_ENABLE(logind, AS_HELP_STRING([--disable-logind], [disable login daemon]))
791 if test "x$enable_logind" != "xno"; then
792         have_logind=yes
793 fi
794 AM_CONDITIONAL(ENABLE_LOGIND, [test "$have_logind" = "yes"])
795 AS_IF([test "$have_logind" = "yes"], [ AC_DEFINE(HAVE_LOGIND, [1], [Logind support available]) ])
796
797 # ------------------------------------------------------------------------------
798 have_machined=no
799 AC_ARG_ENABLE(machined, AS_HELP_STRING([--disable-machined], [disable machine daemon]))
800 if test "x$enable_machined" != "xno"; then
801         have_machined=yes
802 fi
803 AM_CONDITIONAL(ENABLE_MACHINED, [test "$have_machined" = "yes"])
804 AS_IF([test "$have_machined" = "yes"], [ AC_DEFINE(HAVE_MACHINED, [1], [Machined support available]) ])
805
806 # ------------------------------------------------------------------------------
807 have_hostnamed=no
808 AC_ARG_ENABLE(hostnamed, AS_HELP_STRING([--disable-hostnamed], [disable hostname daemon]))
809 if test "x$enable_hostnamed" != "xno"; then
810         have_hostnamed=yes
811 fi
812 AM_CONDITIONAL(ENABLE_HOSTNAMED, [test "$have_hostnamed" = "yes"])
813
814 # ------------------------------------------------------------------------------
815 have_timedated=no
816 AC_ARG_ENABLE(timedated, AS_HELP_STRING([--disable-timedated], [disable timedate daemon]))
817 if test "x$enable_timedated" != "xno"; then
818         have_timedated=yes
819 fi
820 AM_CONDITIONAL(ENABLE_TIMEDATED, [test "$have_timedated" = "yes"])
821
822 # ------------------------------------------------------------------------------
823 have_timesyncd=no
824 AC_ARG_ENABLE(timesyncd, AS_HELP_STRING([--disable-timesyncd], [disable timesync daemon]))
825 if test "x$enable_timesyncd" != "xno"; then
826         have_timesyncd=yes
827 fi
828 AM_CONDITIONAL(ENABLE_TIMESYNCD, [test "$have_timesyncd" = "yes"])
829
830 AC_ARG_WITH(ntp-servers,
831         AS_HELP_STRING([--with-ntp-servers=NTPSERVERS],
832                 [Space-separated list of default NTP servers]),
833         [NTP_SERVERS="$withval"],
834         [NTP_SERVERS="time1.google.com time2.google.com time3.google.com time4.google.com"])
835
836 AC_DEFINE_UNQUOTED(NTP_SERVERS, ["$NTP_SERVERS"], [Default NTP Servers])
837 AC_SUBST(NTP_SERVERS)
838
839 AC_ARG_WITH(time-epoch,
840         AS_HELP_STRING([--with-time-epoch=SECONDS],
841                 [TIme epoch for time clients]),
842         [TIME_EPOCH="$withval"],
843         [TIME_EPOCH="`stat -c %Y ${srcdir}/NEWS 2>/dev/null || echo 0`"])
844
845 AC_DEFINE_UNQUOTED(TIME_EPOCH, [$TIME_EPOCH], [Time Epoch])
846
847 # ------------------------------------------------------------------------------
848 have_localed=no
849 AC_ARG_ENABLE(localed, AS_HELP_STRING([--disable-localed], [disable locale daemon]))
850 if test "x$enable_localed" != "xno"; then
851         have_localed=yes
852 fi
853 AM_CONDITIONAL(ENABLE_LOCALED, [test "$have_localed" = "yes"])
854
855 # ------------------------------------------------------------------------------
856 have_coredump=no
857 AC_ARG_ENABLE(coredump, AS_HELP_STRING([--disable-coredump], [disable coredump hook]))
858 if test "x$enable_coredump" != "xno"; then
859         have_coredump=yes
860 fi
861 AM_CONDITIONAL(ENABLE_COREDUMP, [test "$have_coredump" = "yes"])
862
863 # ------------------------------------------------------------------------------
864 have_polkit=no
865 AC_ARG_ENABLE(polkit, AS_HELP_STRING([--disable-polkit], [disable PolicyKit support]))
866 if test "x$enable_polkit" != "xno"; then
867         AC_DEFINE(ENABLE_POLKIT, 1, [Define if PolicyKit support is to be enabled])
868         have_polkit=yes
869 fi
870 AM_CONDITIONAL(ENABLE_POLKIT, [test "x$have_polkit" = "xyes"])
871
872 # ------------------------------------------------------------------------------
873 AC_ARG_ENABLE(networkd, AS_HELP_STRING([--disable-networkd], [disable networkd]))
874 if test "x$enable_networkd" != "xno"; then
875         AC_DEFINE(ENABLE_NETWORKD, 1, [Define if networkd support is to be enabled])
876         have_networkd=yes
877 fi
878 AM_CONDITIONAL(ENABLE_NETWORKD, [test "x$have_networkd" = "xyes"])
879
880 # ------------------------------------------------------------------------------
881 have_efi=no
882 AC_ARG_ENABLE(efi, AS_HELP_STRING([--disable-efi], [disable EFI support]))
883 if test "x$enable_efi" != "xno"; then
884         AC_DEFINE(ENABLE_EFI, 1, [Define if EFI support is to be enabled])
885         have_efi=yes
886 fi
887 AM_CONDITIONAL(ENABLE_EFI, [test "x$have_efi" = "xyes"])
888
889 # ------------------------------------------------------------------------------
890 have_multi_seat_x=no
891 AC_ARG_ENABLE(multi_seat_x, AS_HELP_STRING([--disable-multi-seat-x], [do not build multi-seat-x]))
892 if test "x$enable_multi_seat_x" != "xno"; then
893         have_multi_seat_x=yes
894 fi
895 AM_CONDITIONAL(ENABLE_MULTI_SEAT_X, [test "$have_multi_seat_x" = "yes"])
896
897 # ------------------------------------------------------------------------------
898 have_kdbus=no
899 AC_ARG_ENABLE(kdbus, AS_HELP_STRING([--enable-kdbus], [do connect to kdbus by default]))
900 if test "x$enable_kdbus" = "xyes"; then
901         AC_DEFINE(ENABLE_KDBUS, 1, [Define if kdbus support is to be enabled])
902         have_kdbus=yes
903         M4_DEFINES="$M4_DEFINES -DENABLE_KDBUS"
904 fi
905 AM_CONDITIONAL(ENABLE_KDBUS, [test "$have_kdbus" = "yes"])
906
907 # ------------------------------------------------------------------------------
908 AC_ARG_WITH(rc-local-script-path-start,
909         AS_HELP_STRING([--with-rc-local-script-path-start=PATH],
910                 [Path to /etc/rc.local]),
911         [RC_LOCAL_SCRIPT_PATH_START="$withval"],
912         [RC_LOCAL_SCRIPT_PATH_START="/etc/rc.local"])
913
914 AC_ARG_WITH(rc-local-script-path-stop,
915         AS_HELP_STRING([--with-rc-local-script-path-stop=PATH],
916                 [Path to /usr/sbin/halt.local]),
917         [RC_LOCAL_SCRIPT_PATH_STOP="$withval"],
918         [RC_LOCAL_SCRIPT_PATH_STOP="/usr/sbin/halt.local"])
919
920 AC_DEFINE_UNQUOTED(RC_LOCAL_SCRIPT_PATH_START, ["$RC_LOCAL_SCRIPT_PATH_START"], [Path of /etc/rc.local script])
921 AC_DEFINE_UNQUOTED(RC_LOCAL_SCRIPT_PATH_STOP, ["$RC_LOCAL_SCRIPT_PATH_STOP"], [Path of /usr/sbin/halt.local script])
922
923 AC_SUBST(RC_LOCAL_SCRIPT_PATH_START)
924 AC_SUBST(RC_LOCAL_SCRIPT_PATH_STOP)
925
926 # ------------------------------------------------------------------------------
927 AC_ARG_WITH(kbd-loadkeys,
928         AS_HELP_STRING([--with-kbd-loadkeys=PATH],
929                 [Path to loadkeys]),
930         [KBD_LOADKEYS="$withval"],
931         [KBD_LOADKEYS="/usr/bin/loadkeys"])
932
933 AC_ARG_WITH(kbd-setfont,
934         AS_HELP_STRING([--with-kbd-setfont=PATH],
935                 [Path to setfont]),
936         [KBD_SETFONT="$withval"],
937         [KBD_SETFONT="/usr/bin/setfont"])
938
939 AC_DEFINE_UNQUOTED(KBD_LOADKEYS, ["$KBD_LOADKEYS"], [Path of loadkeys])
940 AC_DEFINE_UNQUOTED(KBD_SETFONT, ["$KBD_SETFONT"], [Path of setfont])
941
942 AC_SUBST(KBD_LOADKEYS)
943 AC_SUBST(KBD_SETFONT)
944
945 AC_ARG_WITH(telinit,
946         AS_HELP_STRING([--with-telinit=PATH],
947                 [Path to telinit]),
948         [TELINIT="$withval"],
949         [TELINIT="/lib/sysvinit/telinit"])
950
951 AC_DEFINE_UNQUOTED(TELINIT, ["$TELINIT"], [Path to telinit])
952
953 AC_SUBST(TELINIT)
954
955 AC_CHECK_HEADERS_ONCE([valgrind/memcheck.h valgrind/valgrind.h])
956
957 # ------------------------------------------------------------------------------
958 have_myhostname=no
959 AC_ARG_ENABLE(myhostname, AS_HELP_STRING([--disable-myhostname], [disable nss-myhostname support]))
960 if test "x$enable_myhostname" != "xno"; then
961         AC_HEADER_STDC
962         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])
963
964         AC_C_CONST
965         AC_TYPE_SIZE_T
966         AC_HEADER_TIME
967
968         AC_FUNC_MALLOC
969         AC_FUNC_SELECT_ARGTYPES
970         AC_CHECK_FUNCS([gethostbyaddr gethostbyname gettimeofday inet_ntoa memset select socket strcspn strdup strerror strncasecmp strcasecmp strspn])
971
972         have_myhostname=yes
973 fi
974 AM_CONDITIONAL(HAVE_MYHOSTNAME, [test "$have_myhostname" = "yes"])
975
976 # ------------------------------------------------------------------------------
977 AC_ARG_WITH(firmware-path,
978        AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]],
979           [Firmware search path (default="")]),
980        [], [with_firmware_path=""])
981 OLD_IFS=$IFS
982 IFS=:
983 for i in $with_firmware_path; do
984        if test "x${FIRMWARE_PATH}" = "x"; then
985               FIRMWARE_PATH="\\\"${i}/\\\""
986        else
987               FIRMWARE_PATH="${FIRMWARE_PATH}, \\\"${i}/\\\""
988        fi
989 done
990 IFS=$OLD_IFS
991 AC_SUBST(FIRMWARE_PATH)
992 AS_IF([test "x${FIRMWARE_PATH}" != "x"], [ AC_DEFINE(HAVE_FIRMWARE, 1, [Define if FIRMWARE is available]) ])
993 AM_CONDITIONAL(ENABLE_FIRMWARE, [test "x${FIRMWARE_PATH}" != "x"])
994
995 # ------------------------------------------------------------------------------
996 AC_ARG_ENABLE([gudev],
997        AS_HELP_STRING([--disable-gudev], [disable Gobject libudev support @<:@default=enabled@:>@]),
998        [], [enable_gudev=yes])
999 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]) ])
1000 AM_CONDITIONAL([ENABLE_GUDEV], [test "x$enable_gudev" = "xyes"])
1001 AS_IF([test "x$enable_gudev" = "xyes"], [ AC_DEFINE(HAVE_GLIB, 1, [Define if glib is available]) ])
1002
1003 # ------------------------------------------------------------------------------
1004 have_manpages=no
1005 AC_ARG_ENABLE(manpages, AS_HELP_STRING([--disable-manpages], [disable manpages]))
1006 AS_IF([test "x$enable_manpages" != xno], [have_manpages=yes])
1007 AM_CONDITIONAL(ENABLE_MANPAGES, [test "x$have_manpages" = "xyes"])
1008
1009 # ------------------------------------------------------------------------------
1010
1011 # Location of the init scripts as mandated by LSB
1012 SYSTEM_SYSVINIT_PATH=/etc/init.d
1013 SYSTEM_SYSVRCND_PATH=/etc/rc.d
1014
1015 AC_ARG_WITH([sysvinit-path],
1016         [AS_HELP_STRING([--with-sysvinit-path=PATH],
1017                 [Specify the path to where the SysV init scripts are located])],
1018         [SYSTEM_SYSVINIT_PATH="$withval"],
1019         [])
1020
1021 AC_ARG_WITH([sysvrcnd-path],
1022         [AS_HELP_STRING([--with-sysvrcnd-path=PATH],
1023                 [Specify the path to the base directory for the SysV rcN.d directories])],
1024         [SYSTEM_SYSVRCND_PATH="$withval"],
1025         [])
1026
1027 if test "x${SYSTEM_SYSVINIT_PATH}" != "x" -a "x${SYSTEM_SYSVRCND_PATH}" != "x"; then
1028         AC_DEFINE(HAVE_SYSV_COMPAT, [], [SysV init scripts and rcN.d links are supported.])
1029         SYSTEM_SYSV_COMPAT="yes"
1030         M4_DEFINES="$M4_DEFINES -DHAVE_SYSV_COMPAT"
1031 elif test "x${SYSTEM_SYSVINIT_PATH}" != "x" -o "x${SYSTEM_SYSVRCND_PATH}" != "x"; then
1032         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.])
1033 else
1034         SYSTEM_SYSV_COMPAT="no"
1035 fi
1036
1037 AC_SUBST(SYSTEM_SYSVINIT_PATH)
1038 AC_SUBST(SYSTEM_SYSVRCND_PATH)
1039 AC_SUBST(M4_DEFINES)
1040
1041 AM_CONDITIONAL(HAVE_SYSV_COMPAT, test "$SYSTEM_SYSV_COMPAT" = "yes")
1042
1043 AC_ARG_WITH([tty-gid],
1044         [AS_HELP_STRING([--with-tty-gid=GID],
1045                 [Specify the numeric GID of the 'tty' group])],
1046         [AC_DEFINE_UNQUOTED(TTY_GID, [$withval], [GID of the 'tty' group])],
1047         [])
1048
1049 AC_ARG_WITH([dbuspolicydir],
1050         AS_HELP_STRING([--with-dbuspolicydir=DIR], [D-Bus policy directory]),
1051         [],
1052         [with_dbuspolicydir=$($PKG_CONFIG --variable=sysconfdir dbus-1)/dbus-1/system.d])
1053
1054 AC_ARG_WITH([dbussessionservicedir],
1055         AS_HELP_STRING([--with-dbussessionservicedir=DIR], [D-Bus session service directory]),
1056         [],
1057         [with_dbussessionservicedir=$($PKG_CONFIG --variable=session_bus_services_dir dbus-1)])
1058
1059 AC_ARG_WITH([dbussystemservicedir],
1060         AS_HELP_STRING([--with-dbussystemservicedir=DIR], [D-Bus system service directory]),
1061         [],
1062         [with_dbussystemservicedir=$(readlink -m $($PKG_CONFIG --variable=session_bus_services_dir dbus-1)/../system-services)])
1063
1064 AC_ARG_WITH([dbusinterfacedir],
1065         AS_HELP_STRING([--with-dbusinterfacedir=DIR], [D-Bus interface directory]),
1066         [],
1067         [with_dbusinterfacedir=$(readlink -m $($PKG_CONFIG --variable=session_bus_services_dir dbus-1)/../interfaces)])
1068
1069 AC_ARG_WITH([bashcompletiondir],
1070         AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]),
1071         [],
1072         [AS_IF([$($PKG_CONFIG --exists bash-completion)], [
1073                 with_bashcompletiondir=$($PKG_CONFIG --variable=completionsdir bash-completion)
1074         ] , [
1075                 with_bashcompletiondir=${datadir}/bash-completion/completions
1076         ])])
1077
1078 AC_ARG_WITH([zshcompletiondir],
1079         AS_HELP_STRING([--with-zshcompletiondir=DIR], [Zsh completions directory]),
1080         [], [with_zshcompletiondir=${datadir}/zsh/site-functions])
1081
1082 AC_ARG_WITH([rootprefix],
1083         AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]),
1084         [], [with_rootprefix=${ac_default_prefix}])
1085
1086 AC_ARG_WITH([rootlibdir],
1087         AS_HELP_STRING([--with-rootlibdir=DIR], [Root directory for libraries necessary for boot]),
1088         [],
1089         [with_rootlibdir=${libdir}])
1090
1091 AC_ARG_WITH([pamlibdir],
1092         AS_HELP_STRING([--with-pamlibdir=DIR], [Directory for PAM modules]),
1093         [],
1094         [with_pamlibdir=${with_rootlibdir}/security])
1095
1096 AC_ARG_WITH([pamconfdir],
1097         AS_HELP_STRING([--with-pamconfdir=DIR], [Directory for PAM configuration]),
1098         [],
1099         [with_pamconfdir=${sysconfdir}/pam.d])
1100
1101 AC_ARG_ENABLE([split-usr],
1102         AS_HELP_STRING([--enable-split-usr], [Assume that /bin, /sbin aren\'t symlinks into /usr]),
1103         [],
1104         [AS_IF([test "x${ac_default_prefix}" != "x${with_rootprefix}"], [
1105                 enable_split_usr=yes
1106         ], [
1107                 enable_split_usr=no
1108         ])])
1109
1110 AS_IF([test "x${enable_split_usr}" = "xyes"], [
1111         AC_DEFINE(HAVE_SPLIT_USR, 1, [Define if /bin, /sbin aren't symlinks into /usr])
1112 ])
1113
1114 # Work around intltoolize and gtk-doc problems in VPATH builds
1115 AM_CONDITIONAL([ENABLE_GTK_DOC_TESTS], [test "x$0" = "x./configure"],
1116                                        [Define to do gtk-doc tests])
1117 AS_IF([test "x$0" != "x./configure"], [
1118         AC_SUBST([INTLTOOL_UPDATE], [/bin/true])
1119 ])
1120
1121 AC_ARG_ENABLE(tests,
1122        [AC_HELP_STRING([--disable-tests], [disable tests])],
1123        enable_tests=$enableval, enable_tests=yes)
1124 AM_CONDITIONAL(ENABLE_TESTS, [test x$enable_tests = xyes])
1125
1126 AC_SUBST([dbuspolicydir], [$with_dbuspolicydir])
1127 AC_SUBST([dbussessionservicedir], [$with_dbussessionservicedir])
1128 AC_SUBST([dbussystemservicedir], [$with_dbussystemservicedir])
1129 AC_SUBST([dbusinterfacedir], [$with_dbusinterfacedir])
1130 AC_SUBST([bashcompletiondir], [$with_bashcompletiondir])
1131 AC_SUBST([zshcompletiondir], [$with_zshcompletiondir])
1132 AC_SUBST([pamlibdir], [$with_pamlibdir])
1133 AC_SUBST([pamconfdir], [$with_pamconfdir])
1134 AC_SUBST([rootprefix], [$with_rootprefix])
1135 AC_SUBST([rootlibdir], [$with_rootlibdir])
1136
1137 AC_CONFIG_FILES([
1138         Makefile po/Makefile.in
1139         docs/libudev/Makefile
1140         docs/libudev/version.xml
1141         docs/gudev/Makefile
1142         docs/gudev/version.xml
1143 ])
1144
1145 AC_OUTPUT
1146 AC_MSG_RESULT([
1147         $PACKAGE_NAME $VERSION
1148
1149         libcryptsetup:           ${have_libcryptsetup}
1150         PAM:                     ${have_pam}
1151         AUDIT:                   ${have_audit}
1152         IMA:                     ${have_ima}
1153         AppArmor:                ${have_apparmor}
1154         SELinux:                 ${have_selinux}
1155         SECCOMP:                 ${have_seccomp}
1156         SMACK:                   ${have_smack}
1157         XZ:                      ${have_xz}
1158         ACL:                     ${have_acl}
1159         XATTR:                   ${have_xattr}
1160         GCRYPT:                  ${have_gcrypt}
1161         QRENCODE:                ${have_qrencode}
1162         MICROHTTPD:              ${have_microhttpd}
1163         CHKCONFIG:               ${have_chkconfig}
1164         GNUTLS:                  ${have_gnutls}
1165         binfmt:                  ${have_binfmt}
1166         vconsole:                ${have_vconsole}
1167         readahead:               ${have_readahead}
1168         bootchart:               ${have_bootchart}
1169         quotacheck:              ${have_quotacheck}
1170         tmpfiles:                ${have_tmpfiles}
1171         randomseed:              ${have_randomseed}
1172         backlight:               ${have_backlight}
1173         rfkill:                  ${have_rfkill}
1174         logind:                  ${have_logind}
1175         machined:                ${have_machined}
1176         hostnamed:               ${have_hostnamed}
1177         timedated:               ${have_timedated}
1178         timesyncd:               ${have_timesyncd}
1179         default NTP servers:     ${NTP_SERVERS}
1180         time epoch:              ${TIME_EPOCH}
1181         localed:                 ${have_localed}
1182         networkd:                ${have_networkd}
1183         coredump:                ${have_coredump}
1184         polkit:                  ${have_polkit}
1185         efi:                     ${have_efi}
1186         kmod:                    ${have_kmod}
1187         blkid:                   ${have_blkid}
1188         dbus:                    ${have_dbus}
1189         nss-myhostname:          ${have_myhostname}
1190         gudev:                   ${enable_gudev}
1191         gintrospection:          ${enable_introspection}
1192         multi-seat-x:            ${have_multi_seat_x}
1193         kdbus:                   ${have_kdbus}
1194         Python:                  ${have_python}
1195         Python Headers:          ${have_python_devel}
1196         man pages:               ${have_manpages}
1197         gtk-doc:                 ${enable_gtk_doc}
1198         test coverage:           ${have_coverage}
1199         Split /usr:              ${enable_split_usr}
1200         SysV compatibility:      ${SYSTEM_SYSV_COMPAT}
1201         compatibility libraries: ${have_compat_libs}
1202
1203         prefix:                  ${prefix}
1204         rootprefix:              ${with_rootprefix}
1205         sysconf dir:             ${sysconfdir}
1206         datarootdir:             ${datarootdir}
1207         includedir:              ${includedir}
1208         include_prefix:          ${INCLUDE_PREFIX}
1209         lib dir:                 ${libdir}
1210         rootlib dir:             ${with_rootlibdir}
1211         SysV init scripts:       ${SYSTEM_SYSVINIT_PATH}
1212         SysV rc?.d directories:  ${SYSTEM_SYSVRCND_PATH}
1213         Build Python:            ${PYTHON}
1214         Installation Python:     ${PYTHON_BINARY}
1215         sphinx binary:           ${SPHINX_BUILD}
1216         firmware path:           ${FIRMWARE_PATH}
1217         PAM modules dir:         ${with_pamlibdir}
1218         PAM configuration dir:   ${with_pamconfdir}
1219         D-Bus policy dir:        ${with_dbuspolicydir}
1220         D-Bus session dir:       ${with_dbussessionservicedir}
1221         D-Bus system dir:        ${with_dbussystemservicedir}
1222         D-Bus interfaces dir:    ${with_dbusinterfacedir}
1223         Bash completions dir:    ${with_bashcompletiondir}
1224         Zsh completions dir:     ${with_zshcompletiondir}
1225         Extra start script:      ${RC_LOCAL_SCRIPT_PATH_START}
1226         Extra stop script:       ${RC_LOCAL_SCRIPT_PATH_STOP}
1227         Debug shell:             ${SUSHELL} @ ${DEBUGTTY}
1228
1229         CFLAGS:                  ${OUR_CFLAGS} ${CFLAGS}
1230         CPPFLAGS:                ${OUR_CPPFLAGS} ${CPPFLAGS}
1231         LDFLAGS:                 ${OUR_LDFLAGS} ${LDFLAGS}
1232         PYTHON_CFLAGS:           ${PYTHON_DEVEL_CFLAGS}
1233         PYTHON_LIBS:             ${PYTHON_DEVEL_LIBS}
1234 ])