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