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