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