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