2003-05-16 Havoc Pennington <hp@redhat.com>
[platform/upstream/dbus.git] / configure.in
1 dnl -*- mode: m4 -*-
2 AC_PREREQ(2.52)
3
4 AC_INIT(dbus/dbus.h)
5
6 AM_INIT_AUTOMAKE(dbus, 0.11)
7
8 AM_CONFIG_HEADER(config.h)
9
10 # Honor aclocal flags
11 ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
12
13 GETTEXT_PACKAGE=dbus-1
14 AC_SUBST(GETTEXT_PACKAGE)
15 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[The name of the gettext domain])
16
17  ## must come before we use the $USE_MAINTAINER_MODE variable later
18 AM_MAINTAINER_MODE
19
20 AC_PROG_CC
21 AC_PROG_CXX
22 AC_ISC_POSIX
23 AC_HEADER_STDC
24 AM_PROG_LIBTOOL
25
26 AC_ARG_ENABLE(qt,      [  --enable-qt      enable Qt-friendly client library],enable_qt=$enableval,enable_qt=auto)
27 AC_ARG_ENABLE(glib,    [  --enable-glib    enable GLib-friendly client library],enable_glib=$enableval,enable_glib=auto)
28 AC_ARG_ENABLE(tests,   [  --enable-tests   enable unit test code],enable_tests=$enableval,enable_tests=$USE_MAINTAINER_MODE)
29 AC_ARG_ENABLE(ansi,    [  --enable-ansi    enable -ansi -pedantic gcc flags],enable_ansi=$enableval,enable_ansi=no)
30 AC_ARG_ENABLE(verbose-mode, [  --enable-verbose-mode support verbose debug mode],enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
31 AC_ARG_ENABLE(asserts, [  --enable-asserts include assertion checks],enable_asserts=$enableval,enable_asserts=$USE_MAINTAINER_MODE)
32 AC_ARG_ENABLE(checks,  [  --enable-checks  include sanity checks on public API],enable_checks=$enableval,enable_checks=yes)
33 AC_ARG_ENABLE(docs,    [  --enable-docs    build documentation (requires Doxygen and jade)],enable_docs=$enableval,enable_docs=auto)
34 AC_ARG_ENABLE(gcov,    [  --enable-gcov    compile with coverage profiling instrumentation (gcc only)],enable_gcov=$enableval,enable_gcov=no)
35
36 AC_ARG_WITH(xml,                [  --with-xml=[libxml/expat]           XML library to use])
37 AC_ARG_WITH(init-scripts,       [  --with-init-scripts=[redhat]        Style of init scripts to install])
38 AC_ARG_WITH(session-socket-dir, [  --with-session-socket-dir=[dirname] Where to put sockets for the per-login-session message bus])
39 AC_ARG_WITH(test-socket-dir,    [  --with-test-socket-dir=[dirname]    Where to put sockets for make check])
40 AC_ARG_WITH(system-pid-file,    [  --with-system-pid-file=[pidfile]    PID file for systemwide daemon])
41 AC_ARG_WITH(system-socket,      [  --with-system-socket=[filename]     UNIX domain socket for systemwide daemon])
42
43 dnl DBUS_BUILD_TESTS controls unit tests built in to .c files 
44 dnl and also some stuff in the test/ subdir
45 AM_CONDITIONAL(DBUS_BUILD_TESTS, test x$enable_tests = xyes)
46 if test x$enable_tests = xyes; then
47     AC_DEFINE(DBUS_BUILD_TESTS,1,[Build test code])
48 fi
49
50 if test x$enable_verbose_mode = xyes; then
51     AC_DEFINE(DBUS_ENABLE_VERBOSE_MODE,1,[Support a verbose mode])
52 fi
53 if test x$enable_asserts = xno; then
54     AC_DEFINE(DBUS_DISABLE_ASSERT,1,[Disable assertion checking])
55 fi
56 if test x$enable_checks = xno; then
57     AC_DEFINE(DBUS_DISABLE_CHECKS,1,[Disable public API sanity checking])
58 fi
59
60 #### gcc warning flags
61
62 if test "x$GCC" = "xyes"; then
63   changequote(,)dnl
64   case " $CFLAGS " in
65   *[\ \ ]-Wall[\ \      ]*) ;;
66   *) CFLAGS="$CFLAGS -Wall" ;;
67   esac
68
69   case " $CFLAGS " in
70   *[\ \ ]-Wchar-subscripts[\ \  ]*) ;;
71   *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
72   esac
73
74   case " $CFLAGS " in
75   *[\ \ ]-Wmissing-declarations[\ \     ]*) ;;
76   *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
77   esac
78
79   case " $CFLAGS " in
80   *[\ \ ]-Wmissing-prototypes[\ \       ]*) ;;
81   *) CFLAGS="$CFLAGS -Wmissing-prototypes" ;;
82   esac
83
84   case " $CFLAGS " in
85   *[\ \ ]-Wnested-externs[\ \   ]*) ;;
86   *) CFLAGS="$CFLAGS -Wnested-externs" ;;
87   esac
88
89   case " $CFLAGS " in
90   *[\ \ ]-Wpointer-arith[\ \    ]*) ;;
91   *) CFLAGS="$CFLAGS -Wpointer-arith" ;;
92   esac
93
94   case " $CFLAGS " in
95   *[\ \ ]-Wcast-align[\ \       ]*) ;;
96   *) CFLAGS="$CFLAGS -Wcast-align" ;;
97   esac
98
99   case " $CFLAGS " in
100   *[\ \ ]-Wsign-compare[\ \     ]*) ;;
101   *) CFLAGS="$CFLAGS -Wsign-compare" ;;
102   esac
103
104   if test "x$enable_ansi" = "xyes"; then
105     case " $CFLAGS " in
106     *[\ \       ]-ansi[\ \      ]*) ;;
107     *) CFLAGS="$CFLAGS -ansi" ;;
108     esac
109
110     case " $CFLAGS " in
111     *[\ \       ]-pedantic[\ \  ]*) ;;
112     *) CFLAGS="$CFLAGS -pedantic" ;;
113     esac
114   fi
115   if test x$enable_gcov = xyes; then
116     case " $CFLAGS " in
117     *[\ \       ]-fprofile-arcs[\ \     ]*) ;;
118     *) CFLAGS="$CFLAGS -fprofile-arcs" ;;
119     esac
120     case " $CFLAGS " in
121     *[\ \       ]-ftest-coverage[\ \    ]*) ;;
122     *) CFLAGS="$CFLAGS -ftest-coverage" ;;
123     esac
124
125     ## remove optimization
126     CFLAGS=`echo "$CFLAGS" | sed -e 's/-O[0-9]*//g'`
127   fi
128   changequote([,])dnl
129 else
130   if test x$enable_gcov = xyes; then
131     AC_MSG_ERROR([--enable-gcov can only be used with gcc])
132   fi
133 fi
134
135 changequote(,)dnl
136 # let ourselves use our own unstable API
137 CPPFLAGS="-DDBUS_API_SUBJECT_TO_CHANGE=1 $CPPFLAGS"
138 # compress spaces in flags
139 CFLAGS=`echo "$CFLAGS" | sed -e 's/ +/ /g'`
140 CXXFLAGS=`echo "$CXXFLAGS" | sed -e 's/ +/ /g'`
141 CPPFLAGS=`echo "$CPPFLAGS" | sed -e 's/ +/ /g'`
142 changequote([,])dnl
143
144 if test x$enable_gcov = xyes; then
145      ## so that config.h changes when you toggle gcov support
146      AC_DEFINE_UNQUOTED(DBUS_GCOV_ENABLED, 1, [Defined if gcov is enabled to force a rebuild due to config.h changing])
147 fi
148 AM_CONDITIONAL(DBUS_GCOV_ENABLED, test x$enable_gcov = xyes)
149
150 #### Integer sizes 
151
152 AC_CHECK_SIZEOF(char)
153 AC_CHECK_SIZEOF(short)
154 AC_CHECK_SIZEOF(long)
155 AC_CHECK_SIZEOF(int)
156 AC_CHECK_SIZEOF(void *)
157 AC_CHECK_SIZEOF(long long)
158 AC_CHECK_SIZEOF(__int64)
159
160 ### See what our 64 bit type is called
161 AC_MSG_CHECKING([64-bit integer type])
162
163 case 8 in
164 $ac_cv_sizeof_int)
165   dbusint64=int
166   dbusint64_constant='(val)'
167   dbusuint64_constant='(val)'
168   ;;
169 $ac_cv_sizeof_long)
170   dbusint64=long
171   dbusint64_constant='(val##L)'
172   dbusuint64_constant='(val##UL)'
173   ;;
174 $ac_cv_sizeof_long_long)
175   dbusint64='long long'
176   dbusint64_constant='(val##LL)'
177   dbusuint64_constant='(val##ULL)'
178   ;;
179 $ac_cv_sizeof___int64)
180   dbusint64=__int64
181   dbusint64_constant='(val##i64)'
182   dbusuint64_constant='(val##ui64)'
183   ;;
184 esac
185
186 if test -z "$dbusint64" ; then
187         DBUS_INT64_TYPE="no_int64_type_detected"
188         DBUS_HAVE_INT64=0
189         DBUS_INT64_CONSTANT=
190         DBUS_UINT64_CONSTANT=
191         AC_MSG_RESULT([none found])
192 else
193         DBUS_INT64_TYPE="$dbusint64"
194         DBUS_HAVE_INT64=1
195         DBUS_INT64_CONSTANT="$dbusint64_constant"
196         DBUS_UINT64_CONSTANT="$dbusuint64_constant"
197         AC_MSG_RESULT($DBUS_INT64_TYPE)
198 fi
199
200 AC_SUBST(DBUS_INT64_TYPE)
201 AC_SUBST(DBUS_INT64_CONSTANT)
202 AC_SUBST(DBUS_UINT64_CONSTANT)
203 AC_SUBST(DBUS_HAVE_INT64)
204
205 ## byte order
206 AC_C_BIGENDIAN
207
208 #### Atomic integers (checks by Sebastian Wilhelmi for GLib)
209 AC_MSG_CHECKING([whether to use inline assembler routines for atomic integers])
210 have_atomic_inc=no
211 if test x"$GCC" = xyes; then
212   case $host_cpu in
213     i386)
214       AC_MSG_RESULT([no])
215       ;;
216     i?86)
217       AC_MSG_RESULT([i486])
218       AC_DEFINE_UNQUOTED(DBUS_USE_ATOMIC_INT_486, 1, [Use atomic integer implementation for 486])
219       have_atomic_inc=yes
220       ;;
221     *)
222       AC_MSG_RESULT([no])
223       ;;
224   esac
225 fi
226 if test x$have_atomic_inc = xyes ; then
227   AC_DEFINE_UNQUOTED(DBUS_HAVE_ATOMIC_INT, 1, [Some atomic integer implementation present])
228 fi
229
230 #### Various functions
231 AC_CHECK_LIB(socket,socket)
232 AC_CHECK_LIB(nsl,gethostbyname)
233
234 AC_CHECK_FUNCS(vsnprintf vasprintf nanosleep usleep poll setenv unsetenv socketpair getgrouplist)
235
236 AC_CHECK_HEADERS(execinfo.h, [AC_CHECK_FUNCS(backtrace)])
237
238 AC_CACHE_CHECK([for posix getpwnam_r],
239                 ac_cv_func_posix_getpwnam_r,
240                 [AC_TRY_RUN([
241 #include <errno.h>
242 #include <pwd.h>
243 int main () { 
244     char buffer[10000];
245     struct passwd pwd, *pwptr = &pwd;
246     int error;
247     errno = 0;
248     error = getpwnam_r ("", &pwd, buffer, 
249                         sizeof (buffer), &pwptr);
250    return (error < 0 && errno == ENOSYS) 
251            || error == ENOSYS; 
252 }               ],
253         [ac_cv_func_posix_getpwnam_r=yes],
254         [ac_cv_func_posix_getpwnam_r=no])])
255 if test "$ac_cv_func_posix_getpwnam_r" = yes; then
256         AC_DEFINE(HAVE_POSIX_GETPWNAM_R,1,
257                 [Have POSIX function getpwnam_r])
258 else
259         AC_CACHE_CHECK([for nonposix getpwnam_r],
260                 ac_cv_func_nonposix_getpwnam_r,
261                 [AC_TRY_LINK([#include <pwd.h>],
262                         [char buffer[10000];
263                         struct passwd pwd;
264                         getpwnam_r ("", &pwd, buffer, 
265                                         sizeof (buffer));],
266                         [ac_cv_func_nonposix_getpwnam_r=yes],
267                         [ac_cv_func_nonposix_getpwnam_r=no])])
268                 if test "$ac_cv_func_nonposix_getpwnam_r" = yes; then
269                 AC_DEFINE(HAVE_NONPOSIX_GETPWNAM_R,1,
270                         [Have non-POSIX function getpwnam_r])
271         fi
272 fi
273
274 dnl check for writev header and writev function so we're 
275 dnl good to go if HAVE_WRITEV gets defined.
276 AC_CHECK_HEADERS(sys/uio.h, [AC_CHECK_FUNCS(writev)])
277
278 dnl check for flavours of varargs macros (test from GLib)
279 AC_MSG_CHECKING(for ISO C99 varargs macros in C)
280 AC_TRY_COMPILE([],[
281 int a(int p1, int p2, int p3);
282 #define call_a(...) a(1,__VA_ARGS__)
283 call_a(2,3);
284 ],dbus_have_iso_c_varargs=yes,dbus_have_iso_c_varargs=no)
285 AC_MSG_RESULT($dbus_have_iso_c_varargs)
286
287 AC_MSG_CHECKING(for GNUC varargs macros)
288 AC_TRY_COMPILE([],[
289 int a(int p1, int p2, int p3);
290 #define call_a(params...) a(1,params)
291 call_a(2,3);
292 ],dbus_have_gnuc_varargs=yes,dbus_have_gnuc_varargs=no)
293 AC_MSG_RESULT($dbus_have_gnuc_varargs)
294
295 dnl Output varargs tests
296 if test x$dbus_have_iso_c_varargs = xyes; then
297     AC_DEFINE(HAVE_ISO_VARARGS,1,[Have ISO C99 varargs macros])
298 fi
299 if test x$dbus_have_gnuc_varargs = xyes; then
300     AC_DEFINE(HAVE_GNUC_VARARGS,1,[Have GNU-style varargs macros])
301 fi
302
303 dnl Check for various credentials.
304 AC_MSG_CHECKING(for struct cmsgcred)
305 AC_TRY_COMPILE([
306 #include <sys/types.h>
307 #include <sys/socket.h>
308 ],[
309 struct cmsgcred cred;
310
311 cred.cmcred_pid = 0;
312 ],dbus_have_struct_cmsgcred=yes,dbus_have_struct_cmsgcred=no)
313 AC_MSG_RESULT($dbus_have_struct_cmsgcred)
314
315 if test x$dbus_have_struct_cmsgcred = xyes; then
316     AC_DEFINE(HAVE_CMSGCRED,1,[Have cmsgcred structure])
317 fi
318
319
320 #### Sort out XML library
321
322 # see what we have
323 AC_CHECK_LIB(expat, XML_ParserCreate_MM, 
324              [ AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false) ],
325              have_expat=false)
326
327 PKG_CHECK_MODULES(LIBXML, libxml-2.0, have_libxml=true, have_libxml=false)
328
329 # see what we want to use
330 dbus_use_libxml=false
331 dbus_use_expat=false
332 if test x$with_xml = xexpat; then
333         dbus_use_expat=true
334         if ! $have_expat ; then
335            AC_MSG_ERROR([Explicitly requested expat but expat not found])
336         fi
337 elif test x$with_xml = xlibxml; then
338         dbus_use_libxml=true
339         if ! $have_libxml ; then
340            AC_MSG_ERROR([Explicitly requested libxml but libxml not found])
341         fi
342 else
343         ### expat is the default because libxml can't currently survive 
344         ### our brutal OOM-handling unit test setup.
345         ### http://bugzilla.gnome.org/show_bug.cgi?id=109368
346         if $have_expat ; then
347                 with_xml=expat
348                 dbus_use_expat=true
349         elif $have_libxml ; then
350                 with_xml=libxml
351                 dbus_use_libxml=true
352         else
353                 AC_MSG_ERROR([No XML library found, check config.log for failed attempts])
354         fi
355 fi
356
357 AM_CONDITIONAL(DBUS_USE_EXPAT, $dbus_use_expat)
358 AM_CONDITIONAL(DBUS_USE_LIBXML, $dbus_use_libxml)
359
360 if $dbus_use_expat; then
361    XML_LIBS=-lexpat
362    XML_CFLAGS=
363 fi
364 if $dbus_use_libxml; then
365    XML_LIBS=$LIBXML_LIBS
366    XML_CFLAGS=$LIBXML_CFLAGS
367 fi
368
369 #### Set up final flags
370 DBUS_CLIENT_CFLAGS=
371 DBUS_CLIENT_LIBS=
372 AC_SUBST(DBUS_CLIENT_CFLAGS)
373 AC_SUBST(DBUS_CLIENT_LIBS)
374
375 DBUS_BUS_CFLAGS=$XML_CFLAGS
376 DBUS_BUS_LIBS=$XML_LIBS
377 AC_SUBST(DBUS_BUS_CFLAGS)
378 AC_SUBST(DBUS_BUS_LIBS)
379
380 DBUS_TEST_CFLAGS=
381 DBUS_TEST_LIBS=
382 AC_SUBST(DBUS_TEST_CFLAGS)
383 AC_SUBST(DBUS_TEST_LIBS)
384
385 # Glib detection
386 PKG_CHECK_MODULES(DBUS_GLIB, glib-2.0, have_glib=yes, have_glib=no)
387 PKG_CHECK_MODULES(DBUS_GLIB_THREADS, glib-2.0 gthread-2.0, have_glib_threads=yes, have_glib_threads=no)
388
389 if test x$have_glib = xno ; then
390     AC_MSG_WARN([GLib development libraries not found])
391 fi
392
393 if test x$enable_glib = xyes; then
394     if test x$have_glib = xno; then
395         AC_MSG_ERROR([GLib explicitly required, and GLib development libraries not found])
396     fi
397 fi
398
399 if test x$enable_glib = xno; then
400    have_glib=no;
401 fi
402
403 AM_CONDITIONAL(HAVE_GLIB, test x$have_glib = xyes)
404 AM_CONDITIONAL(HAVE_GLIB_THREADS, test x$have_glib_threads = xyes)
405
406 dnl GLib flags
407 AC_SUBST(DBUS_GLIB_CFLAGS)
408 AC_SUBST(DBUS_GLIB_LIBS)
409 AC_SUBST(DBUS_GLIB_THREADS_LIBS)
410
411 # Qt detection
412 have_qt=no
413 AC_MSG_CHECKING([for qglobal.h])
414 if test -n "$QTDIR" -a -f "$QTDIR/include/qglobal.h"; then
415     have_qt=yes
416     DBUS_QT_CXXFLAGS="-I$QTDIR/include"
417 else
418     for dir in "${prefix}/include/qt" "/usr/include/qt-3.1" "/usr/include/qt3" "/usr/include/qt" "/usr/lib/qt/include"; do
419         if test -f "$dir/qglobal.h"; then
420             have_qt=yes
421             DBUS_QT_CXXFLAGS="-I$dir"
422        fi
423     done
424 fi
425 if test x"$have_qt" = x"yes"; then
426    AC_MSG_RESULT([found])
427 else
428    AC_MSG_RESULT([not found])
429 fi
430
431 dnl linking to kdecore will give us a bit of help from libtool
432 if (! kde-config >& /dev/null); then
433     have_qt=no
434 else
435     kdelibs=`kde-config --install lib --expandvars 2>/dev/null`
436     if test -z $kdelibs -o ! -f $kdelibs/libkdecore.la; then
437         have_qt=no
438     else
439         DBUS_QT_LIBS="$kdelibs/libkdecore.la"
440     fi
441 fi
442
443 if test x$have_qt = xno ; then
444     AC_MSG_WARN([Qt development libraries not found])
445 fi
446
447 if test x$enable_qt = xyes; then
448     if test x$have_qt = xno; then
449         AC_MSG_ERROR([Qt integration explicitly required, and Qt libraries not found])
450     fi
451 fi
452
453 if test x$enable_qt = xno; then
454    have_qt=no;
455 fi
456
457 AM_CONDITIONAL(HAVE_QT, test x$have_qt = xyes)
458
459 dnl Qt flags
460 AC_SUBST(DBUS_QT_CXXFLAGS)
461 AC_SUBST(DBUS_QT_LIBS)
462
463 ### X11 detection
464 AC_PATH_XTRA
465
466 ## for now enable_x11 just tracks have_x11, 
467 ## there's no --enable-x11
468 if test x$no_x = xyes ; then
469    have_x11=no
470    enable_x11=no
471 else
472    have_x11=yes
473    enable_x11=yes
474 fi
475
476 if test x$enable_x11 = xyes ; then
477    AC_DEFINE(DBUS_BUILD_X11,1,[Build X11-dependent code])
478    DBUS_X_LIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
479    DBUS_X_CFLAGS="$X_CFLAGS"
480 else
481    DBUS_X_LIBS=
482    DBUS_X_CFLAGS=
483 fi
484
485 AC_SUBST(DBUS_X_CFLAGS)
486 AC_SUBST(DBUS_X_LIBS)
487
488 ### Documentation
489
490 AC_PATH_PROG(DOXYGEN, doxygen, no)
491 AC_PATH_PROG(DB2HTML, db2html, no)
492
493 AC_MSG_CHECKING([whether to build documentation])
494
495 if test x$DOXYGEN = xno -o x$DB2HTML = xno ; then
496     have_docs_tools=no
497 else
498     have_docs_tools=yes
499 fi
500
501 if test x$enable_docs = xauto ; then
502     if test x$have_docs_tools = xno ; then
503         enable_docs=no
504     else
505         enable_docs=yes
506     fi
507 fi
508
509 if test x$enable_docs = xyes; then
510     if test x$have_docs_tools = xno; then
511         AC_MSG_ERROR([Building docs explicitly required, but Doxygen or db2html not found])
512     fi
513 fi
514
515 AM_CONDITIONAL(DBUS_DOCS_ENABLED, test x$enable_docs = xyes)
516 AC_MSG_RESULT(yes)
517
518 #### find the actual value for $prefix that we'll end up with
519 ##   (I know this is broken and should be done in the Makefile, but
520 ##    that's a major pain and almost nobody actually seems to care)
521 REAL_PREFIX=
522 if test "x$prefix" = "xNONE"; then
523   REAL_PREFIX=$ac_default_prefix
524 else
525   REAL_PREFIX=$prefix
526 fi
527
528 #### Have to go $localstatedir->$prefix/var->/usr/local/var   
529 #### someone please fix this a better way...
530 LOCALSTATEDIR_TMP="$localstatedir"
531 old_prefix=$prefix
532 prefix=$REAL_PREFIX
533 EXPANDED_LOCALSTATEDIR=`eval echo $LOCALSTATEDIR_TMP`
534 prefix=$old_prefix
535 AC_SUBST(EXPANDED_LOCALSTATEDIR)
536
537 SYSCONFDIR_TMP="$sysconfdir"
538 old_prefix=$prefix
539 prefix=$REAL_PREFIX
540 EXPANDED_SYSCONFDIR=`eval echo $SYSCONFDIR_TMP`
541 prefix=$old_prefix
542 AC_SUBST(EXPANDED_SYSCONFDIR)
543
544 BINDIR_TMP="$bindir"
545 old_prefix=$prefix
546 prefix=$REAL_PREFIX
547 EXPANDED_BINDIR=`eval echo $BINDIR_TMP`
548 prefix=$old_prefix
549 AC_SUBST(EXPANDED_BINDIR)
550
551 old_exec_prefix=${exec_prefix}
552 test "x$exec_prefix" = xNONE && eval exec_prefix=${prefix}
553 eval EXPANDED_LIBDIR=${libdir}
554 exec_prefix=${old_exec_prefix}
555 AC_SUBST(EXPANDED_LIBDIR)
556
557 #### Check our operating system
558 operating_system=unknown
559 if test -f /etc/redhat-release || test -f $EXPANDED_SYSCONFDIR/redhat-release ; then
560    operating_system=redhat
561 fi
562
563 #### Sort out init scripts
564
565 if test x$with_init_scripts = x; then
566     if test xredhat = x$operating_system ; then
567         with_init_scripts=redhat
568     else
569         with_init_scripts=none
570     fi
571 fi
572
573 AM_CONDITIONAL(DBUS_INIT_SCRIPTS_RED_HAT, test x$with_init_scripts = xredhat)
574
575
576 ##### Set up location for system bus socket
577 if ! test -z "$with_system_socket"; then
578    DBUS_SYSTEM_SOCKET=$with_system_socket
579 else
580    DBUS_SYSTEM_SOCKET=${EXPANDED_LOCALSTATEDIR}/run/dbus/system_bus_socket
581 fi
582
583 AC_SUBST(DBUS_SYSTEM_SOCKET)
584
585 #### Set up the pid file
586 if ! test -z "$with_system_pid_file"; then
587    DBUS_SYSTEM_PID_FILE=$with_system_pid_file
588 elif test x$operating_system = xredhat ; then
589    DBUS_SYSTEM_PID_FILE=${EXPANDED_LOCALSTATEDIR}/run/messagebus.pid
590 else
591    DBUS_SYSTEM_PID_FILE=${EXPANDED_LOCALSTATEDIR}/run/dbus/pid
592 fi
593
594 AC_SUBST(DBUS_SYSTEM_PID_FILE)
595
596 #### Tell tests where to find certain stuff in builddir
597 ABSOLUTE_TOP_BUILDDIR=`cd ${ac_top_builddir}. && pwd`
598
599 AC_DEFUN(TEST_PATH, [
600 TEST_$1=${ABSOLUTE_TOP_BUILDDIR}/test/$2
601 AC_DEFINE_UNQUOTED(TEST_$1, "$TEST_$1",
602                    [Full path to test file test/$2 in builddir])
603 AC_SUBST(TEST_$1)
604 ])
605
606 TEST_PATH(SERVICE_DIR, data/valid-service-files)
607 TEST_PATH(SERVICE_BINARY, test-service)
608 TEST_PATH(EXIT_BINARY, test-exit)
609 TEST_PATH(SEGFAULT_BINARY, test-segfault)
610 TEST_PATH(SLEEP_FOREVER_BINARY, test-sleep-forever)
611
612 #### Find socket directories
613 if ! test -z "$TMPDIR" ; then
614    DEFAULT_SOCKET_DIR=$TMPDIR
615 elif ! test -z "$TEMP" ; then
616    DEFAULT_SOCKET_DIR=$TEMP
617 elif ! test -z "$TMP" ; then
618    DEFAULT_SOCKET_DIR=$TMP
619 else
620    DEFAULT_SOCKET_DIR=/tmp
621 fi
622
623 if ! test -z "$with_test_socket_dir" ; then
624    TEST_SOCKET_DIR="$with_test_socket_dir"
625 else
626    TEST_SOCKET_DIR=$DEFAULT_SOCKET_DIR
627 fi
628 AC_SUBST(TEST_SOCKET_DIR)
629 AC_DEFINE_UNQUOTED(DBUS_TEST_SOCKET_DIR, "$TEST_SOCKET_DIR", [Where to put test sockets])
630
631 if ! test -z "$with_session_socket_dir" ; then
632    DBUS_SESSION_SOCKET_DIR="$with_session_socket_dir"
633 else
634    DBUS_SESSION_SOCKET_DIR=$DEFAULT_SOCKET_DIR
635 fi
636 AC_SUBST(DBUS_SESSION_SOCKET_DIR)
637
638
639
640 AC_OUTPUT([
641 Doxyfile
642 dbus/dbus-arch-deps.h
643 bus/system.conf
644 bus/session.conf
645 bus/messagebus
646 bus/dbus-daemon-1.1
647 Makefile
648 dbus/Makefile
649 glib/Makefile
650 qt/Makefile
651 bus/Makefile
652 tools/Makefile
653 test/Makefile
654 doc/Makefile
655 dbus-1.pc
656 dbus-glib-1.pc
657 test/data/valid-config-files/debug-allow-all.conf
658 test/data/valid-config-files/debug-allow-all-sha1.conf
659 test/data/valid-service-files/debug-echo.service
660 test/data/valid-service-files/debug-segfault.service
661 ])
662
663 ### FIXME it's bizarre that have_qt and have_glib are used
664 ### instead of enable_ - should fix things so that enable 
665 ### is always whether it's enabled, and have is always whether 
666 ### it was found.
667
668 dnl ==========================================================================
669 echo "
670                     D-BUS $VERSION
671                   ==============
672
673         prefix:                   ${prefix}
674         source code location:     ${srcdir}
675         compiler:                 ${CC}
676         cflags:                   ${CFLAGS}
677         cppflags:                 ${CPPFLAGS}
678         cxxflags:                 ${CXXFLAGS}
679         Doxygen:                  ${DOXYGEN}
680         db2html:                  ${DB2HTML}
681
682         Maintainer mode:          ${USE_MAINTAINER_MODE}
683         gcc coverage profiling:   ${enable_gcov}
684         Building unit tests:      ${enable_tests}
685         Building verbose mode:    ${enable_verbose_mode}
686         Building assertions:      ${enable_asserts}
687         Building checks:          ${enable_checks}
688         Building Qt bindings:     ${have_qt}
689         Building GLib bindings:   ${have_glib}
690         Building X11 code:        ${enable_x11}
691         Building documentation:   ${enable_docs}
692         Using XML parser:         ${with_xml}
693         Init scripts style:       ${with_init_scripts}
694         System bus socket:        ${DBUS_SYSTEM_SOCKET}
695         System bus PID file:      ${DBUS_SYSTEM_PID_FILE}
696         Session bus socket dir:   ${DBUS_SESSION_SOCKET_DIR}
697         'make check' socket dir:  ${TEST_SOCKET_DIR}
698 "
699
700 if test x$enable_tests = xyes; then
701         echo "NOTE: building with unit tests increases the size of the installed library and renders it insecure."
702 fi
703 if test x$enable_tests = xyes -a x$enable_asserts = xno; then
704         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)"
705 fi
706 if test x$enable_gcov = xyes; then
707         echo "NOTE: building with coverage profiling is definitely for developers only."
708 fi
709 if test x$enable_verbose_mode = xyes; then
710         echo "NOTE: building with verbose mode increases library size, may slightly increase security risk, and decreases performance."
711 fi
712 if test x$enable_asserts = xyes; then
713         echo "NOTE: building with assertions increases library size and decreases performance."
714 fi
715 if test x$enable_checks = xno; then
716         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."
717 fi