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