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