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