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