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],[32],[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)
60 AC_PROG_GCC_TRADITIONAL
62 AC_CHECK_TOOL(OBJCOPY, objcopy)
63 AC_CHECK_TOOL(STRINGS, strings)
64 AC_CHECK_TOOL(GPERF, gperf)
66 CC_CHECK_CFLAGS_APPEND([ \
78 -Wmissing-include-dirs \
80 -Wold-style-definition \
83 -Wdeclaration-after-statement \
85 -Wmissing-prototypes \
88 -Wmissing-declarations \
96 -Wno-overlength-strings \
97 -Wno-unused-parameter \
98 -Wno-missing-field-initializers \
100 -Wp,-D_FORTIFY_SOURCE=2 \
103 -fdiagnostics-show-option \
104 -fno-strict-aliasing \
105 -fvisibility=hidden \
106 -ffunction-sections \
114 AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([*** POSIX RT library not found])])
115 AC_SEARCH_LIBS([dlsym], [dl], [], [AC_MSG_ERROR([*** Dynamic linking loader library not found])])
119 AC_SEARCH_LIBS([cap_init], [cap], [], [AC_MSG_ERROR([*** POSIX caps library not found])])
120 AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers not found])])
125 # This makes sure pkg.m4 is available.
126 m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
128 PKG_CHECK_MODULES(UDEV, [ libudev >= 172 ])
129 AC_SUBST(UDEV_CFLAGS)
132 PKG_CHECK_MODULES(DBUS, [ dbus-1 >= 1.3.2 ])
133 AC_SUBST(DBUS_CFLAGS)
137 AC_ARG_ENABLE(selinux, AS_HELP_STRING([--disable-selinux], [Disable optional SELINUX support]))
138 if test "x$enable_selinux" != "xno"; then
139 PKG_CHECK_MODULES(SELINUX, [ libselinux ],
140 [AC_DEFINE(HAVE_SELINUX, 1, [Define if SELinux is available]) have_selinux=yes], have_selinux=no)
141 AC_SUBST(SELINUX_CFLAGS)
142 AC_SUBST(SELINUX_LIBS)
143 if test "x$have_selinux" = xno -a "x$enable_selinux" = xyes; then
144 AC_MSG_ERROR([*** SELinux support requested but libraries not found])
147 AM_CONDITIONAL(HAVE_SELINUX, [test "$have_selinux" = "yes"])
149 AC_ARG_ENABLE([tcpwrap],
150 AS_HELP_STRING([--disable-tcpwrap],[Disable optional TCP wrappers support]),
151 [case "${enableval}" in
152 yes) have_tcpwrap=yes ;;
153 no) have_tcpwrap=no ;;
154 *) AC_MSG_ERROR(bad value ${enableval} for --disable-tcpwrap) ;;
158 if test "x${have_tcpwrap}" != xno ; then
160 if test "x${LIBWRAP_LIBS}" = x ; then
161 if test "x$have_tcpwrap" = xyes ; then
162 AC_MSG_ERROR([*** TCP wrappers support not found.])
171 AC_SUBST(LIBWRAP_LIBS)
174 AS_HELP_STRING([--disable-pam],[Disable optional PAM support]),
175 [case "${enableval}" in
178 *) AC_MSG_ERROR(bad value ${enableval} for --disable-pam) ;;
182 if test "x${have_pam}" != xno ; then
184 [security/pam_modules.h security/pam_modutil.h security/pam_ext.h],
186 [if test "x$have_pam" = xyes ; then
187 AC_MSG_ERROR([*** PAM headers not found.])
194 [if test "x$have_pam" = xyes ; then
195 AC_MSG_ERROR([*** libpam not found.])
198 if test "x$have_pam" = xyes ; then
199 PAM_LIBS="-lpam -lpam_misc"
200 AC_DEFINE(HAVE_PAM, 1, [PAM available])
208 AM_CONDITIONAL([HAVE_PAM], [test "x$have_pam" != xno])
211 AS_HELP_STRING([--disable-acl],[Disable optional ACL support]),
212 [case "${enableval}" in
215 *) AC_MSG_ERROR(bad value ${enableval} for --disable-acl) ;;
219 if test "x${have_acl}" != xno ; then
221 [sys/acl.h acl/libacl.h],
223 [if test "x$have_acl" = xyes ; then
224 AC_MSG_ERROR([*** ACL headers not found.])
231 [if test "x$have_acl" = xyes ; then
232 AC_MSG_ERROR([*** libacl not found.])
235 if test "x$have_acl" = xyes ; then
237 AC_DEFINE(HAVE_ACL, 1, [ACL available])
245 AM_CONDITIONAL([HAVE_ACL], [test "x$have_acl" != xno])
247 AC_ARG_ENABLE([audit],
248 AS_HELP_STRING([--disable-audit],[Disable optional AUDIT support]),
249 [case "${enableval}" in
250 yes) have_audit=yes ;;
252 *) AC_MSG_ERROR(bad value ${enableval} for --disable-audit) ;;
256 if test "x${have_audit}" != xno ; then
260 [if test "x$have_audit" = xyes ; then
261 AC_MSG_ERROR([*** AUDIT headers not found.])
268 [if test "x$have_audit" = xyes ; then
269 AC_MSG_ERROR([*** libaudit not found.])
272 if test "x$have_audit" = xyes ; then
274 AC_DEFINE(HAVE_AUDIT, 1, [AUDIT available])
283 have_libcryptsetup=no
284 AC_ARG_ENABLE(libcryptsetup, AS_HELP_STRING([--disable-libcryptsetup], [disable libcryptsetup tools]))
285 if test "x$enable_libcryptsetup" != "xno"; then
286 PKG_CHECK_MODULES(LIBCRYPTSETUP, [ libcryptsetup ],
287 [AC_DEFINE(HAVE_LIBCRYPTSETUP, 1, [Define if libcryptsetup is available]) have_libcryptsetup=yes], have_libcryptsetup=no)
288 AC_SUBST(LIBCRYPTSETUP_CFLAGS)
289 AC_SUBST(LIBCRYPTSETUP_LIBS)
290 if test "x$have_libcryptsetup" = xno -a "x$enable_libcryptsetup" = xyes; then
291 AC_MSG_ERROR([*** libcryptsetup support requested but libraries not found])
294 AM_CONDITIONAL(HAVE_LIBCRYPTSETUP, [test "$have_libcryptsetup" = "yes"])
297 AC_ARG_ENABLE(binfmt, AS_HELP_STRING([--disable-binfmt], [disable binfmt tool]))
298 if test "x$enable_binfmt" != "xno"; then
301 AM_CONDITIONAL(ENABLE_BINFMT, [test "$have_binfmt" = "yes"])
304 AC_ARG_ENABLE(gtk, AS_HELP_STRING([--disable-gtk], [disable GTK tools]))
305 if test "x$enable_gtk" != "xno"; then
306 PKG_CHECK_MODULES(GTK, [ gtk+-2.0 glib-2.0 > 2.26 gio-unix-2.0 ],
307 [AC_DEFINE(HAVE_GTK, 1, [Define if GTK is available]) have_gtk=yes], have_gtk=no)
310 if test "x$have_gtk" = xno -a "x$enable_gtk" = xyes; then
311 AC_MSG_ERROR([*** gtk support requested but libraries not found])
314 AM_CONDITIONAL(HAVE_GTK, [test "$have_gtk" = "yes"])
316 if test "$have_gtk" = "yes"; then
317 PKG_CHECK_MODULES(LIBNOTIFY, [ libnotify ])
318 PKG_CHECK_EXISTS([ libnotify >= 0.7.0 ], [ libnotify07=yes ])
320 AC_SUBST(LIBNOTIFY_CFLAGS)
321 AC_SUBST(LIBNOTIFY_LIBS)
323 AM_CONDITIONAL(LIBNOTIFY07, [ test "$libnotify07" = "yes" ])
325 AM_PROG_VALAC([0.10])
327 AM_CONDITIONAL(HAVE_VALAC, test x"$VALAC" != x)
329 AC_PATH_PROG([XSLTPROC], [xsltproc])
330 AM_CONDITIONAL(HAVE_XSLTPROC, test x"$XSLTPROC" != x)
332 AC_PATH_PROG([M4], [m4])
334 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]))
335 if test "z$with_distro" = "z"; then
336 if test "$cross_compiling" = yes; then
337 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)])
339 test -f "/etc/redhat-release" && with_distro="fedora"
340 test -f "/etc/SuSE-release" && with_distro="suse"
341 test -f "/etc/debian_version" && with_distro="debian"
342 test -f "/etc/arch-release" && with_distro="arch"
343 test -f "/etc/gentoo-release" && with_distro="gentoo"
344 test -f "/etc/slackware-version" && with_distro="slackware"
345 test -f "/etc/frugalware-release" && with_distro="frugalware"
346 test -f "/etc/altlinux-release" && with_distro="altlinux"
347 test -f "/etc/mandriva-release" && with_distro="mandriva"
348 test -f "/etc/meego-release" && with_distro="meego"
349 test -f "/etc/angstrom-version" && with_distro="angstrom"
350 if test "x`lsb_release -is 2>/dev/null`" = "xUbuntu"; then
354 if test "z$with_distro" = "z"; then
355 with_distro=`uname -s`
358 with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
359 AC_DEFINE_UNQUOTED(DISTRIBUTION, ["${with_distro}"], [Target Distribution])
361 # Location of the init scripts as mandated by LSB
362 SYSTEM_SYSVINIT_PATH=/etc/init.d
363 SYSTEM_SYSVRCND_PATH=/etc/rc.d
370 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
371 AC_DEFINE(TARGET_FEDORA, [], [Target is Fedora/RHEL])
372 M4_DEFINES=-DTARGET_FEDORA=1
376 SYSTEM_SYSVRCND_PATH=/etc/init.d
377 AC_DEFINE(TARGET_SUSE, [], [Target is openSUSE/SLE])
378 M4_DEFINES=-DTARGET_SUSE=1
382 SYSTEM_SYSVRCND_PATH=/etc
383 AC_DEFINE(TARGET_DEBIAN, [], [Target is Debian])
384 M4_DEFINES=-DTARGET_DEBIAN=1
387 SYSTEM_SYSVRCND_PATH=/etc
388 AC_DEFINE(TARGET_UBUNTU, [], [Target is Ubuntu])
389 M4_DEFINES=-DTARGET_UBUNTU=1
392 SYSTEM_SYSVINIT_PATH=/etc/rc.d
393 SYSTEM_SYSVRCND_PATH=/etc
394 AC_DEFINE(TARGET_ARCH, [], [Target is ArchLinux])
395 M4_DEFINES=-DTARGET_ARCH=1
398 SYSTEM_SYSVINIT_PATH=
399 SYSTEM_SYSVRCND_PATH=
400 AC_DEFINE(TARGET_GENTOO, [], [Target is Gentoo])
401 M4_DEFINES=-DTARGET_GENTOO=1
404 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
405 AC_DEFINE(TARGET_SLACKWARE, [], [Target is Slackware])
406 M4_DEFINES=-DTARGET_SLACKWARE=1
409 SYSTEM_SYSVINIT_PATH=/etc/rc.d
410 AC_DEFINE(TARGET_FRUGALWARE, [], [Target is Frugalware])
411 M4_DEFINES=-DTARGET_FRUGALWARE=1
415 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
416 AC_DEFINE(TARGET_ALTLINUX, [], [Target is ALTLinux])
417 M4_DEFINES=-DTARGET_ALTLINUX=1
421 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
422 AC_DEFINE(TARGET_MANDRIVA, [], [Target is Mandriva])
423 M4_DEFINES=-DTARGET_MANDRIVA=1
427 SYSTEM_SYSVINIT_PATH=
428 SYSTEM_SYSVRCND_PATH=
429 AC_DEFINE(TARGET_MEEGO, [], [Target is MeeGo])
430 M4_DEFINES=-DTARGET_MEEGO=1
433 SYSTEM_SYSVRCND_PATH=/etc
434 AC_DEFINE(TARGET_ANGSTROM, [], [Target is Ångström])
435 M4_DEFINES=-DTARGET_ANGSTROM=1
440 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])
444 AC_ARG_WITH([sysvinit-path],
445 [AS_HELP_STRING([--with-sysvinit-path=PATH],
446 [Specify the path to where the SysV init scripts are located @<:@default=based on distro@:>@])],
447 [SYSTEM_SYSVINIT_PATH="$withval"],
450 AC_ARG_WITH([sysvrcd-path],
451 [AS_HELP_STRING([--with-sysvrcd-path=PATH],
452 [Specify the path to the base directory for the SysV rcN.d directories @<:@default=based on distro@:>@])],
453 [SYSTEM_SYSVRCND_PATH="$withval"],
456 AC_SUBST(SYSTEM_SYSVINIT_PATH)
457 AC_SUBST(SYSTEM_SYSVRCND_PATH)
460 if test "x${SYSTEM_SYSVINIT_PATH}" != "x" -a "x${SYSTEM_SYSVRCND_PATH}" != "x"; then
461 AC_DEFINE(HAVE_SYSV_COMPAT, [], [SysV init scripts and rcN.d links are supported.])
462 SYSTEM_SYSV_COMPAT="yes"
463 M4_DEFINES="$M4_DEFINES -DHAVE_SYSV_COMPAT"
464 elif test "x${SYSTEM_SYSVINIT_PATH}" != "x" -o "x${SYSTEM_SYSVRCND_PATH}" != "x"; then
465 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.])
467 SYSTEM_SYSV_COMPAT="no"
470 AC_ARG_WITH([tty-gid],
471 [AS_HELP_STRING([--with-tty-gid=GID],
472 [Specify the numeric GID of the 'tty' group])],
473 [AC_DEFINE_UNQUOTED(TTY_GID, [$withval], [GID of the 'tty' group])],
476 AC_ARG_ENABLE(plymouth, AS_HELP_STRING([--enable-plymouth], [enable plymouth support]))
477 if test -n "$enable_plymouth"; then
478 have_plymouth="$enable_plymouth"
481 AM_CONDITIONAL(TARGET_FEDORA, test x"$with_distro" = xfedora)
482 AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse)
483 AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian)
484 AM_CONDITIONAL(TARGET_UBUNTU, test x"$with_distro" = xubuntu)
485 AM_CONDITIONAL(TARGET_DEBIAN_OR_UBUNTU, test x"$with_distro" = xdebian -o x"$with_distro" = xubuntu)
486 AM_CONDITIONAL(TARGET_ARCH, test x"$with_distro" = xarch)
487 AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo)
488 AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware)
489 AM_CONDITIONAL(TARGET_FRUGALWARE, test x"$with_distro" = xfrugalware)
490 AM_CONDITIONAL(TARGET_ALTLINUX, test x"$with_distro" = xaltlinux)
491 AM_CONDITIONAL(TARGET_MANDRIVA, test x"$with_distro" = xmandriva)
492 AM_CONDITIONAL(TARGET_MEEGO, test x"$with_distro" = xmeego)
493 AM_CONDITIONAL(TARGET_ANGSTROM, test x"$with_distro" = xangstrom)
495 AM_CONDITIONAL(HAVE_PLYMOUTH, test "$have_plymouth" = "yes")
496 AM_CONDITIONAL(HAVE_SYSV_COMPAT, test "$SYSTEM_SYSV_COMPAT" = "yes")
498 AC_ARG_WITH([dbuspolicydir],
499 AS_HELP_STRING([--with-dbuspolicydir=DIR], [D-Bus policy directory]),
501 [with_dbuspolicydir=`pkg-config --variable=sysconfdir dbus-1`/dbus-1/system.d])
503 AC_ARG_WITH([dbussessionservicedir],
504 AS_HELP_STRING([--with-dbussessionservicedir=DIR], [D-Bus session service directory]),
506 [with_dbussessionservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`])
508 AC_ARG_WITH([dbussystemservicedir],
509 AS_HELP_STRING([--with-dbussystemservicedir=DIR], [D-Bus system service directory]),
511 [with_dbussystemservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../system-services])
513 AC_ARG_WITH([dbusinterfacedir],
514 AS_HELP_STRING([--with-dbusinterfacedir=DIR], [D-Bus interface directory]),
516 [with_dbusinterfacedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../interfaces])
518 AC_ARG_WITH([udevrulesdir],
519 AS_HELP_STRING([--with-udevrulesdir=DIR], [Diectory for udev rules]),
521 [with_udevrulesdir=`pkg-config --variable=udevdir udev`/rules.d])
523 AC_ARG_WITH([pamlibdir],
524 AS_HELP_STRING([--with-pamlibdir=DIR], [Diectory for PAM modules]),
526 [with_pamlibdir=/lib/`$CC -print-multi-os-directory`/security])
528 AC_ARG_WITH([rootdir],
529 AS_HELP_STRING([--with-rootdir=DIR], [Root directory for files necessary for boot]),
531 [with_rootdir=${ac_default_prefix}])
533 AC_ARG_WITH([rootlibdir],
534 AS_HELP_STRING([--with-rootlibdir=DIR], [Root directory for libraries necessary for boot]),
536 [with_rootlibdir=${libdir}])
538 AC_SUBST([dbuspolicydir], [$with_dbuspolicydir])
539 AC_SUBST([dbussessionservicedir], [$with_dbussessionservicedir])
540 AC_SUBST([dbussystemservicedir], [$with_dbussystemservicedir])
541 AC_SUBST([dbusinterfacedir], [$with_dbusinterfacedir])
542 AC_SUBST([udevrulesdir], [$with_udevrulesdir])
543 AC_SUBST([pamlibdir], [$with_pamlibdir])
544 AC_SUBST([rootdir], [$with_rootdir])
545 AC_SUBST([rootlibdir], [$with_rootlibdir])
547 AC_CONFIG_FILES([Makefile po/Makefile.in])
550 $PACKAGE_NAME $VERSION
552 Distribution: ${with_distro}
553 SysV compatibility: ${SYSTEM_SYSV_COMPAT}
554 SysV init scripts: ${SYSTEM_SYSVINIT_PATH}
555 SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH}
557 libcryptsetup: ${have_libcryptsetup}
558 tcpwrap: ${have_tcpwrap}
561 SELinux: ${have_selinux}
563 binfmt: ${have_binfmt}
564 plymouth: ${have_plymouth}
566 root dir: ${with_rootdir}
568 rootlib dir: ${with_rootlibdir}
569 pam modules dir: ${with_pamlibdir}
570 udev rules dir: ${with_udevrulesdir}
571 dbus policy dir: ${with_dbuspolicydir}
572 dbus session dir: ${with_dbussessionservicedir}
573 dbus system dir: ${with_dbussystemservicedir}
574 dbus interfaces dir: ${with_dbusinterfacedir}