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