chiark / gitweb /
fix --nonet calls to xsltproc
[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         -Wp,-D_FORTIFY_SOURCE=2 \
84         -ffast-math \
85         -fno-common \
86         -fdiagnostics-show-option \
87         -fno-strict-aliasing])
88
89 AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([*** POSIX RT library not found])])
90 AC_SEARCH_LIBS([cap_init], [cap], [], [AC_MSG_ERROR([*** POSIX caps library not found])])
91 AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers not found])])
92
93 # This makes sure pkg.m4 is available.
94 m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
95
96 PKG_CHECK_MODULES(UDEV, [ libudev >= 154 ])
97 AC_SUBST(UDEV_CFLAGS)
98 AC_SUBST(UDEV_LIBS)
99
100 PKG_CHECK_MODULES(DBUS, [ dbus-1 ])
101 AC_SUBST(DBUS_CFLAGS)
102 AC_SUBST(DBUS_LIBS)
103
104 PKG_CHECK_MODULES(DBUSGLIB, [ dbus-glib-1 ])
105 AC_SUBST(DBUSGLIB_CFLAGS)
106 AC_SUBST(DBUSGLIB_LIBS)
107
108 PKG_CHECK_MODULES(CGROUP, [ libcgroup >= 0.36 ])
109 AC_SUBST(CGROUP_CFLAGS)
110 AC_SUBST(CGROUP_LIBS)
111
112 AC_ARG_ENABLE([tcpwrap],
113         AS_HELP_STRING([--disable-tcpwrap],[Disable optional TCP wrappers support]),
114                 [case "${enableval}" in
115                         yes) have_tcpwrap=yes ;;
116                         no) have_tcpwrap=no ;;
117                         *) AC_MSG_ERROR(bad value ${enableval} for --disable-tcpwrap) ;;
118                 esac],
119                 [have_tcpwrap=auto])
120
121 if test "x${have_tcpwrap}" != xno ; then
122         ACX_LIBWRAP
123         if test "x${LIBWRAP_LIBS}" = x ; then
124                 if test "x$have_tcpwrap" = xyes ; then
125                         AC_MSG_ERROR([*** TCP wrappers support not found.])
126                 fi
127                 have_tcpwrap=no
128         else
129                 have_tcpwrap=yes
130         fi
131 else
132         LIBWRAP_LIBS=
133 fi
134 AC_SUBST(LIBWRAP_LIBS)
135
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])
164         else
165                 have_pam=no
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
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
186 AM_PROG_VALAC([0.8])
187 AC_SUBST(VAPIDIR)
188 AM_CONDITIONAL(HAVE_VALAC, test x"$VALAC" != x)
189
190 AC_PATH_PROG([XSLTPROC], [xsltproc])
191 AM_CONDITIONAL(HAVE_XSLTPROC, test x"$XSLTPROC" != x)
192
193 AC_PATH_PROG([M4], [m4])
194
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]))
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")
203                 AC_CHECK_FILE(/etc/arch-release,with_distro="arch")
204                 AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
205                 AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
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
213 # Default generic names
214 SPECIAL_DBUS_SERVICE=dbus.service
215 SPECIAL_SYSLOG_SERVICE=syslog.service
216
217 # Location of the init scripts as mandated by LSB
218 SYSTEM_SYSVINIT_PATH=/etc/init.d
219
220 M4_DISTRO_FLAG=
221
222 case $with_distro in
223         fedora)
224                 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
225                 SYSTEM_SYSVRCND_PATH=/etc/rc.d
226
227                 # A little background why we define these special unit
228                 # names here in configure.ac: SysV services currently
229                 # cannot have aliases. As long as syslog is started
230                 # via a SysV init script we hence define these names
231                 # to the actual SysV name here. Later on when SysV
232                 # init scripts are not used anymore it is advisable to
233                 # use the generic names instead and use symlinks in
234                 # the unit directories to point to the right native
235                 # unit file.
236
237                 SPECIAL_DBUS_SERVICE=messagebus.service
238                 SPECIAL_SYSLOG_SERVICE=rsyslog.service
239                 AC_DEFINE(TARGET_FEDORA, [], [Target is Fedora/RHEL])
240                 M4_DISTRO_FLAG=-DTARGET_FEDORA=1
241                 ;;
242         suse)
243                 SYSTEM_SYSVRCND_PATH=/etc/init.d
244                 AC_DEFINE(TARGET_SUSE, [], [Target is openSUSE/SLE])
245                 M4_DISTRO_FLAG=-DTARGET_SUSE=1
246                 ;;
247         debian)
248                 SYSTEM_SYSVRCND_PATH=/etc
249                 SPECIAL_SYSLOG_SERVICE=rsyslog.service
250                 AC_DEFINE(TARGET_DEBIAN, [], [Target is Debian/Ubuntu])
251                 M4_DISTRO_FLAG=-DTARGET_DEBIAN=1
252                 ;;
253         arch)
254                 SYSTEM_SYSVINIT_PATH=/etc/rc.d
255                 SYSTEM_SYSVRCND_PATH=/etc
256                 SPECIAL_SYSLOG_SERVICE=syslog-ng.service
257                 AC_DEFINE(TARGET_ARCH, [], [Target is ArchLinux])
258                 M4_DISTRO_FLAG=-DTARGET_ARCH=1
259                 ;;
260         gentoo)
261                 SYSTEM_SYSVRCND_PATH=/etc
262                 SPECIAL_SYSLOG_SERVICE=syslog-ng.service
263                 AC_DEFINE(TARGET_GENTOO, [], [Target is Gentoo])
264                 M4_DISTRO_FLAG=-DTARGET_GENTOO=1
265                 ;;
266         slackware)
267                 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
268                 SYSTEM_SYSVRCND_PATH=/etc/rc.d
269                 SPECIAL_DBUS_SERVICE=messagebus.service
270                 AC_DEFINE(TARGET_SLACKWARE, [], [Target is Slackware])
271                 M4_DISTRO_FLAG=-DTARGET_SLACKWARE=1
272                 ;;
273         other)
274                 AS_IF([test "x$with_sysvinit_path" = "x"],
275                         [AC_MSG_ERROR([With --distro=other, you must pass --with-sysvinit-path= to configure])])
276                 AS_IF([test "x$with_sysvrcd_path" = "x"],
277                         [AC_MSG_ERROR([With --distro=other, you must pass --with-sysvrcd-path= to configure])])
278                 AS_IF([test "x$with_dbus_service" = "x"],
279                         [AC_MSG_ERROR([With --distro=other, you must pass --with-dbus-service= to configure])])
280                 AS_IF([test "x$with_syslog_service" = "x"],
281                         [AC_MSG_ERROR([With --distro=other, you must pass --with-syslog-service= to configure])])
282                 ;;
283         *)
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])
285                 ;;
286 esac
287
288 AC_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
294 AC_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
300 AC_ARG_WITH([dbus-service],
301         [AS_HELP_STRING([--with-dbus-service=UNIT],
302                 [Specify the name of the special DBus service @<:@default=based on distro@:>@])],
303         [SPECIAL_DBUS_SERVICE="$withval"],
304         [])
305
306 AC_ARG_WITH([syslog-service],
307         [AS_HELP_STRING([--with-syslog-service=UNIT],
308                 [Specify the name of the special syslog service @<:@default=based on distro@:>@])],
309         [SPECIAL_SYSLOG_SERVICE="$withval"],
310         [])
311
312 AC_SUBST(SYSTEM_SYSVINIT_PATH)
313 AC_SUBST(SYSTEM_SYSVRCND_PATH)
314 AC_SUBST(SPECIAL_DBUS_SERVICE)
315 AC_SUBST(SPECIAL_SYSLOG_SERVICE)
316 AC_SUBST(M4_DISTRO_FLAG)
317
318 AM_CONDITIONAL(TARGET_FEDORA, test x"$with_distro" = xfedora)
319 AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse)
320 AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian)
321 AM_CONDITIONAL(TARGET_ARCH, test x"$with_distro" = xarch)
322 AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo)
323 AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware)
324
325 AC_DEFINE_UNQUOTED(SPECIAL_DBUS_SERVICE, ["$SPECIAL_DBUS_SERVICE"], [D-Bus service name])
326 AC_DEFINE_UNQUOTED(SPECIAL_SYSLOG_SERVICE, ["$SPECIAL_SYSLOG_SERVICE"], [Syslog service name])
327
328 AC_ARG_WITH([dbuspolicydir],
329         AS_HELP_STRING([--with-dbuspolicydir=DIR], [D-Bus policy directory]),
330         [],
331         [with_dbuspolicydir=`pkg-config --variable=sysconfdir dbus-1`/dbus-1/system.d])
332
333 AC_ARG_WITH([dbussessionservicedir],
334         AS_HELP_STRING([--with-dbussessionservicedir=DIR], [D-Bus session service directory]),
335         [],
336         [with_dbussessionservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`])
337
338 AC_ARG_WITH([dbussystemservicedir],
339         AS_HELP_STRING([--with-dbussystemservicedir=DIR], [D-Bus system service directory]),
340         [],
341         [with_dbussystemservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../system-services])
342
343 AC_ARG_WITH([dbusinterfacedir],
344         AS_HELP_STRING([--with-dbusinterfacedir=DIR], [D-Bus interface directory]),
345         [],
346         [with_dbusinterfacedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../interfaces])
347
348 AC_ARG_WITH([udevrulesdir],
349         AS_HELP_STRING([--with-udevrulesdir=DIR], [Diectory for udev rules]),
350         [],
351         [with_udevrulesdir=/lib/udev/rules.d])
352
353 AC_ARG_WITH([rootdir],
354         AS_HELP_STRING([--with-rootdir=DIR], [Root directory for files necessary for boot]),
355         [],
356         [with_rootdir=${ac_default_prefix}])
357
358 AC_SUBST([dbuspolicydir], [$with_dbuspolicydir])
359 AC_SUBST([dbussessionservicedir], [$with_dbussessionservicedir])
360 AC_SUBST([dbussystemservicedir], [$with_dbussystemservicedir])
361 AC_SUBST([dbusinterfacedir], [$with_dbusinterfacedir])
362 AC_SUBST([udevrulesdir], [$with_udevrulesdir])
363 AC_SUBST([rootdir], [$with_rootdir])
364
365 AC_CONFIG_FILES([Makefile])
366 AC_OUTPUT
367
368 echo "
369         $PACKAGE_NAME $VERSION
370
371         Distribution:            ${with_distro}
372         SysV init scripts:       ${SYSTEM_SYSVINIT_PATH}
373         SysV rc?.d directories:  ${SYSTEM_SYSVRCND_PATH}
374         Syslog service:          ${SPECIAL_SYSLOG_SERVICE}
375         D-Bus service:           ${SPECIAL_DBUS_SERVICE}
376         Gtk:                     ${have_gtk}
377         tcpwrap:                 ${have_tcpwrap}
378         PAM:                     ${have_pam}
379         prefix:                  ${prefix}
380         root dir:                ${with_rootdir}
381         udev rules dir:          ${with_udevrulesdir}
382         dbus policy dir:         ${with_dbuspolicydir}
383         dbus session dir:        ${with_dbussessionservicedir}
384         dbus system dir:         ${with_dbussystemservicedir}
385         dbus interfaces dir:     ${with_dbusinterfacedir}
386 "