]>
Commit | Line | Data |
---|---|---|
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 | ||
18 | AC_PREREQ(2.63) | |
19 | ||
db12315a | 20 | AC_INIT([systemd],[3],[systemd-devel@lists.freedesktop.org]) |
e99e38bb | 21 | AC_CONFIG_SRCDIR([src/main.c]) |
47be870b LP |
22 | AC_CONFIG_MACRO_DIR([m4]) |
23 | AC_CONFIG_HEADERS([config.h]) | |
24 | ||
b60e6bbf | 25 | AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules tar-pax subdir-objects dist-bzip2]) |
47be870b | 26 | |
1b322bdb | 27 | AC_SUBST(PACKAGE_URL, [http://www.freedesktop.org/wiki/Software/systemd]) |
47be870b LP |
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 | ||
e9da3678 LP |
40 | AC_PROG_MKDIR_P |
41 | AC_PROG_LN_S | |
42 | AC_PROG_SED | |
43 | ||
47be870b LP |
44 | AC_PROG_CC |
45 | AC_PROG_CC_C99 | |
46 | AM_PROG_CC_C_O | |
47 | AC_PROG_GCC_TRADITIONAL | |
48 | AC_USE_SYSTEM_EXTENSIONS | |
49 | ||
d1ab0ca0 | 50 | CC_CHECK_CFLAGS_APPEND([ \ |
be1a67d9 | 51 | -pipe \ |
d1ab0ca0 LP |
52 | -Wall \ |
53 | -W \ | |
54 | -Wextra \ | |
27765dfc | 55 | -Wno-inline \ |
d1ab0ca0 | 56 | -Wvla \ |
d1ab0ca0 LP |
57 | -Wundef \ |
58 | -Wformat=2 \ | |
59 | -Wlogical-op \ | |
60 | -Wsign-compare \ | |
61 | -Wformat-security \ | |
62 | -Wmissing-include-dirs \ | |
63 | -Wformat-nonliteral \ | |
64 | -Wold-style-definition \ | |
65 | -Wpointer-arith \ | |
66 | -Winit-self \ | |
67 | -Wdeclaration-after-statement \ | |
68 | -Wfloat-equal \ | |
69 | -Wmissing-prototypes \ | |
70 | -Wstrict-prototypes \ | |
71 | -Wredundant-decls \ | |
72 | -Wmissing-declarations \ | |
73 | -Wmissing-noreturn \ | |
74 | -Wshadow \ | |
75 | -Wendif-labels \ | |
76 | -Wcast-align \ | |
77 | -Wstrict-aliasing=2 \ | |
78 | -Wwrite-strings \ | |
be1a67d9 LP |
79 | -Wno-long-long \ |
80 | -Wno-overlength-strings \ | |
d1ab0ca0 | 81 | -Wno-unused-parameter \ |
be1a67d9 | 82 | -Wno-missing-field-initializers \ |
8745297f | 83 | -Wno-unused-result \ |
d1ab0ca0 | 84 | -Wp,-D_FORTIFY_SOURCE=2 \ |
be1a67d9 | 85 | -ffast-math \ |
d1ab0ca0 LP |
86 | -fno-common \ |
87 | -fdiagnostics-show-option \ | |
be1a67d9 | 88 | -fno-strict-aliasing]) |
47be870b | 89 | |
139be57d LP |
90 | LT_PREREQ(2.2) |
91 | LT_INIT | |
92 | ||
47be870b LP |
93 | AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([*** POSIX RT library not found])]) |
94 | AC_SEARCH_LIBS([cap_init], [cap], [], [AC_MSG_ERROR([*** POSIX caps library not found])]) | |
95 | AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers not found])]) | |
96 | ||
b237ef2c | 97 | # This makes sure pkg.m4 is available. |
a9b5b032 | 98 | m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config]) |
d1ab0ca0 | 99 | |
f1dfb629 | 100 | PKG_CHECK_MODULES(UDEV, [ libudev >= 160 ]) |
47be870b LP |
101 | AC_SUBST(UDEV_CFLAGS) |
102 | AC_SUBST(UDEV_LIBS) | |
103 | ||
83bda358 | 104 | PKG_CHECK_MODULES(DBUS, [ dbus-1 >= 1.3.2 ]) |
47be870b LP |
105 | AC_SUBST(DBUS_CFLAGS) |
106 | AC_SUBST(DBUS_LIBS) | |
107 | ||
108 | PKG_CHECK_MODULES(DBUSGLIB, [ dbus-glib-1 ]) | |
109 | AC_SUBST(DBUSGLIB_CFLAGS) | |
110 | AC_SUBST(DBUSGLIB_LIBS) | |
111 | ||
0213c3f8 LP |
112 | AC_ARG_ENABLE([tcpwrap], |
113 | AS_HELP_STRING([--disable-tcpwrap],[Disable optional TCP wrappers support]), | |
114 | [case "${enableval}" in | |
5b6319dc LP |
115 | yes) have_tcpwrap=yes ;; |
116 | no) have_tcpwrap=no ;; | |
0213c3f8 LP |
117 | *) AC_MSG_ERROR(bad value ${enableval} for --disable-tcpwrap) ;; |
118 | esac], | |
5b6319dc | 119 | [have_tcpwrap=auto]) |
0213c3f8 | 120 | |
5b6319dc | 121 | if test "x${have_tcpwrap}" != xno ; then |
0213c3f8 LP |
122 | ACX_LIBWRAP |
123 | if test "x${LIBWRAP_LIBS}" = x ; then | |
5b6319dc LP |
124 | if test "x$have_tcpwrap" = xyes ; then |
125 | AC_MSG_ERROR([*** TCP wrappers support not found.]) | |
0213c3f8 | 126 | fi |
812cce32 | 127 | have_tcpwrap=no |
0213c3f8 | 128 | else |
5b6319dc | 129 | have_tcpwrap=yes |
0213c3f8 LP |
130 | fi |
131 | else | |
5b6319dc | 132 | LIBWRAP_LIBS= |
0213c3f8 | 133 | fi |
0213c3f8 LP |
134 | AC_SUBST(LIBWRAP_LIBS) |
135 | ||
5b6319dc LP |
136 | AC_ARG_ENABLE([pam], |
137 | AS_HELP_STRING([--disable-pam],[Disable optional PAM support]), | |
138 | [case "${enableval}" in | |
139 | yes) have_pam=yes ;; | |
140 | no) have_pam=no ;; | |
141 | *) AC_MSG_ERROR(bad value ${enableval} for --disable-pam) ;; | |
142 | esac], | |
143 | [have_pam=auto]) | |
144 | ||
145 | if test "x${have_pam}" != xno ; then | |
146 | AC_CHECK_HEADERS( | |
147 | [security/pam_modules.h security/pam_modutil.h security/pam_ext.h], | |
148 | [have_pam=yes], | |
149 | [if test "x$have_pam" = xyes ; then | |
150 | AC_MSG_ERROR([*** PAM headers not found.]) | |
151 | fi]) | |
152 | ||
153 | AC_CHECK_LIB( | |
154 | [pam], | |
155 | [pam_syslog], | |
156 | [have_pam=yes], | |
157 | [if test "x$have_pam" = xyes ; then | |
158 | AC_MSG_ERROR([*** libpam not found.]) | |
159 | fi]) | |
160 | ||
161 | if test "x$have_pam" = xyes ; then | |
162 | PAM_LIBS="-lpam -lpam_misc" | |
163 | AC_DEFINE(HAVE_PAM, 1, [PAM available]) | |
812cce32 LP |
164 | else |
165 | have_pam=no | |
5b6319dc LP |
166 | fi |
167 | else | |
168 | PAM_LIBS= | |
169 | fi | |
170 | AC_SUBST(PAM_LIBS) | |
171 | AM_CONDITIONAL([HAVE_PAM], [test "x$have_pam" != xno]) | |
172 | ||
a9b5b032 MT |
173 | have_gtk=no |
174 | AC_ARG_ENABLE(gtk, AS_HELP_STRING([--disable-gtk], [disable GTK tools])) | |
175 | if test "x$enable_gtk" != "xno"; then | |
176 | PKG_CHECK_MODULES(GTK, [ gtk+-2.0 ], | |
177 | [AC_DEFINE(HAVE_GTK, 1, [Define if GTK is available]) have_gtk=yes], have_gtk=no) | |
178 | AC_SUBST(GTK_CFLAGS) | |
179 | AC_SUBST(GTK_LIBS) | |
180 | if test "x$have_gtk" = xno -a "x$enable_gtk" = xyes; then | |
181 | AC_MSG_ERROR([*** gtk support requested but libraries not found]) | |
182 | fi | |
183 | fi | |
184 | AM_CONDITIONAL(HAVE_GTK, [test "$have_gtk" = "yes"]) | |
185 | ||
e12891f7 | 186 | AM_PROG_VALAC([0.8]) |
47be870b | 187 | AC_SUBST(VAPIDIR) |
42e39f0b | 188 | AM_CONDITIONAL(HAVE_VALAC, test x"$VALAC" != x) |
47be870b | 189 | |
d1ab0ca0 LP |
190 | AC_PATH_PROG([XSLTPROC], [xsltproc]) |
191 | AM_CONDITIONAL(HAVE_XSLTPROC, test x"$XSLTPROC" != x) | |
192 | ||
5e6afdd3 LP |
193 | AC_PATH_PROG([M4], [m4]) |
194 | ||
9f2c5942 | 195 | AC_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 |
196 | if test "z$with_distro" = "z"; then |
197 | if test "$cross_compiling" = yes; then | |
198 | 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)]) | |
199 | else | |
200 | AC_CHECK_FILE(/etc/redhat-release,with_distro="fedora") | |
201 | AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse") | |
202 | AC_CHECK_FILE(/etc/debian_version,with_distro="debian") | |
d7c114c0 | 203 | AC_CHECK_FILE(/etc/arch-release,with_distro="arch") |
f2b4af1c | 204 | AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo") |
65c8976a | 205 | AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware") |
0571e011 LP |
206 | fi |
207 | if test "z$with_distro" = "z"; then | |
208 | with_distro=`uname -s` | |
209 | fi | |
210 | fi | |
211 | with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' ` | |
212 | ||
34eff652 | 213 | # Default generic names |
34eff652 LP |
214 | SPECIAL_SYSLOG_SERVICE=syslog.service |
215 | ||
216 | # Location of the init scripts as mandated by LSB | |
217 | SYSTEM_SYSVINIT_PATH=/etc/init.d | |
218 | ||
12e84679 LP |
219 | M4_DISTRO_FLAG= |
220 | ||
0571e011 LP |
221 | case $with_distro in |
222 | fedora) | |
223 | SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d | |
224 | SYSTEM_SYSVRCND_PATH=/etc/rc.d | |
34eff652 | 225 | |
83bda358 | 226 | # A little background why we define this special unit |
34eff652 LP |
227 | # names here in configure.ac: SysV services currently |
228 | # cannot have aliases. As long as syslog is started | |
83bda358 LP |
229 | # via a SysV init script we hence define this name to |
230 | # the actual SysV name here. Later on when SysV init | |
231 | # scripts are not used anymore it is advisable to use | |
232 | # the generic name instead and use symlinks in the | |
233 | # unit directories to point to the right native unit | |
234 | # file. | |
235 | ||
a7b6f8e5 | 236 | SPECIAL_SYSLOG_SERVICE=rsyslog.service |
2c696a96 | 237 | AC_DEFINE(TARGET_FEDORA, [], [Target is Fedora/RHEL]) |
12e84679 | 238 | M4_DISTRO_FLAG=-DTARGET_FEDORA=1 |
0571e011 LP |
239 | ;; |
240 | suse) | |
0571e011 | 241 | SYSTEM_SYSVRCND_PATH=/etc/init.d |
634826b5 | 242 | AC_DEFINE(TARGET_SUSE, [], [Target is openSUSE/SLE]) |
12e84679 | 243 | M4_DISTRO_FLAG=-DTARGET_SUSE=1 |
0571e011 LP |
244 | ;; |
245 | debian) | |
0571e011 | 246 | SYSTEM_SYSVRCND_PATH=/etc |
a7b6f8e5 | 247 | SPECIAL_SYSLOG_SERVICE=rsyslog.service |
2c696a96 | 248 | AC_DEFINE(TARGET_DEBIAN, [], [Target is Debian/Ubuntu]) |
12e84679 | 249 | M4_DISTRO_FLAG=-DTARGET_DEBIAN=1 |
0571e011 | 250 | ;; |
d7c114c0 DR |
251 | arch) |
252 | SYSTEM_SYSVINIT_PATH=/etc/rc.d | |
253 | SYSTEM_SYSVRCND_PATH=/etc | |
a7b6f8e5 | 254 | SPECIAL_SYSLOG_SERVICE=syslog-ng.service |
d7c114c0 | 255 | AC_DEFINE(TARGET_ARCH, [], [Target is ArchLinux]) |
12e84679 | 256 | M4_DISTRO_FLAG=-DTARGET_ARCH=1 |
d7c114c0 | 257 | ;; |
f2b4af1c | 258 | gentoo) |
f2b4af1c | 259 | SYSTEM_SYSVRCND_PATH=/etc |
a7b6f8e5 | 260 | SPECIAL_SYSLOG_SERVICE=syslog-ng.service |
f2b4af1c | 261 | AC_DEFINE(TARGET_GENTOO, [], [Target is Gentoo]) |
12e84679 | 262 | M4_DISTRO_FLAG=-DTARGET_GENTOO=1 |
f2b4af1c | 263 | ;; |
65c8976a MS |
264 | slackware) |
265 | SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d | |
266 | SYSTEM_SYSVRCND_PATH=/etc/rc.d | |
65c8976a | 267 | AC_DEFINE(TARGET_SLACKWARE, [], [Target is Slackware]) |
12e84679 | 268 | M4_DISTRO_FLAG=-DTARGET_SLACKWARE=1 |
65c8976a | 269 | ;; |
bf024b02 | 270 | other) |
136337ff | 271 | AS_IF([test "x$with_sysvinit_path" = "x"], |
b6c2bf61 | 272 | [AC_MSG_ERROR([With --distro=other, you must pass --with-sysvinit-path= to configure])]) |
136337ff | 273 | AS_IF([test "x$with_sysvrcd_path" = "x"], |
b6c2bf61 | 274 | [AC_MSG_ERROR([With --distro=other, you must pass --with-sysvrcd-path= to configure])]) |
136337ff | 275 | AS_IF([test "x$with_syslog_service" = "x"], |
b6c2bf61 | 276 | [AC_MSG_ERROR([With --distro=other, you must pass --with-syslog-service= to configure])]) |
0571e011 LP |
277 | ;; |
278 | *) | |
bf024b02 | 279 | 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 |
280 | ;; |
281 | esac | |
282 | ||
136337ff TFH |
283 | AC_ARG_WITH([sysvinit-path], |
284 | [AS_HELP_STRING([--with-sysvinit-path=PATH], | |
285 | [Specify the path to where the SysV init scripts are located @<:@default=based on distro@:>@])], | |
286 | [SYSTEM_SYSVINIT_PATH="$withval"], | |
287 | []) | |
288 | ||
289 | AC_ARG_WITH([sysvrcd-path], | |
290 | [AS_HELP_STRING([--with-sysvrcd-path=PATH], | |
291 | [Specify the path to the base directory for the SysV rcN.d directories @<:@default=based on distro@:>@])], | |
292 | [SYSTEM_SYSVRCND_PATH="$withval"], | |
293 | []) | |
294 | ||
136337ff | 295 | AC_ARG_WITH([syslog-service], |
d2d12cd1 | 296 | [AS_HELP_STRING([--with-syslog-service=UNIT], |
136337ff | 297 | [Specify the name of the special syslog service @<:@default=based on distro@:>@])], |
a7b6f8e5 | 298 | [SPECIAL_SYSLOG_SERVICE="$withval"], |
136337ff TFH |
299 | []) |
300 | ||
0571e011 | 301 | AC_SUBST(SYSTEM_SYSVINIT_PATH) |
d64b723a | 302 | AC_SUBST(SYSTEM_SYSVRCND_PATH) |
a7b6f8e5 | 303 | AC_SUBST(SPECIAL_SYSLOG_SERVICE) |
12e84679 | 304 | AC_SUBST(M4_DISTRO_FLAG) |
0571e011 LP |
305 | |
306 | AM_CONDITIONAL(TARGET_FEDORA, test x"$with_distro" = xfedora) | |
307 | AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse) | |
308 | AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian) | |
d7c114c0 | 309 | AM_CONDITIONAL(TARGET_ARCH, test x"$with_distro" = xarch) |
f2b4af1c | 310 | AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo) |
65c8976a | 311 | AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware) |
0571e011 | 312 | |
a7b6f8e5 | 313 | AC_DEFINE_UNQUOTED(SPECIAL_SYSLOG_SERVICE, ["$SPECIAL_SYSLOG_SERVICE"], [Syslog service name]) |
2c696a96 | 314 | |
d2d12cd1 LP |
315 | AC_ARG_WITH([dbuspolicydir], |
316 | AS_HELP_STRING([--with-dbuspolicydir=DIR], [D-Bus policy directory]), | |
317 | [], | |
318 | [with_dbuspolicydir=`pkg-config --variable=sysconfdir dbus-1`/dbus-1/system.d]) | |
d122948d | 319 | |
d2d12cd1 LP |
320 | AC_ARG_WITH([dbussessionservicedir], |
321 | AS_HELP_STRING([--with-dbussessionservicedir=DIR], [D-Bus session service directory]), | |
322 | [], | |
323 | [with_dbussessionservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`]) | |
d122948d | 324 | |
d2d12cd1 LP |
325 | AC_ARG_WITH([dbussystemservicedir], |
326 | AS_HELP_STRING([--with-dbussystemservicedir=DIR], [D-Bus system service directory]), | |
327 | [], | |
328 | [with_dbussystemservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../system-services]) | |
d122948d | 329 | |
d2d12cd1 LP |
330 | AC_ARG_WITH([dbusinterfacedir], |
331 | AS_HELP_STRING([--with-dbusinterfacedir=DIR], [D-Bus interface directory]), | |
332 | [], | |
333 | [with_dbusinterfacedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../interfaces]) | |
d122948d | 334 | |
d1ab0ca0 LP |
335 | AC_ARG_WITH([udevrulesdir], |
336 | AS_HELP_STRING([--with-udevrulesdir=DIR], [Diectory for udev rules]), | |
337 | [], | |
8c6db833 LP |
338 | [with_udevrulesdir=`pkg-config --variable=udevdir udev`/rules.d]) |
339 | ||
340 | AC_ARG_WITH([pamlibdir], | |
341 | AS_HELP_STRING([--with-pamlibdir=DIR], [Diectory for PAM modules]), | |
342 | [], | |
343 | [with_pamlibdir=/lib/`$CC -print-multi-os-directory`/security]) | |
d1ab0ca0 | 344 | |
8c4a3079 LP |
345 | AC_ARG_WITH([rootdir], |
346 | AS_HELP_STRING([--with-rootdir=DIR], [Root directory for files necessary for boot]), | |
347 | [], | |
a6baa3f6 | 348 | [with_rootdir=${ac_default_prefix}]) |
d2d12cd1 LP |
349 | |
350 | AC_SUBST([dbuspolicydir], [$with_dbuspolicydir]) | |
351 | AC_SUBST([dbussessionservicedir], [$with_dbussessionservicedir]) | |
352 | AC_SUBST([dbussystemservicedir], [$with_dbussystemservicedir]) | |
353 | AC_SUBST([dbusinterfacedir], [$with_dbusinterfacedir]) | |
354 | AC_SUBST([udevrulesdir], [$with_udevrulesdir]) | |
8c6db833 | 355 | AC_SUBST([pamlibdir], [$with_pamlibdir]) |
8c4a3079 LP |
356 | AC_SUBST([rootdir], [$with_rootdir]) |
357 | ||
a45a909f CR |
358 | AC_CONFIG_FILES([Makefile]) |
359 | AC_OUTPUT | |
0571e011 LP |
360 | |
361 | echo " | |
362 | $PACKAGE_NAME $VERSION | |
363 | ||
2c696a96 | 364 | Distribution: ${with_distro} |
0571e011 LP |
365 | SysV init scripts: ${SYSTEM_SYSVINIT_PATH} |
366 | SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH} | |
a7b6f8e5 | 367 | Syslog service: ${SPECIAL_SYSLOG_SERVICE} |
a9b5b032 | 368 | Gtk: ${have_gtk} |
5b6319dc LP |
369 | tcpwrap: ${have_tcpwrap} |
370 | PAM: ${have_pam} | |
8c4a3079 LP |
371 | prefix: ${prefix} |
372 | root dir: ${with_rootdir} | |
d1ab0ca0 | 373 | udev rules dir: ${with_udevrulesdir} |
8c6db833 | 374 | pam modules dir: ${with_pamlibdir} |
d2d12cd1 LP |
375 | dbus policy dir: ${with_dbuspolicydir} |
376 | dbus session dir: ${with_dbussessionservicedir} | |
377 | dbus system dir: ${with_dbussystemservicedir} | |
378 | dbus interfaces dir: ${with_dbusinterfacedir} | |
0571e011 | 379 | " |