1 # This file is part of systemd.
3 # Copyright 2010 Lennart Poettering
5 # systemd is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # systemd is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with systemd; If not, see <http://www.gnu.org/licenses/>.
20 AC_INIT([systemd],[31],[systemd-devel@lists.freedesktop.org])
21 AC_CONFIG_SRCDIR([src/main.c])
22 AC_CONFIG_MACRO_DIR([m4])
23 AC_CONFIG_HEADERS([config.h])
24 AC_USE_SYSTEM_EXTENSIONS
27 AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules tar-pax subdir-objects dist-bzip2])
29 AC_SUBST(PACKAGE_URL, [http://www.freedesktop.org/wiki/Software/systemd])
32 AC_DEFINE_UNQUOTED([CANONICAL_HOST], "$host", [Canonical host string.])
33 AS_IF([test "x$host_cpu" = "xmips" || test "x$host_cpu" = "xmipsel" ||
34 test "x$host_cpu" = "xmips64" || test "x$host_cpu" = "xmips64el"],
35 [AC_DEFINE(ARCH_MIPS, [], [Whether on mips arch])])
37 AM_SILENT_RULES([yes])
39 AC_CHECK_PROG([STOW], [stow], [yes], [no])
41 AS_IF([test "x$STOW" = "xyes" && test -d /usr/local/stow], [
42 AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***])
43 ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}"
46 # i18n stuff for the PolicyKit policy files
47 IT_PROG_INTLTOOL([0.40.0])
49 GETTEXT_PACKAGE=systemd
50 AC_SUBST(GETTEXT_PACKAGE)
59 AC_PROG_GCC_TRADITIONAL
61 AC_CHECK_TOOL(OBJCOPY, objcopy)
62 AC_CHECK_TOOL(STRINGS, strings)
64 CC_CHECK_CFLAGS_APPEND([ \
76 -Wmissing-include-dirs \
78 -Wold-style-definition \
81 -Wdeclaration-after-statement \
83 -Wmissing-prototypes \
86 -Wmissing-declarations \
94 -Wno-overlength-strings \
95 -Wno-unused-parameter \
96 -Wno-missing-field-initializers \
98 -Wp,-D_FORTIFY_SOURCE=2 \
101 -fdiagnostics-show-option \
102 -fno-strict-aliasing \
103 -fvisibility=hidden \
104 -ffunction-sections \
112 AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([*** POSIX RT library not found])])
113 AC_SEARCH_LIBS([dlsym], [dl], [], [AC_MSG_ERROR([*** Dynamic linking loader library not found])])
117 AC_SEARCH_LIBS([cap_init], [cap], [], [AC_MSG_ERROR([*** POSIX caps library not found])])
118 AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers not found])])
123 # This makes sure pkg.m4 is available.
124 m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
126 PKG_CHECK_MODULES(UDEV, [ libudev >= 172 ])
127 AC_SUBST(UDEV_CFLAGS)
130 PKG_CHECK_MODULES(DBUS, [ dbus-1 >= 1.3.2 ])
131 AC_SUBST(DBUS_CFLAGS)
135 AC_ARG_ENABLE(selinux, AS_HELP_STRING([--disable-selinux], [Disable optional SELINUX support]))
136 if test "x$enable_selinux" != "xno"; then
137 PKG_CHECK_MODULES(SELINUX, [ libselinux ],
138 [AC_DEFINE(HAVE_SELINUX, 1, [Define if SELinux is available]) have_selinux=yes], have_selinux=no)
139 AC_SUBST(SELINUX_CFLAGS)
140 AC_SUBST(SELINUX_LIBS)
141 if test "x$have_selinux" = xno -a "x$enable_selinux" = xyes; then
142 AC_MSG_ERROR([*** SELinux support requested but libraries not found])
145 AM_CONDITIONAL(HAVE_SELINUX, [test "$have_selinux" = "yes"])
147 AC_ARG_ENABLE([tcpwrap],
148 AS_HELP_STRING([--disable-tcpwrap],[Disable optional TCP wrappers support]),
149 [case "${enableval}" in
150 yes) have_tcpwrap=yes ;;
151 no) have_tcpwrap=no ;;
152 *) AC_MSG_ERROR(bad value ${enableval} for --disable-tcpwrap) ;;
156 if test "x${have_tcpwrap}" != xno ; then
158 if test "x${LIBWRAP_LIBS}" = x ; then
159 if test "x$have_tcpwrap" = xyes ; then
160 AC_MSG_ERROR([*** TCP wrappers support not found.])
169 AC_SUBST(LIBWRAP_LIBS)
172 AS_HELP_STRING([--disable-pam],[Disable optional PAM support]),
173 [case "${enableval}" in
176 *) AC_MSG_ERROR(bad value ${enableval} for --disable-pam) ;;
180 if test "x${have_pam}" != xno ; then
182 [security/pam_modules.h security/pam_modutil.h security/pam_ext.h],
184 [if test "x$have_pam" = xyes ; then
185 AC_MSG_ERROR([*** PAM headers not found.])
192 [if test "x$have_pam" = xyes ; then
193 AC_MSG_ERROR([*** libpam not found.])
196 if test "x$have_pam" = xyes ; then
197 PAM_LIBS="-lpam -lpam_misc"
198 AC_DEFINE(HAVE_PAM, 1, [PAM available])
206 AM_CONDITIONAL([HAVE_PAM], [test "x$have_pam" != xno])
209 AS_HELP_STRING([--disable-acl],[Disable optional ACL support]),
210 [case "${enableval}" in
213 *) AC_MSG_ERROR(bad value ${enableval} for --disable-acl) ;;
217 if test "x${have_acl}" != xno ; then
219 [sys/acl.h acl/libacl.h],
221 [if test "x$have_acl" = xyes ; then
222 AC_MSG_ERROR([*** ACL headers not found.])
229 [if test "x$have_acl" = xyes ; then
230 AC_MSG_ERROR([*** libacl not found.])
233 if test "x$have_acl" = xyes ; then
235 AC_DEFINE(HAVE_ACL, 1, [ACL available])
243 AM_CONDITIONAL([HAVE_ACL], [test "x$have_acl" != xno])
245 AC_ARG_ENABLE([audit],
246 AS_HELP_STRING([--disable-audit],[Disable optional AUDIT support]),
247 [case "${enableval}" in
248 yes) have_audit=yes ;;
250 *) AC_MSG_ERROR(bad value ${enableval} for --disable-audit) ;;
254 if test "x${have_audit}" != xno ; then
258 [if test "x$have_audit" = xyes ; then
259 AC_MSG_ERROR([*** AUDIT headers not found.])
266 [if test "x$have_audit" = xyes ; then
267 AC_MSG_ERROR([*** libaudit not found.])
270 if test "x$have_audit" = xyes ; then
272 AC_DEFINE(HAVE_AUDIT, 1, [AUDIT available])
281 have_libcryptsetup=no
282 AC_ARG_ENABLE(libcryptsetup, AS_HELP_STRING([--disable-libcryptsetup], [disable libcryptsetup tools]))
283 if test "x$enable_libcryptsetup" != "xno"; then
284 PKG_CHECK_MODULES(LIBCRYPTSETUP, [ libcryptsetup ],
285 [AC_DEFINE(HAVE_LIBCRYPTSETUP, 1, [Define if libcryptsetup is available]) have_libcryptsetup=yes], have_libcryptsetup=no)
286 AC_SUBST(LIBCRYPTSETUP_CFLAGS)
287 AC_SUBST(LIBCRYPTSETUP_LIBS)
288 if test "x$have_libcryptsetup" = xno -a "x$enable_libcryptsetup" = xyes; then
289 AC_MSG_ERROR([*** libcryptsetup support requested but libraries not found])
292 AM_CONDITIONAL(HAVE_LIBCRYPTSETUP, [test "$have_libcryptsetup" = "yes"])
295 AC_ARG_ENABLE(binfmt, AS_HELP_STRING([--disable-binfmt], [disable binfmt tool]))
296 if test "x$enable_binfmt" != "xno"; then
299 AM_CONDITIONAL(ENABLE_BINFMT, [test "$have_binfmt" = "yes"])
302 AC_ARG_ENABLE(gtk, AS_HELP_STRING([--disable-gtk], [disable GTK tools]))
303 if test "x$enable_gtk" != "xno"; then
304 PKG_CHECK_MODULES(GTK, [ gtk+-2.0 glib-2.0 > 2.26 gio-unix-2.0 ],
305 [AC_DEFINE(HAVE_GTK, 1, [Define if GTK is available]) have_gtk=yes], have_gtk=no)
308 if test "x$have_gtk" = xno -a "x$enable_gtk" = xyes; then
309 AC_MSG_ERROR([*** gtk support requested but libraries not found])
312 AM_CONDITIONAL(HAVE_GTK, [test "$have_gtk" = "yes"])
314 if test "$have_gtk" = "yes"; then
315 PKG_CHECK_MODULES(LIBNOTIFY, [ libnotify ])
316 PKG_CHECK_EXISTS([ libnotify >= 0.7.0 ], [ libnotify07=yes ])
318 AC_SUBST(LIBNOTIFY_CFLAGS)
319 AC_SUBST(LIBNOTIFY_LIBS)
321 AM_CONDITIONAL(LIBNOTIFY07, [ test "$libnotify07" = "yes" ])
323 AM_PROG_VALAC([0.10])
325 AM_CONDITIONAL(HAVE_VALAC, test x"$VALAC" != x)
327 AC_PATH_PROG([XSLTPROC], [xsltproc])
328 AM_CONDITIONAL(HAVE_XSLTPROC, test x"$XSLTPROC" != x)
330 AC_PATH_PROG([M4], [m4])
332 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 or other]))
333 if test "z$with_distro" = "z"; then
334 if test "$cross_compiling" = yes; then
335 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)])
337 test -f "/etc/redhat-release" && with_distro="fedora"
338 test -f "/etc/SuSE-release" && with_distro="suse"
339 test -f "/etc/debian_version" && with_distro="debian"
340 test -f "/etc/arch-release" && with_distro="arch"
341 test -f "/etc/gentoo-release" && with_distro="gentoo"
342 test -f "/etc/slackware-version" && with_distro="slackware"
343 test -f "/etc/frugalware-release" && with_distro="frugalware"
344 test -f "/etc/altlinux-release" && with_distro="altlinux"
345 test -f "/etc/mandriva-release" && with_distro="mandriva"
346 test -f "/etc/meego-release" && with_distro="meego"
347 test -f "/etc/angstrom-version" && with_distro="angstrom"
348 if test "x`lsb_release -is 2>/dev/null`" = "xUbuntu"; then
352 if test "z$with_distro" = "z"; then
353 with_distro=`uname -s`
356 with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
357 AC_DEFINE_UNQUOTED(DISTRIBUTION, ["${with_distro}"], [Target Distribution])
359 # Location of the init scripts as mandated by LSB
360 SYSTEM_SYSVINIT_PATH=/etc/init.d
361 SYSTEM_SYSVRCND_PATH=/etc/rc.d
368 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
369 AC_DEFINE(TARGET_FEDORA, [], [Target is Fedora/RHEL])
370 M4_DISTRO_FLAG=-DTARGET_FEDORA=1
374 SYSTEM_SYSVRCND_PATH=/etc/init.d
375 AC_DEFINE(TARGET_SUSE, [], [Target is openSUSE/SLE])
376 M4_DISTRO_FLAG=-DTARGET_SUSE=1
380 SYSTEM_SYSVRCND_PATH=/etc
381 AC_DEFINE(TARGET_DEBIAN, [], [Target is Debian])
382 M4_DISTRO_FLAG=-DTARGET_DEBIAN=1
385 SYSTEM_SYSVRCND_PATH=/etc
386 AC_DEFINE(TARGET_UBUNTU, [], [Target is Ubuntu])
387 M4_DISTRO_FLAG=-DTARGET_UBUNTU=1
390 SYSTEM_SYSVINIT_PATH=/etc/rc.d
391 SYSTEM_SYSVRCND_PATH=/etc
392 AC_DEFINE(TARGET_ARCH, [], [Target is ArchLinux])
393 M4_DISTRO_FLAG=-DTARGET_ARCH=1
396 SYSTEM_SYSVINIT_PATH=
397 SYSTEM_SYSVRCND_PATH=
398 AC_DEFINE(TARGET_GENTOO, [], [Target is Gentoo])
399 M4_DISTRO_FLAG=-DTARGET_GENTOO=1
402 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
403 AC_DEFINE(TARGET_SLACKWARE, [], [Target is Slackware])
404 M4_DISTRO_FLAG=-DTARGET_SLACKWARE=1
407 SYSTEM_SYSVINIT_PATH=/etc/rc.d
408 AC_DEFINE(TARGET_FRUGALWARE, [], [Target is Frugalware])
409 M4_DISTRO_FLAG=-DTARGET_FRUGALWARE=1
413 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
414 AC_DEFINE(TARGET_ALTLINUX, [], [Target is ALTLinux])
415 M4_DISTRO_FLAG=-DTARGET_ALTLINUX=1
419 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
420 AC_DEFINE(TARGET_MANDRIVA, [], [Target is Mandriva])
421 M4_DISTRO_FLAG=-DTARGET_MANDRIVA=1
425 SYSTEM_SYSVINIT_PATH=
426 SYSTEM_SYSVRCND_PATH=
427 AC_DEFINE(TARGET_MEEGO, [], [Target is MeeGo])
428 M4_DISTRO_FLAG=-DTARGET_MEEGO=1
431 SYSTEM_SYSVRCND_PATH=/etc
432 AC_DEFINE(TARGET_ANGSTROM, [], [Target is Ångström])
433 M4_DISTRO_FLAG=-DTARGET_ANGSTROM=1
438 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])
442 AC_ARG_WITH([sysvinit-path],
443 [AS_HELP_STRING([--with-sysvinit-path=PATH],
444 [Specify the path to where the SysV init scripts are located @<:@default=based on distro@:>@])],
445 [SYSTEM_SYSVINIT_PATH="$withval"],
448 AC_ARG_WITH([sysvrcd-path],
449 [AS_HELP_STRING([--with-sysvrcd-path=PATH],
450 [Specify the path to the base directory for the SysV rcN.d directories @<:@default=based on distro@:>@])],
451 [SYSTEM_SYSVRCND_PATH="$withval"],
454 AC_SUBST(SYSTEM_SYSVINIT_PATH)
455 AC_SUBST(SYSTEM_SYSVRCND_PATH)
456 AC_SUBST(M4_DISTRO_FLAG)
458 if test "x${SYSTEM_SYSVINIT_PATH}" != "x" -a "x${SYSTEM_SYSVRCND_PATH}" != "x"; then
459 AC_DEFINE(HAVE_SYSV_COMPAT, [], [SysV init scripts and rcN.d links are supported.])
460 SYSTEM_SYSV_COMPAT="yes"
461 elif test "x${SYSTEM_SYSVINIT_PATH}" != "x" -o "x${SYSTEM_SYSVRCND_PATH}" != "x"; then
462 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.])
464 SYSTEM_SYSV_COMPAT="no"
467 AC_ARG_WITH([tty-gid],
468 [AS_HELP_STRING([--with-tty-gid=GID],
469 [Specify the numeric GID of the 'tty' group])],
470 [AC_DEFINE_UNQUOTED(TTY_GID, [$withval], [GID of the 'tty' group])],
473 AC_ARG_ENABLE(plymouth, AS_HELP_STRING([--enable-plymouth], [enable plymouth support]))
474 if test -n "$enable_plymouth"; then
475 have_plymouth="$enable_plymouth"
478 AM_CONDITIONAL(TARGET_FEDORA, test x"$with_distro" = xfedora)
479 AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse)
480 AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian)
481 AM_CONDITIONAL(TARGET_UBUNTU, test x"$with_distro" = xubuntu)
482 AM_CONDITIONAL(TARGET_DEBIAN_OR_UBUNTU, test x"$with_distro" = xdebian -o x"$with_distro" = xubuntu)
483 AM_CONDITIONAL(TARGET_ARCH, test x"$with_distro" = xarch)
484 AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo)
485 AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware)
486 AM_CONDITIONAL(TARGET_FRUGALWARE, test x"$with_distro" = xfrugalware)
487 AM_CONDITIONAL(TARGET_ALTLINUX, test x"$with_distro" = xaltlinux)
488 AM_CONDITIONAL(TARGET_MANDRIVA, test x"$with_distro" = xmandriva)
489 AM_CONDITIONAL(TARGET_MEEGO, test x"$with_distro" = xmeego)
490 AM_CONDITIONAL(TARGET_ANGSTROM, test x"$with_distro" = xangstrom)
492 AM_CONDITIONAL(HAVE_PLYMOUTH, test "$have_plymouth" = "yes")
493 AM_CONDITIONAL(HAVE_SYSV_COMPAT, test "$SYSTEM_SYSV_COMPAT" = "yes")
495 AC_ARG_WITH([dbuspolicydir],
496 AS_HELP_STRING([--with-dbuspolicydir=DIR], [D-Bus policy directory]),
498 [with_dbuspolicydir=`pkg-config --variable=sysconfdir dbus-1`/dbus-1/system.d])
500 AC_ARG_WITH([dbussessionservicedir],
501 AS_HELP_STRING([--with-dbussessionservicedir=DIR], [D-Bus session service directory]),
503 [with_dbussessionservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`])
505 AC_ARG_WITH([dbussystemservicedir],
506 AS_HELP_STRING([--with-dbussystemservicedir=DIR], [D-Bus system service directory]),
508 [with_dbussystemservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../system-services])
510 AC_ARG_WITH([dbusinterfacedir],
511 AS_HELP_STRING([--with-dbusinterfacedir=DIR], [D-Bus interface directory]),
513 [with_dbusinterfacedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../interfaces])
515 AC_ARG_WITH([udevrulesdir],
516 AS_HELP_STRING([--with-udevrulesdir=DIR], [Diectory for udev rules]),
518 [with_udevrulesdir=`pkg-config --variable=udevdir udev`/rules.d])
520 AC_ARG_WITH([pamlibdir],
521 AS_HELP_STRING([--with-pamlibdir=DIR], [Diectory for PAM modules]),
523 [with_pamlibdir=/lib/`$CC -print-multi-os-directory`/security])
525 AC_ARG_WITH([rootdir],
526 AS_HELP_STRING([--with-rootdir=DIR], [Root directory for files necessary for boot]),
528 [with_rootdir=${ac_default_prefix}])
530 AC_ARG_WITH([rootlibdir],
531 AS_HELP_STRING([--with-rootlibdir=DIR], [Root directory for libraries necessary for boot]),
533 [with_rootlibdir=${libdir}])
535 AC_SUBST([dbuspolicydir], [$with_dbuspolicydir])
536 AC_SUBST([dbussessionservicedir], [$with_dbussessionservicedir])
537 AC_SUBST([dbussystemservicedir], [$with_dbussystemservicedir])
538 AC_SUBST([dbusinterfacedir], [$with_dbusinterfacedir])
539 AC_SUBST([udevrulesdir], [$with_udevrulesdir])
540 AC_SUBST([pamlibdir], [$with_pamlibdir])
541 AC_SUBST([rootdir], [$with_rootdir])
542 AC_SUBST([rootlibdir], [$with_rootlibdir])
544 AC_CONFIG_FILES([Makefile po/Makefile.in])
547 $PACKAGE_NAME $VERSION
549 Distribution: ${with_distro}
550 SysV compatibility: ${SYSTEM_SYSV_COMPAT}
551 SysV init scripts: ${SYSTEM_SYSVINIT_PATH}
552 SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH}
554 libcryptsetup: ${have_libcryptsetup}
555 tcpwrap: ${have_tcpwrap}
558 SELinux: ${have_selinux}
560 binfmt: ${have_binfmt}
561 plymouth: ${have_plymouth}
563 root dir: ${with_rootdir}
565 rootlib dir: ${with_rootlibdir}
566 pam modules dir: ${with_pamlibdir}
567 udev rules dir: ${with_udevrulesdir}
568 dbus policy dir: ${with_dbuspolicydir}
569 dbus session dir: ${with_dbussessionservicedir}
570 dbus system dir: ${with_dbussystemservicedir}
571 dbus interfaces dir: ${with_dbusinterfacedir}