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