1 # This file is part of systemd.
3 # Copyright 2010 Lennart Poettering
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.
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.
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/>.
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])
25 AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules tar-pax subdir-objects dist-bzip2])
27 AC_SUBST(PACKAGE_URL, [http://www.freedesktop.org/wiki/Software/systemd])
31 AM_SILENT_RULES([yes])
33 AC_CHECK_PROG([STOW], [stow], [yes], [no])
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}"
47 AC_PROG_GCC_TRADITIONAL
48 AC_USE_SYSTEM_EXTENSIONS
50 CC_CHECK_CFLAGS_APPEND([ \
58 -Wno-overlength-strings \
64 -Wmissing-include-dirs \
66 -Wold-style-definition \
69 -Wdeclaration-after-statement \
71 -Wmissing-prototypes \
74 -Wmissing-declarations \
81 -Wno-unused-parameter \
83 -Wp,-D_FORTIFY_SOURCE=2 \
85 -fdiagnostics-show-option \
86 -Wno-missing-field-initializers])
88 AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([*** POSIX RT library not found])])
89 AC_SEARCH_LIBS([cap_init], [cap], [], [AC_MSG_ERROR([*** POSIX caps library not found])])
90 AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers not found])])
92 # This makes sure pkg.m4 is available.
93 m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
95 PKG_CHECK_MODULES(UDEV, [ libudev >= 154 ])
99 PKG_CHECK_MODULES(DBUS, [ dbus-1 ])
100 AC_SUBST(DBUS_CFLAGS)
103 PKG_CHECK_MODULES(DBUSGLIB, [ dbus-glib-1 ])
104 AC_SUBST(DBUSGLIB_CFLAGS)
105 AC_SUBST(DBUSGLIB_LIBS)
107 PKG_CHECK_MODULES(CGROUP, [ libcgroup >= 0.36 ])
108 AC_SUBST(CGROUP_CFLAGS)
109 AC_SUBST(CGROUP_LIBS)
111 AC_ARG_ENABLE([tcpwrap],
112 AS_HELP_STRING([--disable-tcpwrap],[Disable optional TCP wrappers support]),
113 [case "${enableval}" in
114 yes) have_tcpwrap=yes ;;
115 no) have_tcpwrap=no ;;
116 *) AC_MSG_ERROR(bad value ${enableval} for --disable-tcpwrap) ;;
120 if test "x${have_tcpwrap}" != xno ; then
122 if test "x${LIBWRAP_LIBS}" = x ; then
123 if test "x$have_tcpwrap" = xyes ; then
124 AC_MSG_ERROR([*** TCP wrappers support not found.])
132 AC_SUBST(LIBWRAP_LIBS)
135 AS_HELP_STRING([--disable-pam],[Disable optional PAM support]),
136 [case "${enableval}" in
139 *) AC_MSG_ERROR(bad value ${enableval} for --disable-pam) ;;
143 if test "x${have_pam}" != xno ; then
145 [security/pam_modules.h security/pam_modutil.h security/pam_ext.h],
147 [if test "x$have_pam" = xyes ; then
148 AC_MSG_ERROR([*** PAM headers not found.])
155 [if test "x$have_pam" = xyes ; then
156 AC_MSG_ERROR([*** libpam not found.])
159 if test "x$have_pam" = xyes ; then
160 PAM_LIBS="-lpam -lpam_misc"
161 AC_DEFINE(HAVE_PAM, 1, [PAM available])
167 AM_CONDITIONAL([HAVE_PAM], [test "x$have_pam" != xno])
170 AC_ARG_ENABLE(gtk, AS_HELP_STRING([--disable-gtk], [disable GTK tools]))
171 if test "x$enable_gtk" != "xno"; then
172 PKG_CHECK_MODULES(GTK, [ gtk+-2.0 ],
173 [AC_DEFINE(HAVE_GTK, 1, [Define if GTK is available]) have_gtk=yes], have_gtk=no)
176 if test "x$have_gtk" = xno -a "x$enable_gtk" = xyes; then
177 AC_MSG_ERROR([*** gtk support requested but libraries not found])
180 AM_CONDITIONAL(HAVE_GTK, [test "$have_gtk" = "yes"])
184 AM_CONDITIONAL(HAVE_VALAC, test x"$VALAC" != x)
186 AC_PATH_PROG([XSLTPROC], [xsltproc])
187 AM_CONDITIONAL(HAVE_XSLTPROC, test x"$XSLTPROC" != x)
189 AC_PATH_PROG([M4], [m4])
191 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]))
192 if test "z$with_distro" = "z"; then
193 if test "$cross_compiling" = yes; then
194 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)])
196 AC_CHECK_FILE(/etc/redhat-release,with_distro="fedora")
197 AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
198 AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
199 AC_CHECK_FILE(/etc/arch-release,with_distro="arch")
200 AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
201 AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
203 if test "z$with_distro" = "z"; then
204 with_distro=`uname -s`
207 with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
209 # Default generic names
210 SPECIAL_DBUS_SERVICE=dbus.service
211 SPECIAL_SYSLOG_SERVICE=syslog.service
213 # Location of the init scripts as mandated by LSB
214 SYSTEM_SYSVINIT_PATH=/etc/init.d
220 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
221 SYSTEM_SYSVRCND_PATH=/etc/rc.d
223 # A little background why we define these special unit
224 # names here in configure.ac: SysV services currently
225 # cannot have aliases. As long as syslog is started
226 # via a SysV init script we hence define these names
227 # to the actual SysV name here. Later on when SysV
228 # init scripts are not used anymore it is advisable to
229 # use the generic names instead and use symlinks in
230 # the unit directories to point to the right native
233 SPECIAL_DBUS_SERVICE=messagebus.service
234 SPECIAL_SYSLOG_SERVICE=rsyslog.service
235 AC_DEFINE(TARGET_FEDORA, [], [Target is Fedora/RHEL])
236 M4_DISTRO_FLAG=-DTARGET_FEDORA=1
239 SYSTEM_SYSVRCND_PATH=/etc/init.d
240 AC_DEFINE(TARGET_SUSE, [], [Target is OpenSUSE/SLE])
241 M4_DISTRO_FLAG=-DTARGET_SUSE=1
244 SYSTEM_SYSVRCND_PATH=/etc
245 SPECIAL_SYSLOG_SERVICE=rsyslog.service
246 AC_DEFINE(TARGET_DEBIAN, [], [Target is Debian/Ubuntu])
247 M4_DISTRO_FLAG=-DTARGET_DEBIAN=1
250 SYSTEM_SYSVINIT_PATH=/etc/rc.d
251 SYSTEM_SYSVRCND_PATH=/etc
252 SPECIAL_SYSLOG_SERVICE=syslog-ng.service
253 AC_DEFINE(TARGET_ARCH, [], [Target is ArchLinux])
254 M4_DISTRO_FLAG=-DTARGET_ARCH=1
257 SYSTEM_SYSVRCND_PATH=/etc
258 SPECIAL_SYSLOG_SERVICE=syslog-ng.service
259 AC_DEFINE(TARGET_GENTOO, [], [Target is Gentoo])
260 M4_DISTRO_FLAG=-DTARGET_GENTOO=1
263 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
264 SYSTEM_SYSVRCND_PATH=/etc/rc.d
265 SPECIAL_DBUS_SERVICE=messagebus.service
266 AC_DEFINE(TARGET_SLACKWARE, [], [Target is Slackware])
267 M4_DISTRO_FLAG=-DTARGET_SLACKWARE=1
270 AS_IF([test "x$with_sysvinit_path" = "x"],
271 [AC_MSG_ERROR([With --distro=other, you must pass --with-sysvinit-path= to configure])])
272 AS_IF([test "x$with_sysvrcd_path" = "x"],
273 [AC_MSG_ERROR([With --distro=other, you must pass --with-sysvrcd-path= to configure])])
274 AS_IF([test "x$with_dbus_service" = "x"],
275 [AC_MSG_ERROR([With --distro=other, you must pass --with-dbus-service= to configure])])
276 AS_IF([test "x$with_syslog_service" = "x"],
277 [AC_MSG_ERROR([With --distro=other, you must pass --with-syslog-service= to configure])])
280 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])
284 AC_ARG_WITH([sysvinit-path],
285 [AS_HELP_STRING([--with-sysvinit-path=PATH],
286 [Specify the path to where the SysV init scripts are located @<:@default=based on distro@:>@])],
287 [SYSTEM_SYSVINIT_PATH="$withval"],
290 AC_ARG_WITH([sysvrcd-path],
291 [AS_HELP_STRING([--with-sysvrcd-path=PATH],
292 [Specify the path to the base directory for the SysV rcN.d directories @<:@default=based on distro@:>@])],
293 [SYSTEM_SYSVRCND_PATH="$withval"],
296 AC_ARG_WITH([dbus-service],
297 [AS_HELP_STRING([--with-dbus-service=UNIT],
298 [Specify the name of the special DBus service @<:@default=based on distro@:>@])],
299 [SPECIAL_DBUS_SERVICE="$withval"],
302 AC_ARG_WITH([syslog-service],
303 [AS_HELP_STRING([--with-syslog-service=UNIT],
304 [Specify the name of the special syslog service @<:@default=based on distro@:>@])],
305 [SPECIAL_SYSLOG_SERVICE="$withval"],
308 AC_SUBST(SYSTEM_SYSVINIT_PATH)
309 AC_SUBST(SYSTEM_SYSVRCND_PATH)
310 AC_SUBST(SPECIAL_DBUS_SERVICE)
311 AC_SUBST(SPECIAL_SYSLOG_SERVICE)
312 AC_SUBST(M4_DISTRO_FLAG)
314 AM_CONDITIONAL(TARGET_FEDORA, test x"$with_distro" = xfedora)
315 AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse)
316 AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian)
317 AM_CONDITIONAL(TARGET_ARCH, test x"$with_distro" = xarch)
318 AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo)
319 AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware)
321 AC_DEFINE_UNQUOTED(SPECIAL_DBUS_SERVICE, ["$SPECIAL_DBUS_SERVICE"], [D-Bus service name])
322 AC_DEFINE_UNQUOTED(SPECIAL_SYSLOG_SERVICE, ["$SPECIAL_SYSLOG_SERVICE"], [Syslog service name])
324 AC_ARG_WITH([dbuspolicydir],
325 AS_HELP_STRING([--with-dbuspolicydir=DIR], [D-Bus policy directory]),
327 [with_dbuspolicydir=`pkg-config --variable=sysconfdir dbus-1`/dbus-1/system.d])
329 AC_ARG_WITH([dbussessionservicedir],
330 AS_HELP_STRING([--with-dbussessionservicedir=DIR], [D-Bus session service directory]),
332 [with_dbussessionservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`])
334 AC_ARG_WITH([dbussystemservicedir],
335 AS_HELP_STRING([--with-dbussystemservicedir=DIR], [D-Bus system service directory]),
337 [with_dbussystemservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../system-services])
339 AC_ARG_WITH([dbusinterfacedir],
340 AS_HELP_STRING([--with-dbusinterfacedir=DIR], [D-Bus interface directory]),
342 [with_dbusinterfacedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../interfaces])
344 AC_ARG_WITH([udevrulesdir],
345 AS_HELP_STRING([--with-udevrulesdir=DIR], [Diectory for udev rules]),
347 [with_udevrulesdir=/lib/udev/rules.d])
349 AC_ARG_WITH([rootdir],
350 AS_HELP_STRING([--with-rootdir=DIR], [Root directory for files necessary for boot]),
352 [with_rootdir=${ac_default_prefix}])
354 AC_SUBST([dbuspolicydir], [$with_dbuspolicydir])
355 AC_SUBST([dbussessionservicedir], [$with_dbussessionservicedir])
356 AC_SUBST([dbussystemservicedir], [$with_dbussystemservicedir])
357 AC_SUBST([dbusinterfacedir], [$with_dbusinterfacedir])
358 AC_SUBST([udevrulesdir], [$with_udevrulesdir])
359 AC_SUBST([rootdir], [$with_rootdir])
361 AC_CONFIG_FILES([Makefile])
365 $PACKAGE_NAME $VERSION
367 Distribution: ${with_distro}
368 SysV init scripts: ${SYSTEM_SYSVINIT_PATH}
369 SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH}
370 Syslog service: ${SPECIAL_SYSLOG_SERVICE}
371 D-Bus service: ${SPECIAL_DBUS_SERVICE}
373 tcpwrap: ${have_tcpwrap}
376 root dir: ${with_rootdir}
377 udev rules dir: ${with_udevrulesdir}
378 dbus policy dir: ${with_dbuspolicydir}
379 dbus session dir: ${with_dbussessionservicedir}
380 dbus system dir: ${with_dbussystemservicedir}
381 dbus interfaces dir: ${with_dbusinterfacedir}