chiark / gitweb /
build-sys: add autoconf macro to pick macro for x32 compatibility
[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         [197],
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_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules tar-pax no-dist-gzip dist-xz subdir-objects check-news])
37 AM_SILENT_RULES([yes])
38 AC_CANONICAL_HOST
39 AC_DEFINE_UNQUOTED([CANONICAL_HOST], "$host", [Canonical host string.])
40 AS_IF([test "x$host_cpu" = "xmips" || test "x$host_cpu" = "xmipsel" ||
41        test "x$host_cpu" = "xmips64" || test "x$host_cpu" = "xmips64el"],
42       [AC_DEFINE(ARCH_MIPS, [], [Whether on mips arch])])
43 SD_CHECK_MAX_INT_SIZE([time_t], [#include <time.h>])
44
45 LT_PREREQ(2.2)
46 LT_INIT([disable-static])
47
48 # i18n stuff for the PolicyKit policy files
49 IT_PROG_INTLTOOL([0.40.0])
50
51 GETTEXT_PACKAGE=systemd
52 AC_SUBST(GETTEXT_PACKAGE)
53
54 AC_PROG_MKDIR_P
55 AC_PROG_LN_S
56 AC_PROG_SED
57 AC_PROG_GREP
58 AC_PROG_AWK
59
60 AC_PROG_CC
61 AC_PROG_CC_C99
62 AM_PROG_CC_C_O
63 AC_PROG_GCC_TRADITIONAL
64
65 AC_PATH_PROG([M4], [m4])
66 AC_PATH_PROG([XSLTPROC], [xsltproc])
67
68 AC_PATH_PROG([QUOTAON], [quotaon], [/usr/sbin/quotaon])
69 AC_PATH_PROG([QUOTACHECK], [quotacheck], [/usr/sbin/quotacheck])
70
71 AC_PATH_PROG([SETCAP], [setcap], [/usr/sbin/setcap])
72
73 AC_PATH_PROG([KILL], [kill], [/usr/bin/kill])
74
75 # gtkdocize greps for '^GTK_DOC_CHECK', so it needs to be on its own line
76 m4_ifdef([GTK_DOC_CHECK], [
77 GTK_DOC_CHECK([1.18],[--flavour no-tmpl])
78 ], [AM_CONDITIONAL([ENABLE_GTK_DOC], [false])])
79
80 AS_IF([test "x$enable_gtk_doc" = "xyes" -a "x$XSLTPROC" = x], [
81         AC_MSG_ERROR([*** GTK doc requested but xsltproc not found])
82 ])
83
84 m4_ifdef([GOBJECT_INTROSPECTION_CHECK], [
85 GOBJECT_INTROSPECTION_CHECK([1.31.1])
86 ], [
87    AM_CONDITIONAL([HAVE_INTROSPECTION], [false])
88    enable_introspection=no])
89
90 AC_PATH_TOOL(OBJCOPY, objcopy)
91 AC_PATH_TOOL(STRINGS, strings)
92 AC_PATH_TOOL(GPERF, gperf)
93 if test -z "$GPERF" ; then
94         AC_MSG_ERROR([*** gperf not found])
95 fi
96
97 # we use python to build the man page index, and for systemd-python
98 have_python=no
99 have_python_devel=no
100
101 AC_ARG_WITH([python],
102         [AS_HELP_STRING([--without-python], [Disable building the man page index and systemd-python (default: test)])])
103
104 AS_IF([test "x$with_python" != "xno"], [
105         AM_PATH_PYTHON(,, [:])
106         AS_IF([test "$PYTHON" != :], [have_python=yes])
107 ])
108 AM_CONDITIONAL([HAVE_PYTHON], [test "x$have_python" = "xyes"])
109 AS_IF([test "x$PYTHON_BINARY" = "x"],
110       [AS_IF([test "x$have_python" = "xyes"],
111              [PYTHON_BINARY="`which "$PYTHON"`"],
112              [PYTHON_BINARY=/usr/bin/python])])
113 AC_ARG_VAR(PYTHON_BINARY, [Python binary used to launch installed scripts])
114
115 AS_IF([test "x$with_python" != "xno"], [
116         AC_PATH_PROG(PYTHON_CONFIG, python${PYTHON_VERSION}-config)
117         AS_IF([test -n "$PYTHON_CONFIG"], [
118               have_python_devel=yes
119               PYTHON_CFLAGS="`$PYTHON_CONFIG --cflags`"
120               PYTHON_LIBS="`$PYTHON_CONFIG --ldflags`"
121               AC_SUBST(PYTHON_CFLAGS)
122               AC_SUBST(PYTHON_LIBS)
123         ])
124 ])
125 AM_CONDITIONAL([HAVE_PYTHON_DEVEL], [test "$have_python_devel" = "yes"])
126
127 CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
128         -pipe \
129         -Wall \
130         -Wextra \
131         -Wno-inline \
132         -Wundef \
133         -Wformat=2 \
134         -Wlogical-op \
135         -Wsign-compare \
136         -Wformat-security \
137         -Wmissing-include-dirs \
138         -Wformat-nonliteral \
139         -Wold-style-definition \
140         -Wpointer-arith \
141         -Winit-self \
142         -Wdeclaration-after-statement \
143         -Wfloat-equal \
144         -Wmissing-prototypes \
145         -Wstrict-prototypes \
146         -Wredundant-decls \
147         -Wmissing-declarations \
148         -Wmissing-noreturn \
149         -Wshadow \
150         -Wendif-labels \
151         -Wcast-align \
152         -Wstrict-aliasing=2 \
153         -Wwrite-strings \
154         -Wno-long-long \
155         -Wno-overlength-strings \
156         -Wno-unused-parameter \
157         -Wno-missing-field-initializers \
158         -Wno-unused-result \
159         -Werror=overflow \
160         -ffast-math \
161         -fno-common \
162         -fdiagnostics-show-option \
163         -fno-strict-aliasing \
164         -fvisibility=hidden \
165         -ffunction-sections \
166         -fdata-sections \
167         -fstack-protector \
168         --param=ssp-buffer-size=4])
169 AC_SUBST([OUR_CFLAGS], $with_cflags)
170
171 AS_CASE([$CFLAGS], [*-O[[12345\ ]]*], [
172         CC_CHECK_FLAGS_APPEND([with_cppflags], [CPPFLAGS], [\
173                -Wp,-D_FORTIFY_SOURCE=2])], [
174         AC_MSG_RESULT([skipping -D_FORTIFY_SOURCE, optimization not enabled])])
175 AC_SUBST([OUR_CPPFLAGS], $with_cppflags)
176
177 CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
178         -Wl,--as-needed \
179         -Wl,--gc-sections \
180         -Wl,-z,relro \
181         -Wl,-z,now])
182 AC_SUBST([OUR_LDFLAGS], $with_ldflags)
183
184 AC_SEARCH_LIBS([mq_open], [rt], [], [AC_MSG_ERROR([*** POSIX RT library not found])])
185 AC_SEARCH_LIBS([dlsym], [dl], [], [AC_MSG_ERROR([*** Dynamic linking loader library not found])])
186
187 save_LIBS="$LIBS"
188 LIBS=
189 AC_SEARCH_LIBS([cap_init], [cap], [], [AC_MSG_ERROR([*** POSIX caps library not found])])
190 AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers not found])])
191 CAP_LIBS="$LIBS"
192 LIBS="$save_LIBS"
193 AC_SUBST(CAP_LIBS)
194
195 AC_CHECK_FUNCS([fanotify_init fanotify_mark])
196 AC_CHECK_FUNCS([__secure_getenv secure_getenv])
197 AC_CHECK_DECLS([gettid, pivot_root, name_to_handle_at], [], [], [[#include <sys/types.h>
198 #include <unistd.h>
199 #include <sys/mount.h>
200 #include <fcntl.h>]])
201
202 # This makes sure pkg.m4 is available.
203 m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
204
205 PKG_CHECK_MODULES(DBUS, [dbus-1 >= 1.3.2])
206
207 # ------------------------------------------------------------------------------
208 have_kmod=no
209 AC_ARG_ENABLE(kmod, AS_HELP_STRING([--disable-kmod], [disable loadable modules support]))
210 if test "x$enable_kmod" != "xno"; then
211         PKG_CHECK_MODULES(KMOD, [ libkmod >= 5 ],
212                 [AC_DEFINE(HAVE_KMOD, 1, [Define if kmod is available]) have_kmod=yes], have_kmod=no)
213         if test "x$have_kmod" = xno -a "x$enable_kmod" = xyes; then
214                 AC_MSG_ERROR([*** kmod support requested but libraries not found])
215         fi
216 fi
217 AM_CONDITIONAL(HAVE_KMOD, [test "$have_kmod" = "yes"])
218
219 # ------------------------------------------------------------------------------
220 have_blkid=no
221 AC_ARG_ENABLE(blkid, AS_HELP_STRING([--disable-blkid], [disable blkid support]))
222 if test "x$enable_blkid" != "xno"; then
223         PKG_CHECK_MODULES(BLKID, [ blkid >= 2.20 ],
224                 [AC_DEFINE(HAVE_BLKID, 1, [Define if blkid is available]) have_blkid=yes], have_blkid=no)
225         if test "x$have_blkid" = xno -a "x$enable_blkid" = xyes; then
226                 AC_MSG_ERROR([*** blkid support requested but libraries not found])
227         fi
228 fi
229 AM_CONDITIONAL(HAVE_BLKID, [test "$have_blkid" = "yes"])
230
231 # ------------------------------------------------------------------------------
232 have_ima=yes
233 AC_ARG_ENABLE([ima], AS_HELP_STRING([--disable-ima],[Disable optional IMA support]),
234                 [case "${enableval}" in
235                         yes) have_ima=yes ;;
236                         no) have_ima=no ;;
237                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-ima) ;;
238                 esac],
239                 [have_ima=yes])
240
241 if test "x${have_ima}" != xno ; then
242         AC_DEFINE(HAVE_IMA, 1, [Define if IMA is available])
243 fi
244
245 # ------------------------------------------------------------------------------
246 have_chkconfig=yes
247 AC_ARG_ENABLE([chkconfig], AS_HELP_STRING([--disable-chkconfig],[Disable optional chkconfig support]),
248                 [case "${enableval}" in
249                         yes) have_chkconfig=yes ;;
250                         no) have_chkconfig=no ;;
251                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-chkconfig) ;;
252                 esac],
253                 [AC_PATH_PROG(CHKCONFIG, chkconfig)
254                 if test -z "$CHKCONFIG"; then
255                         have_chkconfig=no
256                 else
257                         have_chkconfig=yes
258                 fi])
259
260 if test "x${have_chkconfig}" != xno ; then
261         AC_DEFINE(HAVE_CHKCONFIG, 1, [Define if CHKCONFIG is available])
262 fi
263
264 # ------------------------------------------------------------------------------
265 have_selinux=no
266 AC_ARG_ENABLE(selinux, AS_HELP_STRING([--disable-selinux], [Disable optional SELINUX support]))
267 if test "x$enable_selinux" != "xno"; then
268         PKG_CHECK_MODULES([SELINUX], [libselinux >= 2.1.9],
269                 [AC_DEFINE(HAVE_SELINUX, 1, [Define if SELinux is available]) have_selinux=yes], have_selinux=no)
270         if test "x$have_selinux" = xno -a "x$enable_selinux" = xyes; then
271                 AC_MSG_ERROR([*** SELinux support requested but libraries not found])
272         fi
273 fi
274 AM_CONDITIONAL(HAVE_SELINUX, [test "$have_selinux" = "yes"])
275 if test "x${have_selinux}" != xno ; then
276         sushell=/sbin/sushell
277 else
278         sushell=/bin/bash
279 fi
280 AC_SUBST(sushell)
281
282 # ------------------------------------------------------------------------------
283 have_xz=no
284 AC_ARG_ENABLE(xz, AS_HELP_STRING([--disable-xz], [Disable optional XZ support]))
285 if test "x$enable_xz" != "xno"; then
286         PKG_CHECK_MODULES(XZ, [ liblzma ],
287                 [AC_DEFINE(HAVE_XZ, 1, [Define if XZ is available]) have_xz=yes], have_xz=no)
288         if test "x$have_xz" = xno -a "x$enable_xz" = xyes; then
289                 AC_MSG_ERROR([*** Xz support requested but libraries not found])
290         fi
291 fi
292 AM_CONDITIONAL(HAVE_XZ, [test "$have_xz" = "yes"])
293
294 # ------------------------------------------------------------------------------
295 AC_ARG_ENABLE([tcpwrap],
296         AS_HELP_STRING([--disable-tcpwrap],[Disable optional TCP wrappers support]),
297                 [case "${enableval}" in
298                         yes) have_tcpwrap=yes ;;
299                         no) have_tcpwrap=no ;;
300                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-tcpwrap) ;;
301                 esac],
302                 [have_tcpwrap=auto])
303
304 if test "x${have_tcpwrap}" != xno ; then
305         ACX_LIBWRAP
306         if test "x${LIBWRAP_LIBS}" = x ; then
307                 if test "x$have_tcpwrap" = xyes ; then
308                         AC_MSG_ERROR([*** TCP wrappers support not found.])
309                 fi
310                 have_tcpwrap=no
311         else
312                 have_tcpwrap=yes
313         fi
314 else
315         LIBWRAP_LIBS=
316 fi
317 AC_SUBST(LIBWRAP_LIBS)
318
319 # ------------------------------------------------------------------------------
320 AC_ARG_ENABLE([pam],
321         AS_HELP_STRING([--disable-pam],[Disable optional PAM support]),
322                 [case "${enableval}" in
323                         yes) have_pam=yes ;;
324                         no) have_pam=no ;;
325                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-pam) ;;
326                 esac],
327                 [have_pam=auto])
328
329 if test "x${have_pam}" != xno ; then
330         AC_CHECK_HEADERS(
331                 [security/pam_modules.h security/pam_modutil.h security/pam_ext.h],
332                 [have_pam=yes],
333                 [if test "x$have_pam" = xyes ; then
334                         AC_MSG_ERROR([*** PAM headers not found.])
335                 fi])
336
337         AC_CHECK_LIB(
338                 [pam],
339                 [pam_syslog],
340                 [have_pam=yes],
341                 [if test "x$have_pam" = xyes ; then
342                         AC_MSG_ERROR([*** libpam not found.])
343                 fi])
344
345         if test "x$have_pam" = xyes ; then
346                 PAM_LIBS="-lpam -lpam_misc"
347                 AC_DEFINE(HAVE_PAM, 1, [PAM available])
348         else
349                 have_pam=no
350         fi
351 else
352         PAM_LIBS=
353 fi
354 AC_SUBST(PAM_LIBS)
355 AM_CONDITIONAL([HAVE_PAM], [test "x$have_pam" != xno])
356
357 # ------------------------------------------------------------------------------
358 AC_ARG_ENABLE([acl],
359         AS_HELP_STRING([--disable-acl],[Disable optional ACL support]),
360                 [case "${enableval}" in
361                         yes) have_acl=yes ;;
362                         no) have_acl=no ;;
363                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-acl) ;;
364                 esac],
365                 [have_acl=auto])
366
367 if test "x${have_acl}" != xno ; then
368         AC_CHECK_HEADERS(
369                 [sys/acl.h acl/libacl.h],
370                 [have_acl=yes],
371                 [if test "x$have_acl" = xyes ; then
372                         AC_MSG_ERROR([*** ACL headers not found.])
373                 fi])
374
375         AC_CHECK_LIB(
376                 [acl],
377                 [acl_get_file],
378                 [have_acl=yes],
379                 [if test "x$have_acl" = xyes ; then
380                         AC_MSG_ERROR([*** libacl not found.])
381                 fi])
382
383         if test "x$have_acl" = xyes ; then
384                 ACL_LIBS="-lacl"
385                 AC_DEFINE(HAVE_ACL, 1, [ACL available])
386         else
387                 have_acl=no
388         fi
389 else
390         ACL_LIBS=
391 fi
392 AC_SUBST(ACL_LIBS)
393 AM_CONDITIONAL([HAVE_ACL], [test "x$have_acl" != xno])
394
395 # ------------------------------------------------------------------------------
396 AC_ARG_ENABLE([xattr],
397         AS_HELP_STRING([--disable-xattr],[Disable optional XATTR support]),
398                 [case "${enableval}" in
399                         yes) have_xattr=yes ;;
400                         no) have_xattr=no ;;
401                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-xattr) ;;
402                 esac],
403                 [have_xattr=auto])
404
405 if test "x${have_xattr}" != xno ; then
406         AC_CHECK_HEADERS(
407                 [attr/xattr.h],
408                 [have_xattr=yes],
409                 [if test "x$have_xattr" = xyes ; then
410                         AC_MSG_ERROR([*** XATTR headers not found.])
411                 fi])
412
413         AC_CHECK_LIB(
414                 [attr],
415                 [fsetxattr],
416                 [have_xattr=yes],
417                 [if test "x$have_xattr" = xyes ; then
418                         AC_MSG_ERROR([*** libattr not found.])
419                 fi])
420
421         if test "x$have_xattr" = xyes ; then
422                 XATTR_LIBS="-lattr"
423                 AC_DEFINE(HAVE_XATTR, 1, [XATTR available])
424         else
425                 have_xattr=no
426         fi
427 else
428         XATTR_LIBS=
429 fi
430 AC_SUBST(XATTR_LIBS)
431 AM_CONDITIONAL([HAVE_XATTR], [test "x$have_xattr" != xno])
432
433 # ------------------------------------------------------------------------------
434 AC_ARG_ENABLE([gcrypt],
435         AS_HELP_STRING([--disable-gcrypt],[Disable optional GCRYPT support]),
436                 [case "${enableval}" in
437                         yes) have_gcrypt=yes ;;
438                         no) have_gcrypt=no ;;
439                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-gcrypt) ;;
440                 esac],
441                 [have_gcrypt=auto])
442
443 if test "x${have_gcrypt}" != xno ; then
444         AM_PATH_LIBGCRYPT(
445                 [1.4.5],
446                 [have_gcrypt=yes],
447                 [if test "x$have_gcrypt" = xyes ; then
448                         AC_MSG_ERROR([*** GCRYPT headers not found.])
449                 fi])
450
451         if test "x$have_gcrypt" = xyes ; then
452                 GCRYPT_LIBS="$LIBGCRYPT_LIBS"
453                 GCRYPT_CFLAGS="$LIBGCRYPT_CFLAGS"
454                 AC_DEFINE(HAVE_GCRYPT, 1, [GCRYPT available])
455         else
456                 have_gcrypt=no
457         fi
458 else
459         GCRYPT_LIBS=
460         GCRYPT_CFLAGS=
461 fi
462 AC_SUBST(GCRYPT_LIBS)
463 AC_SUBST(GCRYPT_CFLAGS)
464 AM_CONDITIONAL([HAVE_GCRYPT], [test "x$have_gcrypt" != xno])
465
466 # ------------------------------------------------------------------------------
467 AC_ARG_ENABLE([audit],
468         AS_HELP_STRING([--disable-audit],[Disable optional AUDIT support]),
469                 [case "${enableval}" in
470                         yes) have_audit=yes ;;
471                         no) have_audit=no ;;
472                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-audit) ;;
473                 esac],
474                 [have_audit=auto])
475
476 if test "x${have_audit}" != xno ; then
477         AC_CHECK_HEADERS(
478                 [libaudit.h],
479                 [have_audit=yes],
480                 [if test "x$have_audit" = xyes ; then
481                         AC_MSG_ERROR([*** AUDIT headers not found.])
482                 fi])
483
484         AC_CHECK_LIB(
485                 [audit],
486                 [audit_open],
487                 [have_audit=yes],
488                 [if test "x$have_audit" = xyes ; then
489                         AC_MSG_ERROR([*** libaudit not found.])
490                 fi])
491
492         if test "x$have_audit" = xyes ; then
493                 AUDIT_LIBS="-laudit"
494                 AC_DEFINE(HAVE_AUDIT, 1, [AUDIT available])
495         else
496                 have_audit=no
497         fi
498 else
499         AUDIT_LIBS=
500 fi
501 AC_SUBST(AUDIT_LIBS)
502
503 # ------------------------------------------------------------------------------
504 have_libcryptsetup=no
505 AC_ARG_ENABLE(libcryptsetup, AS_HELP_STRING([--disable-libcryptsetup], [disable libcryptsetup tools]))
506 if test "x$enable_libcryptsetup" != "xno"; then
507         PKG_CHECK_MODULES(LIBCRYPTSETUP, [ libcryptsetup >= 1.4.2 ],
508                 [AC_DEFINE(HAVE_LIBCRYPTSETUP, 1, [Define if libcryptsetup is available]) have_libcryptsetup=yes], have_libcryptsetup=no)
509         if test "x$have_libcryptsetup" = xno -a "x$enable_libcryptsetup" = xyes; then
510                 AC_MSG_ERROR([*** libcryptsetup support requested but libraries not found])
511         fi
512 fi
513 AM_CONDITIONAL(HAVE_LIBCRYPTSETUP, [test "$have_libcryptsetup" = "yes"])
514
515 # ------------------------------------------------------------------------------
516 have_qrencode=no
517 AC_ARG_ENABLE(qrencode, AS_HELP_STRING([--disable-qrencode], [disable qrencode support]))
518 if test "x$enable_qrencode" != "xno"; then
519         PKG_CHECK_MODULES(QRENCODE, [ libqrencode ],
520                 [AC_DEFINE(HAVE_QRENCODE, 1, [Define if qrencode is available]) have_qrencode=yes], have_qrencode=no)
521         if test "x$have_qrencode" = xno -a "x$enable_qrencode" = xyes; then
522                 AC_MSG_ERROR([*** qrencode support requested but libraries not found])
523         fi
524 fi
525 AM_CONDITIONAL(HAVE_QRENCODE, [test "$have_qrencode" = "yes"])
526
527 # ------------------------------------------------------------------------------
528 have_microhttpd=no
529 AC_ARG_ENABLE(microhttpd, AS_HELP_STRING([--disable-microhttpd], [disable microhttpd support]))
530 if test "x$enable_microhttpd" != "xno"; then
531         PKG_CHECK_MODULES(MICROHTTPD, [libmicrohttpd >= 0.9.5],
532                 [AC_DEFINE(HAVE_MICROHTTPD, 1, [Define if microhttpd is available]) have_microhttpd=yes], have_microhttpd=no)
533         if test "x$have_microhttpd" = xno -a "x$enable_microhttpd" = xyes; then
534                 AC_MSG_ERROR([*** microhttpd support requested but libraries not found])
535         fi
536 fi
537 AM_CONDITIONAL(HAVE_MICROHTTPD, [test "$have_microhttpd" = "yes"])
538
539 # ------------------------------------------------------------------------------
540 have_binfmt=no
541 AC_ARG_ENABLE(binfmt, AS_HELP_STRING([--disable-binfmt], [disable binfmt tool]))
542 if test "x$enable_binfmt" != "xno"; then
543         have_binfmt=yes
544 fi
545 AM_CONDITIONAL(ENABLE_BINFMT, [test "$have_binfmt" = "yes"])
546
547 # ------------------------------------------------------------------------------
548 have_vconsole=no
549 AC_ARG_ENABLE(vconsole, AS_HELP_STRING([--disable-vconsole], [disable vconsole tool]))
550 if test "x$enable_vconsole" != "xno"; then
551         have_vconsole=yes
552 fi
553 AM_CONDITIONAL(ENABLE_VCONSOLE, [test "$have_vconsole" = "yes"])
554
555 # ------------------------------------------------------------------------------
556 have_readahead=no
557 AC_ARG_ENABLE(readahead, AS_HELP_STRING([--disable-readahead], [disable readahead tools]))
558 if test "x$enable_readahead" != "xno"; then
559         have_readahead=yes
560 fi
561 AM_CONDITIONAL(ENABLE_READAHEAD, [test "$have_readahead" = "yes"])
562
563 # ------------------------------------------------------------------------------
564 have_bootchart=no
565 AC_ARG_ENABLE(bootchart, AS_HELP_STRING([--disable-bootchart], [disable bootchart tool]))
566 if test "x$enable_bootchart" != "xno"; then
567         have_bootchart=yes
568 fi
569 AM_CONDITIONAL(ENABLE_BOOTCHART, [test "$have_bootchart" = "yes"])
570
571 # ------------------------------------------------------------------------------
572 have_quotacheck=no
573 AC_ARG_ENABLE(quotacheck, AS_HELP_STRING([--disable-quotacheck], [disable quotacheck tools]))
574 if test "x$enable_quotacheck" != "xno"; then
575         have_quotacheck=yes
576 fi
577 AM_CONDITIONAL(ENABLE_QUOTACHECK, [test "$have_quotacheck" = "yes"])
578
579 # ------------------------------------------------------------------------------
580 have_randomseed=no
581 AC_ARG_ENABLE(randomseed, AS_HELP_STRING([--disable-randomseed], [disable randomseed tools]))
582 if test "x$enable_randomseed" != "xno"; then
583         have_randomseed=yes
584 fi
585 AM_CONDITIONAL(ENABLE_RANDOMSEED, [test "$have_randomseed" = "yes"])
586
587 # ------------------------------------------------------------------------------
588 have_logind=no
589 AC_ARG_ENABLE(logind, AS_HELP_STRING([--disable-logind], [disable login daemon]))
590 if test "x$enable_logind" != "xno"; then
591         have_logind=yes
592 fi
593 AM_CONDITIONAL(ENABLE_LOGIND, [test "$have_logind" = "yes"])
594 AS_IF([test "$have_logind" = "yes"], [ AC_DEFINE(HAVE_LOGIND, [1], [Logind support available]) ])
595
596 # ------------------------------------------------------------------------------
597 have_hostnamed=no
598 AC_ARG_ENABLE(hostnamed, AS_HELP_STRING([--disable-hostnamed], [disable hostname daemon]))
599 if test "x$enable_hostnamed" != "xno"; then
600         have_hostnamed=yes
601 fi
602 AM_CONDITIONAL(ENABLE_HOSTNAMED, [test "$have_hostnamed" = "yes"])
603
604 # ------------------------------------------------------------------------------
605 have_timedated=no
606 AC_ARG_ENABLE(timedated, AS_HELP_STRING([--disable-timedated], [disable timedate daemon]))
607 if test "x$enable_timedated" != "xno"; then
608         have_timedated=yes
609 fi
610 AM_CONDITIONAL(ENABLE_TIMEDATED, [test "$have_timedated" = "yes"])
611
612 # ------------------------------------------------------------------------------
613 have_localed=no
614 AC_ARG_ENABLE(localed, AS_HELP_STRING([--disable-localed], [disable locale daemon]))
615 if test "x$enable_localed" != "xno"; then
616         have_localed=yes
617 fi
618 AM_CONDITIONAL(ENABLE_LOCALED, [test "$have_localed" = "yes"])
619
620 # ------------------------------------------------------------------------------
621 have_coredump=no
622 AC_ARG_ENABLE(coredump, AS_HELP_STRING([--disable-coredump], [disable coredump hook]))
623 if test "x$enable_coredump" != "xno"; then
624         have_coredump=yes
625 fi
626 AM_CONDITIONAL(ENABLE_COREDUMP, [test "$have_coredump" = "yes"])
627
628 # ------------------------------------------------------------------------------
629 AC_ARG_WITH(rc-local-script-path-start,
630         AS_HELP_STRING([--with-rc-local-script-path-start=PATH],
631                 [Path to /etc/rc.local]),
632         [RC_LOCAL_SCRIPT_PATH_START="$withval"],
633         [RC_LOCAL_SCRIPT_PATH_START="/etc/rc.local"])
634
635 AC_ARG_WITH(rc-local-script-path-stop,
636         AS_HELP_STRING([--with-rc-local-script-path-stop=PATH],
637                 [Path to /usr/sbin/halt.local]),
638         [RC_LOCAL_SCRIPT_PATH_STOP="$withval"],
639         [RC_LOCAL_SCRIPT_PATH_STOP="/usr/sbin/halt.local"])
640
641 AC_DEFINE_UNQUOTED(RC_LOCAL_SCRIPT_PATH_START, ["$RC_LOCAL_SCRIPT_PATH_START"], [Path of /etc/rc.local script])
642 AC_DEFINE_UNQUOTED(RC_LOCAL_SCRIPT_PATH_STOP, ["$RC_LOCAL_SCRIPT_PATH_STOP"], [Path of /usr/sbin/halt.local script])
643
644 AC_SUBST(RC_LOCAL_SCRIPT_PATH_START)
645 AC_SUBST(RC_LOCAL_SCRIPT_PATH_STOP)
646
647 # ------------------------------------------------------------------------------
648 AC_ARG_WITH(kbd-loadkeys,
649         AS_HELP_STRING([--with-kbd-loadkeys=PATH],
650                 [Path to loadkeys]),
651         [KBD_LOADKEYS="$withval"],
652         [KBD_LOADKEYS="/usr/bin/loadkeys"])
653
654 AC_ARG_WITH(kbd-setfont,
655         AS_HELP_STRING([--with-kbd-setfont=PATH],
656                 [Path to setfont]),
657         [KBD_SETFONT="$withval"],
658         [KBD_SETFONT="/usr/bin/setfont"])
659
660 AC_DEFINE_UNQUOTED(KBD_LOADKEYS, ["$KBD_LOADKEYS"], [Path of loadkeys])
661 AC_DEFINE_UNQUOTED(KBD_SETFONT, ["$KBD_SETFONT"], [Path of setfont])
662
663 AC_SUBST(KBD_LOADKEYS)
664 AC_SUBST(KBD_SETFONT)
665
666 # ------------------------------------------------------------------------------
667 have_myhostname=no
668 AC_ARG_ENABLE(myhostname, AS_HELP_STRING([--disable-myhostname], [disable nss-myhostname support]))
669 if test "x$enable_myhostname" != "xno"; then
670         AC_HEADER_STDC
671         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])
672
673         AC_C_CONST
674         AC_TYPE_SIZE_T
675         AC_HEADER_TIME
676
677         AC_FUNC_MALLOC
678         AC_FUNC_SELECT_ARGTYPES
679         AC_CHECK_FUNCS([gethostbyaddr gethostbyname gettimeofday inet_ntoa memset select socket strcspn strdup strerror strncasecmp strcasecmp strspn])
680
681         have_myhostname=yes
682 fi
683 AM_CONDITIONAL(HAVE_MYHOSTNAME, [test "$have_myhostname" = "yes"])
684
685 # ------------------------------------------------------------------------------
686 AC_ARG_WITH(firmware-path,
687        AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]],
688           [Firmware search path (default=ROOTPREFIX/lib/firmware/updates:ROOTPREFIX/lib/firmware)]),
689        [], [with_firmware_path="$rootprefix/lib/firmware/updates:$rootprefix/lib/firmware"])
690 OLD_IFS=$IFS
691 IFS=:
692 for i in $with_firmware_path; do
693        if test "x${FIRMWARE_PATH}" = "x"; then
694               FIRMWARE_PATH="\\\"${i}/\\\""
695        else
696               FIRMWARE_PATH="${FIRMWARE_PATH}, \\\"${i}/\\\""
697        fi
698 done
699 IFS=$OLD_IFS
700 AC_SUBST([FIRMWARE_PATH], [$FIRMWARE_PATH])
701
702 # ------------------------------------------------------------------------------
703 AC_ARG_ENABLE([gudev],
704        AS_HELP_STRING([--disable-gudev], [disable Gobject libudev support @<:@default=enabled@:>@]),
705        [], [enable_gudev=yes])
706 AS_IF([test "x$enable_gudev" = "xyes"], [ PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0]) ])
707 AM_CONDITIONAL([ENABLE_GUDEV], [test "x$enable_gudev" = "xyes"])
708
709 # ------------------------------------------------------------------------------
710 AC_ARG_ENABLE([keymap],
711        AS_HELP_STRING([--disable-keymap], [disable keymap fixup support @<:@default=enabled@:>@]),
712        [], [enable_keymap=yes])
713 AS_IF([test "x$enable_keymap" = "xyes"], [
714        AC_PATH_PROG([GPERF], [gperf])
715        if test -z "$GPERF"; then
716               AC_MSG_ERROR([gperf is needed])
717        fi
718
719        AC_CHECK_HEADER([linux/input.h], [:], AC_MSG_ERROR([kernel headers not found]))
720        AC_SUBST([INCLUDE_PREFIX], [$(echo '#include <linux/input.h>' | eval $ac_cpp -E - | sed -n '/linux\/input.h/ {s:.*"\(.*\)/linux/input.h".*:\1:; p; q}')])
721 ])
722 AM_CONDITIONAL([ENABLE_KEYMAP], [test "x$enable_keymap" = "xyes"])
723
724 # ------------------------------------------------------------------------------
725 have_manpages=no
726 AC_ARG_ENABLE(manpages, AS_HELP_STRING([--disable-manpages], [disable manpages]))
727 AS_IF([test "x$enable_manpages" != xno], [
728         AS_IF([test "x$enable_manpages" = xyes -a "x$XSLTPROC" = x], [
729                 AC_MSG_ERROR([*** Manpages requested but xsltproc not found])
730         ])
731         AS_IF([test "x$XSLTPROC" != x], [have_manpages=yes])
732 ])
733 AM_CONDITIONAL(ENABLE_MANPAGES, [test "x$have_manpages" = "xyes"])
734
735 # ------------------------------------------------------------------------------
736
737 # Location of the init scripts as mandated by LSB
738 SYSTEM_SYSVINIT_PATH=/etc/init.d
739 SYSTEM_SYSVRCND_PATH=/etc/rc.d
740 M4_DEFINES=
741
742 AC_ARG_WITH([sysvinit-path],
743         [AS_HELP_STRING([--with-sysvinit-path=PATH],
744                 [Specify the path to where the SysV init scripts are located])],
745         [SYSTEM_SYSVINIT_PATH="$withval"],
746         [])
747
748 AC_ARG_WITH([sysvrcnd-path],
749         [AS_HELP_STRING([--with-sysvrcnd-path=PATH],
750                 [Specify the path to the base directory for the SysV rcN.d directories])],
751         [SYSTEM_SYSVRCND_PATH="$withval"],
752         [])
753
754 if test "x${SYSTEM_SYSVINIT_PATH}" != "x" -a "x${SYSTEM_SYSVRCND_PATH}" != "x"; then
755         AC_DEFINE(HAVE_SYSV_COMPAT, [], [SysV init scripts and rcN.d links are supported.])
756         SYSTEM_SYSV_COMPAT="yes"
757         M4_DEFINES="$M4_DEFINES -DHAVE_SYSV_COMPAT"
758 elif test "x${SYSTEM_SYSVINIT_PATH}" != "x" -o "x${SYSTEM_SYSVRCND_PATH}" != "x"; then
759         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.])
760 else
761         SYSTEM_SYSV_COMPAT="no"
762 fi
763
764 AC_SUBST(SYSTEM_SYSVINIT_PATH)
765 AC_SUBST(SYSTEM_SYSVRCND_PATH)
766 AC_SUBST(M4_DEFINES)
767
768 AM_CONDITIONAL(HAVE_SYSV_COMPAT, test "$SYSTEM_SYSV_COMPAT" = "yes")
769
770 AC_ARG_WITH([tty-gid],
771         [AS_HELP_STRING([--with-tty-gid=GID],
772                 [Specify the numeric GID of the 'tty' group])],
773         [AC_DEFINE_UNQUOTED(TTY_GID, [$withval], [GID of the 'tty' group])],
774         [])
775
776 AC_ARG_WITH([dbuspolicydir],
777         AS_HELP_STRING([--with-dbuspolicydir=DIR], [D-Bus policy directory]),
778         [],
779         [with_dbuspolicydir=`pkg-config --variable=sysconfdir dbus-1`/dbus-1/system.d])
780
781 AC_ARG_WITH([dbussessionservicedir],
782         AS_HELP_STRING([--with-dbussessionservicedir=DIR], [D-Bus session service directory]),
783         [],
784         [with_dbussessionservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`])
785
786 AC_ARG_WITH([dbussystemservicedir],
787         AS_HELP_STRING([--with-dbussystemservicedir=DIR], [D-Bus system service directory]),
788         [],
789         [with_dbussystemservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../system-services])
790
791 AC_ARG_WITH([dbusinterfacedir],
792         AS_HELP_STRING([--with-dbusinterfacedir=DIR], [D-Bus interface directory]),
793         [],
794         [with_dbusinterfacedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../interfaces])
795
796 AC_ARG_WITH([rootprefix],
797         AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]),
798         [], [with_rootprefix=${ac_default_prefix}])
799
800 AC_ARG_WITH([rootlibdir],
801         AS_HELP_STRING([--with-rootlibdir=DIR], [Root directory for libraries necessary for boot]),
802         [],
803         [with_rootlibdir=${libdir}])
804
805 AC_ARG_WITH([pamlibdir],
806         AS_HELP_STRING([--with-pamlibdir=DIR], [Directory for PAM modules]),
807         [],
808         [with_pamlibdir=${with_rootlibdir}/security])
809
810 AC_ARG_ENABLE([split-usr],
811         AS_HELP_STRING([--enable-split-usr], [Assume that /bin, /sbin aren\'t symlinks into /usr]),
812         [],
813         [AS_IF([test "x${ac_default_prefix}" != "x${with_rootprefix}"], [
814                 enable_split_usr=yes
815         ], [
816                 enable_split_usr=no
817         ])])
818
819 AS_IF([test "x${enable_split_usr}" = "xyes"], [
820         AC_DEFINE(HAVE_SPLIT_USR, 1, [Define if /bin, /sbin aren't symlinks into /usr])
821 ])
822
823 AC_SUBST([dbuspolicydir], [$with_dbuspolicydir])
824 AC_SUBST([dbussessionservicedir], [$with_dbussessionservicedir])
825 AC_SUBST([dbussystemservicedir], [$with_dbussystemservicedir])
826 AC_SUBST([dbusinterfacedir], [$with_dbusinterfacedir])
827 AC_SUBST([pamlibdir], [$with_pamlibdir])
828 AC_SUBST([rootprefix], [$with_rootprefix])
829 AC_SUBST([rootlibdir], [$with_rootlibdir])
830
831 AC_CONFIG_FILES([
832         Makefile po/Makefile.in
833         docs/libudev/Makefile
834         docs/libudev/version.xml
835         docs/gudev/Makefile
836         docs/gudev/version.xml
837 ])
838
839 AC_OUTPUT
840 AC_MSG_RESULT([
841         $PACKAGE_NAME $VERSION
842
843         libcryptsetup:           ${have_libcryptsetup}
844         tcpwrap:                 ${have_tcpwrap}
845         PAM:                     ${have_pam}
846         AUDIT:                   ${have_audit}
847         IMA:                     ${have_ima}
848         SELinux:                 ${have_selinux}
849         XZ:                      ${have_xz}
850         ACL:                     ${have_acl}
851         XATTR:                   ${have_xattr}
852         GCRYPT:                  ${have_gcrypt}
853         QRENCODE:                ${have_qrencode}
854         MICROHTTPD:              ${have_microhttpd}
855         CHKCONFIG:               ${have_chkconfig}
856         binfmt:                  ${have_binfmt}
857         vconsole:                ${have_vconsole}
858         readahead:               ${have_readahead}
859         bootchart:               ${have_bootchart}
860         quotacheck:              ${have_quotacheck}
861         randomseed:              ${have_randomseed}
862         logind:                  ${have_logind}
863         hostnamed:               ${have_hostnamed}
864         timedated:               ${have_timedated}
865         localed:                 ${have_localed}
866         coredump:                ${have_coredump}
867         kmod:                    ${have_kmod}
868         blkid:                   ${have_blkid}
869         nss-myhostname:          ${have_myhostname}
870         gudev:                   ${enable_gudev}
871         gintrospection:          ${enable_introspection}
872         keymap:                  ${enable_keymap}
873         Python:                  ${have_python}
874         Python Headers:          ${have_python_devel}
875         man pages:               ${have_manpages}
876         gtk-doc:                 ${enable_gtk_doc}
877         Split /usr:              ${enable_split_usr}
878         SysV compatibility:      ${SYSTEM_SYSV_COMPAT}
879
880         prefix:                  ${prefix}
881         rootprefix:              ${with_rootprefix}
882         sysconf dir:             ${sysconfdir}
883         datarootdir:             ${datarootdir}
884         includedir:              ${includedir}
885         include_prefix:          ${INCLUDE_PREFIX}
886         lib dir:                 ${libdir}
887         rootlib dir:             ${with_rootlibdir}
888         SysV init scripts:       ${SYSTEM_SYSVINIT_PATH}
889         SysV rc?.d directories:  ${SYSTEM_SYSVRCND_PATH}
890         Build Python:            ${PYTHON}
891         Installation Python:     ${PYTHON_BINARY}
892         firmware path:           ${FIRMWARE_PATH}
893         PAM modules dir:         ${with_pamlibdir}
894         D-Bus policy dir:        ${with_dbuspolicydir}
895         D-Bus session dir:       ${with_dbussessionservicedir}
896         D-Bus system dir:        ${with_dbussystemservicedir}
897         D-Bus interfaces dir:    ${with_dbusinterfacedir}
898         Extra start script:      ${RC_LOCAL_SCRIPT_PATH_START}
899         Extra stop script:       ${RC_LOCAL_SCRIPT_PATH_STOP}
900
901         CFLAGS:                  ${OUR_CFLAGS} ${CFLAGS}
902         CPPLAGS:                 ${OUR_CPPFLAGS} ${CPPFLAGS}
903         LDFLAGS:                 ${OUR_LDFLAGS} ${LDFLAGS}
904         PYTHON_CFLAGS:           ${PYTHON_CFLAGS}
905         PYTHON_LIBS:             ${PYTHON_LIBS}
906 ])