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