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