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],[0],[mzflfgrzq (at) 0pointer (dot) net])
21 AC_CONFIG_SRCDIR([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])
27 AC_SUBST(PACKAGE_URL, [http://git.0pointer.de/?p=systemd.git])
31 AM_SILENT_RULES([yes])
33 AC_CHECK_PROG([STOW], [stow], [yes], [no])
35 AS_IF([test "x$STOW" = "xyes" && test -d /usr/local/stow], [
36 AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***])
37 ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}"
43 AC_PROG_GCC_TRADITIONAL
44 AC_USE_SYSTEM_EXTENSIONS
46 CC_CHECK_CFLAGS_APPEND([ \
54 -Wno-overlength-strings \
60 -Wmissing-include-dirs \
62 -Wold-style-definition \
65 -Wdeclaration-after-statement \
67 -Wmissing-prototypes \
70 -Wmissing-declarations \
77 -Wno-unused-parameter \
79 -Wp,-D_FORTIFY_SOURCE=2 \
81 -fdiagnostics-show-option \
82 -Wno-missing-field-initializers])
84 AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([*** POSIX RT library not found])])
85 AC_SEARCH_LIBS([cap_init], [cap], [], [AC_MSG_ERROR([*** POSIX caps library not found])])
86 AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers not found])])
88 # This makes sure pkg.m4 is available.
89 m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
91 PKG_CHECK_MODULES(UDEV, [ libudev ])
95 PKG_CHECK_MODULES(DBUS, [ dbus-1 ])
99 PKG_CHECK_MODULES(DBUSGLIB, [ dbus-glib-1 ])
100 AC_SUBST(DBUSGLIB_CFLAGS)
101 AC_SUBST(DBUSGLIB_LIBS)
104 AC_ARG_ENABLE(gtk, AS_HELP_STRING([--disable-gtk], [disable GTK tools]))
105 if test "x$enable_gtk" != "xno"; then
106 PKG_CHECK_MODULES(GTK, [ gtk+-2.0 ],
107 [AC_DEFINE(HAVE_GTK, 1, [Define if GTK is available]) have_gtk=yes], have_gtk=no)
110 if test "x$have_gtk" = xno -a "x$enable_gtk" = xyes; then
111 AC_MSG_ERROR([*** gtk support requested but libraries not found])
114 AM_CONDITIONAL(HAVE_GTK, [test "$have_gtk" = "yes"])
116 PKG_CHECK_MODULES( CGROUP, [ libcgroup >= 0.35 ], [], [
117 AC_CHECK_HEADER( [libcgroup.h], [], [AC_MSG_ERROR([*** libcgroup.h not found])], )
118 save_CPPFLAGS="$CPPFLAGS"
120 CGROUP_LIBS=${CGROUP_LIBS:--lcgroup}
121 LIBS="$LIBS $CGROUP_LIBS"
122 CPPFLAGS="$CPPFLAGS $CGROUP_CFLAGS"
123 AC_MSG_CHECKING([for libcgroup >= 0.35])
125 [AC_LANG_PROGRAM([[#include <libcgroup.h>]], [[ CGFLAG_DELETE_RECURSIVE; cgroup_init(); ]])],
126 [AC_MSG_RESULT([yes])],
127 [AC_MSG_RESULT([no]); AC_MSG_ERROR([*** systemd needs libcgroup 0.35 or newer])],
129 CPPFLAGS="$save_CPPFLAGS"
132 AC_SUBST(CGROUP_CFLAGS)
133 AC_SUBST(CGROUP_LIBS)
138 AC_PATH_PROG([XSLTPROC], [xsltproc])
139 AM_CONDITIONAL(HAVE_XSLTPROC, test x"$XSLTPROC" != x)
141 AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO],[Specify the distribution to target: One of fedora, suse, debian, arch, gentoo, or none]))
142 if test "z$with_distro" = "z"; then
143 if test "$cross_compiling" = yes; then
144 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)])
146 AC_CHECK_FILE(/etc/redhat-release,with_distro="fedora")
147 AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
148 AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
149 AC_CHECK_FILE(/etc/arch-release,with_distro="arch")
150 AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
152 if test "z$with_distro" = "z"; then
153 with_distro=`uname -s`
156 with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
160 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
161 SYSTEM_SYSVRCND_PATH=/etc/rc.d
162 special_dbus_service=messagebus.service
163 special_syslog_service=rsyslog.service
164 AC_DEFINE(TARGET_FEDORA, [], [Target is Fedora/RHEL])
167 SYSTEM_SYSVINIT_PATH=/etc/init.d
168 SYSTEM_SYSVRCND_PATH=/etc/init.d
169 special_dbus_service=dbus.service
170 special_syslog_service=syslog.service
171 AC_DEFINE(TARGET_SUSE, [], [Target is OpenSUSE/SLES])
174 SYSTEM_SYSVINIT_PATH=/etc/init.d
175 SYSTEM_SYSVRCND_PATH=/etc
176 special_dbus_service=dbus.service
177 special_syslog_service=rsyslog.service
178 AC_DEFINE(TARGET_DEBIAN, [], [Target is Debian/Ubuntu])
181 SYSTEM_SYSVINIT_PATH=/etc/rc.d
182 SYSTEM_SYSVRCND_PATH=/etc
183 special_dbus_service=dbus.service
184 special_syslog_service=syslog-ng.service
185 AC_DEFINE(TARGET_ARCH, [], [Target is ArchLinux])
188 SYSTEM_SYSVINIT_PATH=/etc/init.d
189 SYSTEM_SYSVRCND_PATH=/etc
190 special_dbus_service=dbus.service
191 special_syslog_service=syslog-ng.service
192 AC_DEFINE(TARGET_GENTOO, [], [Target is Gentoo])
195 SYSTEM_SYSVINIT_PATH=/fix/the/configure/script
196 SYSTEM_SYSVRCND_PATH=/fix/the/configure/script
197 special_dbus_service=fix-the-configure-script.service
198 special_syslog_service=fix-the-configure-script.service
201 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=none to skip this check])
205 AC_SUBST(SYSTEM_SYSVINIT_PATH)
206 AC_SUBST(SYSTEM_SYSVRCND_PATH)
208 AM_CONDITIONAL(TARGET_FEDORA, test x"$with_distro" = xfedora)
209 AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse)
210 AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian)
211 AM_CONDITIONAL(TARGET_ARCH, test x"$with_distro" = xarch)
212 AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo)
214 AC_DEFINE_UNQUOTED(SPECIAL_DBUS_SERVICE, ["$special_dbus_service"], [D-Bus service name])
215 AC_DEFINE_UNQUOTED(SPECIAL_SYSLOG_SERVICE, ["$special_syslog_service"], [syslog service name])
217 AC_ARG_WITH([udevrulesdir],
218 AS_HELP_STRING([--with-udevrulesdir=DIR], [Diectory for udev rules]),
220 [with_udevrulesdir=/lib/udev/rules.d])
221 AC_SUBST([udevrulesdir], [$with_udevrulesdir])
224 AC_OUTPUT([Makefile])
227 $PACKAGE_NAME $VERSION
229 Distribution: ${with_distro}
230 SysV init scripts: ${SYSTEM_SYSVINIT_PATH}
231 SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH}
232 Syslog service: ${special_syslog_service}
233 D-Bus service: ${special_dbus_service}
235 udev rules dir: ${with_udevrulesdir}