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