dnl -*- mode: m4 -*-
AC_PREREQ(2.52)
-AC_INIT(dbus/dbus.h)
+m4_define([dbus_major_version], [1])
+m4_define([dbus_minor_version], [2])
+m4_define([dbus_micro_version], [24])
+m4_define([dbus_version],
+ [dbus_major_version.dbus_minor_version.dbus_micro_version])
+AC_INIT(dbus, [dbus_version])
-AC_CANONICAL_TARGET
-
-AM_INIT_AUTOMAKE(dbus, 0.95)
+AC_CANONICAL_HOST
+AM_INIT_AUTOMAKE([1.9 tar-ustar])
AM_CONFIG_HEADER(config.h)
# Honor aclocal flags
## must come before we use the $USE_MAINTAINER_MODE variable later
AM_MAINTAINER_MODE
+m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
+
# libtool versioning - this applies to libdbus
#
# See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details
#
## increment if the interface has additions, changes, removals.
-LT_CURRENT=5
+LT_CURRENT=7
## increment any time the source changes; set to
## 0 if you increment CURRENT
## increment if any interfaces have been added; set to 0
## if any interfaces have been changed or removed. removal has
## precedence over adding, so set to 0 if both happened.
-LT_AGE=2
+LT_AGE=4
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)
+DBUS_MAJOR_VERSION=dbus_major_version
+DBUS_MINOR_VERSION=dbus_minor_version
+DBUS_MICRO_VERSION=dbus_micro_version
+DBUS_VERSION=dbus_major_version.dbus_minor_version.dbus_micro_version
+
+AC_SUBST(DBUS_MAJOR_VERSION)
+AC_SUBST(DBUS_MINOR_VERSION)
+AC_SUBST(DBUS_MICRO_VERSION)
+AC_SUBST(DBUS_VERSION)
AC_PROG_CC
+AM_PROG_CC_C_O
AC_PROG_CXX
AC_ISC_POSIX
AC_HEADER_STDC
+AC_C_INLINE
+AM_PROG_LIBTOOL
AC_ARG_ENABLE(tests, AS_HELP_STRING([--enable-tests],[enable unit test code]),enable_tests=$enableval,enable_tests=$USE_MAINTAINER_MODE)
AC_ARG_ENABLE(ansi, AS_HELP_STRING([--enable-ansi],[enable -ansi -pedantic gcc flags]),enable_ansi=$enableval,enable_ansi=no)
AC_ARG_ENABLE(gcov, AS_HELP_STRING([--enable-gcov],[compile with coverage profiling instrumentation (gcc only)]),enable_gcov=$enableval,enable_gcov=no)
AC_ARG_ENABLE(abstract-sockets, AS_HELP_STRING([--enable-abstract-sockets],[use abstract socket namespace (linux only)]),enable_abstract_sockets=$enableval,enable_abstract_sockets=auto)
AC_ARG_ENABLE(selinux, AS_HELP_STRING([--enable-selinux],[build with SELinux support]),enable_selinux=$enableval,enable_selinux=auto)
+AC_ARG_ENABLE(libaudit,AS_HELP_STRING([--enable-libaudit],[build audit daemon support for SELinux]),enable_libaudit=$enableval,enable_libaudit=auto)
AC_ARG_ENABLE(dnotify, AS_HELP_STRING([--enable-dnotify],[build with dnotify support (linux only)]),enable_dnotify=$enableval,enable_dnotify=auto)
+AC_ARG_ENABLE(inotify, AS_HELP_STRING([--enable-inotify],[build with inotify support (linux only)]),enable_inotify=$enableval,enable_inotify=auto)
AC_ARG_ENABLE(kqueue, AS_HELP_STRING([--enable-kqueue],[build with kqueue support]),enable_kqueue=$enableval,enable_kqueue=auto)
AC_ARG_ENABLE(console-owner-file, AS_HELP_STRING([--enable-console-owner-file],[enable console owner file]),enable_console_owner_file=$enableval,enable_console_owner_file=auto)
+AC_ARG_ENABLE(userdb-cache, AS_HELP_STRING([--enable-userdb-cache],[build with userdb-cache support]),enable_userdb_cache=$enableval,enable_userdb_cache=yes)
AC_ARG_WITH(xml, AS_HELP_STRING([--with-xml=[libxml/expat]],[XML library to use]))
AC_ARG_WITH(init-scripts, AS_HELP_STRING([--with-init-scripts=[redhat]],[Style of init scripts to install]))
AC_ARG_WITH(dbus_user, AS_HELP_STRING([--with-dbus-user=<user>],[User for running the DBUS daemon (messagebus)]))
AC_ARG_WITH(dbus_daemondir, AS_HELP_STRING([--with-dbus-daemondir=[dirname]],[Directory for installing the DBUS daemon]))
+AC_DEFINE(DBUS_UNIX,1,[dbus on unix])
dnl DBUS_BUILD_TESTS controls unit tests built in to .c files
dnl and also some stuff in the test/ subdir
AC_DEFINE(G_DISABLE_CHECKS,1,[Disable GLib public API sanity checking])
fi
-#### gcc warning flags
-
-cc_supports_flag() {
- AC_MSG_CHECKING(whether $CC supports "$@")
- Cfile=/tmp/foo${$}
- touch ${Cfile}.c
- $CC -c "$@" ${Cfile}.c -o ${Cfile}.o >/dev/null 2>&1
- rc=$?
- rm -f ${Cfile}.c ${Cfile}.o
- case $rc in
- 0) AC_MSG_RESULT(yes);;
- *) AC_MSG_RESULT(no);;
- esac
- return $rc
-}
-
-if test "x$GCC" = "xyes"; then
- changequote(,)dnl
- case " $CFLAGS " in
- *[\ \ ]-Wall[\ \ ]*) ;;
- *) CFLAGS="$CFLAGS -Wall" ;;
- esac
-
- case " $CFLAGS " in
- *[\ \ ]-Wchar-subscripts[\ \ ]*) ;;
- *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
- esac
-
- case " $CFLAGS " in
- *[\ \ ]-Wmissing-declarations[\ \ ]*) ;;
- *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
- esac
-
- case " $CFLAGS " in
- *[\ \ ]-Wmissing-prototypes[\ \ ]*) ;;
- *) CFLAGS="$CFLAGS -Wmissing-prototypes" ;;
- esac
-
- case " $CFLAGS " in
- *[\ \ ]-Wnested-externs[\ \ ]*) ;;
- *) CFLAGS="$CFLAGS -Wnested-externs" ;;
- esac
-
- case " $CFLAGS " in
- *[\ \ ]-Wpointer-arith[\ \ ]*) ;;
- *) CFLAGS="$CFLAGS -Wpointer-arith" ;;
- esac
-
- case " $CFLAGS " in
- *[\ \ ]-Wcast-align[\ \ ]*) ;;
- *) CFLAGS="$CFLAGS -Wcast-align" ;;
- esac
-
- case " $CFLAGS " in
- *[\ \ ]-Wfloat-equal[\ \ ]*) ;;
- *) if cc_supports_flag -Wfloat-equals; then
- CFLAGS="$CFLAGS -Wfloat-equal"
- fi
- ;;
- esac
-
- case " $CFLAGS " in
- *[\ \ ]-Wsign-compare[\ \ ]*) ;;
- *) CFLAGS="$CFLAGS -Wsign-compare" ;;
- esac
-
- case " $CFLAGS " in
- *[\ \ ]-Wdeclaration-after-statement[\ \ ]*) ;;
- *) if cc_supports_flag -Wdeclaration-after-statement; then
- CFLAGS="$CFLAGS -Wdeclaration-after-statement"
- fi
- ;;
- esac
-
- case " $CFLAGS " in
- *[\ \ ]-fno-common[\ \ ]*) ;;
- *) if cc_supports_flag -fno-common; then
- CFLAGS="$CFLAGS -fno-common"
- fi
- ;;
- esac
-
- case " $CFLAGS " in
- *[\ \ ]-fPIC[\ \ ]*) ;;
- *) if cc_supports_flag -fPIC; then
- CFLAGS="$CFLAGS -fPIC"
- fi
- ;;
- esac
-
- if test "x$enable_ansi" = "xyes"; then
- case " $CFLAGS " in
- *[\ \ ]-ansi[\ \ ]*) ;;
- *) CFLAGS="$CFLAGS -ansi" ;;
- esac
-
- case " $CFLAGS " in
- *[\ \ ]-D_POSIX_C_SOURCE*) ;;
- *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;;
- esac
-
- case " $CFLAGS " in
- *[\ \ ]-D_BSD_SOURCE[\ \ ]*) ;;
- *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;;
- esac
-
- case " $CFLAGS " in
- *[\ \ ]-pedantic[\ \ ]*) ;;
- *) CFLAGS="$CFLAGS -pedantic" ;;
- esac
- fi
- if test x$enable_gcov = xyes; then
- case " $CFLAGS " in
- *[\ \ ]-fprofile-arcs[\ \ ]*) ;;
- *) CFLAGS="$CFLAGS -fprofile-arcs" ;;
- esac
- case " $CFLAGS " in
- *[\ \ ]-ftest-coverage[\ \ ]*) ;;
- *) CFLAGS="$CFLAGS -ftest-coverage" ;;
- esac
-
- ## remove optimization
- CFLAGS=`echo "$CFLAGS" | sed -e 's/-O[0-9]*//g'`
- fi
- changequote([,])dnl
-else
- if test x$enable_gcov = xyes; then
- AC_MSG_ERROR([--enable-gcov can only be used with gcc])
- fi
+if test x$enable_userdb_cache = xyes; then
+ AC_DEFINE(DBUS_ENABLE_USERDB_CACHE,1,[Build with caching of user data])
fi
-# Add -D_POSIX_PTHREAD_SEMANTICS if on Solaris
-#
-case $target_os in
- solaris*)
- CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS" ;;
-esac
-
-AM_PROG_LIBTOOL
-
-changequote(,)dnl
-# compress spaces in flags
-CFLAGS=`echo "$CFLAGS" | sed -e 's/ +/ /g'`
-CXXFLAGS=`echo "$CXXFLAGS" | sed -e 's/ +/ /g'`
-CPPFLAGS=`echo "$CPPFLAGS" | sed -e 's/ +/ /g'`
-changequote([,])dnl
-
if test x$enable_gcov = xyes; then
## so that config.h changes when you toggle gcov support
AC_DEFINE_UNQUOTED(DBUS_GCOV_ENABLED, 1, [Defined if gcov is enabled to force a rebuild due to config.h changing])
fi
AM_CONDITIONAL(DBUS_GCOV_ENABLED, test x$enable_gcov = xyes)
+# glibc21.m4 serial 3
+dnl Copyright (C) 2000-2002, 2004 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+# Test for the GNU C Library, version 2.1 or newer.
+# From Bruno Haible.
+
+AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
+ ac_cv_gnu_library_2_1,
+ [AC_EGREP_CPP([Lucky GNU user],
+ [
+#include <features.h>
+#ifdef __GNU_LIBRARY__
+ #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
+ Lucky GNU user
+ #endif
+#endif
+ ],
+ ac_cv_gnu_library_2_1=yes,
+ ac_cv_gnu_library_2_1=no)
+ ]
+)
+
#### Integer sizes
AC_CHECK_SIZEOF(char)
dbusint64=int
dbusint64_constant='(val)'
dbusuint64_constant='(val)'
+ dbusint64_printf_modifier='""'
;;
$ac_cv_sizeof_long)
dbusint64=long
dbusint64_constant='(val##L)'
dbusuint64_constant='(val##UL)'
+ dbusint64_printf_modifier='"l"'
;;
$ac_cv_sizeof_long_long)
dbusint64='long long'
dbusint64_constant='(val##LL)'
dbusuint64_constant='(val##ULL)'
+ # Ideally we discover what the format is, but this is
+ # only used in verbose mode, so eh...
+ if test x"$ac_cv_gnu_library_2_1" = xyes; then
+ dbusint64_printf_modifier='"ll"'
+ fi
;;
$ac_cv_sizeof___int64)
dbusint64=__int64
dbusint64_constant='(val##i64)'
dbusuint64_constant='(val##ui64)'
+ # See above case
+ if test x"$ac_cv_gnu_library_2_1" = xyes; then
+ dbusint64_printf_modifier='"ll"'
+ fi
;;
esac
DBUS_HAVE_INT64=1
DBUS_INT64_CONSTANT="$dbusint64_constant"
DBUS_UINT64_CONSTANT="$dbusuint64_constant"
+ if test x"$dbusint64_printf_modifier" != x; then
+ AC_DEFINE_UNQUOTED(DBUS_INT64_PRINTF_MODIFIER, [$dbusint64_printf_modifier], [Define to printf modifier for 64 bit integer type])
+ fi
AC_MSG_RESULT($DBUS_INT64_TYPE)
fi
dnl all results in config.log for bug reports.
AC_CACHE_CHECK([for an implementation of va_copy()],dbus_cv_va_copy,[
AC_LINK_IFELSE([#include <stdarg.h>
- void f (int i, ...) {
+#include <stdlib.h>
+ static void f (int i, ...) {
va_list args1, args2;
va_start (args1, i);
va_copy (args2, args1);
])
AC_CACHE_CHECK([for an implementation of __va_copy()],dbus_cv___va_copy,[
AC_LINK_IFELSE([#include <stdarg.h>
- void f (int i, ...) {
+#include <stdlib.h>
+ static void f (int i, ...) {
va_list args1, args2;
va_start (args1, i);
__va_copy (args2, args1);
[AC_RUN_IFELSE([AC_LANG_PROGRAM(
[[
#include <stdarg.h>
+ #include <stdlib.h>
]],
[[
- void f (int i, ...) {
+ static void f (int i, ...) {
va_list args1, args2;
va_start (args1, i);
args2 = args1;
#### Atomic integers (checks by Sebastian Wilhelmi for GLib)
AC_MSG_CHECKING([whether to use inline assembler routines for atomic integers])
-have_atomic_inc=no
+have_atomic_inc_cond=0
if test x"$GCC" = xyes; then
if test "x$enable_ansi" = "xyes"; then
AC_MSG_RESULT([no])
AC_MSG_RESULT([darwin])
# check at compile-time, so that it is possible to build universal
# (with multiple architectures at once on the compile line)
- AH_VERBATIM([DBUS_USE_ATOMIC_INT_486_DARWIN], [
- #if (defined(__i386__) || defined(__x86_64__))
- # define DBUS_USE_ATOMIC_INT_486 1
- #endif
- ])
+ have_atomic_inc_cond="(defined(__i386__) || defined(__x86_64__))"
;;
*)
AC_MSG_RESULT([i486])
- AC_DEFINE_UNQUOTED(DBUS_USE_ATOMIC_INT_486, 1, [Use atomic integer implementation for 486])
+ have_atomic_inc_cond=1
;;
esac
- have_atomic_inc=yes
;;
*)
AC_MSG_RESULT([no])
esac
fi
fi
-if test x$have_atomic_inc = xyes ; then
- case $host_os in
- darwin*)
- AH_VERBATIM([DBUS_HAVE_ATOMIC_INT_DARWIN], [
- #if (defined(__i386__) || defined(__x86_64__))
- # define DBUS_HAVE_ATOMIC_INT 1
- #endif
- ])
- ;;
- *)
- AC_DEFINE_UNQUOTED(DBUS_HAVE_ATOMIC_INT, 1, [Some atomic integer implementation present])
- ;;
- esac
-fi
+AC_DEFINE_UNQUOTED([DBUS_USE_ATOMIC_INT_486_COND], [$have_atomic_inc_cond],
+ [Always defined; expands to 1 if we should use atomic integer implementation for 486, else 0])
+AC_DEFINE_UNQUOTED(DBUS_HAVE_ATOMIC_INT_COND, [$have_atomic_inc_cond],
+ [Always defined; expands to 1 if we have an atomic integer implementation, else 0])
#### Various functions
-AC_CHECK_LIB(socket,socket)
+AC_SEARCH_LIBS(socket,[socket network])
AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)])
-AC_CHECK_FUNCS(vsnprintf vasprintf nanosleep usleep poll setenv unsetenv socketpair getgrouplist fpathconf)
+AC_CHECK_FUNCS(vsnprintf vasprintf nanosleep usleep setenv clearenv unsetenv socketpair getgrouplist fpathconf setrlimit poll)
+
+#### Check for broken poll; taken from Glib's configure
+
+AC_MSG_CHECKING([for broken poll])
+AC_RUN_IFELSE([AC_LANG_SOURCE([[
+ #include <stdlib.h>
+ #include <fcntl.h>
+ #include <poll.h>
+ #ifdef HAVE_SYS_POLL_H
+ #include <sys/poll.h>
+ #endif
+ int main(void) {
+ struct pollfd fds[1];
+ int fd;
+ fd = open("/dev/null", 1);
+ fds[0].fd = fd;
+ fds[0].events = POLLIN;
+ fds[0].revents = 0;
+ if (poll(fds, 1, 0) < 0 || (fds[0].revents & POLLNVAL) != 0) {
+ exit(1); /* Does not work for devices -- fail */
+ }
+ exit(0);
+ }]])],
+ [broken_poll=no],
+ [broken_poll=yes
+ AC_DEFINE(BROKEN_POLL,1,[poll doesn't work on devices])],
+ [broken_poll="no (cross compiling)"])
+AC_MSG_RESULT($broken_poll)
AC_MSG_CHECKING(for dirfd)
-AC_TRY_COMPILE([
+AC_TRY_LINK([
#include <sys/types.h>
#include <dirent.h>
],[
AC_MSG_RESULT($dbus_have_dirfd)
if test "$dbus_have_dirfd" = yes; then
AC_DEFINE(HAVE_DIRFD,1,[Have dirfd function])
+else
+ AC_MSG_CHECKING(for DIR *dirp->dd_fd)
+ AC_TRY_LINK([
+#include <sys/types.h>
+#include <dirent.h>
+ ],[
+DIR *dirp;
+int fd;
+dirp = opendir(".");
+fd = dirp->dd_fd;
+closedir(dirp);
+ ],
+ dbus_have_ddfd=yes, dbus_have_ddfd=no)
+ AC_MSG_RESULT($dbus_have_ddfd)
+ if test "$dbus_have_ddfd" = yes; then
+ AC_DEFINE(HAVE_DDFD,1,[Have the ddfd member of DIR])
+ fi
fi
AC_CHECK_HEADERS(execinfo.h, [AC_CHECK_FUNCS(backtrace)])
AC_CHECK_HEADERS(errno.h)
+AC_CHECK_HEADERS(unistd.h)
+
+# Add -D_POSIX_PTHREAD_SEMANTICS if on Solaris
+#
+case $host_os in
+ solaris*)
+ CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS" ;;
+esac
+
# checking for a posix version of getpwnam_r
# if we are cross compiling and can not run the test
# assume getpwnam_r is the posix version
#### Abstract sockets
+if test x$enable_abstract_sockets = xauto; then
AC_LANG_PUSH(C)
+warn_on_xcompile=no
AC_CACHE_CHECK([abstract socket namespace],
ac_cv_have_abstract_sockets,
[AC_RUN_IFELSE([AC_LANG_PROGRAM(
exit (0);
]])],
[ac_cv_have_abstract_sockets=yes],
- [ac_cv_have_abstract_sockets=no]
+ [ac_cv_have_abstract_sockets=no],
+ [
+ ac_cv_have_abstract_sockets=no
+ warn_on_xcompile=yes
+ ]
)])
+if test x$warn_on_xcompile = xyes ; then
+ AC_MSG_WARN([Cannot check for abstract sockets when cross-compiling, please use --enable-abstract-sockets])
+fi
AC_LANG_POP(C)
+fi
if test x$enable_abstract_sockets = xyes; then
if test x$ac_cv_have_abstract_sockets = xno; then
[ AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false) ],
have_expat=false)
-PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.6.0, have_libxml=true, have_libxml=false)
-
# see what we want to use
dbus_use_libxml=false
dbus_use_expat=false
if test x$with_xml = xexpat; then
- dbus_use_expat=true
if ! $have_expat ; then
AC_MSG_ERROR([Explicitly requested expat but expat not found])
fi
+ dbus_use_expat=true
elif test x$with_xml = xlibxml; then
- dbus_use_libxml=true
+ PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.6.0, have_libxml=true, have_libxml=false)
if ! $have_libxml ; then
AC_MSG_ERROR([Explicitly requested libxml but libxml not found])
fi
+ dbus_use_libxml=true
else
### expat is the default because libxml can't currently survive
### our brutal OOM-handling unit test setup.
### http://bugzilla.gnome.org/show_bug.cgi?id=109368
- if $have_expat ; then
- with_xml=expat
- dbus_use_expat=true
- elif $have_libxml ; then
- with_xml=libxml
- dbus_use_libxml=true
- else
- AC_MSG_ERROR([No XML library found, check config.log for failed attempts])
+ if test x$have_expat = xfalse; then
+ AC_MSG_ERROR([Could not find expat.h, check config.log for failed attempts])
fi
+ ### By default, only use Expat since it's tested and known to work. If you're a
+ ### general-purpose OS vendor, please don't enable libxml. For embedded use
+ ### if your OS is built around libxml, that's another case.
+ dbus_use_expat=true
fi
AM_CONDITIONAL(DBUS_USE_EXPAT, $dbus_use_expat)
XML_CFLAGS=$LIBXML_CFLAGS
fi
+# Thread lib detection
+AC_CHECK_FUNC(pthread_cond_timedwait,[AC_CHECK_LIB(pthread,pthread_cond_timedwait,
+ [THREAD_LIBS="-lpthread"])])
+save_libs="$LIBS"
+LIBS="$LIBS $THREAD_LIBS"
+AC_CHECK_FUNC(pthread_condattr_setclock,have_pthread_condattr_setclock=true,have_pthread_condattr_setclock=false)
+if test x$have_pthread_condattr_setclock = xtrue; then
+ AC_SEARCH_LIBS([clock_getres],[rt],[THREAD_LIBS="$THREAD_LIBS -lrt"])
+ AC_MSG_CHECKING([for CLOCK_MONOTONIC])
+ AC_TRY_COMPILE([#include <time.h>
+#include <pthread.h>
+], [
+struct timespec monotonic_timer;
+pthread_condattr_t attr;
+pthread_condattr_init (&attr);
+pthread_condattr_setclock (&attr, CLOCK_MONOTONIC);
+clock_getres (CLOCK_MONOTONIC,&monotonic_timer);
+], have_clock_monotonic=true, have_clock_monotonic=false)
+if test x$have_clock_monotonic = xtrue; then
+ AC_MSG_RESULT([found])
+ AC_DEFINE(HAVE_MONOTONIC_CLOCK, 1, [Define if we have CLOCK_MONOTONIC])
+else
+ AC_MSG_RESULT([not found])
+fi
+fi
+LIBS="$save_libs"
+
# SELinux detection
if test x$enable_selinux = xno ; then
have_selinux=no;
AM_CONDITIONAL(HAVE_SELINUX, test x$have_selinux = xyes)
if test x$have_selinux = xyes ; then
- SELINUX_LIBS="-lselinux -lpthread"
+ # the selinux code creates threads
+ # which requires libpthread even on linux
+ AC_CHECK_FUNC(pthread_create,,[AC_CHECK_LIB(pthread,pthread_create,
+ [SELINUX_THREAD_LIBS="-lpthread"])])
+
+ SELINUX_LIBS="-lselinux $SELINUX_THREAD_LIBS"
AC_DEFINE(HAVE_SELINUX,1,[SELinux support])
else
SELINUX_LIBS=
fi
+# inotify checks
+if test x$enable_inotify = xno ; then
+ have_inotify=no;
+else
+ AC_CHECK_HEADERS(sys/inotify.h, have_inotify=yes, have_inotify=no)
+fi
+
+dnl check if inotify backend is enabled
+if test x$have_inotify = xyes; then
+ AC_DEFINE(DBUS_BUS_ENABLE_INOTIFY,1,[Use inotify])
+ AC_CHECK_FUNCS(inotify_init1)
+fi
+
+AM_CONDITIONAL(DBUS_BUS_ENABLE_INOTIFY, test x$have_inotify = xyes)
+
# dnotify checks
if test x$enable_dnotify = xno ; then
have_dnotify=no;
else
- if test x$target_os = xlinux-gnu -o x$target_os = xlinux; then
+ if test x$have_inotify = xno -a x$host_os = xlinux-gnu -o x$host_os = xlinux; then
have_dnotify=yes;
else
have_dnotify=no;
if test x$enable_console_owner_file = xno ; then
have_console_owner_file=no;
else
- case $target_os in
+ case $host_os in
solaris*)
have_console_owner_file=yes;
AC_DEFINE(HAVE_CONSOLE_OWNER_FILE,1,[Have console owner file])
AM_CONDITIONAL(HAVE_CONSOLE_OWNER_FILE, test x$have_console_owner_file = xyes)
+# libaudit detection
+if test x$enable_libaudit = xno ; then
+ have_libaudit=no;
+else
+ # See if we have audit daemon & capabilities library
+ AC_CHECK_LIB(audit, audit_log_user_avc_message,
+ have_libaudit=yes, have_libaudit=no)
+ if test x$have_libaudit = xyes ; then
+ AC_CHECK_LIB(cap-ng, capng_clear,
+ have_libaudit=yes, have_libaudit=no)
+ fi
+fi
+
+AM_CONDITIONAL(HAVE_LIBAUDIT, test x$have_libaudit = xyes)
+
+if test x$have_libaudit = xyes ; then
+ SELINUX_LIBS="$SELINUX_LIBS -laudit -lcap-ng"
+ AC_DEFINE(HAVE_LIBAUDIT,1,[audit daemon SELinux support])
+fi
+
+# Check for ADT API
+AC_MSG_CHECKING(for ADT API)
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <bsm/adt.h>
+adt_user_context = ADT_USER;
+]], [[]])], [ check_adt_audit=yes ], [ check_adt_audit=no ])
+
+if test ${check_adt_audit} = yes
+then
+ AC_DEFINE([HAVE_ADT], [], [Adt audit API])
+ ADT_LIBS="-lbsm"
+ LIBS="-lbsm $LIBS"
+ AC_MSG_RESULT(yes)
+else
+ AC_MSG_RESULT(no)
+fi
+
+
#### Set up final flags
DBUS_CLIENT_CFLAGS=
-DBUS_CLIENT_LIBS=
+DBUS_CLIENT_LIBS="$THREAD_LIBS"
AC_SUBST(DBUS_CLIENT_CFLAGS)
AC_SUBST(DBUS_CLIENT_LIBS)
-DBUS_BUS_CFLAGS=$XML_CFLAGS
-DBUS_BUS_LIBS="$XML_LIBS $SELINUX_LIBS $INTLLIBS"
+DBUS_BUS_CFLAGS="$XML_CFLAGS"
+DBUS_BUS_LIBS="$XML_LIBS $SELINUX_LIBS $INTLLIBS $THREAD_LIBS $ADT_LIBS"
AC_SUBST(DBUS_BUS_CFLAGS)
AC_SUBST(DBUS_BUS_LIBS)
+DBUS_LAUNCHER_CFLAGS="$XML_CFLAGS"
+DBUS_LAUNCHER_LIBS="$XML_LIBS $THREAD_LIBS"
+AC_SUBST(DBUS_LAUNCHER_CFLAGS)
+AC_SUBST(DBUS_LAUNCHER_LIBS)
+
DBUS_TEST_CFLAGS=
-DBUS_TEST_LIBS=
+DBUS_TEST_LIBS="$THREAD_LIBS"
AC_SUBST(DBUS_TEST_CFLAGS)
AC_SUBST(DBUS_TEST_LIBS)
AC_SUBST(DBUS_X_CFLAGS)
AC_SUBST(DBUS_X_LIBS)
+
+#### gcc warning flags
+
+cc_supports_flag() {
+ AC_MSG_CHECKING(whether $CC supports "$@")
+ Cfile=/tmp/foo${$}
+ touch ${Cfile}.c
+ $CC -c "$@" ${Cfile}.c -o ${Cfile}.o >/dev/null 2>&1
+ rc=$?
+ rm -f ${Cfile}.c ${Cfile}.o
+ case $rc in
+ 0) AC_MSG_RESULT(yes);;
+ *) AC_MSG_RESULT(no);;
+ esac
+ return $rc
+}
+
+ld_supports_flag() {
+ AC_MSG_CHECKING([whether $LD supports "$@"])
+ AC_TRY_LINK([
+ int one(void) { return 1; }
+ int two(void) { return 2; }
+ ], [ two(); ] , [_ac_ld_flag_supported=yes], [_ac_ld_flag_supported=no])
+
+ if test "$_ac_ld_flag_supported" = "yes"; then
+ rm -f conftest.c
+ touch conftest.c
+ if $CC -c conftest.c; then
+ ld_out=`$LD $@ -o conftest conftest.o 2>&1`
+ ld_ret=$?
+ if test $ld_ret -ne 0 ; then
+ _ac_ld_flag_supported=no
+ elif echo "$ld_out" | egrep 'option ignored|^usage:|unrecognized option|illegal option' >/dev/null ; then
+ _ac_ld_flag_supported=no
+ fi
+ fi
+ rm -f conftest.c conftest.o conftest
+ fi
+
+ AC_MSG_RESULT($_ac_ld_flag_supported)
+ if test "$_ac_ld_flag_supported" = "yes" ; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+if test x$USE_MAINTAINER_MODE = xyes; then
+ if cc_supports_flag "-Werror"; then
+ CFLAGS="$CFLAGS -Werror"
+ fi
+fi
+
+if test "x$GCC" = "xyes"; then
+ changequote(,)dnl
+ case " $CFLAGS " in
+ *[\ \ ]-Wall[\ \ ]*) ;;
+ *) CFLAGS="$CFLAGS -Wall" ;;
+ esac
+
+ case " $CFLAGS " in
+ *[\ \ ]-Wchar-subscripts[\ \ ]*) ;;
+ *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
+ esac
+
+ case " $CFLAGS " in
+ *[\ \ ]-Wmissing-declarations[\ \ ]*) ;;
+ *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
+ esac
+
+ case " $CFLAGS " in
+ *[\ \ ]-Wmissing-prototypes[\ \ ]*) ;;
+ *) CFLAGS="$CFLAGS -Wmissing-prototypes" ;;
+ esac
+
+ case " $CFLAGS " in
+ *[\ \ ]-Wnested-externs[\ \ ]*) ;;
+ *) CFLAGS="$CFLAGS -Wnested-externs" ;;
+ esac
+
+ case " $CFLAGS " in
+ *[\ \ ]-Wpointer-arith[\ \ ]*) ;;
+ *) CFLAGS="$CFLAGS -Wpointer-arith" ;;
+ esac
+
+ case " $CFLAGS " in
+ *[\ \ ]-Wcast-align[\ \ ]*) ;;
+ *) CFLAGS="$CFLAGS -Wcast-align" ;;
+ esac
+
+ case " $CFLAGS " in
+ *[\ \ ]-Wfloat-equal[\ \ ]*) ;;
+ *) if cc_supports_flag -Wfloat-equals; then
+ CFLAGS="$CFLAGS -Wfloat-equal"
+ fi
+ ;;
+ esac
+
+ case " $CFLAGS " in
+ *[\ \ ]-Wdeclaration-after-statement[\ \ ]*) ;;
+ *) if cc_supports_flag -Wdeclaration-after-statement; then
+ CFLAGS="$CFLAGS -Wdeclaration-after-statement"
+ fi
+ ;;
+ esac
+
+ case " $CFLAGS " in
+ *[\ \ ]-fno-common[\ \ ]*) ;;
+ *) if cc_supports_flag -fno-common; then
+ CFLAGS="$CFLAGS -fno-common"
+ fi
+ ;;
+ esac
+
+ case " $CFLAGS " in
+ *[\ \ ]-fPIC[\ \ ]*) ;;
+ *) if cc_supports_flag -fPIC; then
+ PIC_CFLAGS="-fPIC"
+ if ld_supports_flag -z,relro; then
+ PIC_LDFLAGS="-Wl,-z,relro"
+ fi
+ fi
+ ;;
+ esac
+
+ case " $CFLAGS " in
+ *[\ \ ]-fPIE[\ \ ]*) ;;
+ *) if cc_supports_flag -fPIE; then
+ PIE_CFLAGS="-fPIE"
+ if ld_supports_flag -z,relro; then
+ PIE_LDFLAGS="-pie -Wl,-z,relro"
+ else
+ PIE_LDFLAGS="-pie"
+ fi
+ fi
+ ;;
+ esac
+
+ ### Disabled warnings, and compiler flag overrides
+
+ # Let's just ignore unused for now
+ case " $CFLAGS " in
+ *[\ \ ]-Wno-unused[\ \ ]*) ;;
+ *) CFLAGS="$CFLAGS -Wno-unused" ;;
+ esac
+
+ # This group is for warnings we currently don't pass.
+ # We would like to, however. Please fix.
+
+ # http://bugs.freedesktop.org/show_bug.cgi?id=17433
+ case " $CFLAGS " in
+ *[\ \ ]-Wno-sign-compare[\ \ ]*) ;;
+ *) CFLAGS="$CFLAGS -Wno-sign-compare" ;;
+ esac
+ case " $CFLAGS " in
+ *[\ \ ]-Wno-pointer-sign[\ \ ]*) ;;
+ *) if cc_supports_flag -Wno-pointer-sign; then
+ CFLAGS="$CFLAGS -Wno-pointer-sign"
+ fi
+ ;;
+ esac
+
+ # This one is special - it's not a warning override.
+ # http://bugs.freedesktop.org/show_bug.cgi?id=10599
+ case " $CFLAGS " in
+ *[\ \ ]-fno-strict-aliasing[\ \ ]*) ;;
+ *) CFLAGS="$CFLAGS -fno-strict-aliasing" ;;
+ esac
+ ### End disabled warnings
+
+ if test "x$enable_ansi" = "xyes"; then
+ case " $CFLAGS " in
+ *[\ \ ]-ansi[\ \ ]*) ;;
+ *) CFLAGS="$CFLAGS -ansi" ;;
+ esac
+
+ case " $CFLAGS " in
+ *[\ \ ]-D_POSIX_C_SOURCE*) ;;
+ *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;;
+ esac
+
+ case " $CFLAGS " in
+ *[\ \ ]-D_BSD_SOURCE[\ \ ]*) ;;
+ *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;;
+ esac
+
+ case " $CFLAGS " in
+ *[\ \ ]-pedantic[\ \ ]*) ;;
+ *) CFLAGS="$CFLAGS -pedantic" ;;
+ esac
+ fi
+ if test x$enable_gcov = xyes; then
+ case " $CFLAGS " in
+ *[\ \ ]-fprofile-arcs[\ \ ]*) ;;
+ *) CFLAGS="$CFLAGS -fprofile-arcs" ;;
+ esac
+ case " $CFLAGS " in
+ *[\ \ ]-ftest-coverage[\ \ ]*) ;;
+ *) CFLAGS="$CFLAGS -ftest-coverage" ;;
+ esac
+
+ ## remove optimization
+ CFLAGS=`echo "$CFLAGS" | sed -e 's/-O[0-9]*//g'`
+ fi
+ changequote([,])dnl
+else
+ if test x$enable_gcov = xyes; then
+ AC_MSG_ERROR([--enable-gcov can only be used with gcc])
+ fi
+fi
+
+AC_SUBST(PIC_CFLAGS)
+AC_SUBST(PIC_LDFLAGS)
+AC_SUBST(PIE_CFLAGS)
+AC_SUBST(PIE_LDFLAGS)
+
+if ld_supports_flag --gc-sections; then
+ SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
+ CFLAGS="-ffunction-sections -fdata-sections $CFLAGS"
+fi
+AC_SUBST(SECTION_FLAGS)
+AC_SUBST(SECTION_LDFLAGS)
+AC_MSG_RESULT($ac_gcsections)
+
+changequote(,)dnl
+# compress spaces in flags
+CFLAGS=`echo "$CFLAGS" | sed -e 's/ +/ /g'`
+CXXFLAGS=`echo "$CXXFLAGS" | sed -e 's/ +/ /g'`
+CPPFLAGS=`echo "$CPPFLAGS" | sed -e 's/ +/ /g'`
+changequote([,])dnl
+
### Doxygen Documentation
AC_PATH_PROG(DOXYGEN, doxygen, no)
AM_CONDITIONAL(DBUS_XML_DOCS_ENABLED, test x$enable_xml_docs = xyes)
AC_MSG_RESULT(yes)
-#### Have to go $localstatedir->$prefix/var->/usr/local/var
-#### someone please fix this a better way...
+#### Have to go $localstatedir->$prefix/var->/usr/local/var
#### find the actual value for $prefix that we'll end up with
## (I know this is broken and should be done in the Makefile, but
## that's a major pain and almost nobody actually seems to care)
-REAL_PREFIX=
-if test "x$prefix" = "xNONE"; then
- REAL_PREFIX=$ac_default_prefix
-else
- REAL_PREFIX=$prefix
-fi
-
-## temporarily change prefix and exec_prefix
-old_prefix=$prefix
-prefix=$REAL_PREFIX
-
-if test "x$exec_prefix" = xNONE ; then
- REAL_EXEC_PREFIX=$REAL_PREFIX
-else
- REAL_EXEC_PREFIX=$exec_prefix
-fi
-old_exec_prefix=$exec_prefix
-exec_prefix=$REAL_EXEC_PREFIX
-
-## eval everything
-LOCALSTATEDIR_TMP="$localstatedir"
-EXPANDED_LOCALSTATEDIR=`eval echo $LOCALSTATEDIR_TMP`
-AC_SUBST(EXPANDED_LOCALSTATEDIR)
-
-SYSCONFDIR_TMP="$sysconfdir"
-EXPANDED_SYSCONFDIR=`eval echo $SYSCONFDIR_TMP`
-AC_SUBST(EXPANDED_SYSCONFDIR)
-
-BINDIR_TMP="$bindir"
-EXPANDED_BINDIR=`eval echo $BINDIR_TMP`
-AC_SUBST(EXPANDED_BINDIR)
-
-LIBDIR_TMP="$libdir"
-EXPANDED_LIBDIR=`eval echo $LIBDIR_TMP`
-AC_SUBST(EXPANDED_LIBDIR)
-
-DATADIR_TMP="$datadir"
-EXPANDED_DATADIR=`eval echo $DATADIR_TMP`
-AC_SUBST(EXPANDED_DATADIR)
-
-## put prefix and exec_prefix back
-prefix=$old_prefix
-exec_prefix=$old_exec_prefix
+AS_AC_EXPAND(EXPANDED_LOCALSTATEDIR, "$localstatedir")
+AS_AC_EXPAND(EXPANDED_SYSCONFDIR, "$sysconfdir")
+AS_AC_EXPAND(EXPANDED_BINDIR, "$bindir")
+AS_AC_EXPAND(EXPANDED_LIBDIR, "$libdir")
+AS_AC_EXPAND(EXPANDED_LIBEXECDIR, "$libexecdir")
+AS_AC_EXPAND(EXPANDED_DATADIR, "$datadir")
#### Check our operating system
operating_system=unknown
AC_SUBST(DBUS_USER)
AC_DEFINE_UNQUOTED(DBUS_USER,"$DBUS_USER", [User for running the system BUS daemon])
+#### Direcotry to install data files into
+DBUS_DATADIR=$EXPANDED_DATADIR
+AC_SUBST(DBUS_DATADIR)
+AC_DEFINE_UNQUOTED(DBUS_DATADIR,"$DBUS_DATADIR", [Directory for installing DBUS data files])
+
#### Directory to install dbus-daemon
if test -z "$with_dbus_daemondir" ; then
DBUS_DAEMONDIR=$EXPANDED_BINDIR
AC_DEFINE_UNQUOTED(DBUS_DAEMONDIR,"$DBUS_DAEMONDIR", [Directory for installing the DBUS daemon])
#### Directory to install the other binaries
-DBUS_BINDIR=$EXPANDED_BINDIR
+DBUS_BINDIR="$EXPANDED_BINDIR"
AC_SUBST(DBUS_BINDIR)
AC_DEFINE_UNQUOTED(DBUS_BINDIR,"$DBUS_BINDIR", [Directory for installing the binaries])
+#### Directory to install the libexec binaries
+DBUS_LIBEXECDIR="$EXPANDED_LIBEXECDIR"
+AC_SUBST(DBUS_LIBEXECDIR)
+AC_DEFINE_UNQUOTED(DBUS_LIBEXECDIR,"$DBUS_LIBEXECDIR", [Directory for installing the libexec binaries])
+
#### Tell tests where to find certain stuff in builddir
DBUS_PWD=`pwd`
AC_SUBST(TEST_$1)
])
-TEST_PATH(SERVICE_DIR, data/valid-service-files)
+TEST_PATH(VALID_SERVICE_DIR, data/valid-service-files)
+TEST_PATH(INVALID_SERVICE_DIR, data/invalid-service-files)
+TEST_PATH(VALID_SERVICE_SYSTEM_DIR, data/valid-service-files-system)
+TEST_PATH(INVALID_SERVICE_SYSTEM_DIR, data/invalid-service-files-system)
TEST_PATH(SERVICE_BINARY, test-service)
TEST_PATH(SHELL_SERVICE_BINARY, test-shell-service)
TEST_PATH(EXIT_BINARY, test-exit)
TEST_PATH(SEGFAULT_BINARY, test-segfault)
TEST_PATH(SLEEP_FOREVER_BINARY, test-sleep-forever)
+TEST_PATH(PRIVSERVER_BINARY, name-test/test-privserver)
AC_DEFINE_UNQUOTED(TEST_BUS_BINARY, "$DBUS_PWD/bus/dbus-daemon",
[Full path to the daemon in the builddir])
AC_SUBST(TEST_BUS_BINARY)
+## Export the non-setuid external helper
+TEST_LAUNCH_HELPER_BINARY="$DBUS_PWD/bus/dbus-daemon-launch-helper-test"
+AC_SUBST(TEST_LAUNCH_HELPER_BINARY)
+AC_DEFINE_UNQUOTED(DBUS_TEST_LAUNCH_HELPER_BINARY, "$TEST_LAUNCH_HELPER_BINARY",
+ [Full path to the launch helper test program in the builddir])
+
#### Find socket directories
if ! test -z "$TMPDIR" ; then
DEFAULT_SOCKET_DIR=$TMPDIR
AC_DEFINE_UNQUOTED(DBUS_SESSION_SOCKET_DIR, "$DBUS_SESSION_SOCKET_DIR", [Where per-session bus puts its sockets])
AC_SUBST(DBUS_SESSION_SOCKET_DIR)
+AC_DEFINE_UNQUOTED(DBUS_UNIX, "1", [Defined on UNIX and Linux systems and not on Windows])
+
+# darwin needs this to initialize the environment
+AC_CHECK_HEADERS(crt_externs.h)
+AC_CHECK_FUNC(_NSGetEnviron, [AC_DEFINE(HAVE_NSGETENVIRON, 1, [Define if your system needs _NSGetEnviron to set up the environment])])
+AH_VERBATIM(_DARWIN_ENVIRON,
+[
+#if defined(HAVE_NSGETENVIRON) && defined(HAVE_CRT_EXTERNS_H)
+# include <sys/time.h>
+# include <crt_externs.h>
+# define environ (*_NSGetEnviron())
+#endif
+])
+
AC_OUTPUT([
Doxyfile
dbus/dbus-arch-deps.h
dbus-1.pc
test/data/valid-config-files/debug-allow-all.conf
test/data/valid-config-files/debug-allow-all-sha1.conf
-test/data/valid-service-files/debug-echo.service
-test/data/valid-service-files/debug-segfault.service
-test/data/valid-service-files/debug-shell-echo-success.service
-test/data/valid-service-files/debug-shell-echo-fail.service
+test/data/valid-config-files-system/debug-allow-all-pass.conf
+test/data/valid-config-files-system/debug-allow-all-fail.conf
+test/data/valid-service-files/org.freedesktop.DBus.TestSuite.PrivServer.service
+test/data/valid-service-files/org.freedesktop.DBus.TestSuiteEchoService.service
+test/data/valid-service-files/org.freedesktop.DBus.TestSuiteForkingEchoService.service
+test/data/valid-service-files/org.freedesktop.DBus.TestSuiteSegfaultService.service
+test/data/valid-service-files/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service
+test/data/valid-service-files/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service
+test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteEchoService.service
+test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteSegfaultService.service
+test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service
+test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service
+test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoExec.service
+test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoUser.service
+test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoService.service
])
dnl ==========================================================================
prefix: ${prefix}
exec_prefix: ${exec_prefix}
libdir: ${EXPANDED_LIBDIR}
+ libexecdir: ${EXPANDED_LIBEXECDIR}
bindir: ${EXPANDED_BINDIR}
sysconfdir: ${EXPANDED_SYSCONFDIR}
localstatedir: ${EXPANDED_LOCALSTATEDIR}
Building assertions: ${enable_asserts}
Building checks: ${enable_checks}
Building SELinux support: ${have_selinux}
+ Building inotify support: ${have_inotify}
Building dnotify support: ${have_dnotify}
+ Building kqueue support: ${have_kqueue}
Building X11 code: ${enable_x11}
Building Doxygen docs: ${enable_doxygen_docs}
Building XML docs: ${enable_xml_docs}
+ Building cache support: ${enable_userdb_cache}
Gettext libs (empty OK): ${INTLLIBS}
Using XML parser: ${with_xml}
Init scripts style: ${with_init_scripts}
if test x$enable_checks = xno; then
echo "NOTE: building without checks for arguments passed to public API makes it harder to debug apps using D-Bus, but will slightly decrease D-Bus library size and _very_ slightly improve performance."
fi
+if test x$dbus_use_libxml = xtrue; then
+ echo
+ echo "WARNING: You have chosen to use libxml as your xml parser however this code path is not maintained by the D-Bus developers and if it breaks you get to keep the pieces. If you have selected this option in err please reconfigure with expat (e.g. --with-xml=expat)."
+fi