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