]> git.ipfire.org Git - thirdparty/systemd.git/blame - configure.ac
build-sys: don't fail if we cannot create /cgroup/debug
[thirdparty/systemd.git] / configure.ac
CommitLineData
47be870b
LP
1# This file is part of systemd.
2#
3# Copyright 2010 Lennart Poettering
4#
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.
9#
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.
14#
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/>.
17
18AC_PREREQ(2.63)
19
1b00a255 20AC_INIT([systemd],[0],[systemd-devel@lists.freedesktop.org])
e99e38bb 21AC_CONFIG_SRCDIR([src/main.c])
47be870b
LP
22AC_CONFIG_MACRO_DIR([m4])
23AC_CONFIG_HEADERS([config.h])
24
e99e38bb 25AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules tar-pax subdir-objects])
47be870b 26
1b322bdb 27AC_SUBST(PACKAGE_URL, [http://www.freedesktop.org/wiki/Software/systemd])
47be870b
LP
28
29AC_CANONICAL_HOST
30
31AM_SILENT_RULES([yes])
32
33AC_CHECK_PROG([STOW], [stow], [yes], [no])
34
35AS_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}"
38])
39
e9da3678
LP
40AC_PROG_MKDIR_P
41AC_PROG_LN_S
42AC_PROG_SED
43
47be870b
LP
44AC_PROG_CC
45AC_PROG_CC_C99
46AM_PROG_CC_C_O
47AC_PROG_GCC_TRADITIONAL
48AC_USE_SYSTEM_EXTENSIONS
49
d1ab0ca0
LP
50CC_CHECK_CFLAGS_APPEND([ \
51 -Wall \
52 -W \
53 -Wextra \
54 -pipe \
55 -Wno-long-long \
56 -Winline \
57 -Wvla \
58 -Wno-overlength-strings \
59 -Wundef \
60 -Wformat=2 \
61 -Wlogical-op \
62 -Wsign-compare \
63 -Wformat-security \
64 -Wmissing-include-dirs \
65 -Wformat-nonliteral \
66 -Wold-style-definition \
67 -Wpointer-arith \
68 -Winit-self \
69 -Wdeclaration-after-statement \
70 -Wfloat-equal \
71 -Wmissing-prototypes \
72 -Wstrict-prototypes \
73 -Wredundant-decls \
74 -Wmissing-declarations \
75 -Wmissing-noreturn \
76 -Wshadow \
77 -Wendif-labels \
78 -Wcast-align \
79 -Wstrict-aliasing=2 \
80 -Wwrite-strings \
81 -Wno-unused-parameter \
82 -ffast-math \
83 -Wp,-D_FORTIFY_SOURCE=2 \
84 -fno-common \
85 -fdiagnostics-show-option \
86 -Wno-missing-field-initializers])
47be870b
LP
87
88AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([*** POSIX RT library not found])])
89AC_SEARCH_LIBS([cap_init], [cap], [], [AC_MSG_ERROR([*** POSIX caps library not found])])
90AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers not found])])
91
b237ef2c 92# This makes sure pkg.m4 is available.
a9b5b032 93m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
d1ab0ca0 94
47be870b
LP
95PKG_CHECK_MODULES(UDEV, [ libudev ])
96AC_SUBST(UDEV_CFLAGS)
97AC_SUBST(UDEV_LIBS)
98
99PKG_CHECK_MODULES(DBUS, [ dbus-1 ])
100AC_SUBST(DBUS_CFLAGS)
101AC_SUBST(DBUS_LIBS)
102
103PKG_CHECK_MODULES(DBUSGLIB, [ dbus-glib-1 ])
104AC_SUBST(DBUSGLIB_CFLAGS)
105AC_SUBST(DBUSGLIB_LIBS)
106
a9b5b032
MT
107have_gtk=no
108AC_ARG_ENABLE(gtk, AS_HELP_STRING([--disable-gtk], [disable GTK tools]))
109if 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)
112 AC_SUBST(GTK_CFLAGS)
113 AC_SUBST(GTK_LIBS)
114 if test "x$have_gtk" = xno -a "x$enable_gtk" = xyes; then
115 AC_MSG_ERROR([*** gtk support requested but libraries not found])
116 fi
117fi
118AM_CONDITIONAL(HAVE_GTK, [test "$have_gtk" = "yes"])
119
120PKG_CHECK_MODULES( CGROUP, [ libcgroup >= 0.35 ], [], [
121 AC_CHECK_HEADER( [libcgroup.h], [], [AC_MSG_ERROR([*** libcgroup.h not found])], )
122 save_CPPFLAGS="$CPPFLAGS"
123 save_LIBS="$LIBS"
124 CGROUP_LIBS=${CGROUP_LIBS:--lcgroup}
125 LIBS="$LIBS $CGROUP_LIBS"
126 CPPFLAGS="$CPPFLAGS $CGROUP_CFLAGS"
127 AC_MSG_CHECKING([for libcgroup >= 0.35])
128 AC_LINK_IFELSE(
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])],
132 [${CGROUP_LIBS}])
133 CPPFLAGS="$save_CPPFLAGS"
134 LIBS="$save_LIBS"
135])
8e274523
LP
136AC_SUBST(CGROUP_CFLAGS)
137AC_SUBST(CGROUP_LIBS)
138
e12891f7 139AM_PROG_VALAC([0.8])
47be870b
LP
140AC_SUBST(VAPIDIR)
141
d1ab0ca0
LP
142AC_PATH_PROG([XSLTPROC], [xsltproc])
143AM_CONDITIONAL(HAVE_XSLTPROC, test x"$XSLTPROC" != x)
144
5e6afdd3
LP
145AC_PATH_PROG([M4], [m4])
146
9f2c5942 147AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO],[Specify the distribution to target: One of fedora, suse, debian, arch, gentoo, slackware or other]))
0571e011
LP
148if 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)])
151 else
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")
d7c114c0 155 AC_CHECK_FILE(/etc/arch-release,with_distro="arch")
f2b4af1c 156 AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
65c8976a 157 AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
0571e011
LP
158 fi
159 if test "z$with_distro" = "z"; then
160 with_distro=`uname -s`
161 fi
162fi
163with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
164
34eff652
LP
165# Default generic names
166SPECIAL_DBUS_SERVICE=dbus.service
167SPECIAL_SYSLOG_SERVICE=syslog.service
168
169# Location of the init scripts as mandated by LSB
170SYSTEM_SYSVINIT_PATH=/etc/init.d
171
12e84679
LP
172M4_DISTRO_FLAG=
173
0571e011
LP
174case $with_distro in
175 fedora)
176 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
177 SYSTEM_SYSVRCND_PATH=/etc/rc.d
34eff652
LP
178
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
187 # unit file.
188
a7b6f8e5
LP
189 SPECIAL_DBUS_SERVICE=messagebus.service
190 SPECIAL_SYSLOG_SERVICE=rsyslog.service
2c696a96 191 AC_DEFINE(TARGET_FEDORA, [], [Target is Fedora/RHEL])
12e84679 192 M4_DISTRO_FLAG=-DTARGET_FEDORA=1
0571e011
LP
193 ;;
194 suse)
0571e011 195 SYSTEM_SYSVRCND_PATH=/etc/init.d
2c696a96 196 AC_DEFINE(TARGET_SUSE, [], [Target is OpenSUSE/SLES])
12e84679 197 M4_DISTRO_FLAG=-DTARGET_SUSE=1
0571e011
LP
198 ;;
199 debian)
0571e011 200 SYSTEM_SYSVRCND_PATH=/etc
a7b6f8e5 201 SPECIAL_SYSLOG_SERVICE=rsyslog.service
2c696a96 202 AC_DEFINE(TARGET_DEBIAN, [], [Target is Debian/Ubuntu])
12e84679 203 M4_DISTRO_FLAG=-DTARGET_DEBIAN=1
0571e011 204 ;;
d7c114c0
DR
205 arch)
206 SYSTEM_SYSVINIT_PATH=/etc/rc.d
207 SYSTEM_SYSVRCND_PATH=/etc
a7b6f8e5 208 SPECIAL_SYSLOG_SERVICE=syslog-ng.service
d7c114c0 209 AC_DEFINE(TARGET_ARCH, [], [Target is ArchLinux])
12e84679 210 M4_DISTRO_FLAG=-DTARGET_ARCH=1
d7c114c0 211 ;;
f2b4af1c 212 gentoo)
f2b4af1c 213 SYSTEM_SYSVRCND_PATH=/etc
a7b6f8e5 214 SPECIAL_SYSLOG_SERVICE=syslog-ng.service
f2b4af1c 215 AC_DEFINE(TARGET_GENTOO, [], [Target is Gentoo])
12e84679 216 M4_DISTRO_FLAG=-DTARGET_GENTOO=1
f2b4af1c 217 ;;
65c8976a
MS
218 slackware)
219 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
220 SYSTEM_SYSVRCND_PATH=/etc/rc.d
a7b6f8e5 221 SPECIAL_DBUS_SERVICE=messagebus.service
65c8976a 222 AC_DEFINE(TARGET_SLACKWARE, [], [Target is Slackware])
12e84679 223 M4_DISTRO_FLAG=-DTARGET_SLACKWARE=1
65c8976a 224 ;;
bf024b02 225 other)
136337ff 226 AS_IF([test "x$with_sysvinit_path" = "x"],
b6c2bf61 227 [AC_MSG_ERROR([With --distro=other, you must pass --with-sysvinit-path= to configure])])
136337ff 228 AS_IF([test "x$with_sysvrcd_path" = "x"],
b6c2bf61 229 [AC_MSG_ERROR([With --distro=other, you must pass --with-sysvrcd-path= to configure])])
136337ff 230 AS_IF([test "x$with_dbus_service" = "x"],
b6c2bf61 231 [AC_MSG_ERROR([With --distro=other, you must pass --with-dbus-service= to configure])])
136337ff 232 AS_IF([test "x$with_syslog_service" = "x"],
b6c2bf61 233 [AC_MSG_ERROR([With --distro=other, you must pass --with-syslog-service= to configure])])
0571e011
LP
234 ;;
235 *)
bf024b02 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])
0571e011
LP
237 ;;
238esac
239
136337ff
TFH
240AC_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"],
244 [])
245
246AC_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"],
250 [])
251
252AC_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@:>@])],
a7b6f8e5 255 [SPECIAL_DBUS_SERVICE="$withval"],
136337ff
TFH
256 [])
257
258AC_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@:>@])],
a7b6f8e5 261 [SPECIAL_SYSLOG_SERVICE="$withval"],
136337ff
TFH
262 [])
263
0571e011 264AC_SUBST(SYSTEM_SYSVINIT_PATH)
d64b723a 265AC_SUBST(SYSTEM_SYSVRCND_PATH)
a7b6f8e5
LP
266AC_SUBST(SPECIAL_DBUS_SERVICE)
267AC_SUBST(SPECIAL_SYSLOG_SERVICE)
12e84679 268AC_SUBST(M4_DISTRO_FLAG)
0571e011
LP
269
270AM_CONDITIONAL(TARGET_FEDORA, test x"$with_distro" = xfedora)
271AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse)
272AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian)
d7c114c0 273AM_CONDITIONAL(TARGET_ARCH, test x"$with_distro" = xarch)
f2b4af1c 274AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo)
65c8976a 275AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware)
0571e011 276
a7b6f8e5
LP
277AC_DEFINE_UNQUOTED(SPECIAL_DBUS_SERVICE, ["$SPECIAL_DBUS_SERVICE"], [D-Bus service name])
278AC_DEFINE_UNQUOTED(SPECIAL_SYSLOG_SERVICE, ["$SPECIAL_SYSLOG_SERVICE"], [Syslog service name])
2c696a96 279
d1ab0ca0
LP
280AC_ARG_WITH([udevrulesdir],
281 AS_HELP_STRING([--with-udevrulesdir=DIR], [Diectory for udev rules]),
282 [],
283 [with_udevrulesdir=/lib/udev/rules.d])
284AC_SUBST([udevrulesdir], [$with_udevrulesdir])
285
47be870b 286AC_OUTPUT([Makefile])
0571e011
LP
287
288echo "
289 $PACKAGE_NAME $VERSION
290
2c696a96 291 Distribution: ${with_distro}
0571e011
LP
292 SysV init scripts: ${SYSTEM_SYSVINIT_PATH}
293 SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH}
a7b6f8e5
LP
294 Syslog service: ${SPECIAL_SYSLOG_SERVICE}
295 D-Bus service: ${SPECIAL_DBUS_SERVICE}
a9b5b032 296 Gtk: ${have_gtk}
d1ab0ca0 297 udev rules dir: ${with_udevrulesdir}
0571e011 298"