]>
Commit | Line | Data |
---|---|---|
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 | ||
18 | AC_PREREQ(2.63) | |
19 | ||
20 | AC_INIT([systemd],[0],[systemd-devel@lists.freedesktop.org]) | |
21 | AC_CONFIG_SRCDIR([main.c]) | |
22 | AC_CONFIG_MACRO_DIR([m4]) | |
23 | AC_CONFIG_HEADERS([config.h]) | |
24 | ||
25 | AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules tar-pax]) | |
26 | ||
27 | AC_SUBST(PACKAGE_URL, [http://www.freedesktop.org/wiki/Software/systemd]) | |
28 | ||
29 | AC_CANONICAL_HOST | |
30 | ||
31 | AM_SILENT_RULES([yes]) | |
32 | ||
33 | AC_CHECK_PROG([STOW], [stow], [yes], [no]) | |
34 | ||
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}" | |
38 | ]) | |
39 | ||
40 | AC_PROG_CC | |
41 | AC_PROG_CC_C99 | |
42 | AM_PROG_CC_C_O | |
43 | AC_PROG_GCC_TRADITIONAL | |
44 | AC_USE_SYSTEM_EXTENSIONS | |
45 | ||
46 | CC_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]) | |
83 | ||
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])]) | |
87 | ||
88 | # This makes sure pkg.m4 is available. | |
89 | m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config]) | |
90 | ||
91 | PKG_CHECK_MODULES(UDEV, [ libudev ]) | |
92 | AC_SUBST(UDEV_CFLAGS) | |
93 | AC_SUBST(UDEV_LIBS) | |
94 | ||
95 | PKG_CHECK_MODULES(DBUS, [ dbus-1 ]) | |
96 | AC_SUBST(DBUS_CFLAGS) | |
97 | AC_SUBST(DBUS_LIBS) | |
98 | ||
99 | PKG_CHECK_MODULES(DBUSGLIB, [ dbus-glib-1 ]) | |
100 | AC_SUBST(DBUSGLIB_CFLAGS) | |
101 | AC_SUBST(DBUSGLIB_LIBS) | |
102 | ||
103 | have_gtk=no | |
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) | |
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 | |
113 | fi | |
114 | AM_CONDITIONAL(HAVE_GTK, [test "$have_gtk" = "yes"]) | |
115 | ||
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" | |
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 | ]) | |
132 | AC_SUBST(CGROUP_CFLAGS) | |
133 | AC_SUBST(CGROUP_LIBS) | |
134 | ||
135 | AM_PROG_VALAC([0.8]) | |
136 | AC_SUBST(VAPIDIR) | |
137 | ||
138 | AC_PATH_PROG([XSLTPROC], [xsltproc]) | |
139 | AM_CONDITIONAL(HAVE_XSLTPROC, test x"$XSLTPROC" != x) | |
140 | ||
141 | AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO],[Specify the distribution to target: One of fedora, suse, debian, arch, gentoo or other])) | |
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)]) | |
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") | |
149 | AC_CHECK_FILE(/etc/arch-release,with_distro="arch") | |
150 | AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo") | |
151 | AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware") | |
152 | fi | |
153 | if test "z$with_distro" = "z"; then | |
154 | with_distro=`uname -s` | |
155 | fi | |
156 | fi | |
157 | with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' ` | |
158 | ||
159 | case $with_distro in | |
160 | fedora) | |
161 | SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d | |
162 | SYSTEM_SYSVRCND_PATH=/etc/rc.d | |
163 | special_dbus_service=messagebus.service | |
164 | special_syslog_service=rsyslog.service | |
165 | AC_DEFINE(TARGET_FEDORA, [], [Target is Fedora/RHEL]) | |
166 | ;; | |
167 | suse) | |
168 | SYSTEM_SYSVINIT_PATH=/etc/init.d | |
169 | SYSTEM_SYSVRCND_PATH=/etc/init.d | |
170 | special_dbus_service=dbus.service | |
171 | special_syslog_service=syslog.service | |
172 | AC_DEFINE(TARGET_SUSE, [], [Target is OpenSUSE/SLES]) | |
173 | ;; | |
174 | debian) | |
175 | SYSTEM_SYSVINIT_PATH=/etc/init.d | |
176 | SYSTEM_SYSVRCND_PATH=/etc | |
177 | special_dbus_service=dbus.service | |
178 | special_syslog_service=rsyslog.service | |
179 | AC_DEFINE(TARGET_DEBIAN, [], [Target is Debian/Ubuntu]) | |
180 | ;; | |
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 | ;; | |
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 | ;; | |
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 | ;; | |
202 | other) | |
203 | AS_IF([test "x$with_sysvinit_path" = "x"], | |
204 | [AC_MSG_ERROR([With --distro=none, you must pass --with-sysvinit-path to configure])]) | |
205 | AS_IF([test "x$with_sysvrcd_path" = "x"], | |
206 | [AC_MSG_ERROR([With --distro=none, you must pass --with-sysvrcd-path to configure])]) | |
207 | AS_IF([test "x$with_dbus_service" = "x"], | |
208 | [AC_MSG_ERROR([With --distro=none, you must pass --with-dbus-service to configure])]) | |
209 | AS_IF([test "x$with_syslog_service" = "x"], | |
210 | [AC_MSG_ERROR([With --distro=none, you must pass --with-syslog-service to configure])]) | |
211 | ;; | |
212 | *) | |
213 | 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]) | |
214 | ;; | |
215 | esac | |
216 | ||
217 | AC_ARG_WITH([sysvinit-path], | |
218 | [AS_HELP_STRING([--with-sysvinit-path=PATH], | |
219 | [Specify the path to where the SysV init scripts are located @<:@default=based on distro@:>@])], | |
220 | [SYSTEM_SYSVINIT_PATH="$withval"], | |
221 | []) | |
222 | ||
223 | AC_ARG_WITH([sysvrcd-path], | |
224 | [AS_HELP_STRING([--with-sysvrcd-path=PATH], | |
225 | [Specify the path to the base directory for the SysV rcN.d directories @<:@default=based on distro@:>@])], | |
226 | [SYSTEM_SYSVRCND_PATH="$withval"], | |
227 | []) | |
228 | ||
229 | AC_ARG_WITH([dbus-service], | |
230 | [AS_HELP_STRING([--with-dbus-service=PATH], | |
231 | [Specify the name of the special DBus service @<:@default=based on distro@:>@])], | |
232 | [special_dbus_service="$withval"], | |
233 | []) | |
234 | ||
235 | AC_ARG_WITH([syslog-service], | |
236 | [AS_HELP_STRING([--with-syslog-service=PATH], | |
237 | [Specify the name of the special syslog service @<:@default=based on distro@:>@])], | |
238 | [special_syslog_service="$withval"], | |
239 | []) | |
240 | ||
241 | AC_SUBST(SYSTEM_SYSVINIT_PATH) | |
242 | AC_SUBST(SYSTEM_SYSVRCND_PATH) | |
243 | ||
244 | AM_CONDITIONAL(TARGET_FEDORA, test x"$with_distro" = xfedora) | |
245 | AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse) | |
246 | AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian) | |
247 | AM_CONDITIONAL(TARGET_ARCH, test x"$with_distro" = xarch) | |
248 | AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo) | |
249 | AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware) | |
250 | ||
251 | AC_DEFINE_UNQUOTED(SPECIAL_DBUS_SERVICE, ["$special_dbus_service"], [D-Bus service name]) | |
252 | AC_DEFINE_UNQUOTED(SPECIAL_SYSLOG_SERVICE, ["$special_syslog_service"], [syslog service name]) | |
253 | ||
254 | AC_ARG_WITH([udevrulesdir], | |
255 | AS_HELP_STRING([--with-udevrulesdir=DIR], [Diectory for udev rules]), | |
256 | [], | |
257 | [with_udevrulesdir=/lib/udev/rules.d]) | |
258 | AC_SUBST([udevrulesdir], [$with_udevrulesdir]) | |
259 | ||
260 | ||
261 | AC_OUTPUT([Makefile]) | |
262 | ||
263 | echo " | |
264 | $PACKAGE_NAME $VERSION | |
265 | ||
266 | Distribution: ${with_distro} | |
267 | SysV init scripts: ${SYSTEM_SYSVINIT_PATH} | |
268 | SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH} | |
269 | Syslog service: ${special_syslog_service} | |
270 | D-Bus service: ${special_dbus_service} | |
271 | Gtk: ${have_gtk} | |
272 | udev rules dir: ${with_udevrulesdir} | |
273 | " |