6 AM_INIT_AUTOMAKE(dbus, 0.33)
8 AM_CONFIG_HEADER(config.h)
11 ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
13 GETTEXT_PACKAGE=dbus-1
14 AC_SUBST(GETTEXT_PACKAGE)
15 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[The name of the gettext domain])
17 ## must come before we use the $USE_MAINTAINER_MODE variable later
20 # libtool versioning - this applies to libhal and libhal-storage
22 # See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details
37 AC_ARG_ENABLE(qt, [ --enable-qt enable Qt-friendly client library],enable_qt=$enableval,enable_qt=auto)
38 AC_ARG_ENABLE(glib, [ --enable-glib enable GLib-friendly client library],enable_glib=$enableval,enable_glib=auto)
39 AC_ARG_ENABLE(gtk, [ --enable-gtk enable GTK-requiring executables],enable_gtk=$enableval,enable_gtk=auto)
40 AC_ARG_ENABLE(tests, [ --enable-tests enable unit test code],enable_tests=$enableval,enable_tests=$USE_MAINTAINER_MODE)
41 AC_ARG_ENABLE(ansi, [ --enable-ansi enable -ansi -pedantic gcc flags],enable_ansi=$enableval,enable_ansi=no)
42 AC_ARG_ENABLE(verbose-mode, [ --enable-verbose-mode support verbose debug mode],enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
43 AC_ARG_ENABLE(asserts, [ --enable-asserts include assertion checks],enable_asserts=$enableval,enable_asserts=$USE_MAINTAINER_MODE)
44 AC_ARG_ENABLE(checks, [ --enable-checks include sanity checks on public API],enable_checks=$enableval,enable_checks=yes)
45 AC_ARG_ENABLE(xml-docs, [ --enable-xml-docs build XML documentation (requires xmlto)],enable_xml_docs=$enableval,enable_xml_docs=auto)
46 AC_ARG_ENABLE(doxygen-docs, [ --enable-doxygen-docs build DOXYGEN documentation (requires Doxygen)],enable_doxygen_docs=$enableval,enable_doxygen_docs=auto)
47 AC_ARG_ENABLE(gcov, [ --enable-gcov compile with coverage profiling instrumentation (gcc only)],enable_gcov=$enableval,enable_gcov=no)
48 AC_ARG_ENABLE(abstract-sockets, [ --enable-abstract-sockets use abstract socket namespace (linux only)],enable_abstract_sockets=$enableval,enable_abstract_sockets=auto)
49 AC_ARG_ENABLE(gcj, [ --enable-gcj build gcj bindings],enable_gcj=$enableval,enable_gcj=no)
50 AC_ARG_ENABLE(mono, [ --enable-mono build mono bindings],enable_mono=$enableval,enable_mono=auto)
51 AC_ARG_ENABLE(mono_docs, [ --enable-mono-docs build mono docs],enable_mono_docs=$enableval,enable_mono_docs=auto)
52 AC_ARG_ENABLE(python, [ --enable-python build python bindings],enable_python=$enableval,enable_python=auto)
53 AC_ARG_ENABLE(selinux, [ --enable-selinux build with SELinux support],enable_selinux=$enableval,enable_selinux=auto)
55 AC_ARG_WITH(xml, [ --with-xml=[libxml/expat] XML library to use])
56 AC_ARG_WITH(init-scripts, [ --with-init-scripts=[redhat] Style of init scripts to install])
57 AC_ARG_WITH(session-socket-dir, [ --with-session-socket-dir=[dirname] Where to put sockets for the per-login-session message bus])
58 AC_ARG_WITH(test-socket-dir, [ --with-test-socket-dir=[dirname] Where to put sockets for make check])
59 AC_ARG_WITH(system-pid-file, [ --with-system-pid-file=[pidfile] PID file for systemwide daemon])
60 AC_ARG_WITH(system-socket, [ --with-system-socket=[filename] UNIX domain socket for systemwide daemon])
62 dnl DBUS_BUILD_TESTS controls unit tests built in to .c files
63 dnl and also some stuff in the test/ subdir
64 AM_CONDITIONAL(DBUS_BUILD_TESTS, test x$enable_tests = xyes)
65 if test x$enable_tests = xyes; then
66 AC_DEFINE(DBUS_BUILD_TESTS,1,[Build test code])
69 if test x$enable_verbose_mode = xyes; then
70 AC_DEFINE(DBUS_ENABLE_VERBOSE_MODE,1,[Support a verbose mode])
72 if test x$enable_asserts = xno; then
73 AC_DEFINE(DBUS_DISABLE_ASSERT,1,[Disable assertion checking])
74 AC_DEFINE(G_DISABLE_ASSERT,1,[Disable GLib assertion macros])
76 if test x$enable_checks = xno; then
77 AC_DEFINE(DBUS_DISABLE_CHECKS,1,[Disable public API sanity checking])
78 AC_DEFINE(G_DISABLE_CHECKS,1,[Disable GLib public API sanity checking])
81 #### gcc warning flags
83 if test "x$GCC" = "xyes"; then
86 *[\ \ ]-Wall[\ \ ]*) ;;
87 *) CFLAGS="$CFLAGS -Wall" ;;
91 *[\ \ ]-Wchar-subscripts[\ \ ]*) ;;
92 *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
96 *[\ \ ]-Wmissing-declarations[\ \ ]*) ;;
97 *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
101 *[\ \ ]-Wmissing-prototypes[\ \ ]*) ;;
102 *) CFLAGS="$CFLAGS -Wmissing-prototypes" ;;
106 *[\ \ ]-Wnested-externs[\ \ ]*) ;;
107 *) CFLAGS="$CFLAGS -Wnested-externs" ;;
111 *[\ \ ]-Wpointer-arith[\ \ ]*) ;;
112 *) CFLAGS="$CFLAGS -Wpointer-arith" ;;
116 *[\ \ ]-Wcast-align[\ \ ]*) ;;
117 *) CFLAGS="$CFLAGS -Wcast-align" ;;
121 *[\ \ ]-Wfloat-equal[\ \ ]*) ;;
122 *) CFLAGS="$CFLAGS -Wfloat-equal" ;;
126 *[\ \ ]-Wsign-compare[\ \ ]*) ;;
127 *) CFLAGS="$CFLAGS -Wsign-compare" ;;
130 if test "x$enable_ansi" = "xyes"; then
132 *[\ \ ]-ansi[\ \ ]*) ;;
133 *) CFLAGS="$CFLAGS -ansi" ;;
137 *[\ \ ]-D_POSIX_C_SOURCE*) ;;
138 *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;;
142 *[\ \ ]-D_BSD_SOURCE[\ \ ]*) ;;
143 *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;;
147 *[\ \ ]-pedantic[\ \ ]*) ;;
148 *) CFLAGS="$CFLAGS -pedantic" ;;
151 if test x$enable_gcov = xyes; then
153 *[\ \ ]-fprofile-arcs[\ \ ]*) ;;
154 *) CFLAGS="$CFLAGS -fprofile-arcs" ;;
157 *[\ \ ]-ftest-coverage[\ \ ]*) ;;
158 *) CFLAGS="$CFLAGS -ftest-coverage" ;;
161 ## remove optimization
162 CFLAGS=`echo "$CFLAGS" | sed -e 's/-O[0-9]*//g'`
166 if test x$enable_gcov = xyes; then
167 AC_MSG_ERROR([--enable-gcov can only be used with gcc])
171 #### can't use AM_PROG_GCJ since it fails fatally if no gcj found
172 AC_CHECK_PROGS(GCJ, gcj, gcj)
173 if test -z "$GCJ" ; then
176 # Needs to be here so libtool wont get confused
180 if test "x${GCJFLAGS-unset}" = xunset; then
181 GCJFLAGS="-g -O2 -Wall"
186 if test x$enable_gcj = xauto ; then
187 if test x$have_gcj = xno ; then
194 if test x$enable_gcj = xyes; then
195 if test x$have_gcj = xno ; then
196 AC_MSG_ERROR([Building gcj explicitly required, but gcj not found])
200 AM_CONDITIONAL(DBUS_USE_GCJ, test x$enable_gcj = xyes)
205 MONO_REQUIRED_VERSION=0.95
206 AC_SUBST(MONO_REQUIRED_VERSION)
207 PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, have_mono=true, have_mono=false)
209 if test "x$enable_mono" = "xyes"; then
210 if test "x$have_mono" = "xfalse"; then
211 AC_MSG_ERROR([Mono was not found])
215 if test "x$have_mono" = "xtrue"; then
216 if test `uname -s` = "Darwin"; then
217 AC_PATH_PROG(RUNTIME, mint, no)
218 AC_PATH_PROG(CSC, mcs, no)
222 AC_PATH_PROG(RUNTIME, mono, no)
223 AC_PATH_PROG(CSC, mcs, no)
228 AC_PATH_PROG(CSC, csc.exe, no)
234 if test x$enable_mono = xyes; then
235 if test x$have_mcs = xno ; then
236 AC_MSG_ERROR([Building Mono bindings explicitly required, but mcs compiler not found])
240 AC_PATH_PROG(GACUTIL, gacutil, no)
241 if test "x$GACUTIL" = "xno" ; then
242 AC_MSG_ERROR([No gacutil tool found])
248 if test x$enable_mono = xauto ; then
249 if test x$CSC = xno ; then
253 AC_PATH_PROG(GACUTIL, gacutil, no)
254 if test "x$GACUTIL" = "xno" ; then
268 AM_CONDITIONAL(DBUS_USE_CSC, test x$enable_mono = xyes)
270 #### Look for monodoc
271 MONODOC_REQUIRED_VERSION=0.16
272 AC_SUBST(MONODOC_REQUIRED_VERSION)
273 PKG_CHECK_MODULES(MONODOC_DEPENDENCY, monodoc >= $MONODOC_REQUIRED_VERSION, have_monodoc=yes, have_monodoc=no)
275 if test x$enable_mono_docs = xyes; then
276 if test x$have_monodoc = xno ; then
277 AC_MSG_ERROR([Building Mono docs explicitly required, but monodoc not found])
279 AC_PATH_PROG(MONODOC, monodoc, no)
280 if test x$MONODOC = xno; then
281 AC_MSG_ERROR([Building Mono docs explicitly required, but monodoc not found])
286 if test x$enable_mono_docs = xauto ; then
287 if test x$have_monodoc = xno ; then
291 AC_PATH_PROG(MONODOC, monodoc, no)
292 if test x$MONODOC = xno; then
303 AM_CONDITIONAL(ENABLE_MONODOC, test "x$enable_mono_docs" = "xyes")
306 # let ourselves use our own unstable API
307 CPPFLAGS="-DDBUS_API_SUBJECT_TO_CHANGE=1 $CPPFLAGS"
308 # compress spaces in flags
309 CFLAGS=`echo "$CFLAGS" | sed -e 's/ +/ /g'`
310 CXXFLAGS=`echo "$CXXFLAGS" | sed -e 's/ +/ /g'`
311 CPPFLAGS=`echo "$CPPFLAGS" | sed -e 's/ +/ /g'`
314 if test x$enable_gcov = xyes; then
315 ## so that config.h changes when you toggle gcov support
316 AC_DEFINE_UNQUOTED(DBUS_GCOV_ENABLED, 1, [Defined if gcov is enabled to force a rebuild due to config.h changing])
318 AC_MSG_CHECKING([for gcc 3.3 version of gcov file format])
320 AC_RUN_IFELSE( [AC_LANG_PROGRAM( , [[ if (__GNUC__ >=3 && __GNUC_MINOR__ >= 3) exit (0); else exit (1); ]])],
322 if test x$have_gcc33_gcov = xyes ; then
323 AC_DEFINE_UNQUOTED(DBUS_HAVE_GCC33_GCOV, 1, [Defined if we have gcc 3.3 and thus the new gcov format])
325 AC_MSG_RESULT($have_gcc33_gcov)
327 AM_CONDITIONAL(DBUS_GCOV_ENABLED, test x$enable_gcov = xyes)
331 AC_CHECK_SIZEOF(char)
332 AC_CHECK_SIZEOF(short)
333 AC_CHECK_SIZEOF(long)
335 AC_CHECK_SIZEOF(void *)
336 AC_CHECK_SIZEOF(long long)
337 AC_CHECK_SIZEOF(__int64)
339 ### See what our 64 bit type is called
340 AC_MSG_CHECKING([64-bit integer type])
345 dbusint64_constant='(val)'
346 dbusuint64_constant='(val)'
350 dbusint64_constant='(val##L)'
351 dbusuint64_constant='(val##UL)'
353 $ac_cv_sizeof_long_long)
354 dbusint64='long long'
355 dbusint64_constant='(val##LL)'
356 dbusuint64_constant='(val##ULL)'
358 $ac_cv_sizeof___int64)
360 dbusint64_constant='(val##i64)'
361 dbusuint64_constant='(val##ui64)'
365 if test -z "$dbusint64" ; then
366 DBUS_INT64_TYPE="no_int64_type_detected"
369 DBUS_UINT64_CONSTANT=
370 AC_MSG_RESULT([none found])
372 DBUS_INT64_TYPE="$dbusint64"
374 DBUS_INT64_CONSTANT="$dbusint64_constant"
375 DBUS_UINT64_CONSTANT="$dbusuint64_constant"
376 AC_MSG_RESULT($DBUS_INT64_TYPE)
379 AC_SUBST(DBUS_INT64_TYPE)
380 AC_SUBST(DBUS_INT64_CONSTANT)
381 AC_SUBST(DBUS_UINT64_CONSTANT)
382 AC_SUBST(DBUS_HAVE_INT64)
384 ### see what 32-bit int is called
385 AC_MSG_CHECKING([32-bit integer type])
399 if test -z "$dbusint32" ; then
400 DBUS_INT32_TYPE="no_int32_type_detected"
401 AC_MSG_ERROR([No 32-bit integer type found])
403 DBUS_INT32_TYPE="$dbusint32"
404 AC_MSG_RESULT($DBUS_INT32_TYPE)
407 AC_SUBST(DBUS_INT32_TYPE)
409 ### see what 16-bit int is called
410 AC_MSG_CHECKING([16-bit integer type])
421 if test -z "$dbusint16" ; then
422 DBUS_INT16_TYPE="no_int16_type_detected"
423 AC_MSG_ERROR([No 16-bit integer type found])
425 DBUS_INT16_TYPE="$dbusint16"
426 AC_MSG_RESULT($DBUS_INT16_TYPE)
429 AC_SUBST(DBUS_INT16_TYPE)
435 dnl **********************************
436 dnl *** va_copy checks (from GLib) ***
437 dnl **********************************
438 dnl we currently check for all three va_copy possibilities, so we get
439 dnl all results in config.log for bug reports.
440 AC_CACHE_CHECK([for an implementation of va_copy()],dbus_cv_va_copy,[
441 AC_LINK_IFELSE([#include <stdarg.h>
442 void f (int i, ...) {
443 va_list args1, args2;
445 va_copy (args2, args1);
446 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
448 va_end (args1); va_end (args2);
454 [dbus_cv_va_copy=yes],
455 [dbus_cv_va_copy=no])
457 AC_CACHE_CHECK([for an implementation of __va_copy()],dbus_cv___va_copy,[
458 AC_LINK_IFELSE([#include <stdarg.h>
459 void f (int i, ...) {
460 va_list args1, args2;
462 __va_copy (args2, args1);
463 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
465 va_end (args1); va_end (args2);
471 [dbus_cv___va_copy=yes],
472 [dbus_cv___va_copy=no])
475 if test "x$dbus_cv_va_copy" = "xyes"; then
476 dbus_va_copy_func=va_copy
477 else if test "x$dbus_cv___va_copy" = "xyes"; then
478 dbus_va_copy_func=__va_copy
482 if test -n "$dbus_va_copy_func"; then
483 AC_DEFINE_UNQUOTED(DBUS_VA_COPY,$dbus_va_copy_func,[A 'va_copy' style function])
486 AC_CACHE_CHECK([whether va_lists can be copied by value],dbus_cv_va_val_copy,[
487 AC_TRY_RUN([#include <stdarg.h>
488 void f (int i, ...) {
489 va_list args1, args2;
492 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
494 va_end (args1); va_end (args2);
500 [dbus_cv_va_val_copy=yes],
501 [dbus_cv_va_val_copy=no],
502 [dbus_cv_va_val_copy=yes])
505 if test "x$dbus_cv_va_val_copy" = "xno"; then
506 AC_DEFINE(DBUS_VA_COPY_AS_ARRAY,1, ['va_lists' cannot be copies as values])
510 #### Atomic integers (checks by Sebastian Wilhelmi for GLib)
511 AC_MSG_CHECKING([whether to use inline assembler routines for atomic integers])
513 if test x"$GCC" = xyes; then
514 if test "x$enable_ansi" = "xyes"; then
522 AC_MSG_RESULT([i486])
523 AC_DEFINE_UNQUOTED(DBUS_USE_ATOMIC_INT_486, 1, [Use atomic integer implementation for 486])
532 if test x$have_atomic_inc = xyes ; then
533 AC_DEFINE_UNQUOTED(DBUS_HAVE_ATOMIC_INT, 1, [Some atomic integer implementation present])
536 #### Various functions
537 AC_CHECK_LIB(socket,socket)
538 AC_CHECK_LIB(nsl,gethostbyname)
540 AC_CHECK_FUNCS(vsnprintf vasprintf nanosleep usleep poll setenv unsetenv socketpair getgrouplist)
542 AC_CHECK_HEADERS(execinfo.h, [AC_CHECK_FUNCS(backtrace)])
544 AC_CACHE_CHECK([for posix getpwnam_r],
545 ac_cv_func_posix_getpwnam_r,
551 struct passwd pwd, *pwptr = &pwd;
554 error = getpwnam_r ("", &pwd, buffer,
555 sizeof (buffer), &pwptr);
556 return (error < 0 && errno == ENOSYS)
559 [ac_cv_func_posix_getpwnam_r=yes],
560 [ac_cv_func_posix_getpwnam_r=no])])
561 if test "$ac_cv_func_posix_getpwnam_r" = yes; then
562 AC_DEFINE(HAVE_POSIX_GETPWNAM_R,1,
563 [Have POSIX function getpwnam_r])
565 AC_CACHE_CHECK([for nonposix getpwnam_r],
566 ac_cv_func_nonposix_getpwnam_r,
567 [AC_TRY_LINK([#include <pwd.h>],
570 getpwnam_r ("", &pwd, buffer,
572 [ac_cv_func_nonposix_getpwnam_r=yes],
573 [ac_cv_func_nonposix_getpwnam_r=no])])
574 if test "$ac_cv_func_nonposix_getpwnam_r" = yes; then
575 AC_DEFINE(HAVE_NONPOSIX_GETPWNAM_R,1,
576 [Have non-POSIX function getpwnam_r])
580 dnl check for socklen_t
581 AC_MSG_CHECKING(whether socklen_t is defined)
583 #include <sys/types.h>
584 #include <sys/socket.h>
589 ],dbus_have_socklen_t=yes,dbus_have_socklen_t=no)
590 AC_MSG_RESULT($dbus_have_socklen_t)
592 if test "x$dbus_have_socklen_t" = "xyes"; then
593 AC_DEFINE(HAVE_SOCKLEN_T,1,[Have socklen_t type])
596 dnl check for writev header and writev function so we're
597 dnl good to go if HAVE_WRITEV gets defined.
598 AC_CHECK_HEADERS(sys/uio.h, [AC_CHECK_FUNCS(writev)])
600 dnl check for flavours of varargs macros (test from GLib)
601 AC_MSG_CHECKING(for ISO C99 varargs macros in C)
603 int a(int p1, int p2, int p3);
604 #define call_a(...) a(1,__VA_ARGS__)
606 ],dbus_have_iso_c_varargs=yes,dbus_have_iso_c_varargs=no)
607 AC_MSG_RESULT($dbus_have_iso_c_varargs)
609 AC_MSG_CHECKING(for GNUC varargs macros)
611 int a(int p1, int p2, int p3);
612 #define call_a(params...) a(1,params)
614 ],dbus_have_gnuc_varargs=yes,dbus_have_gnuc_varargs=no)
615 AC_MSG_RESULT($dbus_have_gnuc_varargs)
617 dnl Output varargs tests
618 if test x$dbus_have_iso_c_varargs = xyes; then
619 AC_DEFINE(HAVE_ISO_VARARGS,1,[Have ISO C99 varargs macros])
621 if test x$dbus_have_gnuc_varargs = xyes; then
622 AC_DEFINE(HAVE_GNUC_VARARGS,1,[Have GNU-style varargs macros])
625 dnl Check for various credentials.
626 AC_MSG_CHECKING(for struct cmsgcred)
628 #include <sys/types.h>
629 #include <sys/socket.h>
631 struct cmsgcred cred;
634 ],dbus_have_struct_cmsgcred=yes,dbus_have_struct_cmsgcred=no)
635 AC_MSG_RESULT($dbus_have_struct_cmsgcred)
637 if test x$dbus_have_struct_cmsgcred = xyes; then
638 AC_DEFINE(HAVE_CMSGCRED,1,[Have cmsgcred structure])
642 #### Abstract sockets
644 AC_MSG_CHECKING(abstract socket namespace)
646 AC_RUN_IFELSE([AC_LANG_PROGRAM(
648 #include <sys/types.h>
652 #include <sys/socket.h>
658 struct sockaddr_un addr;
660 listen_fd = socket (PF_UNIX, SOCK_STREAM, 0);
664 fprintf (stderr, "socket() failed: %s\n", strerror (errno));
668 memset (&addr, '\0', sizeof (addr));
669 addr.sun_family = AF_UNIX;
670 strcpy (addr.sun_path, "X/tmp/dbus-fake-socket-path-used-in-configure-test");
671 addr.sun_path[0] = '\0'; /* this is what makes it abstract */
673 if (bind (listen_fd, (struct sockaddr*) &addr, SUN_LEN (&addr)) < 0)
675 fprintf (stderr, "Abstract socket namespace bind() failed: %s\n",
682 [have_abstract_sockets=yes],
683 [have_abstract_sockets=no])
685 AC_MSG_RESULT($have_abstract_sockets)
687 if test x$enable_abstract_sockets = xyes; then
688 if test x$have_abstract_sockets = xno; then
689 AC_MSG_ERROR([Abstract sockets explicitly required, and support not detected.])
693 if test x$enable_abstract_sockets = xno; then
694 have_abstract_sockets=no;
697 if test x$have_abstract_sockets = xyes ; then
698 DBUS_PATH_OR_ABSTRACT=abstract
699 AC_DEFINE(HAVE_ABSTRACT_SOCKETS,1,[Have abstract socket namespace])
701 DBUS_PATH_OR_ABSTRACT=path
704 # this is used in addresses to prefer abstract, e.g.
705 # unix:path=/foo or unix:abstract=/foo
706 AC_SUBST(DBUS_PATH_OR_ABSTRACT)
708 #### Sort out XML library
711 AC_CHECK_LIB(expat, XML_ParserCreate_MM,
712 [ AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false) ],
715 PKG_CHECK_MODULES(LIBXML, libxml-2.0, have_libxml=true, have_libxml=false)
717 # see what we want to use
718 dbus_use_libxml=false
720 if test x$with_xml = xexpat; then
722 if ! $have_expat ; then
723 AC_MSG_ERROR([Explicitly requested expat but expat not found])
725 elif test x$with_xml = xlibxml; then
727 if ! $have_libxml ; then
728 AC_MSG_ERROR([Explicitly requested libxml but libxml not found])
731 ### expat is the default because libxml can't currently survive
732 ### our brutal OOM-handling unit test setup.
733 ### http://bugzilla.gnome.org/show_bug.cgi?id=109368
734 if $have_expat ; then
737 elif $have_libxml ; then
741 AC_MSG_ERROR([No XML library found, check config.log for failed attempts])
745 AM_CONDITIONAL(DBUS_USE_EXPAT, $dbus_use_expat)
746 AM_CONDITIONAL(DBUS_USE_LIBXML, $dbus_use_libxml)
748 if $dbus_use_expat; then
752 if $dbus_use_libxml; then
753 XML_LIBS=$LIBXML_LIBS
754 XML_CFLAGS=$LIBXML_CFLAGS
758 if test x$enable_selinux = xno ; then
761 # See if we have SELinux library
762 AC_CHECK_LIB(selinux, is_selinux_enabled,
763 have_selinux=yes, have_selinux=no)
765 # see if we have the SELinux header with the new D-BUS stuff in it
766 if test x$have_selinux = xyes ; then
767 AC_MSG_CHECKING([for DBUS Flask permissions in selinux/av_permissions.h])
768 AC_TRY_COMPILE([#include <selinux/av_permissions.h>],
769 [#ifdef DBUS__ACQUIRE_SVC return 0;
771 #error DBUS__ACQUIRE_SVC not defined
773 have_selinux=yes, have_selinux=no)
774 AC_MSG_RESULT($have_selinux)
777 if test x$enable_selinux = xauto ; then
778 if test x$have_selinux = xno ; then
779 AC_MSG_WARN([Sufficiently new SELinux library not found])
782 if test x$have_selinux = xno ; then
783 AC_MSG_ERROR([SElinux explicitly required, and SELinux library not found])
788 AM_CONDITIONAL(HAVE_SELINUX, test x$have_selinux = xyes)
790 if test x$have_selinux = xyes ; then
791 SELINUX_LIBS="-lselinux -lpthread"
792 AC_DEFINE(HAVE_SELINUX,1,[SELinux support])
797 #### Set up final flags
800 AC_SUBST(DBUS_CLIENT_CFLAGS)
801 AC_SUBST(DBUS_CLIENT_LIBS)
803 DBUS_BUS_CFLAGS=$XML_CFLAGS
804 DBUS_BUS_LIBS="$XML_LIBS $SELINUX_LIBS"
805 AC_SUBST(DBUS_BUS_CFLAGS)
806 AC_SUBST(DBUS_BUS_LIBS)
810 AC_SUBST(DBUS_TEST_CFLAGS)
811 AC_SUBST(DBUS_TEST_LIBS)
814 PKG_CHECK_MODULES(DBUS_GLIB, gobject-2.0, have_glib=yes, have_glib=no)
815 PKG_CHECK_MODULES(DBUS_GLIB_THREADS, glib-2.0 gthread-2.0, have_glib_threads=yes, have_glib_threads=no)
817 if test x$have_glib = xno ; then
818 AC_MSG_WARN([GLib development libraries not found])
821 if test x$enable_glib = xyes; then
822 if test x$have_glib = xno; then
823 AC_MSG_ERROR([GLib explicitly required, and GLib development libraries not found])
827 if test x$enable_glib = xno; then
831 AM_CONDITIONAL(HAVE_GLIB, test x$have_glib = xyes)
832 AM_CONDITIONAL(HAVE_GLIB_THREADS, test x$have_glib_threads = xyes)
834 if test x$have_glib = xyes; then
835 GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
837 GLIB_GENMARSHAL=glib-not-enabled-so-there-is-no-genmarshal
839 AC_SUBST(GLIB_GENMARSHAL)
842 AC_SUBST(DBUS_GLIB_CFLAGS)
843 AC_SUBST(DBUS_GLIB_LIBS)
844 AC_SUBST(DBUS_GLIB_THREADS_LIBS)
846 DBUS_GLIB_TOOL_CFLAGS=$XML_CFLAGS
847 DBUS_GLIB_TOOL_LIBS=$XML_LIBS
848 AC_SUBST(DBUS_GLIB_TOOL_CFLAGS)
849 AC_SUBST(DBUS_GLIB_TOOL_LIBS)
852 if test x$have_glib = xno ; then
853 AC_MSG_WARN([Can't use GTK+ since GLib not enabled])
856 PKG_CHECK_MODULES(DBUS_GTK, gtk+-2.0 >= 2.4, have_gtk=yes, have_gtk=no)
857 PKG_CHECK_MODULES(DBUS_GTK_THREADS, gtk+-2.0 >= 2.4 gthread-2.0, have_gtk_threads=yes, have_gtk_threads=no)
860 if test x$have_gtk = xno ; then
861 AC_MSG_WARN([GTK+ development libraries not found])
864 if test x$enable_gtk = xyes; then
865 if test x$have_gtk = xno; then
866 AC_MSG_ERROR([GTK+ explicitly required, and GTK+ development libraries not found])
870 if test x$enable_gtk = xno; then
874 AM_CONDITIONAL(HAVE_GTK, test x$have_gtk = xyes)
877 AC_SUBST(DBUS_GTK_CFLAGS)
878 AC_SUBST(DBUS_GTK_LIBS)
879 AC_SUBST(DBUS_GTK_THREADS_CFLAGS)
880 AC_SUBST(DBUS_GTK_THREADS_LIBS)
883 AC_PATH_PROG(QT_MOC, moc, no)
886 AC_MSG_CHECKING([for qglobal.h])
887 if test -n "$QTDIR" -a -f "$QTDIR/include/qglobal.h"; then
889 DBUS_QT_CXXFLAGS="-I$QTDIR/include"
891 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
892 if test -f "$dir/qglobal.h"; then
894 DBUS_QT_CXXFLAGS="-I$dir"
898 if test x"$have_qt" = x"yes"; then
899 AC_MSG_RESULT([found])
901 AC_MSG_RESULT([not found])
904 dnl linking to kdecore will give us a bit of help from libtool
905 if (! kde-config >& /dev/null); then
908 kdelibs=`kde-config --install lib --expandvars 2>/dev/null`
909 if test -z $kdelibs -o ! -f $kdelibs/libkdecore.la; then
912 DBUS_QT_LIBS="$kdelibs/libkdecore.la"
916 if test x$have_qt = xno ; then
917 AC_MSG_WARN([Qt development libraries not found])
920 if test x$enable_qt = xyes; then
921 if test x$have_qt = xno; then
922 AC_MSG_ERROR([Qt integration explicitly required, and Qt libraries not found])
926 if test x$enable_qt = xno; then
930 AM_CONDITIONAL(HAVE_QT, test x$have_qt = xyes)
933 AC_SUBST(DBUS_QT_CXXFLAGS)
934 AC_SUBST(DBUS_QT_LIBS)
939 ## for now enable_x11 just tracks have_x11,
940 ## there's no --enable-x11
941 if test x$no_x = xyes ; then
949 if test x$enable_x11 = xyes ; then
950 AC_DEFINE(DBUS_BUILD_X11,1,[Build X11-dependent code])
951 DBUS_X_LIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
952 DBUS_X_CFLAGS="$X_CFLAGS"
958 AC_SUBST(DBUS_X_CFLAGS)
959 AC_SUBST(DBUS_X_LIBS)
961 ### Doxygen Documentation
963 AC_PATH_PROG(DOXYGEN, doxygen, no)
965 AC_MSG_CHECKING([whether to build Doxygen documentation])
967 if test x$DOXYGEN = xno ; then
973 if test x$enable_doxygen_docs = xauto ; then
974 if test x$have_doxygen = xno ; then
975 enable_doxygen_docs=no
977 enable_doxygen_docs=yes
981 if test x$enable_doxygen_docs = xyes; then
982 if test x$have_doxygen = xno; then
983 AC_MSG_ERROR([Building Doxygen docs explicitly required, but Doxygen not found])
987 AM_CONDITIONAL(DBUS_DOXYGEN_DOCS_ENABLED, test x$enable_doxygen_docs = xyes)
990 ### XML Documentation
992 AC_PATH_PROG(XMLTO, xmlto, no)
994 AC_MSG_CHECKING([whether to build XML documentation])
996 if test x$XMLTO = xno ; then
1002 if test x$enable_xml_docs = xauto ; then
1003 if test x$have_xmlto = xno ; then
1010 if test x$enable_xml_docs = xyes; then
1011 if test x$have_xmlto = xno; then
1012 AC_MSG_ERROR([Building XML docs explicitly required, but xmlto not found])
1016 AM_CONDITIONAL(DBUS_XML_DOCS_ENABLED, test x$enable_xml_docs = xyes)
1019 #### Have to go $localstatedir->$prefix/var->/usr/local/var
1020 #### someone please fix this a better way...
1022 #### find the actual value for $prefix that we'll end up with
1023 ## (I know this is broken and should be done in the Makefile, but
1024 ## that's a major pain and almost nobody actually seems to care)
1026 if test "x$prefix" = "xNONE"; then
1027 REAL_PREFIX=$ac_default_prefix
1032 ## temporarily change prefix and exec_prefix
1036 if test "x$exec_prefix" = xNONE ; then
1037 REAL_EXEC_PREFIX=$REAL_PREFIX
1039 REAL_EXEC_PREFIX=$exec_prefix
1041 old_exec_prefix=$exec_prefix
1042 exec_prefix=$REAL_EXEC_PREFIX
1045 LOCALSTATEDIR_TMP="$localstatedir"
1046 EXPANDED_LOCALSTATEDIR=`eval echo $LOCALSTATEDIR_TMP`
1047 AC_SUBST(EXPANDED_LOCALSTATEDIR)
1049 SYSCONFDIR_TMP="$sysconfdir"
1050 EXPANDED_SYSCONFDIR=`eval echo $SYSCONFDIR_TMP`
1051 AC_SUBST(EXPANDED_SYSCONFDIR)
1053 BINDIR_TMP="$bindir"
1054 EXPANDED_BINDIR=`eval echo $BINDIR_TMP`
1055 AC_SUBST(EXPANDED_BINDIR)
1057 LIBDIR_TMP="$libdir"
1058 EXPANDED_LIBDIR=`eval echo $LIBDIR_TMP`
1059 AC_SUBST(EXPANDED_LIBDIR)
1061 DATADIR_TMP="$datadir"
1062 EXPANDED_DATADIR=`eval echo $DATADIR_TMP`
1063 AC_SUBST(EXPANDED_DATADIR)
1065 ## put prefix and exec_prefix back
1067 exec_prefix=$old_exec_prefix
1069 #### Check our operating system
1070 operating_system=unknown
1071 if test -f /etc/redhat-release || test -f $EXPANDED_SYSCONFDIR/redhat-release ; then
1072 operating_system=redhat
1075 if test -f /etc/slackware-version || test -f $EXPANDED_SYSCONFDIR/slackware-version ; then
1076 operating_system=slackware
1079 #### Sort out init scripts
1081 if test x$with_init_scripts = x; then
1082 if test xredhat = x$operating_system ; then
1083 with_init_scripts=redhat
1085 if test xslackware = x$operating_system ; then
1086 with_init_scripts=slackware
1088 with_init_scripts=none
1093 AM_CONDITIONAL(DBUS_INIT_SCRIPTS_RED_HAT, test x$with_init_scripts = xredhat)
1095 AM_CONDITIONAL(DBUS_INIT_SCRIPTS_SLACKWARE, test x$with_init_scripts = xslackware)
1097 ##### Set up location for system bus socket
1098 if ! test -z "$with_system_socket"; then
1099 DBUS_SYSTEM_SOCKET=$with_system_socket
1101 DBUS_SYSTEM_SOCKET=${EXPANDED_LOCALSTATEDIR}/run/dbus/system_bus_socket
1104 AC_SUBST(DBUS_SYSTEM_SOCKET)
1105 AC_DEFINE_UNQUOTED(DBUS_SYSTEM_SOCKET,"$DBUS_SYSTEM_SOCKET",[The name of the socket the system bus listens on by default])
1107 ## system bus only listens on local domain sockets, and never
1108 ## on an abstract socket (so only root can create the socket)
1109 DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="unix:path=$DBUS_SYSTEM_SOCKET"
1110 AC_SUBST(DBUS_SYSTEM_BUS_DEFAULT_ADDRESS)
1111 AC_DEFINE_UNQUOTED(DBUS_SYSTEM_BUS_DEFAULT_ADDRESS, "$DBUS_SYSTEM_BUS_DEFAULT_ADDRESS",[The default D-BUS address of the system bus])
1113 #### Set up the pid file
1114 if ! test -z "$with_system_pid_file"; then
1115 DBUS_SYSTEM_PID_FILE=$with_system_pid_file
1116 elif test x$operating_system = xredhat ; then
1117 DBUS_SYSTEM_PID_FILE=${EXPANDED_LOCALSTATEDIR}/run/messagebus.pid
1119 DBUS_SYSTEM_PID_FILE=${EXPANDED_LOCALSTATEDIR}/run/dbus/pid
1122 AC_SUBST(DBUS_SYSTEM_PID_FILE)
1124 #### Tell tests where to find certain stuff in builddir
1125 ABSOLUTE_TOP_BUILDDIR=`cd ${ac_top_builddir}. && pwd`
1127 AC_DEFUN(TEST_PATH, [
1128 TEST_$1=${ABSOLUTE_TOP_BUILDDIR}/test/$2
1129 AC_DEFINE_UNQUOTED(TEST_$1, "$TEST_$1",
1130 [Full path to test file test/$2 in builddir])
1134 TEST_PATH(SERVICE_DIR, data/valid-service-files)
1135 TEST_PATH(SERVICE_BINARY, test-service)
1136 TEST_PATH(GLIB_SERVICE_BINARY, glib/test-service-glib)
1137 TEST_PATH(EXIT_BINARY, test-exit)
1138 TEST_PATH(SEGFAULT_BINARY, test-segfault)
1139 TEST_PATH(SLEEP_FOREVER_BINARY, test-sleep-forever)
1140 AC_SUBST(ABSOLUTE_TOP_BUILDDIR)
1142 #### Find socket directories
1143 if ! test -z "$TMPDIR" ; then
1144 DEFAULT_SOCKET_DIR=$TMPDIR
1145 elif ! test -z "$TEMP" ; then
1146 DEFAULT_SOCKET_DIR=$TEMP
1147 elif ! test -z "$TMP" ; then
1148 DEFAULT_SOCKET_DIR=$TMP
1150 DEFAULT_SOCKET_DIR=/tmp
1153 if ! test -z "$with_test_socket_dir" ; then
1154 TEST_SOCKET_DIR="$with_test_socket_dir"
1156 TEST_SOCKET_DIR=$DEFAULT_SOCKET_DIR
1158 AC_SUBST(TEST_SOCKET_DIR)
1159 AC_DEFINE_UNQUOTED(DBUS_TEST_SOCKET_DIR, "$TEST_SOCKET_DIR", [Where to put test sockets])
1161 if ! test -z "$with_session_socket_dir" ; then
1162 DBUS_SESSION_SOCKET_DIR="$with_session_socket_dir"
1164 DBUS_SESSION_SOCKET_DIR=$DEFAULT_SOCKET_DIR
1166 AC_DEFINE_UNQUOTED(DBUS_SESSION_SOCKET_DIR, "$DBUS_SESSION_SOCKET_DIR", [Where per-session bus puts its sockets])
1167 AC_SUBST(DBUS_SESSION_SOCKET_DIR)
1169 # Detect if we can build Python bindings (need python, python headers, and pyrex)
1170 if test x$enable_python = xno; then
1173 AC_MSG_NOTICE([Checking to see if we can build Python bindings])
1177 if test -z "$PYTHON" ; then
1178 AC_MSG_WARN([Python not found])
1180 AC_CHECK_PROGS(PYREX, pyrexc)
1182 if test -z "$PYREX" ; then
1188 AM_CHECK_PYTHON_HEADERS(have_python_headers=yes,have_python_headers=no)
1190 if test x$have_pyrex = xyes -a x$have_python_headers = xyes ; then
1195 if test x$have_python = xno ; then
1196 if test x$enable_python = xyes ; then
1197 AC_MSG_ERROR([Building python explicitly requested, but can't build python bindings])
1199 AC_MSG_WARN([Couldn't find either Pyrex or the Python headers, not building Python bindings])
1204 AM_CONDITIONAL(HAVE_PYTHON, test x$have_python = xyes)
1208 dbus/dbus-arch-deps.h
1218 python/examples/Makefile
1222 gcj/org/freedesktop/Makefile
1223 gcj/org/freedesktop/dbus/Makefile
1225 mono/AssemblyInfo.cs
1226 mono/dbus-sharp.dll.config
1227 mono/example/Makefile
1237 test/data/valid-config-files/debug-allow-all.conf
1238 test/data/valid-config-files/debug-allow-all-sha1.conf
1239 test/data/valid-service-files/debug-echo.service
1240 test/data/valid-service-files/debug-segfault.service
1241 test/data/valid-service-files/debug-glib.service
1244 ### FIXME it's bizarre that have_qt and have_glib are used
1245 ### instead of enable_ - should fix things so that enable
1246 ### is always whether it's enabled, and have is always whether
1249 dnl ==========================================================================
1255 exec_prefix: ${exec_prefix}
1256 libdir: ${EXPANDED_LIBDIR}
1257 bindir: ${EXPANDED_BINDIR}
1258 sysconfdir: ${EXPANDED_SYSCONFDIR}
1259 localstatedir: ${EXPANDED_LOCALSTATEDIR}
1260 datadir: ${EXPANDED_DATADIR}
1261 source code location: ${srcdir}
1264 cppflags: ${CPPFLAGS}
1265 cxxflags: ${CXXFLAGS}
1266 64-bit int: ${DBUS_INT64_TYPE}
1267 32-bit int: ${DBUS_INT32_TYPE}
1268 16-bit int: ${DBUS_INT16_TYPE}
1272 if test x$enable_gcj = xyes ; then
1275 gcjflags: ${GCJFLAGS}"
1278 " gcj: (not enabled)"
1281 if test x$enable_mono = xyes ; then
1287 " csc: (not enabled)
1292 Maintainer mode: ${USE_MAINTAINER_MODE}
1293 gcc coverage profiling: ${enable_gcov}
1294 Building unit tests: ${enable_tests}
1295 Building verbose mode: ${enable_verbose_mode}
1296 Building assertions: ${enable_asserts}
1297 Building checks: ${enable_checks}
1298 Building Qt bindings: ${have_qt}
1299 Building GLib bindings: ${have_glib}
1300 Building Python bindings: ${have_python}
1301 Building SELinux support: ${have_selinux}
1302 Building Mono bindings: ${enable_mono}
1303 Building Mono docs: ${enable_mono_docs}
1304 Building GTK+ tools: ${have_gtk}
1305 Building X11 code: ${enable_x11}
1306 Building Doxygen docs: ${enable_doxygen_docs}
1307 Building XML docs: ${enable_xml_docs}
1308 Using XML parser: ${with_xml}
1309 Init scripts style: ${with_init_scripts}
1310 Abstract socket names: ${have_abstract_sockets}
1311 System bus socket: ${DBUS_SYSTEM_SOCKET}
1312 System bus address: ${DBUS_SYSTEM_BUS_DEFAULT_ADDRESS}
1313 System bus PID file: ${DBUS_SYSTEM_PID_FILE}
1314 Session bus socket dir: ${DBUS_SESSION_SOCKET_DIR}
1315 'make check' socket dir: ${TEST_SOCKET_DIR}
1318 if test x$enable_tests = xyes; then
1319 echo "NOTE: building with unit tests increases the size of the installed library and renders it insecure."
1321 if test x$enable_tests = xyes -a x$enable_asserts = xno; then
1322 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)"
1324 if test x$enable_gcov = xyes; then
1325 echo "NOTE: building with coverage profiling is definitely for developers only."
1327 if test x$enable_verbose_mode = xyes; then
1328 echo "NOTE: building with verbose mode increases library size, may slightly increase security risk, and decreases performance."
1330 if test x$enable_asserts = xyes; then
1331 echo "NOTE: building with assertions increases library size and decreases performance."
1333 if test x$enable_checks = xno; then
1334 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."