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])
25 AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules tar-pax subdir-objects dist-bzip2])
27 AC_SUBST(PACKAGE_URL, [http://www.freedesktop.org/wiki/Software/systemd])
30 AC_DEFINE_UNQUOTED([CANONICAL_HOST], "$host", [Canonical host string.])
31 AS_IF([test "x$host_cpu" = "xmips" || test "x$host_cpu" = "xmipsel" ||
32 test "x$host_cpu" = "xmips64" || test "x$host_cpu" = "xmips64el"],
33 [AC_DEFINE(ARCH_MIPS, [], [Whether on mips arch])])
35 AM_SILENT_RULES([yes])
37 AC_CHECK_PROG([STOW], [stow], [yes], [no])
39 AS_IF([test "x$STOW" = "xyes" && test -d /usr/local/stow], [
40 AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***])
41 ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}"
51 AC_PROG_GCC_TRADITIONAL
52 AC_USE_SYSTEM_EXTENSIONS
54 AC_CHECK_TOOL(OBJCOPY, objcopy)
55 AC_CHECK_TOOL(STRINGS, strings)
57 CC_CHECK_CFLAGS_APPEND([ \
69 -Wmissing-include-dirs \
71 -Wold-style-definition \
74 -Wdeclaration-after-statement \
76 -Wmissing-prototypes \
79 -Wmissing-declarations \
87 -Wno-overlength-strings \
88 -Wno-unused-parameter \
89 -Wno-missing-field-initializers \
91 -Wp,-D_FORTIFY_SOURCE=2 \
94 -fdiagnostics-show-option \
95 -fno-strict-aliasing \
105 AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([*** POSIX RT library not found])])
106 AC_SEARCH_LIBS([dlsym], [dl], [], [AC_MSG_ERROR([*** Dynamic linking loader library not found])])
107 AC_SEARCH_LIBS([cap_init], [cap], [], [AC_MSG_ERROR([*** POSIX caps library not found])])
108 AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers not found])])
110 # This makes sure pkg.m4 is available.
111 m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
113 PKG_CHECK_MODULES(UDEV, [ libudev >= 160 ])
114 AC_SUBST(UDEV_CFLAGS)
117 PKG_CHECK_MODULES(DBUS, [ dbus-1 >= 1.3.2 ])
118 AC_SUBST(DBUS_CFLAGS)
122 AC_ARG_ENABLE(selinux, AS_HELP_STRING([--disable-selinux], [Disable optional SELINUX support]))
123 if test "x$enable_selinux" != "xno"; then
124 PKG_CHECK_MODULES(SELINUX, [ libselinux ],
125 [AC_DEFINE(HAVE_SELINUX, 1, [Define if SELinux is available]) have_selinux=yes], have_selinux=no)
126 AC_SUBST(SELINUX_CFLAGS)
127 AC_SUBST(SELINUX_LIBS)
128 if test "x$have_selinux" = xno -a "x$enable_selinux" = xyes; then
129 AC_MSG_ERROR([*** SELinux support requested but libraries not found])
132 AM_CONDITIONAL(HAVE_SELINUX, [test "$have_selinux" = "yes"])
134 AC_ARG_ENABLE([tcpwrap],
135 AS_HELP_STRING([--disable-tcpwrap],[Disable optional TCP wrappers support]),
136 [case "${enableval}" in
137 yes) have_tcpwrap=yes ;;
138 no) have_tcpwrap=no ;;
139 *) AC_MSG_ERROR(bad value ${enableval} for --disable-tcpwrap) ;;
143 if test "x${have_tcpwrap}" != xno ; then
145 if test "x${LIBWRAP_LIBS}" = x ; then
146 if test "x$have_tcpwrap" = xyes ; then
147 AC_MSG_ERROR([*** TCP wrappers support not found.])
156 AC_SUBST(LIBWRAP_LIBS)
159 AS_HELP_STRING([--disable-pam],[Disable optional PAM support]),
160 [case "${enableval}" in
163 *) AC_MSG_ERROR(bad value ${enableval} for --disable-pam) ;;
167 if test "x${have_pam}" != xno ; then
169 [security/pam_modules.h security/pam_modutil.h security/pam_ext.h],
171 [if test "x$have_pam" = xyes ; then
172 AC_MSG_ERROR([*** PAM headers not found.])
179 [if test "x$have_pam" = xyes ; then
180 AC_MSG_ERROR([*** libpam not found.])
183 if test "x$have_pam" = xyes ; then
184 PAM_LIBS="-lpam -lpam_misc"
185 AC_DEFINE(HAVE_PAM, 1, [PAM available])
193 AM_CONDITIONAL([HAVE_PAM], [test "x$have_pam" != xno])
195 AC_ARG_ENABLE([audit],
196 AS_HELP_STRING([--disable-audit],[Disable optional AUDIT support]),
197 [case "${enableval}" in
198 yes) have_audit=yes ;;
200 *) AC_MSG_ERROR(bad value ${enableval} for --disable-audit) ;;
204 if test "x${have_audit}" != xno ; then
208 [if test "x$have_audit" = xyes ; then
209 AC_MSG_ERROR([*** AUDIT headers not found.])
216 [if test "x$have_audit" = xyes ; then
217 AC_MSG_ERROR([*** libaudit not found.])
220 if test "x$have_audit" = xyes ; then
222 AC_DEFINE(HAVE_AUDIT, 1, [AUDIT available])
231 have_libcryptsetup=no
232 AC_ARG_ENABLE(libcryptsetup, AS_HELP_STRING([--disable-libcryptsetup], [disable libcryptsetup tools]))
233 if test "x$enable_libcryptsetup" != "xno"; then
234 PKG_CHECK_MODULES(LIBCRYPTSETUP, [ libcryptsetup ],
235 [AC_DEFINE(HAVE_LIBCRYPTSETUP, 1, [Define if libcryptsetup is available]) have_libcryptsetup=yes], have_libcryptsetup=no)
236 AC_SUBST(LIBCRYPTSETUP_CFLAGS)
237 AC_SUBST(LIBCRYPTSETUP_LIBS)
238 if test "x$have_libcryptsetup" = xno -a "x$enable_libcryptsetup" = xyes; then
239 AC_MSG_ERROR([*** libcryptsetup support requested but libraries not found])
242 AM_CONDITIONAL(HAVE_LIBCRYPTSETUP, [test "$have_libcryptsetup" = "yes"])
245 AC_ARG_ENABLE(gtk, AS_HELP_STRING([--disable-gtk], [disable GTK tools]))
246 if test "x$enable_gtk" != "xno"; then
247 PKG_CHECK_MODULES(GTK, [ gtk+-2.0 glib-2.0 > 2.26 gio-unix-2.0 ],
248 [AC_DEFINE(HAVE_GTK, 1, [Define if GTK is available]) have_gtk=yes], have_gtk=no)
251 if test "x$have_gtk" = xno -a "x$enable_gtk" = xyes; then
252 AC_MSG_ERROR([*** gtk support requested but libraries not found])
255 AM_CONDITIONAL(HAVE_GTK, [test "$have_gtk" = "yes"])
257 if test "$have_gtk" = "yes"; then
258 PKG_CHECK_MODULES(LIBNOTIFY, [ libnotify ])
259 PKG_CHECK_EXISTS([ libnotify >= 0.7.0 ], [ libnotify07=yes ])
261 AC_SUBST(LIBNOTIFY_CFLAGS)
262 AC_SUBST(LIBNOTIFY_LIBS)
264 AM_CONDITIONAL(LIBNOTIFY07, [ test "$libnotify07" = "yes" ])
266 AM_PROG_VALAC([0.10])
268 AM_CONDITIONAL(HAVE_VALAC, test x"$VALAC" != x)
270 AC_PATH_PROG([XSLTPROC], [xsltproc])
271 AM_CONDITIONAL(HAVE_XSLTPROC, test x"$XSLTPROC" != x)
273 AC_PATH_PROG([M4], [m4])
275 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]))
276 if test "z$with_distro" = "z"; then
277 if test "$cross_compiling" = yes; then
278 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)])
280 test -f "/etc/redhat-release" && with_distro="fedora"
281 test -f "/etc/SuSE-release" && with_distro="suse"
282 test -f "/etc/debian_version" && with_distro="debian"
283 test -f "/etc/arch-release" && with_distro="arch"
284 test -f "/etc/gentoo-release" && with_distro="gentoo"
285 test -f "/etc/slackware-version" && with_distro="slackware"
286 test -f "/etc/frugalware-release" && with_distro="frugalware"
287 test -f "/etc/altlinux-release" && with_distro="altlinux"
288 test -f "/etc/mandriva-release" && with_distro="mandriva"
289 test -f "/etc/meego-release" && with_distro="meego"
290 if test "x`lsb_release -is 2>/dev/null`" = "xUbuntu"; then
294 if test "z$with_distro" = "z"; then
295 with_distro=`uname -s`
298 with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
299 AC_DEFINE_UNQUOTED(DISTRIBUTION, ["${with_distro}"], [Target Distribution])
301 # Location of the init scripts as mandated by LSB
302 SYSTEM_SYSVINIT_PATH=/etc/init.d
303 SYSTEM_SYSVRCND_PATH=/etc/rc.d
309 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
310 AC_DEFINE(TARGET_FEDORA, [], [Target is Fedora/RHEL])
311 M4_DISTRO_FLAG=-DTARGET_FEDORA=1
315 SYSTEM_SYSVRCND_PATH=/etc/init.d
316 AC_DEFINE(TARGET_SUSE, [], [Target is openSUSE/SLE])
317 M4_DISTRO_FLAG=-DTARGET_SUSE=1
321 SYSTEM_SYSVRCND_PATH=/etc
322 AC_DEFINE(TARGET_DEBIAN, [], [Target is Debian])
323 M4_DISTRO_FLAG=-DTARGET_DEBIAN=1
326 SYSTEM_SYSVRCND_PATH=/etc
327 AC_DEFINE(TARGET_UBUNTU, [], [Target is Ubuntu])
328 M4_DISTRO_FLAG=-DTARGET_UBUNTU=1
331 SYSTEM_SYSVINIT_PATH=/etc/rc.d
332 SYSTEM_SYSVRCND_PATH=/etc
333 AC_DEFINE(TARGET_ARCH, [], [Target is ArchLinux])
334 M4_DISTRO_FLAG=-DTARGET_ARCH=1
337 SYSTEM_SYSVINIT_PATH=
338 SYSTEM_SYSVRCND_PATH=
339 AC_DEFINE(TARGET_GENTOO, [], [Target is Gentoo])
340 M4_DISTRO_FLAG=-DTARGET_GENTOO=1
343 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
344 AC_DEFINE(TARGET_SLACKWARE, [], [Target is Slackware])
345 M4_DISTRO_FLAG=-DTARGET_SLACKWARE=1
348 SYSTEM_SYSVINIT_PATH=/etc/rc.d
349 AC_DEFINE(TARGET_FRUGALWARE, [], [Target is Frugalware])
350 M4_DISTRO_FLAG=-DTARGET_FRUGALWARE=1
353 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
354 AC_DEFINE(TARGET_ALTLINUX, [], [Target is ALTLinux])
355 M4_DISTRO_FLAG=-DTARGET_ALTLINUX=1
359 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
360 AC_DEFINE(TARGET_MANDRIVA, [], [Target is Mandriva])
361 M4_DISTRO_FLAG=-DTARGET_MANDRIVA=1
365 SYSTEM_SYSVINIT_PATH=
366 SYSTEM_SYSVRCND_PATH=
367 AC_DEFINE(TARGET_MEEGO, [], [Target is MeeGo])
368 M4_DISTRO_FLAG=-DTARGET_MEEGO=1
373 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])
377 AC_ARG_WITH([sysvinit-path],
378 [AS_HELP_STRING([--with-sysvinit-path=PATH],
379 [Specify the path to where the SysV init scripts are located @<:@default=based on distro@:>@])],
380 [SYSTEM_SYSVINIT_PATH="$withval"],
383 AC_ARG_WITH([sysvrcd-path],
384 [AS_HELP_STRING([--with-sysvrcd-path=PATH],
385 [Specify the path to the base directory for the SysV rcN.d directories @<:@default=based on distro@:>@])],
386 [SYSTEM_SYSVRCND_PATH="$withval"],
389 AC_SUBST(SYSTEM_SYSVINIT_PATH)
390 AC_SUBST(SYSTEM_SYSVRCND_PATH)
391 AC_SUBST(M4_DISTRO_FLAG)
393 if test "x${SYSTEM_SYSVINIT_PATH}" != "x" -a "x${SYSTEM_SYSVRCND_PATH}" != "x"; then
394 AC_DEFINE(HAVE_SYSV_COMPAT, [], [SysV init scripts and rcN.d links are supported.])
395 SYSTEM_SYSV_COMPAT="yes"
396 elif test "x${SYSTEM_SYSVINIT_PATH}" != "x" -o "x${SYSTEM_SYSVRCND_PATH}" != "x"; then
397 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.])
399 SYSTEM_SYSV_COMPAT="no"
402 AC_ARG_WITH([tty-gid],
403 [AS_HELP_STRING([--with-tty-gid=GID],
404 [Specify the numeric GID of the 'tty' group])],
405 [AC_DEFINE_UNQUOTED(TTY_GID, [$withval], [GID of the 'tty' group])],
408 AM_CONDITIONAL(TARGET_FEDORA, test x"$with_distro" = xfedora)
409 AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse)
410 AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian)
411 AM_CONDITIONAL(TARGET_UBUNTU, test x"$with_distro" = xubuntu)
412 AM_CONDITIONAL(TARGET_DEBIAN_OR_UBUNTU, test x"$with_distro" = xdebian -o x"$with_distro" = xubuntu)
413 AM_CONDITIONAL(TARGET_ARCH, test x"$with_distro" = xarch)
414 AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo)
415 AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware)
416 AM_CONDITIONAL(TARGET_FRUGALWARE, test x"$with_distro" = xfrugalware)
417 AM_CONDITIONAL(TARGET_ALTLINUX, test x"$with_distro" = xaltlinux)
418 AM_CONDITIONAL(TARGET_MANDRIVA, test x"$with_distro" = xmandriva)
419 AM_CONDITIONAL(TARGET_MEEGO, test x"$with_distro" = xmeego)
421 AM_CONDITIONAL(HAVE_PLYMOUTH, test -n "$have_plymouth")
422 AM_CONDITIONAL(HAVE_SYSV_COMPAT, test "$SYSTEM_SYSV_COMPAT" = "yes")
424 AC_ARG_WITH([dbuspolicydir],
425 AS_HELP_STRING([--with-dbuspolicydir=DIR], [D-Bus policy directory]),
427 [with_dbuspolicydir=`pkg-config --variable=sysconfdir dbus-1`/dbus-1/system.d])
429 AC_ARG_WITH([dbussessionservicedir],
430 AS_HELP_STRING([--with-dbussessionservicedir=DIR], [D-Bus session service directory]),
432 [with_dbussessionservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`])
434 AC_ARG_WITH([dbussystemservicedir],
435 AS_HELP_STRING([--with-dbussystemservicedir=DIR], [D-Bus system service directory]),
437 [with_dbussystemservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../system-services])
439 AC_ARG_WITH([dbusinterfacedir],
440 AS_HELP_STRING([--with-dbusinterfacedir=DIR], [D-Bus interface directory]),
442 [with_dbusinterfacedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../interfaces])
444 AC_ARG_WITH([udevrulesdir],
445 AS_HELP_STRING([--with-udevrulesdir=DIR], [Diectory for udev rules]),
447 [with_udevrulesdir=`pkg-config --variable=udevdir udev`/rules.d])
449 AC_ARG_WITH([pamlibdir],
450 AS_HELP_STRING([--with-pamlibdir=DIR], [Diectory for PAM modules]),
452 [with_pamlibdir=/lib/`$CC -print-multi-os-directory`/security])
454 AC_ARG_WITH([rootdir],
455 AS_HELP_STRING([--with-rootdir=DIR], [Root directory for files necessary for boot]),
457 [with_rootdir=${ac_default_prefix}])
459 AC_SUBST([dbuspolicydir], [$with_dbuspolicydir])
460 AC_SUBST([dbussessionservicedir], [$with_dbussessionservicedir])
461 AC_SUBST([dbussystemservicedir], [$with_dbussystemservicedir])
462 AC_SUBST([dbusinterfacedir], [$with_dbusinterfacedir])
463 AC_SUBST([udevrulesdir], [$with_udevrulesdir])
464 AC_SUBST([pamlibdir], [$with_pamlibdir])
465 AC_SUBST([rootdir], [$with_rootdir])
467 AC_CONFIG_FILES([Makefile])
471 $PACKAGE_NAME $VERSION
473 Distribution: ${with_distro}
474 SysV compatibility: ${SYSTEM_SYSV_COMPAT}
475 SysV init scripts: ${SYSTEM_SYSVINIT_PATH}
476 SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH}
478 libcryptsetup: ${have_libcryptsetup}
479 tcpwrap: ${have_tcpwrap}
482 SELinux: ${have_selinux}
484 root dir: ${with_rootdir}
485 udev rules dir: ${with_udevrulesdir}
486 pam modules dir: ${with_pamlibdir}
487 dbus policy dir: ${with_dbuspolicydir}
488 dbus session dir: ${with_dbussessionservicedir}
489 dbus system dir: ${with_dbussystemservicedir}
490 dbus interfaces dir: ${with_dbusinterfacedir}