bring Qt3 library back. Some apps that are not in the KDE trunk are using it.
[platform/upstream/dbus.git] / configure.in
1 dnl -*- mode: m4 -*-
2 AC_PREREQ(2.52)
3
4 AC_INIT(dbus/dbus.h)
5
6 AM_INIT_AUTOMAKE(dbus, 0.51)
7
8 AM_CONFIG_HEADER(config.h)
9
10 AC_CANONICAL_TARGET
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=1
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=0
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(qt,               [  --enable-qt           enable Qt-friendly client library],enable_qt=$enableval,enable_qt=auto)
50 AC_ARG_ENABLE(qt3,              [  --enable-qt3          enable Qt3-friendly client library],enable_qt3=$enableval,enable_qt3=auto)
51 AC_ARG_ENABLE(glib,             [  --enable-glib         enable GLib-friendly client library],enable_glib=$enableval,enable_glib=auto)
52 AC_ARG_ENABLE(gtk,              [  --enable-gtk          enable GTK-requiring executables],enable_gtk=$enableval,enable_gtk=auto)
53 AC_ARG_ENABLE(tests,            [  --enable-tests        enable unit test code],enable_tests=$enableval,enable_tests=$USE_MAINTAINER_MODE)
54 AC_ARG_ENABLE(ansi,             [  --enable-ansi         enable -ansi -pedantic gcc flags],enable_ansi=$enableval,enable_ansi=no)
55 AC_ARG_ENABLE(verbose-mode,     [  --enable-verbose-mode support verbose debug mode],enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
56 AC_ARG_ENABLE(asserts,          [  --enable-asserts      include assertion checks],enable_asserts=$enableval,enable_asserts=$USE_MAINTAINER_MODE)
57 AC_ARG_ENABLE(checks,           [  --enable-checks       include sanity checks on public API],enable_checks=$enableval,enable_checks=yes)
58 AC_ARG_ENABLE(xml-docs,         [  --enable-xml-docs     build XML documentation (requires xmlto)],enable_xml_docs=$enableval,enable_xml_docs=auto)
59 AC_ARG_ENABLE(doxygen-docs,     [  --enable-doxygen-docs     build DOXYGEN documentation (requires Doxygen)],enable_doxygen_docs=$enableval,enable_doxygen_docs=auto)
60 AC_ARG_ENABLE(gcov,             [  --enable-gcov         compile with coverage profiling instrumentation (gcc only)],enable_gcov=$enableval,enable_gcov=no)
61 AC_ARG_ENABLE(abstract-sockets, [  --enable-abstract-sockets  use abstract socket namespace (linux only)],enable_abstract_sockets=$enableval,enable_abstract_sockets=auto)
62 AC_ARG_ENABLE(gcj,              [  --enable-gcj          build gcj bindings],enable_gcj=$enableval,enable_gcj=no)
63 AC_ARG_ENABLE(mono,             [  --enable-mono         build mono bindings],enable_mono=$enableval,enable_mono=auto)
64 AC_ARG_ENABLE(mono_docs,        [  --enable-mono-docs    build mono docs],enable_mono_docs=$enableval,enable_mono_docs=auto)
65 AC_ARG_ENABLE(python,           [  --enable-python       build python bindings],enable_python=$enableval,enable_python=auto)
66 AC_ARG_ENABLE(selinux,          [  --enable-selinux      build with SELinux support],enable_selinux=$enableval,enable_selinux=auto)
67
68 AC_ARG_WITH(xml,                [  --with-xml=[libxml/expat]           XML library to use])
69 AC_ARG_WITH(init-scripts,       [  --with-init-scripts=[redhat]        Style of init scripts to install])
70 AC_ARG_WITH(session-socket-dir, [  --with-session-socket-dir=[dirname] Where to put sockets for the per-login-session message bus])
71 AC_ARG_WITH(test-socket-dir,    [  --with-test-socket-dir=[dirname]    Where to put sockets for make check])
72 AC_ARG_WITH(system-pid-file,    [  --with-system-pid-file=[pidfile]    PID file for systemwide daemon])
73 AC_ARG_WITH(system-socket,      [  --with-system-socket=[filename]     UNIX domain socket for systemwide daemon])
74 AC_ARG_WITH(console-auth-dir,   [  --with-console-auth-dir=[dirname]   directory to check for console ownerhip])
75 AC_ARG_WITH(dbus_user,          [  --with-dbus-user=<user>  User for running the DBUS daemon (messagebus)])
76
77 dnl DBUS_BUILD_TESTS controls unit tests built in to .c files 
78 dnl and also some stuff in the test/ subdir
79 AM_CONDITIONAL(DBUS_BUILD_TESTS, test x$enable_tests = xyes)
80 if test x$enable_tests = xyes; then
81     AC_DEFINE(DBUS_BUILD_TESTS,1,[Build test code])
82 fi
83
84 if test x$enable_verbose_mode = xyes; then
85     AC_DEFINE(DBUS_ENABLE_VERBOSE_MODE,1,[Support a verbose mode])
86 fi
87 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 fi
91 if test x$enable_checks = xno; then
92     AC_DEFINE(DBUS_DISABLE_CHECKS,1,[Disable public API sanity checking])
93     AC_DEFINE(G_DISABLE_CHECKS,1,[Disable GLib public API sanity checking])
94 fi
95
96 #### gcc warning flags
97
98 if test "x$GCC" = "xyes"; then
99   changequote(,)dnl
100   case " $CFLAGS " in
101   *[\ \ ]-Wall[\ \      ]*) ;;
102   *) CFLAGS="$CFLAGS -Wall" ;;
103   esac
104
105   case " $CFLAGS " in
106   *[\ \ ]-Wchar-subscripts[\ \  ]*) ;;
107   *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
108   esac
109
110   case " $CFLAGS " in
111   *[\ \ ]-Wmissing-declarations[\ \     ]*) ;;
112   *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
113   esac
114
115   case " $CFLAGS " in
116   *[\ \ ]-Wmissing-prototypes[\ \       ]*) ;;
117   *) CFLAGS="$CFLAGS -Wmissing-prototypes" ;;
118   esac
119
120   case " $CFLAGS " in
121   *[\ \ ]-Wnested-externs[\ \   ]*) ;;
122   *) CFLAGS="$CFLAGS -Wnested-externs" ;;
123   esac
124
125   case " $CFLAGS " in
126   *[\ \ ]-Wpointer-arith[\ \    ]*) ;;
127   *) CFLAGS="$CFLAGS -Wpointer-arith" ;;
128   esac
129
130   case " $CFLAGS " in
131   *[\ \ ]-Wcast-align[\ \       ]*) ;;
132   *) CFLAGS="$CFLAGS -Wcast-align" ;;
133   esac
134
135   case " $CFLAGS " in
136   *[\ \ ]-Wfloat-equal[\ \      ]*) ;;
137   *) CFLAGS="$CFLAGS -Wfloat-equal" ;;
138   esac
139
140   case " $CFLAGS " in
141   *[\ \ ]-Wsign-compare[\ \     ]*) ;;
142   *) CFLAGS="$CFLAGS -Wsign-compare" ;;
143   esac
144
145   if test "x$enable_ansi" = "xyes"; then
146     case " $CFLAGS " in
147     *[\ \       ]-ansi[\ \      ]*) ;;
148     *) CFLAGS="$CFLAGS -ansi" ;;
149     esac
150
151     case " $CFLAGS " in
152     *[\ \       ]-D_POSIX_C_SOURCE*) ;;
153     *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;;
154     esac
155
156     case " $CFLAGS " in
157     *[\ \       ]-D_BSD_SOURCE[\ \      ]*) ;;
158     *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;;
159     esac
160
161     case " $CFLAGS " in
162     *[\ \       ]-pedantic[\ \  ]*) ;;
163     *) CFLAGS="$CFLAGS -pedantic" ;;
164     esac
165   fi
166   if test x$enable_gcov = xyes; then
167     case " $CFLAGS " in
168     *[\ \       ]-fprofile-arcs[\ \     ]*) ;;
169     *) CFLAGS="$CFLAGS -fprofile-arcs" ;;
170     esac
171     case " $CFLAGS " in
172     *[\ \       ]-ftest-coverage[\ \    ]*) ;;
173     *) CFLAGS="$CFLAGS -ftest-coverage" ;;
174     esac
175
176     ## remove optimization
177     CFLAGS=`echo "$CFLAGS" | sed -e 's/-O[0-9]*//g'`
178   fi
179   changequote([,])dnl
180 else
181   if test x$enable_gcov = xyes; then
182     AC_MSG_ERROR([--enable-gcov can only be used with gcc])
183   fi
184 fi
185
186 #### can't use AM_PROG_GCJ since it fails fatally if no gcj found
187 AC_CHECK_PROGS(GCJ, gcj, gcj)
188 if test -z "$GCJ" ; then
189      have_gcj=no
190 else
191      # Needs to be here so libtool wont get confused
192      AM_PROG_GCJ
193
194      have_gcj=yes
195      if test "x${GCJFLAGS-unset}" = xunset; then
196         GCJFLAGS="-g -O2 -Wall"
197      fi
198      AC_SUBST(GCJFLAGS)
199 fi
200
201 if test x$enable_gcj = xauto ; then
202     if test x$have_gcj = xno ; then
203         enable_gcj=no
204     else
205         enable_gcj=yes
206     fi
207 fi
208
209 if test x$enable_gcj = xyes; then
210     if test x$have_gcj = xno ; then
211         AC_MSG_ERROR([Building gcj explicitly required, but gcj not found])
212     fi
213 fi
214
215 AM_CONDITIONAL(DBUS_USE_GCJ, test x$enable_gcj = xyes)
216
217 AM_PROG_LIBTOOL
218
219 #### Look for mono
220 MONO_REQUIRED_VERSION=0.95
221 AC_SUBST(MONO_REQUIRED_VERSION)
222 PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, have_mono=true, have_mono=false)
223
224 if test "x$enable_mono" = "xyes"; then
225         if test "x$have_mono" = "xfalse"; then
226                 AC_MSG_ERROR([Mono was not found])
227         fi
228 fi
229
230 if test "x$have_mono" = "xtrue"; then
231         if test `uname -s` = "Darwin"; then
232                 AC_PATH_PROG(RUNTIME, mint, no)
233                 AC_PATH_PROG(CSC, mcs, no)
234                 LIB_PREFIX=
235                 LIB_SUFFIX=.dylib
236         else
237                 AC_PATH_PROG(RUNTIME, mono, no)
238                 AC_PATH_PROG(CSC, mcs, no)
239                 LIB_PREFIX=.so
240                 LIB_SUFFIX=
241         fi
242 else
243         AC_PATH_PROG(CSC, csc.exe, no)
244         RUNTIME=
245         LIB_PREFIX=
246         LIB_SUFFIX=.dylib
247 fi
248
249 if test x$enable_mono = xyes; then
250     if test x$have_mcs = xno ; then
251         AC_MSG_ERROR([Building Mono bindings explicitly required, but mcs compiler not found])
252     fi
253
254     ### Test for GACUTIL
255     AC_PATH_PROG(GACUTIL, gacutil, no)
256     if test "x$GACUTIL" = "xno" ; then
257         AC_MSG_ERROR([No gacutil tool found])
258     fi
259
260     AC_SUBST(GACUTIL)
261 fi
262
263 if test x$enable_mono = xauto ; then
264     if test x$CSC = xno ; then
265         enable_mono=no
266     else
267         ### Test for GACUTIL
268         AC_PATH_PROG(GACUTIL, gacutil, no)
269         if test "x$GACUTIL" = "xno" ; then
270            enable_mono=no
271         else
272            enable_mono=yes
273         fi
274     fi
275 fi
276
277 AC_SUBST(RUNTIME)
278 AC_SUBST(CSC)
279 AC_SUBST(GACUTIL)
280 AC_SUBST(LIB_PREFIX)
281 AC_SUBST(LIB_SUFFIX)
282
283 AM_CONDITIONAL(DBUS_USE_CSC, test x$enable_mono = xyes)
284
285 #### Look for monodoc
286 MONODOC_REQUIRED_VERSION=0.16
287 AC_SUBST(MONODOC_REQUIRED_VERSION)
288 PKG_CHECK_MODULES(MONODOC_DEPENDENCY, monodoc >= $MONODOC_REQUIRED_VERSION, have_monodoc=yes, have_monodoc=no)
289
290 if test x$enable_mono_docs = xyes; then
291     if test x$have_monodoc = xno ; then
292         AC_MSG_ERROR([Building Mono docs explicitly required, but monodoc not found])
293     else
294         AC_PATH_PROG(MONODOC, monodoc, no)
295         if test x$MONODOC = xno; then
296            AC_MSG_ERROR([Building Mono docs explicitly required, but monodoc not found])        
297         fi
298     fi
299 fi
300
301 if test x$enable_mono_docs = xauto ; then
302     if test x$have_monodoc = xno ; then
303         enable_mono_docs=no
304         MONODOC=
305     else
306         AC_PATH_PROG(MONODOC, monodoc, no)
307         if test x$MONODOC = xno; then
308            enable_mono_docs=no
309            MONODOC=
310         else
311            enable_mono_docs=yes
312         fi
313     fi
314 fi
315
316 AC_SUBST(MONODOC)
317
318 AM_CONDITIONAL(ENABLE_MONODOC, test "x$enable_mono_docs" = "xyes")
319
320 changequote(,)dnl
321 # let ourselves use our own unstable API
322 CPPFLAGS="-DDBUS_API_SUBJECT_TO_CHANGE=1 $CPPFLAGS"
323 # compress spaces in flags
324 CFLAGS=`echo "$CFLAGS" | sed -e 's/ +/ /g'`
325 CXXFLAGS=`echo "$CXXFLAGS" | sed -e 's/ +/ /g'`
326 CPPFLAGS=`echo "$CPPFLAGS" | sed -e 's/ +/ /g'`
327 changequote([,])dnl
328
329 if test x$enable_gcov = xyes; then
330      ## so that config.h changes when you toggle gcov support
331      AC_DEFINE_UNQUOTED(DBUS_GCOV_ENABLED, 1, [Defined if gcov is enabled to force a rebuild due to config.h changing])
332
333      AC_MSG_CHECKING([for gcc 3.3 version of gcov file format])
334      have_gcc33_gcov=no
335      AC_RUN_IFELSE( [AC_LANG_PROGRAM( , [[ if (__GNUC__ >=3 && __GNUC_MINOR__ >= 3) exit (0); else exit (1); ]])],  
336                    have_gcc33_gcov=yes)
337      if test x$have_gcc33_gcov = xyes ; then
338          AC_DEFINE_UNQUOTED(DBUS_HAVE_GCC33_GCOV, 1, [Defined if we have gcc 3.3 and thus the new gcov format])
339      fi
340      AC_MSG_RESULT($have_gcc33_gcov)
341 fi
342 AM_CONDITIONAL(DBUS_GCOV_ENABLED, test x$enable_gcov = xyes)
343
344 #### Integer sizes 
345
346 AC_CHECK_SIZEOF(char)
347 AC_CHECK_SIZEOF(short)
348 AC_CHECK_SIZEOF(long)
349 AC_CHECK_SIZEOF(int)
350 AC_CHECK_SIZEOF(void *)
351 AC_CHECK_SIZEOF(long long)
352 AC_CHECK_SIZEOF(__int64)
353
354 ### See what our 64 bit type is called
355 AC_MSG_CHECKING([64-bit integer type])
356
357 case 8 in
358 $ac_cv_sizeof_int)
359   dbusint64=int
360   dbusint64_constant='(val)'
361   dbusuint64_constant='(val)'
362   ;;
363 $ac_cv_sizeof_long)
364   dbusint64=long
365   dbusint64_constant='(val##L)'
366   dbusuint64_constant='(val##UL)'
367   ;;
368 $ac_cv_sizeof_long_long)
369   dbusint64='long long'
370   dbusint64_constant='(val##LL)'
371   dbusuint64_constant='(val##ULL)'
372   ;;
373 $ac_cv_sizeof___int64)
374   dbusint64=__int64
375   dbusint64_constant='(val##i64)'
376   dbusuint64_constant='(val##ui64)'
377   ;;
378 esac
379
380 if test -z "$dbusint64" ; then
381         DBUS_INT64_TYPE="no_int64_type_detected"
382         DBUS_HAVE_INT64=0
383         DBUS_INT64_CONSTANT=
384         DBUS_UINT64_CONSTANT=
385         AC_MSG_RESULT([none found])
386 else
387         DBUS_INT64_TYPE="$dbusint64"
388         DBUS_HAVE_INT64=1
389         DBUS_INT64_CONSTANT="$dbusint64_constant"
390         DBUS_UINT64_CONSTANT="$dbusuint64_constant"
391         AC_MSG_RESULT($DBUS_INT64_TYPE)
392 fi
393
394 AC_SUBST(DBUS_INT64_TYPE)
395 AC_SUBST(DBUS_INT64_CONSTANT)
396 AC_SUBST(DBUS_UINT64_CONSTANT)
397 AC_SUBST(DBUS_HAVE_INT64)
398
399 ### see what 32-bit int is called
400 AC_MSG_CHECKING([32-bit integer type])
401
402 case 4 in
403 $ac_cv_sizeof_short)
404   dbusint32=int
405   ;;
406 $ac_cv_sizeof_int)
407   dbusint32=int
408   ;;
409 $ac_cv_sizeof_long)
410   dbusint32=long
411   ;;
412 esac
413
414 if test -z "$dbusint32" ; then
415         DBUS_INT32_TYPE="no_int32_type_detected"
416         AC_MSG_ERROR([No 32-bit integer type found])
417 else
418         DBUS_INT32_TYPE="$dbusint32"
419         AC_MSG_RESULT($DBUS_INT32_TYPE)
420 fi
421
422 AC_SUBST(DBUS_INT32_TYPE)
423
424 ### see what 16-bit int is called
425 AC_MSG_CHECKING([16-bit integer type])
426
427 case 2 in
428 $ac_cv_sizeof_short)
429   dbusint16=short
430   ;;
431 $ac_cv_sizeof_int)
432   dbusint16=int
433   ;;
434 esac
435
436 if test -z "$dbusint16" ; then
437         DBUS_INT16_TYPE="no_int16_type_detected"
438         AC_MSG_ERROR([No 16-bit integer type found])
439 else
440         DBUS_INT16_TYPE="$dbusint16"
441         AC_MSG_RESULT($DBUS_INT16_TYPE)
442 fi
443
444 AC_SUBST(DBUS_INT16_TYPE)
445
446 ## byte order
447 AC_C_BIGENDIAN
448
449
450 dnl **********************************
451 dnl *** va_copy checks (from GLib) ***
452 dnl **********************************
453 dnl we currently check for all three va_copy possibilities, so we get
454 dnl all results in config.log for bug reports.
455 AC_CACHE_CHECK([for an implementation of va_copy()],dbus_cv_va_copy,[
456         AC_LINK_IFELSE([#include <stdarg.h>
457         void f (int i, ...) {
458         va_list args1, args2;
459         va_start (args1, i);
460         va_copy (args2, args1);
461         if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
462           exit (1);
463         va_end (args1); va_end (args2);
464         }
465         int main() {
466           f (0, 42);
467           return 0;
468         }],
469         [dbus_cv_va_copy=yes],
470         [dbus_cv_va_copy=no])
471 ])
472 AC_CACHE_CHECK([for an implementation of __va_copy()],dbus_cv___va_copy,[
473         AC_LINK_IFELSE([#include <stdarg.h>
474         void f (int i, ...) {
475         va_list args1, args2;
476         va_start (args1, i);
477         __va_copy (args2, args1);
478         if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
479           exit (1);
480         va_end (args1); va_end (args2);
481         }
482         int main() {
483           f (0, 42);
484           return 0;
485         }],
486         [dbus_cv___va_copy=yes],
487         [dbus_cv___va_copy=no])
488 ])
489
490 if test "x$dbus_cv_va_copy" = "xyes"; then
491   dbus_va_copy_func=va_copy
492 else if test "x$dbus_cv___va_copy" = "xyes"; then
493   dbus_va_copy_func=__va_copy
494 fi
495 fi
496
497 if test -n "$dbus_va_copy_func"; then
498   AC_DEFINE_UNQUOTED(DBUS_VA_COPY,$dbus_va_copy_func,[A 'va_copy' style function])
499 fi
500
501 AC_CACHE_CHECK([whether va_lists can be copied by value],dbus_cv_va_val_copy,[
502         AC_TRY_RUN([#include <stdarg.h>
503         void f (int i, ...) {
504         va_list args1, args2;
505         va_start (args1, i);
506         args2 = args1;
507         if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
508           exit (1);
509         va_end (args1); va_end (args2);
510         }
511         int main() {
512           f (0, 42);
513           return 0;
514         }],
515         [dbus_cv_va_val_copy=yes],
516         [dbus_cv_va_val_copy=no],
517         [dbus_cv_va_val_copy=yes])
518 ])
519
520 if test "x$dbus_cv_va_val_copy" = "xno"; then
521   AC_DEFINE(DBUS_VA_COPY_AS_ARRAY,1, ['va_lists' cannot be copies as values])
522 fi
523
524
525 #### Atomic integers (checks by Sebastian Wilhelmi for GLib)
526 AC_MSG_CHECKING([whether to use inline assembler routines for atomic integers])
527 have_atomic_inc=no
528 if test x"$GCC" = xyes; then
529   if test "x$enable_ansi" = "xyes"; then
530     AC_MSG_RESULT([no])
531   else
532     case $host_cpu in
533       i386)
534         AC_MSG_RESULT([no])
535         ;;
536       i?86)
537         AC_MSG_RESULT([i486])
538         AC_DEFINE_UNQUOTED(DBUS_USE_ATOMIC_INT_486, 1, [Use atomic integer implementation for 486])
539         have_atomic_inc=yes
540         ;;
541       *)
542         AC_MSG_RESULT([no])
543         ;;
544     esac
545   fi
546 fi
547 if test x$have_atomic_inc = xyes ; then
548   AC_DEFINE_UNQUOTED(DBUS_HAVE_ATOMIC_INT, 1, [Some atomic integer implementation present])
549 fi
550
551 #### Various functions
552 AC_CHECK_LIB(socket,socket)
553 AC_CHECK_LIB(nsl,gethostbyname)
554
555 AC_CHECK_FUNCS(vsnprintf vasprintf nanosleep usleep poll setenv unsetenv socketpair getgrouplist)
556
557 AC_CHECK_HEADERS(execinfo.h, [AC_CHECK_FUNCS(backtrace)])
558
559 AC_CACHE_CHECK([for posix getpwnam_r],
560                 ac_cv_func_posix_getpwnam_r,
561                 [AC_TRY_RUN([
562 #include <errno.h>
563 #include <pwd.h>
564 int main () { 
565     char buffer[10000];
566     struct passwd pwd, *pwptr = &pwd;
567     int error;
568     errno = 0;
569     error = getpwnam_r ("", &pwd, buffer, 
570                         sizeof (buffer), &pwptr);
571    return (error < 0 && errno == ENOSYS) 
572            || error == ENOSYS; 
573 }               ],
574         [ac_cv_func_posix_getpwnam_r=yes],
575         [ac_cv_func_posix_getpwnam_r=no])])
576 if test "$ac_cv_func_posix_getpwnam_r" = yes; then
577         AC_DEFINE(HAVE_POSIX_GETPWNAM_R,1,
578                 [Have POSIX function getpwnam_r])
579 else
580         AC_CACHE_CHECK([for nonposix getpwnam_r],
581                 ac_cv_func_nonposix_getpwnam_r,
582                 [AC_TRY_LINK([#include <pwd.h>],
583                         [char buffer[10000];
584                         struct passwd pwd;
585                         getpwnam_r ("", &pwd, buffer, 
586                                         sizeof (buffer));],
587                         [ac_cv_func_nonposix_getpwnam_r=yes],
588                         [ac_cv_func_nonposix_getpwnam_r=no])])
589                 if test "$ac_cv_func_nonposix_getpwnam_r" = yes; then
590                 AC_DEFINE(HAVE_NONPOSIX_GETPWNAM_R,1,
591                         [Have non-POSIX function getpwnam_r])
592         fi
593 fi
594
595 dnl check for socklen_t
596 AC_MSG_CHECKING(whether socklen_t is defined)
597 AC_TRY_COMPILE([
598 #include <sys/types.h>
599 #include <sys/socket.h>
600 #include <netdb.h>
601 ],[
602 socklen_t foo;
603 foo = 1;
604 ],dbus_have_socklen_t=yes,dbus_have_socklen_t=no)
605 AC_MSG_RESULT($dbus_have_socklen_t)
606
607 if test "x$dbus_have_socklen_t" = "xyes"; then
608     AC_DEFINE(HAVE_SOCKLEN_T,1,[Have socklen_t type])
609 fi
610
611 dnl check for writev header and writev function so we're 
612 dnl good to go if HAVE_WRITEV gets defined.
613 AC_CHECK_HEADERS(sys/uio.h, [AC_CHECK_FUNCS(writev)])
614
615 dnl check for flavours of varargs macros (test from GLib)
616 AC_MSG_CHECKING(for ISO C99 varargs macros in C)
617 AC_TRY_COMPILE([],[
618 int a(int p1, int p2, int p3);
619 #define call_a(...) a(1,__VA_ARGS__)
620 call_a(2,3);
621 ],dbus_have_iso_c_varargs=yes,dbus_have_iso_c_varargs=no)
622 AC_MSG_RESULT($dbus_have_iso_c_varargs)
623
624 AC_MSG_CHECKING(for GNUC varargs macros)
625 AC_TRY_COMPILE([],[
626 int a(int p1, int p2, int p3);
627 #define call_a(params...) a(1,params)
628 call_a(2,3);
629 ],dbus_have_gnuc_varargs=yes,dbus_have_gnuc_varargs=no)
630 AC_MSG_RESULT($dbus_have_gnuc_varargs)
631
632 dnl Output varargs tests
633 if test x$dbus_have_iso_c_varargs = xyes; then
634     AC_DEFINE(HAVE_ISO_VARARGS,1,[Have ISO C99 varargs macros])
635 fi
636 if test x$dbus_have_gnuc_varargs = xyes; then
637     AC_DEFINE(HAVE_GNUC_VARARGS,1,[Have GNU-style varargs macros])
638 fi
639
640 dnl Check for various credentials.
641 AC_MSG_CHECKING(for struct cmsgcred)
642 AC_TRY_COMPILE([
643 #include <sys/types.h>
644 #include <sys/socket.h>
645 ],[
646 struct cmsgcred cred;
647
648 cred.cmcred_pid = 0;
649 ],dbus_have_struct_cmsgcred=yes,dbus_have_struct_cmsgcred=no)
650 AC_MSG_RESULT($dbus_have_struct_cmsgcred)
651
652 if test x$dbus_have_struct_cmsgcred = xyes; then
653     AC_DEFINE(HAVE_CMSGCRED,1,[Have cmsgcred structure])
654 fi
655
656
657 #### Abstract sockets
658
659 AC_MSG_CHECKING(abstract socket namespace)
660 AC_LANG_PUSH(C)
661 AC_RUN_IFELSE([AC_LANG_PROGRAM(
662 [[
663 #include <sys/types.h>
664 #include <stdlib.h>
665 #include <string.h>
666 #include <stdio.h>
667 #include <sys/socket.h>
668 #include <sys/un.h>
669 #include <errno.h>
670 ]],
671 [[
672   int listen_fd;
673   struct sockaddr_un addr;
674   
675   listen_fd = socket (PF_UNIX, SOCK_STREAM, 0);
676   
677   if (listen_fd < 0)
678     {
679       fprintf (stderr, "socket() failed: %s\n", strerror (errno));
680       exit (1);
681     }
682
683   memset (&addr, '\0', sizeof (addr));
684   addr.sun_family = AF_UNIX;
685   strcpy (addr.sun_path, "X/tmp/dbus-fake-socket-path-used-in-configure-test");
686   addr.sun_path[0] = '\0'; /* this is what makes it abstract */
687   
688   if (bind (listen_fd, (struct sockaddr*) &addr, SUN_LEN (&addr)) < 0)
689     {
690        fprintf (stderr, "Abstract socket namespace bind() failed: %s\n", 
691                 strerror (errno));
692        exit (1);
693     }
694   else 
695     exit (0);
696 ]])],
697               [have_abstract_sockets=yes],
698               [have_abstract_sockets=no])
699 AC_LANG_POP(C)
700 AC_MSG_RESULT($have_abstract_sockets)
701
702 if test x$enable_abstract_sockets = xyes; then
703     if test x$have_abstract_sockets = xno; then
704         AC_MSG_ERROR([Abstract sockets explicitly required, and support not detected.])
705     fi
706 fi
707
708 if test x$enable_abstract_sockets = xno; then
709    have_abstract_sockets=no;
710 fi
711
712 if test x$have_abstract_sockets = xyes ; then
713    DBUS_PATH_OR_ABSTRACT=abstract
714    AC_DEFINE(HAVE_ABSTRACT_SOCKETS,1,[Have abstract socket namespace])
715 else
716    DBUS_PATH_OR_ABSTRACT=path
717 fi
718
719 # this is used in addresses to prefer abstract, e.g. 
720 # unix:path=/foo or unix:abstract=/foo 
721 AC_SUBST(DBUS_PATH_OR_ABSTRACT)
722
723 #### Sort out gettext
724
725 # this makes us require GLib to run autoconf, but not at runtime
726 ALL_LINGUAS=""
727 AM_GLIB_GNU_GETTEXT
728
729 # INTLLIBS is now set
730
731 # (if someone wants to go through and make internationalization 
732 #  conditional with #ifdef ENABLE_NLS then go crazy and send us a patch, 
733 #  but right now we won't build without gettext)
734 if test "$gt_cv_have_gettext" != "yes" ; then
735   AC_MSG_ERROR([
736 *** You must have either have gettext support in your C library, or use the 
737 *** GNU gettext library. (http://www.gnu.org/software/gettext/gettext.html
738 ])
739 fi
740
741 #### Sort out XML library
742
743 # see what we have
744 AC_CHECK_LIB(expat, XML_ParserCreate_MM,
745              [ AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false) ],
746              have_expat=false)
747
748 PKG_CHECK_MODULES(LIBXML, libxml-2.0, have_libxml=true, have_libxml=false)
749
750 # see what we want to use
751 dbus_use_libxml=false
752 dbus_use_expat=false
753 if test x$with_xml = xexpat; then
754         dbus_use_expat=true
755         if ! $have_expat ; then
756            AC_MSG_ERROR([Explicitly requested expat but expat not found])
757         fi
758 elif test x$with_xml = xlibxml; then
759         dbus_use_libxml=true
760         if ! $have_libxml ; then
761            AC_MSG_ERROR([Explicitly requested libxml but libxml not found])
762         fi
763 else
764         ### expat is the default because libxml can't currently survive 
765         ### our brutal OOM-handling unit test setup.
766         ### http://bugzilla.gnome.org/show_bug.cgi?id=109368
767         if $have_expat ; then
768                 with_xml=expat
769                 dbus_use_expat=true
770         elif $have_libxml ; then
771                 with_xml=libxml
772                 dbus_use_libxml=true
773         else
774                 AC_MSG_ERROR([No XML library found, check config.log for failed attempts])
775         fi
776 fi
777
778 AM_CONDITIONAL(DBUS_USE_EXPAT, $dbus_use_expat)
779 AM_CONDITIONAL(DBUS_USE_LIBXML, $dbus_use_libxml)
780
781 if $dbus_use_expat; then
782    XML_LIBS=-lexpat
783    XML_CFLAGS=
784 fi
785 if $dbus_use_libxml; then
786    XML_LIBS=$LIBXML_LIBS
787    XML_CFLAGS=$LIBXML_CFLAGS
788 fi
789
790 # SELinux detection
791 if test x$enable_selinux = xno ; then
792     have_selinux=no;
793 else
794     # See if we have SELinux library
795     AC_CHECK_LIB(selinux, is_selinux_enabled, 
796                  have_selinux=yes, have_selinux=no)
797
798     # see if we have the SELinux header with the new D-BUS stuff in it
799     if test x$have_selinux = xyes ; then
800         AC_MSG_CHECKING([for DBUS Flask permissions in selinux/av_permissions.h])
801         AC_TRY_COMPILE([#include <selinux/av_permissions.h>],
802                         [#ifdef DBUS__ACQUIRE_SVC return 0;
803                          #else
804                          #error DBUS__ACQUIRE_SVC not defined
805                          #endif],
806                         have_selinux=yes, have_selinux=no)
807         AC_MSG_RESULT($have_selinux)
808     fi
809
810     if test x$enable_selinux = xauto ; then
811         if test x$have_selinux = xno ; then
812                 AC_MSG_WARN([Sufficiently new SELinux library not found])
813         fi
814     else 
815         if test x$have_selinux = xno ; then
816                 AC_MSG_ERROR([SElinux explicitly required, and SELinux library not found])
817         fi
818     fi
819 fi
820
821 AM_CONDITIONAL(HAVE_SELINUX, test x$have_selinux = xyes)
822
823 if test x$have_selinux = xyes ; then
824     SELINUX_LIBS="-lselinux -lpthread"
825     AC_DEFINE(HAVE_SELINUX,1,[SELinux support])
826 else
827     SELINUX_LIBS=
828 fi
829
830 # dnotify checks
831 if test x$target_os = xlinux-gnu; then
832         AC_ARG_ENABLE(dnotify,
833         [  --disable-dnotify         Disable using dnotify on Linux],
834         [case "${enableval}" in
835           yes) dnotify=false ;;
836           no)  dnotify=true ;;
837           *) AC_MSG_ERROR(bad value ${enableval} for --disable-dnotify) ;;
838         esac],[dnotify=true])
839 fi
840 dnl check if dnotify backend is enabled
841 if test x$dnotify = xtrue; then
842    AC_DEFINE(DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX,1,[Use dnotify on Linux])
843 fi
844
845
846 #### Set up final flags
847 DBUS_CLIENT_CFLAGS=
848 DBUS_CLIENT_LIBS=
849 AC_SUBST(DBUS_CLIENT_CFLAGS)
850 AC_SUBST(DBUS_CLIENT_LIBS)
851
852 DBUS_BUS_CFLAGS=$XML_CFLAGS
853 DBUS_BUS_LIBS="$XML_LIBS $SELINUX_LIBS $INTLLIBS"
854 AC_SUBST(DBUS_BUS_CFLAGS)
855 AC_SUBST(DBUS_BUS_LIBS)
856
857 DBUS_TEST_CFLAGS=
858 DBUS_TEST_LIBS=
859 AC_SUBST(DBUS_TEST_CFLAGS)
860 AC_SUBST(DBUS_TEST_LIBS)
861
862 # Glib detection
863 PKG_CHECK_MODULES(DBUS_GLIB, gobject-2.0 >= 2.4, have_glib=yes, have_glib=no)
864 PKG_CHECK_MODULES(DBUS_GLIB_THREADS, gthread-2.0 >= 2.4, have_glib_threads=yes, have_glib_threads=no)
865
866 if test x$have_glib = xno ; then
867     AC_MSG_WARN([GLib development libraries not found])
868 fi
869
870 if test x$enable_glib = xyes; then
871     if test x$have_glib = xno; then
872         AC_MSG_ERROR([GLib explicitly required, and GLib development libraries not found])
873     fi
874 fi
875
876 if test x$enable_glib = xno; then
877    have_glib=no;
878 fi
879
880 AM_CONDITIONAL(HAVE_GLIB, test x$have_glib = xyes)
881 AM_CONDITIONAL(HAVE_GLIB_THREADS, test x$have_glib_threads = xyes)
882
883 if test x$have_glib = xyes; then
884    GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
885 else
886    GLIB_GENMARSHAL=glib-not-enabled-so-there-is-no-genmarshal
887 fi
888 AC_SUBST(GLIB_GENMARSHAL)
889
890 dnl GLib flags
891 AC_SUBST(DBUS_GLIB_CFLAGS)
892 AC_SUBST(DBUS_GLIB_LIBS)
893 AC_SUBST(DBUS_GLIB_THREADS_LIBS)
894
895 DBUS_GLIB_TOOL_CFLAGS=$XML_CFLAGS
896 DBUS_GLIB_TOOL_LIBS="$XML_LIBS $INTLLIBS"
897 AC_SUBST(DBUS_GLIB_TOOL_CFLAGS)
898 AC_SUBST(DBUS_GLIB_TOOL_LIBS)
899
900 # GTK detection
901 if test x$have_glib = xno ; then
902     AC_MSG_WARN([Can't use GTK+ since GLib not enabled])
903     have_gtk=no
904 else
905     PKG_CHECK_MODULES(DBUS_GTK, gtk+-2.0 >= 2.4, have_gtk=yes, have_gtk=no)
906     PKG_CHECK_MODULES(DBUS_GTK_THREADS, gtk+-2.0 >= 2.4 gthread-2.0, have_gtk_threads=yes, have_gtk_threads=no)
907 fi
908
909 if test x$have_gtk = xno ; then
910     AC_MSG_WARN([GTK+ development libraries not found])
911 fi
912
913 if test x$enable_gtk = xyes; then
914     if test x$have_gtk = xno; then
915         AC_MSG_ERROR([GTK+ explicitly required, and GTK+ development libraries not found])
916     fi
917 fi
918
919 if test x$enable_gtk = xno; then
920    have_gtk=no;
921 fi
922
923 AM_CONDITIONAL(HAVE_GTK, test x$have_gtk = xyes)
924
925 dnl Gtk flags
926 AC_SUBST(DBUS_GTK_CFLAGS)
927 AC_SUBST(DBUS_GTK_LIBS)
928 AC_SUBST(DBUS_GTK_THREADS_CFLAGS)
929 AC_SUBST(DBUS_GTK_THREADS_LIBS)
930
931
932 dnl Qt3 detection
933 AC_PATH_PROG(QT3_MOC, moc, no)
934
935 have_qt=no
936 AC_MSG_CHECKING([for qglobal.h])
937 if test -n "$QTDIR" -a -f "$QTDIR/include/qglobal.h"; then
938     have_qt=yes
939     DBUS_QT3_CXXFLAGS="-I$QTDIR/include"
940 else
941     for dir in "${prefix}/include/qt" "/usr/include/qt-3.1" "/usr/include/qt3" "/usr/include/qt" "/usr/lib/qt/include" "/usr/lib/qt-3.1/include"; do
942         if test -f "$dir/qglobal.h"; then
943             have_qt3=yes
944             DBUS_QT3_CXXFLAGS="-I$dir"
945             DBUS_QT3_LIBS="-L$QTDIR/lib -lqt-mt"
946        fi
947     done
948 fi
949 if test x"$have_qt3" = x"yes"; then
950    AC_MSG_RESULT([found])
951 else
952    AC_MSG_RESULT([not found])
953 fi
954
955 if test x$have_qt3 = xno ; then
956     AC_MSG_WARN([Qt3 development libraries not found])
957 fi
958
959 if test x$enable_qt3 = xyes; then
960     if test x$have_qt3 = xno; then
961         AC_MSG_ERROR([Qt3 integration explicitly required, and Qt3 libraries not found])
962     fi
963 fi
964
965 if test x$enable_qt3 = xno; then
966    have_qt3=no;
967 fi
968
969 AM_CONDITIONAL(HAVE_QT3, test x$have_qt3 = xyes)
970
971 dnl Qt flags
972 AC_SUBST(DBUS_QT3_CXXFLAGS)
973 AC_SUBST(DBUS_QT3_LIBS)
974
975
976 dnl Qt detection
977 PKG_CHECK_MODULES(DBUS_QT, QtCore >= 4.0, have_qt=yes, have_qt=no)
978
979 if test x$have_qt = xno ; then
980     AC_MSG_WARN([Qt development libraries not found])
981 fi
982
983 if test x$enable_qt = xyes; then
984     if test x$have_qt = xno; then
985         AC_MSG_ERROR([Qt integration explicitly required, and Qt libraries not found])
986     fi
987 fi
988
989 if test x$enable_qt = xno; then
990    have_qt=no;
991 fi
992
993 QT_MOC=`$PKG_CONFIG --variable=exec_prefix QtCore`
994 QT_MOC=${QT_MOC}/bin/moc
995
996 AM_CONDITIONAL(HAVE_QT, test x$have_qt = xyes)
997
998 dnl Qt flags
999 AC_SUBST(DBUS_QT_CFLAGS)
1000 AC_SUBST(DBUS_QT_LIBS)
1001 AC_SUBST(QT_MOC)
1002
1003 dnl QTestLib detection
1004 PKG_CHECK_MODULES(DBUS_QTESTLIB, QtTest, have_qtest=yes, have_qtest=no)
1005
1006 if test x$have_qtest = xno ; then
1007     AC_MSG_WARN([Qt Unit Test library not found])
1008 fi
1009
1010 if test x$have_qt = xno; then
1011     have_qtest=no
1012 fi
1013
1014 AM_CONDITIONAL(HAVE_QTESTLIB, test x$have_qtest = xyes)
1015
1016 AC_SUBST(DBUS_QTESTLIB_CFLAGS)
1017 AC_SUBST(DBUS_QTESTLIB_LIBS)
1018
1019 ### X11 detection
1020 AC_PATH_XTRA
1021
1022 ## for now enable_x11 just tracks have_x11, 
1023 ## there's no --enable-x11
1024 if test x$no_x = xyes ; then
1025    have_x11=no
1026    enable_x11=no
1027 else
1028    have_x11=yes
1029    enable_x11=yes
1030 fi
1031
1032 if test x$enable_x11 = xyes ; then
1033    AC_DEFINE(DBUS_BUILD_X11,1,[Build X11-dependent code])
1034    DBUS_X_LIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
1035    DBUS_X_CFLAGS="$X_CFLAGS"
1036 else
1037    DBUS_X_LIBS=
1038    DBUS_X_CFLAGS=
1039 fi
1040
1041 AC_SUBST(DBUS_X_CFLAGS)
1042 AC_SUBST(DBUS_X_LIBS)
1043
1044 ### Doxygen Documentation
1045
1046 AC_PATH_PROG(DOXYGEN, doxygen, no)
1047
1048 AC_MSG_CHECKING([whether to build Doxygen documentation])
1049
1050 if test x$DOXYGEN = xno ; then
1051     have_doxygen=no
1052 else
1053     have_doxygen=yes
1054 fi
1055
1056 if test x$enable_doxygen_docs = xauto ; then
1057     if test x$have_doxygen = xno ; then
1058         enable_doxygen_docs=no
1059     else
1060         enable_doxygen_docs=yes
1061     fi
1062 fi
1063
1064 if test x$enable_doxygen_docs = xyes; then
1065     if test x$have_doxygen = xno; then
1066         AC_MSG_ERROR([Building Doxygen docs explicitly required, but Doxygen not found])
1067     fi
1068 fi
1069
1070 AM_CONDITIONAL(DBUS_DOXYGEN_DOCS_ENABLED, test x$enable_doxygen_docs = xyes)
1071 AC_MSG_RESULT(yes)
1072
1073 ### XML Documentation
1074
1075 AC_PATH_PROG(XMLTO, xmlto, no)
1076
1077 AC_MSG_CHECKING([whether to build XML documentation])
1078
1079 if test x$XMLTO = xno ; then
1080     have_xmlto=no
1081 else
1082     have_xmlto=yes
1083 fi
1084
1085 if test x$enable_xml_docs = xauto ; then
1086     if test x$have_xmlto = xno ; then
1087         enable_xml_docs=no
1088     else
1089         enable_xml_docs=yes
1090     fi
1091 fi
1092
1093 if test x$enable_xml_docs = xyes; then
1094     if test x$have_xmlto = xno; then
1095         AC_MSG_ERROR([Building XML docs explicitly required, but xmlto not found])
1096     fi
1097 fi
1098
1099 AM_CONDITIONAL(DBUS_XML_DOCS_ENABLED, test x$enable_xml_docs = xyes)
1100 AC_MSG_RESULT(yes)
1101
1102 #### Have to go $localstatedir->$prefix/var->/usr/local/var   
1103 #### someone please fix this a better way...
1104
1105 #### find the actual value for $prefix that we'll end up with
1106 ##   (I know this is broken and should be done in the Makefile, but
1107 ##    that's a major pain and almost nobody actually seems to care)
1108 REAL_PREFIX=
1109 if test "x$prefix" = "xNONE"; then
1110   REAL_PREFIX=$ac_default_prefix
1111 else
1112   REAL_PREFIX=$prefix
1113 fi
1114
1115 ## temporarily change prefix and exec_prefix
1116 old_prefix=$prefix
1117 prefix=$REAL_PREFIX
1118
1119 if test "x$exec_prefix" = xNONE ; then
1120    REAL_EXEC_PREFIX=$REAL_PREFIX
1121 else
1122    REAL_EXEC_PREFIX=$exec_prefix
1123 fi
1124 old_exec_prefix=$exec_prefix
1125 exec_prefix=$REAL_EXEC_PREFIX
1126
1127 ## eval everything
1128 LOCALSTATEDIR_TMP="$localstatedir"
1129 EXPANDED_LOCALSTATEDIR=`eval echo $LOCALSTATEDIR_TMP`
1130 AC_SUBST(EXPANDED_LOCALSTATEDIR)
1131
1132 SYSCONFDIR_TMP="$sysconfdir"
1133 EXPANDED_SYSCONFDIR=`eval echo $SYSCONFDIR_TMP`
1134 AC_SUBST(EXPANDED_SYSCONFDIR)
1135
1136 BINDIR_TMP="$bindir"
1137 EXPANDED_BINDIR=`eval echo $BINDIR_TMP`
1138 AC_SUBST(EXPANDED_BINDIR)
1139
1140 LIBDIR_TMP="$libdir"
1141 EXPANDED_LIBDIR=`eval echo $LIBDIR_TMP`
1142 AC_SUBST(EXPANDED_LIBDIR)
1143
1144 DATADIR_TMP="$datadir"
1145 EXPANDED_DATADIR=`eval echo $DATADIR_TMP`
1146 AC_SUBST(EXPANDED_DATADIR)
1147
1148 ## put prefix and exec_prefix back
1149 prefix=$old_prefix
1150 exec_prefix=$old_exec_prefix
1151
1152 #### Check our operating system
1153 operating_system=unknown
1154 if test -f /etc/redhat-release || test -f $EXPANDED_SYSCONFDIR/redhat-release ; then
1155    operating_system=redhat
1156 fi
1157
1158 if test -f /etc/slackware-version || test -f $EXPANDED_SYSCONFDIR/slackware-version ; then
1159    operating_system=slackware
1160 fi
1161
1162 #### Sort out init scripts
1163
1164 if test x$with_init_scripts = x; then
1165     if test xredhat = x$operating_system ; then
1166         with_init_scripts=redhat
1167     else
1168         if test xslackware = x$operating_system ; then
1169                 with_init_scripts=slackware
1170             else
1171                 with_init_scripts=none
1172         fi
1173     fi
1174 fi
1175
1176 AM_CONDITIONAL(DBUS_INIT_SCRIPTS_RED_HAT, test x$with_init_scripts = xredhat)
1177
1178 AM_CONDITIONAL(DBUS_INIT_SCRIPTS_SLACKWARE, test x$with_init_scripts = xslackware)
1179
1180 ##### Set up location for system bus socket
1181 if ! test -z "$with_system_socket"; then
1182    DBUS_SYSTEM_SOCKET=$with_system_socket
1183 else
1184    DBUS_SYSTEM_SOCKET=${EXPANDED_LOCALSTATEDIR}/run/dbus/system_bus_socket
1185 fi
1186
1187 AC_SUBST(DBUS_SYSTEM_SOCKET)
1188 AC_DEFINE_UNQUOTED(DBUS_SYSTEM_SOCKET,"$DBUS_SYSTEM_SOCKET",[The name of the socket the system bus listens on by default])
1189
1190 ## system bus only listens on local domain sockets, and never 
1191 ## on an abstract socket (so only root can create the socket)
1192 DBUS_SYSTEM_BUS_DEFAULT_ADDRESS="unix:path=$DBUS_SYSTEM_SOCKET"
1193 AC_SUBST(DBUS_SYSTEM_BUS_DEFAULT_ADDRESS)
1194 AC_DEFINE_UNQUOTED(DBUS_SYSTEM_BUS_DEFAULT_ADDRESS, "$DBUS_SYSTEM_BUS_DEFAULT_ADDRESS",[The default D-BUS address of the system bus])
1195
1196 #### Set up the pid file
1197 if ! test -z "$with_system_pid_file"; then
1198    DBUS_SYSTEM_PID_FILE=$with_system_pid_file
1199 elif test x$operating_system = xredhat ; then
1200    DBUS_SYSTEM_PID_FILE=${EXPANDED_LOCALSTATEDIR}/run/messagebus.pid
1201 else
1202    DBUS_SYSTEM_PID_FILE=${EXPANDED_LOCALSTATEDIR}/run/dbus/pid
1203 fi
1204
1205 AC_SUBST(DBUS_SYSTEM_PID_FILE)
1206
1207 #### Directory to check for console ownership
1208 if ! test -z "$with_console_auth_dir"; then
1209    DBUS_CONSOLE_AUTH_DIR=$with_console_auth_dir
1210 else
1211    DBUS_CONSOLE_AUTH_DIR=/var/run/console/
1212 fi
1213
1214 AC_SUBST(DBUS_CONSOLE_AUTH_DIR)
1215 AC_DEFINE_UNQUOTED(DBUS_CONSOLE_AUTH_DIR, "$DBUS_CONSOLE_AUTH_DIR", [Directory to check for console ownerhip])
1216
1217 #### User to start the system bus as
1218 if test -z "$with_dbus_user" ; then
1219     DBUS_USER=messagebus
1220 else
1221     DBUS_USER=$with_dbus_user
1222 fi
1223 AC_SUBST(DBUS_USER)
1224 AC_DEFINE_UNQUOTED(DBUS_USER,"$DBUS_USER", [User for running the system BUS daemon])
1225
1226 #### Tell tests where to find certain stuff in builddir
1227 ABSOLUTE_TOP_BUILDDIR=`cd ${ac_top_builddir}. && pwd`
1228
1229 AC_DEFUN(TEST_PATH, [
1230 TEST_$1=${ABSOLUTE_TOP_BUILDDIR}/test/$2
1231 AC_DEFINE_UNQUOTED(TEST_$1, "$TEST_$1",
1232                    [Full path to test file test/$2 in builddir])
1233 AC_SUBST(TEST_$1)
1234 ])
1235
1236 TEST_PATH(SERVICE_DIR, data/valid-service-files)
1237 TEST_PATH(SERVICE_BINARY, test-service)
1238 TEST_PATH(SHELL_SERVICE_BINARY, test-shell-service)
1239 TEST_PATH(GLIB_SERVICE_BINARY, glib/test-service-glib)
1240 TEST_PATH(PYTHON_SERVICE_BINARY, python/test-service.py)
1241 TEST_PATH(EXIT_BINARY, test-exit)
1242 TEST_PATH(SEGFAULT_BINARY, test-segfault)
1243 TEST_PATH(SLEEP_FOREVER_BINARY, test-sleep-forever)
1244 AC_SUBST(ABSOLUTE_TOP_BUILDDIR)
1245
1246 #### Find socket directories
1247 if ! test -z "$TMPDIR" ; then
1248    DEFAULT_SOCKET_DIR=$TMPDIR
1249 elif ! test -z "$TEMP" ; then
1250    DEFAULT_SOCKET_DIR=$TEMP
1251 elif ! test -z "$TMP" ; then
1252    DEFAULT_SOCKET_DIR=$TMP
1253 else
1254    DEFAULT_SOCKET_DIR=/tmp
1255 fi
1256
1257 if ! test -z "$with_test_socket_dir" ; then
1258    TEST_SOCKET_DIR="$with_test_socket_dir"
1259 else
1260    TEST_SOCKET_DIR=$DEFAULT_SOCKET_DIR
1261 fi
1262 AC_SUBST(TEST_SOCKET_DIR)
1263 AC_DEFINE_UNQUOTED(DBUS_TEST_SOCKET_DIR, "$TEST_SOCKET_DIR", [Where to put test sockets])
1264
1265 if ! test -z "$with_session_socket_dir" ; then
1266    DBUS_SESSION_SOCKET_DIR="$with_session_socket_dir"
1267 else
1268    DBUS_SESSION_SOCKET_DIR=$DEFAULT_SOCKET_DIR
1269 fi
1270 AC_DEFINE_UNQUOTED(DBUS_SESSION_SOCKET_DIR, "$DBUS_SESSION_SOCKET_DIR", [Where per-session bus puts its sockets])
1271 AC_SUBST(DBUS_SESSION_SOCKET_DIR)
1272
1273 # Detect if we can build Python bindings (need python, python headers, and pyrex)
1274 if test x$enable_python = xno; then
1275     have_python=no
1276 else
1277     have_python_version=2.4
1278     AC_MSG_NOTICE([Checking to see if we can build Python bindings])
1279     have_python=no
1280     AM_PATH_PYTHON()
1281
1282     if test -z "$PYTHON" ; then
1283         AC_MSG_WARN([Python not found])
1284     else
1285         AC_MSG_CHECKING([whether $PYTHON version >= $have_python_version])
1286         AM_PYTHON_CHECK_VERSION([$PYTHON], [$have_python_version],
1287                               [have_python_version="yes"],
1288                               [have_python_version="too old"])
1289     
1290         AC_MSG_RESULT($have_python_version)
1291     
1292         AC_CHECK_PROGS(PYREX, pyrexc)
1293
1294         if test -z "$PYREX" ; then
1295             have_pyrex=no
1296         else
1297             have_pyrex=yes
1298         fi
1299
1300         AM_CHECK_PYTHON_HEADERS(have_python_headers=yes,have_python_headers=no)
1301
1302         if test x$have_pyrex = xyes -a x$have_python_headers = xyes -a "x$have_python_version" = xyes ; then
1303             have_python=yes
1304         fi
1305     fi
1306
1307     if test x$have_python = xno ; then
1308         if test x$enable_python = xyes ; then
1309             AC_MSG_ERROR([Building python explicitly requested, but can't build python bindings because either Pyrex, Python headers or a suitable Python version was not found])
1310         else
1311             AC_MSG_WARN([Couldn't find either Pyrex, the Python headers or a suitable version of Python, not building Python bindings])
1312         fi
1313     fi               
1314 fi
1315
1316 AM_CONDITIONAL(HAVE_PYTHON, test x$have_python = xyes)
1317
1318 AC_OUTPUT([
1319 Doxyfile
1320 dbus/dbus-arch-deps.h
1321 bus/system.conf
1322 bus/session.conf
1323 bus/messagebus
1324 bus/rc.messagebus
1325 bus/dbus-daemon.1
1326 Makefile
1327 dbus/Makefile
1328 glib/Makefile
1329 glib/examples/Makefile
1330 glib/examples/statemachine/Makefile
1331 python/Makefile
1332 python/examples/Makefile
1333 qt/Makefile
1334 qt3/Makefile
1335 gcj/Makefile
1336 gcj/org/Makefile
1337 gcj/org/freedesktop/Makefile
1338 gcj/org/freedesktop/dbus/Makefile
1339 mono/Makefile
1340 mono/AssemblyInfo.cs
1341 mono/dbus-sharp.dll.config
1342 mono/example/Makefile
1343 mono/doc/Makefile
1344 bus/Makefile
1345 tools/Makefile
1346 test/Makefile
1347 test/glib/Makefile
1348 test/python/Makefile
1349 test/qt/Makefile
1350 doc/Makefile
1351 dbus-1.pc
1352 dbus-glib-1.pc
1353 dbus-sharp.pc
1354 test/data/valid-config-files/debug-allow-all.conf
1355 test/data/valid-config-files/debug-allow-all-sha1.conf
1356 test/data/valid-service-files/debug-echo.service
1357 test/data/valid-service-files/debug-segfault.service
1358 test/data/valid-service-files/debug-glib.service
1359 test/data/valid-service-files/debug-shell-echo-success.service
1360 test/data/valid-service-files/debug-shell-echo-fail.service
1361 test/data/valid-service-files/debug-python.service
1362 ])
1363
1364 ### FIXME it's bizarre that have_qt and have_glib are used
1365 ### instead of enable_ - should fix things so that enable 
1366 ### is always whether it's enabled, and have is always whether 
1367 ### it was found.
1368
1369 dnl ==========================================================================
1370 echo "
1371                     D-BUS $VERSION
1372                   ==============
1373
1374         prefix:                   ${prefix}
1375         exec_prefix:              ${exec_prefix}
1376         libdir:                   ${EXPANDED_LIBDIR}
1377         bindir:                   ${EXPANDED_BINDIR}
1378         sysconfdir:               ${EXPANDED_SYSCONFDIR}
1379         localstatedir:            ${EXPANDED_LOCALSTATEDIR}
1380         datadir:              ${EXPANDED_DATADIR}
1381         source code location:     ${srcdir}
1382         compiler:                 ${CC}
1383         cflags:                   ${CFLAGS}
1384         cppflags:                 ${CPPFLAGS}
1385         cxxflags:                 ${CXXFLAGS}
1386         64-bit int:               ${DBUS_INT64_TYPE}
1387         32-bit int:               ${DBUS_INT32_TYPE}
1388         16-bit int:               ${DBUS_INT16_TYPE}
1389         Doxygen:                  ${DOXYGEN}
1390         xmlto:                    ${XMLTO}"
1391
1392 if test x$enable_gcj = xyes ; then
1393 echo \
1394 "        gcj:                     ${GCJ}
1395         gcjflags:                 ${GCJFLAGS}"
1396 else
1397 echo \
1398 "        gcj:                      (not enabled)"
1399 fi
1400
1401 if test x$enable_mono = xyes ; then
1402 echo \
1403 "        csc:                     ${CSC}
1404 "
1405 else
1406 echo \
1407 "        csc:                      (not enabled)
1408 "
1409 fi
1410
1411 echo "
1412         Maintainer mode:          ${USE_MAINTAINER_MODE}
1413         gcc coverage profiling:   ${enable_gcov}
1414         Building unit tests:      ${enable_tests}
1415         Building verbose mode:    ${enable_verbose_mode}
1416         Building assertions:      ${enable_asserts}
1417         Building checks:          ${enable_checks}
1418         Building Qt bindings:     ${have_qt}
1419         Building Qt3 bindings:    ${have_qt3}
1420         Building GLib bindings:   ${have_glib}
1421         Building Python bindings: ${have_python}
1422         Building SELinux support: ${have_selinux}
1423         Building Mono bindings:   ${enable_mono}
1424         Building Mono docs:       ${enable_mono_docs}
1425         Building GTK+ tools:      ${have_gtk}
1426         Building X11 code:        ${enable_x11}
1427         Building Doxygen docs:    ${enable_doxygen_docs}
1428         Building XML docs:        ${enable_xml_docs}
1429         Gettext libs (empty OK):  ${INTLLIBS}
1430         Using XML parser:         ${with_xml}
1431         Init scripts style:       ${with_init_scripts}
1432         Abstract socket names:    ${have_abstract_sockets}
1433         System bus socket:        ${DBUS_SYSTEM_SOCKET}
1434         System bus address:       ${DBUS_SYSTEM_BUS_DEFAULT_ADDRESS}
1435         System bus PID file:      ${DBUS_SYSTEM_PID_FILE}
1436         Session bus socket dir:   ${DBUS_SESSION_SOCKET_DIR}
1437         Console auth dir:         ${DBUS_CONSOLE_AUTH_DIR}
1438         System bus user:          ${DBUS_USER}
1439         'make check' socket dir:  ${TEST_SOCKET_DIR}
1440 "
1441
1442 if test x$enable_tests = xyes; then
1443         echo "NOTE: building with unit tests increases the size of the installed library and renders it insecure."
1444 fi
1445 if test x$enable_tests = xyes -a x$enable_asserts = xno; then
1446         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)"
1447 fi
1448 if test x$enable_gcov = xyes; then
1449         echo "NOTE: building with coverage profiling is definitely for developers only."
1450 fi
1451 if test x$enable_verbose_mode = xyes; then
1452         echo "NOTE: building with verbose mode increases library size, may slightly increase security risk, and decreases performance."
1453 fi
1454 if test x$enable_asserts = xyes; then
1455         echo "NOTE: building with assertions increases library size and decreases performance."
1456 fi
1457 if test x$enable_checks = xno; then
1458         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."
1459 fi