chiark / gitweb /
udev: set errno = ENOSYS for removed interfaces
[elogind.git] / configure.ac
1 #  This file is part of systemd.
2 #
3 #  Copyright 2010-2012 Lennart Poettering
4 #  Copyright 2010-2012 Kay Sievers
5 #
6 #  systemd is free software; you can redistribute it and/or modify it
7 #  under the terms of the GNU General Public License as published by
8 #  the Free Software Foundation; either version 2 of the License, or
9 #  (at your option) any later version.
10 #
11 #  systemd is distributed in the hope that it will be useful, but
12 #  WITHOUT ANY WARRANTY; without even the implied warranty of
13 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 #  General Public License for more details.
15 #
16 #  You should have received a copy of the GNU General Public License
17 #  along with systemd; If not, see <http://www.gnu.org/licenses/>.
18
19 AC_PREREQ(2.63)
20
21 AC_INIT([systemd],[182],[systemd-devel@lists.freedesktop.org])
22 AC_SUBST(PACKAGE_URL, [http://www.freedesktop.org/wiki/Software/systemd])
23 AC_CONFIG_SRCDIR([src/main.c])
24 AC_CONFIG_MACRO_DIR([m4])
25 AC_CONFIG_HEADERS([config.h])
26 AC_USE_SYSTEM_EXTENSIONS
27 AC_SYS_LARGEFILE
28 AC_PREFIX_DEFAULT([/usr])
29 AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules tar-pax no-dist-gzip dist-xz subdir-objects check-news])
30 AM_SILENT_RULES([yes])
31 AC_CANONICAL_HOST
32 AC_DEFINE_UNQUOTED([CANONICAL_HOST], "$host", [Canonical host string.])
33 AS_IF([test "x$host_cpu" = "xmips" || test "x$host_cpu" = "xmipsel" ||
34        test "x$host_cpu" = "xmips64" || test "x$host_cpu" = "xmips64el"],
35       [AC_DEFINE(ARCH_MIPS, [], [Whether on mips arch])])
36
37 LT_PREREQ(2.2)
38 LT_INIT
39
40 # i18n stuff for the PolicyKit policy files
41 IT_PROG_INTLTOOL([0.40.0])
42
43 GETTEXT_PACKAGE=systemd
44 AC_SUBST(GETTEXT_PACKAGE)
45
46 AC_PROG_MKDIR_P
47 AC_PROG_LN_S
48 AC_PROG_SED
49 AC_PROG_GREP
50 AC_PROG_AWK
51
52 AC_PROG_CC
53 AC_PROG_CC_C99
54 AM_PROG_CC_C_O
55 AC_PROG_GCC_TRADITIONAL
56
57 AC_PATH_PROG([M4], [m4])
58 GTK_DOC_CHECK(1.10)
59
60 AC_CHECK_TOOL(OBJCOPY, objcopy)
61 AC_CHECK_TOOL(STRINGS, strings)
62 AC_CHECK_TOOL(GPERF, gperf)
63 if test -z "$GPERF" ; then
64         AC_MSG_ERROR([*** gperf not found])
65 fi
66
67 CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
68         -pipe \
69         -Wall \
70         -W \
71         -Wextra \
72         -Wno-inline \
73         -Wvla \
74         -Wundef \
75         -Wformat=2 \
76         -Wlogical-op \
77         -Wsign-compare \
78         -Wformat-security \
79         -Wmissing-include-dirs \
80         -Wformat-nonliteral \
81         -Wold-style-definition \
82         -Wpointer-arith \
83         -Winit-self \
84         -Wdeclaration-after-statement \
85         -Wfloat-equal \
86         -Wmissing-prototypes \
87         -Wstrict-prototypes \
88         -Wredundant-decls \
89         -Wmissing-declarations \
90         -Wmissing-noreturn \
91         -Wshadow \
92         -Wendif-labels \
93         -Wcast-align \
94         -Wstrict-aliasing=2 \
95         -Wwrite-strings \
96         -Wno-long-long \
97         -Wno-overlength-strings \
98         -Wno-unused-parameter \
99         -Wno-missing-field-initializers \
100         -Wno-unused-result \
101         -Werror=overflow \
102         -Wp,-D_FORTIFY_SOURCE=2 \
103         -ffast-math \
104         -fno-common \
105         -fdiagnostics-show-option \
106         -fno-strict-aliasing \
107         -fvisibility=hidden \
108         -ffunction-sections \
109         -fdata-sections])
110 AC_SUBST([WARNINGFLAGS], $with_cflags)
111
112 CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
113         -Wl,--as-needed \
114         -Wl,--gc-sections])
115 AC_SUBST([GCLDFLAGS], $with_ldflags)
116
117 AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([*** POSIX RT library not found])])
118 AC_SEARCH_LIBS([dlsym], [dl], [], [AC_MSG_ERROR([*** Dynamic linking loader library not found])])
119
120 save_LIBS="$LIBS"
121 LIBS=
122 AC_SEARCH_LIBS([cap_init], [cap], [], [AC_MSG_ERROR([*** POSIX caps library not found])])
123 AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers not found])])
124 CAP_LIBS="$LIBS"
125 LIBS="$save_LIBS"
126 AC_SUBST(CAP_LIBS)
127
128 # This makes sure pkg.m4 is available.
129 m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
130
131 PKG_CHECK_MODULES(DBUS, [dbus-1 >= 1.3.2])
132 PKG_CHECK_MODULES(KMOD, [libkmod >= 5])
133 PKG_CHECK_MODULES(BLKID,[blkid >= 2.20])
134
135 # ------------------------------------------------------------------------------
136 have_ima=yes
137 AC_ARG_ENABLE([ima], AS_HELP_STRING([--disable-ima],[Disable optional IMA support]),
138                 [case "${enableval}" in
139                         yes) have_ima=yes ;;
140                         no) have_ima=no ;;
141                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-ima) ;;
142                 esac],
143                 [have_ima=yes])
144
145 if test "x${have_ima}" != xno ; then
146         AC_DEFINE(HAVE_IMA, 1, [Define if IMA is available])
147 fi
148
149 # ------------------------------------------------------------------------------
150 have_selinux=no
151 AC_ARG_ENABLE(selinux, AS_HELP_STRING([--disable-selinux], [Disable optional SELINUX support]))
152 if test "x$enable_selinux" != "xno"; then
153         PKG_CHECK_MODULES(SELINUX, [ libselinux ],
154                 [AC_DEFINE(HAVE_SELINUX, 1, [Define if SELinux is available]) have_selinux=yes], have_selinux=no)
155         if test "x$have_selinux" = xno -a "x$enable_selinux" = xyes; then
156                 AC_MSG_ERROR([*** SELinux support requested but libraries not found])
157         fi
158 fi
159 AM_CONDITIONAL(HAVE_SELINUX, [test "$have_selinux" = "yes"])
160
161 # ------------------------------------------------------------------------------
162 have_xz=no
163 AC_ARG_ENABLE(xz, AS_HELP_STRING([--disable-xz], [Disable optional XZ support]))
164 if test "x$enable_xz" != "xno"; then
165         PKG_CHECK_MODULES(XZ, [ liblzma ],
166                 [AC_DEFINE(HAVE_XZ, 1, [Define if XZ is available]) have_xz=yes], have_xz=no)
167         if test "x$have_xz" = xno -a "x$enable_xz" = xyes; then
168                 AC_MSG_ERROR([*** Xz support requested but libraries not found])
169         fi
170 fi
171 AM_CONDITIONAL(HAVE_XZ, [test "$have_xz" = "yes"])
172
173 # ------------------------------------------------------------------------------
174 AC_ARG_ENABLE([tcpwrap],
175         AS_HELP_STRING([--disable-tcpwrap],[Disable optional TCP wrappers support]),
176                 [case "${enableval}" in
177                         yes) have_tcpwrap=yes ;;
178                         no) have_tcpwrap=no ;;
179                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-tcpwrap) ;;
180                 esac],
181                 [have_tcpwrap=auto])
182
183 if test "x${have_tcpwrap}" != xno ; then
184         ACX_LIBWRAP
185         if test "x${LIBWRAP_LIBS}" = x ; then
186                 if test "x$have_tcpwrap" = xyes ; then
187                         AC_MSG_ERROR([*** TCP wrappers support not found.])
188                 fi
189                 have_tcpwrap=no
190         else
191                 have_tcpwrap=yes
192         fi
193 else
194         LIBWRAP_LIBS=
195 fi
196 AC_SUBST(LIBWRAP_LIBS)
197
198 # ------------------------------------------------------------------------------
199 AC_ARG_ENABLE([pam],
200         AS_HELP_STRING([--disable-pam],[Disable optional PAM support]),
201                 [case "${enableval}" in
202                         yes) have_pam=yes ;;
203                         no) have_pam=no ;;
204                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-pam) ;;
205                 esac],
206                 [have_pam=auto])
207
208 if test "x${have_pam}" != xno ; then
209         AC_CHECK_HEADERS(
210                 [security/pam_modules.h security/pam_modutil.h security/pam_ext.h],
211                 [have_pam=yes],
212                 [if test "x$have_pam" = xyes ; then
213                         AC_MSG_ERROR([*** PAM headers not found.])
214                 fi])
215
216         AC_CHECK_LIB(
217                 [pam],
218                 [pam_syslog],
219                 [have_pam=yes],
220                 [if test "x$have_pam" = xyes ; then
221                         AC_MSG_ERROR([*** libpam not found.])
222                 fi])
223
224         if test "x$have_pam" = xyes ; then
225                 PAM_LIBS="-lpam -lpam_misc"
226                 AC_DEFINE(HAVE_PAM, 1, [PAM available])
227         else
228                 have_pam=no
229         fi
230 else
231         PAM_LIBS=
232 fi
233 AC_SUBST(PAM_LIBS)
234 AM_CONDITIONAL([HAVE_PAM], [test "x$have_pam" != xno])
235
236 # ------------------------------------------------------------------------------
237 AC_ARG_ENABLE([acl],
238         AS_HELP_STRING([--disable-acl],[Disable optional ACL support]),
239                 [case "${enableval}" in
240                         yes) have_acl=yes ;;
241                         no) have_acl=no ;;
242                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-acl) ;;
243                 esac],
244                 [have_acl=auto])
245
246 if test "x${have_acl}" != xno ; then
247         AC_CHECK_HEADERS(
248                 [sys/acl.h acl/libacl.h],
249                 [have_acl=yes],
250                 [if test "x$have_acl" = xyes ; then
251                         AC_MSG_ERROR([*** ACL headers not found.])
252                 fi])
253
254         AC_CHECK_LIB(
255                 [acl],
256                 [acl_get_file],
257                 [have_acl=yes],
258                 [if test "x$have_acl" = xyes ; then
259                         AC_MSG_ERROR([*** libacl not found.])
260                 fi])
261
262         if test "x$have_acl" = xyes ; then
263                 ACL_LIBS="-lacl"
264                 AC_DEFINE(HAVE_ACL, 1, [ACL available])
265         else
266                 have_acl=no
267         fi
268 else
269         ACL_LIBS=
270 fi
271 AC_SUBST(ACL_LIBS)
272 AM_CONDITIONAL([HAVE_ACL], [test "x$have_acl" != xno])
273
274 # ------------------------------------------------------------------------------
275 AC_ARG_ENABLE([audit],
276         AS_HELP_STRING([--disable-audit],[Disable optional AUDIT support]),
277                 [case "${enableval}" in
278                         yes) have_audit=yes ;;
279                         no) have_audit=no ;;
280                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-audit) ;;
281                 esac],
282                 [have_audit=auto])
283
284 if test "x${have_audit}" != xno ; then
285         AC_CHECK_HEADERS(
286                 [libaudit.h],
287                 [have_audit=yes],
288                 [if test "x$have_audit" = xyes ; then
289                         AC_MSG_ERROR([*** AUDIT headers not found.])
290                 fi])
291
292         AC_CHECK_LIB(
293                 [audit],
294                 [audit_open],
295                 [have_audit=yes],
296                 [if test "x$have_audit" = xyes ; then
297                         AC_MSG_ERROR([*** libaudit not found.])
298                 fi])
299
300         if test "x$have_audit" = xyes ; then
301                 AUDIT_LIBS="-laudit"
302                 AC_DEFINE(HAVE_AUDIT, 1, [AUDIT available])
303         else
304                 have_audit=no
305         fi
306 else
307         AUDIT_LIBS=
308 fi
309 AC_SUBST(AUDIT_LIBS)
310
311 # ------------------------------------------------------------------------------
312 have_libcryptsetup=no
313 AC_ARG_ENABLE(libcryptsetup, AS_HELP_STRING([--disable-libcryptsetup], [disable libcryptsetup tools]))
314 if test "x$enable_libcryptsetup" != "xno"; then
315         PKG_CHECK_MODULES(LIBCRYPTSETUP, [ libcryptsetup ],
316                 [AC_DEFINE(HAVE_LIBCRYPTSETUP, 1, [Define if libcryptsetup is available]) have_libcryptsetup=yes], have_libcryptsetup=no)
317         if test "x$have_libcryptsetup" = xno -a "x$enable_libcryptsetup" = xyes; then
318                 AC_MSG_ERROR([*** libcryptsetup support requested but libraries not found])
319         fi
320 fi
321 AM_CONDITIONAL(HAVE_LIBCRYPTSETUP, [test "$have_libcryptsetup" = "yes"])
322
323 # ------------------------------------------------------------------------------
324 have_binfmt=no
325 AC_ARG_ENABLE(binfmt, AS_HELP_STRING([--disable-binfmt], [disable binfmt tool]))
326 if test "x$enable_binfmt" != "xno"; then
327         have_binfmt=yes
328 fi
329 AM_CONDITIONAL(ENABLE_BINFMT, [test "$have_binfmt" = "yes"])
330
331 # ------------------------------------------------------------------------------
332 have_vconsole=no
333 AC_ARG_ENABLE(vconsole, AS_HELP_STRING([--disable-vconsole], [disable vconsole tool]))
334 if test "x$enable_vconsole" != "xno"; then
335         have_vconsole=yes
336 fi
337 AM_CONDITIONAL(ENABLE_VCONSOLE, [test "$have_vconsole" = "yes"])
338
339 # ------------------------------------------------------------------------------
340 have_readahead=no
341 AC_ARG_ENABLE(readahead, AS_HELP_STRING([--disable-readahead], [disable readahead tools]))
342 if test "x$enable_readahead" != "xno"; then
343         have_readahead=yes
344 fi
345 AM_CONDITIONAL(ENABLE_READAHEAD, [test "$have_readahead" = "yes"])
346
347 # ------------------------------------------------------------------------------
348 have_quotacheck=no
349 AC_ARG_ENABLE(quotacheck, AS_HELP_STRING([--disable-quotacheck], [disable quotacheck tools]))
350 if test "x$enable_quotacheck" != "xno"; then
351         have_quotacheck=yes
352 fi
353 AM_CONDITIONAL(ENABLE_QUOTACHECK, [test "$have_quotacheck" = "yes"])
354
355 # ------------------------------------------------------------------------------
356 have_randomseed=no
357 AC_ARG_ENABLE(randomseed, AS_HELP_STRING([--disable-randomseed], [disable randomseed tools]))
358 if test "x$enable_randomseed" != "xno"; then
359         have_randomseed=yes
360 fi
361 AM_CONDITIONAL(ENABLE_RANDOMSEED, [test "$have_randomseed" = "yes"])
362
363 # ------------------------------------------------------------------------------
364 have_logind=no
365 AC_ARG_ENABLE(logind, AS_HELP_STRING([--disable-logind], [disable login daemon]))
366 if test "x$enable_logind" != "xno"; then
367         have_logind=yes
368 fi
369 AM_CONDITIONAL(ENABLE_LOGIND, [test "$have_logind" = "yes"])
370 AS_IF([test "$have_logind" = "yes"], [ AC_DEFINE(HAVE_LOGIND, [1], [Logind support available]) ])
371
372 # ------------------------------------------------------------------------------
373 have_hostnamed=no
374 AC_ARG_ENABLE(hostnamed, AS_HELP_STRING([--disable-hostnamed], [disable hostname daemon]))
375 if test "x$enable_hostnamed" != "xno"; then
376         have_hostnamed=yes
377 fi
378 AM_CONDITIONAL(ENABLE_HOSTNAMED, [test "$have_hostnamed" = "yes"])
379
380 # ------------------------------------------------------------------------------
381 have_timedated=no
382 AC_ARG_ENABLE(timedated, AS_HELP_STRING([--disable-timedated], [disable timedate daemon]))
383 if test "x$enable_timedated" != "xno"; then
384         have_timedated=yes
385 fi
386 AM_CONDITIONAL(ENABLE_TIMEDATED, [test "$have_timedated" = "yes"])
387
388 # ------------------------------------------------------------------------------
389 have_localed=no
390 AC_ARG_ENABLE(localed, AS_HELP_STRING([--disable-localed], [disable locale daemon]))
391 if test "x$enable_localed" != "xno"; then
392         have_localed=yes
393 fi
394 AM_CONDITIONAL(ENABLE_LOCALED, [test "$have_localed" = "yes"])
395
396 # ------------------------------------------------------------------------------
397 have_coredump=no
398 AC_ARG_ENABLE(coredump, AS_HELP_STRING([--disable-coredump], [disable coredump hook]))
399 if test "x$enable_coredump" != "xno"; then
400         have_coredump=yes
401 fi
402 AM_CONDITIONAL(ENABLE_COREDUMP, [test "$have_coredump" = "yes"])
403
404 # ------------------------------------------------------------------------------
405 if test "x$cross_compiling" = "xno" ; then
406        AC_CHECK_FILES([/usr/share/pci.ids], [pciids=/usr/share/pci.ids])
407        AC_CHECK_FILES([/usr/share/hwdata/pci.ids], [pciids=/usr/share/hwdata/pci.ids])
408        AC_CHECK_FILES([/usr/share/misc/pci.ids], [pciids=/usr/share/misc/pci.ids])
409 fi
410
411 AC_ARG_WITH(usb-ids-path,
412        [AS_HELP_STRING([--with-usb-ids-path=DIR], [Path to usb.ids file])],
413        [USB_DATABASE=${withval}],
414        [if test -n "$usbids" ; then
415               USB_DATABASE="$usbids"
416        else
417               PKG_CHECK_MODULES(USBUTILS, usbutils >= 0.82)
418               AC_SUBST([USB_DATABASE], [$($PKG_CONFIG --variable=usbids usbutils)])
419        fi])
420 AC_MSG_CHECKING([for USB database location])
421 AC_MSG_RESULT([$USB_DATABASE])
422 AC_SUBST(USB_DATABASE)
423
424 AC_ARG_WITH(pci-ids-path,
425        [AS_HELP_STRING([--with-pci-ids-path=DIR], [Path to pci.ids file])],
426        [PCI_DATABASE=${withval}],
427        [if test -n "$pciids" ; then
428               PCI_DATABASE="$pciids"
429        else
430               AC_MSG_ERROR([pci.ids not found, try --with-pci-ids-path=])
431        fi])
432 AC_MSG_CHECKING([for PCI database location])
433 AC_MSG_RESULT([$PCI_DATABASE])
434 AC_SUBST(PCI_DATABASE)
435
436 # ------------------------------------------------------------------------------
437 AC_ARG_WITH(firmware-path,
438        AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]],
439           [Firmware search path (default=ROOTPREFIX/lib/firmware/updates:ROOTPREFIX/lib/firmware)]),
440        [], [with_firmware_path="$rootprefix/lib/firmware/updates:$rootprefix/lib/firmware"])
441 OLD_IFS=$IFS
442 IFS=:
443 for i in $with_firmware_path; do
444        if test "x${FIRMWARE_PATH}" = "x"; then
445               FIRMWARE_PATH="\\\"${i}/\\\""
446        else
447               FIRMWARE_PATH="${FIRMWARE_PATH}, \\\"${i}/\\\""
448        fi
449 done
450 IFS=$OLD_IFS
451 AC_SUBST([FIRMWARE_PATH], [$FIRMWARE_PATH])
452
453 # ------------------------------------------------------------------------------
454 AC_ARG_ENABLE([gudev],
455        AS_HELP_STRING([--disable-gudev], [disable Gobject libudev support @<:@default=enabled@:>@]),
456        [], [enable_gudev=yes])
457 AS_IF([test "x$enable_gudev" = "xyes"], [ PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0]) ])
458
459 AC_ARG_ENABLE([introspection],
460        AS_HELP_STRING([--disable-introspection], [disable GObject introspection @<:@default=enabled@:>@]),
461        [], [enable_introspection=yes])
462 AS_IF([test "x$enable_introspection" = "xyes"], [
463        PKG_CHECK_MODULES([INTROSPECTION], [gobject-introspection-1.0 >= 0.6.2])
464        AC_DEFINE([ENABLE_INTROSPECTION], [1], [enable GObject introspection support])
465        AC_SUBST([G_IR_SCANNER], [$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)])
466        AC_SUBST([G_IR_COMPILER], [$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0)])
467        AC_SUBST([G_IR_GENERATE], [$($PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0)])
468        AC_SUBST([GIRDIR], [$($PKG_CONFIG --define-variable=datadir=${datadir} --variable=girdir gobject-introspection-1.0)])
469        AC_SUBST([GIRTYPELIBDIR], [$($PKG_CONFIG --define-variable=libdir=${libdir} --variable=typelibdir gobject-introspection-1.0)])
470 ])
471 AM_CONDITIONAL([ENABLE_INTROSPECTION], [test "x$enable_introspection" = "xyes"])
472 AM_CONDITIONAL([ENABLE_GUDEV], [test "x$enable_gudev" = "xyes"])
473
474 # ------------------------------------------------------------------------------
475 AC_ARG_ENABLE([keymap],
476        AS_HELP_STRING([--disable-keymap], [disable keymap fixup support @<:@default=enabled@:>@]),
477        [], [enable_keymap=yes])
478 AS_IF([test "x$enable_keymap" = "xyes"], [
479        AC_PATH_PROG([GPERF], [gperf])
480        if test -z "$GPERF"; then
481               AC_MSG_ERROR([gperf is needed])
482        fi
483
484        AC_CHECK_HEADER([linux/input.h], [:], AC_MSG_ERROR([kernel headers not found]))
485        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}')])
486 ])
487 AM_CONDITIONAL([ENABLE_KEYMAP], [test "x$enable_keymap" = "xyes"])
488
489 # ------------------------------------------------------------------------------
490 have_manpages=no
491 AC_ARG_ENABLE(manpages, AS_HELP_STRING([--disable-manpages], [disable manpages]))
492 if test "x$enable_manpages" != "xno"; then
493         have_manpages=yes
494 fi
495 AM_CONDITIONAL(ENABLE_MANPAGES, [test "$have_manpages" = "yes"])
496
497 # ------------------------------------------------------------------------------
498 AC_PATH_PROG([XSLTPROC], [xsltproc])
499 AM_CONDITIONAL(HAVE_XSLTPROC, test x"$XSLTPROC" != x)
500
501 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, meego, mageia, angstrom or other]))
502 if test "z$with_distro" = "z"; then
503         if test "$cross_compiling" = yes; then
504                 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)])
505         else
506                 with_distro=$($GREP '^ID=' /etc/os-release | $SED 's/ID=//');
507         fi
508         if test "z$with_distro" = "z"; then
509                 with_distro=other
510         fi
511 fi
512 with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
513 AC_DEFINE_UNQUOTED(DISTRIBUTION, ["${with_distro}"], [Target Distribution])
514
515 # Location of the init scripts as mandated by LSB
516 SYSTEM_SYSVINIT_PATH=/etc/init.d
517 SYSTEM_SYSVRCND_PATH=/etc/rc.d
518
519 M4_DEFINES=
520 have_plymouth=no
521
522 case $with_distro in
523         fedora)
524                 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
525                 AC_DEFINE(TARGET_FEDORA, [], [Target is Fedora/RHEL])
526                 M4_DEFINES=-DTARGET_FEDORA=1
527                 have_plymouth=yes
528                 ;;
529         opensuse|suse)
530                 SYSTEM_SYSVRCND_PATH=/etc/init.d
531                 AC_DEFINE(TARGET_SUSE, [], [Target is openSUSE/SLE])
532                 M4_DEFINES=-DTARGET_SUSE=1
533                 have_plymouth=yes
534                 ;;
535         debian)
536                 SYSTEM_SYSVRCND_PATH=/etc
537                 AC_DEFINE(TARGET_DEBIAN, [], [Target is Debian])
538                 M4_DEFINES=-DTARGET_DEBIAN=1
539                 ;;
540         ubuntu)
541                 SYSTEM_SYSVRCND_PATH=/etc
542                 AC_DEFINE(TARGET_UBUNTU, [], [Target is Ubuntu])
543                 M4_DEFINES=-DTARGET_UBUNTU=1
544                 ;;
545         arch)
546                 SYSTEM_SYSVINIT_PATH=/etc/rc.d
547                 SYSTEM_SYSVRCND_PATH=/etc
548                 AC_DEFINE(TARGET_ARCH, [], [Target is ArchLinux])
549                 M4_DEFINES=-DTARGET_ARCH=1
550                 ;;
551         gentoo)
552                 SYSTEM_SYSVINIT_PATH=
553                 SYSTEM_SYSVRCND_PATH=
554                 AC_DEFINE(TARGET_GENTOO, [], [Target is Gentoo])
555                 M4_DEFINES=-DTARGET_GENTOO=1
556                 ;;
557         slackware)
558                 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
559                 AC_DEFINE(TARGET_SLACKWARE, [], [Target is Slackware])
560                 M4_DEFINES=-DTARGET_SLACKWARE=1
561                 ;;
562         frugalware)
563                 SYSTEM_SYSVINIT_PATH=/etc/rc.d
564                 AC_DEFINE(TARGET_FRUGALWARE, [], [Target is Frugalware])
565                 M4_DEFINES=-DTARGET_FRUGALWARE=1
566                 have_plymouth=yes
567                 ;;
568         altlinux)
569                 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
570                 AC_DEFINE(TARGET_ALTLINUX, [], [Target is ALTLinux])
571                 M4_DEFINES=-DTARGET_ALTLINUX=1
572                 have_plymouth=yes
573                 ;;
574         mandriva)
575                 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
576                 AC_DEFINE(TARGET_MANDRIVA, [], [Target is Mandriva])
577                 M4_DEFINES=-DTARGET_MANDRIVA=1
578                 have_plymouth=yes
579                 ;;
580         meego)
581                 SYSTEM_SYSVINIT_PATH=
582                 SYSTEM_SYSVRCND_PATH=
583                 AC_DEFINE(TARGET_MEEGO, [], [Target is MeeGo])
584                 M4_DEFINES=-DTARGET_MEEGO=1
585                 ;;
586         angstrom)
587                 SYSTEM_SYSVRCND_PATH=/etc
588                 AC_DEFINE(TARGET_ANGSTROM, [], [Target is Ångström])
589                 M4_DEFINES=-DTARGET_ANGSTROM=1
590                 ;;
591         mageia)
592                 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
593                 AC_DEFINE(TARGET_MAGEIA, [], [Target is Mageia])
594                 M4_DISTRO_FLAG=-DTARGET_MAGEIA=1
595                 have_plymouth=yes
596                 ;;
597         other)
598                 ;;
599         *)
600                 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])
601                 ;;
602 esac
603
604 AC_ARG_WITH([sysvinit-path],
605         [AS_HELP_STRING([--with-sysvinit-path=PATH],
606                 [Specify the path to where the SysV init scripts are located @<:@default=based on distro@:>@])],
607         [SYSTEM_SYSVINIT_PATH="$withval"],
608         [])
609
610 AC_ARG_WITH([sysvrcd-path],
611         [AS_HELP_STRING([--with-sysvrcd-path=PATH],
612                 [Specify the path to the base directory for the SysV rcN.d directories @<:@default=based on distro@:>@])],
613         [SYSTEM_SYSVRCND_PATH="$withval"],
614         [])
615
616 AC_SUBST(SYSTEM_SYSVINIT_PATH)
617 AC_SUBST(SYSTEM_SYSVRCND_PATH)
618 AC_SUBST(M4_DEFINES)
619
620 if test "x${SYSTEM_SYSVINIT_PATH}" != "x" -a "x${SYSTEM_SYSVRCND_PATH}" != "x"; then
621         AC_DEFINE(HAVE_SYSV_COMPAT, [], [SysV init scripts and rcN.d links are supported.])
622         SYSTEM_SYSV_COMPAT="yes"
623         M4_DEFINES="$M4_DEFINES -DHAVE_SYSV_COMPAT"
624 elif test "x${SYSTEM_SYSVINIT_PATH}" != "x" -o "x${SYSTEM_SYSVRCND_PATH}" != "x"; then
625         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.])
626 else
627         SYSTEM_SYSV_COMPAT="no"
628 fi
629
630 AC_ARG_WITH([tty-gid],
631         [AS_HELP_STRING([--with-tty-gid=GID],
632                 [Specify the numeric GID of the 'tty' group])],
633         [AC_DEFINE_UNQUOTED(TTY_GID, [$withval], [GID of the 'tty' group])],
634         [])
635
636 AC_ARG_ENABLE(plymouth, AS_HELP_STRING([--enable-plymouth], [enable plymouth support]))
637 if test -n "$enable_plymouth"; then
638         have_plymouth="$enable_plymouth"
639 fi
640
641 AM_CONDITIONAL(TARGET_FEDORA, test x"$with_distro" = xfedora)
642 AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse)
643 AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian)
644 AM_CONDITIONAL(TARGET_UBUNTU, test x"$with_distro" = xubuntu)
645 AM_CONDITIONAL(TARGET_DEBIAN_OR_UBUNTU, test x"$with_distro" = xdebian -o x"$with_distro" = xubuntu)
646 AM_CONDITIONAL(TARGET_ARCH, test x"$with_distro" = xarch)
647 AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo)
648 AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware)
649 AM_CONDITIONAL(TARGET_FRUGALWARE, test x"$with_distro" = xfrugalware)
650 AM_CONDITIONAL(TARGET_ALTLINUX, test x"$with_distro" = xaltlinux)
651 AM_CONDITIONAL(TARGET_MANDRIVA, test x"$with_distro" = xmandriva)
652 AM_CONDITIONAL(TARGET_MEEGO, test x"$with_distro" = xmeego)
653 AM_CONDITIONAL(TARGET_ANGSTROM, test x"$with_distro" = xangstrom)
654 AM_CONDITIONAL(TARGET_MAGEIA, test x"$with_distro" = xmageia)
655
656 AM_CONDITIONAL(HAVE_PLYMOUTH, test "$have_plymouth" = "yes")
657 AM_CONDITIONAL(HAVE_SYSV_COMPAT, test "$SYSTEM_SYSV_COMPAT" = "yes")
658
659 AC_ARG_WITH([dbuspolicydir],
660         AS_HELP_STRING([--with-dbuspolicydir=DIR], [D-Bus policy directory]),
661         [],
662         [with_dbuspolicydir=`pkg-config --variable=sysconfdir dbus-1`/dbus-1/system.d])
663
664 AC_ARG_WITH([dbussessionservicedir],
665         AS_HELP_STRING([--with-dbussessionservicedir=DIR], [D-Bus session service directory]),
666         [],
667         [with_dbussessionservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`])
668
669 AC_ARG_WITH([dbussystemservicedir],
670         AS_HELP_STRING([--with-dbussystemservicedir=DIR], [D-Bus system service directory]),
671         [],
672         [with_dbussystemservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../system-services])
673
674 AC_ARG_WITH([dbusinterfacedir],
675         AS_HELP_STRING([--with-dbusinterfacedir=DIR], [D-Bus interface directory]),
676         [],
677         [with_dbusinterfacedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../interfaces])
678
679 AC_ARG_WITH([rootprefix],
680         AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]),
681         [], [with_rootprefix=${ac_default_prefix}])
682
683 AC_ARG_WITH([rootlibdir],
684         AS_HELP_STRING([--with-rootlibdir=DIR], [Root directory for libraries necessary for boot]),
685         [],
686         [with_rootlibdir=${libdir}])
687
688 AC_ARG_WITH([pamlibdir],
689         AS_HELP_STRING([--with-pamlibdir=DIR], [Directory for PAM modules]),
690         [],
691         [with_pamlibdir=${with_rootlibdir}/security])
692
693 AC_ARG_ENABLE([split-usr],
694         AS_HELP_STRING([--enable-split-usr], [Assume that /bin, /sbin aren\'t symlinks into /usr]),
695         [],
696         [AS_IF([test "x${ac_default_prefix}" != "x${with_rootprefix}"], [
697                 enable_split_usr=yes
698         ], [
699                 enable_split_usr=no
700         ])])
701
702 AS_IF([test "x${enable_split_usr}" = "xyes"], [
703         AC_DEFINE(HAVE_SPLIT_USR, 1, [Define if /bin, /sbin aren't symlinks into /usr])
704 ])
705
706 AC_SUBST([dbuspolicydir], [$with_dbuspolicydir])
707 AC_SUBST([dbussessionservicedir], [$with_dbussessionservicedir])
708 AC_SUBST([dbussystemservicedir], [$with_dbussystemservicedir])
709 AC_SUBST([dbusinterfacedir], [$with_dbusinterfacedir])
710 AC_SUBST([pamlibdir], [$with_pamlibdir])
711 AC_SUBST([rootprefix], [$with_rootprefix])
712 AC_SUBST([rootlibdir], [$with_rootlibdir])
713
714 AC_CONFIG_FILES([
715         Makefile po/Makefile.in
716         src/udev/docs/Makefile
717         src/udev/docs/version.xml
718         src/udev/gudev/docs/Makefile
719         src/udev/gudev/docs/version.xml
720 ])
721
722 AC_OUTPUT
723 AC_MSG_RESULT([
724         $PACKAGE_NAME $VERSION
725
726         Distribution:            ${with_distro}
727         SysV compatibility:      ${SYSTEM_SYSV_COMPAT}
728         SysV init scripts:       ${SYSTEM_SYSVINIT_PATH}
729         SysV rc?.d directories:  ${SYSTEM_SYSVRCND_PATH}
730         libcryptsetup:           ${have_libcryptsetup}
731         tcpwrap:                 ${have_tcpwrap}
732         PAM:                     ${have_pam}
733         AUDIT:                   ${have_audit}
734         IMA:                     ${have_ima}
735         SELinux:                 ${have_selinux}
736         XZ:                      ${have_xz}
737         ACL:                     ${have_acl}
738         binfmt:                  ${have_binfmt}
739         vconsole:                ${have_vconsole}
740         readahead:               ${have_readahead}
741         quotacheck:              ${have_quotacheck}
742         randomseed:              ${have_randomseed}
743         logind:                  ${have_logind}
744         hostnamed:               ${have_hostnamed}
745         timedated:               ${have_timedated}
746         localed:                 ${have_localed}
747         coredump:                ${have_coredump}
748         plymouth:                ${have_plymouth}
749         firmware path:           ${FIRMWARE_PATH}
750         usb.ids:                 ${USB_DATABASE}
751         pci.ids:                 ${PCI_DATABASE}
752         gudev:                   ${enable_gudev}
753         gintrospection:          ${enable_introspection}
754         keymap:                  ${enable_keymap}
755
756         prefix:                  ${prefix}
757         rootprefix:              ${with_rootprefix}
758         sysconf dir:             ${sysconfdir}
759         datarootdir:             ${datarootdir}
760         includedir:              ${includedir}
761         include_prefix:          ${INCLUDE_PREFIX}
762         libexec dir:             ${libexecdir}
763         lib dir:                 ${libdir}
764         rootlib dir:             ${with_rootlibdir}
765         PAM modules dir:         ${with_pamlibdir}
766         D-Bus policy dir:        ${with_dbuspolicydir}
767         D-Bus session dir:       ${with_dbussessionservicedir}
768         D-Bus system dir:        ${with_dbussystemservicedir}
769         D-Bus interfaces dir:    ${with_dbusinterfacedir}
770         Split /usr:              ${enable_split_usr}
771         man pages:               ${have_manpages}
772 ])