6 AM_INIT_AUTOMAKE(dbus, 0.23)
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
25 AC_ARG_ENABLE(qt, [ --enable-qt enable Qt-friendly client library],enable_qt=$enableval,enable_qt=auto)
26 AC_ARG_ENABLE(glib, [ --enable-glib enable GLib-friendly client library],enable_glib=$enableval,enable_glib=auto)
27 AC_ARG_ENABLE(gtk, [ --enable-gtk enable GTK-requiring executables],enable_gtk=$enableval,enable_gtk=auto)
28 AC_ARG_ENABLE(tests, [ --enable-tests enable unit test code],enable_tests=$enableval,enable_tests=$USE_MAINTAINER_MODE)
29 AC_ARG_ENABLE(ansi, [ --enable-ansi enable -ansi -pedantic gcc flags],enable_ansi=$enableval,enable_ansi=no)
30 AC_ARG_ENABLE(verbose-mode, [ --enable-verbose-mode support verbose debug mode],enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
31 AC_ARG_ENABLE(asserts, [ --enable-asserts include assertion checks],enable_asserts=$enableval,enable_asserts=$USE_MAINTAINER_MODE)
32 AC_ARG_ENABLE(checks, [ --enable-checks include sanity checks on public API],enable_checks=$enableval,enable_checks=yes)
33 AC_ARG_ENABLE(xml-docs, [ --enable-xml-docs build XML documentation (requires xmlto)],enable_xml_docs=$enableval,enable_xml_docs=auto)
34 AC_ARG_ENABLE(doxygen-docs, [ --enable-doxygen-docs build DOXYGEN documentation (requires Doxygen)],enable_doxygen_docs=$enableval,enable_doxygen_docs=auto)
35 AC_ARG_ENABLE(gcov, [ --enable-gcov compile with coverage profiling instrumentation (gcc only)],enable_gcov=$enableval,enable_gcov=no)
36 AC_ARG_ENABLE(abstract-sockets, [ --enable-abstract-sockets use abstract socket namespace (linux only)],enable_abstract_sockets=$enableval,enable_abstract_sockets=auto)
37 AC_ARG_ENABLE(gcj, [ --enable-gcj build gcj bindings],enable_gcj=$enableval,enable_gcj=no)
38 AC_ARG_ENABLE(mono, [ --enable-mono build mono bindings],enable_mono=$enableval,enable_mono=auto)
39 AC_ARG_ENABLE(mono_docs, [ --enable-mono-docs build mono docs],enable_mono_docs=$enableval,enable_mono_docs=auto)
40 AC_ARG_ENABLE(python, [ --enable-python build python bindings],enable_python=$enableval,enable_python=auto)
41 AC_ARG_ENABLE(selinux, [ --enable-selinux build with SELinux support],enable_selinux=$enableval,enable_selinux=auto)
43 AC_ARG_WITH(xml, [ --with-xml=[libxml/expat] XML library to use])
44 AC_ARG_WITH(init-scripts, [ --with-init-scripts=[redhat] Style of init scripts to install])
45 AC_ARG_WITH(session-socket-dir, [ --with-session-socket-dir=[dirname] Where to put sockets for the per-login-session message bus])
46 AC_ARG_WITH(test-socket-dir, [ --with-test-socket-dir=[dirname] Where to put sockets for make check])
47 AC_ARG_WITH(system-pid-file, [ --with-system-pid-file=[pidfile] PID file for systemwide daemon])
48 AC_ARG_WITH(system-socket, [ --with-system-socket=[filename] UNIX domain socket for systemwide daemon])
50 dnl DBUS_BUILD_TESTS controls unit tests built in to .c files
51 dnl and also some stuff in the test/ subdir
52 AM_CONDITIONAL(DBUS_BUILD_TESTS, test x$enable_tests = xyes)
53 if test x$enable_tests = xyes; then
54 AC_DEFINE(DBUS_BUILD_TESTS,1,[Build test code])
57 if test x$enable_verbose_mode = xyes; then
58 AC_DEFINE(DBUS_ENABLE_VERBOSE_MODE,1,[Support a verbose mode])
60 if test x$enable_asserts = xno; then
61 AC_DEFINE(DBUS_DISABLE_ASSERT,1,[Disable assertion checking])
62 AC_DEFINE(G_DISABLE_ASSERT,1,[Disable GLib assertion macros])
64 if test x$enable_checks = xno; then
65 AC_DEFINE(DBUS_DISABLE_CHECKS,1,[Disable public API sanity checking])
66 AC_DEFINE(G_DISABLE_CHECKS,1,[Disable GLib public API sanity checking])
69 #### gcc warning flags
71 if test "x$GCC" = "xyes"; then
74 *[\ \ ]-Wall[\ \ ]*) ;;
75 *) CFLAGS="$CFLAGS -Wall" ;;
79 *[\ \ ]-Wchar-subscripts[\ \ ]*) ;;
80 *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
84 *[\ \ ]-Wmissing-declarations[\ \ ]*) ;;
85 *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
89 *[\ \ ]-Wmissing-prototypes[\ \ ]*) ;;
90 *) CFLAGS="$CFLAGS -Wmissing-prototypes" ;;
94 *[\ \ ]-Wnested-externs[\ \ ]*) ;;
95 *) CFLAGS="$CFLAGS -Wnested-externs" ;;
99 *[\ \ ]-Wpointer-arith[\ \ ]*) ;;
100 *) CFLAGS="$CFLAGS -Wpointer-arith" ;;
104 *[\ \ ]-Wcast-align[\ \ ]*) ;;
105 *) CFLAGS="$CFLAGS -Wcast-align" ;;
109 *[\ \ ]-Wfloat-equal[\ \ ]*) ;;
110 *) CFLAGS="$CFLAGS -Wfloat-equal" ;;
114 *[\ \ ]-Wsign-compare[\ \ ]*) ;;
115 *) CFLAGS="$CFLAGS -Wsign-compare" ;;
118 if test "x$enable_ansi" = "xyes"; then
120 *[\ \ ]-ansi[\ \ ]*) ;;
121 *) CFLAGS="$CFLAGS -ansi" ;;
125 *[\ \ ]-D_POSIX_C_SOURCE*) ;;
126 *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;;
130 *[\ \ ]-D_BSD_SOURCE[\ \ ]*) ;;
131 *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;;
135 *[\ \ ]-pedantic[\ \ ]*) ;;
136 *) CFLAGS="$CFLAGS -pedantic" ;;
139 if test x$enable_gcov = xyes; then
141 *[\ \ ]-fprofile-arcs[\ \ ]*) ;;
142 *) CFLAGS="$CFLAGS -fprofile-arcs" ;;
145 *[\ \ ]-ftest-coverage[\ \ ]*) ;;
146 *) CFLAGS="$CFLAGS -ftest-coverage" ;;
149 ## remove optimization
150 CFLAGS=`echo "$CFLAGS" | sed -e 's/-O[0-9]*//g'`
154 if test x$enable_gcov = xyes; then
155 AC_MSG_ERROR([--enable-gcov can only be used with gcc])
159 #### can't use AM_PROG_GCJ since it fails fatally if no gcj found
160 AC_CHECK_PROGS(GCJ, gcj, gcj)
161 if test -z "$GCJ" ; then
164 # Needs to be here so libtool wont get confused
168 if test "x${GCJFLAGS-unset}" = xunset; then
169 GCJFLAGS="-g -O2 -Wall"
174 if test x$enable_gcj = xauto ; then
175 if test x$have_gcj = xno ; then
182 if test x$enable_gcj = xyes; then
183 if test x$have_gcj = xno ; then
184 AC_MSG_ERROR([Building gcj explicitly required, but gcj not found])
188 AM_CONDITIONAL(DBUS_USE_GCJ, test x$enable_gcj = xyes)
193 MONO_REQUIRED_VERSION=0.95
194 AC_SUBST(MONO_REQUIRED_VERSION)
195 PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, have_mono=true, have_mono=false)
197 if test "x$enable_mono" = "xyes"; then
198 if test "x$have_mono" = "xfalse"; then
199 AC_MSG_ERROR([Mono was not found])
203 if test "x$have_mono" = "xtrue"; then
204 if test `uname -s` = "Darwin"; then
205 AC_PATH_PROG(RUNTIME, mint, no)
206 AC_PATH_PROG(CSC, mcs, no)
210 AC_PATH_PROG(RUNTIME, mono, no)
211 AC_PATH_PROG(CSC, mcs, no)
216 AC_PATH_PROG(CSC, csc.exe, no)
222 if test x$enable_mono = xyes; then
223 if test x$have_mcs = xno ; then
224 AC_MSG_ERROR([Building Mono bindings explicitly required, but mcs compiler not found])
228 AC_PATH_PROG(GACUTIL, gacutil, no)
229 if test "x$GACUTIL" = "xno" ; then
230 AC_MSG_ERROR([No gacutil tool found])
236 if test x$enable_mono = xauto ; then
237 if test x$CSC = xno ; then
241 AC_PATH_PROG(GACUTIL, gacutil, no)
242 if test "x$GACUTIL" = "xno" ; then
256 AM_CONDITIONAL(DBUS_USE_CSC, test x$enable_mono = xyes)
258 #### Look for monodoc
259 MONODOC_REQUIRED_VERSION=0.16
260 AC_SUBST(MONODOC_REQUIRED_VERSION)
261 PKG_CHECK_MODULES(MONODOC_DEPENDENCY, monodoc >= $MONODOC_REQUIRED_VERSION, have_monodoc=yes, have_monodoc=no)
263 if test x$enable_mono_docs = xyes; then
264 if test x$have_monodoc = xno ; then
265 AC_MSG_ERROR([Building Mono docs explicitly required, but monodoc not found])
267 AC_PATH_PROG(MONODOC, monodoc, no)
268 if test x$MONODOC = xno; then
269 AC_MSG_ERROR([Building Mono docs explicitly required, but monodoc not found])
274 if test x$enable_mono_docs = xauto ; then
275 if test x$have_monodoc = xno ; then
279 AC_PATH_PROG(MONODOC, monodoc, no)
280 if test x$MONODOC = xno; then
291 AM_CONDITIONAL(ENABLE_MONODOC, test "x$enable_mono_docs" = "xyes")
294 # let ourselves use our own unstable API
295 CPPFLAGS="-DDBUS_API_SUBJECT_TO_CHANGE=1 $CPPFLAGS"
296 # compress spaces in flags
297 CFLAGS=`echo "$CFLAGS" | sed -e 's/ +/ /g'`
298 CXXFLAGS=`echo "$CXXFLAGS" | sed -e 's/ +/ /g'`
299 CPPFLAGS=`echo "$CPPFLAGS" | sed -e 's/ +/ /g'`
302 if test x$enable_gcov = xyes; then
303 ## so that config.h changes when you toggle gcov support
304 AC_DEFINE_UNQUOTED(DBUS_GCOV_ENABLED, 1, [Defined if gcov is enabled to force a rebuild due to config.h changing])
306 AC_MSG_CHECKING([for gcc 3.3 version of gcov file format])
308 AC_RUN_IFELSE( [AC_LANG_PROGRAM( , [[ if (__GNUC__ >=3 && __GNUC_MINOR__ >= 3) exit (0); else exit (1); ]])],
310 if test x$have_gcc33_gcov = xyes ; then
311 AC_DEFINE_UNQUOTED(DBUS_HAVE_GCC33_GCOV, 1, [Defined if we have gcc 3.3 and thus the new gcov format])
313 AC_MSG_RESULT($have_gcc33_gcov)
315 AM_CONDITIONAL(DBUS_GCOV_ENABLED, test x$enable_gcov = xyes)
319 AC_CHECK_SIZEOF(char)
320 AC_CHECK_SIZEOF(short)
321 AC_CHECK_SIZEOF(long)
323 AC_CHECK_SIZEOF(void *)
324 AC_CHECK_SIZEOF(long long)
325 AC_CHECK_SIZEOF(__int64)
327 ### See what our 64 bit type is called
328 AC_MSG_CHECKING([64-bit integer type])
333 dbusint64_constant='(val)'
334 dbusuint64_constant='(val)'
338 dbusint64_constant='(val##L)'
339 dbusuint64_constant='(val##UL)'
341 $ac_cv_sizeof_long_long)
342 dbusint64='long long'
343 dbusint64_constant='(val##LL)'
344 dbusuint64_constant='(val##ULL)'
346 $ac_cv_sizeof___int64)
348 dbusint64_constant='(val##i64)'
349 dbusuint64_constant='(val##ui64)'
353 if test -z "$dbusint64" ; then
354 DBUS_INT64_TYPE="no_int64_type_detected"
357 DBUS_UINT64_CONSTANT=
358 AC_MSG_RESULT([none found])
360 DBUS_INT64_TYPE="$dbusint64"
362 DBUS_INT64_CONSTANT="$dbusint64_constant"
363 DBUS_UINT64_CONSTANT="$dbusuint64_constant"
364 AC_MSG_RESULT($DBUS_INT64_TYPE)
367 AC_SUBST(DBUS_INT64_TYPE)
368 AC_SUBST(DBUS_INT64_CONSTANT)
369 AC_SUBST(DBUS_UINT64_CONSTANT)
370 AC_SUBST(DBUS_HAVE_INT64)
376 dnl **********************************
377 dnl *** va_copy checks (from GLib) ***
378 dnl **********************************
379 dnl we currently check for all three va_copy possibilities, so we get
380 dnl all results in config.log for bug reports.
381 AC_CACHE_CHECK([for an implementation of va_copy()],dbus_cv_va_copy,[
382 AC_LINK_IFELSE([#include <stdarg.h>
383 void f (int i, ...) {
384 va_list args1, args2;
386 va_copy (args2, args1);
387 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
389 va_end (args1); va_end (args2);
395 [dbus_cv_va_copy=yes],
396 [dbus_cv_va_copy=no])
398 AC_CACHE_CHECK([for an implementation of __va_copy()],dbus_cv___va_copy,[
399 AC_LINK_IFELSE([#include <stdarg.h>
400 void f (int i, ...) {
401 va_list args1, args2;
403 __va_copy (args2, args1);
404 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
406 va_end (args1); va_end (args2);
412 [dbus_cv___va_copy=yes],
413 [dbus_cv___va_copy=no])
416 if test "x$dbus_cv_va_copy" = "xyes"; then
417 dbus_va_copy_func=va_copy
418 else if test "x$dbus_cv___va_copy" = "xyes"; then
419 dbus_va_copy_func=__va_copy
423 if test -n "$dbus_va_copy_func"; then
424 AC_DEFINE_UNQUOTED(DBUS_VA_COPY,$dbus_va_copy_func,[A 'va_copy' style function])
427 AC_CACHE_CHECK([whether va_lists can be copied by value],dbus_cv_va_val_copy,[
428 AC_TRY_RUN([#include <stdarg.h>
429 void f (int i, ...) {
430 va_list args1, args2;
433 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
435 va_end (args1); va_end (args2);
441 [dbus_cv_va_val_copy=yes],
442 [dbus_cv_va_val_copy=no],
443 [dbus_cv_va_val_copy=yes])
446 if test "x$dbus_cv_va_val_copy" = "xno"; then
447 AC_DEFINE(DBUS_VA_COPY_AS_ARRAY,1, ['va_lists' cannot be copies as values])
451 #### Atomic integers (checks by Sebastian Wilhelmi for GLib)
452 AC_MSG_CHECKING([whether to use inline assembler routines for atomic integers])
454 if test x"$GCC" = xyes; then
455 if test "x$enable_ansi" = "xyes"; then
463 AC_MSG_RESULT([i486])
464 AC_DEFINE_UNQUOTED(DBUS_USE_ATOMIC_INT_486, 1, [Use atomic integer implementation for 486])
473 if test x$have_atomic_inc = xyes ; then
474 AC_DEFINE_UNQUOTED(DBUS_HAVE_ATOMIC_INT, 1, [Some atomic integer implementation present])
477 #### Various functions
478 AC_CHECK_LIB(socket,socket)
479 AC_CHECK_LIB(nsl,gethostbyname)
481 AC_CHECK_FUNCS(vsnprintf vasprintf nanosleep usleep poll setenv unsetenv socketpair getgrouplist)
483 AC_CHECK_HEADERS(execinfo.h, [AC_CHECK_FUNCS(backtrace)])
485 AC_CACHE_CHECK([for posix getpwnam_r],
486 ac_cv_func_posix_getpwnam_r,
492 struct passwd pwd, *pwptr = &pwd;
495 error = getpwnam_r ("", &pwd, buffer,
496 sizeof (buffer), &pwptr);
497 return (error < 0 && errno == ENOSYS)
500 [ac_cv_func_posix_getpwnam_r=yes],
501 [ac_cv_func_posix_getpwnam_r=no])])
502 if test "$ac_cv_func_posix_getpwnam_r" = yes; then
503 AC_DEFINE(HAVE_POSIX_GETPWNAM_R,1,
504 [Have POSIX function getpwnam_r])
506 AC_CACHE_CHECK([for nonposix getpwnam_r],
507 ac_cv_func_nonposix_getpwnam_r,
508 [AC_TRY_LINK([#include <pwd.h>],
511 getpwnam_r ("", &pwd, buffer,
513 [ac_cv_func_nonposix_getpwnam_r=yes],
514 [ac_cv_func_nonposix_getpwnam_r=no])])
515 if test "$ac_cv_func_nonposix_getpwnam_r" = yes; then
516 AC_DEFINE(HAVE_NONPOSIX_GETPWNAM_R,1,
517 [Have non-POSIX function getpwnam_r])
521 dnl check for socklen_t
522 AC_MSG_CHECKING(whether socklen_t is defined)
524 #include <sys/types.h>
525 #include <sys/socket.h>
530 ],dbus_have_socklen_t=yes,dbus_have_socklen_t=no)
531 AC_MSG_RESULT($dbus_have_socklen_t)
533 if test "x$dbus_have_socklen_t" = "xyes"; then
534 AC_DEFINE(HAVE_SOCKLEN_T,1,[Have socklen_t type])
537 dnl check for writev header and writev function so we're
538 dnl good to go if HAVE_WRITEV gets defined.
539 AC_CHECK_HEADERS(sys/uio.h, [AC_CHECK_FUNCS(writev)])
541 dnl check for flavours of varargs macros (test from GLib)
542 AC_MSG_CHECKING(for ISO C99 varargs macros in C)
544 int a(int p1, int p2, int p3);
545 #define call_a(...) a(1,__VA_ARGS__)
547 ],dbus_have_iso_c_varargs=yes,dbus_have_iso_c_varargs=no)
548 AC_MSG_RESULT($dbus_have_iso_c_varargs)
550 AC_MSG_CHECKING(for GNUC varargs macros)
552 int a(int p1, int p2, int p3);
553 #define call_a(params...) a(1,params)
555 ],dbus_have_gnuc_varargs=yes,dbus_have_gnuc_varargs=no)
556 AC_MSG_RESULT($dbus_have_gnuc_varargs)
558 dnl Output varargs tests
559 if test x$dbus_have_iso_c_varargs = xyes; then
560 AC_DEFINE(HAVE_ISO_VARARGS,1,[Have ISO C99 varargs macros])
562 if test x$dbus_have_gnuc_varargs = xyes; then
563 AC_DEFINE(HAVE_GNUC_VARARGS,1,[Have GNU-style varargs macros])
566 dnl Check for various credentials.
567 AC_MSG_CHECKING(for struct cmsgcred)
569 #include <sys/types.h>
570 #include <sys/socket.h>
572 struct cmsgcred cred;
575 ],dbus_have_struct_cmsgcred=yes,dbus_have_struct_cmsgcred=no)
576 AC_MSG_RESULT($dbus_have_struct_cmsgcred)
578 if test x$dbus_have_struct_cmsgcred = xyes; then
579 AC_DEFINE(HAVE_CMSGCRED,1,[Have cmsgcred structure])
583 #### Abstract sockets
585 AC_MSG_CHECKING(abstract socket namespace)
587 AC_RUN_IFELSE([AC_LANG_PROGRAM(
589 #include <sys/types.h>
593 #include <sys/socket.h>
599 struct sockaddr_un addr;
601 listen_fd = socket (PF_UNIX, SOCK_STREAM, 0);
605 fprintf (stderr, "socket() failed: %s\n", strerror (errno));
609 memset (&addr, '\0', sizeof (addr));
610 addr.sun_family = AF_UNIX;
611 strcpy (addr.sun_path, "X/tmp/dbus-fake-socket-path-used-in-configure-test");
612 addr.sun_path[0] = '\0'; /* this is what makes it abstract */
614 if (bind (listen_fd, (struct sockaddr*) &addr, SUN_LEN (&addr)) < 0)
616 fprintf (stderr, "Abstract socket namespace bind() failed: %s\n",
623 [have_abstract_sockets=yes],
624 [have_abstract_sockets=no])
626 AC_MSG_RESULT($have_abstract_sockets)
628 if test x$enable_abstract_sockets = xyes; then
629 if test x$have_abstract_sockets = xno; then
630 AC_MSG_ERROR([Abstract sockets explicitly required, and support not detected.])
634 if test x$enable_abstract_sockets = xno; then
635 have_abstract_sockets=no;
638 if test x$have_abstract_sockets = xyes ; then
639 DBUS_PATH_OR_ABSTRACT=abstract
640 AC_DEFINE(HAVE_ABSTRACT_SOCKETS,1,[Have abstract socket namespace])
642 DBUS_PATH_OR_ABSTRACT=path
645 # this is used in addresses to prefer abstract, e.g.
646 # unix:path=/foo or unix:abstract=/foo
647 AC_SUBST(DBUS_PATH_OR_ABSTRACT)
649 #### Sort out XML library
652 AC_CHECK_LIB(expat, XML_ParserCreate_MM,
653 [ AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false) ],
656 PKG_CHECK_MODULES(LIBXML, libxml-2.0, have_libxml=true, have_libxml=false)
658 # see what we want to use
659 dbus_use_libxml=false
661 if test x$with_xml = xexpat; then
663 if ! $have_expat ; then
664 AC_MSG_ERROR([Explicitly requested expat but expat not found])
666 elif test x$with_xml = xlibxml; then
668 if ! $have_libxml ; then
669 AC_MSG_ERROR([Explicitly requested libxml but libxml not found])
672 ### expat is the default because libxml can't currently survive
673 ### our brutal OOM-handling unit test setup.
674 ### http://bugzilla.gnome.org/show_bug.cgi?id=109368
675 if $have_expat ; then
678 elif $have_libxml ; then
682 AC_MSG_ERROR([No XML library found, check config.log for failed attempts])
686 AM_CONDITIONAL(DBUS_USE_EXPAT, $dbus_use_expat)
687 AM_CONDITIONAL(DBUS_USE_LIBXML, $dbus_use_libxml)
689 if $dbus_use_expat; then
693 if $dbus_use_libxml; then
694 XML_LIBS=$LIBXML_LIBS
695 XML_CFLAGS=$LIBXML_CFLAGS
699 if test x$enable_selinux = xno ; then
702 # See if we have SELinux library
703 AC_CHECK_LIB(selinux, is_selinux_enabled,
704 have_selinux=yes, have_selinux=no)
706 # see if we have the SELinux header with the new D-BUS stuff in it
707 if test x$have_selinux = xyes ; then
708 AC_MSG_CHECKING([for DBUS Flask permissions in selinux/av_permissions.h])
709 AC_TRY_COMPILE([#include <selinux/av_permissions.h>],
710 [#ifdef DBUS__ACQUIRE_SVC return 0;
712 #error DBUS__ACQUIRE_SVC not defined
714 have_selinux=yes, have_selinux=no)
715 AC_MSG_RESULT($have_selinux)
718 if test x$enable_selinux = xauto ; then
719 if test x$have_selinux = xno ; then
720 AC_MSG_WARN([Sufficiently new SELinux library not found])
723 if test x$have_selinux = xno ; then
724 AC_MSG_ERROR([SElinux explicitly required, and SELinux library not found])
729 AM_CONDITIONAL(HAVE_SELINUX, test x$have_selinux = xyes)
731 if test x$have_selinux = xyes ; then
732 SELINUX_LIBS="-lselinux -lpthread"
733 AC_DEFINE(HAVE_SELINUX,1,[SELinux support])
738 #### Set up final flags
741 AC_SUBST(DBUS_CLIENT_CFLAGS)
742 AC_SUBST(DBUS_CLIENT_LIBS)
744 DBUS_BUS_CFLAGS=$XML_CFLAGS
745 DBUS_BUS_LIBS="$XML_LIBS $SELINUX_LIBS"
746 AC_SUBST(DBUS_BUS_CFLAGS)
747 AC_SUBST(DBUS_BUS_LIBS)
751 AC_SUBST(DBUS_TEST_CFLAGS)
752 AC_SUBST(DBUS_TEST_LIBS)
755 PKG_CHECK_MODULES(DBUS_GLIB, gobject-2.0, have_glib=yes, have_glib=no)
756 PKG_CHECK_MODULES(DBUS_GLIB_THREADS, glib-2.0 gthread-2.0, have_glib_threads=yes, have_glib_threads=no)
758 if test x$have_glib = xno ; then
759 AC_MSG_WARN([GLib development libraries not found])
762 if test x$enable_glib = xyes; then
763 if test x$have_glib = xno; then
764 AC_MSG_ERROR([GLib explicitly required, and GLib development libraries not found])
768 if test x$enable_glib = xno; then
772 AM_CONDITIONAL(HAVE_GLIB, test x$have_glib = xyes)
773 AM_CONDITIONAL(HAVE_GLIB_THREADS, test x$have_glib_threads = xyes)
776 AC_SUBST(DBUS_GLIB_CFLAGS)
777 AC_SUBST(DBUS_GLIB_LIBS)
778 AC_SUBST(DBUS_GLIB_THREADS_LIBS)
780 DBUS_GLIB_TOOL_CFLAGS=$XML_CFLAGS
781 DBUS_GLIB_TOOL_LIBS=$XML_LIBS
782 AC_SUBST(DBUS_GLIB_TOOL_CFLAGS)
783 AC_SUBST(DBUS_GLIB_TOOL_LIBS)
786 if test x$have_glib = xno ; then
787 AC_MSG_WARN([Can't use GTK+ since GLib not enabled])
790 PKG_CHECK_MODULES(DBUS_GTK, gtk+-2.0, have_gtk=yes, have_gtk=no)
793 if test x$have_gtk = xno ; then
794 AC_MSG_WARN([GTK+ development libraries not found])
797 if test x$enable_gtk = xyes; then
798 if test x$have_gtk = xno; then
799 AC_MSG_ERROR([GTK+ explicitly required, and GTK+ development libraries not found])
803 if test x$enable_gtk = xno; then
807 AM_CONDITIONAL(HAVE_GTK, test x$have_gtk = xyes)
810 AC_SUBST(DBUS_GTK_CFLAGS)
811 AC_SUBST(DBUS_GTK_LIBS)
814 AC_PATH_PROG(QT_MOC, moc, no)
817 AC_MSG_CHECKING([for qglobal.h])
818 if test -n "$QTDIR" -a -f "$QTDIR/include/qglobal.h"; then
820 DBUS_QT_CXXFLAGS="-I$QTDIR/include"
822 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
823 if test -f "$dir/qglobal.h"; then
825 DBUS_QT_CXXFLAGS="-I$dir"
829 if test x"$have_qt" = x"yes"; then
830 AC_MSG_RESULT([found])
832 AC_MSG_RESULT([not found])
835 dnl linking to kdecore will give us a bit of help from libtool
836 if (! kde-config >& /dev/null); then
839 kdelibs=`kde-config --install lib --expandvars 2>/dev/null`
840 if test -z $kdelibs -o ! -f $kdelibs/libkdecore.la; then
843 DBUS_QT_LIBS="$kdelibs/libkdecore.la"
847 if test x$have_qt = xno ; then
848 AC_MSG_WARN([Qt development libraries not found])
851 if test x$enable_qt = xyes; then
852 if test x$have_qt = xno; then
853 AC_MSG_ERROR([Qt integration explicitly required, and Qt libraries not found])
857 if test x$enable_qt = xno; then
861 AM_CONDITIONAL(HAVE_QT, test x$have_qt = xyes)
864 AC_SUBST(DBUS_QT_CXXFLAGS)
865 AC_SUBST(DBUS_QT_LIBS)
870 ## for now enable_x11 just tracks have_x11,
871 ## there's no --enable-x11
872 if test x$no_x = xyes ; then
880 if test x$enable_x11 = xyes ; then
881 AC_DEFINE(DBUS_BUILD_X11,1,[Build X11-dependent code])
882 DBUS_X_LIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
883 DBUS_X_CFLAGS="$X_CFLAGS"
889 AC_SUBST(DBUS_X_CFLAGS)
890 AC_SUBST(DBUS_X_LIBS)
892 ### Doxygen Documentation
894 AC_PATH_PROG(DOXYGEN, doxygen, no)
896 AC_MSG_CHECKING([whether to build Doxygen documentation])
898 if test x$DOXYGEN = xno ; then
904 if test x$enable_doxygen_docs = xauto ; then
905 if test x$have_doxygen = xno ; then
906 enable_doxygen_docs=no
908 enable_doxygen_docs=yes
912 if test x$enable_doxygen_docs = xyes; then
913 if test x$have_doxygen = xno; then
914 AC_MSG_ERROR([Building Doxygen docs explicitly required, but Doxygen not found])
918 AM_CONDITIONAL(DBUS_DOXYGEN_DOCS_ENABLED, test x$enable_doxygen_docs = xyes)
921 ### XML Documentation
923 AC_PATH_PROG(XMLTO, xmlto, no)
925 AC_MSG_CHECKING([whether to build XML documentation])
927 if test x$XMLTO = xno ; then
933 if test x$enable_xml_docs = xauto ; then
934 if test x$have_xmlto = xno ; then
941 if test x$enable_xml_docs = xyes; then
942 if test x$have_xmlto = xno; then
943 AC_MSG_ERROR([Building XML docs explicitly required, but xmlto not found])
947 AM_CONDITIONAL(DBUS_XML_DOCS_ENABLED, test x$enable_xml_docs = xyes)
950 #### Have to go $localstatedir->$prefix/var->/usr/local/var
951 #### someone please fix this a better way...
953 #### find the actual value for $prefix that we'll end up with
954 ## (I know this is broken and should be done in the Makefile, but
955 ## that's a major pain and almost nobody actually seems to care)
957 if test "x$prefix" = "xNONE"; then
958 REAL_PREFIX=$ac_default_prefix
963 ## temporarily change prefix and exec_prefix
967 if test "x$exec_prefix" = xNONE ; then
968 REAL_EXEC_PREFIX=$REAL_PREFIX
970 REAL_EXEC_PREFIX=$exec_prefix
972 old_exec_prefix=$exec_prefix
973 exec_prefix=$REAL_EXEC_PREFIX
976 LOCALSTATEDIR_TMP="$localstatedir"
977 EXPANDED_LOCALSTATEDIR=`eval echo $LOCALSTATEDIR_TMP`
978 AC_SUBST(EXPANDED_LOCALSTATEDIR)
980 SYSCONFDIR_TMP="$sysconfdir"
981 EXPANDED_SYSCONFDIR=`eval echo $SYSCONFDIR_TMP`
982 AC_SUBST(EXPANDED_SYSCONFDIR)
985 EXPANDED_BINDIR=`eval echo $BINDIR_TMP`
986 AC_SUBST(EXPANDED_BINDIR)
989 EXPANDED_LIBDIR=`eval echo $LIBDIR_TMP`
990 AC_SUBST(EXPANDED_LIBDIR)
992 DATADIR_TMP="$datadir"
993 EXPANDED_DATADIR=`eval echo $DATADIR_TMP`
994 AC_SUBST(EXPANDED_DATADIR)
996 ## put prefix and exec_prefix back
998 exec_prefix=$old_exec_prefix
1000 #### Check our operating system
1001 operating_system=unknown
1002 if test -f /etc/redhat-release || test -f $EXPANDED_SYSCONFDIR/redhat-release ; then
1003 operating_system=redhat
1006 if test -f /etc/slackware-version || test -f $EXPANDED_SYSCONFDIR/slackware-version ; then
1007 operating_system=slackware
1010 #### Sort out init scripts
1012 if test x$with_init_scripts = x; then
1013 if test xredhat = x$operating_system ; then
1014 with_init_scripts=redhat
1016 if test xslackware = x$operating_system ; then
1017 with_init_scripts=slackware
1019 with_init_scripts=none
1024 AM_CONDITIONAL(DBUS_INIT_SCRIPTS_RED_HAT, test x$with_init_scripts = xredhat)
1026 AM_CONDITIONAL(DBUS_INIT_SCRIPTS_SLACKWARE, test x$with_init_scripts = xslackware)
1028 ##### Set up location for system bus socket
1029 if ! test -z "$with_system_socket"; then
1030 DBUS_SYSTEM_SOCKET=$with_system_socket
1032 DBUS_SYSTEM_SOCKET=${EXPANDED_LOCALSTATEDIR}/run/dbus/system_bus_socket
1035 AC_SUBST(DBUS_SYSTEM_SOCKET)
1036 AC_DEFINE_UNQUOTED(DBUS_SYSTEM_SOCKET,"$DBUS_SYSTEM_SOCKET",[The name of the socket the system bus listens on by default])
1038 ## system bus only listens on local domain sockets, and never
1039 ## on an abstract socket (so only root can create the socket)
1040 DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="unix:path=$DBUS_SYSTEM_SOCKET"
1041 AC_SUBST(DBUS_SYSTEM_BUS_DEFAULT_ADDRESS)
1042 AC_DEFINE_UNQUOTED(DBUS_SYSTEM_BUS_DEFAULT_ADDRESS, "$DBUS_SYSTEM_BUS_DEFAULT_ADDRESS",[The default D-BUS address of the system bus])
1044 #### Set up the pid file
1045 if ! test -z "$with_system_pid_file"; then
1046 DBUS_SYSTEM_PID_FILE=$with_system_pid_file
1047 elif test x$operating_system = xredhat ; then
1048 DBUS_SYSTEM_PID_FILE=${EXPANDED_LOCALSTATEDIR}/run/messagebus.pid
1050 DBUS_SYSTEM_PID_FILE=${EXPANDED_LOCALSTATEDIR}/run/dbus/pid
1053 AC_SUBST(DBUS_SYSTEM_PID_FILE)
1055 #### Tell tests where to find certain stuff in builddir
1056 ABSOLUTE_TOP_BUILDDIR=`cd ${ac_top_builddir}. && pwd`
1058 AC_DEFUN(TEST_PATH, [
1059 TEST_$1=${ABSOLUTE_TOP_BUILDDIR}/test/$2
1060 AC_DEFINE_UNQUOTED(TEST_$1, "$TEST_$1",
1061 [Full path to test file test/$2 in builddir])
1065 TEST_PATH(SERVICE_DIR, data/valid-service-files)
1066 TEST_PATH(SERVICE_BINARY, test-service)
1067 TEST_PATH(GLIB_SERVICE_BINARY, test-service-glib)
1068 TEST_PATH(EXIT_BINARY, test-exit)
1069 TEST_PATH(SEGFAULT_BINARY, test-segfault)
1070 TEST_PATH(SLEEP_FOREVER_BINARY, test-sleep-forever)
1071 AC_SUBST(ABSOLUTE_TOP_BUILDDIR)
1073 #### Find socket directories
1074 if ! test -z "$TMPDIR" ; then
1075 DEFAULT_SOCKET_DIR=$TMPDIR
1076 elif ! test -z "$TEMP" ; then
1077 DEFAULT_SOCKET_DIR=$TEMP
1078 elif ! test -z "$TMP" ; then
1079 DEFAULT_SOCKET_DIR=$TMP
1081 DEFAULT_SOCKET_DIR=/tmp
1084 if ! test -z "$with_test_socket_dir" ; then
1085 TEST_SOCKET_DIR="$with_test_socket_dir"
1087 TEST_SOCKET_DIR=$DEFAULT_SOCKET_DIR
1089 AC_SUBST(TEST_SOCKET_DIR)
1090 AC_DEFINE_UNQUOTED(DBUS_TEST_SOCKET_DIR, "$TEST_SOCKET_DIR", [Where to put test sockets])
1092 if ! test -z "$with_session_socket_dir" ; then
1093 DBUS_SESSION_SOCKET_DIR="$with_session_socket_dir"
1095 DBUS_SESSION_SOCKET_DIR=$DEFAULT_SOCKET_DIR
1097 AC_DEFINE_UNQUOTED(DBUS_SESSION_SOCKET_DIR, "$DBUS_SESSION_SOCKET_DIR", [Where per-session bus puts its sockets])
1098 AC_SUBST(DBUS_SESSION_SOCKET_DIR)
1100 # Detect if we can build Python bindings (need python, python headers, and pyrex)
1101 if test x$enable_python = xno; then
1104 AC_MSG_NOTICE([Checking to see if we can build Python bindings])
1108 if test -z "$PYTHON" ; then
1109 AC_MSG_WARN([Python not found])
1111 AC_CHECK_PROGS(PYREX, pyrexc)
1113 if test -z "$PYREX" ; then
1119 AM_CHECK_PYTHON_HEADERS(have_python_headers=yes,have_python_headers=no)
1121 if test x$have_pyrex = xyes -a x$have_python_headers = xyes ; then
1126 if test x$have_python = xno ; then
1127 if test x$enable_python = xyes ; then
1128 AC_MSG_ERROR([Building python explicitly requested, but can't build python bindings])
1130 AC_MSG_WARN([Couldn't find either Pyrex or the Python headers, not building Python bindings])
1135 AM_CONDITIONAL(HAVE_PYTHON, test x$have_python = xyes)
1139 dbus/dbus-arch-deps.h
1149 python/examples/Makefile
1153 gcj/org/freedesktop/Makefile
1154 gcj/org/freedesktop/dbus/Makefile
1156 mono/AssemblyInfo.cs
1157 mono/dbus-sharp.dll.config
1158 mono/example/Makefile
1168 test/data/valid-config-files/debug-allow-all.conf
1169 test/data/valid-config-files/debug-allow-all-sha1.conf
1170 test/data/valid-service-files/debug-echo.service
1171 test/data/valid-service-files/debug-segfault.service
1174 ### FIXME it's bizarre that have_qt and have_glib are used
1175 ### instead of enable_ - should fix things so that enable
1176 ### is always whether it's enabled, and have is always whether
1179 dnl ==========================================================================
1185 exec_prefix: ${exec_prefix}
1186 libdir: ${EXPANDED_LIBDIR}
1187 bindir: ${EXPANDED_BINDIR}
1188 sysconfdir: ${EXPANDED_SYSCONFDIR}
1189 localstatedir: ${EXPANDED_LOCALSTATEDIR}
1190 datadir: ${EXPANDED_DATADIR}
1191 source code location: ${srcdir}
1194 cppflags: ${CPPFLAGS}
1195 cxxflags: ${CXXFLAGS}
1196 64-bit int: ${DBUS_INT64_TYPE}
1200 if test x$enable_gcj = xyes ; then
1203 gcjflags: ${GCJFLAGS}"
1206 " gcj: (not enabled)"
1209 if test x$enable_mono = xyes ; then
1215 " csc: (not enabled)
1220 Maintainer mode: ${USE_MAINTAINER_MODE}
1221 gcc coverage profiling: ${enable_gcov}
1222 Building unit tests: ${enable_tests}
1223 Building verbose mode: ${enable_verbose_mode}
1224 Building assertions: ${enable_asserts}
1225 Building checks: ${enable_checks}
1226 Building Qt bindings: ${have_qt}
1227 Building GLib bindings: ${have_glib}
1228 Building Python bindings: ${have_python}
1229 Building SELinux support: ${have_selinux}
1230 Building Mono bindings: ${enable_mono}
1231 Building Mono docs: ${enable_mono_docs}
1232 Building GTK+ tools: ${have_gtk}
1233 Building X11 code: ${enable_x11}
1234 Building Doxygen docs: ${enable_doxygen_docs}
1235 Building XML docs: ${enable_xml_docs}
1236 Using XML parser: ${with_xml}
1237 Init scripts style: ${with_init_scripts}
1238 Abstract socket names: ${have_abstract_sockets}
1239 System bus socket: ${DBUS_SYSTEM_SOCKET}
1240 System bus address: ${DBUS_SYSTEM_BUS_DEFAULT_ADDRESS}
1241 System bus PID file: ${DBUS_SYSTEM_PID_FILE}
1242 Session bus socket dir: ${DBUS_SESSION_SOCKET_DIR}
1243 'make check' socket dir: ${TEST_SOCKET_DIR}
1246 if test x$enable_tests = xyes; then
1247 echo "NOTE: building with unit tests increases the size of the installed library and renders it insecure."
1249 if test x$enable_tests = xyes -a x$enable_asserts = xno; then
1250 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)"
1252 if test x$enable_gcov = xyes; then
1253 echo "NOTE: building with coverage profiling is definitely for developers only."
1255 if test x$enable_verbose_mode = xyes; then
1256 echo "NOTE: building with verbose mode increases library size, may slightly increase security risk, and decreases performance."
1258 if test x$enable_asserts = xyes; then
1259 echo "NOTE: building with assertions increases library size and decreases performance."
1261 if test x$enable_checks = xno; then
1262 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."