8 AM_INIT_AUTOMAKE(dbus, 1.1.1)
10 AM_CONFIG_HEADER(config.h)
13 ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
15 GETTEXT_PACKAGE=dbus-1
16 AC_SUBST(GETTEXT_PACKAGE)
17 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[The name of the gettext domain])
19 ## must come before we use the $USE_MAINTAINER_MODE variable later
22 # libtool versioning - this applies to libdbus
24 # See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details
27 ## increment if the interface has additions, changes, removals.
30 ## increment any time the source changes; set to
31 ## 0 if you increment CURRENT
34 ## increment if any interfaces have been added; set to 0
35 ## if any interfaces have been changed or removed. removal has
36 ## precedence over adding, so set to 0 if both happened.
49 AC_ARG_ENABLE(tests, AS_HELP_STRING([--enable-tests],[enable unit test code]),enable_tests=$enableval,enable_tests=$USE_MAINTAINER_MODE)
50 AC_ARG_ENABLE(ansi, AS_HELP_STRING([--enable-ansi],[enable -ansi -pedantic gcc flags]),enable_ansi=$enableval,enable_ansi=no)
51 AC_ARG_ENABLE(verbose-mode, AS_HELP_STRING([--enable-verbose-mode],[support verbose debug mode]),enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
52 AC_ARG_ENABLE(asserts, AS_HELP_STRING([--enable-asserts],[include assertion checks]),enable_asserts=$enableval,enable_asserts=$USE_MAINTAINER_MODE)
53 AC_ARG_ENABLE(checks, AS_HELP_STRING([--enable-checks],[include sanity checks on public API]),enable_checks=$enableval,enable_checks=yes)
54 AC_ARG_ENABLE(xml-docs, AS_HELP_STRING([--enable-xml-docs],[build XML documentation (requires xmlto)]),enable_xml_docs=$enableval,enable_xml_docs=auto)
55 AC_ARG_ENABLE(doxygen-docs, AS_HELP_STRING([--enable-doxygen-docs],[build DOXYGEN documentation (requires Doxygen)]),enable_doxygen_docs=$enableval,enable_doxygen_docs=auto)
56 AC_ARG_ENABLE(gcov, AS_HELP_STRING([--enable-gcov],[compile with coverage profiling instrumentation (gcc only)]),enable_gcov=$enableval,enable_gcov=no)
57 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)
58 AC_ARG_ENABLE(selinux, AS_HELP_STRING([--enable-selinux],[build with SELinux support]),enable_selinux=$enableval,enable_selinux=auto)
59 AC_ARG_ENABLE(libaudit, [ --enable-libaudit build audit daemon support for SELinux],enable_libaudit=$enableval,enable_libaudit=auto)
60 AC_ARG_ENABLE(dnotify, AS_HELP_STRING([--enable-dnotify],[build with dnotify support (linux only)]),enable_dnotify=$enableval,enable_dnotify=auto)
61 AC_ARG_ENABLE(kqueue, AS_HELP_STRING([--enable-kqueue],[build with kqueue support]),enable_kqueue=$enableval,enable_kqueue=auto)
62 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)
63 AC_ARG_ENABLE(userdb-cache, AS_HELP_STRING([--enable-userdb-cache],[build with userdb-cache support]),enable_userdb_cache=$enableval,enable_userdb_cache=yes)
65 AC_ARG_WITH(xml, AS_HELP_STRING([--with-xml=[libxml/expat]],[XML library to use]))
66 AC_ARG_WITH(init-scripts, AS_HELP_STRING([--with-init-scripts=[redhat]],[Style of init scripts to install]))
67 AC_ARG_WITH(session-socket-dir, AS_HELP_STRING([--with-session-socket-dir=[dirname]],[Where to put sockets for the per-login-session message bus]))
68 AC_ARG_WITH(test-socket-dir, AS_HELP_STRING([--with-test-socket-dir=[dirname]],[Where to put sockets for make check]))
69 AC_ARG_WITH(system-pid-file, AS_HELP_STRING([--with-system-pid-file=[pidfile]],[PID file for systemwide daemon]))
70 AC_ARG_WITH(system-socket, AS_HELP_STRING([--with-system-socket=[filename]],[UNIX domain socket for systemwide daemon]))
71 AC_ARG_WITH(console-auth-dir, AS_HELP_STRING([--with-console-auth-dir=[dirname]],[directory to check for console ownerhip]))
72 AC_ARG_WITH(console-owner-file, AS_HELP_STRING([--with-console-owner-file=[filename]],[file whose owner determines current console owner]))
73 AC_ARG_WITH(dbus_user, AS_HELP_STRING([--with-dbus-user=<user>],[User for running the DBUS daemon (messagebus)]))
74 AC_ARG_WITH(dbus_daemondir, AS_HELP_STRING([--with-dbus-daemondir=[dirname]],[Directory for installing the DBUS daemon]))
76 AC_DEFINE(DBUS_UNIX,1,[dbus on unix])
78 dnl DBUS_BUILD_TESTS controls unit tests built in to .c files
79 dnl and also some stuff in the test/ subdir
80 AM_CONDITIONAL(DBUS_BUILD_TESTS, test x$enable_tests = xyes)
81 if test x$enable_tests = xyes; then
82 AC_DEFINE(DBUS_BUILD_TESTS,1,[Build test code])
85 if test x$enable_verbose_mode = xyes; then
86 AC_DEFINE(DBUS_ENABLE_VERBOSE_MODE,1,[Support a verbose mode])
89 if test x$enable_asserts = xno; then
90 AC_DEFINE(DBUS_DISABLE_ASSERT,1,[Disable assertion checking])
91 AC_DEFINE(G_DISABLE_ASSERT,1,[Disable GLib assertion macros])
94 # -rdynamic is needed for glibc's backtrace_symbols to work.
95 # No clue how much overhead this adds, but it's useful
96 # to do this on any assertion failure,
97 # so for now it's enabled anytime asserts are (currently not
98 # in production builds).
100 # To get -rdynamic you pass -export-dynamic to libtool.
101 AC_DEFINE(DBUS_BUILT_R_DYNAMIC,1,[whether -export-dynamic was passed to libtool])
102 R_DYNAMIC_LDFLAG=-export-dynamic
104 AC_SUBST(R_DYNAMIC_LDFLAG)
106 if test x$enable_checks = xno; then
107 AC_DEFINE(DBUS_DISABLE_CHECKS,1,[Disable public API sanity checking])
108 AC_DEFINE(G_DISABLE_CHECKS,1,[Disable GLib public API sanity checking])
111 if test x$enable_userdb_cache = xyes; then
112 AC_DEFINE(DBUS_ENABLE_USERDB_CACHE,1,[Build with caching of user data])
115 #### gcc warning flags
118 AC_MSG_CHECKING(whether $CC supports "$@")
121 $CC -c "$@" ${Cfile}.c -o ${Cfile}.o >/dev/null 2>&1
123 rm -f ${Cfile}.c ${Cfile}.o
125 0) AC_MSG_RESULT(yes);;
126 *) AC_MSG_RESULT(no);;
131 if test "x$GCC" = "xyes"; then
134 *[\ \ ]-Wall[\ \ ]*) ;;
135 *) CFLAGS="$CFLAGS -Wall" ;;
139 *[\ \ ]-Wchar-subscripts[\ \ ]*) ;;
140 *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
144 *[\ \ ]-Wmissing-declarations[\ \ ]*) ;;
145 *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
149 *[\ \ ]-Wmissing-prototypes[\ \ ]*) ;;
150 *) CFLAGS="$CFLAGS -Wmissing-prototypes" ;;
154 *[\ \ ]-Wnested-externs[\ \ ]*) ;;
155 *) CFLAGS="$CFLAGS -Wnested-externs" ;;
159 *[\ \ ]-Wpointer-arith[\ \ ]*) ;;
160 *) CFLAGS="$CFLAGS -Wpointer-arith" ;;
164 *[\ \ ]-Wcast-align[\ \ ]*) ;;
165 *) CFLAGS="$CFLAGS -Wcast-align" ;;
169 *[\ \ ]-Wfloat-equal[\ \ ]*) ;;
170 *) if cc_supports_flag -Wfloat-equals; then
171 CFLAGS="$CFLAGS -Wfloat-equal"
177 *[\ \ ]-Wsign-compare[\ \ ]*) ;;
178 *) CFLAGS="$CFLAGS -Wsign-compare" ;;
182 *[\ \ ]-Wdeclaration-after-statement[\ \ ]*) ;;
183 *) if cc_supports_flag -Wdeclaration-after-statement; then
184 CFLAGS="$CFLAGS -Wdeclaration-after-statement"
190 *[\ \ ]-fno-common[\ \ ]*) ;;
191 *) if cc_supports_flag -fno-common; then
192 CFLAGS="$CFLAGS -fno-common"
198 *[\ \ ]-fPIC[\ \ ]*) ;;
199 *) if cc_supports_flag -fPIC; then
200 CFLAGS="$CFLAGS -fPIC"
205 if test "x$enable_ansi" = "xyes"; then
207 *[\ \ ]-ansi[\ \ ]*) ;;
208 *) CFLAGS="$CFLAGS -ansi" ;;
212 *[\ \ ]-D_POSIX_C_SOURCE*) ;;
213 *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;;
217 *[\ \ ]-D_BSD_SOURCE[\ \ ]*) ;;
218 *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;;
222 *[\ \ ]-pedantic[\ \ ]*) ;;
223 *) CFLAGS="$CFLAGS -pedantic" ;;
226 if test x$enable_gcov = xyes; then
228 *[\ \ ]-fprofile-arcs[\ \ ]*) ;;
229 *) CFLAGS="$CFLAGS -fprofile-arcs" ;;
232 *[\ \ ]-ftest-coverage[\ \ ]*) ;;
233 *) CFLAGS="$CFLAGS -ftest-coverage" ;;
236 ## remove optimization
237 CFLAGS=`echo "$CFLAGS" | sed -e 's/-O[0-9]*//g'`
241 if test x$enable_gcov = xyes; then
242 AC_MSG_ERROR([--enable-gcov can only be used with gcc])
246 # Add -D_POSIX_PTHREAD_SEMANTICS if on Solaris
250 CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS" ;;
256 # compress spaces in flags
257 CFLAGS=`echo "$CFLAGS" | sed -e 's/ +/ /g'`
258 CXXFLAGS=`echo "$CXXFLAGS" | sed -e 's/ +/ /g'`
259 CPPFLAGS=`echo "$CPPFLAGS" | sed -e 's/ +/ /g'`
262 if test x$enable_gcov = xyes; then
263 ## so that config.h changes when you toggle gcov support
264 AC_DEFINE_UNQUOTED(DBUS_GCOV_ENABLED, 1, [Defined if gcov is enabled to force a rebuild due to config.h changing])
266 AC_MSG_CHECKING([for gcc 3.3 version of gcov file format])
268 AC_RUN_IFELSE( [AC_LANG_PROGRAM( , [[ if (__GNUC__ >=3 && __GNUC_MINOR__ >= 3) exit (0); else exit (1); ]])],
270 if test x$have_gcc33_gcov = xyes ; then
271 AC_DEFINE_UNQUOTED(DBUS_HAVE_GCC33_GCOV, 1, [Defined if we have gcc 3.3 and thus the new gcov format])
273 AC_MSG_RESULT($have_gcc33_gcov)
275 AM_CONDITIONAL(DBUS_GCOV_ENABLED, test x$enable_gcov = xyes)
279 AC_CHECK_SIZEOF(char)
280 AC_CHECK_SIZEOF(short)
281 AC_CHECK_SIZEOF(long)
283 AC_CHECK_SIZEOF(void *)
284 AC_CHECK_SIZEOF(long long)
285 AC_CHECK_SIZEOF(__int64)
287 ### See what our 64 bit type is called
288 AC_MSG_CHECKING([64-bit integer type])
293 dbusint64_constant='(val)'
294 dbusuint64_constant='(val)'
298 dbusint64_constant='(val##L)'
299 dbusuint64_constant='(val##UL)'
301 $ac_cv_sizeof_long_long)
302 dbusint64='long long'
303 dbusint64_constant='(val##LL)'
304 dbusuint64_constant='(val##ULL)'
306 $ac_cv_sizeof___int64)
308 dbusint64_constant='(val##i64)'
309 dbusuint64_constant='(val##ui64)'
313 if test -z "$dbusint64" ; then
314 DBUS_INT64_TYPE="no_int64_type_detected"
317 DBUS_UINT64_CONSTANT=
318 AC_MSG_RESULT([none found])
320 DBUS_INT64_TYPE="$dbusint64"
322 DBUS_INT64_CONSTANT="$dbusint64_constant"
323 DBUS_UINT64_CONSTANT="$dbusuint64_constant"
324 AC_MSG_RESULT($DBUS_INT64_TYPE)
327 AC_SUBST(DBUS_INT64_TYPE)
328 AC_SUBST(DBUS_INT64_CONSTANT)
329 AC_SUBST(DBUS_UINT64_CONSTANT)
330 AC_SUBST(DBUS_HAVE_INT64)
332 ### see what 32-bit int is called
333 AC_MSG_CHECKING([32-bit integer type])
347 if test -z "$dbusint32" ; then
348 DBUS_INT32_TYPE="no_int32_type_detected"
349 AC_MSG_ERROR([No 32-bit integer type found])
351 DBUS_INT32_TYPE="$dbusint32"
352 AC_MSG_RESULT($DBUS_INT32_TYPE)
355 AC_SUBST(DBUS_INT32_TYPE)
357 ### see what 16-bit int is called
358 AC_MSG_CHECKING([16-bit integer type])
369 if test -z "$dbusint16" ; then
370 DBUS_INT16_TYPE="no_int16_type_detected"
371 AC_MSG_ERROR([No 16-bit integer type found])
373 DBUS_INT16_TYPE="$dbusint16"
374 AC_MSG_RESULT($DBUS_INT16_TYPE)
377 AC_SUBST(DBUS_INT16_TYPE)
382 # check at compile-time, so that it is possible to build universal
383 # (with multiple architectures at once on the compile line)
384 AH_VERBATIM([WORDS_BIGENDIAN_DARWIN], [
385 /* Use the compiler-provided endianness defines to allow universal compiling. */
386 #if defined(__BIG_ENDIAN__)
387 #define WORDS_BIGENDIAN 1
396 dnl **********************************
397 dnl *** va_copy checks (from GLib) ***
398 dnl **********************************
399 dnl we currently check for all three va_copy possibilities, so we get
400 dnl all results in config.log for bug reports.
401 AC_CACHE_CHECK([for an implementation of va_copy()],dbus_cv_va_copy,[
402 AC_LINK_IFELSE([#include <stdarg.h>
403 void f (int i, ...) {
404 va_list args1, args2;
406 va_copy (args2, args1);
407 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
409 va_end (args1); va_end (args2);
415 [dbus_cv_va_copy=yes],
416 [dbus_cv_va_copy=no])
418 AC_CACHE_CHECK([for an implementation of __va_copy()],dbus_cv___va_copy,[
419 AC_LINK_IFELSE([#include <stdarg.h>
420 void f (int i, ...) {
421 va_list args1, args2;
423 __va_copy (args2, args1);
424 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
426 va_end (args1); va_end (args2);
432 [dbus_cv___va_copy=yes],
433 [dbus_cv___va_copy=no])
436 if test "x$dbus_cv_va_copy" = "xyes"; then
437 dbus_va_copy_func=va_copy
438 else if test "x$dbus_cv___va_copy" = "xyes"; then
439 dbus_va_copy_func=__va_copy
443 if test -n "$dbus_va_copy_func"; then
444 AC_DEFINE_UNQUOTED(DBUS_VA_COPY,$dbus_va_copy_func,[A 'va_copy' style function])
448 AC_CACHE_CHECK([whether va_lists can be copied by value],
450 [AC_RUN_IFELSE([AC_LANG_PROGRAM(
455 void f (int i, ...) {
456 va_list args1, args2;
459 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
461 va_end (args1); va_end (args2);
468 [dbus_cv_va_val_copy=yes],
469 [dbus_cv_va_val_copy=no],
470 [dbus_cv_va_val_copy=yes])
474 if test "x$dbus_cv_va_val_copy" = "xno"; then
475 AC_DEFINE(DBUS_VA_COPY_AS_ARRAY,1, ['va_lists' cannot be copies as values])
479 #### Atomic integers (checks by Sebastian Wilhelmi for GLib)
480 AC_MSG_CHECKING([whether to use inline assembler routines for atomic integers])
482 if test x"$GCC" = xyes; then
483 if test "x$enable_ansi" = "xyes"; then
493 AC_MSG_RESULT([darwin])
494 # check at compile-time, so that it is possible to build universal
495 # (with multiple architectures at once on the compile line)
496 AH_VERBATIM([DBUS_USE_ATOMIC_INT_486_DARWIN], [
497 #if (defined(__i386__) || defined(__x86_64__))
498 # define DBUS_USE_ATOMIC_INT_486 1
503 AC_MSG_RESULT([i486])
504 AC_DEFINE_UNQUOTED(DBUS_USE_ATOMIC_INT_486, 1, [Use atomic integer implementation for 486])
515 if test x$have_atomic_inc = xyes ; then
518 AH_VERBATIM([DBUS_HAVE_ATOMIC_INT_DARWIN], [
519 #if (defined(__i386__) || defined(__x86_64__))
520 # define DBUS_HAVE_ATOMIC_INT 1
525 AC_DEFINE_UNQUOTED(DBUS_HAVE_ATOMIC_INT, 1, [Some atomic integer implementation present])
530 #### Various functions
531 AC_CHECK_LIB(socket,socket)
532 AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)])
534 AC_CHECK_FUNCS(vsnprintf vasprintf nanosleep usleep poll setenv unsetenv socketpair getgrouplist fpathconf setrlimit)
536 AC_MSG_CHECKING(for dirfd)
538 #include <sys/types.h>
546 dbus_have_dirfd=yes, dbus_have_dirfd=no)
547 AC_MSG_RESULT($dbus_have_dirfd)
548 if test "$dbus_have_dirfd" = yes; then
549 AC_DEFINE(HAVE_DIRFD,1,[Have dirfd function])
551 AC_MSG_CHECKING(for DIR *dirp->dd_fd)
553 #include <sys/types.h>
562 dbus_have_ddfd=yes, dbus_have_ddfd=no)
563 AC_MSG_RESULT($dbus_have_ddfd)
564 if test "$dbus_have_ddfd" = yes; then
565 AC_DEFINE(HAVE_DDFD,1,[Have the ddfd member of DIR])
569 AC_CHECK_HEADERS(execinfo.h, [AC_CHECK_FUNCS(backtrace)])
571 AC_CHECK_HEADERS(errno.h)
573 AC_CHECK_HEADERS(unistd.h)
575 # checking for a posix version of getpwnam_r
576 # if we are cross compiling and can not run the test
577 # assume getpwnam_r is the posix version
578 # it is up to the person cross compiling to change
579 # this behavior if desired
581 AC_CACHE_CHECK([for posix getpwnam_r],
582 ac_cv_func_posix_getpwnam_r,
583 [AC_RUN_IFELSE([AC_LANG_PROGRAM(
590 struct passwd pwd, *pwptr = &pwd;
593 error = getpwnam_r ("", &pwd, buffer,
594 sizeof (buffer), &pwptr);
595 return (error < 0 && errno == ENOSYS)
598 [ac_cv_func_posix_getpwnam_r=yes],
599 [ac_cv_func_posix_getpwnam_r=no],
600 [ac_cv_func_posix_getpwnam_r=yes]
604 if test "$ac_cv_func_posix_getpwnam_r" = yes; then
605 AC_DEFINE(HAVE_POSIX_GETPWNAM_R,1,
606 [Have POSIX function getpwnam_r])
608 AC_CACHE_CHECK([for nonposix getpwnam_r],
609 ac_cv_func_nonposix_getpwnam_r,
610 [AC_TRY_LINK([#include <pwd.h>],
613 getpwnam_r ("", &pwd, buffer,
615 [ac_cv_func_nonposix_getpwnam_r=yes],
616 [ac_cv_func_nonposix_getpwnam_r=no])])
617 if test "$ac_cv_func_nonposix_getpwnam_r" = yes; then
618 AC_DEFINE(HAVE_NONPOSIX_GETPWNAM_R,1,
619 [Have non-POSIX function getpwnam_r])
623 dnl check for socklen_t
624 AC_MSG_CHECKING(whether socklen_t is defined)
626 #include <sys/types.h>
627 #include <sys/socket.h>
632 ],dbus_have_socklen_t=yes,dbus_have_socklen_t=no)
633 AC_MSG_RESULT($dbus_have_socklen_t)
635 if test "x$dbus_have_socklen_t" = "xyes"; then
636 AC_DEFINE(HAVE_SOCKLEN_T,1,[Have socklen_t type])
639 dnl check for writev header and writev function so we're
640 dnl good to go if HAVE_WRITEV gets defined.
641 AC_CHECK_HEADERS(sys/uio.h, [AC_CHECK_FUNCS(writev)])
643 dnl needed on darwin for NAME_MAX
644 AC_CHECK_HEADERS(sys/syslimits.h)
646 dnl check for flavours of varargs macros (test from GLib)
647 AC_MSG_CHECKING(for ISO C99 varargs macros in C)
649 int a(int p1, int p2, int p3);
650 #define call_a(...) a(1,__VA_ARGS__)
652 ],dbus_have_iso_c_varargs=yes,dbus_have_iso_c_varargs=no)
653 AC_MSG_RESULT($dbus_have_iso_c_varargs)
655 AC_MSG_CHECKING(for GNUC varargs macros)
657 int a(int p1, int p2, int p3);
658 #define call_a(params...) a(1,params)
660 ],dbus_have_gnuc_varargs=yes,dbus_have_gnuc_varargs=no)
661 AC_MSG_RESULT($dbus_have_gnuc_varargs)
663 dnl Output varargs tests
664 if test x$dbus_have_iso_c_varargs = xyes; then
665 AC_DEFINE(HAVE_ISO_VARARGS,1,[Have ISO C99 varargs macros])
667 if test x$dbus_have_gnuc_varargs = xyes; then
668 AC_DEFINE(HAVE_GNUC_VARARGS,1,[Have GNU-style varargs macros])
671 dnl Check for various credentials.
672 AC_MSG_CHECKING(for struct cmsgcred)
674 #include <sys/types.h>
675 #include <sys/socket.h>
677 struct cmsgcred cred;
680 ],dbus_have_struct_cmsgcred=yes,dbus_have_struct_cmsgcred=no)
681 AC_MSG_RESULT($dbus_have_struct_cmsgcred)
683 if test x$dbus_have_struct_cmsgcred = xyes; then
684 AC_DEFINE(HAVE_CMSGCRED,1,[Have cmsgcred structure])
687 AC_CHECK_FUNCS(getpeerucred getpeereid)
689 #### Abstract sockets
692 AC_CACHE_CHECK([abstract socket namespace],
693 ac_cv_have_abstract_sockets,
694 [AC_RUN_IFELSE([AC_LANG_PROGRAM(
696 #include <sys/types.h>
700 #include <sys/socket.h>
706 struct sockaddr_un addr;
708 listen_fd = socket (PF_UNIX, SOCK_STREAM, 0);
712 fprintf (stderr, "socket() failed: %s\n", strerror (errno));
716 memset (&addr, '\0', sizeof (addr));
717 addr.sun_family = AF_UNIX;
718 strcpy (addr.sun_path, "X/tmp/dbus-fake-socket-path-used-in-configure-test");
719 addr.sun_path[0] = '\0'; /* this is what makes it abstract */
721 if (bind (listen_fd, (struct sockaddr*) &addr, SUN_LEN (&addr)) < 0)
723 fprintf (stderr, "Abstract socket namespace bind() failed: %s\n",
730 [ac_cv_have_abstract_sockets=yes],
731 [ac_cv_have_abstract_sockets=no]
735 if test x$enable_abstract_sockets = xyes; then
736 if test x$ac_cv_have_abstract_sockets = xno; then
737 AC_MSG_ERROR([Abstract sockets explicitly required, and support not detected.])
741 if test x$enable_abstract_sockets = xno; then
742 ac_cv_have_abstract_sockets=no;
745 if test x$ac_cv_have_abstract_sockets = xyes ; then
746 DBUS_PATH_OR_ABSTRACT=abstract
747 AC_DEFINE(HAVE_ABSTRACT_SOCKETS,1,[Have abstract socket namespace])
749 DBUS_PATH_OR_ABSTRACT=path
752 # this is used in addresses to prefer abstract, e.g.
753 # unix:path=/foo or unix:abstract=/foo
754 AC_SUBST(DBUS_PATH_OR_ABSTRACT)
756 #### Sort out XML library
759 AC_CHECK_LIB(expat, XML_ParserCreate_MM,
760 [ AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false) ],
763 PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.6.0, have_libxml=true, have_libxml=false)
765 # see what we want to use
766 dbus_use_libxml=false
768 if test x$with_xml = xexpat; then
770 if ! $have_expat ; then
771 AC_MSG_ERROR([Explicitly requested expat but expat not found])
773 elif test x$with_xml = xlibxml; then
775 if ! $have_libxml ; then
776 AC_MSG_ERROR([Explicitly requested libxml but libxml not found])
779 ### expat is the default because libxml can't currently survive
780 ### our brutal OOM-handling unit test setup.
781 ### http://bugzilla.gnome.org/show_bug.cgi?id=109368
782 if $have_expat ; then
785 elif $have_libxml ; then
789 AC_MSG_ERROR([No XML library found, check config.log for failed attempts])
793 AM_CONDITIONAL(DBUS_USE_EXPAT, $dbus_use_expat)
794 AM_CONDITIONAL(DBUS_USE_LIBXML, $dbus_use_libxml)
796 if $dbus_use_expat; then
800 if $dbus_use_libxml; then
801 XML_LIBS=$LIBXML_LIBS
802 XML_CFLAGS=$LIBXML_CFLAGS
805 # Thread lib detection
806 AC_CHECK_FUNC(pthread_cond_timedwait,,[AC_CHECK_LIB(pthread,pthread_cond_timedwait,
807 [THREAD_LIBS="-lpthread"])])
810 if test x$enable_selinux = xno ; then
813 # See if we have SELinux library
814 AC_CHECK_LIB(selinux, is_selinux_enabled,
815 have_selinux=yes, have_selinux=no)
817 # see if we have the SELinux header with the new D-Bus stuff in it
818 if test x$have_selinux = xyes ; then
819 AC_MSG_CHECKING([for DBUS Flask permissions in selinux/av_permissions.h])
820 AC_TRY_COMPILE([#include <selinux/av_permissions.h>],
821 [#ifdef DBUS__ACQUIRE_SVC return 0;
823 #error DBUS__ACQUIRE_SVC not defined
825 have_selinux=yes, have_selinux=no)
826 AC_MSG_RESULT($have_selinux)
829 if test x$enable_selinux = xauto ; then
830 if test x$have_selinux = xno ; then
831 AC_MSG_WARN([Sufficiently new SELinux library not found])
834 if test x$have_selinux = xno ; then
835 AC_MSG_ERROR([SElinux explicitly required, and SELinux library not found])
840 AM_CONDITIONAL(HAVE_SELINUX, test x$have_selinux = xyes)
842 if test x$have_selinux = xyes ; then
843 # the selinux code creates threads
844 # which requires libpthread even on linux
845 AC_CHECK_FUNC(pthread_create,,[AC_CHECK_LIB(pthread,pthread_create,
846 [SELINUX_THREAD_LIBS="-lpthread"])])
848 SELINUX_LIBS="-lselinux $SELINUX_THREAD_LIBS"
849 AC_DEFINE(HAVE_SELINUX,1,[SELinux support])
855 if test x$enable_dnotify = xno ; then
858 if test x$target_os = xlinux-gnu -o x$target_os = xlinux; then
865 dnl check if dnotify backend is enabled
866 if test x$have_dnotify = xyes; then
867 AC_DEFINE(DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX,1,[Use dnotify on Linux])
870 AM_CONDITIONAL(DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX, test x$have_dnotify = xyes)
873 if test x$enable_kqueue = xno ; then
877 AC_CHECK_HEADER(sys/event.h, , have_kqueue=no)
878 AC_CHECK_FUNC(kqueue, , have_kqueue=no)
880 if test x$enable_kqueue = xyes -a x$have_kqueue = xno; then
881 AC_MSG_ERROR(kqueue support explicitly enabled but not available)
885 dnl check if kqueue backend is enabled
886 if test x$have_kqueue = xyes; then
887 AC_DEFINE(DBUS_BUS_ENABLE_KQUEUE,1,[Use kqueue])
890 AM_CONDITIONAL(DBUS_BUS_ENABLE_KQUEUE, test x$have_kqueue = xyes)
892 dnl console owner file
893 if test x$enable_console_owner_file = xno ; then
894 have_console_owner_file=no;
898 have_console_owner_file=yes;
899 AC_DEFINE(HAVE_CONSOLE_OWNER_FILE,1,[Have console owner file])
902 have_console_owner_file=no;;
906 AM_CONDITIONAL(HAVE_CONSOLE_OWNER_FILE, test x$have_console_owner_file = xyes)
909 if test x$enable_libaudit = xno ; then
912 # See if we have audit daemon & capabilities library
913 AC_CHECK_LIB(audit, audit_log_user_avc_message,
914 have_libaudit=yes, have_libaudit=no)
915 if test x$have_libaudit = xyes ; then
916 AC_CHECK_LIB(cap, cap_set_proc,
917 have_libaudit=yes, have_libaudit=no)
921 AM_CONDITIONAL(HAVE_LIBAUDIT, test x$have_libaudit = xyes)
923 if test x$have_libaudit = xyes ; then
924 SELINUX_LIBS="$SELINUX_LIBS -laudit"
926 AC_DEFINE(HAVE_LIBAUDIT,1,[audit daemon SELinux support])
929 #### Set up final flags
931 DBUS_CLIENT_LIBS="$THREAD_LIBS"
932 AC_SUBST(DBUS_CLIENT_CFLAGS)
933 AC_SUBST(DBUS_CLIENT_LIBS)
935 DBUS_BUS_CFLAGS=$XML_CFLAGS
936 DBUS_BUS_LIBS="$XML_LIBS $SELINUX_LIBS $INTLLIBS $THREAD_LIBS"
937 AC_SUBST(DBUS_BUS_CFLAGS)
938 AC_SUBST(DBUS_BUS_LIBS)
941 DBUS_TEST_LIBS="$THREAD_LIBS"
942 AC_SUBST(DBUS_TEST_CFLAGS)
943 AC_SUBST(DBUS_TEST_LIBS)
948 ## for now enable_x11 just tracks have_x11,
949 ## there's no --enable-x11
950 if test x$no_x = xyes ; then
958 if test x$enable_x11 = xyes ; then
959 AC_DEFINE(DBUS_BUILD_X11,1,[Build X11-dependent code])
960 DBUS_X_LIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
961 DBUS_X_CFLAGS="$X_CFLAGS"
967 AC_SUBST(DBUS_X_CFLAGS)
968 AC_SUBST(DBUS_X_LIBS)
970 ### Doxygen Documentation
972 AC_PATH_PROG(DOXYGEN, doxygen, no)
974 AC_MSG_CHECKING([whether to build Doxygen documentation])
976 if test x$DOXYGEN = xno ; then
982 if test x$enable_doxygen_docs = xauto ; then
983 if test x$have_doxygen = xno ; then
984 enable_doxygen_docs=no
986 enable_doxygen_docs=yes
990 if test x$enable_doxygen_docs = xyes; then
991 if test x$have_doxygen = xno; then
992 AC_MSG_ERROR([Building Doxygen docs explicitly required, but Doxygen not found])
996 AM_CONDITIONAL(DBUS_DOXYGEN_DOCS_ENABLED, test x$enable_doxygen_docs = xyes)
999 ### XML Documentation
1001 AC_PATH_PROG(XMLTO, xmlto, no)
1003 AC_MSG_CHECKING([whether to build XML documentation])
1005 if test x$XMLTO = xno ; then
1011 if test x$enable_xml_docs = xauto ; then
1012 if test x$have_xmlto = xno ; then
1019 if test x$enable_xml_docs = xyes; then
1020 if test x$have_xmlto = xno; then
1021 AC_MSG_ERROR([Building XML docs explicitly required, but xmlto not found])
1025 AM_CONDITIONAL(DBUS_XML_DOCS_ENABLED, test x$enable_xml_docs = xyes)
1028 #### Have to go $localstatedir->$prefix/var->/usr/local/var
1030 #### find the actual value for $prefix that we'll end up with
1031 ## (I know this is broken and should be done in the Makefile, but
1032 ## that's a major pain and almost nobody actually seems to care)
1033 AS_AC_EXPAND(EXPANDED_LOCALSTATEDIR, "$localstatedir")
1034 AS_AC_EXPAND(EXPANDED_SYSCONFDIR, "$sysconfdir")
1035 AS_AC_EXPAND(EXPANDED_BINDIR, "$bindir")
1036 AS_AC_EXPAND(EXPANDED_LIBDIR, "$libdir")
1037 AS_AC_EXPAND(EXPANDED_DATADIR, "$datadir")
1039 #### Check our operating system
1040 operating_system=unknown
1041 if test -f /etc/redhat-release || test -f $EXPANDED_SYSCONFDIR/redhat-release ; then
1042 operating_system=redhat
1045 if test -f /etc/slackware-version || test -f $EXPANDED_SYSCONFDIR/slackware-version ; then
1046 operating_system=slackware
1049 #### Sort out init scripts
1051 if test x$with_init_scripts = x; then
1052 if test xredhat = x$operating_system ; then
1053 with_init_scripts=redhat
1055 if test xslackware = x$operating_system ; then
1056 with_init_scripts=slackware
1058 with_init_scripts=none
1063 AM_CONDITIONAL(DBUS_INIT_SCRIPTS_RED_HAT, test x$with_init_scripts = xredhat)
1065 AM_CONDITIONAL(DBUS_INIT_SCRIPTS_SLACKWARE, test x$with_init_scripts = xslackware)
1067 ##### Set up location for system bus socket
1068 if ! test -z "$with_system_socket"; then
1069 DBUS_SYSTEM_SOCKET=$with_system_socket
1071 DBUS_SYSTEM_SOCKET=${EXPANDED_LOCALSTATEDIR}/run/dbus/system_bus_socket
1074 AC_SUBST(DBUS_SYSTEM_SOCKET)
1075 AC_DEFINE_UNQUOTED(DBUS_SYSTEM_SOCKET,"$DBUS_SYSTEM_SOCKET",[The name of the socket the system bus listens on by default])
1077 ## system bus only listens on local domain sockets, and never
1078 ## on an abstract socket (so only root can create the socket)
1079 DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="unix:path=$DBUS_SYSTEM_SOCKET"
1080 AC_SUBST(DBUS_SYSTEM_BUS_DEFAULT_ADDRESS)
1081 AC_DEFINE_UNQUOTED(DBUS_SYSTEM_BUS_DEFAULT_ADDRESS, "$DBUS_SYSTEM_BUS_DEFAULT_ADDRESS",[The default D-Bus address of the system bus])
1083 #### Set up the pid file
1084 if ! test -z "$with_system_pid_file"; then
1085 DBUS_SYSTEM_PID_FILE=$with_system_pid_file
1086 elif test x$with_init_scripts = xredhat ; then
1087 DBUS_SYSTEM_PID_FILE=${EXPANDED_LOCALSTATEDIR}/run/messagebus.pid
1089 DBUS_SYSTEM_PID_FILE=${EXPANDED_LOCALSTATEDIR}/run/dbus/pid
1092 AC_SUBST(DBUS_SYSTEM_PID_FILE)
1094 #### Directory to check for console ownership
1095 if ! test -z "$with_console_auth_dir"; then
1096 DBUS_CONSOLE_AUTH_DIR=$with_console_auth_dir
1098 DBUS_CONSOLE_AUTH_DIR=/var/run/console/
1101 AC_SUBST(DBUS_CONSOLE_AUTH_DIR)
1102 AC_DEFINE_UNQUOTED(DBUS_CONSOLE_AUTH_DIR, "$DBUS_CONSOLE_AUTH_DIR", [Directory to check for console ownerhip])
1104 #### File to check for console ownership
1105 if test x$have_console_owner_file = xyes; then
1106 if ! test -z "$with_console_owner_file"; then
1107 DBUS_CONSOLE_OWNER_FILE=$with_console_owner_file
1109 DBUS_CONSOLE_OWNER_FILE=/dev/console
1112 DBUS_CONSOLE_OWNER_FILE=
1115 AC_SUBST(DBUS_CONSOLE_OWNER_FILE)
1116 AC_DEFINE_UNQUOTED(DBUS_CONSOLE_OWNER_FILE, "$DBUS_CONSOLE_OWNER_FILE", [File to check for console ownerhip])
1118 #### User to start the system bus as
1119 if test -z "$with_dbus_user" ; then
1120 DBUS_USER=messagebus
1122 DBUS_USER=$with_dbus_user
1125 AC_DEFINE_UNQUOTED(DBUS_USER,"$DBUS_USER", [User for running the system BUS daemon])
1127 #### Direcotry to install data files into
1128 DBUS_DATADIR=$EXPANDED_DATADIR
1129 AC_SUBST(DBUS_DATADIR)
1130 AC_DEFINE_UNQUOTED(DBUS_DATADIR,"$DBUS_DATADIR", [Directory for installing DBUS data files])
1132 #### Directory to install dbus-daemon
1133 if test -z "$with_dbus_daemondir" ; then
1134 DBUS_DAEMONDIR=$EXPANDED_BINDIR
1136 DBUS_DAEMONDIR=$with_dbus_daemondir
1138 AC_SUBST(DBUS_DAEMONDIR)
1139 AC_DEFINE_UNQUOTED(DBUS_DAEMONDIR,"$DBUS_DAEMONDIR", [Directory for installing the DBUS daemon])
1141 #### Directory to install the other binaries
1142 DBUS_BINDIR=$EXPANDED_BINDIR
1143 AC_SUBST(DBUS_BINDIR)
1144 AC_DEFINE_UNQUOTED(DBUS_BINDIR,"$DBUS_BINDIR", [Directory for installing the binaries])
1146 #### Tell tests where to find certain stuff in builddir
1149 AC_DEFUN([TEST_PATH], [
1150 TEST_$1=${DBUS_PWD}/test/$2
1151 AC_DEFINE_UNQUOTED(TEST_$1, "$TEST_$1",
1152 [Full path to test file test/$2 in builddir])
1156 TEST_PATH(SERVICE_DIR, data/valid-service-files)
1157 TEST_PATH(SERVICE_BINARY, test-service)
1158 TEST_PATH(SHELL_SERVICE_BINARY, test-shell-service)
1159 TEST_PATH(EXIT_BINARY, test-exit)
1160 TEST_PATH(SEGFAULT_BINARY, test-segfault)
1161 TEST_PATH(SLEEP_FOREVER_BINARY, test-sleep-forever)
1163 AC_DEFINE_UNQUOTED(TEST_BUS_BINARY, "$DBUS_PWD/bus/dbus-daemon",
1164 [Full path to the daemon in the builddir])
1165 AC_SUBST(TEST_BUS_BINARY)
1167 #### Find socket directories
1168 if ! test -z "$TMPDIR" ; then
1169 DEFAULT_SOCKET_DIR=$TMPDIR
1170 elif ! test -z "$TEMP" ; then
1171 DEFAULT_SOCKET_DIR=$TEMP
1172 elif ! test -z "$TMP" ; then
1173 DEFAULT_SOCKET_DIR=$TMP
1175 DEFAULT_SOCKET_DIR=/tmp
1178 if ! test -z "$with_test_socket_dir" ; then
1179 TEST_SOCKET_DIR="$with_test_socket_dir"
1181 TEST_SOCKET_DIR=$DEFAULT_SOCKET_DIR
1183 AC_SUBST(TEST_SOCKET_DIR)
1184 AC_DEFINE_UNQUOTED(DBUS_TEST_SOCKET_DIR, "$TEST_SOCKET_DIR", [Where to put test sockets])
1186 if ! test -z "$with_session_socket_dir" ; then
1187 DBUS_SESSION_SOCKET_DIR="$with_session_socket_dir"
1189 DBUS_SESSION_SOCKET_DIR=$DEFAULT_SOCKET_DIR
1191 AC_DEFINE_UNQUOTED(DBUS_SESSION_SOCKET_DIR, "$DBUS_SESSION_SOCKET_DIR", [Where per-session bus puts its sockets])
1192 AC_SUBST(DBUS_SESSION_SOCKET_DIR)
1194 AC_DEFINE_UNQUOTED(DBUS_UNIX, "1", [Defined on UNIX and Linux systems and not on Windows])
1198 dbus/dbus-arch-deps.h
1209 test/name-test/Makefile
1212 test/data/valid-config-files/debug-allow-all.conf
1213 test/data/valid-config-files/debug-allow-all-sha1.conf
1214 test/data/valid-service-files/debug-echo.service
1215 test/data/valid-service-files/debug-segfault.service
1216 test/data/valid-service-files/debug-shell-echo-success.service
1217 test/data/valid-service-files/debug-shell-echo-fail.service
1220 dnl ==========================================================================
1226 exec_prefix: ${exec_prefix}
1227 libdir: ${EXPANDED_LIBDIR}
1228 bindir: ${EXPANDED_BINDIR}
1229 sysconfdir: ${EXPANDED_SYSCONFDIR}
1230 localstatedir: ${EXPANDED_LOCALSTATEDIR}
1231 datadir: ${EXPANDED_DATADIR}
1232 source code location: ${srcdir}
1235 cppflags: ${CPPFLAGS}
1236 cxxflags: ${CXXFLAGS}
1237 64-bit int: ${DBUS_INT64_TYPE}
1238 32-bit int: ${DBUS_INT32_TYPE}
1239 16-bit int: ${DBUS_INT16_TYPE}
1244 Maintainer mode: ${USE_MAINTAINER_MODE}
1245 gcc coverage profiling: ${enable_gcov}
1246 Building unit tests: ${enable_tests}
1247 Building verbose mode: ${enable_verbose_mode}
1248 Building assertions: ${enable_asserts}
1249 Building checks: ${enable_checks}
1250 Building SELinux support: ${have_selinux}
1251 Building dnotify support: ${have_dnotify}
1252 Building X11 code: ${enable_x11}
1253 Building Doxygen docs: ${enable_doxygen_docs}
1254 Building XML docs: ${enable_xml_docs}
1255 Building cache support: ${enable_userdb_cache}
1256 Gettext libs (empty OK): ${INTLLIBS}
1257 Using XML parser: ${with_xml}
1258 Init scripts style: ${with_init_scripts}
1259 Abstract socket names: ${ac_cv_have_abstract_sockets}
1260 System bus socket: ${DBUS_SYSTEM_SOCKET}
1261 System bus address: ${DBUS_SYSTEM_BUS_DEFAULT_ADDRESS}
1262 System bus PID file: ${DBUS_SYSTEM_PID_FILE}
1263 Session bus socket dir: ${DBUS_SESSION_SOCKET_DIR}
1264 Console auth dir: ${DBUS_CONSOLE_AUTH_DIR}
1265 Console owner file: ${have_console_owner_file}
1266 Console owner file path: ${DBUS_CONSOLE_OWNER_FILE}
1267 System bus user: ${DBUS_USER}
1268 Session bus services dir: ${EXPANDED_DATADIR}/dbus-1/services
1269 'make check' socket dir: ${TEST_SOCKET_DIR}
1272 if test x$enable_tests = xyes; then
1273 echo "NOTE: building with unit tests increases the size of the installed library and renders it insecure."
1275 if test x$enable_tests = xyes -a x$enable_asserts = xno; then
1276 echo "NOTE: building with unit tests but without assertions means tests may not properly report failures (this configuration is only useful when doing something like profiling the tests)"
1278 if test x$enable_gcov = xyes; then
1279 echo "NOTE: building with coverage profiling is definitely for developers only."
1281 if test x$enable_verbose_mode = xyes; then
1282 echo "NOTE: building with verbose mode increases library size, may slightly increase security risk, and decreases performance."
1284 if test x$enable_asserts = xyes; then
1285 echo "NOTE: building with assertions increases library size and decreases performance."
1287 if test x$enable_checks = xno; then
1288 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."