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