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],[4],[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([ \
62 -Wmissing-include-dirs \
64 -Wold-style-definition \
67 -Wdeclaration-after-statement \
69 -Wmissing-prototypes \
72 -Wmissing-declarations \
80 -Wno-overlength-strings \
81 -Wno-unused-parameter \
82 -Wno-missing-field-initializers \
84 -Wp,-D_FORTIFY_SOURCE=2 \
87 -fdiagnostics-show-option \
88 -fno-strict-aliasing])
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])])
97 # This makes sure pkg.m4 is available.
98 m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
100 PKG_CHECK_MODULES(UDEV, [ libudev >= 160 ])
101 AC_SUBST(UDEV_CFLAGS)
104 PKG_CHECK_MODULES(DBUS, [ dbus-1 >= 1.3.2 ])
105 AC_SUBST(DBUS_CFLAGS)
108 PKG_CHECK_MODULES(DBUSGLIB, [ dbus-glib-1 ])
109 AC_SUBST(DBUSGLIB_CFLAGS)
110 AC_SUBST(DBUSGLIB_LIBS)
113 AC_ARG_ENABLE(selinux, AS_HELP_STRING([--disable-selinux], [Disable optional SELINUX support]))
114 if test "x$enable_selinux" != "xno"; then
115 # not using PKG_CHECK_MODULES as for some reason libselinux didn't
116 # install any pkg-config modules here
117 AC_SEARCH_LIBS([getcon], [selinux],
118 [AC_DEFINE(HAVE_SELINUX, 1, [Define if SELINUX is available]) have_selinux=yes],
120 AC_SUBST(SELINUX_CFLAGS)
121 AC_SUBST(SELINUX_LIBS)
122 if test "x$have_selinux" = xno -a "x$enable_selinux" = xyes; then
123 AC_MSG_ERROR([*** selinux support requested but libraries not found])
126 AM_CONDITIONAL(HAVE_SELINUX, [test "$have_selinux" = "yes"])
128 AC_ARG_ENABLE([tcpwrap],
129 AS_HELP_STRING([--disable-tcpwrap],[Disable optional TCP wrappers support]),
130 [case "${enableval}" in
131 yes) have_tcpwrap=yes ;;
132 no) have_tcpwrap=no ;;
133 *) AC_MSG_ERROR(bad value ${enableval} for --disable-tcpwrap) ;;
137 if test "x${have_tcpwrap}" != xno ; then
139 if test "x${LIBWRAP_LIBS}" = x ; then
140 if test "x$have_tcpwrap" = xyes ; then
141 AC_MSG_ERROR([*** TCP wrappers support not found.])
150 AC_SUBST(LIBWRAP_LIBS)
153 AS_HELP_STRING([--disable-pam],[Disable optional PAM support]),
154 [case "${enableval}" in
157 *) AC_MSG_ERROR(bad value ${enableval} for --disable-pam) ;;
161 if test "x${have_pam}" != xno ; then
163 [security/pam_modules.h security/pam_modutil.h security/pam_ext.h],
165 [if test "x$have_pam" = xyes ; then
166 AC_MSG_ERROR([*** PAM headers not found.])
173 [if test "x$have_pam" = xyes ; then
174 AC_MSG_ERROR([*** libpam not found.])
177 if test "x$have_pam" = xyes ; then
178 PAM_LIBS="-lpam -lpam_misc"
179 AC_DEFINE(HAVE_PAM, 1, [PAM available])
187 AM_CONDITIONAL([HAVE_PAM], [test "x$have_pam" != xno])
190 AC_ARG_ENABLE(gtk, AS_HELP_STRING([--disable-gtk], [disable GTK tools]))
191 if test "x$enable_gtk" != "xno"; then
192 PKG_CHECK_MODULES(GTK, [ gtk+-2.0 ],
193 [AC_DEFINE(HAVE_GTK, 1, [Define if GTK is available]) have_gtk=yes], have_gtk=no)
196 if test "x$have_gtk" = xno -a "x$enable_gtk" = xyes; then
197 AC_MSG_ERROR([*** gtk support requested but libraries not found])
200 AM_CONDITIONAL(HAVE_GTK, [test "$have_gtk" = "yes"])
204 AM_CONDITIONAL(HAVE_VALAC, test x"$VALAC" != x)
206 AC_PATH_PROG([XSLTPROC], [xsltproc])
207 AM_CONDITIONAL(HAVE_XSLTPROC, test x"$XSLTPROC" != x)
209 AC_PATH_PROG([M4], [m4])
211 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]))
212 if test "z$with_distro" = "z"; then
213 if test "$cross_compiling" = yes; then
214 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)])
216 AC_CHECK_FILE(/etc/redhat-release,with_distro="fedora")
217 AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
218 AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
219 AC_CHECK_FILE(/etc/arch-release,with_distro="arch")
220 AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
221 AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
223 if test "z$with_distro" = "z"; then
224 with_distro=`uname -s`
227 with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
229 # Default generic names
230 SPECIAL_SYSLOG_SERVICE=syslog.service
232 # Location of the init scripts as mandated by LSB
233 SYSTEM_SYSVINIT_PATH=/etc/init.d
239 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
240 SYSTEM_SYSVRCND_PATH=/etc/rc.d
242 # A little background why we define this special unit
243 # names here in configure.ac: SysV services currently
244 # cannot have aliases. As long as syslog is started
245 # via a SysV init script we hence define this name to
246 # the actual SysV name here. Later on when SysV init
247 # scripts are not used anymore it is advisable to use
248 # the generic name instead and use symlinks in the
249 # unit directories to point to the right native unit
252 SPECIAL_SYSLOG_SERVICE=rsyslog.service
253 AC_DEFINE(TARGET_FEDORA, [], [Target is Fedora/RHEL])
254 M4_DISTRO_FLAG=-DTARGET_FEDORA=1
257 SYSTEM_SYSVRCND_PATH=/etc/init.d
258 AC_DEFINE(TARGET_SUSE, [], [Target is openSUSE/SLE])
259 M4_DISTRO_FLAG=-DTARGET_SUSE=1
262 SYSTEM_SYSVRCND_PATH=/etc
263 SPECIAL_SYSLOG_SERVICE=rsyslog.service
264 AC_DEFINE(TARGET_DEBIAN, [], [Target is Debian/Ubuntu])
265 M4_DISTRO_FLAG=-DTARGET_DEBIAN=1
268 SYSTEM_SYSVINIT_PATH=/etc/rc.d
269 SYSTEM_SYSVRCND_PATH=/etc
270 SPECIAL_SYSLOG_SERVICE=syslog-ng.service
271 AC_DEFINE(TARGET_ARCH, [], [Target is ArchLinux])
272 M4_DISTRO_FLAG=-DTARGET_ARCH=1
275 SYSTEM_SYSVRCND_PATH=/etc
276 SPECIAL_SYSLOG_SERVICE=syslog-ng.service
277 AC_DEFINE(TARGET_GENTOO, [], [Target is Gentoo])
278 M4_DISTRO_FLAG=-DTARGET_GENTOO=1
281 SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
282 SYSTEM_SYSVRCND_PATH=/etc/rc.d
283 AC_DEFINE(TARGET_SLACKWARE, [], [Target is Slackware])
284 M4_DISTRO_FLAG=-DTARGET_SLACKWARE=1
287 AS_IF([test "x$with_sysvinit_path" = "x"],
288 [AC_MSG_ERROR([With --distro=other, you must pass --with-sysvinit-path= to configure])])
289 AS_IF([test "x$with_sysvrcd_path" = "x"],
290 [AC_MSG_ERROR([With --distro=other, you must pass --with-sysvrcd-path= to configure])])
291 AS_IF([test "x$with_syslog_service" = "x"],
292 [AC_MSG_ERROR([With --distro=other, you must pass --with-syslog-service= to configure])])
295 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])
299 AC_ARG_WITH([sysvinit-path],
300 [AS_HELP_STRING([--with-sysvinit-path=PATH],
301 [Specify the path to where the SysV init scripts are located @<:@default=based on distro@:>@])],
302 [SYSTEM_SYSVINIT_PATH="$withval"],
305 AC_ARG_WITH([sysvrcd-path],
306 [AS_HELP_STRING([--with-sysvrcd-path=PATH],
307 [Specify the path to the base directory for the SysV rcN.d directories @<:@default=based on distro@:>@])],
308 [SYSTEM_SYSVRCND_PATH="$withval"],
311 AC_ARG_WITH([syslog-service],
312 [AS_HELP_STRING([--with-syslog-service=UNIT],
313 [Specify the name of the special syslog service @<:@default=based on distro@:>@])],
314 [SPECIAL_SYSLOG_SERVICE="$withval"],
317 AC_SUBST(SYSTEM_SYSVINIT_PATH)
318 AC_SUBST(SYSTEM_SYSVRCND_PATH)
319 AC_SUBST(SPECIAL_SYSLOG_SERVICE)
320 AC_SUBST(M4_DISTRO_FLAG)
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)
329 AC_DEFINE_UNQUOTED(SPECIAL_SYSLOG_SERVICE, ["$SPECIAL_SYSLOG_SERVICE"], [Syslog service name])
331 AC_ARG_WITH([dbuspolicydir],
332 AS_HELP_STRING([--with-dbuspolicydir=DIR], [D-Bus policy directory]),
334 [with_dbuspolicydir=`pkg-config --variable=sysconfdir dbus-1`/dbus-1/system.d])
336 AC_ARG_WITH([dbussessionservicedir],
337 AS_HELP_STRING([--with-dbussessionservicedir=DIR], [D-Bus session service directory]),
339 [with_dbussessionservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`])
341 AC_ARG_WITH([dbussystemservicedir],
342 AS_HELP_STRING([--with-dbussystemservicedir=DIR], [D-Bus system service directory]),
344 [with_dbussystemservicedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../system-services])
346 AC_ARG_WITH([dbusinterfacedir],
347 AS_HELP_STRING([--with-dbusinterfacedir=DIR], [D-Bus interface directory]),
349 [with_dbusinterfacedir=`pkg-config --variable=session_bus_services_dir dbus-1`/../interfaces])
351 AC_ARG_WITH([udevrulesdir],
352 AS_HELP_STRING([--with-udevrulesdir=DIR], [Diectory for udev rules]),
354 [with_udevrulesdir=`pkg-config --variable=udevdir udev`/rules.d])
356 AC_ARG_WITH([pamlibdir],
357 AS_HELP_STRING([--with-pamlibdir=DIR], [Diectory for PAM modules]),
359 [with_pamlibdir=/lib/`$CC -print-multi-os-directory`/security])
361 AC_ARG_WITH([rootdir],
362 AS_HELP_STRING([--with-rootdir=DIR], [Root directory for files necessary for boot]),
364 [with_rootdir=${ac_default_prefix}])
366 AC_SUBST([dbuspolicydir], [$with_dbuspolicydir])
367 AC_SUBST([dbussessionservicedir], [$with_dbussessionservicedir])
368 AC_SUBST([dbussystemservicedir], [$with_dbussystemservicedir])
369 AC_SUBST([dbusinterfacedir], [$with_dbusinterfacedir])
370 AC_SUBST([udevrulesdir], [$with_udevrulesdir])
371 AC_SUBST([pamlibdir], [$with_pamlibdir])
372 AC_SUBST([rootdir], [$with_rootdir])
374 AC_CONFIG_FILES([Makefile])
378 $PACKAGE_NAME $VERSION
380 Distribution: ${with_distro}
381 SysV init scripts: ${SYSTEM_SYSVINIT_PATH}
382 SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH}
383 Syslog service: ${SPECIAL_SYSLOG_SERVICE}
385 tcpwrap: ${have_tcpwrap}
388 root dir: ${with_rootdir}
389 udev rules dir: ${with_udevrulesdir}
390 pam modules dir: ${with_pamlibdir}
391 dbus policy dir: ${with_dbuspolicydir}
392 dbus session dir: ${with_dbussessionservicedir}
393 dbus system dir: ${with_dbussystemservicedir}
394 dbus interfaces dir: ${with_dbusinterfacedir}