chiark / gitweb /
dbus: send reload completion message on right connection
[elogind.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],[0],[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         -Winline \
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 >= 154 ])
101 AC_SUBST(UDEV_CFLAGS)
102 AC_SUBST(UDEV_LIBS)
103
104 PKG_CHECK_MODULES(DBUS, [ dbus-1 ])
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 PKG_CHECK_MODULES(CGROUP, [ libcgroup >= 0.36 ])
113 AC_SUBST(CGROUP_CFLAGS)
114 AC_SUBST(CGROUP_LIBS)
115
116 AC_ARG_ENABLE([tcpwrap],
117         AS_HELP_STRING([--disable-tcpwrap],[Disable optional TCP wrappers support]),
118                 [case "${enableval}" in
119                         yes) have_tcpwrap=yes ;;
120                         no) have_tcpwrap=no ;;
121                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-tcpwrap) ;;
122                 esac],
123                 [have_tcpwrap=auto])
124
125 if test "x${have_tcpwrap}" != xno ; then
126         ACX_LIBWRAP
127         if test "x${LIBWRAP_LIBS}" = x ; then
128                 if test "x$have_tcpwrap" = xyes ; then
129                         AC_MSG_ERROR([*** TCP wrappers support not found.])
130                 fi
131                 have_tcpwrap=no
132         else
133                 have_tcpwrap=yes
134         fi
135 else
136         LIBWRAP_LIBS=
137 fi
138 AC_SUBST(LIBWRAP_LIBS)
139
140 AC_ARG_ENABLE([pam],
141         AS_HELP_STRING([--disable-pam],[Disable optional PAM support]),
142                 [case "${enableval}" in
143                         yes) have_pam=yes ;;
144                         no) have_pam=no ;;
145                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-pam) ;;
146                 esac],
147                 [have_pam=auto])
148
149 if test "x${have_pam}" != xno ; then
150         AC_CHECK_HEADERS(
151                 [security/pam_modules.h security/pam_modutil.h security/pam_ext.h],
152                 [have_pam=yes],
153                 [if test "x$have_pam" = xyes ; then
154                         AC_MSG_ERROR([*** PAM headers not found.])
155                 fi])
156
157         AC_CHECK_LIB(
158                 [pam],
159                 [pam_syslog],
160                 [have_pam=yes],
161                 [if test "x$have_pam" = xyes ; then
162                         AC_MSG_ERROR([*** libpam not found.])
163                 fi])
164
165         if test "x$have_pam" = xyes ; then
166                 PAM_LIBS="-lpam -lpam_misc"
167                 AC_DEFINE(HAVE_PAM, 1, [PAM available])
168         else
169                 have_pam=no
170         fi
171 else
172         PAM_LIBS=
173 fi
174 AC_SUBST(PAM_LIBS)
175 AM_CONDITIONAL([HAVE_PAM], [test "x$have_pam" != xno])
176
177 have_gtk=no
178 AC_ARG_ENABLE(gtk, AS_HELP_STRING([--disable-gtk], [disable GTK tools]))
179 if test "x$enable_gtk" != "xno"; then
180         PKG_CHECK_MODULES(GTK, [ gtk+-2.0 ],
181                 [AC_DEFINE(HAVE_GTK, 1, [Define if GTK is available]) have_gtk=yes], have_gtk=no)
182         AC_SUBST(GTK_CFLAGS)
183         AC_SUBST(GTK_LIBS)
184         if test "x$have_gtk" = xno -a "x$enable_gtk" = xyes; then
185              AC_MSG_ERROR([*** gtk support requested but libraries not found])
186         fi
187 fi
188 AM_CONDITIONAL(HAVE_GTK, [test "$have_gtk" = "yes"])
189
190 AM_PROG_VALAC([0.8])
191 AC_SUBST(VAPIDIR)
192 AM_CONDITIONAL(HAVE_VALAC, test x"$VALAC" != x)
193
194 AC_PATH_PROG([XSLTPROC], [xsltproc])
195 AM_CONDITIONAL(HAVE_XSLTPROC, test x"$XSLTPROC" != x)
196
197 AC_PATH_PROG([M4], [m4])
198
199 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]))
200 if test "z$with_distro" = "z"; then
201         if test "$cross_compiling" = yes; then
202                 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)])
203         else
204                 AC_CHECK_FILE(/etc/redhat-release,with_distro="fedora")
205                 AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
206                 AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
207                 AC_CHECK_FILE(/etc/arch-release,with_distro="arch")
208                 AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
209                 AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
210         fi
211         if test "z$with_distro" = "z"; then
212                 with_distro=`uname -s`
213         fi
214 fi
215 with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
216
217 # Default generic names
218 SPECIAL_DBUS_SERVICE=dbus.service
219 SPECIAL_SYSLOG_SERVICE=syslog.service
220
221 # Location of the init scripts as mandated by LSB
222 SYSTEM_SYSVINIT_PATH=/etc/init.d
223
224 M4_DISTRO_FLAG=
225
226 case $with_distro in
227         fedora)
228                 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
229                 SYSTEM_SYSVRCND_PATH=/etc/rc.d
230
231                 # A little background why we define these special unit
232                 # names here in configure.ac: SysV services currently
233                 # cannot have aliases. As long as syslog is started
234                 # via a SysV init script we hence define these names
235                 # to the actual SysV name here. Later on when SysV
236                 # init scripts are not used anymore it is advisable to
237                 # use the generic names instead and use symlinks in
238                 # the unit directories to point to the right native
239                 # unit file.
240
241                 SPECIAL_DBUS_SERVICE=messagebus.service
242                 SPECIAL_SYSLOG_SERVICE=rsyslog.service
243                 AC_DEFINE(TARGET_FEDORA, [], [Target is Fedora/RHEL])
244                 M4_DISTRO_FLAG=-DTARGET_FEDORA=1
245                 ;;
246         suse)
247                 SYSTEM_SYSVRCND_PATH=/etc/init.d
248                 AC_DEFINE(TARGET_SUSE, [], [Target is openSUSE/SLE])
249                 M4_DISTRO_FLAG=-DTARGET_SUSE=1
250                 ;;
251         debian)
252                 SYSTEM_SYSVRCND_PATH=/etc
253                 SPECIAL_SYSLOG_SERVICE=rsyslog.service
254                 AC_DEFINE(TARGET_DEBIAN, [], [Target is Debian/Ubuntu])
255                 M4_DISTRO_FLAG=-DTARGET_DEBIAN=1
256                 ;;
257         arch)
258                 SYSTEM_SYSVINIT_PATH=/etc/rc.d
259                 SYSTEM_SYSVRCND_PATH=/etc
260                 SPECIAL_SYSLOG_SERVICE=syslog-ng.service
261                 AC_DEFINE(TARGET_ARCH, [], [Target is ArchLinux])
262                 M4_DISTRO_FLAG=-DTARGET_ARCH=1
263                 ;;
264         gentoo)
265                 SYSTEM_SYSVRCND_PATH=/etc
266                 SPECIAL_SYSLOG_SERVICE=syslog-ng.service
267                 AC_DEFINE(TARGET_GENTOO, [], [Target is Gentoo])
268                 M4_DISTRO_FLAG=-DTARGET_GENTOO=1
269                 ;;
270         slackware)
271                 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
272                 SYSTEM_SYSVRCND_PATH=/etc/rc.d
273                 SPECIAL_DBUS_SERVICE=messagebus.service
274                 AC_DEFINE(TARGET_SLACKWARE, [], [Target is Slackware])
275                 M4_DISTRO_FLAG=-DTARGET_SLACKWARE=1
276                 ;;
277         other)
278                 AS_IF([test "x$with_sysvinit_path" = "x"],
279                         [AC_MSG_ERROR([With --distro=other, you must pass --with-sysvinit-path= to configure])])
280                 AS_IF([test "x$with_sysvrcd_path" = "x"],
281                         [AC_MSG_ERROR([With --distro=other, you must pass --with-sysvrcd-path= to configure])])
282                 AS_IF([test "x$with_dbus_service" = "x"],
283                         [AC_MSG_ERROR([With --distro=other, you must pass --with-dbus-service= to configure])])
284                 AS_IF([test "x$with_syslog_service" = "x"],
285                         [AC_MSG_ERROR([With --distro=other, you must pass --with-syslog-service= to configure])])
286                 ;;
287         *)
288                 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])
289                 ;;
290 esac
291
292 AC_ARG_WITH([sysvinit-path],
293         [AS_HELP_STRING([--with-sysvinit-path=PATH],
294                 [Specify the path to where the SysV init scripts are located @<:@default=based on distro@:>@])],
295         [SYSTEM_SYSVINIT_PATH="$withval"],
296         [])
297
298 AC_ARG_WITH([sysvrcd-path],
299         [AS_HELP_STRING([--with-sysvrcd-path=PATH],
300                 [Specify the path to the base directory for the SysV rcN.d directories @<:@default=based on distro@:>@])],
301         [SYSTEM_SYSVRCND_PATH="$withval"],
302         [])
303
304 AC_ARG_WITH([dbus-service],
305         [AS_HELP_STRING([--with-dbus-service=UNIT],
306                 [Specify the name of the special DBus service @<:@default=based on distro@:>@])],
307         [SPECIAL_DBUS_SERVICE="$withval"],
308         [])
309
310 AC_ARG_WITH([syslog-service],
311         [AS_HELP_STRING([--with-syslog-service=UNIT],
312                 [Specify the name of the special syslog service @<:@default=based on distro@:>@])],
313         [SPECIAL_SYSLOG_SERVICE="$withval"],
314         [])
315
316 AC_SUBST(SYSTEM_SYSVINIT_PATH)
317 AC_SUBST(SYSTEM_SYSVRCND_PATH)
318 AC_SUBST(SPECIAL_DBUS_SERVICE)
319 AC_SUBST(SPECIAL_SYSLOG_SERVICE)
320 AC_SUBST(M4_DISTRO_FLAG)
321
322 AM_CONDITIONAL(TARGET_FEDORA, test x"$with_distro" = xfedora)
323 AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse)
324 AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian)
325 AM_CONDITIONAL(TARGET_ARCH, test x"$with_distro" = xarch)
326 AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo)
327 AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware)
328
329 AC_DEFINE_UNQUOTED(SPECIAL_DBUS_SERVICE, ["$SPECIAL_DBUS_SERVICE"], [D-Bus service name])
330 AC_DEFINE_UNQUOTED(SPECIAL_SYSLOG_SERVICE, ["$SPECIAL_SYSLOG_SERVICE"], [Syslog service name])
331
332 AC_ARG_WITH([dbuspolicydir],
333         AS_HELP_STRING([--with-dbuspolicydir=DIR], [D-Bus policy directory]),
334         [],
335         [with_dbuspolicydir=`pkg-config --variable=sysconfdir dbus-1`/dbus-1/system.d])
336
337 AC_ARG_WITH([dbussessionservicedir],
338         AS_HELP_STRING([--with-dbussessionservicedir=DIR], [D-Bus session service directory]),
339         [],
340         [with_dbussessionservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`])
341
342 AC_ARG_WITH([dbussystemservicedir],
343         AS_HELP_STRING([--with-dbussystemservicedir=DIR], [D-Bus system service directory]),
344         [],
345         [with_dbussystemservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../system-services])
346
347 AC_ARG_WITH([dbusinterfacedir],
348         AS_HELP_STRING([--with-dbusinterfacedir=DIR], [D-Bus interface directory]),
349         [],
350         [with_dbusinterfacedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../interfaces])
351
352 AC_ARG_WITH([udevrulesdir],
353         AS_HELP_STRING([--with-udevrulesdir=DIR], [Diectory for udev rules]),
354         [],
355         [with_udevrulesdir=`pkg-config --variable=udevdir udev`/rules.d])
356
357 AC_ARG_WITH([pamlibdir],
358         AS_HELP_STRING([--with-pamlibdir=DIR], [Diectory for PAM modules]),
359         [],
360         [with_pamlibdir=/lib/`$CC -print-multi-os-directory`/security])
361
362 AC_ARG_WITH([rootdir],
363         AS_HELP_STRING([--with-rootdir=DIR], [Root directory for files necessary for boot]),
364         [],
365         [with_rootdir=${ac_default_prefix}])
366
367 AC_SUBST([dbuspolicydir], [$with_dbuspolicydir])
368 AC_SUBST([dbussessionservicedir], [$with_dbussessionservicedir])
369 AC_SUBST([dbussystemservicedir], [$with_dbussystemservicedir])
370 AC_SUBST([dbusinterfacedir], [$with_dbusinterfacedir])
371 AC_SUBST([udevrulesdir], [$with_udevrulesdir])
372 AC_SUBST([pamlibdir], [$with_pamlibdir])
373 AC_SUBST([rootdir], [$with_rootdir])
374
375 AC_CONFIG_FILES([Makefile])
376 AC_OUTPUT
377
378 echo "
379         $PACKAGE_NAME $VERSION
380
381         Distribution:            ${with_distro}
382         SysV init scripts:       ${SYSTEM_SYSVINIT_PATH}
383         SysV rc?.d directories:  ${SYSTEM_SYSVRCND_PATH}
384         Syslog service:          ${SPECIAL_SYSLOG_SERVICE}
385         D-Bus service:           ${SPECIAL_DBUS_SERVICE}
386         Gtk:                     ${have_gtk}
387         tcpwrap:                 ${have_tcpwrap}
388         PAM:                     ${have_pam}
389         prefix:                  ${prefix}
390         root dir:                ${with_rootdir}
391         udev rules dir:          ${with_udevrulesdir}
392         pam modules dir:         ${with_pamlibdir}
393         dbus policy dir:         ${with_dbuspolicydir}
394         dbus session dir:        ${with_dbussessionservicedir}
395         dbus system dir:         ${with_dbussystemservicedir}
396         dbus interfaces dir:     ${with_dbusinterfacedir}
397 "