8 AM_INIT_AUTOMAKE(dbus, 1.1.0)
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(dnotify, AS_HELP_STRING([--enable-dnotify],[build with dnotify support (linux only)]),enable_dnotify=$enableval,enable_dnotify=auto)
60 AC_ARG_ENABLE(kqueue, AS_HELP_STRING([--enable-kqueue],[build with kqueue support]),enable_kqueue=$enableval,enable_kqueue=auto)
61 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)
62 AC_ARG_ENABLE(userdb-cache, AS_HELP_STRING([--enable-userdb-cache],[build with userdb-cache support]),enable_userdb_cache=$enableval,enable_userdb_cache=yes)
64 AC_ARG_WITH(xml, AS_HELP_STRING([--with-xml=[libxml/expat]],[XML library to use]))
65 AC_ARG_WITH(init-scripts, AS_HELP_STRING([--with-init-scripts=[redhat]],[Style of init scripts to install]))
66 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]))
67 AC_ARG_WITH(test-socket-dir, AS_HELP_STRING([--with-test-socket-dir=[dirname]],[Where to put sockets for make check]))
68 AC_ARG_WITH(system-pid-file, AS_HELP_STRING([--with-system-pid-file=[pidfile]],[PID file for systemwide daemon]))
69 AC_ARG_WITH(system-socket, AS_HELP_STRING([--with-system-socket=[filename]],[UNIX domain socket for systemwide daemon]))
70 AC_ARG_WITH(console-auth-dir, AS_HELP_STRING([--with-console-auth-dir=[dirname]],[directory to check for console ownerhip]))
71 AC_ARG_WITH(console-owner-file, AS_HELP_STRING([--with-console-owner-file=[filename]],[file whose owner determines current console owner]))
72 AC_ARG_WITH(dbus_user, AS_HELP_STRING([--with-dbus-user=<user>],[User for running the DBUS daemon (messagebus)]))
73 AC_ARG_WITH(dbus_daemondir, AS_HELP_STRING([--with-dbus-daemondir=[dirname]],[Directory for installing the DBUS daemon]))
76 dnl DBUS_BUILD_TESTS controls unit tests built in to .c files
77 dnl and also some stuff in the test/ subdir
78 AM_CONDITIONAL(DBUS_BUILD_TESTS, test x$enable_tests = xyes)
79 if test x$enable_tests = xyes; then
80 AC_DEFINE(DBUS_BUILD_TESTS,1,[Build test code])
83 if test x$enable_verbose_mode = xyes; then
84 AC_DEFINE(DBUS_ENABLE_VERBOSE_MODE,1,[Support a verbose mode])
87 if test x$enable_asserts = xno; then
88 AC_DEFINE(DBUS_DISABLE_ASSERT,1,[Disable assertion checking])
89 AC_DEFINE(G_DISABLE_ASSERT,1,[Disable GLib assertion macros])
92 # -rdynamic is needed for glibc's backtrace_symbols to work.
93 # No clue how much overhead this adds, but it's useful
94 # to do this on any assertion failure,
95 # so for now it's enabled anytime asserts are (currently not
96 # in production builds).
98 # To get -rdynamic you pass -export-dynamic to libtool.
99 AC_DEFINE(DBUS_BUILT_R_DYNAMIC,1,[whether -export-dynamic was passed to libtool])
100 R_DYNAMIC_LDFLAG=-export-dynamic
102 AC_SUBST(R_DYNAMIC_LDFLAG)
104 if test x$enable_checks = xno; then
105 AC_DEFINE(DBUS_DISABLE_CHECKS,1,[Disable public API sanity checking])
106 AC_DEFINE(G_DISABLE_CHECKS,1,[Disable GLib public API sanity checking])
109 if test x$enable_userdb_cache = xyes; then
110 AC_DEFINE(DBUS_ENABLE_USERDB_CACHE,1,[Build with caching of user data])
113 #### gcc warning flags
116 AC_MSG_CHECKING(whether $CC supports "$@")
119 $CC -c "$@" ${Cfile}.c -o ${Cfile}.o >/dev/null 2>&1
121 rm -f ${Cfile}.c ${Cfile}.o
123 0) AC_MSG_RESULT(yes);;
124 *) AC_MSG_RESULT(no);;
129 if test "x$GCC" = "xyes"; then
132 *[\ \ ]-Wall[\ \ ]*) ;;
133 *) CFLAGS="$CFLAGS -Wall" ;;
137 *[\ \ ]-Wchar-subscripts[\ \ ]*) ;;
138 *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
142 *[\ \ ]-Wmissing-declarations[\ \ ]*) ;;
143 *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
147 *[\ \ ]-Wmissing-prototypes[\ \ ]*) ;;
148 *) CFLAGS="$CFLAGS -Wmissing-prototypes" ;;
152 *[\ \ ]-Wnested-externs[\ \ ]*) ;;
153 *) CFLAGS="$CFLAGS -Wnested-externs" ;;
157 *[\ \ ]-Wpointer-arith[\ \ ]*) ;;
158 *) CFLAGS="$CFLAGS -Wpointer-arith" ;;
162 *[\ \ ]-Wcast-align[\ \ ]*) ;;
163 *) CFLAGS="$CFLAGS -Wcast-align" ;;
167 *[\ \ ]-Wfloat-equal[\ \ ]*) ;;
168 *) if cc_supports_flag -Wfloat-equals; then
169 CFLAGS="$CFLAGS -Wfloat-equal"
175 *[\ \ ]-Wsign-compare[\ \ ]*) ;;
176 *) CFLAGS="$CFLAGS -Wsign-compare" ;;
180 *[\ \ ]-Wdeclaration-after-statement[\ \ ]*) ;;
181 *) if cc_supports_flag -Wdeclaration-after-statement; then
182 CFLAGS="$CFLAGS -Wdeclaration-after-statement"
188 *[\ \ ]-fno-common[\ \ ]*) ;;
189 *) if cc_supports_flag -fno-common; then
190 CFLAGS="$CFLAGS -fno-common"
196 *[\ \ ]-fPIC[\ \ ]*) ;;
197 *) if cc_supports_flag -fPIC; then
198 CFLAGS="$CFLAGS -fPIC"
203 if test "x$enable_ansi" = "xyes"; then
205 *[\ \ ]-ansi[\ \ ]*) ;;
206 *) CFLAGS="$CFLAGS -ansi" ;;
210 *[\ \ ]-D_POSIX_C_SOURCE*) ;;
211 *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;;
215 *[\ \ ]-D_BSD_SOURCE[\ \ ]*) ;;
216 *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;;
220 *[\ \ ]-pedantic[\ \ ]*) ;;
221 *) CFLAGS="$CFLAGS -pedantic" ;;
224 if test x$enable_gcov = xyes; then
226 *[\ \ ]-fprofile-arcs[\ \ ]*) ;;
227 *) CFLAGS="$CFLAGS -fprofile-arcs" ;;
230 *[\ \ ]-ftest-coverage[\ \ ]*) ;;
231 *) CFLAGS="$CFLAGS -ftest-coverage" ;;
234 ## remove optimization
235 CFLAGS=`echo "$CFLAGS" | sed -e 's/-O[0-9]*//g'`
239 if test x$enable_gcov = xyes; then
240 AC_MSG_ERROR([--enable-gcov can only be used with gcc])
244 # Add -D_POSIX_PTHREAD_SEMANTICS if on Solaris
248 CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS" ;;
254 # compress spaces in flags
255 CFLAGS=`echo "$CFLAGS" | sed -e 's/ +/ /g'`
256 CXXFLAGS=`echo "$CXXFLAGS" | sed -e 's/ +/ /g'`
257 CPPFLAGS=`echo "$CPPFLAGS" | sed -e 's/ +/ /g'`
260 if test x$enable_gcov = xyes; then
261 ## so that config.h changes when you toggle gcov support
262 AC_DEFINE_UNQUOTED(DBUS_GCOV_ENABLED, 1, [Defined if gcov is enabled to force a rebuild due to config.h changing])
264 AC_MSG_CHECKING([for gcc 3.3 version of gcov file format])
266 AC_RUN_IFELSE( [AC_LANG_PROGRAM( , [[ if (__GNUC__ >=3 && __GNUC_MINOR__ >= 3) exit (0); else exit (1); ]])],
268 if test x$have_gcc33_gcov = xyes ; then
269 AC_DEFINE_UNQUOTED(DBUS_HAVE_GCC33_GCOV, 1, [Defined if we have gcc 3.3 and thus the new gcov format])
271 AC_MSG_RESULT($have_gcc33_gcov)
273 AM_CONDITIONAL(DBUS_GCOV_ENABLED, test x$enable_gcov = xyes)
277 AC_CHECK_SIZEOF(char)
278 AC_CHECK_SIZEOF(short)
279 AC_CHECK_SIZEOF(long)
281 AC_CHECK_SIZEOF(void *)
282 AC_CHECK_SIZEOF(long long)
283 AC_CHECK_SIZEOF(__int64)
285 ### See what our 64 bit type is called
286 AC_MSG_CHECKING([64-bit integer type])
291 dbusint64_constant='(val)'
292 dbusuint64_constant='(val)'
296 dbusint64_constant='(val##L)'
297 dbusuint64_constant='(val##UL)'
299 $ac_cv_sizeof_long_long)
300 dbusint64='long long'
301 dbusint64_constant='(val##LL)'
302 dbusuint64_constant='(val##ULL)'
304 $ac_cv_sizeof___int64)
306 dbusint64_constant='(val##i64)'
307 dbusuint64_constant='(val##ui64)'
311 if test -z "$dbusint64" ; then
312 DBUS_INT64_TYPE="no_int64_type_detected"
315 DBUS_UINT64_CONSTANT=
316 AC_MSG_RESULT([none found])
318 DBUS_INT64_TYPE="$dbusint64"
320 DBUS_INT64_CONSTANT="$dbusint64_constant"
321 DBUS_UINT64_CONSTANT="$dbusuint64_constant"
322 AC_MSG_RESULT($DBUS_INT64_TYPE)
325 AC_SUBST(DBUS_INT64_TYPE)
326 AC_SUBST(DBUS_INT64_CONSTANT)
327 AC_SUBST(DBUS_UINT64_CONSTANT)
328 AC_SUBST(DBUS_HAVE_INT64)
330 ### see what 32-bit int is called
331 AC_MSG_CHECKING([32-bit integer type])
345 if test -z "$dbusint32" ; then
346 DBUS_INT32_TYPE="no_int32_type_detected"
347 AC_MSG_ERROR([No 32-bit integer type found])
349 DBUS_INT32_TYPE="$dbusint32"
350 AC_MSG_RESULT($DBUS_INT32_TYPE)
353 AC_SUBST(DBUS_INT32_TYPE)
355 ### see what 16-bit int is called
356 AC_MSG_CHECKING([16-bit integer type])
367 if test -z "$dbusint16" ; then
368 DBUS_INT16_TYPE="no_int16_type_detected"
369 AC_MSG_ERROR([No 16-bit integer type found])
371 DBUS_INT16_TYPE="$dbusint16"
372 AC_MSG_RESULT($DBUS_INT16_TYPE)
375 AC_SUBST(DBUS_INT16_TYPE)
380 # check at compile-time, so that it is possible to build universal
381 # (with multiple architectures at once on the compile line)
382 AH_VERBATIM([WORDS_BIGENDIAN_DARWIN], [
383 /* Use the compiler-provided endianness defines to allow universal compiling. */
384 #if defined(__BIG_ENDIAN__)
385 #define WORDS_BIGENDIAN 1
394 dnl **********************************
395 dnl *** va_copy checks (from GLib) ***
396 dnl **********************************
397 dnl we currently check for all three va_copy possibilities, so we get
398 dnl all results in config.log for bug reports.
399 AC_CACHE_CHECK([for an implementation of va_copy()],dbus_cv_va_copy,[
400 AC_LINK_IFELSE([#include <stdarg.h>
401 void f (int i, ...) {
402 va_list args1, args2;
404 va_copy (args2, args1);
405 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
407 va_end (args1); va_end (args2);
413 [dbus_cv_va_copy=yes],
414 [dbus_cv_va_copy=no])
416 AC_CACHE_CHECK([for an implementation of __va_copy()],dbus_cv___va_copy,[
417 AC_LINK_IFELSE([#include <stdarg.h>
418 void f (int i, ...) {
419 va_list args1, args2;
421 __va_copy (args2, args1);
422 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
424 va_end (args1); va_end (args2);
430 [dbus_cv___va_copy=yes],
431 [dbus_cv___va_copy=no])
434 if test "x$dbus_cv_va_copy" = "xyes"; then
435 dbus_va_copy_func=va_copy
436 else if test "x$dbus_cv___va_copy" = "xyes"; then
437 dbus_va_copy_func=__va_copy
441 if test -n "$dbus_va_copy_func"; then
442 AC_DEFINE_UNQUOTED(DBUS_VA_COPY,$dbus_va_copy_func,[A 'va_copy' style function])
446 AC_CACHE_CHECK([whether va_lists can be copied by value],
448 [AC_RUN_IFELSE([AC_LANG_PROGRAM(
453 void f (int i, ...) {
454 va_list args1, args2;
457 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
459 va_end (args1); va_end (args2);
466 [dbus_cv_va_val_copy=yes],
467 [dbus_cv_va_val_copy=no],
468 [dbus_cv_va_val_copy=yes])
472 if test "x$dbus_cv_va_val_copy" = "xno"; then
473 AC_DEFINE(DBUS_VA_COPY_AS_ARRAY,1, ['va_lists' cannot be copies as values])
477 #### Atomic integers (checks by Sebastian Wilhelmi for GLib)
478 AC_MSG_CHECKING([whether to use inline assembler routines for atomic integers])
480 if test x"$GCC" = xyes; then
481 if test "x$enable_ansi" = "xyes"; then
491 AC_MSG_RESULT([darwin])
492 # check at compile-time, so that it is possible to build universal
493 # (with multiple architectures at once on the compile line)
494 AH_VERBATIM([DBUS_USE_ATOMIC_INT_486_DARWIN], [
495 #if (defined(__i386__) || defined(__x86_64__))
496 # define DBUS_USE_ATOMIC_INT_486 1
501 AC_MSG_RESULT([i486])
502 AC_DEFINE_UNQUOTED(DBUS_USE_ATOMIC_INT_486, 1, [Use atomic integer implementation for 486])
513 if test x$have_atomic_inc = xyes ; then
516 AH_VERBATIM([DBUS_HAVE_ATOMIC_INT_DARWIN], [
517 #if (defined(__i386__) || defined(__x86_64__))
518 # define DBUS_HAVE_ATOMIC_INT 1
523 AC_DEFINE_UNQUOTED(DBUS_HAVE_ATOMIC_INT, 1, [Some atomic integer implementation present])
528 #### Various functions
529 AC_CHECK_LIB(socket,socket)
530 AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)])
532 AC_CHECK_FUNCS(vsnprintf vasprintf nanosleep usleep poll setenv unsetenv socketpair getgrouplist fpathconf)
534 AC_MSG_CHECKING(for dirfd)
536 #include <sys/types.h>
544 dbus_have_dirfd=yes, dbus_have_dirfd=no)
545 AC_MSG_RESULT($dbus_have_dirfd)
546 if test "$dbus_have_dirfd" = yes; then
547 AC_DEFINE(HAVE_DIRFD,1,[Have dirfd function])
549 AC_MSG_CHECKING(for DIR *dirp->dd_fd)
551 #include <sys/types.h>
560 dbus_have_ddfd=yes, dbus_have_ddfd=no)
561 AC_MSG_RESULT($dbus_have_ddfd)
562 if test "$dbus_have_ddfd" = yes; then
563 AC_DEFINE(HAVE_DDFD,1,[Have the ddfd member of DIR])
567 AC_CHECK_HEADERS(execinfo.h, [AC_CHECK_FUNCS(backtrace)])
569 AC_CHECK_HEADERS(errno.h)
571 # checking for a posix version of getpwnam_r
572 # if we are cross compiling and can not run the test
573 # assume getpwnam_r is the posix version
574 # it is up to the person cross compiling to change
575 # this behavior if desired
577 AC_CACHE_CHECK([for posix getpwnam_r],
578 ac_cv_func_posix_getpwnam_r,
579 [AC_RUN_IFELSE([AC_LANG_PROGRAM(
586 struct passwd pwd, *pwptr = &pwd;
589 error = getpwnam_r ("", &pwd, buffer,
590 sizeof (buffer), &pwptr);
591 return (error < 0 && errno == ENOSYS)
594 [ac_cv_func_posix_getpwnam_r=yes],
595 [ac_cv_func_posix_getpwnam_r=no],
596 [ac_cv_func_posix_getpwnam_r=yes]
600 if test "$ac_cv_func_posix_getpwnam_r" = yes; then
601 AC_DEFINE(HAVE_POSIX_GETPWNAM_R,1,
602 [Have POSIX function getpwnam_r])
604 AC_CACHE_CHECK([for nonposix getpwnam_r],
605 ac_cv_func_nonposix_getpwnam_r,
606 [AC_TRY_LINK([#include <pwd.h>],
609 getpwnam_r ("", &pwd, buffer,
611 [ac_cv_func_nonposix_getpwnam_r=yes],
612 [ac_cv_func_nonposix_getpwnam_r=no])])
613 if test "$ac_cv_func_nonposix_getpwnam_r" = yes; then
614 AC_DEFINE(HAVE_NONPOSIX_GETPWNAM_R,1,
615 [Have non-POSIX function getpwnam_r])
619 dnl check for socklen_t
620 AC_MSG_CHECKING(whether socklen_t is defined)
622 #include <sys/types.h>
623 #include <sys/socket.h>
628 ],dbus_have_socklen_t=yes,dbus_have_socklen_t=no)
629 AC_MSG_RESULT($dbus_have_socklen_t)
631 if test "x$dbus_have_socklen_t" = "xyes"; then
632 AC_DEFINE(HAVE_SOCKLEN_T,1,[Have socklen_t type])
635 dnl check for writev header and writev function so we're
636 dnl good to go if HAVE_WRITEV gets defined.
637 AC_CHECK_HEADERS(sys/uio.h, [AC_CHECK_FUNCS(writev)])
639 dnl needed on darwin for NAME_MAX
640 AC_CHECK_HEADERS(sys/syslimits.h)
642 dnl check for flavours of varargs macros (test from GLib)
643 AC_MSG_CHECKING(for ISO C99 varargs macros in C)
645 int a(int p1, int p2, int p3);
646 #define call_a(...) a(1,__VA_ARGS__)
648 ],dbus_have_iso_c_varargs=yes,dbus_have_iso_c_varargs=no)
649 AC_MSG_RESULT($dbus_have_iso_c_varargs)
651 AC_MSG_CHECKING(for GNUC varargs macros)
653 int a(int p1, int p2, int p3);
654 #define call_a(params...) a(1,params)
656 ],dbus_have_gnuc_varargs=yes,dbus_have_gnuc_varargs=no)
657 AC_MSG_RESULT($dbus_have_gnuc_varargs)
659 dnl Output varargs tests
660 if test x$dbus_have_iso_c_varargs = xyes; then
661 AC_DEFINE(HAVE_ISO_VARARGS,1,[Have ISO C99 varargs macros])
663 if test x$dbus_have_gnuc_varargs = xyes; then
664 AC_DEFINE(HAVE_GNUC_VARARGS,1,[Have GNU-style varargs macros])
667 dnl Check for various credentials.
668 AC_MSG_CHECKING(for struct cmsgcred)
670 #include <sys/types.h>
671 #include <sys/socket.h>
673 struct cmsgcred cred;
676 ],dbus_have_struct_cmsgcred=yes,dbus_have_struct_cmsgcred=no)
677 AC_MSG_RESULT($dbus_have_struct_cmsgcred)
679 if test x$dbus_have_struct_cmsgcred = xyes; then
680 AC_DEFINE(HAVE_CMSGCRED,1,[Have cmsgcred structure])
683 AC_CHECK_FUNCS(getpeerucred getpeereid)
685 #### Abstract sockets
688 AC_CACHE_CHECK([abstract socket namespace],
689 ac_cv_have_abstract_sockets,
690 [AC_RUN_IFELSE([AC_LANG_PROGRAM(
692 #include <sys/types.h>
696 #include <sys/socket.h>
702 struct sockaddr_un addr;
704 listen_fd = socket (PF_UNIX, SOCK_STREAM, 0);
708 fprintf (stderr, "socket() failed: %s\n", strerror (errno));
712 memset (&addr, '\0', sizeof (addr));
713 addr.sun_family = AF_UNIX;
714 strcpy (addr.sun_path, "X/tmp/dbus-fake-socket-path-used-in-configure-test");
715 addr.sun_path[0] = '\0'; /* this is what makes it abstract */
717 if (bind (listen_fd, (struct sockaddr*) &addr, SUN_LEN (&addr)) < 0)
719 fprintf (stderr, "Abstract socket namespace bind() failed: %s\n",
726 [ac_cv_have_abstract_sockets=yes],
727 [ac_cv_have_abstract_sockets=no]
731 if test x$enable_abstract_sockets = xyes; then
732 if test x$ac_cv_have_abstract_sockets = xno; then
733 AC_MSG_ERROR([Abstract sockets explicitly required, and support not detected.])
737 if test x$enable_abstract_sockets = xno; then
738 ac_cv_have_abstract_sockets=no;
741 if test x$ac_cv_have_abstract_sockets = xyes ; then
742 DBUS_PATH_OR_ABSTRACT=abstract
743 AC_DEFINE(HAVE_ABSTRACT_SOCKETS,1,[Have abstract socket namespace])
745 DBUS_PATH_OR_ABSTRACT=path
748 # this is used in addresses to prefer abstract, e.g.
749 # unix:path=/foo or unix:abstract=/foo
750 AC_SUBST(DBUS_PATH_OR_ABSTRACT)
752 #### Sort out XML library
755 AC_CHECK_LIB(expat, XML_ParserCreate_MM,
756 [ AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false) ],
759 PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= 2.6.0, have_libxml=true, have_libxml=false)
761 # see what we want to use
762 dbus_use_libxml=false
764 if test x$with_xml = xexpat; then
766 if ! $have_expat ; then
767 AC_MSG_ERROR([Explicitly requested expat but expat not found])
769 elif test x$with_xml = xlibxml; then
771 if ! $have_libxml ; then
772 AC_MSG_ERROR([Explicitly requested libxml but libxml not found])
775 ### expat is the default because libxml can't currently survive
776 ### our brutal OOM-handling unit test setup.
777 ### http://bugzilla.gnome.org/show_bug.cgi?id=109368
778 if $have_expat ; then
781 elif $have_libxml ; then
785 AC_MSG_ERROR([No XML library found, check config.log for failed attempts])
789 AM_CONDITIONAL(DBUS_USE_EXPAT, $dbus_use_expat)
790 AM_CONDITIONAL(DBUS_USE_LIBXML, $dbus_use_libxml)
792 if $dbus_use_expat; then
796 if $dbus_use_libxml; then
797 XML_LIBS=$LIBXML_LIBS
798 XML_CFLAGS=$LIBXML_CFLAGS
801 # Thread lib detection
802 AC_CHECK_FUNC(pthread_cond_timedwait,,[AC_CHECK_LIB(pthread,pthread_cond_timedwait,
803 [THREAD_LIBS="-lpthread"])])
806 if test x$enable_selinux = xno ; then
809 # See if we have SELinux library
810 AC_CHECK_LIB(selinux, is_selinux_enabled,
811 have_selinux=yes, have_selinux=no)
813 # see if we have the SELinux header with the new D-Bus stuff in it
814 if test x$have_selinux = xyes ; then
815 AC_MSG_CHECKING([for DBUS Flask permissions in selinux/av_permissions.h])
816 AC_TRY_COMPILE([#include <selinux/av_permissions.h>],
817 [#ifdef DBUS__ACQUIRE_SVC return 0;
819 #error DBUS__ACQUIRE_SVC not defined
821 have_selinux=yes, have_selinux=no)
822 AC_MSG_RESULT($have_selinux)
825 if test x$enable_selinux = xauto ; then
826 if test x$have_selinux = xno ; then
827 AC_MSG_WARN([Sufficiently new SELinux library not found])
830 if test x$have_selinux = xno ; then
831 AC_MSG_ERROR([SElinux explicitly required, and SELinux library not found])
836 AM_CONDITIONAL(HAVE_SELINUX, test x$have_selinux = xyes)
838 if test x$have_selinux = xyes ; then
839 # the selinux code creates threads
840 # which requires libpthread even on linux
841 AC_CHECK_FUNC(pthread_create,,[AC_CHECK_LIB(pthread,pthread_create,
842 [SELINUX_THREAD_LIBS="-lpthread"])])
844 SELINUX_LIBS="-lselinux $SELINUX_THREAD_LIBS"
845 AC_DEFINE(HAVE_SELINUX,1,[SELinux support])
851 if test x$enable_dnotify = xno ; then
854 if test x$target_os = xlinux-gnu -o x$target_os = xlinux; then
861 dnl check if dnotify backend is enabled
862 if test x$have_dnotify = xyes; then
863 AC_DEFINE(DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX,1,[Use dnotify on Linux])
866 AM_CONDITIONAL(DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX, test x$have_dnotify = xyes)
869 if test x$enable_kqueue = xno ; then
873 AC_CHECK_HEADER(sys/event.h, , have_kqueue=no)
874 AC_CHECK_FUNC(kqueue, , have_kqueue=no)
876 if test x$enable_kqueue = xyes -a x$have_kqueue = xno; then
877 AC_MSG_ERROR(kqueue support explicitly enabled but not available)
881 dnl check if kqueue backend is enabled
882 if test x$have_kqueue = xyes; then
883 AC_DEFINE(DBUS_BUS_ENABLE_KQUEUE,1,[Use kqueue])
886 AM_CONDITIONAL(DBUS_BUS_ENABLE_KQUEUE, test x$have_kqueue = xyes)
888 dnl console owner file
889 if test x$enable_console_owner_file = xno ; then
890 have_console_owner_file=no;
894 have_console_owner_file=yes;
895 AC_DEFINE(HAVE_CONSOLE_OWNER_FILE,1,[Have console owner file])
898 have_console_owner_file=no;;
902 AM_CONDITIONAL(HAVE_CONSOLE_OWNER_FILE, test x$have_console_owner_file = xyes)
904 #### Set up final flags
906 DBUS_CLIENT_LIBS="$THREAD_LIBS"
907 AC_SUBST(DBUS_CLIENT_CFLAGS)
908 AC_SUBST(DBUS_CLIENT_LIBS)
910 DBUS_BUS_CFLAGS=$XML_CFLAGS
911 DBUS_BUS_LIBS="$XML_LIBS $SELINUX_LIBS $INTLLIBS $THREAD_LIBS"
912 AC_SUBST(DBUS_BUS_CFLAGS)
913 AC_SUBST(DBUS_BUS_LIBS)
916 DBUS_TEST_LIBS="$THREAD_LIBS"
917 AC_SUBST(DBUS_TEST_CFLAGS)
918 AC_SUBST(DBUS_TEST_LIBS)
923 ## for now enable_x11 just tracks have_x11,
924 ## there's no --enable-x11
925 if test x$no_x = xyes ; then
933 if test x$enable_x11 = xyes ; then
934 AC_DEFINE(DBUS_BUILD_X11,1,[Build X11-dependent code])
935 DBUS_X_LIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
936 DBUS_X_CFLAGS="$X_CFLAGS"
942 AC_SUBST(DBUS_X_CFLAGS)
943 AC_SUBST(DBUS_X_LIBS)
945 ### Doxygen Documentation
947 AC_PATH_PROG(DOXYGEN, doxygen, no)
949 AC_MSG_CHECKING([whether to build Doxygen documentation])
951 if test x$DOXYGEN = xno ; then
957 if test x$enable_doxygen_docs = xauto ; then
958 if test x$have_doxygen = xno ; then
959 enable_doxygen_docs=no
961 enable_doxygen_docs=yes
965 if test x$enable_doxygen_docs = xyes; then
966 if test x$have_doxygen = xno; then
967 AC_MSG_ERROR([Building Doxygen docs explicitly required, but Doxygen not found])
971 AM_CONDITIONAL(DBUS_DOXYGEN_DOCS_ENABLED, test x$enable_doxygen_docs = xyes)
974 ### XML Documentation
976 AC_PATH_PROG(XMLTO, xmlto, no)
978 AC_MSG_CHECKING([whether to build XML documentation])
980 if test x$XMLTO = xno ; then
986 if test x$enable_xml_docs = xauto ; then
987 if test x$have_xmlto = xno ; then
994 if test x$enable_xml_docs = xyes; then
995 if test x$have_xmlto = xno; then
996 AC_MSG_ERROR([Building XML docs explicitly required, but xmlto not found])
1000 AM_CONDITIONAL(DBUS_XML_DOCS_ENABLED, test x$enable_xml_docs = xyes)
1003 #### Have to go $localstatedir->$prefix/var->/usr/local/var
1004 #### someone please fix this a better way...
1006 #### find the actual value for $prefix that we'll end up with
1007 ## (I know this is broken and should be done in the Makefile, but
1008 ## that's a major pain and almost nobody actually seems to care)
1010 if test "x$prefix" = "xNONE"; then
1011 REAL_PREFIX=$ac_default_prefix
1016 ## temporarily change prefix and exec_prefix
1020 if test "x$exec_prefix" = xNONE ; then
1021 REAL_EXEC_PREFIX=$REAL_PREFIX
1023 REAL_EXEC_PREFIX=$exec_prefix
1025 old_exec_prefix=$exec_prefix
1026 exec_prefix=$REAL_EXEC_PREFIX
1029 LOCALSTATEDIR_TMP="$localstatedir"
1030 EXPANDED_LOCALSTATEDIR=`eval echo $LOCALSTATEDIR_TMP`
1031 AC_SUBST(EXPANDED_LOCALSTATEDIR)
1033 SYSCONFDIR_TMP="$sysconfdir"
1034 EXPANDED_SYSCONFDIR=`eval echo $SYSCONFDIR_TMP`
1035 AC_SUBST(EXPANDED_SYSCONFDIR)
1037 BINDIR_TMP="$bindir"
1038 EXPANDED_BINDIR=`eval echo $BINDIR_TMP`
1039 AC_SUBST(EXPANDED_BINDIR)
1041 LIBDIR_TMP="$libdir"
1042 EXPANDED_LIBDIR=`eval echo $LIBDIR_TMP`
1043 AC_SUBST(EXPANDED_LIBDIR)
1045 DATADIR_TMP="$datadir"
1046 EXPANDED_DATADIR=`eval echo $DATADIR_TMP`
1047 AC_SUBST(EXPANDED_DATADIR)
1049 ## put prefix and exec_prefix back
1051 exec_prefix=$old_exec_prefix
1053 #### Check our operating system
1054 operating_system=unknown
1055 if test -f /etc/redhat-release || test -f $EXPANDED_SYSCONFDIR/redhat-release ; then
1056 operating_system=redhat
1059 if test -f /etc/slackware-version || test -f $EXPANDED_SYSCONFDIR/slackware-version ; then
1060 operating_system=slackware
1063 #### Sort out init scripts
1065 if test x$with_init_scripts = x; then
1066 if test xredhat = x$operating_system ; then
1067 with_init_scripts=redhat
1069 if test xslackware = x$operating_system ; then
1070 with_init_scripts=slackware
1072 with_init_scripts=none
1077 AM_CONDITIONAL(DBUS_INIT_SCRIPTS_RED_HAT, test x$with_init_scripts = xredhat)
1079 AM_CONDITIONAL(DBUS_INIT_SCRIPTS_SLACKWARE, test x$with_init_scripts = xslackware)
1081 ##### Set up location for system bus socket
1082 if ! test -z "$with_system_socket"; then
1083 DBUS_SYSTEM_SOCKET=$with_system_socket
1085 DBUS_SYSTEM_SOCKET=${EXPANDED_LOCALSTATEDIR}/run/dbus/system_bus_socket
1088 AC_SUBST(DBUS_SYSTEM_SOCKET)
1089 AC_DEFINE_UNQUOTED(DBUS_SYSTEM_SOCKET,"$DBUS_SYSTEM_SOCKET",[The name of the socket the system bus listens on by default])
1091 ## system bus only listens on local domain sockets, and never
1092 ## on an abstract socket (so only root can create the socket)
1093 DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="unix:path=$DBUS_SYSTEM_SOCKET"
1094 AC_SUBST(DBUS_SYSTEM_BUS_DEFAULT_ADDRESS)
1095 AC_DEFINE_UNQUOTED(DBUS_SYSTEM_BUS_DEFAULT_ADDRESS, "$DBUS_SYSTEM_BUS_DEFAULT_ADDRESS",[The default D-Bus address of the system bus])
1097 #### Set up the pid file
1098 if ! test -z "$with_system_pid_file"; then
1099 DBUS_SYSTEM_PID_FILE=$with_system_pid_file
1100 elif test x$with_init_scripts = xredhat ; then
1101 DBUS_SYSTEM_PID_FILE=${EXPANDED_LOCALSTATEDIR}/run/messagebus.pid
1103 DBUS_SYSTEM_PID_FILE=${EXPANDED_LOCALSTATEDIR}/run/dbus/pid
1106 AC_SUBST(DBUS_SYSTEM_PID_FILE)
1108 #### Directory to check for console ownership
1109 if ! test -z "$with_console_auth_dir"; then
1110 DBUS_CONSOLE_AUTH_DIR=$with_console_auth_dir
1112 DBUS_CONSOLE_AUTH_DIR=/var/run/console/
1115 AC_SUBST(DBUS_CONSOLE_AUTH_DIR)
1116 AC_DEFINE_UNQUOTED(DBUS_CONSOLE_AUTH_DIR, "$DBUS_CONSOLE_AUTH_DIR", [Directory to check for console ownerhip])
1118 #### File to check for console ownership
1119 if test x$have_console_owner_file = xyes; then
1120 if ! test -z "$with_console_owner_file"; then
1121 DBUS_CONSOLE_OWNER_FILE=$with_console_owner_file
1123 DBUS_CONSOLE_OWNER_FILE=/dev/console
1126 DBUS_CONSOLE_OWNER_FILE=
1129 AC_SUBST(DBUS_CONSOLE_OWNER_FILE)
1130 AC_DEFINE_UNQUOTED(DBUS_CONSOLE_OWNER_FILE, "$DBUS_CONSOLE_OWNER_FILE", [File to check for console ownerhip])
1132 #### User to start the system bus as
1133 if test -z "$with_dbus_user" ; then
1134 DBUS_USER=messagebus
1136 DBUS_USER=$with_dbus_user
1139 AC_DEFINE_UNQUOTED(DBUS_USER,"$DBUS_USER", [User for running the system BUS daemon])
1141 #### Direcotry to install data files into
1142 DBUS_DATADIR=$EXPANDED_DATADIR
1143 AC_SUBST(DBUS_DATADIR)
1144 AC_DEFINE_UNQUOTED(DBUS_DATADIR,"$DBUS_DATADIR", [Directory for installing DBUS data files])
1146 #### Directory to install dbus-daemon
1147 if test -z "$with_dbus_daemondir" ; then
1148 DBUS_DAEMONDIR=$EXPANDED_BINDIR
1150 DBUS_DAEMONDIR=$with_dbus_daemondir
1152 AC_SUBST(DBUS_DAEMONDIR)
1153 AC_DEFINE_UNQUOTED(DBUS_DAEMONDIR,"$DBUS_DAEMONDIR", [Directory for installing the DBUS daemon])
1155 #### Directory to install the other binaries
1156 DBUS_BINDIR=$EXPANDED_BINDIR
1157 AC_SUBST(DBUS_BINDIR)
1158 AC_DEFINE_UNQUOTED(DBUS_BINDIR,"$DBUS_BINDIR", [Directory for installing the binaries])
1160 #### Tell tests where to find certain stuff in builddir
1163 AC_DEFUN([TEST_PATH], [
1164 TEST_$1=${DBUS_PWD}/test/$2
1165 AC_DEFINE_UNQUOTED(TEST_$1, "$TEST_$1",
1166 [Full path to test file test/$2 in builddir])
1170 TEST_PATH(SERVICE_DIR, data/valid-service-files)
1171 TEST_PATH(SERVICE_BINARY, test-service)
1172 TEST_PATH(SHELL_SERVICE_BINARY, test-shell-service)
1173 TEST_PATH(EXIT_BINARY, test-exit)
1174 TEST_PATH(SEGFAULT_BINARY, test-segfault)
1175 TEST_PATH(SLEEP_FOREVER_BINARY, test-sleep-forever)
1177 AC_DEFINE_UNQUOTED(TEST_BUS_BINARY, "$DBUS_PWD/bus/dbus-daemon",
1178 [Full path to the daemon in the builddir])
1179 AC_SUBST(TEST_BUS_BINARY)
1181 #### Find socket directories
1182 if ! test -z "$TMPDIR" ; then
1183 DEFAULT_SOCKET_DIR=$TMPDIR
1184 elif ! test -z "$TEMP" ; then
1185 DEFAULT_SOCKET_DIR=$TEMP
1186 elif ! test -z "$TMP" ; then
1187 DEFAULT_SOCKET_DIR=$TMP
1189 DEFAULT_SOCKET_DIR=/tmp
1192 if ! test -z "$with_test_socket_dir" ; then
1193 TEST_SOCKET_DIR="$with_test_socket_dir"
1195 TEST_SOCKET_DIR=$DEFAULT_SOCKET_DIR
1197 AC_SUBST(TEST_SOCKET_DIR)
1198 AC_DEFINE_UNQUOTED(DBUS_TEST_SOCKET_DIR, "$TEST_SOCKET_DIR", [Where to put test sockets])
1200 if ! test -z "$with_session_socket_dir" ; then
1201 DBUS_SESSION_SOCKET_DIR="$with_session_socket_dir"
1203 DBUS_SESSION_SOCKET_DIR=$DEFAULT_SOCKET_DIR
1205 AC_DEFINE_UNQUOTED(DBUS_SESSION_SOCKET_DIR, "$DBUS_SESSION_SOCKET_DIR", [Where per-session bus puts its sockets])
1206 AC_SUBST(DBUS_SESSION_SOCKET_DIR)
1210 dbus/dbus-arch-deps.h
1221 test/name-test/Makefile
1224 test/data/valid-config-files/debug-allow-all.conf
1225 test/data/valid-config-files/debug-allow-all-sha1.conf
1226 test/data/valid-service-files/debug-echo.service
1227 test/data/valid-service-files/debug-segfault.service
1228 test/data/valid-service-files/debug-shell-echo-success.service
1229 test/data/valid-service-files/debug-shell-echo-fail.service
1232 dnl ==========================================================================
1238 exec_prefix: ${exec_prefix}
1239 libdir: ${EXPANDED_LIBDIR}
1240 bindir: ${EXPANDED_BINDIR}
1241 sysconfdir: ${EXPANDED_SYSCONFDIR}
1242 localstatedir: ${EXPANDED_LOCALSTATEDIR}
1243 datadir: ${EXPANDED_DATADIR}
1244 source code location: ${srcdir}
1247 cppflags: ${CPPFLAGS}
1248 cxxflags: ${CXXFLAGS}
1249 64-bit int: ${DBUS_INT64_TYPE}
1250 32-bit int: ${DBUS_INT32_TYPE}
1251 16-bit int: ${DBUS_INT16_TYPE}
1256 Maintainer mode: ${USE_MAINTAINER_MODE}
1257 gcc coverage profiling: ${enable_gcov}
1258 Building unit tests: ${enable_tests}
1259 Building verbose mode: ${enable_verbose_mode}
1260 Building assertions: ${enable_asserts}
1261 Building checks: ${enable_checks}
1262 Building SELinux support: ${have_selinux}
1263 Building dnotify support: ${have_dnotify}
1264 Building X11 code: ${enable_x11}
1265 Building Doxygen docs: ${enable_doxygen_docs}
1266 Building XML docs: ${enable_xml_docs}
1267 Building cache support: ${enable_userdb_cache}
1268 Gettext libs (empty OK): ${INTLLIBS}
1269 Using XML parser: ${with_xml}
1270 Init scripts style: ${with_init_scripts}
1271 Abstract socket names: ${ac_cv_have_abstract_sockets}
1272 System bus socket: ${DBUS_SYSTEM_SOCKET}
1273 System bus address: ${DBUS_SYSTEM_BUS_DEFAULT_ADDRESS}
1274 System bus PID file: ${DBUS_SYSTEM_PID_FILE}
1275 Session bus socket dir: ${DBUS_SESSION_SOCKET_DIR}
1276 Console auth dir: ${DBUS_CONSOLE_AUTH_DIR}
1277 Console owner file: ${have_console_owner_file}
1278 Console owner file path: ${DBUS_CONSOLE_OWNER_FILE}
1279 System bus user: ${DBUS_USER}
1280 Session bus services dir: ${EXPANDED_DATADIR}/dbus-1/services
1281 'make check' socket dir: ${TEST_SOCKET_DIR}
1284 if test x$enable_tests = xyes; then
1285 echo "NOTE: building with unit tests increases the size of the installed library and renders it insecure."
1287 if test x$enable_tests = xyes -a x$enable_asserts = xno; then
1288 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)"
1290 if test x$enable_gcov = xyes; then
1291 echo "NOTE: building with coverage profiling is definitely for developers only."
1293 if test x$enable_verbose_mode = xyes; then
1294 echo "NOTE: building with verbose mode increases library size, may slightly increase security risk, and decreases performance."
1296 if test x$enable_asserts = xyes; then
1297 echo "NOTE: building with assertions increases library size and decreases performance."
1299 if test x$enable_checks = xno; then
1300 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."