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