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)
52 AM_GNU_GETTEXT([external])
53 AM_GNU_GETTEXT_VERSION([0.18.1])
62 AC_PROG_GCC_TRADITIONAL
64 AC_CHECK_TOOL(OBJCOPY, objcopy)
65 AC_CHECK_TOOL(STRINGS, strings)
67 CC_CHECK_CFLAGS_APPEND([ \
79 -Wmissing-include-dirs \
81 -Wold-style-definition \
84 -Wdeclaration-after-statement \
86 -Wmissing-prototypes \
89 -Wmissing-declarations \
97 -Wno-overlength-strings \
98 -Wno-unused-parameter \
99 -Wno-missing-field-initializers \
101 -Wp,-D_FORTIFY_SOURCE=2 \
104 -fdiagnostics-show-option \
105 -fno-strict-aliasing \
106 -fvisibility=hidden \
107 -ffunction-sections \
115 AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([*** POSIX RT library not found])])
116 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])])
120 # This makes sure pkg.m4 is available.
121 m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
123 PKG_CHECK_MODULES(UDEV, [ libudev >= 160 ])
124 AC_SUBST(UDEV_CFLAGS)
127 PKG_CHECK_MODULES(DBUS, [ dbus-1 >= 1.3.2 ])
128 AC_SUBST(DBUS_CFLAGS)
132 AC_ARG_ENABLE(selinux, AS_HELP_STRING([--disable-selinux], [Disable optional SELINUX support]))
133 if test "x$enable_selinux" != "xno"; then
134 PKG_CHECK_MODULES(SELINUX, [ libselinux ],
135 [AC_DEFINE(HAVE_SELINUX, 1, [Define if SELinux is available]) have_selinux=yes], have_selinux=no)
136 AC_SUBST(SELINUX_CFLAGS)
137 AC_SUBST(SELINUX_LIBS)
138 if test "x$have_selinux" = xno -a "x$enable_selinux" = xyes; then
139 AC_MSG_ERROR([*** SELinux support requested but libraries not found])
142 AM_CONDITIONAL(HAVE_SELINUX, [test "$have_selinux" = "yes"])
144 AC_ARG_ENABLE([tcpwrap],
145 AS_HELP_STRING([--disable-tcpwrap],[Disable optional TCP wrappers support]),
146 [case "${enableval}" in
147 yes) have_tcpwrap=yes ;;
148 no) have_tcpwrap=no ;;
149 *) AC_MSG_ERROR(bad value ${enableval} for --disable-tcpwrap) ;;
153 if test "x${have_tcpwrap}" != xno ; then
155 if test "x${LIBWRAP_LIBS}" = x ; then
156 if test "x$have_tcpwrap" = xyes ; then
157 AC_MSG_ERROR([*** TCP wrappers support not found.])
166 AC_SUBST(LIBWRAP_LIBS)
169 AS_HELP_STRING([--disable-pam],[Disable optional PAM support]),
170 [case "${enableval}" in
173 *) AC_MSG_ERROR(bad value ${enableval} for --disable-pam) ;;
177 if test "x${have_pam}" != xno ; then
179 [security/pam_modules.h security/pam_modutil.h security/pam_ext.h],
181 [if test "x$have_pam" = xyes ; then
182 AC_MSG_ERROR([*** PAM headers not found.])
189 [if test "x$have_pam" = xyes ; then
190 AC_MSG_ERROR([*** libpam not found.])
193 if test "x$have_pam" = xyes ; then
194 PAM_LIBS="-lpam -lpam_misc"
195 AC_DEFINE(HAVE_PAM, 1, [PAM available])
203 AM_CONDITIONAL([HAVE_PAM], [test "x$have_pam" != xno])
206 AS_HELP_STRING([--disable-acl],[Disable optional ACL support]),
207 [case "${enableval}" in
210 *) AC_MSG_ERROR(bad value ${enableval} for --disable-acl) ;;
214 if test "x${have_acl}" != xno ; then
216 [sys/acl.h acl/libacl.h],
218 [if test "x$have_acl" = xyes ; then
219 AC_MSG_ERROR([*** ACL headers not found.])
226 [if test "x$have_acl" = xyes ; then
227 AC_MSG_ERROR([*** libacl not found.])
230 if test "x$have_acl" = xyes ; then
232 AC_DEFINE(HAVE_ACL, 1, [ACL available])
240 AM_CONDITIONAL([HAVE_ACL], [test "x$have_acl" != xno])
242 AC_ARG_ENABLE([audit],
243 AS_HELP_STRING([--disable-audit],[Disable optional AUDIT support]),
244 [case "${enableval}" in
245 yes) have_audit=yes ;;
247 *) AC_MSG_ERROR(bad value ${enableval} for --disable-audit) ;;
251 if test "x${have_audit}" != xno ; then
255 [if test "x$have_audit" = xyes ; then
256 AC_MSG_ERROR([*** AUDIT headers not found.])
263 [if test "x$have_audit" = xyes ; then
264 AC_MSG_ERROR([*** libaudit not found.])
267 if test "x$have_audit" = xyes ; then
269 AC_DEFINE(HAVE_AUDIT, 1, [AUDIT available])
278 have_libcryptsetup=no
279 AC_ARG_ENABLE(libcryptsetup, AS_HELP_STRING([--disable-libcryptsetup], [disable libcryptsetup tools]))
280 if test "x$enable_libcryptsetup" != "xno"; then
281 PKG_CHECK_MODULES(LIBCRYPTSETUP, [ libcryptsetup ],
282 [AC_DEFINE(HAVE_LIBCRYPTSETUP, 1, [Define if libcryptsetup is available]) have_libcryptsetup=yes], have_libcryptsetup=no)
283 AC_SUBST(LIBCRYPTSETUP_CFLAGS)
284 AC_SUBST(LIBCRYPTSETUP_LIBS)
285 if test "x$have_libcryptsetup" = xno -a "x$enable_libcryptsetup" = xyes; then
286 AC_MSG_ERROR([*** libcryptsetup support requested but libraries not found])
289 AM_CONDITIONAL(HAVE_LIBCRYPTSETUP, [test "$have_libcryptsetup" = "yes"])
292 AC_ARG_ENABLE(binfmt, AS_HELP_STRING([--disable-binfmt], [disable binfmt tool]))
293 if test "x$enable_binfmt" != "xno"; then
296 AM_CONDITIONAL(ENABLE_BINFMT, [test "$have_binfmt" = "yes"])
299 AC_ARG_ENABLE(gtk, AS_HELP_STRING([--disable-gtk], [disable GTK tools]))
300 if test "x$enable_gtk" != "xno"; then
301 PKG_CHECK_MODULES(GTK, [ gtk+-2.0 glib-2.0 > 2.26 gio-unix-2.0 ],
302 [AC_DEFINE(HAVE_GTK, 1, [Define if GTK is available]) have_gtk=yes], have_gtk=no)
305 if test "x$have_gtk" = xno -a "x$enable_gtk" = xyes; then
306 AC_MSG_ERROR([*** gtk support requested but libraries not found])
309 AM_CONDITIONAL(HAVE_GTK, [test "$have_gtk" = "yes"])
311 if test "$have_gtk" = "yes"; then
312 PKG_CHECK_MODULES(LIBNOTIFY, [ libnotify ])
313 PKG_CHECK_EXISTS([ libnotify >= 0.7.0 ], [ libnotify07=yes ])
315 AC_SUBST(LIBNOTIFY_CFLAGS)
316 AC_SUBST(LIBNOTIFY_LIBS)
318 AM_CONDITIONAL(LIBNOTIFY07, [ test "$libnotify07" = "yes" ])
320 AM_PROG_VALAC([0.10])
322 AM_CONDITIONAL(HAVE_VALAC, test x"$VALAC" != x)
324 AC_PATH_PROG([XSLTPROC], [xsltproc])
325 AM_CONDITIONAL(HAVE_XSLTPROC, test x"$XSLTPROC" != x)
327 AC_PATH_PROG([M4], [m4])
329 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]))
330 if test "z$with_distro" = "z"; then
331 if test "$cross_compiling" = yes; then
332 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)])
334 test -f "/etc/redhat-release" && with_distro="fedora"
335 test -f "/etc/SuSE-release" && with_distro="suse"
336 test -f "/etc/debian_version" && with_distro="debian"
337 test -f "/etc/arch-release" && with_distro="arch"
338 test -f "/etc/gentoo-release" && with_distro="gentoo"
339 test -f "/etc/slackware-version" && with_distro="slackware"
340 test -f "/etc/frugalware-release" && with_distro="frugalware"
341 test -f "/etc/altlinux-release" && with_distro="altlinux"
342 test -f "/etc/mandriva-release" && with_distro="mandriva"
343 test -f "/etc/meego-release" && with_distro="meego"
344 test -f "/etc/angstrom-version" && with_distro="angstrom"
345 if test "x`lsb_release -is 2>/dev/null`" = "xUbuntu"; then
349 if test "z$with_distro" = "z"; then
350 with_distro=`uname -s`
353 with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
354 AC_DEFINE_UNQUOTED(DISTRIBUTION, ["${with_distro}"], [Target Distribution])
356 # Location of the init scripts as mandated by LSB
357 SYSTEM_SYSVINIT_PATH=/etc/init.d
358 SYSTEM_SYSVRCND_PATH=/etc/rc.d
365 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
366 AC_DEFINE(TARGET_FEDORA, [], [Target is Fedora/RHEL])
367 M4_DISTRO_FLAG=-DTARGET_FEDORA=1
371 SYSTEM_SYSVRCND_PATH=/etc/init.d
372 AC_DEFINE(TARGET_SUSE, [], [Target is openSUSE/SLE])
373 M4_DISTRO_FLAG=-DTARGET_SUSE=1
377 SYSTEM_SYSVRCND_PATH=/etc
378 AC_DEFINE(TARGET_DEBIAN, [], [Target is Debian])
379 M4_DISTRO_FLAG=-DTARGET_DEBIAN=1
382 SYSTEM_SYSVRCND_PATH=/etc
383 AC_DEFINE(TARGET_UBUNTU, [], [Target is Ubuntu])
384 M4_DISTRO_FLAG=-DTARGET_UBUNTU=1
387 SYSTEM_SYSVINIT_PATH=/etc/rc.d
388 SYSTEM_SYSVRCND_PATH=/etc
389 AC_DEFINE(TARGET_ARCH, [], [Target is ArchLinux])
390 M4_DISTRO_FLAG=-DTARGET_ARCH=1
393 SYSTEM_SYSVINIT_PATH=
394 SYSTEM_SYSVRCND_PATH=
395 AC_DEFINE(TARGET_GENTOO, [], [Target is Gentoo])
396 M4_DISTRO_FLAG=-DTARGET_GENTOO=1
399 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
400 AC_DEFINE(TARGET_SLACKWARE, [], [Target is Slackware])
401 M4_DISTRO_FLAG=-DTARGET_SLACKWARE=1
404 SYSTEM_SYSVINIT_PATH=/etc/rc.d
405 AC_DEFINE(TARGET_FRUGALWARE, [], [Target is Frugalware])
406 M4_DISTRO_FLAG=-DTARGET_FRUGALWARE=1
410 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
411 AC_DEFINE(TARGET_ALTLINUX, [], [Target is ALTLinux])
412 M4_DISTRO_FLAG=-DTARGET_ALTLINUX=1
416 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
417 AC_DEFINE(TARGET_MANDRIVA, [], [Target is Mandriva])
418 M4_DISTRO_FLAG=-DTARGET_MANDRIVA=1
422 SYSTEM_SYSVINIT_PATH=
423 SYSTEM_SYSVRCND_PATH=
424 AC_DEFINE(TARGET_MEEGO, [], [Target is MeeGo])
425 M4_DISTRO_FLAG=-DTARGET_MEEGO=1
428 SYSTEM_SYSVRCND_PATH=/etc
429 AC_DEFINE(TARGET_ANGSTROM, [], [Target is Ångström])
430 M4_DISTRO_FLAG=-DTARGET_ANGSTROM=1
435 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])
439 AC_ARG_WITH([sysvinit-path],
440 [AS_HELP_STRING([--with-sysvinit-path=PATH],
441 [Specify the path to where the SysV init scripts are located @<:@default=based on distro@:>@])],
442 [SYSTEM_SYSVINIT_PATH="$withval"],
445 AC_ARG_WITH([sysvrcd-path],
446 [AS_HELP_STRING([--with-sysvrcd-path=PATH],
447 [Specify the path to the base directory for the SysV rcN.d directories @<:@default=based on distro@:>@])],
448 [SYSTEM_SYSVRCND_PATH="$withval"],
451 AC_SUBST(SYSTEM_SYSVINIT_PATH)
452 AC_SUBST(SYSTEM_SYSVRCND_PATH)
453 AC_SUBST(M4_DISTRO_FLAG)
455 if test "x${SYSTEM_SYSVINIT_PATH}" != "x" -a "x${SYSTEM_SYSVRCND_PATH}" != "x"; then
456 AC_DEFINE(HAVE_SYSV_COMPAT, [], [SysV init scripts and rcN.d links are supported.])
457 SYSTEM_SYSV_COMPAT="yes"
458 elif test "x${SYSTEM_SYSVINIT_PATH}" != "x" -o "x${SYSTEM_SYSVRCND_PATH}" != "x"; then
459 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.])
461 SYSTEM_SYSV_COMPAT="no"
464 AC_ARG_WITH([tty-gid],
465 [AS_HELP_STRING([--with-tty-gid=GID],
466 [Specify the numeric GID of the 'tty' group])],
467 [AC_DEFINE_UNQUOTED(TTY_GID, [$withval], [GID of the 'tty' group])],
470 AC_ARG_ENABLE(plymouth, AS_HELP_STRING([--enable-plymouth], [enable plymouth support]))
471 if test -n "$enable_plymouth"; then
472 have_plymouth="$enable_plymouth"
475 AM_CONDITIONAL(TARGET_FEDORA, test x"$with_distro" = xfedora)
476 AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse)
477 AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian)
478 AM_CONDITIONAL(TARGET_UBUNTU, test x"$with_distro" = xubuntu)
479 AM_CONDITIONAL(TARGET_DEBIAN_OR_UBUNTU, test x"$with_distro" = xdebian -o x"$with_distro" = xubuntu)
480 AM_CONDITIONAL(TARGET_ARCH, test x"$with_distro" = xarch)
481 AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo)
482 AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware)
483 AM_CONDITIONAL(TARGET_FRUGALWARE, test x"$with_distro" = xfrugalware)
484 AM_CONDITIONAL(TARGET_ALTLINUX, test x"$with_distro" = xaltlinux)
485 AM_CONDITIONAL(TARGET_MANDRIVA, test x"$with_distro" = xmandriva)
486 AM_CONDITIONAL(TARGET_MEEGO, test x"$with_distro" = xmeego)
487 AM_CONDITIONAL(TARGET_ANGSTROM, test x"$with_distro" = xangstrom)
489 AM_CONDITIONAL(HAVE_PLYMOUTH, test "$have_plymouth" = "yes")
490 AM_CONDITIONAL(HAVE_SYSV_COMPAT, test "$SYSTEM_SYSV_COMPAT" = "yes")
492 AC_ARG_WITH([dbuspolicydir],
493 AS_HELP_STRING([--with-dbuspolicydir=DIR], [D-Bus policy directory]),
495 [with_dbuspolicydir=`pkg-config --variable=sysconfdir dbus-1`/dbus-1/system.d])
497 AC_ARG_WITH([dbussessionservicedir],
498 AS_HELP_STRING([--with-dbussessionservicedir=DIR], [D-Bus session service directory]),
500 [with_dbussessionservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`])
502 AC_ARG_WITH([dbussystemservicedir],
503 AS_HELP_STRING([--with-dbussystemservicedir=DIR], [D-Bus system service directory]),
505 [with_dbussystemservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../system-services])
507 AC_ARG_WITH([dbusinterfacedir],
508 AS_HELP_STRING([--with-dbusinterfacedir=DIR], [D-Bus interface directory]),
510 [with_dbusinterfacedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../interfaces])
512 AC_ARG_WITH([udevrulesdir],
513 AS_HELP_STRING([--with-udevrulesdir=DIR], [Diectory for udev rules]),
515 [with_udevrulesdir=`pkg-config --variable=udevdir udev`/rules.d])
517 AC_ARG_WITH([pamlibdir],
518 AS_HELP_STRING([--with-pamlibdir=DIR], [Diectory for PAM modules]),
520 [with_pamlibdir=/lib/`$CC -print-multi-os-directory`/security])
522 AC_ARG_WITH([rootdir],
523 AS_HELP_STRING([--with-rootdir=DIR], [Root directory for files necessary for boot]),
525 [with_rootdir=${ac_default_prefix}])
527 AC_SUBST([dbuspolicydir], [$with_dbuspolicydir])
528 AC_SUBST([dbussessionservicedir], [$with_dbussessionservicedir])
529 AC_SUBST([dbussystemservicedir], [$with_dbussystemservicedir])
530 AC_SUBST([dbusinterfacedir], [$with_dbusinterfacedir])
531 AC_SUBST([udevrulesdir], [$with_udevrulesdir])
532 AC_SUBST([pamlibdir], [$with_pamlibdir])
533 AC_SUBST([rootdir], [$with_rootdir])
535 AC_CONFIG_FILES([Makefile po/Makefile.in])
539 $PACKAGE_NAME $VERSION
541 Distribution: ${with_distro}
542 SysV compatibility: ${SYSTEM_SYSV_COMPAT}
543 SysV init scripts: ${SYSTEM_SYSVINIT_PATH}
544 SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH}
546 libcryptsetup: ${have_libcryptsetup}
547 tcpwrap: ${have_tcpwrap}
550 SELinux: ${have_selinux}
552 binfmt: ${have_binfmt}
553 plymouth: ${have_plymouth}
555 root dir: ${with_rootdir}
556 udev rules dir: ${with_udevrulesdir}
557 pam modules dir: ${with_pamlibdir}
558 dbus policy dir: ${with_dbuspolicydir}
559 dbus session dir: ${with_dbussessionservicedir}
560 dbus system dir: ${with_dbussystemservicedir}
561 dbus interfaces dir: ${with_dbusinterfacedir}