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