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],[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])
27 AC_SUBST(PACKAGE_URL, [http://www.freedesktop.org/wiki/Software/systemd])
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}"
47 AC_PROG_GCC_TRADITIONAL
48 AC_USE_SYSTEM_EXTENSIONS
50 CC_CHECK_CFLAGS_APPEND([ \
58 -Wno-overlength-strings \
64 -Wmissing-include-dirs \
66 -Wold-style-definition \
69 -Wdeclaration-after-statement \
71 -Wmissing-prototypes \
74 -Wmissing-declarations \
81 -Wno-unused-parameter \
83 -Wp,-D_FORTIFY_SOURCE=2 \
85 -fdiagnostics-show-option \
86 -Wno-missing-field-initializers])
88 AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([*** POSIX RT library not found])])
89 AC_SEARCH_LIBS([cap_init], [cap], [], [AC_MSG_ERROR([*** POSIX caps library not found])])
90 AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers not found])])
92 # This makes sure pkg.m4 is available.
93 m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
95 PKG_CHECK_MODULES(UDEV, [ libudev ])
99 PKG_CHECK_MODULES(DBUS, [ dbus-1 ])
100 AC_SUBST(DBUS_CFLAGS)
103 PKG_CHECK_MODULES(DBUSGLIB, [ dbus-glib-1 ])
104 AC_SUBST(DBUSGLIB_CFLAGS)
105 AC_SUBST(DBUSGLIB_LIBS)
108 AC_ARG_ENABLE(gtk, AS_HELP_STRING([--disable-gtk], [disable GTK tools]))
109 if test "x$enable_gtk" != "xno"; then
110 PKG_CHECK_MODULES(GTK, [ gtk+-2.0 ],
111 [AC_DEFINE(HAVE_GTK, 1, [Define if GTK is available]) have_gtk=yes], have_gtk=no)
114 if test "x$have_gtk" = xno -a "x$enable_gtk" = xyes; then
115 AC_MSG_ERROR([*** gtk support requested but libraries not found])
118 AM_CONDITIONAL(HAVE_GTK, [test "$have_gtk" = "yes"])
120 PKG_CHECK_MODULES( CGROUP, [ libcgroup >= 0.35 ], [], [
121 AC_CHECK_HEADER( [libcgroup.h], [], [AC_MSG_ERROR([*** libcgroup.h not found])], )
122 save_CPPFLAGS="$CPPFLAGS"
124 CGROUP_LIBS=${CGROUP_LIBS:--lcgroup}
125 LIBS="$LIBS $CGROUP_LIBS"
126 CPPFLAGS="$CPPFLAGS $CGROUP_CFLAGS"
127 AC_MSG_CHECKING([for libcgroup >= 0.35])
129 [AC_LANG_PROGRAM([[#include <libcgroup.h>]], [[ CGFLAG_DELETE_RECURSIVE; cgroup_init(); ]])],
130 [AC_MSG_RESULT([yes])],
131 [AC_MSG_RESULT([no]); AC_MSG_ERROR([*** systemd needs libcgroup 0.35 or newer])],
133 CPPFLAGS="$save_CPPFLAGS"
136 AC_SUBST(CGROUP_CFLAGS)
137 AC_SUBST(CGROUP_LIBS)
142 AC_PATH_PROG([XSLTPROC], [xsltproc])
143 AM_CONDITIONAL(HAVE_XSLTPROC, test x"$XSLTPROC" != x)
145 AC_PATH_PROG([M4], [m4])
147 AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO],[Specify the distribution to target: One of fedora, suse, debian, arch, gentoo or other]))
148 if test "z$with_distro" = "z"; then
149 if test "$cross_compiling" = yes; then
150 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)])
152 AC_CHECK_FILE(/etc/redhat-release,with_distro="fedora")
153 AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
154 AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
155 AC_CHECK_FILE(/etc/arch-release,with_distro="arch")
156 AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
157 AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
159 if test "z$with_distro" = "z"; then
160 with_distro=`uname -s`
163 with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
165 # Default generic names
166 SPECIAL_DBUS_SERVICE=dbus.service
167 SPECIAL_SYSLOG_SERVICE=syslog.service
169 # Location of the init scripts as mandated by LSB
170 SYSTEM_SYSVINIT_PATH=/etc/init.d
176 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
177 SYSTEM_SYSVRCND_PATH=/etc/rc.d
179 # A little background why we define these special unit
180 # names here in configure.ac: SysV services currently
181 # cannot have aliases. As long as syslog is started
182 # via a SysV init script we hence define these names
183 # to the actual SysV name here. Later on when SysV
184 # init scripts are not used anymore it is advisable to
185 # use the generic names instead and use symlinks in
186 # the unit directories to point to the right native
189 SPECIAL_DBUS_SERVICE=messagebus.service
190 SPECIAL_SYSLOG_SERVICE=rsyslog.service
191 AC_DEFINE(TARGET_FEDORA, [], [Target is Fedora/RHEL])
192 M4_DISTRO_FLAG=-DTARGET_FEDORA=1
195 SYSTEM_SYSVRCND_PATH=/etc/init.d
196 AC_DEFINE(TARGET_SUSE, [], [Target is OpenSUSE/SLES])
197 M4_DISTRO_FLAG=-DTARGET_SUSE=1
200 SYSTEM_SYSVRCND_PATH=/etc
201 SPECIAL_SYSLOG_SERVICE=rsyslog.service
202 AC_DEFINE(TARGET_DEBIAN, [], [Target is Debian/Ubuntu])
203 M4_DISTRO_FLAG=-DTARGET_DEBIAN=1
206 SYSTEM_SYSVINIT_PATH=/etc/rc.d
207 SYSTEM_SYSVRCND_PATH=/etc
208 SPECIAL_SYSLOG_SERVICE=syslog-ng.service
209 AC_DEFINE(TARGET_ARCH, [], [Target is ArchLinux])
210 M4_DISTRO_FLAG=-DTARGET_ARCH=1
213 SYSTEM_SYSVRCND_PATH=/etc
214 SPECIAL_SYSLOG_SERVICE=syslog-ng.service
215 AC_DEFINE(TARGET_GENTOO, [], [Target is Gentoo])
216 M4_DISTRO_FLAG=-DTARGET_GENTOO=1
219 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
220 SYSTEM_SYSVRCND_PATH=/etc/rc.d
221 SPECIAL_DBUS_SERVICE=messagebus.service
222 AC_DEFINE(TARGET_SLACKWARE, [], [Target is Slackware])
223 M4_DISTRO_FLAG=-DTARGET_SLACKWARE=1
226 AS_IF([test "x$with_sysvinit_path" = "x"],
227 [AC_MSG_ERROR([With --distro=other, you must pass --with-sysvinit-path= to configure])])
228 AS_IF([test "x$with_sysvrcd_path" = "x"],
229 [AC_MSG_ERROR([With --distro=other, you must pass --with-sysvrcd-path= to configure])])
230 AS_IF([test "x$with_dbus_service" = "x"],
231 [AC_MSG_ERROR([With --distro=other, you must pass --with-dbus-service= to configure])])
232 AS_IF([test "x$with_syslog_service" = "x"],
233 [AC_MSG_ERROR([With --distro=other, you must pass --with-syslog-service= to configure])])
236 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])
240 AC_ARG_WITH([sysvinit-path],
241 [AS_HELP_STRING([--with-sysvinit-path=PATH],
242 [Specify the path to where the SysV init scripts are located @<:@default=based on distro@:>@])],
243 [SYSTEM_SYSVINIT_PATH="$withval"],
246 AC_ARG_WITH([sysvrcd-path],
247 [AS_HELP_STRING([--with-sysvrcd-path=PATH],
248 [Specify the path to the base directory for the SysV rcN.d directories @<:@default=based on distro@:>@])],
249 [SYSTEM_SYSVRCND_PATH="$withval"],
252 AC_ARG_WITH([dbus-service],
253 [AS_HELP_STRING([--with-dbus-service=PATH],
254 [Specify the name of the special DBus service @<:@default=based on distro@:>@])],
255 [SPECIAL_DBUS_SERVICE="$withval"],
258 AC_ARG_WITH([syslog-service],
259 [AS_HELP_STRING([--with-syslog-service=PATH],
260 [Specify the name of the special syslog service @<:@default=based on distro@:>@])],
261 [SPECIAL_SYSLOG_SERVICE="$withval"],
264 AC_SUBST(SYSTEM_SYSVINIT_PATH)
265 AC_SUBST(SYSTEM_SYSVRCND_PATH)
266 AC_SUBST(SPECIAL_DBUS_SERVICE)
267 AC_SUBST(SPECIAL_SYSLOG_SERVICE)
268 AC_SUBST(M4_DISTRO_FLAG)
270 AM_CONDITIONAL(TARGET_FEDORA, test x"$with_distro" = xfedora)
271 AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse)
272 AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian)
273 AM_CONDITIONAL(TARGET_ARCH, test x"$with_distro" = xarch)
274 AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo)
275 AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware)
277 AC_DEFINE_UNQUOTED(SPECIAL_DBUS_SERVICE, ["$SPECIAL_DBUS_SERVICE"], [D-Bus service name])
278 AC_DEFINE_UNQUOTED(SPECIAL_SYSLOG_SERVICE, ["$SPECIAL_SYSLOG_SERVICE"], [Syslog service name])
280 AC_ARG_WITH([udevrulesdir],
281 AS_HELP_STRING([--with-udevrulesdir=DIR], [Diectory for udev rules]),
283 [with_udevrulesdir=/lib/udev/rules.d])
284 AC_SUBST([udevrulesdir], [$with_udevrulesdir])
286 AC_OUTPUT([Makefile])
289 $PACKAGE_NAME $VERSION
291 Distribution: ${with_distro}
292 SysV init scripts: ${SYSTEM_SYSVINIT_PATH}
293 SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH}
294 Syslog service: ${SPECIAL_SYSLOG_SERVICE}
295 D-Bus service: ${SPECIAL_DBUS_SERVICE}
297 udev rules dir: ${with_udevrulesdir}