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