2005-01-28 Joe Shaw <joeshaw@novell.com>
[platform/upstream/dbus.git] / configure.in
1 dnl -*- mode: m4 -*-
2 AC_PREREQ(2.52)
3
4 AC_INIT(dbus/dbus.h)
5
6 AM_INIT_AUTOMAKE(dbus, 0.30)
7
8 AM_CONFIG_HEADER(config.h)
9
10 # Honor aclocal flags
11 ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
12
13 GETTEXT_PACKAGE=dbus-1
14 AC_SUBST(GETTEXT_PACKAGE)
15 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[The name of the gettext domain])
16
17  ## must come before we use the $USE_MAINTAINER_MODE variable later
18 AM_MAINTAINER_MODE
19
20 AC_PROG_CC
21 AC_PROG_CXX
22 AC_ISC_POSIX
23 AC_HEADER_STDC
24
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)
42
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])
49
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])
55 fi
56
57 if test x$enable_verbose_mode = xyes; then
58     AC_DEFINE(DBUS_ENABLE_VERBOSE_MODE,1,[Support a verbose mode])
59 fi
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])
63 fi
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])
67 fi
68
69 #### gcc warning flags
70
71 if test "x$GCC" = "xyes"; then
72   changequote(,)dnl
73   case " $CFLAGS " in
74   *[\ \ ]-Wall[\ \      ]*) ;;
75   *) CFLAGS="$CFLAGS -Wall" ;;
76   esac
77
78   case " $CFLAGS " in
79   *[\ \ ]-Wchar-subscripts[\ \  ]*) ;;
80   *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
81   esac
82
83   case " $CFLAGS " in
84   *[\ \ ]-Wmissing-declarations[\ \     ]*) ;;
85   *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
86   esac
87
88   case " $CFLAGS " in
89   *[\ \ ]-Wmissing-prototypes[\ \       ]*) ;;
90   *) CFLAGS="$CFLAGS -Wmissing-prototypes" ;;
91   esac
92
93   case " $CFLAGS " in
94   *[\ \ ]-Wnested-externs[\ \   ]*) ;;
95   *) CFLAGS="$CFLAGS -Wnested-externs" ;;
96   esac
97
98   case " $CFLAGS " in
99   *[\ \ ]-Wpointer-arith[\ \    ]*) ;;
100   *) CFLAGS="$CFLAGS -Wpointer-arith" ;;
101   esac
102
103   case " $CFLAGS " in
104   *[\ \ ]-Wcast-align[\ \       ]*) ;;
105   *) CFLAGS="$CFLAGS -Wcast-align" ;;
106   esac
107
108   case " $CFLAGS " in
109   *[\ \ ]-Wfloat-equal[\ \      ]*) ;;
110   *) CFLAGS="$CFLAGS -Wfloat-equal" ;;
111   esac
112
113   case " $CFLAGS " in
114   *[\ \ ]-Wsign-compare[\ \     ]*) ;;
115   *) CFLAGS="$CFLAGS -Wsign-compare" ;;
116   esac
117
118   if test "x$enable_ansi" = "xyes"; then
119     case " $CFLAGS " in
120     *[\ \       ]-ansi[\ \      ]*) ;;
121     *) CFLAGS="$CFLAGS -ansi" ;;
122     esac
123
124     case " $CFLAGS " in
125     *[\ \       ]-D_POSIX_C_SOURCE*) ;;
126     *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;;
127     esac
128
129     case " $CFLAGS " in
130     *[\ \       ]-D_BSD_SOURCE[\ \      ]*) ;;
131     *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;;
132     esac
133
134     case " $CFLAGS " in
135     *[\ \       ]-pedantic[\ \  ]*) ;;
136     *) CFLAGS="$CFLAGS -pedantic" ;;
137     esac
138   fi
139   if test x$enable_gcov = xyes; then
140     case " $CFLAGS " in
141     *[\ \       ]-fprofile-arcs[\ \     ]*) ;;
142     *) CFLAGS="$CFLAGS -fprofile-arcs" ;;
143     esac
144     case " $CFLAGS " in
145     *[\ \       ]-ftest-coverage[\ \    ]*) ;;
146     *) CFLAGS="$CFLAGS -ftest-coverage" ;;
147     esac
148
149     ## remove optimization
150     CFLAGS=`echo "$CFLAGS" | sed -e 's/-O[0-9]*//g'`
151   fi
152   changequote([,])dnl
153 else
154   if test x$enable_gcov = xyes; then
155     AC_MSG_ERROR([--enable-gcov can only be used with gcc])
156   fi
157 fi
158
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
162      have_gcj=no
163 else
164      # Needs to be here so libtool wont get confused
165      AM_PROG_GCJ
166
167      have_gcj=yes
168      if test "x${GCJFLAGS-unset}" = xunset; then
169         GCJFLAGS="-g -O2 -Wall"
170      fi
171      AC_SUBST(GCJFLAGS)
172 fi
173
174 if test x$enable_gcj = xauto ; then
175     if test x$have_gcj = xno ; then
176         enable_gcj=no
177     else
178         enable_gcj=yes
179     fi
180 fi
181
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])
185     fi
186 fi
187
188 AM_CONDITIONAL(DBUS_USE_GCJ, test x$enable_gcj = xyes)
189
190 AM_PROG_LIBTOOL
191
192 #### Look for mono
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)
196
197 if test "x$enable_mono" = "xyes"; then
198         if test "x$have_mono" = "xfalse"; then
199                 AC_MSG_ERROR([Mono was not found])
200         fi
201 fi
202
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)
207                 LIB_PREFIX=
208                 LIB_SUFFIX=.dylib
209         else
210                 AC_PATH_PROG(RUNTIME, mono, no)
211                 AC_PATH_PROG(CSC, mcs, no)
212                 LIB_PREFIX=.so
213                 LIB_SUFFIX=
214         fi
215 else
216         AC_PATH_PROG(CSC, csc.exe, no)
217         RUNTIME=
218         LIB_PREFIX=
219         LIB_SUFFIX=.dylib
220 fi
221
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])
225     fi
226
227     ### Test for GACUTIL
228     AC_PATH_PROG(GACUTIL, gacutil, no)
229     if test "x$GACUTIL" = "xno" ; then
230         AC_MSG_ERROR([No gacutil tool found])
231     fi
232
233     AC_SUBST(GACUTIL)
234 fi
235
236 if test x$enable_mono = xauto ; then
237     if test x$CSC = xno ; then
238         enable_mono=no
239     else
240         ### Test for GACUTIL
241         AC_PATH_PROG(GACUTIL, gacutil, no)
242         if test "x$GACUTIL" = "xno" ; then
243            enable_mono=no
244         else
245            enable_mono=yes
246         fi
247     fi
248 fi
249
250 AC_SUBST(RUNTIME)
251 AC_SUBST(CSC)
252 AC_SUBST(GACUTIL)
253 AC_SUBST(LIB_PREFIX)
254 AC_SUBST(LIB_SUFFIX)
255
256 AM_CONDITIONAL(DBUS_USE_CSC, test x$enable_mono = xyes)
257
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)
262
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])
266     else
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])        
270         fi
271     fi
272 fi
273
274 if test x$enable_mono_docs = xauto ; then
275     if test x$have_monodoc = xno ; then
276         enable_mono_docs=no
277         MONODOC=
278     else
279         AC_PATH_PROG(MONODOC, monodoc, no)
280         if test x$MONODOC = xno; then
281            enable_mono_docs=no
282            MONODOC=
283         else
284            enable_mono_docs=yes
285         fi
286     fi
287 fi
288
289 AC_SUBST(MONODOC)
290
291 AM_CONDITIONAL(ENABLE_MONODOC, test "x$enable_mono_docs" = "xyes")
292
293 changequote(,)dnl
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'`
300 changequote([,])dnl
301
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])
305
306      AC_MSG_CHECKING([for gcc 3.3 version of gcov file format])
307      have_gcc33_gcov=no
308      AC_RUN_IFELSE( [AC_LANG_PROGRAM( , [[ if (__GNUC__ >=3 && __GNUC_MINOR__ >= 3) exit (0); else exit (1); ]])],  
309                    have_gcc33_gcov=yes)
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])
312      fi
313      AC_MSG_RESULT($have_gcc33_gcov)
314 fi
315 AM_CONDITIONAL(DBUS_GCOV_ENABLED, test x$enable_gcov = xyes)
316
317 #### Integer sizes 
318
319 AC_CHECK_SIZEOF(char)
320 AC_CHECK_SIZEOF(short)
321 AC_CHECK_SIZEOF(long)
322 AC_CHECK_SIZEOF(int)
323 AC_CHECK_SIZEOF(void *)
324 AC_CHECK_SIZEOF(long long)
325 AC_CHECK_SIZEOF(__int64)
326
327 ### See what our 64 bit type is called
328 AC_MSG_CHECKING([64-bit integer type])
329
330 case 8 in
331 $ac_cv_sizeof_int)
332   dbusint64=int
333   dbusint64_constant='(val)'
334   dbusuint64_constant='(val)'
335   ;;
336 $ac_cv_sizeof_long)
337   dbusint64=long
338   dbusint64_constant='(val##L)'
339   dbusuint64_constant='(val##UL)'
340   ;;
341 $ac_cv_sizeof_long_long)
342   dbusint64='long long'
343   dbusint64_constant='(val##LL)'
344   dbusuint64_constant='(val##ULL)'
345   ;;
346 $ac_cv_sizeof___int64)
347   dbusint64=__int64
348   dbusint64_constant='(val##i64)'
349   dbusuint64_constant='(val##ui64)'
350   ;;
351 esac
352
353 if test -z "$dbusint64" ; then
354         DBUS_INT64_TYPE="no_int64_type_detected"
355         DBUS_HAVE_INT64=0
356         DBUS_INT64_CONSTANT=
357         DBUS_UINT64_CONSTANT=
358         AC_MSG_RESULT([none found])
359 else
360         DBUS_INT64_TYPE="$dbusint64"
361         DBUS_HAVE_INT64=1
362         DBUS_INT64_CONSTANT="$dbusint64_constant"
363         DBUS_UINT64_CONSTANT="$dbusuint64_constant"
364         AC_MSG_RESULT($DBUS_INT64_TYPE)
365 fi
366
367 AC_SUBST(DBUS_INT64_TYPE)
368 AC_SUBST(DBUS_INT64_CONSTANT)
369 AC_SUBST(DBUS_UINT64_CONSTANT)
370 AC_SUBST(DBUS_HAVE_INT64)
371
372 ### see what 32-bit int is called
373 AC_MSG_CHECKING([32-bit integer type])
374
375 case 4 in
376 $ac_cv_sizeof_short)
377   dbusint32=int
378   ;;
379 $ac_cv_sizeof_int)
380   dbusint32=int
381   ;;
382 $ac_cv_sizeof_long)
383   dbusint32=long
384   ;;
385 esac
386
387 if test -z "$dbusint32" ; then
388         DBUS_INT32_TYPE="no_int32_type_detected"
389         AC_MSG_ERROR([No 32-bit integer type found])
390 else
391         DBUS_INT32_TYPE="$dbusint32"
392         AC_MSG_RESULT($DBUS_INT32_TYPE)
393 fi
394
395 AC_SUBST(DBUS_INT32_TYPE)
396
397 ### see what 16-bit int is called
398 AC_MSG_CHECKING([16-bit integer type])
399
400 case 2 in
401 $ac_cv_sizeof_short)
402   dbusint16=short
403   ;;
404 $ac_cv_sizeof_int)
405   dbusint16=int
406   ;;
407 esac
408
409 if test -z "$dbusint16" ; then
410         DBUS_INT16_TYPE="no_int16_type_detected"
411         AC_MSG_ERROR([No 16-bit integer type found])
412 else
413         DBUS_INT16_TYPE="$dbusint16"
414         AC_MSG_RESULT($DBUS_INT16_TYPE)
415 fi
416
417 AC_SUBST(DBUS_INT16_TYPE)
418
419 ## byte order
420 AC_C_BIGENDIAN
421
422
423 dnl **********************************
424 dnl *** va_copy checks (from GLib) ***
425 dnl **********************************
426 dnl we currently check for all three va_copy possibilities, so we get
427 dnl all results in config.log for bug reports.
428 AC_CACHE_CHECK([for an implementation of va_copy()],dbus_cv_va_copy,[
429         AC_LINK_IFELSE([#include <stdarg.h>
430         void f (int i, ...) {
431         va_list args1, args2;
432         va_start (args1, i);
433         va_copy (args2, args1);
434         if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
435           exit (1);
436         va_end (args1); va_end (args2);
437         }
438         int main() {
439           f (0, 42);
440           return 0;
441         }],
442         [dbus_cv_va_copy=yes],
443         [dbus_cv_va_copy=no])
444 ])
445 AC_CACHE_CHECK([for an implementation of __va_copy()],dbus_cv___va_copy,[
446         AC_LINK_IFELSE([#include <stdarg.h>
447         void f (int i, ...) {
448         va_list args1, args2;
449         va_start (args1, i);
450         __va_copy (args2, args1);
451         if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
452           exit (1);
453         va_end (args1); va_end (args2);
454         }
455         int main() {
456           f (0, 42);
457           return 0;
458         }],
459         [dbus_cv___va_copy=yes],
460         [dbus_cv___va_copy=no])
461 ])
462
463 if test "x$dbus_cv_va_copy" = "xyes"; then
464   dbus_va_copy_func=va_copy
465 else if test "x$dbus_cv___va_copy" = "xyes"; then
466   dbus_va_copy_func=__va_copy
467 fi
468 fi
469
470 if test -n "$dbus_va_copy_func"; then
471   AC_DEFINE_UNQUOTED(DBUS_VA_COPY,$dbus_va_copy_func,[A 'va_copy' style function])
472 fi
473
474 AC_CACHE_CHECK([whether va_lists can be copied by value],dbus_cv_va_val_copy,[
475         AC_TRY_RUN([#include <stdarg.h>
476         void f (int i, ...) {
477         va_list args1, args2;
478         va_start (args1, i);
479         args2 = args1;
480         if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
481           exit (1);
482         va_end (args1); va_end (args2);
483         }
484         int main() {
485           f (0, 42);
486           return 0;
487         }],
488         [dbus_cv_va_val_copy=yes],
489         [dbus_cv_va_val_copy=no],
490         [dbus_cv_va_val_copy=yes])
491 ])
492
493 if test "x$dbus_cv_va_val_copy" = "xno"; then
494   AC_DEFINE(DBUS_VA_COPY_AS_ARRAY,1, ['va_lists' cannot be copies as values])
495 fi
496
497
498 #### Atomic integers (checks by Sebastian Wilhelmi for GLib)
499 AC_MSG_CHECKING([whether to use inline assembler routines for atomic integers])
500 have_atomic_inc=no
501 if test x"$GCC" = xyes; then
502   if test "x$enable_ansi" = "xyes"; then
503     AC_MSG_RESULT([no])
504   else
505     case $host_cpu in
506       i386)
507         AC_MSG_RESULT([no])
508         ;;
509       i?86)
510         AC_MSG_RESULT([i486])
511         AC_DEFINE_UNQUOTED(DBUS_USE_ATOMIC_INT_486, 1, [Use atomic integer implementation for 486])
512         have_atomic_inc=yes
513         ;;
514       *)
515         AC_MSG_RESULT([no])
516         ;;
517     esac
518   fi
519 fi
520 if test x$have_atomic_inc = xyes ; then
521   AC_DEFINE_UNQUOTED(DBUS_HAVE_ATOMIC_INT, 1, [Some atomic integer implementation present])
522 fi
523
524 #### Various functions
525 AC_CHECK_LIB(socket,socket)
526 AC_CHECK_LIB(nsl,gethostbyname)
527
528 AC_CHECK_FUNCS(vsnprintf vasprintf nanosleep usleep poll setenv unsetenv socketpair getgrouplist)
529
530 AC_CHECK_HEADERS(execinfo.h, [AC_CHECK_FUNCS(backtrace)])
531
532 AC_CACHE_CHECK([for posix getpwnam_r],
533                 ac_cv_func_posix_getpwnam_r,
534                 [AC_TRY_RUN([
535 #include <errno.h>
536 #include <pwd.h>
537 int main () { 
538     char buffer[10000];
539     struct passwd pwd, *pwptr = &pwd;
540     int error;
541     errno = 0;
542     error = getpwnam_r ("", &pwd, buffer, 
543                         sizeof (buffer), &pwptr);
544    return (error < 0 && errno == ENOSYS) 
545            || error == ENOSYS; 
546 }               ],
547         [ac_cv_func_posix_getpwnam_r=yes],
548         [ac_cv_func_posix_getpwnam_r=no])])
549 if test "$ac_cv_func_posix_getpwnam_r" = yes; then
550         AC_DEFINE(HAVE_POSIX_GETPWNAM_R,1,
551                 [Have POSIX function getpwnam_r])
552 else
553         AC_CACHE_CHECK([for nonposix getpwnam_r],
554                 ac_cv_func_nonposix_getpwnam_r,
555                 [AC_TRY_LINK([#include <pwd.h>],
556                         [char buffer[10000];
557                         struct passwd pwd;
558                         getpwnam_r ("", &pwd, buffer, 
559                                         sizeof (buffer));],
560                         [ac_cv_func_nonposix_getpwnam_r=yes],
561                         [ac_cv_func_nonposix_getpwnam_r=no])])
562                 if test "$ac_cv_func_nonposix_getpwnam_r" = yes; then
563                 AC_DEFINE(HAVE_NONPOSIX_GETPWNAM_R,1,
564                         [Have non-POSIX function getpwnam_r])
565         fi
566 fi
567
568 dnl check for socklen_t
569 AC_MSG_CHECKING(whether socklen_t is defined)
570 AC_TRY_COMPILE([
571 #include <sys/types.h>
572 #include <sys/socket.h>
573 #include <netdb.h>
574 ],[
575 socklen_t foo;
576 foo = 1;
577 ],dbus_have_socklen_t=yes,dbus_have_socklen_t=no)
578 AC_MSG_RESULT($dbus_have_socklen_t)
579
580 if test "x$dbus_have_socklen_t" = "xyes"; then
581     AC_DEFINE(HAVE_SOCKLEN_T,1,[Have socklen_t type])
582 fi
583
584 dnl check for writev header and writev function so we're 
585 dnl good to go if HAVE_WRITEV gets defined.
586 AC_CHECK_HEADERS(sys/uio.h, [AC_CHECK_FUNCS(writev)])
587
588 dnl check for flavours of varargs macros (test from GLib)
589 AC_MSG_CHECKING(for ISO C99 varargs macros in C)
590 AC_TRY_COMPILE([],[
591 int a(int p1, int p2, int p3);
592 #define call_a(...) a(1,__VA_ARGS__)
593 call_a(2,3);
594 ],dbus_have_iso_c_varargs=yes,dbus_have_iso_c_varargs=no)
595 AC_MSG_RESULT($dbus_have_iso_c_varargs)
596
597 AC_MSG_CHECKING(for GNUC varargs macros)
598 AC_TRY_COMPILE([],[
599 int a(int p1, int p2, int p3);
600 #define call_a(params...) a(1,params)
601 call_a(2,3);
602 ],dbus_have_gnuc_varargs=yes,dbus_have_gnuc_varargs=no)
603 AC_MSG_RESULT($dbus_have_gnuc_varargs)
604
605 dnl Output varargs tests
606 if test x$dbus_have_iso_c_varargs = xyes; then
607     AC_DEFINE(HAVE_ISO_VARARGS,1,[Have ISO C99 varargs macros])
608 fi
609 if test x$dbus_have_gnuc_varargs = xyes; then
610     AC_DEFINE(HAVE_GNUC_VARARGS,1,[Have GNU-style varargs macros])
611 fi
612
613 dnl Check for various credentials.
614 AC_MSG_CHECKING(for struct cmsgcred)
615 AC_TRY_COMPILE([
616 #include <sys/types.h>
617 #include <sys/socket.h>
618 ],[
619 struct cmsgcred cred;
620
621 cred.cmcred_pid = 0;
622 ],dbus_have_struct_cmsgcred=yes,dbus_have_struct_cmsgcred=no)
623 AC_MSG_RESULT($dbus_have_struct_cmsgcred)
624
625 if test x$dbus_have_struct_cmsgcred = xyes; then
626     AC_DEFINE(HAVE_CMSGCRED,1,[Have cmsgcred structure])
627 fi
628
629
630 #### Abstract sockets
631
632 AC_MSG_CHECKING(abstract socket namespace)
633 AC_LANG_PUSH(C)
634 AC_RUN_IFELSE([AC_LANG_PROGRAM(
635 [[
636 #include <sys/types.h>
637 #include <stdlib.h>
638 #include <string.h>
639 #include <stdio.h>
640 #include <sys/socket.h>
641 #include <sys/un.h>
642 #include <errno.h>
643 ]],
644 [[
645   int listen_fd;
646   struct sockaddr_un addr;
647   
648   listen_fd = socket (PF_UNIX, SOCK_STREAM, 0);
649   
650   if (listen_fd < 0)
651     {
652       fprintf (stderr, "socket() failed: %s\n", strerror (errno));
653       exit (1);
654     }
655
656   memset (&addr, '\0', sizeof (addr));
657   addr.sun_family = AF_UNIX;
658   strcpy (addr.sun_path, "X/tmp/dbus-fake-socket-path-used-in-configure-test");
659   addr.sun_path[0] = '\0'; /* this is what makes it abstract */
660   
661   if (bind (listen_fd, (struct sockaddr*) &addr, SUN_LEN (&addr)) < 0)
662     {
663        fprintf (stderr, "Abstract socket namespace bind() failed: %s\n", 
664                 strerror (errno));
665        exit (1);
666     }
667   else 
668     exit (0);
669 ]])],
670               [have_abstract_sockets=yes],
671               [have_abstract_sockets=no])
672 AC_LANG_POP(C)
673 AC_MSG_RESULT($have_abstract_sockets)
674
675 if test x$enable_abstract_sockets = xyes; then
676     if test x$have_abstract_sockets = xno; then
677         AC_MSG_ERROR([Abstract sockets explicitly required, and support not detected.])
678     fi
679 fi
680
681 if test x$enable_abstract_sockets = xno; then
682    have_abstract_sockets=no;
683 fi
684
685 if test x$have_abstract_sockets = xyes ; then
686    DBUS_PATH_OR_ABSTRACT=abstract
687    AC_DEFINE(HAVE_ABSTRACT_SOCKETS,1,[Have abstract socket namespace])
688 else
689    DBUS_PATH_OR_ABSTRACT=path
690 fi
691
692 # this is used in addresses to prefer abstract, e.g. 
693 # unix:path=/foo or unix:abstract=/foo 
694 AC_SUBST(DBUS_PATH_OR_ABSTRACT)
695
696 #### Sort out XML library
697
698 # see what we have
699 AC_CHECK_LIB(expat, XML_ParserCreate_MM, 
700              [ AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false) ],
701              have_expat=false)
702
703 PKG_CHECK_MODULES(LIBXML, libxml-2.0, have_libxml=true, have_libxml=false)
704
705 # see what we want to use
706 dbus_use_libxml=false
707 dbus_use_expat=false
708 if test x$with_xml = xexpat; then
709         dbus_use_expat=true
710         if ! $have_expat ; then
711            AC_MSG_ERROR([Explicitly requested expat but expat not found])
712         fi
713 elif test x$with_xml = xlibxml; then
714         dbus_use_libxml=true
715         if ! $have_libxml ; then
716            AC_MSG_ERROR([Explicitly requested libxml but libxml not found])
717         fi
718 else
719         ### expat is the default because libxml can't currently survive 
720         ### our brutal OOM-handling unit test setup.
721         ### http://bugzilla.gnome.org/show_bug.cgi?id=109368
722         if $have_expat ; then
723                 with_xml=expat
724                 dbus_use_expat=true
725         elif $have_libxml ; then
726                 with_xml=libxml
727                 dbus_use_libxml=true
728         else
729                 AC_MSG_ERROR([No XML library found, check config.log for failed attempts])
730         fi
731 fi
732
733 AM_CONDITIONAL(DBUS_USE_EXPAT, $dbus_use_expat)
734 AM_CONDITIONAL(DBUS_USE_LIBXML, $dbus_use_libxml)
735
736 if $dbus_use_expat; then
737    XML_LIBS=-lexpat
738    XML_CFLAGS=
739 fi
740 if $dbus_use_libxml; then
741    XML_LIBS=$LIBXML_LIBS
742    XML_CFLAGS=$LIBXML_CFLAGS
743 fi
744
745 # SELinux detection
746 if test x$enable_selinux = xno ; then
747     have_selinux=no;
748 else
749     # See if we have SELinux library
750     AC_CHECK_LIB(selinux, is_selinux_enabled, 
751                  have_selinux=yes, have_selinux=no)
752
753     # see if we have the SELinux header with the new D-BUS stuff in it
754     if test x$have_selinux = xyes ; then
755         AC_MSG_CHECKING([for DBUS Flask permissions in selinux/av_permissions.h])
756         AC_TRY_COMPILE([#include <selinux/av_permissions.h>],
757                         [#ifdef DBUS__ACQUIRE_SVC return 0;
758                          #else
759                          #error DBUS__ACQUIRE_SVC not defined
760                          #endif],
761                         have_selinux=yes, have_selinux=no)
762         AC_MSG_RESULT($have_selinux)
763     fi
764
765     if test x$enable_selinux = xauto ; then
766         if test x$have_selinux = xno ; then
767                 AC_MSG_WARN([Sufficiently new SELinux library not found])
768         fi
769     else 
770         if test x$have_selinux = xno ; then
771                 AC_MSG_ERROR([SElinux explicitly required, and SELinux library not found])
772         fi
773     fi
774 fi
775
776 AM_CONDITIONAL(HAVE_SELINUX, test x$have_selinux = xyes)
777
778 if test x$have_selinux = xyes ; then
779     SELINUX_LIBS="-lselinux -lpthread"
780     AC_DEFINE(HAVE_SELINUX,1,[SELinux support])
781 else
782     SELINUX_LIBS=
783 fi
784
785 #### Set up final flags
786 DBUS_CLIENT_CFLAGS=
787 DBUS_CLIENT_LIBS=
788 AC_SUBST(DBUS_CLIENT_CFLAGS)
789 AC_SUBST(DBUS_CLIENT_LIBS)
790
791 DBUS_BUS_CFLAGS=$XML_CFLAGS
792 DBUS_BUS_LIBS="$XML_LIBS $SELINUX_LIBS"
793 AC_SUBST(DBUS_BUS_CFLAGS)
794 AC_SUBST(DBUS_BUS_LIBS)
795
796 DBUS_TEST_CFLAGS=
797 DBUS_TEST_LIBS=
798 AC_SUBST(DBUS_TEST_CFLAGS)
799 AC_SUBST(DBUS_TEST_LIBS)
800
801 # Glib detection
802 PKG_CHECK_MODULES(DBUS_GLIB, gobject-2.0, have_glib=yes, have_glib=no)
803 PKG_CHECK_MODULES(DBUS_GLIB_THREADS, glib-2.0 gthread-2.0, have_glib_threads=yes, have_glib_threads=no)
804
805 if test x$have_glib = xno ; then
806     AC_MSG_WARN([GLib development libraries not found])
807 fi
808
809 if test x$enable_glib = xyes; then
810     if test x$have_glib = xno; then
811         AC_MSG_ERROR([GLib explicitly required, and GLib development libraries not found])
812     fi
813 fi
814
815 if test x$enable_glib = xno; then
816    have_glib=no;
817 fi
818
819 AM_CONDITIONAL(HAVE_GLIB, test x$have_glib = xyes)
820 AM_CONDITIONAL(HAVE_GLIB_THREADS, test x$have_glib_threads = xyes)
821
822 dnl GLib flags
823 AC_SUBST(DBUS_GLIB_CFLAGS)
824 AC_SUBST(DBUS_GLIB_LIBS)
825 AC_SUBST(DBUS_GLIB_THREADS_LIBS)
826
827 DBUS_GLIB_TOOL_CFLAGS=$XML_CFLAGS
828 DBUS_GLIB_TOOL_LIBS=$XML_LIBS
829 AC_SUBST(DBUS_GLIB_TOOL_CFLAGS)
830 AC_SUBST(DBUS_GLIB_TOOL_LIBS)
831
832 # GTK detection
833 if test x$have_glib = xno ; then
834     AC_MSG_WARN([Can't use GTK+ since GLib not enabled])
835     have_gtk=no
836 else
837     PKG_CHECK_MODULES(DBUS_GTK, gtk+-2.0, have_gtk=yes, have_gtk=no)
838 fi
839
840 if test x$have_gtk = xno ; then
841     AC_MSG_WARN([GTK+ development libraries not found])
842 fi
843
844 if test x$enable_gtk = xyes; then
845     if test x$have_gtk = xno; then
846         AC_MSG_ERROR([GTK+ explicitly required, and GTK+ development libraries not found])
847     fi
848 fi
849
850 if test x$enable_gtk = xno; then
851    have_gtk=no;
852 fi
853
854 AM_CONDITIONAL(HAVE_GTK, test x$have_gtk = xyes)
855
856 dnl Gtk flags
857 AC_SUBST(DBUS_GTK_CFLAGS)
858 AC_SUBST(DBUS_GTK_LIBS)
859
860 # Qt detection
861 AC_PATH_PROG(QT_MOC, moc, no)
862
863 have_qt=no
864 AC_MSG_CHECKING([for qglobal.h])
865 if test -n "$QTDIR" -a -f "$QTDIR/include/qglobal.h"; then
866     have_qt=yes
867     DBUS_QT_CXXFLAGS="-I$QTDIR/include"
868 else
869     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
870         if test -f "$dir/qglobal.h"; then
871             have_qt=yes
872             DBUS_QT_CXXFLAGS="-I$dir"
873        fi
874     done
875 fi
876 if test x"$have_qt" = x"yes"; then
877    AC_MSG_RESULT([found])
878 else
879    AC_MSG_RESULT([not found])
880 fi
881
882 dnl linking to kdecore will give us a bit of help from libtool
883 if (! kde-config >& /dev/null); then
884     have_qt=no
885 else
886     kdelibs=`kde-config --install lib --expandvars 2>/dev/null`
887     if test -z $kdelibs -o ! -f $kdelibs/libkdecore.la; then
888         have_qt=no
889     else
890         DBUS_QT_LIBS="$kdelibs/libkdecore.la"
891     fi
892 fi
893
894 if test x$have_qt = xno ; then
895     AC_MSG_WARN([Qt development libraries not found])
896 fi
897
898 if test x$enable_qt = xyes; then
899     if test x$have_qt = xno; then
900         AC_MSG_ERROR([Qt integration explicitly required, and Qt libraries not found])
901     fi
902 fi
903
904 if test x$enable_qt = xno; then
905    have_qt=no;
906 fi
907
908 AM_CONDITIONAL(HAVE_QT, test x$have_qt = xyes)
909
910 dnl Qt flags
911 AC_SUBST(DBUS_QT_CXXFLAGS)
912 AC_SUBST(DBUS_QT_LIBS)
913
914 ### X11 detection
915 AC_PATH_XTRA
916
917 ## for now enable_x11 just tracks have_x11, 
918 ## there's no --enable-x11
919 if test x$no_x = xyes ; then
920    have_x11=no
921    enable_x11=no
922 else
923    have_x11=yes
924    enable_x11=yes
925 fi
926
927 if test x$enable_x11 = xyes ; then
928    AC_DEFINE(DBUS_BUILD_X11,1,[Build X11-dependent code])
929    DBUS_X_LIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
930    DBUS_X_CFLAGS="$X_CFLAGS"
931 else
932    DBUS_X_LIBS=
933    DBUS_X_CFLAGS=
934 fi
935
936 AC_SUBST(DBUS_X_CFLAGS)
937 AC_SUBST(DBUS_X_LIBS)
938
939 ### Doxygen Documentation
940
941 AC_PATH_PROG(DOXYGEN, doxygen, no)
942
943 AC_MSG_CHECKING([whether to build Doxygen documentation])
944
945 if test x$DOXYGEN = xno ; then
946     have_doxygen=no
947 else
948     have_doxygen=yes
949 fi
950
951 if test x$enable_doxygen_docs = xauto ; then
952     if test x$have_doxygen = xno ; then
953         enable_doxygen_docs=no
954     else
955         enable_doxygen_docs=yes
956     fi
957 fi
958
959 if test x$enable_doxygen_docs = xyes; then
960     if test x$have_doxygen = xno; then
961         AC_MSG_ERROR([Building Doxygen docs explicitly required, but Doxygen not found])
962     fi
963 fi
964
965 AM_CONDITIONAL(DBUS_DOXYGEN_DOCS_ENABLED, test x$enable_doxygen_docs = xyes)
966 AC_MSG_RESULT(yes)
967
968 ### XML Documentation
969
970 AC_PATH_PROG(XMLTO, xmlto, no)
971
972 AC_MSG_CHECKING([whether to build XML documentation])
973
974 if test x$XMLTO = xno ; then
975     have_xmlto=no
976 else
977     have_xmlto=yes
978 fi
979
980 if test x$enable_xml_docs = xauto ; then
981     if test x$have_xmlto = xno ; then
982         enable_xml_docs=no
983     else
984         enable_xml_docs=yes
985     fi
986 fi
987
988 if test x$enable_xml_docs = xyes; then
989     if test x$have_xmlto = xno; then
990         AC_MSG_ERROR([Building XML docs explicitly required, but xmlto not found])
991     fi
992 fi
993
994 AM_CONDITIONAL(DBUS_XML_DOCS_ENABLED, test x$enable_xml_docs = xyes)
995 AC_MSG_RESULT(yes)
996
997 #### Have to go $localstatedir->$prefix/var->/usr/local/var   
998 #### someone please fix this a better way...
999
1000 #### find the actual value for $prefix that we'll end up with
1001 ##   (I know this is broken and should be done in the Makefile, but
1002 ##    that's a major pain and almost nobody actually seems to care)
1003 REAL_PREFIX=
1004 if test "x$prefix" = "xNONE"; then
1005   REAL_PREFIX=$ac_default_prefix
1006 else
1007   REAL_PREFIX=$prefix
1008 fi
1009
1010 ## temporarily change prefix and exec_prefix
1011 old_prefix=$prefix
1012 prefix=$REAL_PREFIX
1013
1014 if test "x$exec_prefix" = xNONE ; then
1015    REAL_EXEC_PREFIX=$REAL_PREFIX
1016 else
1017    REAL_EXEC_PREFIX=$exec_prefix
1018 fi
1019 old_exec_prefix=$exec_prefix
1020 exec_prefix=$REAL_EXEC_PREFIX
1021
1022 ## eval everything
1023 LOCALSTATEDIR_TMP="$localstatedir"
1024 EXPANDED_LOCALSTATEDIR=`eval echo $LOCALSTATEDIR_TMP`
1025 AC_SUBST(EXPANDED_LOCALSTATEDIR)
1026
1027 SYSCONFDIR_TMP="$sysconfdir"
1028 EXPANDED_SYSCONFDIR=`eval echo $SYSCONFDIR_TMP`
1029 AC_SUBST(EXPANDED_SYSCONFDIR)
1030
1031 BINDIR_TMP="$bindir"
1032 EXPANDED_BINDIR=`eval echo $BINDIR_TMP`
1033 AC_SUBST(EXPANDED_BINDIR)
1034
1035 LIBDIR_TMP="$libdir"
1036 EXPANDED_LIBDIR=`eval echo $LIBDIR_TMP`
1037 AC_SUBST(EXPANDED_LIBDIR)
1038
1039 DATADIR_TMP="$datadir"
1040 EXPANDED_DATADIR=`eval echo $DATADIR_TMP`
1041 AC_SUBST(EXPANDED_DATADIR)
1042
1043 ## put prefix and exec_prefix back
1044 prefix=$old_prefix
1045 exec_prefix=$old_exec_prefix
1046
1047 #### Check our operating system
1048 operating_system=unknown
1049 if test -f /etc/redhat-release || test -f $EXPANDED_SYSCONFDIR/redhat-release ; then
1050    operating_system=redhat
1051 fi
1052
1053 if test -f /etc/slackware-version || test -f $EXPANDED_SYSCONFDIR/slackware-version ; then
1054    operating_system=slackware
1055 fi
1056
1057 #### Sort out init scripts
1058
1059 if test x$with_init_scripts = x; then
1060     if test xredhat = x$operating_system ; then
1061         with_init_scripts=redhat
1062     else
1063         if test xslackware = x$operating_system ; then
1064                 with_init_scripts=slackware
1065             else
1066                 with_init_scripts=none
1067         fi
1068     fi
1069 fi
1070
1071 AM_CONDITIONAL(DBUS_INIT_SCRIPTS_RED_HAT, test x$with_init_scripts = xredhat)
1072
1073 AM_CONDITIONAL(DBUS_INIT_SCRIPTS_SLACKWARE, test x$with_init_scripts = xslackware)
1074
1075 ##### Set up location for system bus socket
1076 if ! test -z "$with_system_socket"; then
1077    DBUS_SYSTEM_SOCKET=$with_system_socket
1078 else
1079    DBUS_SYSTEM_SOCKET=${EXPANDED_LOCALSTATEDIR}/run/dbus/system_bus_socket
1080 fi
1081
1082 AC_SUBST(DBUS_SYSTEM_SOCKET)
1083 AC_DEFINE_UNQUOTED(DBUS_SYSTEM_SOCKET,"$DBUS_SYSTEM_SOCKET",[The name of the socket the system bus listens on by default])
1084
1085 ## system bus only listens on local domain sockets, and never 
1086 ## on an abstract socket (so only root can create the socket)
1087 DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="unix:path=$DBUS_SYSTEM_SOCKET"
1088 AC_SUBST(DBUS_SYSTEM_BUS_DEFAULT_ADDRESS)
1089 AC_DEFINE_UNQUOTED(DBUS_SYSTEM_BUS_DEFAULT_ADDRESS, "$DBUS_SYSTEM_BUS_DEFAULT_ADDRESS",[The default D-BUS address of the system bus])
1090
1091 #### Set up the pid file
1092 if ! test -z "$with_system_pid_file"; then
1093    DBUS_SYSTEM_PID_FILE=$with_system_pid_file
1094 elif test x$operating_system = xredhat ; then
1095    DBUS_SYSTEM_PID_FILE=${EXPANDED_LOCALSTATEDIR}/run/messagebus.pid
1096 else
1097    DBUS_SYSTEM_PID_FILE=${EXPANDED_LOCALSTATEDIR}/run/dbus/pid
1098 fi
1099
1100 AC_SUBST(DBUS_SYSTEM_PID_FILE)
1101
1102 #### Tell tests where to find certain stuff in builddir
1103 ABSOLUTE_TOP_BUILDDIR=`cd ${ac_top_builddir}. && pwd`
1104
1105 AC_DEFUN(TEST_PATH, [
1106 TEST_$1=${ABSOLUTE_TOP_BUILDDIR}/test/$2
1107 AC_DEFINE_UNQUOTED(TEST_$1, "$TEST_$1",
1108                    [Full path to test file test/$2 in builddir])
1109 AC_SUBST(TEST_$1)
1110 ])
1111
1112 TEST_PATH(SERVICE_DIR, data/valid-service-files)
1113 TEST_PATH(SERVICE_BINARY, test-service)
1114 TEST_PATH(GLIB_SERVICE_BINARY, test-service-glib)
1115 TEST_PATH(EXIT_BINARY, test-exit)
1116 TEST_PATH(SEGFAULT_BINARY, test-segfault)
1117 TEST_PATH(SLEEP_FOREVER_BINARY, test-sleep-forever)
1118 AC_SUBST(ABSOLUTE_TOP_BUILDDIR)
1119
1120 #### Find socket directories
1121 if ! test -z "$TMPDIR" ; then
1122    DEFAULT_SOCKET_DIR=$TMPDIR
1123 elif ! test -z "$TEMP" ; then
1124    DEFAULT_SOCKET_DIR=$TEMP
1125 elif ! test -z "$TMP" ; then
1126    DEFAULT_SOCKET_DIR=$TMP
1127 else
1128    DEFAULT_SOCKET_DIR=/tmp
1129 fi
1130
1131 if ! test -z "$with_test_socket_dir" ; then
1132    TEST_SOCKET_DIR="$with_test_socket_dir"
1133 else
1134    TEST_SOCKET_DIR=$DEFAULT_SOCKET_DIR
1135 fi
1136 AC_SUBST(TEST_SOCKET_DIR)
1137 AC_DEFINE_UNQUOTED(DBUS_TEST_SOCKET_DIR, "$TEST_SOCKET_DIR", [Where to put test sockets])
1138
1139 if ! test -z "$with_session_socket_dir" ; then
1140    DBUS_SESSION_SOCKET_DIR="$with_session_socket_dir"
1141 else
1142    DBUS_SESSION_SOCKET_DIR=$DEFAULT_SOCKET_DIR
1143 fi
1144 AC_DEFINE_UNQUOTED(DBUS_SESSION_SOCKET_DIR, "$DBUS_SESSION_SOCKET_DIR", [Where per-session bus puts its sockets])
1145 AC_SUBST(DBUS_SESSION_SOCKET_DIR)
1146
1147 # Detect if we can build Python bindings (need python, python headers, and pyrex)
1148 if test x$enable_python = xno; then
1149     have_python=no
1150 else
1151     AC_MSG_NOTICE([Checking to see if we can build Python bindings])
1152     have_python=no
1153     AM_PATH_PYTHON(2.2)
1154
1155     if test -z "$PYTHON" ; then
1156         AC_MSG_WARN([Python not found])
1157     else
1158         AC_CHECK_PROGS(PYREX, pyrexc)
1159
1160         if test -z "$PYREX" ; then
1161             have_pyrex=no
1162         else
1163             have_pyrex=yes
1164         fi
1165
1166         AM_CHECK_PYTHON_HEADERS(have_python_headers=yes,have_python_headers=no)
1167
1168         if test x$have_pyrex = xyes -a x$have_python_headers = xyes ; then
1169             have_python=yes
1170         fi
1171     fi
1172
1173     if test x$have_python = xno ; then
1174         if test x$enable_python = xyes ; then
1175             AC_MSG_ERROR([Building python explicitly requested, but can't build python bindings])
1176         else
1177             AC_MSG_WARN([Couldn't find either Pyrex or the Python headers, not building Python bindings])
1178         fi
1179     fi               
1180 fi
1181
1182 AM_CONDITIONAL(HAVE_PYTHON, test x$have_python = xyes)
1183
1184 AC_OUTPUT([
1185 Doxyfile
1186 dbus/dbus-arch-deps.h
1187 bus/system.conf
1188 bus/session.conf
1189 bus/messagebus
1190 bus/rc.messagebus
1191 bus/dbus-daemon.1
1192 Makefile
1193 dbus/Makefile
1194 glib/Makefile
1195 python/Makefile
1196 python/examples/Makefile
1197 qt/Makefile
1198 gcj/Makefile
1199 gcj/org/Makefile
1200 gcj/org/freedesktop/Makefile
1201 gcj/org/freedesktop/dbus/Makefile
1202 mono/Makefile
1203 mono/AssemblyInfo.cs
1204 mono/dbus-sharp.dll.config
1205 mono/example/Makefile
1206 mono/doc/Makefile
1207 bus/Makefile
1208 tools/Makefile
1209 test/Makefile
1210 test/glib/Makefile
1211 doc/Makefile
1212 dbus-1.pc
1213 dbus-glib-1.pc
1214 dbus-sharp.pc
1215 test/data/valid-config-files/debug-allow-all.conf
1216 test/data/valid-config-files/debug-allow-all-sha1.conf
1217 test/data/valid-service-files/debug-echo.service
1218 test/data/valid-service-files/debug-segfault.service
1219 ])
1220
1221 ### FIXME it's bizarre that have_qt and have_glib are used
1222 ### instead of enable_ - should fix things so that enable 
1223 ### is always whether it's enabled, and have is always whether 
1224 ### it was found.
1225
1226 dnl ==========================================================================
1227 echo "
1228                     D-BUS $VERSION
1229                   ==============
1230
1231         prefix:                   ${prefix}
1232         exec_prefix:              ${exec_prefix}
1233         libdir:                   ${EXPANDED_LIBDIR}
1234         bindir:                   ${EXPANDED_BINDIR}
1235         sysconfdir:               ${EXPANDED_SYSCONFDIR}
1236         localstatedir:            ${EXPANDED_LOCALSTATEDIR}
1237         datadir:              ${EXPANDED_DATADIR}
1238         source code location:     ${srcdir}
1239         compiler:                 ${CC}
1240         cflags:                   ${CFLAGS}
1241         cppflags:                 ${CPPFLAGS}
1242         cxxflags:                 ${CXXFLAGS}
1243         64-bit int:               ${DBUS_INT64_TYPE}
1244         32-bit int:               ${DBUS_INT32_TYPE}
1245         16-bit int:               ${DBUS_INT16_TYPE}
1246         Doxygen:                  ${DOXYGEN}
1247         xmlto:                    ${XMLTO}"
1248
1249 if test x$enable_gcj = xyes ; then
1250 echo \
1251 "        gcj:                     ${GCJ}
1252         gcjflags:                 ${GCJFLAGS}"
1253 else
1254 echo \
1255 "        gcj:                      (not enabled)"
1256 fi
1257
1258 if test x$enable_mono = xyes ; then
1259 echo \
1260 "        csc:                     ${CSC}
1261 "
1262 else
1263 echo \
1264 "        csc:                      (not enabled)
1265 "
1266 fi
1267
1268 echo "
1269         Maintainer mode:          ${USE_MAINTAINER_MODE}
1270         gcc coverage profiling:   ${enable_gcov}
1271         Building unit tests:      ${enable_tests}
1272         Building verbose mode:    ${enable_verbose_mode}
1273         Building assertions:      ${enable_asserts}
1274         Building checks:          ${enable_checks}
1275         Building Qt bindings:     ${have_qt}
1276         Building GLib bindings:   ${have_glib}
1277         Building Python bindings: ${have_python}
1278         Building SELinux support: ${have_selinux}
1279         Building Mono bindings:   ${enable_mono}
1280         Building Mono docs:       ${enable_mono_docs}
1281         Building GTK+ tools:      ${have_gtk}
1282         Building X11 code:        ${enable_x11}
1283         Building Doxygen docs:    ${enable_doxygen_docs}
1284         Building XML docs:        ${enable_xml_docs}
1285         Using XML parser:         ${with_xml}
1286         Init scripts style:       ${with_init_scripts}
1287         Abstract socket names:    ${have_abstract_sockets}
1288         System bus socket:        ${DBUS_SYSTEM_SOCKET}
1289         System bus address:       ${DBUS_SYSTEM_BUS_DEFAULT_ADDRESS}
1290         System bus PID file:      ${DBUS_SYSTEM_PID_FILE}
1291         Session bus socket dir:   ${DBUS_SESSION_SOCKET_DIR}
1292         'make check' socket dir:  ${TEST_SOCKET_DIR}
1293 "
1294
1295 if test x$enable_tests = xyes; then
1296         echo "NOTE: building with unit tests increases the size of the installed library and renders it insecure."
1297 fi
1298 if test x$enable_tests = xyes -a x$enable_asserts = xno; then
1299         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)"
1300 fi
1301 if test x$enable_gcov = xyes; then
1302         echo "NOTE: building with coverage profiling is definitely for developers only."
1303 fi
1304 if test x$enable_verbose_mode = xyes; then
1305         echo "NOTE: building with verbose mode increases library size, may slightly increase security risk, and decreases performance."
1306 fi
1307 if test x$enable_asserts = xyes; then
1308         echo "NOTE: building with assertions increases library size and decreases performance."
1309 fi
1310 if test x$enable_checks = xno; then
1311         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."
1312 fi