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