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],[29],[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])])
114 AC_SEARCH_LIBS([cap_init], [cap], [], [AC_MSG_ERROR([*** POSIX caps library not found])])
115 AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers not found])])
117 # This makes sure pkg.m4 is available.
118 m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
120 PKG_CHECK_MODULES(UDEV, [ libudev >= 160 ])
121 AC_SUBST(UDEV_CFLAGS)
124 PKG_CHECK_MODULES(DBUS, [ dbus-1 >= 1.3.2 ])
125 AC_SUBST(DBUS_CFLAGS)
129 AC_ARG_ENABLE(selinux, AS_HELP_STRING([--disable-selinux], [Disable optional SELINUX support]))
130 if test "x$enable_selinux" != "xno"; then
131 PKG_CHECK_MODULES(SELINUX, [ libselinux ],
132 [AC_DEFINE(HAVE_SELINUX, 1, [Define if SELinux is available]) have_selinux=yes], have_selinux=no)
133 AC_SUBST(SELINUX_CFLAGS)
134 AC_SUBST(SELINUX_LIBS)
135 if test "x$have_selinux" = xno -a "x$enable_selinux" = xyes; then
136 AC_MSG_ERROR([*** SELinux support requested but libraries not found])
139 AM_CONDITIONAL(HAVE_SELINUX, [test "$have_selinux" = "yes"])
141 AC_ARG_ENABLE([tcpwrap],
142 AS_HELP_STRING([--disable-tcpwrap],[Disable optional TCP wrappers support]),
143 [case "${enableval}" in
144 yes) have_tcpwrap=yes ;;
145 no) have_tcpwrap=no ;;
146 *) AC_MSG_ERROR(bad value ${enableval} for --disable-tcpwrap) ;;
150 if test "x${have_tcpwrap}" != xno ; then
152 if test "x${LIBWRAP_LIBS}" = x ; then
153 if test "x$have_tcpwrap" = xyes ; then
154 AC_MSG_ERROR([*** TCP wrappers support not found.])
163 AC_SUBST(LIBWRAP_LIBS)
166 AS_HELP_STRING([--disable-pam],[Disable optional PAM support]),
167 [case "${enableval}" in
170 *) AC_MSG_ERROR(bad value ${enableval} for --disable-pam) ;;
174 if test "x${have_pam}" != xno ; then
176 [security/pam_modules.h security/pam_modutil.h security/pam_ext.h],
178 [if test "x$have_pam" = xyes ; then
179 AC_MSG_ERROR([*** PAM headers not found.])
186 [if test "x$have_pam" = xyes ; then
187 AC_MSG_ERROR([*** libpam not found.])
190 if test "x$have_pam" = xyes ; then
191 PAM_LIBS="-lpam -lpam_misc"
192 AC_DEFINE(HAVE_PAM, 1, [PAM available])
200 AM_CONDITIONAL([HAVE_PAM], [test "x$have_pam" != xno])
203 AS_HELP_STRING([--disable-acl],[Disable optional ACL support]),
204 [case "${enableval}" in
207 *) AC_MSG_ERROR(bad value ${enableval} for --disable-acl) ;;
211 if test "x${have_acl}" != xno ; then
213 [sys/acl.h acl/libacl.h],
215 [if test "x$have_acl" = xyes ; then
216 AC_MSG_ERROR([*** ACL headers not found.])
223 [if test "x$have_acl" = xyes ; then
224 AC_MSG_ERROR([*** libacl not found.])
227 if test "x$have_acl" = xyes ; then
229 AC_DEFINE(HAVE_ACL, 1, [ACL available])
237 AM_CONDITIONAL([HAVE_ACL], [test "x$have_acl" != xno])
239 AC_ARG_ENABLE([audit],
240 AS_HELP_STRING([--disable-audit],[Disable optional AUDIT support]),
241 [case "${enableval}" in
242 yes) have_audit=yes ;;
244 *) AC_MSG_ERROR(bad value ${enableval} for --disable-audit) ;;
248 if test "x${have_audit}" != xno ; then
252 [if test "x$have_audit" = xyes ; then
253 AC_MSG_ERROR([*** AUDIT headers not found.])
260 [if test "x$have_audit" = xyes ; then
261 AC_MSG_ERROR([*** libaudit not found.])
264 if test "x$have_audit" = xyes ; then
266 AC_DEFINE(HAVE_AUDIT, 1, [AUDIT available])
275 have_libcryptsetup=no
276 AC_ARG_ENABLE(libcryptsetup, AS_HELP_STRING([--disable-libcryptsetup], [disable libcryptsetup tools]))
277 if test "x$enable_libcryptsetup" != "xno"; then
278 PKG_CHECK_MODULES(LIBCRYPTSETUP, [ libcryptsetup ],
279 [AC_DEFINE(HAVE_LIBCRYPTSETUP, 1, [Define if libcryptsetup is available]) have_libcryptsetup=yes], have_libcryptsetup=no)
280 AC_SUBST(LIBCRYPTSETUP_CFLAGS)
281 AC_SUBST(LIBCRYPTSETUP_LIBS)
282 if test "x$have_libcryptsetup" = xno -a "x$enable_libcryptsetup" = xyes; then
283 AC_MSG_ERROR([*** libcryptsetup support requested but libraries not found])
286 AM_CONDITIONAL(HAVE_LIBCRYPTSETUP, [test "$have_libcryptsetup" = "yes"])
289 AC_ARG_ENABLE(binfmt, AS_HELP_STRING([--disable-binfmt], [disable binfmt tool]))
290 if test "x$enable_binfmt" != "xno"; then
293 AM_CONDITIONAL(ENABLE_BINFMT, [test "$have_binfmt" = "yes"])
296 AC_ARG_ENABLE(gtk, AS_HELP_STRING([--disable-gtk], [disable GTK tools]))
297 if test "x$enable_gtk" != "xno"; then
298 PKG_CHECK_MODULES(GTK, [ gtk+-2.0 glib-2.0 > 2.26 gio-unix-2.0 ],
299 [AC_DEFINE(HAVE_GTK, 1, [Define if GTK is available]) have_gtk=yes], have_gtk=no)
302 if test "x$have_gtk" = xno -a "x$enable_gtk" = xyes; then
303 AC_MSG_ERROR([*** gtk support requested but libraries not found])
306 AM_CONDITIONAL(HAVE_GTK, [test "$have_gtk" = "yes"])
308 if test "$have_gtk" = "yes"; then
309 PKG_CHECK_MODULES(LIBNOTIFY, [ libnotify ])
310 PKG_CHECK_EXISTS([ libnotify >= 0.7.0 ], [ libnotify07=yes ])
312 AC_SUBST(LIBNOTIFY_CFLAGS)
313 AC_SUBST(LIBNOTIFY_LIBS)
315 AM_CONDITIONAL(LIBNOTIFY07, [ test "$libnotify07" = "yes" ])
317 AM_PROG_VALAC([0.10])
319 AM_CONDITIONAL(HAVE_VALAC, test x"$VALAC" != x)
321 AC_PATH_PROG([XSLTPROC], [xsltproc])
322 AM_CONDITIONAL(HAVE_XSLTPROC, test x"$XSLTPROC" != x)
324 AC_PATH_PROG([M4], [m4])
326 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]))
327 if test "z$with_distro" = "z"; then
328 if test "$cross_compiling" = yes; then
329 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)])
331 test -f "/etc/redhat-release" && with_distro="fedora"
332 test -f "/etc/SuSE-release" && with_distro="suse"
333 test -f "/etc/debian_version" && with_distro="debian"
334 test -f "/etc/arch-release" && with_distro="arch"
335 test -f "/etc/gentoo-release" && with_distro="gentoo"
336 test -f "/etc/slackware-version" && with_distro="slackware"
337 test -f "/etc/frugalware-release" && with_distro="frugalware"
338 test -f "/etc/altlinux-release" && with_distro="altlinux"
339 test -f "/etc/mandriva-release" && with_distro="mandriva"
340 test -f "/etc/meego-release" && with_distro="meego"
341 test -f "/etc/angstrom-version" && with_distro="angstrom"
342 if test "x`lsb_release -is 2>/dev/null`" = "xUbuntu"; then
346 if test "z$with_distro" = "z"; then
347 with_distro=`uname -s`
350 with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
351 AC_DEFINE_UNQUOTED(DISTRIBUTION, ["${with_distro}"], [Target Distribution])
353 # Location of the init scripts as mandated by LSB
354 SYSTEM_SYSVINIT_PATH=/etc/init.d
355 SYSTEM_SYSVRCND_PATH=/etc/rc.d
362 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
363 AC_DEFINE(TARGET_FEDORA, [], [Target is Fedora/RHEL])
364 M4_DISTRO_FLAG=-DTARGET_FEDORA=1
368 SYSTEM_SYSVRCND_PATH=/etc/init.d
369 AC_DEFINE(TARGET_SUSE, [], [Target is openSUSE/SLE])
370 M4_DISTRO_FLAG=-DTARGET_SUSE=1
374 SYSTEM_SYSVRCND_PATH=/etc
375 AC_DEFINE(TARGET_DEBIAN, [], [Target is Debian])
376 M4_DISTRO_FLAG=-DTARGET_DEBIAN=1
379 SYSTEM_SYSVRCND_PATH=/etc
380 AC_DEFINE(TARGET_UBUNTU, [], [Target is Ubuntu])
381 M4_DISTRO_FLAG=-DTARGET_UBUNTU=1
384 SYSTEM_SYSVINIT_PATH=/etc/rc.d
385 SYSTEM_SYSVRCND_PATH=/etc
386 AC_DEFINE(TARGET_ARCH, [], [Target is ArchLinux])
387 M4_DISTRO_FLAG=-DTARGET_ARCH=1
390 SYSTEM_SYSVINIT_PATH=
391 SYSTEM_SYSVRCND_PATH=
392 AC_DEFINE(TARGET_GENTOO, [], [Target is Gentoo])
393 M4_DISTRO_FLAG=-DTARGET_GENTOO=1
396 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
397 AC_DEFINE(TARGET_SLACKWARE, [], [Target is Slackware])
398 M4_DISTRO_FLAG=-DTARGET_SLACKWARE=1
401 SYSTEM_SYSVINIT_PATH=/etc/rc.d
402 AC_DEFINE(TARGET_FRUGALWARE, [], [Target is Frugalware])
403 M4_DISTRO_FLAG=-DTARGET_FRUGALWARE=1
407 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
408 AC_DEFINE(TARGET_ALTLINUX, [], [Target is ALTLinux])
409 M4_DISTRO_FLAG=-DTARGET_ALTLINUX=1
413 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
414 AC_DEFINE(TARGET_MANDRIVA, [], [Target is Mandriva])
415 M4_DISTRO_FLAG=-DTARGET_MANDRIVA=1
419 SYSTEM_SYSVINIT_PATH=
420 SYSTEM_SYSVRCND_PATH=
421 AC_DEFINE(TARGET_MEEGO, [], [Target is MeeGo])
422 M4_DISTRO_FLAG=-DTARGET_MEEGO=1
425 SYSTEM_SYSVRCND_PATH=/etc
426 AC_DEFINE(TARGET_ANGSTROM, [], [Target is Ångström])
427 M4_DISTRO_FLAG=-DTARGET_ANGSTROM=1
432 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])
436 AC_ARG_WITH([sysvinit-path],
437 [AS_HELP_STRING([--with-sysvinit-path=PATH],
438 [Specify the path to where the SysV init scripts are located @<:@default=based on distro@:>@])],
439 [SYSTEM_SYSVINIT_PATH="$withval"],
442 AC_ARG_WITH([sysvrcd-path],
443 [AS_HELP_STRING([--with-sysvrcd-path=PATH],
444 [Specify the path to the base directory for the SysV rcN.d directories @<:@default=based on distro@:>@])],
445 [SYSTEM_SYSVRCND_PATH="$withval"],
448 AC_SUBST(SYSTEM_SYSVINIT_PATH)
449 AC_SUBST(SYSTEM_SYSVRCND_PATH)
450 AC_SUBST(M4_DISTRO_FLAG)
452 if test "x${SYSTEM_SYSVINIT_PATH}" != "x" -a "x${SYSTEM_SYSVRCND_PATH}" != "x"; then
453 AC_DEFINE(HAVE_SYSV_COMPAT, [], [SysV init scripts and rcN.d links are supported.])
454 SYSTEM_SYSV_COMPAT="yes"
455 elif test "x${SYSTEM_SYSVINIT_PATH}" != "x" -o "x${SYSTEM_SYSVRCND_PATH}" != "x"; then
456 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.])
458 SYSTEM_SYSV_COMPAT="no"
461 AC_ARG_WITH([tty-gid],
462 [AS_HELP_STRING([--with-tty-gid=GID],
463 [Specify the numeric GID of the 'tty' group])],
464 [AC_DEFINE_UNQUOTED(TTY_GID, [$withval], [GID of the 'tty' group])],
467 AC_ARG_ENABLE(plymouth, AS_HELP_STRING([--enable-plymouth], [enable plymouth support]))
468 if test -n "$enable_plymouth"; then
469 have_plymouth="$enable_plymouth"
472 AM_CONDITIONAL(TARGET_FEDORA, test x"$with_distro" = xfedora)
473 AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse)
474 AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian)
475 AM_CONDITIONAL(TARGET_UBUNTU, test x"$with_distro" = xubuntu)
476 AM_CONDITIONAL(TARGET_DEBIAN_OR_UBUNTU, test x"$with_distro" = xdebian -o x"$with_distro" = xubuntu)
477 AM_CONDITIONAL(TARGET_ARCH, test x"$with_distro" = xarch)
478 AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo)
479 AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware)
480 AM_CONDITIONAL(TARGET_FRUGALWARE, test x"$with_distro" = xfrugalware)
481 AM_CONDITIONAL(TARGET_ALTLINUX, test x"$with_distro" = xaltlinux)
482 AM_CONDITIONAL(TARGET_MANDRIVA, test x"$with_distro" = xmandriva)
483 AM_CONDITIONAL(TARGET_MEEGO, test x"$with_distro" = xmeego)
484 AM_CONDITIONAL(TARGET_ANGSTROM, test x"$with_distro" = xangstrom)
486 AM_CONDITIONAL(HAVE_PLYMOUTH, test "$have_plymouth" = "yes")
487 AM_CONDITIONAL(HAVE_SYSV_COMPAT, test "$SYSTEM_SYSV_COMPAT" = "yes")
489 AC_ARG_WITH([dbuspolicydir],
490 AS_HELP_STRING([--with-dbuspolicydir=DIR], [D-Bus policy directory]),
492 [with_dbuspolicydir=`pkg-config --variable=sysconfdir dbus-1`/dbus-1/system.d])
494 AC_ARG_WITH([dbussessionservicedir],
495 AS_HELP_STRING([--with-dbussessionservicedir=DIR], [D-Bus session service directory]),
497 [with_dbussessionservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`])
499 AC_ARG_WITH([dbussystemservicedir],
500 AS_HELP_STRING([--with-dbussystemservicedir=DIR], [D-Bus system service directory]),
502 [with_dbussystemservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../system-services])
504 AC_ARG_WITH([dbusinterfacedir],
505 AS_HELP_STRING([--with-dbusinterfacedir=DIR], [D-Bus interface directory]),
507 [with_dbusinterfacedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../interfaces])
509 AC_ARG_WITH([udevrulesdir],
510 AS_HELP_STRING([--with-udevrulesdir=DIR], [Diectory for udev rules]),
512 [with_udevrulesdir=`pkg-config --variable=udevdir udev`/rules.d])
514 AC_ARG_WITH([pamlibdir],
515 AS_HELP_STRING([--with-pamlibdir=DIR], [Diectory for PAM modules]),
517 [with_pamlibdir=/lib/`$CC -print-multi-os-directory`/security])
519 AC_ARG_WITH([rootdir],
520 AS_HELP_STRING([--with-rootdir=DIR], [Root directory for files necessary for boot]),
522 [with_rootdir=${ac_default_prefix}])
524 AC_SUBST([dbuspolicydir], [$with_dbuspolicydir])
525 AC_SUBST([dbussessionservicedir], [$with_dbussessionservicedir])
526 AC_SUBST([dbussystemservicedir], [$with_dbussystemservicedir])
527 AC_SUBST([dbusinterfacedir], [$with_dbusinterfacedir])
528 AC_SUBST([udevrulesdir], [$with_udevrulesdir])
529 AC_SUBST([pamlibdir], [$with_pamlibdir])
530 AC_SUBST([rootdir], [$with_rootdir])
532 AC_CONFIG_FILES([Makefile po/Makefile.in])
536 $PACKAGE_NAME $VERSION
538 Distribution: ${with_distro}
539 SysV compatibility: ${SYSTEM_SYSV_COMPAT}
540 SysV init scripts: ${SYSTEM_SYSVINIT_PATH}
541 SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH}
543 libcryptsetup: ${have_libcryptsetup}
544 tcpwrap: ${have_tcpwrap}
547 SELinux: ${have_selinux}
549 binfmt: ${have_binfmt}
550 plymouth: ${have_plymouth}
552 root dir: ${with_rootdir}
553 udev rules dir: ${with_udevrulesdir}
554 pam modules dir: ${with_pamlibdir}
555 dbus policy dir: ${with_dbuspolicydir}
556 dbus session dir: ${with_dbussessionservicedir}
557 dbus system dir: ${with_dbussystemservicedir}
558 dbus interfaces dir: ${with_dbusinterfacedir}