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],[11],[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])
30 AC_DEFINE_UNQUOTED([CANONICAL_HOST], "$host", [Canonical host string.])
32 AM_SILENT_RULES([yes])
34 AC_CHECK_PROG([STOW], [stow], [yes], [no])
36 AS_IF([test "x$STOW" = "xyes" && test -d /usr/local/stow], [
37 AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***])
38 ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}"
48 AC_PROG_GCC_TRADITIONAL
49 AC_USE_SYSTEM_EXTENSIONS
51 CC_CHECK_CFLAGS_APPEND([ \
63 -Wmissing-include-dirs \
65 -Wold-style-definition \
68 -Wdeclaration-after-statement \
70 -Wmissing-prototypes \
73 -Wmissing-declarations \
81 -Wno-overlength-strings \
82 -Wno-unused-parameter \
83 -Wno-missing-field-initializers \
85 -Wp,-D_FORTIFY_SOURCE=2 \
88 -fdiagnostics-show-option \
89 -fno-strict-aliasing \
99 AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([*** POSIX RT library not found])])
100 AC_SEARCH_LIBS([dlsym], [dl], [], [AC_MSG_ERROR([*** Dynamic linking loader library not found])])
101 AC_SEARCH_LIBS([cap_init], [cap], [], [AC_MSG_ERROR([*** POSIX caps library not found])])
102 AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers not found])])
104 # This makes sure pkg.m4 is available.
105 m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
107 PKG_CHECK_MODULES(UDEV, [ libudev >= 160 ])
108 AC_SUBST(UDEV_CFLAGS)
111 PKG_CHECK_MODULES(DBUS, [ dbus-1 >= 1.3.2 ])
112 AC_SUBST(DBUS_CFLAGS)
115 PKG_CHECK_MODULES(DBUSGLIB, [ dbus-glib-1 ])
116 AC_SUBST(DBUSGLIB_CFLAGS)
117 AC_SUBST(DBUSGLIB_LIBS)
120 AC_ARG_ENABLE(selinux, AS_HELP_STRING([--disable-selinux], [Disable optional SELINUX support]))
121 if test "x$enable_selinux" != "xno"; then
122 # not using PKG_CHECK_MODULES as for some reason libselinux didn't
123 # install any pkg-config modules here
124 AC_SEARCH_LIBS([getcon], [selinux],
125 [AC_DEFINE(HAVE_SELINUX, 1, [Define if SELINUX is available]) have_selinux=yes],
127 AC_SUBST(SELINUX_CFLAGS)
128 AC_SUBST(SELINUX_LIBS)
129 if test "x$have_selinux" = xno -a "x$enable_selinux" = xyes; then
130 AC_MSG_ERROR([*** selinux support requested but libraries not found])
133 AM_CONDITIONAL(HAVE_SELINUX, [test "$have_selinux" = "yes"])
135 AC_ARG_ENABLE([tcpwrap],
136 AS_HELP_STRING([--disable-tcpwrap],[Disable optional TCP wrappers support]),
137 [case "${enableval}" in
138 yes) have_tcpwrap=yes ;;
139 no) have_tcpwrap=no ;;
140 *) AC_MSG_ERROR(bad value ${enableval} for --disable-tcpwrap) ;;
144 if test "x${have_tcpwrap}" != xno ; then
146 if test "x${LIBWRAP_LIBS}" = x ; then
147 if test "x$have_tcpwrap" = xyes ; then
148 AC_MSG_ERROR([*** TCP wrappers support not found.])
157 AC_SUBST(LIBWRAP_LIBS)
160 AS_HELP_STRING([--disable-pam],[Disable optional PAM support]),
161 [case "${enableval}" in
164 *) AC_MSG_ERROR(bad value ${enableval} for --disable-pam) ;;
168 if test "x${have_pam}" != xno ; then
170 [security/pam_modules.h security/pam_modutil.h security/pam_ext.h],
172 [if test "x$have_pam" = xyes ; then
173 AC_MSG_ERROR([*** PAM headers not found.])
180 [if test "x$have_pam" = xyes ; then
181 AC_MSG_ERROR([*** libpam not found.])
184 if test "x$have_pam" = xyes ; then
185 PAM_LIBS="-lpam -lpam_misc"
186 AC_DEFINE(HAVE_PAM, 1, [PAM available])
194 AM_CONDITIONAL([HAVE_PAM], [test "x$have_pam" != xno])
196 AC_ARG_ENABLE([audit],
197 AS_HELP_STRING([--disable-audit],[Disable optional AUDIT support]),
198 [case "${enableval}" in
199 yes) have_audit=yes ;;
201 *) AC_MSG_ERROR(bad value ${enableval} for --disable-audit) ;;
205 if test "x${have_audit}" != xno ; then
209 [if test "x$have_audit" = xyes ; then
210 AC_MSG_ERROR([*** AUDIT headers not found.])
217 [if test "x$have_audit" = xyes ; then
218 AC_MSG_ERROR([*** libaudit not found.])
221 if test "x$have_audit" = xyes ; then
223 AC_DEFINE(HAVE_AUDIT, 1, [AUDIT available])
232 have_libcryptsetup=no
233 AC_ARG_ENABLE(libcryptsetup, AS_HELP_STRING([--disable-libcryptsetup], [disable libcryptsetup tools]))
234 if test "x$enable_libcryptsetup" != "xno"; then
235 PKG_CHECK_MODULES(LIBCRYPTSETUP, [ libcryptsetup ],
236 [AC_DEFINE(HAVE_LIBCRYPTSETUP, 1, [Define if libcryptsetup is available]) have_libcryptsetup=yes], have_libcryptsetup=no)
237 AC_SUBST(LIBCRYPTSETUP_CFLAGS)
238 AC_SUBST(LIBCRYPTSETUP_LIBS)
239 if test "x$have_libcryptsetup" = xno -a "x$enable_libcryptsetup" = xyes; then
240 AC_MSG_ERROR([*** libcryptsetup support requested but libraries not found])
243 AM_CONDITIONAL(HAVE_LIBCRYPTSETUP, [test "$have_libcryptsetup" = "yes"])
246 AC_ARG_ENABLE(gtk, AS_HELP_STRING([--disable-gtk], [disable GTK tools]))
247 if test "x$enable_gtk" != "xno"; then
248 PKG_CHECK_MODULES(GTK, [ gtk+-2.0 gio-unix-2.0 libnotify ],
249 [AC_DEFINE(HAVE_GTK, 1, [Define if GTK is available]) have_gtk=yes], have_gtk=no)
252 if test "x$have_gtk" = xno -a "x$enable_gtk" = xyes; then
253 AC_MSG_ERROR([*** gtk support requested but libraries not found])
256 AM_CONDITIONAL(HAVE_GTK, [test "$have_gtk" = "yes"])
260 AM_CONDITIONAL(HAVE_VALAC, test x"$VALAC" != x)
262 AC_PATH_PROG([XSLTPROC], [xsltproc])
263 AM_CONDITIONAL(HAVE_XSLTPROC, test x"$XSLTPROC" != x)
265 AC_PATH_PROG([M4], [m4])
267 AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO],[Specify the distribution to target: One of fedora, suse, debian, ubuntu, arch, gentoo, slackware or other]))
268 if test "z$with_distro" = "z"; then
269 if test "$cross_compiling" = yes; then
270 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)])
272 AC_CHECK_FILE(/etc/redhat-release,with_distro="fedora")
273 AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
274 AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
275 if test "x`lsb_release -is 2>/dev/null`" = "xUbuntu"; then
278 AC_CHECK_FILE(/etc/arch-release,with_distro="arch")
279 AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
280 AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
282 if test "z$with_distro" = "z"; then
283 with_distro=`uname -s`
286 with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
287 AC_DEFINE_UNQUOTED(DISTRIBUTION, ["${with_distro}"], [Target Distribution])
289 # Default generic names
290 SPECIAL_SYSLOG_SERVICE=syslog.service
292 # Location of the init scripts as mandated by LSB
293 SYSTEM_SYSVINIT_PATH=/etc/init.d
299 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
300 SYSTEM_SYSVRCND_PATH=/etc/rc.d
302 # A little background why we define this special unit
303 # names here in configure.ac: SysV services currently
304 # cannot have aliases. As long as syslog is started
305 # via a SysV init script we hence define this name to
306 # the actual SysV name here. Later on when SysV init
307 # scripts are not used anymore it is advisable to use
308 # the generic name instead and use symlinks in the
309 # unit directories to point to the right native unit
312 SPECIAL_SYSLOG_SERVICE=rsyslog.service
313 AC_DEFINE(TARGET_FEDORA, [], [Target is Fedora/RHEL])
314 M4_DISTRO_FLAG=-DTARGET_FEDORA=1
317 SYSTEM_SYSVRCND_PATH=/etc/init.d
318 AC_DEFINE(TARGET_SUSE, [], [Target is openSUSE/SLE])
319 M4_DISTRO_FLAG=-DTARGET_SUSE=1
322 SYSTEM_SYSVRCND_PATH=/etc
323 SPECIAL_SYSLOG_SERVICE=rsyslog.service
324 AC_DEFINE(TARGET_DEBIAN, [], [Target is Debian])
325 M4_DISTRO_FLAG=-DTARGET_DEBIAN=1
328 SYSTEM_SYSVRCND_PATH=/etc
329 SPECIAL_SYSLOG_SERVICE=rsyslog.service
330 AC_DEFINE(TARGET_UBUNTU, [], [Target is Ubuntu])
331 M4_DISTRO_FLAG=-DTARGET_UBUNTU=1
334 SYSTEM_SYSVINIT_PATH=/etc/rc.d
335 SYSTEM_SYSVRCND_PATH=/etc
336 SPECIAL_SYSLOG_SERVICE=syslog-ng.service
337 AC_DEFINE(TARGET_ARCH, [], [Target is ArchLinux])
338 M4_DISTRO_FLAG=-DTARGET_ARCH=1
341 SYSTEM_SYSVINIT_PATH=
342 SYSTEM_SYSVRCND_PATH=
343 SPECIAL_SYSLOG_SERVICE=syslog-ng.service
344 AC_DEFINE(TARGET_GENTOO, [], [Target is Gentoo])
345 M4_DISTRO_FLAG=-DTARGET_GENTOO=1
348 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
349 SYSTEM_SYSVRCND_PATH=/etc/rc.d
350 AC_DEFINE(TARGET_SLACKWARE, [], [Target is Slackware])
351 M4_DISTRO_FLAG=-DTARGET_SLACKWARE=1
354 AS_IF([test "x$with_syslog_service" = "x"],
355 [AC_MSG_ERROR([With --distro=other, you must pass --with-syslog-service= to configure])])
358 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])
362 AC_ARG_WITH([sysvinit-path],
363 [AS_HELP_STRING([--with-sysvinit-path=PATH],
364 [Specify the path to where the SysV init scripts are located @<:@default=based on distro@:>@])],
365 [SYSTEM_SYSVINIT_PATH="$withval"],
368 AC_ARG_WITH([sysvrcd-path],
369 [AS_HELP_STRING([--with-sysvrcd-path=PATH],
370 [Specify the path to the base directory for the SysV rcN.d directories @<:@default=based on distro@:>@])],
371 [SYSTEM_SYSVRCND_PATH="$withval"],
374 AC_ARG_WITH([syslog-service],
375 [AS_HELP_STRING([--with-syslog-service=UNIT],
376 [Specify the name of the special syslog service @<:@default=based on distro@:>@])],
377 [SPECIAL_SYSLOG_SERVICE="$withval"],
380 AC_SUBST(SYSTEM_SYSVINIT_PATH)
381 AC_SUBST(SYSTEM_SYSVRCND_PATH)
382 AC_SUBST(SPECIAL_SYSLOG_SERVICE)
383 AC_SUBST(M4_DISTRO_FLAG)
385 if test "x${SYSTEM_SYSVINIT_PATH}" != "x" -a "x${SYSTEM_SYSVRCND_PATH}" != "x"; then
386 AC_DEFINE(HAVE_SYSV_COMPAT, [], [SysV init scripts and rcN.d links are supported.])
387 SYSTEM_SYSV_COMPAT="yes"
388 elif test "x${SYSTEM_SYSVINIT_PATH}" != "x" -o "x${SYSTEM_SYSVRCND_PATH}" != "x"; then
389 AC_MSG_ERROR([*** You need both --with-sysvinit-path=PATH and --with-sysvrcd-path=PATH to enable SysV compatibility support, or both empty to disable it.])
391 SYSTEM_SYSV_COMPAT="no"
394 AM_CONDITIONAL(TARGET_FEDORA, test x"$with_distro" = xfedora)
395 AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse)
396 AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian)
397 AM_CONDITIONAL(TARGET_UBUNTU, test x"$with_distro" = xubuntu)
398 AM_CONDITIONAL(TARGET_DEBIAN_OR_UBUNTU, test x"$with_distro" = xdebian -o x"$with_distro" = xubuntu)
399 AM_CONDITIONAL(TARGET_ARCH, test x"$with_distro" = xarch)
400 AM_CONDITIONAL(TARGET_GENTOO, test x"$with_distro" = xgentoo)
401 AM_CONDITIONAL(TARGET_SLACKWARE, test x"$with_distro" = xslackware)
403 AC_DEFINE_UNQUOTED(SPECIAL_SYSLOG_SERVICE, ["$SPECIAL_SYSLOG_SERVICE"], [Syslog service name])
405 AC_ARG_WITH([dbuspolicydir],
406 AS_HELP_STRING([--with-dbuspolicydir=DIR], [D-Bus policy directory]),
408 [with_dbuspolicydir=`pkg-config --variable=sysconfdir dbus-1`/dbus-1/system.d])
410 AC_ARG_WITH([dbussessionservicedir],
411 AS_HELP_STRING([--with-dbussessionservicedir=DIR], [D-Bus session service directory]),
413 [with_dbussessionservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`])
415 AC_ARG_WITH([dbussystemservicedir],
416 AS_HELP_STRING([--with-dbussystemservicedir=DIR], [D-Bus system service directory]),
418 [with_dbussystemservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../system-services])
420 AC_ARG_WITH([dbusinterfacedir],
421 AS_HELP_STRING([--with-dbusinterfacedir=DIR], [D-Bus interface directory]),
423 [with_dbusinterfacedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../interfaces])
425 AC_ARG_WITH([udevrulesdir],
426 AS_HELP_STRING([--with-udevrulesdir=DIR], [Diectory for udev rules]),
428 [with_udevrulesdir=`pkg-config --variable=udevdir udev`/rules.d])
430 AC_ARG_WITH([pamlibdir],
431 AS_HELP_STRING([--with-pamlibdir=DIR], [Diectory for PAM modules]),
433 [with_pamlibdir=/lib/`$CC -print-multi-os-directory`/security])
435 AC_ARG_WITH([rootdir],
436 AS_HELP_STRING([--with-rootdir=DIR], [Root directory for files necessary for boot]),
438 [with_rootdir=${ac_default_prefix}])
440 AC_SUBST([dbuspolicydir], [$with_dbuspolicydir])
441 AC_SUBST([dbussessionservicedir], [$with_dbussessionservicedir])
442 AC_SUBST([dbussystemservicedir], [$with_dbussystemservicedir])
443 AC_SUBST([dbusinterfacedir], [$with_dbusinterfacedir])
444 AC_SUBST([udevrulesdir], [$with_udevrulesdir])
445 AC_SUBST([pamlibdir], [$with_pamlibdir])
446 AC_SUBST([rootdir], [$with_rootdir])
448 AC_CONFIG_FILES([Makefile])
452 $PACKAGE_NAME $VERSION
454 Distribution: ${with_distro}
455 SysV compatibility: ${SYSTEM_SYSV_COMPAT}
456 SysV init scripts: ${SYSTEM_SYSVINIT_PATH}
457 SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH}
458 Syslog service: ${SPECIAL_SYSLOG_SERVICE}
460 libcryptsetup: ${have_libcryptsetup}
461 tcpwrap: ${have_tcpwrap}
464 SELinux: ${have_selinux}
466 root dir: ${with_rootdir}
467 udev rules dir: ${with_udevrulesdir}
468 pam modules dir: ${with_pamlibdir}
469 dbus policy dir: ${with_dbuspolicydir}
470 dbus session dir: ${with_dbussessionservicedir}
471 dbus system dir: ${with_dbussystemservicedir}
472 dbus interfaces dir: ${with_dbusinterfacedir}