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