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],[25],[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}"
53 AC_PROG_GCC_TRADITIONAL
55 AC_CHECK_TOOL(OBJCOPY, objcopy)
56 AC_CHECK_TOOL(STRINGS, strings)
58 CC_CHECK_CFLAGS_APPEND([ \
70 -Wmissing-include-dirs \
72 -Wold-style-definition \
75 -Wdeclaration-after-statement \
77 -Wmissing-prototypes \
80 -Wmissing-declarations \
88 -Wno-overlength-strings \
89 -Wno-unused-parameter \
90 -Wno-missing-field-initializers \
92 -Wp,-D_FORTIFY_SOURCE=2 \
95 -fdiagnostics-show-option \
96 -fno-strict-aliasing \
106 AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([*** POSIX RT library not found])])
107 AC_SEARCH_LIBS([dlsym], [dl], [], [AC_MSG_ERROR([*** Dynamic linking loader library not found])])
108 AC_SEARCH_LIBS([cap_init], [cap], [], [AC_MSG_ERROR([*** POSIX caps library not found])])
109 AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers not found])])
111 # This makes sure pkg.m4 is available.
112 m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
114 PKG_CHECK_MODULES(UDEV, [ libudev >= 160 ])
115 AC_SUBST(UDEV_CFLAGS)
118 PKG_CHECK_MODULES(DBUS, [ dbus-1 >= 1.3.2 ])
119 AC_SUBST(DBUS_CFLAGS)
123 AC_ARG_ENABLE(selinux, AS_HELP_STRING([--disable-selinux], [Disable optional SELINUX support]))
124 if test "x$enable_selinux" != "xno"; then
125 PKG_CHECK_MODULES(SELINUX, [ libselinux ],
126 [AC_DEFINE(HAVE_SELINUX, 1, [Define if SELinux is available]) have_selinux=yes], have_selinux=no)
127 AC_SUBST(SELINUX_CFLAGS)
128 AC_SUBST(SELINUX_LIBS)
129 if test "x$have_selinux" = xno -a "x$enable_selinux" = xyes; then
130 AC_MSG_ERROR([*** SELinux support requested but libraries not found])
133 AM_CONDITIONAL(HAVE_SELINUX, [test "$have_selinux" = "yes"])
135 AC_ARG_ENABLE([tcpwrap],
136 AS_HELP_STRING([--disable-tcpwrap],[Disable optional TCP wrappers support]),
137 [case "${enableval}" in
138 yes) have_tcpwrap=yes ;;
139 no) have_tcpwrap=no ;;
140 *) AC_MSG_ERROR(bad value ${enableval} for --disable-tcpwrap) ;;
144 if test "x${have_tcpwrap}" != xno ; then
146 if test "x${LIBWRAP_LIBS}" = x ; then
147 if test "x$have_tcpwrap" = xyes ; then
148 AC_MSG_ERROR([*** TCP wrappers support not found.])
157 AC_SUBST(LIBWRAP_LIBS)
160 AS_HELP_STRING([--disable-pam],[Disable optional PAM support]),
161 [case "${enableval}" in
164 *) AC_MSG_ERROR(bad value ${enableval} for --disable-pam) ;;
168 if test "x${have_pam}" != xno ; then
170 [security/pam_modules.h security/pam_modutil.h security/pam_ext.h],
172 [if test "x$have_pam" = xyes ; then
173 AC_MSG_ERROR([*** PAM headers not found.])
180 [if test "x$have_pam" = xyes ; then
181 AC_MSG_ERROR([*** libpam not found.])
184 if test "x$have_pam" = xyes ; then
185 PAM_LIBS="-lpam -lpam_misc"
186 AC_DEFINE(HAVE_PAM, 1, [PAM available])
194 AM_CONDITIONAL([HAVE_PAM], [test "x$have_pam" != xno])
196 AC_ARG_ENABLE([audit],
197 AS_HELP_STRING([--disable-audit],[Disable optional AUDIT support]),
198 [case "${enableval}" in
199 yes) have_audit=yes ;;
201 *) AC_MSG_ERROR(bad value ${enableval} for --disable-audit) ;;
205 if test "x${have_audit}" != xno ; then
209 [if test "x$have_audit" = xyes ; then
210 AC_MSG_ERROR([*** AUDIT headers not found.])
217 [if test "x$have_audit" = xyes ; then
218 AC_MSG_ERROR([*** libaudit not found.])
221 if test "x$have_audit" = xyes ; then
223 AC_DEFINE(HAVE_AUDIT, 1, [AUDIT available])
232 have_libcryptsetup=no
233 AC_ARG_ENABLE(libcryptsetup, AS_HELP_STRING([--disable-libcryptsetup], [disable libcryptsetup tools]))
234 if test "x$enable_libcryptsetup" != "xno"; then
235 PKG_CHECK_MODULES(LIBCRYPTSETUP, [ libcryptsetup ],
236 [AC_DEFINE(HAVE_LIBCRYPTSETUP, 1, [Define if libcryptsetup is available]) have_libcryptsetup=yes], have_libcryptsetup=no)
237 AC_SUBST(LIBCRYPTSETUP_CFLAGS)
238 AC_SUBST(LIBCRYPTSETUP_LIBS)
239 if test "x$have_libcryptsetup" = xno -a "x$enable_libcryptsetup" = xyes; then
240 AC_MSG_ERROR([*** libcryptsetup support requested but libraries not found])
243 AM_CONDITIONAL(HAVE_LIBCRYPTSETUP, [test "$have_libcryptsetup" = "yes"])
246 AC_ARG_ENABLE(gtk, AS_HELP_STRING([--disable-gtk], [disable GTK tools]))
247 if test "x$enable_gtk" != "xno"; then
248 PKG_CHECK_MODULES(GTK, [ gtk+-2.0 glib-2.0 > 2.26 gio-unix-2.0 ],
249 [AC_DEFINE(HAVE_GTK, 1, [Define if GTK is available]) have_gtk=yes], have_gtk=no)
252 if test "x$have_gtk" = xno -a "x$enable_gtk" = xyes; then
253 AC_MSG_ERROR([*** gtk support requested but libraries not found])
256 AM_CONDITIONAL(HAVE_GTK, [test "$have_gtk" = "yes"])
258 if test "$have_gtk" = "yes"; then
259 PKG_CHECK_MODULES(LIBNOTIFY, [ libnotify ])
260 PKG_CHECK_EXISTS([ libnotify >= 0.7.0 ], [ libnotify07=yes ])
262 AC_SUBST(LIBNOTIFY_CFLAGS)
263 AC_SUBST(LIBNOTIFY_LIBS)
265 AM_CONDITIONAL(LIBNOTIFY07, [ test "$libnotify07" = "yes" ])
267 AM_PROG_VALAC([0.10])
269 AM_CONDITIONAL(HAVE_VALAC, test x"$VALAC" != x)
271 AC_PATH_PROG([XSLTPROC], [xsltproc])
272 AM_CONDITIONAL(HAVE_XSLTPROC, test x"$XSLTPROC" != x)
274 AC_PATH_PROG([M4], [m4])
276 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]))
277 if test "z$with_distro" = "z"; then
278 if test "$cross_compiling" = yes; then
279 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)])
281 test -f "/etc/redhat-release" && with_distro="fedora"
282 test -f "/etc/SuSE-release" && with_distro="suse"
283 test -f "/etc/debian_version" && with_distro="debian"
284 test -f "/etc/arch-release" && with_distro="arch"
285 test -f "/etc/gentoo-release" && with_distro="gentoo"
286 test -f "/etc/slackware-version" && with_distro="slackware"
287 test -f "/etc/frugalware-release" && with_distro="frugalware"
288 test -f "/etc/altlinux-release" && with_distro="altlinux"
289 test -f "/etc/mandriva-release" && with_distro="mandriva"
290 test -f "/etc/meego-release" && with_distro="meego"
291 if test "x`lsb_release -is 2>/dev/null`" = "xUbuntu"; then
295 if test "z$with_distro" = "z"; then
296 with_distro=`uname -s`
299 with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
300 AC_DEFINE_UNQUOTED(DISTRIBUTION, ["${with_distro}"], [Target Distribution])
302 # Location of the init scripts as mandated by LSB
303 SYSTEM_SYSVINIT_PATH=/etc/init.d
304 SYSTEM_SYSVRCND_PATH=/etc/rc.d
310 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
311 AC_DEFINE(TARGET_FEDORA, [], [Target is Fedora/RHEL])
312 M4_DISTRO_FLAG=-DTARGET_FEDORA=1
316 SYSTEM_SYSVRCND_PATH=/etc/init.d
317 AC_DEFINE(TARGET_SUSE, [], [Target is openSUSE/SLE])
318 M4_DISTRO_FLAG=-DTARGET_SUSE=1
322 SYSTEM_SYSVRCND_PATH=/etc
323 AC_DEFINE(TARGET_DEBIAN, [], [Target is Debian])
324 M4_DISTRO_FLAG=-DTARGET_DEBIAN=1
327 SYSTEM_SYSVRCND_PATH=/etc
328 AC_DEFINE(TARGET_UBUNTU, [], [Target is Ubuntu])
329 M4_DISTRO_FLAG=-DTARGET_UBUNTU=1
332 SYSTEM_SYSVINIT_PATH=/etc/rc.d
333 SYSTEM_SYSVRCND_PATH=/etc
334 AC_DEFINE(TARGET_ARCH, [], [Target is ArchLinux])
335 M4_DISTRO_FLAG=-DTARGET_ARCH=1
338 SYSTEM_SYSVINIT_PATH=
339 SYSTEM_SYSVRCND_PATH=
340 AC_DEFINE(TARGET_GENTOO, [], [Target is Gentoo])
341 M4_DISTRO_FLAG=-DTARGET_GENTOO=1
344 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
345 AC_DEFINE(TARGET_SLACKWARE, [], [Target is Slackware])
346 M4_DISTRO_FLAG=-DTARGET_SLACKWARE=1
349 SYSTEM_SYSVINIT_PATH=/etc/rc.d
350 AC_DEFINE(TARGET_FRUGALWARE, [], [Target is Frugalware])
351 M4_DISTRO_FLAG=-DTARGET_FRUGALWARE=1
354 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
355 AC_DEFINE(TARGET_ALTLINUX, [], [Target is ALTLinux])
356 M4_DISTRO_FLAG=-DTARGET_ALTLINUX=1
360 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
361 AC_DEFINE(TARGET_MANDRIVA, [], [Target is Mandriva])
362 M4_DISTRO_FLAG=-DTARGET_MANDRIVA=1
366 SYSTEM_SYSVINIT_PATH=
367 SYSTEM_SYSVRCND_PATH=
368 AC_DEFINE(TARGET_MEEGO, [], [Target is MeeGo])
369 M4_DISTRO_FLAG=-DTARGET_MEEGO=1
374 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])
378 AC_ARG_WITH([sysvinit-path],
379 [AS_HELP_STRING([--with-sysvinit-path=PATH],
380 [Specify the path to where the SysV init scripts are located @<:@default=based on distro@:>@])],
381 [SYSTEM_SYSVINIT_PATH="$withval"],
384 AC_ARG_WITH([sysvrcd-path],
385 [AS_HELP_STRING([--with-sysvrcd-path=PATH],
386 [Specify the path to the base directory for the SysV rcN.d directories @<:@default=based on distro@:>@])],
387 [SYSTEM_SYSVRCND_PATH="$withval"],
390 AC_SUBST(SYSTEM_SYSVINIT_PATH)
391 AC_SUBST(SYSTEM_SYSVRCND_PATH)
392 AC_SUBST(M4_DISTRO_FLAG)
394 if test "x${SYSTEM_SYSVINIT_PATH}" != "x" -a "x${SYSTEM_SYSVRCND_PATH}" != "x"; then
395 AC_DEFINE(HAVE_SYSV_COMPAT, [], [SysV init scripts and rcN.d links are supported.])
396 SYSTEM_SYSV_COMPAT="yes"
397 elif test "x${SYSTEM_SYSVINIT_PATH}" != "x" -o "x${SYSTEM_SYSVRCND_PATH}" != "x"; then
398 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.])
400 SYSTEM_SYSV_COMPAT="no"
403 AC_ARG_WITH([tty-gid],
404 [AS_HELP_STRING([--with-tty-gid=GID],
405 [Specify the numeric GID of the 'tty' group])],
406 [AC_DEFINE_UNQUOTED(TTY_GID, [$withval], [GID of the 'tty' group])],
409 AM_CONDITIONAL(TARGET_FEDORA, test x"$with_distro" = xfedora)
410 AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse)
411 AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian)
412 AM_CONDITIONAL(TARGET_UBUNTU, test x"$with_distro" = xubuntu)
413 AM_CONDITIONAL(TARGET_DEBIAN_OR_UBUNTU, test x"$with_distro" = xdebian -o x"$with_distro" = xubuntu)
414 AM_CONDITIONAL(TARGET_ARCH, test x"$with_distro" = xarch)
415 AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo)
416 AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware)
417 AM_CONDITIONAL(TARGET_FRUGALWARE, test x"$with_distro" = xfrugalware)
418 AM_CONDITIONAL(TARGET_ALTLINUX, test x"$with_distro" = xaltlinux)
419 AM_CONDITIONAL(TARGET_MANDRIVA, test x"$with_distro" = xmandriva)
420 AM_CONDITIONAL(TARGET_MEEGO, test x"$with_distro" = xmeego)
422 AM_CONDITIONAL(HAVE_PLYMOUTH, test -n "$have_plymouth")
423 AM_CONDITIONAL(HAVE_SYSV_COMPAT, test "$SYSTEM_SYSV_COMPAT" = "yes")
425 AC_ARG_WITH([dbuspolicydir],
426 AS_HELP_STRING([--with-dbuspolicydir=DIR], [D-Bus policy directory]),
428 [with_dbuspolicydir=`pkg-config --variable=sysconfdir dbus-1`/dbus-1/system.d])
430 AC_ARG_WITH([dbussessionservicedir],
431 AS_HELP_STRING([--with-dbussessionservicedir=DIR], [D-Bus session service directory]),
433 [with_dbussessionservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`])
435 AC_ARG_WITH([dbussystemservicedir],
436 AS_HELP_STRING([--with-dbussystemservicedir=DIR], [D-Bus system service directory]),
438 [with_dbussystemservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../system-services])
440 AC_ARG_WITH([dbusinterfacedir],
441 AS_HELP_STRING([--with-dbusinterfacedir=DIR], [D-Bus interface directory]),
443 [with_dbusinterfacedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../interfaces])
445 AC_ARG_WITH([udevrulesdir],
446 AS_HELP_STRING([--with-udevrulesdir=DIR], [Diectory for udev rules]),
448 [with_udevrulesdir=`pkg-config --variable=udevdir udev`/rules.d])
450 AC_ARG_WITH([pamlibdir],
451 AS_HELP_STRING([--with-pamlibdir=DIR], [Diectory for PAM modules]),
453 [with_pamlibdir=/lib/`$CC -print-multi-os-directory`/security])
455 AC_ARG_WITH([rootdir],
456 AS_HELP_STRING([--with-rootdir=DIR], [Root directory for files necessary for boot]),
458 [with_rootdir=${ac_default_prefix}])
460 AC_SUBST([dbuspolicydir], [$with_dbuspolicydir])
461 AC_SUBST([dbussessionservicedir], [$with_dbussessionservicedir])
462 AC_SUBST([dbussystemservicedir], [$with_dbussystemservicedir])
463 AC_SUBST([dbusinterfacedir], [$with_dbusinterfacedir])
464 AC_SUBST([udevrulesdir], [$with_udevrulesdir])
465 AC_SUBST([pamlibdir], [$with_pamlibdir])
466 AC_SUBST([rootdir], [$with_rootdir])
468 AC_CONFIG_FILES([Makefile])
472 $PACKAGE_NAME $VERSION
474 Distribution: ${with_distro}
475 SysV compatibility: ${SYSTEM_SYSV_COMPAT}
476 SysV init scripts: ${SYSTEM_SYSVINIT_PATH}
477 SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH}
479 libcryptsetup: ${have_libcryptsetup}
480 tcpwrap: ${have_tcpwrap}
483 SELinux: ${have_selinux}
485 root dir: ${with_rootdir}
486 udev rules dir: ${with_udevrulesdir}
487 pam modules dir: ${with_pamlibdir}
488 dbus policy dir: ${with_dbuspolicydir}
489 dbus session dir: ${with_dbussessionservicedir}
490 dbus system dir: ${with_dbussystemservicedir}
491 dbus interfaces dir: ${with_dbusinterfacedir}