]> git.ipfire.org Git - thirdparty/systemd.git/blame - configure.ac
build-sys: rename --with-distro=none to --with-distro=other
[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
20AC_INIT([systemd],[0],[mzflfgrzq (at) 0pointer (dot) net])
21AC_CONFIG_SRCDIR([main.c])
22AC_CONFIG_MACRO_DIR([m4])
23AC_CONFIG_HEADERS([config.h])
24
25AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules tar-pax])
26
27AC_SUBST(PACKAGE_URL, [http://git.0pointer.de/?p=systemd.git])
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
40AC_PROG_CC
41AC_PROG_CC_C99
42AM_PROG_CC_C_O
43AC_PROG_GCC_TRADITIONAL
44AC_USE_SYSTEM_EXTENSIONS
45
d1ab0ca0
LP
46CC_CHECK_CFLAGS_APPEND([ \
47 -Wall \
48 -W \
49 -Wextra \
50 -pipe \
51 -Wno-long-long \
52 -Winline \
53 -Wvla \
54 -Wno-overlength-strings \
55 -Wundef \
56 -Wformat=2 \
57 -Wlogical-op \
58 -Wsign-compare \
59 -Wformat-security \
60 -Wmissing-include-dirs \
61 -Wformat-nonliteral \
62 -Wold-style-definition \
63 -Wpointer-arith \
64 -Winit-self \
65 -Wdeclaration-after-statement \
66 -Wfloat-equal \
67 -Wmissing-prototypes \
68 -Wstrict-prototypes \
69 -Wredundant-decls \
70 -Wmissing-declarations \
71 -Wmissing-noreturn \
72 -Wshadow \
73 -Wendif-labels \
74 -Wcast-align \
75 -Wstrict-aliasing=2 \
76 -Wwrite-strings \
77 -Wno-unused-parameter \
78 -ffast-math \
79 -Wp,-D_FORTIFY_SOURCE=2 \
80 -fno-common \
81 -fdiagnostics-show-option \
82 -Wno-missing-field-initializers])
47be870b
LP
83
84AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([*** POSIX RT library not found])])
85AC_SEARCH_LIBS([cap_init], [cap], [], [AC_MSG_ERROR([*** POSIX caps library not found])])
86AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers not found])])
87
b237ef2c 88# This makes sure pkg.m4 is available.
a9b5b032 89m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
d1ab0ca0 90
47be870b
LP
91PKG_CHECK_MODULES(UDEV, [ libudev ])
92AC_SUBST(UDEV_CFLAGS)
93AC_SUBST(UDEV_LIBS)
94
95PKG_CHECK_MODULES(DBUS, [ dbus-1 ])
96AC_SUBST(DBUS_CFLAGS)
97AC_SUBST(DBUS_LIBS)
98
99PKG_CHECK_MODULES(DBUSGLIB, [ dbus-glib-1 ])
100AC_SUBST(DBUSGLIB_CFLAGS)
101AC_SUBST(DBUSGLIB_LIBS)
102
a9b5b032
MT
103have_gtk=no
104AC_ARG_ENABLE(gtk, AS_HELP_STRING([--disable-gtk], [disable GTK tools]))
105if 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)
108 AC_SUBST(GTK_CFLAGS)
109 AC_SUBST(GTK_LIBS)
110 if test "x$have_gtk" = xno -a "x$enable_gtk" = xyes; then
111 AC_MSG_ERROR([*** gtk support requested but libraries not found])
112 fi
113fi
114AM_CONDITIONAL(HAVE_GTK, [test "$have_gtk" = "yes"])
115
116PKG_CHECK_MODULES( CGROUP, [ libcgroup >= 0.35 ], [], [
117 AC_CHECK_HEADER( [libcgroup.h], [], [AC_MSG_ERROR([*** libcgroup.h not found])], )
118 save_CPPFLAGS="$CPPFLAGS"
119 save_LIBS="$LIBS"
120 CGROUP_LIBS=${CGROUP_LIBS:--lcgroup}
121 LIBS="$LIBS $CGROUP_LIBS"
122 CPPFLAGS="$CPPFLAGS $CGROUP_CFLAGS"
123 AC_MSG_CHECKING([for libcgroup >= 0.35])
124 AC_LINK_IFELSE(
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])],
128 [${CGROUP_LIBS}])
129 CPPFLAGS="$save_CPPFLAGS"
130 LIBS="$save_LIBS"
131])
8e274523
LP
132AC_SUBST(CGROUP_CFLAGS)
133AC_SUBST(CGROUP_LIBS)
134
e12891f7 135AM_PROG_VALAC([0.8])
47be870b
LP
136AC_SUBST(VAPIDIR)
137
d1ab0ca0
LP
138AC_PATH_PROG([XSLTPROC], [xsltproc])
139AM_CONDITIONAL(HAVE_XSLTPROC, test x"$XSLTPROC" != x)
140
bf024b02 141AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO],[Specify the distribution to target: One of fedora, suse, debian, arch, gentoo or other]))
0571e011
LP
142if 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)])
145 else
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")
d7c114c0 149 AC_CHECK_FILE(/etc/arch-release,with_distro="arch")
f2b4af1c 150 AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
65c8976a 151 AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
0571e011
LP
152 fi
153 if test "z$with_distro" = "z"; then
154 with_distro=`uname -s`
155 fi
156fi
157with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
158
0571e011
LP
159case $with_distro in
160 fedora)
161 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
162 SYSTEM_SYSVRCND_PATH=/etc/rc.d
2c696a96
LP
163 special_dbus_service=messagebus.service
164 special_syslog_service=rsyslog.service
165 AC_DEFINE(TARGET_FEDORA, [], [Target is Fedora/RHEL])
0571e011
LP
166 ;;
167 suse)
168 SYSTEM_SYSVINIT_PATH=/etc/init.d
169 SYSTEM_SYSVRCND_PATH=/etc/init.d
2c696a96
LP
170 special_dbus_service=dbus.service
171 special_syslog_service=syslog.service
172 AC_DEFINE(TARGET_SUSE, [], [Target is OpenSUSE/SLES])
0571e011
LP
173 ;;
174 debian)
175 SYSTEM_SYSVINIT_PATH=/etc/init.d
176 SYSTEM_SYSVRCND_PATH=/etc
2c696a96 177 special_dbus_service=dbus.service
924b4d5b 178 special_syslog_service=rsyslog.service
2c696a96 179 AC_DEFINE(TARGET_DEBIAN, [], [Target is Debian/Ubuntu])
0571e011 180 ;;
d7c114c0
DR
181 arch)
182 SYSTEM_SYSVINIT_PATH=/etc/rc.d
183 SYSTEM_SYSVRCND_PATH=/etc
184 special_dbus_service=dbus.service
185 special_syslog_service=syslog-ng.service
186 AC_DEFINE(TARGET_ARCH, [], [Target is ArchLinux])
187 ;;
f2b4af1c
FH
188 gentoo)
189 SYSTEM_SYSVINIT_PATH=/etc/init.d
190 SYSTEM_SYSVRCND_PATH=/etc
191 special_dbus_service=dbus.service
192 special_syslog_service=syslog-ng.service
193 AC_DEFINE(TARGET_GENTOO, [], [Target is Gentoo])
194 ;;
65c8976a
MS
195 slackware)
196 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
197 SYSTEM_SYSVRCND_PATH=/etc/rc.d
198 special_dbus_service=messagebus.service
199 special_syslog_service=syslog.service
200 AC_DEFINE(TARGET_SLACKWARE, [], [Target is Slackware])
201 ;;
bf024b02 202 other)
2c696a96
LP
203 SYSTEM_SYSVINIT_PATH=/fix/the/configure/script
204 SYSTEM_SYSVRCND_PATH=/fix/the/configure/script
205 special_dbus_service=fix-the-configure-script.service
206 special_syslog_service=fix-the-configure-script.service
0571e011
LP
207 ;;
208 *)
bf024b02 209 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
210 ;;
211esac
212
0571e011 213AC_SUBST(SYSTEM_SYSVINIT_PATH)
d64b723a 214AC_SUBST(SYSTEM_SYSVRCND_PATH)
0571e011
LP
215
216AM_CONDITIONAL(TARGET_FEDORA, test x"$with_distro" = xfedora)
217AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse)
218AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian)
d7c114c0 219AM_CONDITIONAL(TARGET_ARCH, test x"$with_distro" = xarch)
f2b4af1c 220AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo)
65c8976a 221AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware)
0571e011 222
2c696a96
LP
223AC_DEFINE_UNQUOTED(SPECIAL_DBUS_SERVICE, ["$special_dbus_service"], [D-Bus service name])
224AC_DEFINE_UNQUOTED(SPECIAL_SYSLOG_SERVICE, ["$special_syslog_service"], [syslog service name])
225
d1ab0ca0
LP
226AC_ARG_WITH([udevrulesdir],
227 AS_HELP_STRING([--with-udevrulesdir=DIR], [Diectory for udev rules]),
228 [],
229 [with_udevrulesdir=/lib/udev/rules.d])
230AC_SUBST([udevrulesdir], [$with_udevrulesdir])
231
232
47be870b 233AC_OUTPUT([Makefile])
0571e011
LP
234
235echo "
236 $PACKAGE_NAME $VERSION
237
2c696a96 238 Distribution: ${with_distro}
0571e011
LP
239 SysV init scripts: ${SYSTEM_SYSVINIT_PATH}
240 SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH}
2c696a96
LP
241 Syslog service: ${special_syslog_service}
242 D-Bus service: ${special_dbus_service}
a9b5b032 243 Gtk: ${have_gtk}
d1ab0ca0 244 udev rules dir: ${with_udevrulesdir}
0571e011 245"