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