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