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