]> git.ipfire.org Git - thirdparty/systemd.git/blob - configure.ac
audit,utmp: implement audit logic and rip utmp stuff out of the main daemon and into...
[thirdparty/systemd.git] / configure.ac
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],[7],[systemd-devel@lists.freedesktop.org])
21 AC_CONFIG_SRCDIR([src/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 subdir-objects dist-bzip2])
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_MKDIR_P
41 AC_PROG_LN_S
42 AC_PROG_SED
43
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
50 CC_CHECK_CFLAGS_APPEND([ \
51 -pipe \
52 -Wall \
53 -W \
54 -Wextra \
55 -Wno-inline \
56 -Wvla \
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 \
79 -Wno-long-long \
80 -Wno-overlength-strings \
81 -Wno-unused-parameter \
82 -Wno-missing-field-initializers \
83 -Wno-unused-result \
84 -Wp,-D_FORTIFY_SOURCE=2 \
85 -ffast-math \
86 -fno-common \
87 -fdiagnostics-show-option \
88 -fno-strict-aliasing])
89
90 LT_PREREQ(2.2)
91 LT_INIT
92
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
97 # This makes sure pkg.m4 is available.
98 m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
99
100 PKG_CHECK_MODULES(UDEV, [ libudev >= 160 ])
101 AC_SUBST(UDEV_CFLAGS)
102 AC_SUBST(UDEV_LIBS)
103
104 PKG_CHECK_MODULES(DBUS, [ dbus-1 >= 1.3.2 ])
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
112 have_selinux=no
113 AC_ARG_ENABLE(selinux, AS_HELP_STRING([--disable-selinux], [Disable optional SELINUX support]))
114 if test "x$enable_selinux" != "xno"; then
115 # not using PKG_CHECK_MODULES as for some reason libselinux didn't
116 # install any pkg-config modules here
117 AC_SEARCH_LIBS([getcon], [selinux],
118 [AC_DEFINE(HAVE_SELINUX, 1, [Define if SELINUX is available]) have_selinux=yes],
119 have_selinux=no)
120 AC_SUBST(SELINUX_CFLAGS)
121 AC_SUBST(SELINUX_LIBS)
122 if test "x$have_selinux" = xno -a "x$enable_selinux" = xyes; then
123 AC_MSG_ERROR([*** selinux support requested but libraries not found])
124 fi
125 fi
126 AM_CONDITIONAL(HAVE_SELINUX, [test "$have_selinux" = "yes"])
127
128 AC_ARG_ENABLE([tcpwrap],
129 AS_HELP_STRING([--disable-tcpwrap],[Disable optional TCP wrappers support]),
130 [case "${enableval}" in
131 yes) have_tcpwrap=yes ;;
132 no) have_tcpwrap=no ;;
133 *) AC_MSG_ERROR(bad value ${enableval} for --disable-tcpwrap) ;;
134 esac],
135 [have_tcpwrap=auto])
136
137 if test "x${have_tcpwrap}" != xno ; then
138 ACX_LIBWRAP
139 if test "x${LIBWRAP_LIBS}" = x ; then
140 if test "x$have_tcpwrap" = xyes ; then
141 AC_MSG_ERROR([*** TCP wrappers support not found.])
142 fi
143 have_tcpwrap=no
144 else
145 have_tcpwrap=yes
146 fi
147 else
148 LIBWRAP_LIBS=
149 fi
150 AC_SUBST(LIBWRAP_LIBS)
151
152 AC_ARG_ENABLE([pam],
153 AS_HELP_STRING([--disable-pam],[Disable optional PAM support]),
154 [case "${enableval}" in
155 yes) have_pam=yes ;;
156 no) have_pam=no ;;
157 *) AC_MSG_ERROR(bad value ${enableval} for --disable-pam) ;;
158 esac],
159 [have_pam=auto])
160
161 if test "x${have_pam}" != xno ; then
162 AC_CHECK_HEADERS(
163 [security/pam_modules.h security/pam_modutil.h security/pam_ext.h],
164 [have_pam=yes],
165 [if test "x$have_pam" = xyes ; then
166 AC_MSG_ERROR([*** PAM headers not found.])
167 fi])
168
169 AC_CHECK_LIB(
170 [pam],
171 [pam_syslog],
172 [have_pam=yes],
173 [if test "x$have_pam" = xyes ; then
174 AC_MSG_ERROR([*** libpam not found.])
175 fi])
176
177 if test "x$have_pam" = xyes ; then
178 PAM_LIBS="-lpam -lpam_misc"
179 AC_DEFINE(HAVE_PAM, 1, [PAM available])
180 else
181 have_pam=no
182 fi
183 else
184 PAM_LIBS=
185 fi
186 AC_SUBST(PAM_LIBS)
187 AM_CONDITIONAL([HAVE_PAM], [test "x$have_pam" != xno])
188
189 AC_ARG_ENABLE([audit],
190 AS_HELP_STRING([--disable-audit],[Disable optional AUDIT support]),
191 [case "${enableval}" in
192 yes) have_audit=yes ;;
193 no) have_audit=no ;;
194 *) AC_MSG_ERROR(bad value ${enableval} for --disable-audit) ;;
195 esac],
196 [have_audit=auto])
197
198 if test "x${have_audit}" != xno ; then
199 AC_CHECK_HEADERS(
200 [libaudit.h],
201 [have_audit=yes],
202 [if test "x$have_audit" = xyes ; then
203 AC_MSG_ERROR([*** AUDIT headers not found.])
204 fi])
205
206 AC_CHECK_LIB(
207 [audit],
208 [audit_open],
209 [have_audit=yes],
210 [if test "x$have_audit" = xyes ; then
211 AC_MSG_ERROR([*** libaudit not found.])
212 fi])
213
214 if test "x$have_audit" = xyes ; then
215 AUDIT_LIBS="-laudit"
216 AC_DEFINE(HAVE_AUDIT, 1, [AUDIT available])
217 else
218 have_audit=no
219 fi
220 else
221 AUDIT_LIBS=
222 fi
223 AC_SUBST(AUDIT_LIBS)
224
225 have_gtk=no
226 AC_ARG_ENABLE(gtk, AS_HELP_STRING([--disable-gtk], [disable GTK tools]))
227 if test "x$enable_gtk" != "xno"; then
228 PKG_CHECK_MODULES(GTK, [ gtk+-2.0 ],
229 [AC_DEFINE(HAVE_GTK, 1, [Define if GTK is available]) have_gtk=yes], have_gtk=no)
230 AC_SUBST(GTK_CFLAGS)
231 AC_SUBST(GTK_LIBS)
232 if test "x$have_gtk" = xno -a "x$enable_gtk" = xyes; then
233 AC_MSG_ERROR([*** gtk support requested but libraries not found])
234 fi
235 fi
236 AM_CONDITIONAL(HAVE_GTK, [test "$have_gtk" = "yes"])
237
238 AM_PROG_VALAC([0.9])
239 AC_SUBST(VAPIDIR)
240 AM_CONDITIONAL(HAVE_VALAC, test x"$VALAC" != x)
241
242 AC_PATH_PROG([XSLTPROC], [xsltproc])
243 AM_CONDITIONAL(HAVE_XSLTPROC, test x"$XSLTPROC" != x)
244
245 AC_PATH_PROG([M4], [m4])
246
247 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]))
248 if test "z$with_distro" = "z"; then
249 if test "$cross_compiling" = yes; then
250 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)])
251 else
252 AC_CHECK_FILE(/etc/redhat-release,with_distro="fedora")
253 AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
254 AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
255 AC_CHECK_FILE(/etc/arch-release,with_distro="arch")
256 AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
257 AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
258 fi
259 if test "z$with_distro" = "z"; then
260 with_distro=`uname -s`
261 fi
262 fi
263 with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
264
265 # Default generic names
266 SPECIAL_SYSLOG_SERVICE=syslog.service
267
268 # Location of the init scripts as mandated by LSB
269 SYSTEM_SYSVINIT_PATH=/etc/init.d
270
271 M4_DISTRO_FLAG=
272
273 case $with_distro in
274 fedora)
275 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
276 SYSTEM_SYSVRCND_PATH=/etc/rc.d
277
278 # A little background why we define this special unit
279 # names here in configure.ac: SysV services currently
280 # cannot have aliases. As long as syslog is started
281 # via a SysV init script we hence define this name to
282 # the actual SysV name here. Later on when SysV init
283 # scripts are not used anymore it is advisable to use
284 # the generic name instead and use symlinks in the
285 # unit directories to point to the right native unit
286 # file.
287
288 SPECIAL_SYSLOG_SERVICE=rsyslog.service
289 AC_DEFINE(TARGET_FEDORA, [], [Target is Fedora/RHEL])
290 M4_DISTRO_FLAG=-DTARGET_FEDORA=1
291 ;;
292 suse)
293 SYSTEM_SYSVRCND_PATH=/etc/init.d
294 AC_DEFINE(TARGET_SUSE, [], [Target is openSUSE/SLE])
295 M4_DISTRO_FLAG=-DTARGET_SUSE=1
296 ;;
297 debian)
298 SYSTEM_SYSVRCND_PATH=/etc
299 SPECIAL_SYSLOG_SERVICE=rsyslog.service
300 AC_DEFINE(TARGET_DEBIAN, [], [Target is Debian/Ubuntu])
301 M4_DISTRO_FLAG=-DTARGET_DEBIAN=1
302 ;;
303 arch)
304 SYSTEM_SYSVINIT_PATH=/etc/rc.d
305 SYSTEM_SYSVRCND_PATH=/etc
306 SPECIAL_SYSLOG_SERVICE=syslog-ng.service
307 AC_DEFINE(TARGET_ARCH, [], [Target is ArchLinux])
308 M4_DISTRO_FLAG=-DTARGET_ARCH=1
309 ;;
310 gentoo)
311 SYSTEM_SYSVRCND_PATH=/etc
312 SPECIAL_SYSLOG_SERVICE=syslog-ng.service
313 AC_DEFINE(TARGET_GENTOO, [], [Target is Gentoo])
314 M4_DISTRO_FLAG=-DTARGET_GENTOO=1
315 ;;
316 slackware)
317 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
318 SYSTEM_SYSVRCND_PATH=/etc/rc.d
319 AC_DEFINE(TARGET_SLACKWARE, [], [Target is Slackware])
320 M4_DISTRO_FLAG=-DTARGET_SLACKWARE=1
321 ;;
322 other)
323 AS_IF([test "x$with_sysvinit_path" = "x"],
324 [AC_MSG_ERROR([With --distro=other, you must pass --with-sysvinit-path= to configure])])
325 AS_IF([test "x$with_sysvrcd_path" = "x"],
326 [AC_MSG_ERROR([With --distro=other, you must pass --with-sysvrcd-path= to configure])])
327 AS_IF([test "x$with_syslog_service" = "x"],
328 [AC_MSG_ERROR([With --distro=other, you must pass --with-syslog-service= to configure])])
329 ;;
330 *)
331 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])
332 ;;
333 esac
334
335 AC_ARG_WITH([sysvinit-path],
336 [AS_HELP_STRING([--with-sysvinit-path=PATH],
337 [Specify the path to where the SysV init scripts are located @<:@default=based on distro@:>@])],
338 [SYSTEM_SYSVINIT_PATH="$withval"],
339 [])
340
341 AC_ARG_WITH([sysvrcd-path],
342 [AS_HELP_STRING([--with-sysvrcd-path=PATH],
343 [Specify the path to the base directory for the SysV rcN.d directories @<:@default=based on distro@:>@])],
344 [SYSTEM_SYSVRCND_PATH="$withval"],
345 [])
346
347 AC_ARG_WITH([syslog-service],
348 [AS_HELP_STRING([--with-syslog-service=UNIT],
349 [Specify the name of the special syslog service @<:@default=based on distro@:>@])],
350 [SPECIAL_SYSLOG_SERVICE="$withval"],
351 [])
352
353 AC_SUBST(SYSTEM_SYSVINIT_PATH)
354 AC_SUBST(SYSTEM_SYSVRCND_PATH)
355 AC_SUBST(SPECIAL_SYSLOG_SERVICE)
356 AC_SUBST(M4_DISTRO_FLAG)
357
358 AM_CONDITIONAL(TARGET_FEDORA, test x"$with_distro" = xfedora)
359 AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse)
360 AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian)
361 AM_CONDITIONAL(TARGET_ARCH, test x"$with_distro" = xarch)
362 AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo)
363 AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware)
364
365 AC_DEFINE_UNQUOTED(SPECIAL_SYSLOG_SERVICE, ["$SPECIAL_SYSLOG_SERVICE"], [Syslog service name])
366
367 AC_ARG_WITH([dbuspolicydir],
368 AS_HELP_STRING([--with-dbuspolicydir=DIR], [D-Bus policy directory]),
369 [],
370 [with_dbuspolicydir=`pkg-config --variable=sysconfdir dbus-1`/dbus-1/system.d])
371
372 AC_ARG_WITH([dbussessionservicedir],
373 AS_HELP_STRING([--with-dbussessionservicedir=DIR], [D-Bus session service directory]),
374 [],
375 [with_dbussessionservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`])
376
377 AC_ARG_WITH([dbussystemservicedir],
378 AS_HELP_STRING([--with-dbussystemservicedir=DIR], [D-Bus system service directory]),
379 [],
380 [with_dbussystemservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../system-services])
381
382 AC_ARG_WITH([dbusinterfacedir],
383 AS_HELP_STRING([--with-dbusinterfacedir=DIR], [D-Bus interface directory]),
384 [],
385 [with_dbusinterfacedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../interfaces])
386
387 AC_ARG_WITH([udevrulesdir],
388 AS_HELP_STRING([--with-udevrulesdir=DIR], [Diectory for udev rules]),
389 [],
390 [with_udevrulesdir=`pkg-config --variable=udevdir udev`/rules.d])
391
392 AC_ARG_WITH([pamlibdir],
393 AS_HELP_STRING([--with-pamlibdir=DIR], [Diectory for PAM modules]),
394 [],
395 [with_pamlibdir=/lib/`$CC -print-multi-os-directory`/security])
396
397 AC_ARG_WITH([rootdir],
398 AS_HELP_STRING([--with-rootdir=DIR], [Root directory for files necessary for boot]),
399 [],
400 [with_rootdir=${ac_default_prefix}])
401
402 AC_SUBST([dbuspolicydir], [$with_dbuspolicydir])
403 AC_SUBST([dbussessionservicedir], [$with_dbussessionservicedir])
404 AC_SUBST([dbussystemservicedir], [$with_dbussystemservicedir])
405 AC_SUBST([dbusinterfacedir], [$with_dbusinterfacedir])
406 AC_SUBST([udevrulesdir], [$with_udevrulesdir])
407 AC_SUBST([pamlibdir], [$with_pamlibdir])
408 AC_SUBST([rootdir], [$with_rootdir])
409
410 AC_CONFIG_FILES([Makefile])
411 AC_OUTPUT
412
413 echo "
414 $PACKAGE_NAME $VERSION
415
416 Distribution: ${with_distro}
417 SysV init scripts: ${SYSTEM_SYSVINIT_PATH}
418 SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH}
419 Syslog service: ${SPECIAL_SYSLOG_SERVICE}
420 Gtk: ${have_gtk}
421 tcpwrap: ${have_tcpwrap}
422 PAM: ${have_pam}
423 prefix: ${prefix}
424 root dir: ${with_rootdir}
425 udev rules dir: ${with_udevrulesdir}
426 pam modules dir: ${with_pamlibdir}
427 dbus policy dir: ${with_dbuspolicydir}
428 dbus session dir: ${with_dbussessionservicedir}
429 dbus system dir: ${with_dbussystemservicedir}
430 dbus interfaces dir: ${with_dbusinterfacedir}
431 "