6 AM_INIT_AUTOMAKE(dbus, 0.35)
8 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(qt, [ --enable-qt enable Qt-friendly client library],enable_qt=$enableval,enable_qt=auto)
50 AC_ARG_ENABLE(glib, [ --enable-glib enable GLib-friendly client library],enable_glib=$enableval,enable_glib=auto)
51 AC_ARG_ENABLE(gtk, [ --enable-gtk enable GTK-requiring executables],enable_gtk=$enableval,enable_gtk=auto)
52 AC_ARG_ENABLE(tests, [ --enable-tests enable unit test code],enable_tests=$enableval,enable_tests=$USE_MAINTAINER_MODE)
53 AC_ARG_ENABLE(ansi, [ --enable-ansi enable -ansi -pedantic gcc flags],enable_ansi=$enableval,enable_ansi=no)
54 AC_ARG_ENABLE(verbose-mode, [ --enable-verbose-mode support verbose debug mode],enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
55 AC_ARG_ENABLE(asserts, [ --enable-asserts include assertion checks],enable_asserts=$enableval,enable_asserts=$USE_MAINTAINER_MODE)
56 AC_ARG_ENABLE(checks, [ --enable-checks include sanity checks on public API],enable_checks=$enableval,enable_checks=yes)
57 AC_ARG_ENABLE(xml-docs, [ --enable-xml-docs build XML documentation (requires xmlto)],enable_xml_docs=$enableval,enable_xml_docs=auto)
58 AC_ARG_ENABLE(doxygen-docs, [ --enable-doxygen-docs build DOXYGEN documentation (requires Doxygen)],enable_doxygen_docs=$enableval,enable_doxygen_docs=auto)
59 AC_ARG_ENABLE(gcov, [ --enable-gcov compile with coverage profiling instrumentation (gcc only)],enable_gcov=$enableval,enable_gcov=no)
60 AC_ARG_ENABLE(abstract-sockets, [ --enable-abstract-sockets use abstract socket namespace (linux only)],enable_abstract_sockets=$enableval,enable_abstract_sockets=auto)
61 AC_ARG_ENABLE(gcj, [ --enable-gcj build gcj bindings],enable_gcj=$enableval,enable_gcj=no)
62 AC_ARG_ENABLE(mono, [ --enable-mono build mono bindings],enable_mono=$enableval,enable_mono=auto)
63 AC_ARG_ENABLE(mono_docs, [ --enable-mono-docs build mono docs],enable_mono_docs=$enableval,enable_mono_docs=auto)
64 AC_ARG_ENABLE(python, [ --enable-python build python bindings],enable_python=$enableval,enable_python=auto)
65 AC_ARG_ENABLE(selinux, [ --enable-selinux build with SELinux support],enable_selinux=$enableval,enable_selinux=auto)
67 AC_ARG_WITH(xml, [ --with-xml=[libxml/expat] XML library to use])
68 AC_ARG_WITH(init-scripts, [ --with-init-scripts=[redhat] Style of init scripts to install])
69 AC_ARG_WITH(session-socket-dir, [ --with-session-socket-dir=[dirname] Where to put sockets for the per-login-session message bus])
70 AC_ARG_WITH(test-socket-dir, [ --with-test-socket-dir=[dirname] Where to put sockets for make check])
71 AC_ARG_WITH(system-pid-file, [ --with-system-pid-file=[pidfile] PID file for systemwide daemon])
72 AC_ARG_WITH(system-socket, [ --with-system-socket=[filename] UNIX domain socket for systemwide daemon])
73 AC_ARG_WITH(console-auth-dir, [ --with-console-auth-dir=[dirname] directory to check for console ownerhip])
75 dnl DBUS_BUILD_TESTS controls unit tests built in to .c files
76 dnl and also some stuff in the test/ subdir
77 AM_CONDITIONAL(DBUS_BUILD_TESTS, test x$enable_tests = xyes)
78 if test x$enable_tests = xyes; then
79 AC_DEFINE(DBUS_BUILD_TESTS,1,[Build test code])
82 if test x$enable_verbose_mode = xyes; then
83 AC_DEFINE(DBUS_ENABLE_VERBOSE_MODE,1,[Support a verbose mode])
85 if test x$enable_asserts = xno; then
86 AC_DEFINE(DBUS_DISABLE_ASSERT,1,[Disable assertion checking])
87 AC_DEFINE(G_DISABLE_ASSERT,1,[Disable GLib assertion macros])
89 if test x$enable_checks = xno; then
90 AC_DEFINE(DBUS_DISABLE_CHECKS,1,[Disable public API sanity checking])
91 AC_DEFINE(G_DISABLE_CHECKS,1,[Disable GLib public API sanity checking])
94 #### gcc warning flags
96 if test "x$GCC" = "xyes"; then
99 *[\ \ ]-Wall[\ \ ]*) ;;
100 *) CFLAGS="$CFLAGS -Wall" ;;
104 *[\ \ ]-Wchar-subscripts[\ \ ]*) ;;
105 *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
109 *[\ \ ]-Wmissing-declarations[\ \ ]*) ;;
110 *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
114 *[\ \ ]-Wmissing-prototypes[\ \ ]*) ;;
115 *) CFLAGS="$CFLAGS -Wmissing-prototypes" ;;
119 *[\ \ ]-Wnested-externs[\ \ ]*) ;;
120 *) CFLAGS="$CFLAGS -Wnested-externs" ;;
124 *[\ \ ]-Wpointer-arith[\ \ ]*) ;;
125 *) CFLAGS="$CFLAGS -Wpointer-arith" ;;
129 *[\ \ ]-Wcast-align[\ \ ]*) ;;
130 *) CFLAGS="$CFLAGS -Wcast-align" ;;
134 *[\ \ ]-Wfloat-equal[\ \ ]*) ;;
135 *) CFLAGS="$CFLAGS -Wfloat-equal" ;;
139 *[\ \ ]-Wsign-compare[\ \ ]*) ;;
140 *) CFLAGS="$CFLAGS -Wsign-compare" ;;
143 if test "x$enable_ansi" = "xyes"; then
145 *[\ \ ]-ansi[\ \ ]*) ;;
146 *) CFLAGS="$CFLAGS -ansi" ;;
150 *[\ \ ]-D_POSIX_C_SOURCE*) ;;
151 *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;;
155 *[\ \ ]-D_BSD_SOURCE[\ \ ]*) ;;
156 *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;;
160 *[\ \ ]-pedantic[\ \ ]*) ;;
161 *) CFLAGS="$CFLAGS -pedantic" ;;
164 if test x$enable_gcov = xyes; then
166 *[\ \ ]-fprofile-arcs[\ \ ]*) ;;
167 *) CFLAGS="$CFLAGS -fprofile-arcs" ;;
170 *[\ \ ]-ftest-coverage[\ \ ]*) ;;
171 *) CFLAGS="$CFLAGS -ftest-coverage" ;;
174 ## remove optimization
175 CFLAGS=`echo "$CFLAGS" | sed -e 's/-O[0-9]*//g'`
179 if test x$enable_gcov = xyes; then
180 AC_MSG_ERROR([--enable-gcov can only be used with gcc])
184 #### can't use AM_PROG_GCJ since it fails fatally if no gcj found
185 AC_CHECK_PROGS(GCJ, gcj, gcj)
186 if test -z "$GCJ" ; then
189 # Needs to be here so libtool wont get confused
193 if test "x${GCJFLAGS-unset}" = xunset; then
194 GCJFLAGS="-g -O2 -Wall"
199 if test x$enable_gcj = xauto ; then
200 if test x$have_gcj = xno ; then
207 if test x$enable_gcj = xyes; then
208 if test x$have_gcj = xno ; then
209 AC_MSG_ERROR([Building gcj explicitly required, but gcj not found])
213 AM_CONDITIONAL(DBUS_USE_GCJ, test x$enable_gcj = xyes)
218 MONO_REQUIRED_VERSION=0.95
219 AC_SUBST(MONO_REQUIRED_VERSION)
220 PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, have_mono=true, have_mono=false)
222 if test "x$enable_mono" = "xyes"; then
223 if test "x$have_mono" = "xfalse"; then
224 AC_MSG_ERROR([Mono was not found])
228 if test "x$have_mono" = "xtrue"; then
229 if test `uname -s` = "Darwin"; then
230 AC_PATH_PROG(RUNTIME, mint, no)
231 AC_PATH_PROG(CSC, mcs, no)
235 AC_PATH_PROG(RUNTIME, mono, no)
236 AC_PATH_PROG(CSC, mcs, no)
241 AC_PATH_PROG(CSC, csc.exe, no)
247 if test x$enable_mono = xyes; then
248 if test x$have_mcs = xno ; then
249 AC_MSG_ERROR([Building Mono bindings explicitly required, but mcs compiler not found])
253 AC_PATH_PROG(GACUTIL, gacutil, no)
254 if test "x$GACUTIL" = "xno" ; then
255 AC_MSG_ERROR([No gacutil tool found])
261 if test x$enable_mono = xauto ; then
262 if test x$CSC = xno ; then
266 AC_PATH_PROG(GACUTIL, gacutil, no)
267 if test "x$GACUTIL" = "xno" ; then
281 AM_CONDITIONAL(DBUS_USE_CSC, test x$enable_mono = xyes)
283 #### Look for monodoc
284 MONODOC_REQUIRED_VERSION=0.16
285 AC_SUBST(MONODOC_REQUIRED_VERSION)
286 PKG_CHECK_MODULES(MONODOC_DEPENDENCY, monodoc >= $MONODOC_REQUIRED_VERSION, have_monodoc=yes, have_monodoc=no)
288 if test x$enable_mono_docs = xyes; then
289 if test x$have_monodoc = xno ; then
290 AC_MSG_ERROR([Building Mono docs explicitly required, but monodoc not found])
292 AC_PATH_PROG(MONODOC, monodoc, no)
293 if test x$MONODOC = xno; then
294 AC_MSG_ERROR([Building Mono docs explicitly required, but monodoc not found])
299 if test x$enable_mono_docs = xauto ; then
300 if test x$have_monodoc = xno ; then
304 AC_PATH_PROG(MONODOC, monodoc, no)
305 if test x$MONODOC = xno; then
316 AM_CONDITIONAL(ENABLE_MONODOC, test "x$enable_mono_docs" = "xyes")
319 # let ourselves use our own unstable API
320 CPPFLAGS="-DDBUS_API_SUBJECT_TO_CHANGE=1 $CPPFLAGS"
321 # compress spaces in flags
322 CFLAGS=`echo "$CFLAGS" | sed -e 's/ +/ /g'`
323 CXXFLAGS=`echo "$CXXFLAGS" | sed -e 's/ +/ /g'`
324 CPPFLAGS=`echo "$CPPFLAGS" | sed -e 's/ +/ /g'`
327 if test x$enable_gcov = xyes; then
328 ## so that config.h changes when you toggle gcov support
329 AC_DEFINE_UNQUOTED(DBUS_GCOV_ENABLED, 1, [Defined if gcov is enabled to force a rebuild due to config.h changing])
331 AC_MSG_CHECKING([for gcc 3.3 version of gcov file format])
333 AC_RUN_IFELSE( [AC_LANG_PROGRAM( , [[ if (__GNUC__ >=3 && __GNUC_MINOR__ >= 3) exit (0); else exit (1); ]])],
335 if test x$have_gcc33_gcov = xyes ; then
336 AC_DEFINE_UNQUOTED(DBUS_HAVE_GCC33_GCOV, 1, [Defined if we have gcc 3.3 and thus the new gcov format])
338 AC_MSG_RESULT($have_gcc33_gcov)
340 AM_CONDITIONAL(DBUS_GCOV_ENABLED, test x$enable_gcov = xyes)
344 AC_CHECK_SIZEOF(char)
345 AC_CHECK_SIZEOF(short)
346 AC_CHECK_SIZEOF(long)
348 AC_CHECK_SIZEOF(void *)
349 AC_CHECK_SIZEOF(long long)
350 AC_CHECK_SIZEOF(__int64)
352 ### See what our 64 bit type is called
353 AC_MSG_CHECKING([64-bit integer type])
358 dbusint64_constant='(val)'
359 dbusuint64_constant='(val)'
363 dbusint64_constant='(val##L)'
364 dbusuint64_constant='(val##UL)'
366 $ac_cv_sizeof_long_long)
367 dbusint64='long long'
368 dbusint64_constant='(val##LL)'
369 dbusuint64_constant='(val##ULL)'
371 $ac_cv_sizeof___int64)
373 dbusint64_constant='(val##i64)'
374 dbusuint64_constant='(val##ui64)'
378 if test -z "$dbusint64" ; then
379 DBUS_INT64_TYPE="no_int64_type_detected"
382 DBUS_UINT64_CONSTANT=
383 AC_MSG_RESULT([none found])
385 DBUS_INT64_TYPE="$dbusint64"
387 DBUS_INT64_CONSTANT="$dbusint64_constant"
388 DBUS_UINT64_CONSTANT="$dbusuint64_constant"
389 AC_MSG_RESULT($DBUS_INT64_TYPE)
392 AC_SUBST(DBUS_INT64_TYPE)
393 AC_SUBST(DBUS_INT64_CONSTANT)
394 AC_SUBST(DBUS_UINT64_CONSTANT)
395 AC_SUBST(DBUS_HAVE_INT64)
397 ### see what 32-bit int is called
398 AC_MSG_CHECKING([32-bit integer type])
412 if test -z "$dbusint32" ; then
413 DBUS_INT32_TYPE="no_int32_type_detected"
414 AC_MSG_ERROR([No 32-bit integer type found])
416 DBUS_INT32_TYPE="$dbusint32"
417 AC_MSG_RESULT($DBUS_INT32_TYPE)
420 AC_SUBST(DBUS_INT32_TYPE)
422 ### see what 16-bit int is called
423 AC_MSG_CHECKING([16-bit integer type])
434 if test -z "$dbusint16" ; then
435 DBUS_INT16_TYPE="no_int16_type_detected"
436 AC_MSG_ERROR([No 16-bit integer type found])
438 DBUS_INT16_TYPE="$dbusint16"
439 AC_MSG_RESULT($DBUS_INT16_TYPE)
442 AC_SUBST(DBUS_INT16_TYPE)
448 dnl **********************************
449 dnl *** va_copy checks (from GLib) ***
450 dnl **********************************
451 dnl we currently check for all three va_copy possibilities, so we get
452 dnl all results in config.log for bug reports.
453 AC_CACHE_CHECK([for an implementation of va_copy()],dbus_cv_va_copy,[
454 AC_LINK_IFELSE([#include <stdarg.h>
455 void f (int i, ...) {
456 va_list args1, args2;
458 va_copy (args2, args1);
459 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
461 va_end (args1); va_end (args2);
467 [dbus_cv_va_copy=yes],
468 [dbus_cv_va_copy=no])
470 AC_CACHE_CHECK([for an implementation of __va_copy()],dbus_cv___va_copy,[
471 AC_LINK_IFELSE([#include <stdarg.h>
472 void f (int i, ...) {
473 va_list args1, args2;
475 __va_copy (args2, args1);
476 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
478 va_end (args1); va_end (args2);
484 [dbus_cv___va_copy=yes],
485 [dbus_cv___va_copy=no])
488 if test "x$dbus_cv_va_copy" = "xyes"; then
489 dbus_va_copy_func=va_copy
490 else if test "x$dbus_cv___va_copy" = "xyes"; then
491 dbus_va_copy_func=__va_copy
495 if test -n "$dbus_va_copy_func"; then
496 AC_DEFINE_UNQUOTED(DBUS_VA_COPY,$dbus_va_copy_func,[A 'va_copy' style function])
499 AC_CACHE_CHECK([whether va_lists can be copied by value],dbus_cv_va_val_copy,[
500 AC_TRY_RUN([#include <stdarg.h>
501 void f (int i, ...) {
502 va_list args1, args2;
505 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
507 va_end (args1); va_end (args2);
513 [dbus_cv_va_val_copy=yes],
514 [dbus_cv_va_val_copy=no],
515 [dbus_cv_va_val_copy=yes])
518 if test "x$dbus_cv_va_val_copy" = "xno"; then
519 AC_DEFINE(DBUS_VA_COPY_AS_ARRAY,1, ['va_lists' cannot be copies as values])
523 #### Atomic integers (checks by Sebastian Wilhelmi for GLib)
524 AC_MSG_CHECKING([whether to use inline assembler routines for atomic integers])
526 if test x"$GCC" = xyes; then
527 if test "x$enable_ansi" = "xyes"; then
535 AC_MSG_RESULT([i486])
536 AC_DEFINE_UNQUOTED(DBUS_USE_ATOMIC_INT_486, 1, [Use atomic integer implementation for 486])
545 if test x$have_atomic_inc = xyes ; then
546 AC_DEFINE_UNQUOTED(DBUS_HAVE_ATOMIC_INT, 1, [Some atomic integer implementation present])
549 #### Various functions
550 AC_CHECK_LIB(socket,socket)
551 AC_CHECK_LIB(nsl,gethostbyname)
553 AC_CHECK_FUNCS(vsnprintf vasprintf nanosleep usleep poll setenv unsetenv socketpair getgrouplist)
555 AC_CHECK_HEADERS(execinfo.h, [AC_CHECK_FUNCS(backtrace)])
557 AC_CACHE_CHECK([for posix getpwnam_r],
558 ac_cv_func_posix_getpwnam_r,
564 struct passwd pwd, *pwptr = &pwd;
567 error = getpwnam_r ("", &pwd, buffer,
568 sizeof (buffer), &pwptr);
569 return (error < 0 && errno == ENOSYS)
572 [ac_cv_func_posix_getpwnam_r=yes],
573 [ac_cv_func_posix_getpwnam_r=no])])
574 if test "$ac_cv_func_posix_getpwnam_r" = yes; then
575 AC_DEFINE(HAVE_POSIX_GETPWNAM_R,1,
576 [Have POSIX function getpwnam_r])
578 AC_CACHE_CHECK([for nonposix getpwnam_r],
579 ac_cv_func_nonposix_getpwnam_r,
580 [AC_TRY_LINK([#include <pwd.h>],
583 getpwnam_r ("", &pwd, buffer,
585 [ac_cv_func_nonposix_getpwnam_r=yes],
586 [ac_cv_func_nonposix_getpwnam_r=no])])
587 if test "$ac_cv_func_nonposix_getpwnam_r" = yes; then
588 AC_DEFINE(HAVE_NONPOSIX_GETPWNAM_R,1,
589 [Have non-POSIX function getpwnam_r])
593 dnl check for socklen_t
594 AC_MSG_CHECKING(whether socklen_t is defined)
596 #include <sys/types.h>
597 #include <sys/socket.h>
602 ],dbus_have_socklen_t=yes,dbus_have_socklen_t=no)
603 AC_MSG_RESULT($dbus_have_socklen_t)
605 if test "x$dbus_have_socklen_t" = "xyes"; then
606 AC_DEFINE(HAVE_SOCKLEN_T,1,[Have socklen_t type])
609 dnl check for writev header and writev function so we're
610 dnl good to go if HAVE_WRITEV gets defined.
611 AC_CHECK_HEADERS(sys/uio.h, [AC_CHECK_FUNCS(writev)])
613 dnl check for flavours of varargs macros (test from GLib)
614 AC_MSG_CHECKING(for ISO C99 varargs macros in C)
616 int a(int p1, int p2, int p3);
617 #define call_a(...) a(1,__VA_ARGS__)
619 ],dbus_have_iso_c_varargs=yes,dbus_have_iso_c_varargs=no)
620 AC_MSG_RESULT($dbus_have_iso_c_varargs)
622 AC_MSG_CHECKING(for GNUC varargs macros)
624 int a(int p1, int p2, int p3);
625 #define call_a(params...) a(1,params)
627 ],dbus_have_gnuc_varargs=yes,dbus_have_gnuc_varargs=no)
628 AC_MSG_RESULT($dbus_have_gnuc_varargs)
630 dnl Output varargs tests
631 if test x$dbus_have_iso_c_varargs = xyes; then
632 AC_DEFINE(HAVE_ISO_VARARGS,1,[Have ISO C99 varargs macros])
634 if test x$dbus_have_gnuc_varargs = xyes; then
635 AC_DEFINE(HAVE_GNUC_VARARGS,1,[Have GNU-style varargs macros])
638 dnl Check for various credentials.
639 AC_MSG_CHECKING(for struct cmsgcred)
641 #include <sys/types.h>
642 #include <sys/socket.h>
644 struct cmsgcred cred;
647 ],dbus_have_struct_cmsgcred=yes,dbus_have_struct_cmsgcred=no)
648 AC_MSG_RESULT($dbus_have_struct_cmsgcred)
650 if test x$dbus_have_struct_cmsgcred = xyes; then
651 AC_DEFINE(HAVE_CMSGCRED,1,[Have cmsgcred structure])
655 #### Abstract sockets
657 AC_MSG_CHECKING(abstract socket namespace)
659 AC_RUN_IFELSE([AC_LANG_PROGRAM(
661 #include <sys/types.h>
665 #include <sys/socket.h>
671 struct sockaddr_un addr;
673 listen_fd = socket (PF_UNIX, SOCK_STREAM, 0);
677 fprintf (stderr, "socket() failed: %s\n", strerror (errno));
681 memset (&addr, '\0', sizeof (addr));
682 addr.sun_family = AF_UNIX;
683 strcpy (addr.sun_path, "X/tmp/dbus-fake-socket-path-used-in-configure-test");
684 addr.sun_path[0] = '\0'; /* this is what makes it abstract */
686 if (bind (listen_fd, (struct sockaddr*) &addr, SUN_LEN (&addr)) < 0)
688 fprintf (stderr, "Abstract socket namespace bind() failed: %s\n",
695 [have_abstract_sockets=yes],
696 [have_abstract_sockets=no])
698 AC_MSG_RESULT($have_abstract_sockets)
700 if test x$enable_abstract_sockets = xyes; then
701 if test x$have_abstract_sockets = xno; then
702 AC_MSG_ERROR([Abstract sockets explicitly required, and support not detected.])
706 if test x$enable_abstract_sockets = xno; then
707 have_abstract_sockets=no;
710 if test x$have_abstract_sockets = xyes ; then
711 DBUS_PATH_OR_ABSTRACT=abstract
712 AC_DEFINE(HAVE_ABSTRACT_SOCKETS,1,[Have abstract socket namespace])
714 DBUS_PATH_OR_ABSTRACT=path
717 # this is used in addresses to prefer abstract, e.g.
718 # unix:path=/foo or unix:abstract=/foo
719 AC_SUBST(DBUS_PATH_OR_ABSTRACT)
721 #### Sort out gettext
723 # this makes us require GLib to run autoconf, but not at runtime
727 # INTLLIBS is now set
729 # (if someone wants to go through and make internationalization
730 # conditional with #ifdef ENABLE_NLS then go crazy and send us a patch,
731 # but right now we won't build without gettext)
732 if test "$gt_cv_have_gettext" != "yes" ; then
734 *** You must have either have gettext support in your C library, or use the
735 *** GNU gettext library. (http://www.gnu.org/software/gettext/gettext.html
739 #### Sort out XML library
742 AC_CHECK_LIB(expat, XML_ParserCreate_MM,
743 [ AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false) ],
746 PKG_CHECK_MODULES(LIBXML, libxml-2.0, have_libxml=true, have_libxml=false)
748 # see what we want to use
749 dbus_use_libxml=false
751 if test x$with_xml = xexpat; then
753 if ! $have_expat ; then
754 AC_MSG_ERROR([Explicitly requested expat but expat not found])
756 elif test x$with_xml = xlibxml; then
758 if ! $have_libxml ; then
759 AC_MSG_ERROR([Explicitly requested libxml but libxml not found])
762 ### expat is the default because libxml can't currently survive
763 ### our brutal OOM-handling unit test setup.
764 ### http://bugzilla.gnome.org/show_bug.cgi?id=109368
765 if $have_expat ; then
768 elif $have_libxml ; then
772 AC_MSG_ERROR([No XML library found, check config.log for failed attempts])
776 AM_CONDITIONAL(DBUS_USE_EXPAT, $dbus_use_expat)
777 AM_CONDITIONAL(DBUS_USE_LIBXML, $dbus_use_libxml)
779 if $dbus_use_expat; then
783 if $dbus_use_libxml; then
784 XML_LIBS=$LIBXML_LIBS
785 XML_CFLAGS=$LIBXML_CFLAGS
789 if test x$enable_selinux = xno ; then
792 # See if we have SELinux library
793 AC_CHECK_LIB(selinux, is_selinux_enabled,
794 have_selinux=yes, have_selinux=no)
796 # see if we have the SELinux header with the new D-BUS stuff in it
797 if test x$have_selinux = xyes ; then
798 AC_MSG_CHECKING([for DBUS Flask permissions in selinux/av_permissions.h])
799 AC_TRY_COMPILE([#include <selinux/av_permissions.h>],
800 [#ifdef DBUS__ACQUIRE_SVC return 0;
802 #error DBUS__ACQUIRE_SVC not defined
804 have_selinux=yes, have_selinux=no)
805 AC_MSG_RESULT($have_selinux)
808 if test x$enable_selinux = xauto ; then
809 if test x$have_selinux = xno ; then
810 AC_MSG_WARN([Sufficiently new SELinux library not found])
813 if test x$have_selinux = xno ; then
814 AC_MSG_ERROR([SElinux explicitly required, and SELinux library not found])
819 AM_CONDITIONAL(HAVE_SELINUX, test x$have_selinux = xyes)
821 if test x$have_selinux = xyes ; then
822 SELINUX_LIBS="-lselinux -lpthread"
823 AC_DEFINE(HAVE_SELINUX,1,[SELinux support])
829 if test x$target_os = xlinux-gnu; then
830 AC_ARG_ENABLE(dnotify,
831 [ --disable-dnotify Disable using dnotify on Linux],
832 [case "${enableval}" in
833 yes) dnotify=false ;;
835 *) AC_MSG_ERROR(bad value ${enableval} for --disable-dnotify) ;;
836 esac],[dnotify=true])
838 dnl check if dnotify backend is enabled
839 if test x$dnotify = xtrue; then
840 AC_DEFINE(DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX,1,[Use dnotify on Linux])
844 #### Set up final flags
847 AC_SUBST(DBUS_CLIENT_CFLAGS)
848 AC_SUBST(DBUS_CLIENT_LIBS)
850 DBUS_BUS_CFLAGS=$XML_CFLAGS
851 DBUS_BUS_LIBS="$XML_LIBS $SELINUX_LIBS $INTLLIBS"
852 AC_SUBST(DBUS_BUS_CFLAGS)
853 AC_SUBST(DBUS_BUS_LIBS)
857 AC_SUBST(DBUS_TEST_CFLAGS)
858 AC_SUBST(DBUS_TEST_LIBS)
861 PKG_CHECK_MODULES(DBUS_GLIB, gobject-2.0, have_glib=yes, have_glib=no)
862 PKG_CHECK_MODULES(DBUS_GLIB_THREADS, glib-2.0 gthread-2.0, have_glib_threads=yes, have_glib_threads=no)
864 if test x$have_glib = xno ; then
865 AC_MSG_WARN([GLib development libraries not found])
868 if test x$enable_glib = xyes; then
869 if test x$have_glib = xno; then
870 AC_MSG_ERROR([GLib explicitly required, and GLib development libraries not found])
874 if test x$enable_glib = xno; then
878 AM_CONDITIONAL(HAVE_GLIB, test x$have_glib = xyes)
879 AM_CONDITIONAL(HAVE_GLIB_THREADS, test x$have_glib_threads = xyes)
881 if test x$have_glib = xyes; then
882 GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
884 GLIB_GENMARSHAL=glib-not-enabled-so-there-is-no-genmarshal
886 AC_SUBST(GLIB_GENMARSHAL)
889 AC_SUBST(DBUS_GLIB_CFLAGS)
890 AC_SUBST(DBUS_GLIB_LIBS)
891 AC_SUBST(DBUS_GLIB_THREADS_LIBS)
893 DBUS_GLIB_TOOL_CFLAGS=$XML_CFLAGS
894 DBUS_GLIB_TOOL_LIBS="$XML_LIBS $INTLLIBS"
895 AC_SUBST(DBUS_GLIB_TOOL_CFLAGS)
896 AC_SUBST(DBUS_GLIB_TOOL_LIBS)
899 if test x$have_glib = xno ; then
900 AC_MSG_WARN([Can't use GTK+ since GLib not enabled])
903 PKG_CHECK_MODULES(DBUS_GTK, gtk+-2.0 >= 2.4, have_gtk=yes, have_gtk=no)
904 PKG_CHECK_MODULES(DBUS_GTK_THREADS, gtk+-2.0 >= 2.4 gthread-2.0, have_gtk_threads=yes, have_gtk_threads=no)
907 if test x$have_gtk = xno ; then
908 AC_MSG_WARN([GTK+ development libraries not found])
911 if test x$enable_gtk = xyes; then
912 if test x$have_gtk = xno; then
913 AC_MSG_ERROR([GTK+ explicitly required, and GTK+ development libraries not found])
917 if test x$enable_gtk = xno; then
921 AM_CONDITIONAL(HAVE_GTK, test x$have_gtk = xyes)
924 AC_SUBST(DBUS_GTK_CFLAGS)
925 AC_SUBST(DBUS_GTK_LIBS)
926 AC_SUBST(DBUS_GTK_THREADS_CFLAGS)
927 AC_SUBST(DBUS_GTK_THREADS_LIBS)
930 AC_PATH_PROG(QT_MOC, moc, no)
933 AC_MSG_CHECKING([for qglobal.h])
934 if test -n "$QTDIR" -a -f "$QTDIR/include/qglobal.h"; then
936 DBUS_QT_CXXFLAGS="-I$QTDIR/include"
938 for dir in "${prefix}/include/qt" "/usr/include/qt-3.1" "/usr/include/qt3" "/usr/include/qt" "/usr/lib/qt/include" "/usr/lib/qt-3.1/include"; do
939 if test -f "$dir/qglobal.h"; then
941 DBUS_QT_CXXFLAGS="-I$dir"
945 if test x"$have_qt" = x"yes"; then
946 AC_MSG_RESULT([found])
948 AC_MSG_RESULT([not found])
951 dnl linking to kdecore will give us a bit of help from libtool
952 if (! kde-config >& /dev/null); then
955 kdelibs=`kde-config --install lib --expandvars 2>/dev/null`
956 if test -z $kdelibs -o ! -f $kdelibs/libkdecore.la; then
959 DBUS_QT_LIBS="$kdelibs/libkdecore.la"
963 if test x$have_qt = xno ; then
964 AC_MSG_WARN([Qt development libraries not found])
967 if test x$enable_qt = xyes; then
968 if test x$have_qt = xno; then
969 AC_MSG_ERROR([Qt integration explicitly required, and Qt libraries not found])
973 if test x$enable_qt = xno; then
977 AM_CONDITIONAL(HAVE_QT, test x$have_qt = xyes)
980 AC_SUBST(DBUS_QT_CXXFLAGS)
981 AC_SUBST(DBUS_QT_LIBS)
986 ## for now enable_x11 just tracks have_x11,
987 ## there's no --enable-x11
988 if test x$no_x = xyes ; then
996 if test x$enable_x11 = xyes ; then
997 AC_DEFINE(DBUS_BUILD_X11,1,[Build X11-dependent code])
998 DBUS_X_LIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
999 DBUS_X_CFLAGS="$X_CFLAGS"
1005 AC_SUBST(DBUS_X_CFLAGS)
1006 AC_SUBST(DBUS_X_LIBS)
1008 ### Doxygen Documentation
1010 AC_PATH_PROG(DOXYGEN, doxygen, no)
1012 AC_MSG_CHECKING([whether to build Doxygen documentation])
1014 if test x$DOXYGEN = xno ; then
1020 if test x$enable_doxygen_docs = xauto ; then
1021 if test x$have_doxygen = xno ; then
1022 enable_doxygen_docs=no
1024 enable_doxygen_docs=yes
1028 if test x$enable_doxygen_docs = xyes; then
1029 if test x$have_doxygen = xno; then
1030 AC_MSG_ERROR([Building Doxygen docs explicitly required, but Doxygen not found])
1034 AM_CONDITIONAL(DBUS_DOXYGEN_DOCS_ENABLED, test x$enable_doxygen_docs = xyes)
1037 ### XML Documentation
1039 AC_PATH_PROG(XMLTO, xmlto, no)
1041 AC_MSG_CHECKING([whether to build XML documentation])
1043 if test x$XMLTO = xno ; then
1049 if test x$enable_xml_docs = xauto ; then
1050 if test x$have_xmlto = xno ; then
1057 if test x$enable_xml_docs = xyes; then
1058 if test x$have_xmlto = xno; then
1059 AC_MSG_ERROR([Building XML docs explicitly required, but xmlto not found])
1063 AM_CONDITIONAL(DBUS_XML_DOCS_ENABLED, test x$enable_xml_docs = xyes)
1066 #### Have to go $localstatedir->$prefix/var->/usr/local/var
1067 #### someone please fix this a better way...
1069 #### find the actual value for $prefix that we'll end up with
1070 ## (I know this is broken and should be done in the Makefile, but
1071 ## that's a major pain and almost nobody actually seems to care)
1073 if test "x$prefix" = "xNONE"; then
1074 REAL_PREFIX=$ac_default_prefix
1079 ## temporarily change prefix and exec_prefix
1083 if test "x$exec_prefix" = xNONE ; then
1084 REAL_EXEC_PREFIX=$REAL_PREFIX
1086 REAL_EXEC_PREFIX=$exec_prefix
1088 old_exec_prefix=$exec_prefix
1089 exec_prefix=$REAL_EXEC_PREFIX
1092 LOCALSTATEDIR_TMP="$localstatedir"
1093 EXPANDED_LOCALSTATEDIR=`eval echo $LOCALSTATEDIR_TMP`
1094 AC_SUBST(EXPANDED_LOCALSTATEDIR)
1096 SYSCONFDIR_TMP="$sysconfdir"
1097 EXPANDED_SYSCONFDIR=`eval echo $SYSCONFDIR_TMP`
1098 AC_SUBST(EXPANDED_SYSCONFDIR)
1100 BINDIR_TMP="$bindir"
1101 EXPANDED_BINDIR=`eval echo $BINDIR_TMP`
1102 AC_SUBST(EXPANDED_BINDIR)
1104 LIBDIR_TMP="$libdir"
1105 EXPANDED_LIBDIR=`eval echo $LIBDIR_TMP`
1106 AC_SUBST(EXPANDED_LIBDIR)
1108 DATADIR_TMP="$datadir"
1109 EXPANDED_DATADIR=`eval echo $DATADIR_TMP`
1110 AC_SUBST(EXPANDED_DATADIR)
1112 ## put prefix and exec_prefix back
1114 exec_prefix=$old_exec_prefix
1116 #### Check our operating system
1117 operating_system=unknown
1118 if test -f /etc/redhat-release || test -f $EXPANDED_SYSCONFDIR/redhat-release ; then
1119 operating_system=redhat
1122 if test -f /etc/slackware-version || test -f $EXPANDED_SYSCONFDIR/slackware-version ; then
1123 operating_system=slackware
1126 #### Sort out init scripts
1128 if test x$with_init_scripts = x; then
1129 if test xredhat = x$operating_system ; then
1130 with_init_scripts=redhat
1132 if test xslackware = x$operating_system ; then
1133 with_init_scripts=slackware
1135 with_init_scripts=none
1140 AM_CONDITIONAL(DBUS_INIT_SCRIPTS_RED_HAT, test x$with_init_scripts = xredhat)
1142 AM_CONDITIONAL(DBUS_INIT_SCRIPTS_SLACKWARE, test x$with_init_scripts = xslackware)
1144 ##### Set up location for system bus socket
1145 if ! test -z "$with_system_socket"; then
1146 DBUS_SYSTEM_SOCKET=$with_system_socket
1148 DBUS_SYSTEM_SOCKET=${EXPANDED_LOCALSTATEDIR}/run/dbus/system_bus_socket
1151 AC_SUBST(DBUS_SYSTEM_SOCKET)
1152 AC_DEFINE_UNQUOTED(DBUS_SYSTEM_SOCKET,"$DBUS_SYSTEM_SOCKET",[The name of the socket the system bus listens on by default])
1154 ## system bus only listens on local domain sockets, and never
1155 ## on an abstract socket (so only root can create the socket)
1156 DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="unix:path=$DBUS_SYSTEM_SOCKET"
1157 AC_SUBST(DBUS_SYSTEM_BUS_DEFAULT_ADDRESS)
1158 AC_DEFINE_UNQUOTED(DBUS_SYSTEM_BUS_DEFAULT_ADDRESS, "$DBUS_SYSTEM_BUS_DEFAULT_ADDRESS",[The default D-BUS address of the system bus])
1160 #### Set up the pid file
1161 if ! test -z "$with_system_pid_file"; then
1162 DBUS_SYSTEM_PID_FILE=$with_system_pid_file
1163 elif test x$operating_system = xredhat ; then
1164 DBUS_SYSTEM_PID_FILE=${EXPANDED_LOCALSTATEDIR}/run/messagebus.pid
1166 DBUS_SYSTEM_PID_FILE=${EXPANDED_LOCALSTATEDIR}/run/dbus/pid
1169 AC_SUBST(DBUS_SYSTEM_PID_FILE)
1171 #### Directory to check for console ownership
1172 if ! test -z "$with_console_auth_dir"; then
1173 DBUS_CONSOLE_AUTH_DIR=$with_console_auth_dir
1175 DBUS_CONSOLE_AUTH_DIR=/var/run/console/
1178 AC_SUBST(DBUS_CONSOLE_AUTH_DIR)
1179 AC_DEFINE_UNQUOTED(DBUS_CONSOLE_AUTH_DIR, "$DBUS_CONSOLE_AUTH_DIR", [Directory to check for console ownerhip])
1181 #### Tell tests where to find certain stuff in builddir
1182 ABSOLUTE_TOP_BUILDDIR=`cd ${ac_top_builddir}. && pwd`
1184 AC_DEFUN(TEST_PATH, [
1185 TEST_$1=${ABSOLUTE_TOP_BUILDDIR}/test/$2
1186 AC_DEFINE_UNQUOTED(TEST_$1, "$TEST_$1",
1187 [Full path to test file test/$2 in builddir])
1191 TEST_PATH(SERVICE_DIR, data/valid-service-files)
1192 TEST_PATH(SERVICE_BINARY, test-service)
1193 TEST_PATH(GLIB_SERVICE_BINARY, glib/test-service-glib)
1194 TEST_PATH(EXIT_BINARY, test-exit)
1195 TEST_PATH(SEGFAULT_BINARY, test-segfault)
1196 TEST_PATH(SLEEP_FOREVER_BINARY, test-sleep-forever)
1197 AC_SUBST(ABSOLUTE_TOP_BUILDDIR)
1199 #### Find socket directories
1200 if ! test -z "$TMPDIR" ; then
1201 DEFAULT_SOCKET_DIR=$TMPDIR
1202 elif ! test -z "$TEMP" ; then
1203 DEFAULT_SOCKET_DIR=$TEMP
1204 elif ! test -z "$TMP" ; then
1205 DEFAULT_SOCKET_DIR=$TMP
1207 DEFAULT_SOCKET_DIR=/tmp
1210 if ! test -z "$with_test_socket_dir" ; then
1211 TEST_SOCKET_DIR="$with_test_socket_dir"
1213 TEST_SOCKET_DIR=$DEFAULT_SOCKET_DIR
1215 AC_SUBST(TEST_SOCKET_DIR)
1216 AC_DEFINE_UNQUOTED(DBUS_TEST_SOCKET_DIR, "$TEST_SOCKET_DIR", [Where to put test sockets])
1218 if ! test -z "$with_session_socket_dir" ; then
1219 DBUS_SESSION_SOCKET_DIR="$with_session_socket_dir"
1221 DBUS_SESSION_SOCKET_DIR=$DEFAULT_SOCKET_DIR
1223 AC_DEFINE_UNQUOTED(DBUS_SESSION_SOCKET_DIR, "$DBUS_SESSION_SOCKET_DIR", [Where per-session bus puts its sockets])
1224 AC_SUBST(DBUS_SESSION_SOCKET_DIR)
1226 # Detect if we can build Python bindings (need python, python headers, and pyrex)
1227 if test x$enable_python = xno; then
1230 AC_MSG_NOTICE([Checking to see if we can build Python bindings])
1234 if test -z "$PYTHON" ; then
1235 AC_MSG_WARN([Python not found])
1237 AC_CHECK_PROGS(PYREX, pyrexc)
1239 if test -z "$PYREX" ; then
1245 AM_CHECK_PYTHON_HEADERS(have_python_headers=yes,have_python_headers=no)
1247 if test x$have_pyrex = xyes -a x$have_python_headers = xyes ; then
1252 if test x$have_python = xno ; then
1253 if test x$enable_python = xyes ; then
1254 AC_MSG_ERROR([Building python explicitly requested, but can't build python bindings])
1256 AC_MSG_WARN([Couldn't find either Pyrex or the Python headers, not building Python bindings])
1261 AM_CONDITIONAL(HAVE_PYTHON, test x$have_python = xyes)
1265 dbus/dbus-arch-deps.h
1274 glib/examples/Makefile
1275 glib/examples/statemachine/Makefile
1277 python/examples/Makefile
1281 gcj/org/freedesktop/Makefile
1282 gcj/org/freedesktop/dbus/Makefile
1284 mono/AssemblyInfo.cs
1285 mono/dbus-sharp.dll.config
1286 mono/example/Makefile
1296 test/data/valid-config-files/debug-allow-all.conf
1297 test/data/valid-config-files/debug-allow-all-sha1.conf
1298 test/data/valid-service-files/debug-echo.service
1299 test/data/valid-service-files/debug-segfault.service
1300 test/data/valid-service-files/debug-glib.service
1303 ### FIXME it's bizarre that have_qt and have_glib are used
1304 ### instead of enable_ - should fix things so that enable
1305 ### is always whether it's enabled, and have is always whether
1308 dnl ==========================================================================
1314 exec_prefix: ${exec_prefix}
1315 libdir: ${EXPANDED_LIBDIR}
1316 bindir: ${EXPANDED_BINDIR}
1317 sysconfdir: ${EXPANDED_SYSCONFDIR}
1318 localstatedir: ${EXPANDED_LOCALSTATEDIR}
1319 datadir: ${EXPANDED_DATADIR}
1320 source code location: ${srcdir}
1323 cppflags: ${CPPFLAGS}
1324 cxxflags: ${CXXFLAGS}
1325 64-bit int: ${DBUS_INT64_TYPE}
1326 32-bit int: ${DBUS_INT32_TYPE}
1327 16-bit int: ${DBUS_INT16_TYPE}
1331 if test x$enable_gcj = xyes ; then
1334 gcjflags: ${GCJFLAGS}"
1337 " gcj: (not enabled)"
1340 if test x$enable_mono = xyes ; then
1346 " csc: (not enabled)
1351 Maintainer mode: ${USE_MAINTAINER_MODE}
1352 gcc coverage profiling: ${enable_gcov}
1353 Building unit tests: ${enable_tests}
1354 Building verbose mode: ${enable_verbose_mode}
1355 Building assertions: ${enable_asserts}
1356 Building checks: ${enable_checks}
1357 Building Qt bindings: ${have_qt}
1358 Building GLib bindings: ${have_glib}
1359 Building Python bindings: ${have_python}
1360 Building SELinux support: ${have_selinux}
1361 Building Mono bindings: ${enable_mono}
1362 Building Mono docs: ${enable_mono_docs}
1363 Building GTK+ tools: ${have_gtk}
1364 Building X11 code: ${enable_x11}
1365 Building Doxygen docs: ${enable_doxygen_docs}
1366 Building XML docs: ${enable_xml_docs}
1367 Gettext libs (empty OK): ${INTLLIBS}
1368 Using XML parser: ${with_xml}
1369 Init scripts style: ${with_init_scripts}
1370 Abstract socket names: ${have_abstract_sockets}
1371 System bus socket: ${DBUS_SYSTEM_SOCKET}
1372 System bus address: ${DBUS_SYSTEM_BUS_DEFAULT_ADDRESS}
1373 System bus PID file: ${DBUS_SYSTEM_PID_FILE}
1374 Session bus socket dir: ${DBUS_SESSION_SOCKET_DIR}
1375 Console auth dir: ${DBUS_CONSOLE_AUTH_DIR}
1376 'make check' socket dir: ${TEST_SOCKET_DIR}
1379 if test x$enable_tests = xyes; then
1380 echo "NOTE: building with unit tests increases the size of the installed library and renders it insecure."
1382 if test x$enable_tests = xyes -a x$enable_asserts = xno; then
1383 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)"
1385 if test x$enable_gcov = xyes; then
1386 echo "NOTE: building with coverage profiling is definitely for developers only."
1388 if test x$enable_verbose_mode = xyes; then
1389 echo "NOTE: building with verbose mode increases library size, may slightly increase security risk, and decreases performance."
1391 if test x$enable_asserts = xyes; then
1392 echo "NOTE: building with assertions increases library size and decreases performance."
1394 if test x$enable_checks = xno; then
1395 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."