6 AM_INIT_AUTOMAKE(dbus, 0.10)
8 AM_CONFIG_HEADER(config.h)
11 ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
13 GETTEXT_PACKAGE=dbus-1
14 AC_SUBST(GETTEXT_PACKAGE)
15 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[The name of the gettext domain])
17 ## must come before we use the $USE_MAINTAINER_MODE variable later
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)
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])
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])
50 if test x$enable_verbose_mode = xyes; then
51 AC_DEFINE(DBUS_ENABLE_VERBOSE_MODE,1,[Support a verbose mode])
53 if test x$enable_asserts = xno; then
54 AC_DEFINE(DBUS_DISABLE_ASSERT,1,[Disable assertion checking])
56 if test x$enable_checks = xno; then
57 AC_DEFINE(DBUS_DISABLE_CHECKS,1,[Disable public API sanity checking])
60 #### gcc warning flags
62 if test "x$GCC" = "xyes"; then
65 *[\ \ ]-Wall[\ \ ]*) ;;
66 *) CFLAGS="$CFLAGS -Wall" ;;
70 *[\ \ ]-Wchar-subscripts[\ \ ]*) ;;
71 *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
75 *[\ \ ]-Wmissing-declarations[\ \ ]*) ;;
76 *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
80 *[\ \ ]-Wmissing-prototypes[\ \ ]*) ;;
81 *) CFLAGS="$CFLAGS -Wmissing-prototypes" ;;
85 *[\ \ ]-Wnested-externs[\ \ ]*) ;;
86 *) CFLAGS="$CFLAGS -Wnested-externs" ;;
90 *[\ \ ]-Wpointer-arith[\ \ ]*) ;;
91 *) CFLAGS="$CFLAGS -Wpointer-arith" ;;
95 *[\ \ ]-Wcast-align[\ \ ]*) ;;
96 *) CFLAGS="$CFLAGS -Wcast-align" ;;
100 *[\ \ ]-Wsign-compare[\ \ ]*) ;;
101 *) CFLAGS="$CFLAGS -Wsign-compare" ;;
104 if test "x$enable_ansi" = "xyes"; then
106 *[\ \ ]-ansi[\ \ ]*) ;;
107 *) CFLAGS="$CFLAGS -ansi" ;;
111 *[\ \ ]-pedantic[\ \ ]*) ;;
112 *) CFLAGS="$CFLAGS -pedantic" ;;
115 if test x$enable_gcov = xyes; then
117 *[\ \ ]-fprofile-arcs[\ \ ]*) ;;
118 *) CFLAGS="$CFLAGS -fprofile-arcs" ;;
121 *[\ \ ]-ftest-coverage[\ \ ]*) ;;
122 *) CFLAGS="$CFLAGS -ftest-coverage" ;;
125 ## remove optimization
126 CFLAGS=`echo "$CFLAGS" | sed -e 's/-O[0-9]*//g'`
130 if test x$enable_gcov = xyes; then
131 AC_MSG_ERROR([--enable-gcov can only be used with gcc])
135 # compress spaces in cflags
136 CFLAGS=`echo "$CFLAGS" | sed -e 's/ +/ /g'`
138 if test x$enable_gcov = xyes; then
139 ## so that config.h changes when you toggle gcov support
140 AC_DEFINE_UNQUOTED(DBUS_GCOV_ENABLED, 1, [Defined if gcov is enabled to force a rebuild due to config.h changing])
142 AM_CONDITIONAL(DBUS_GCOV_ENABLED, test x$enable_gcov = xyes)
146 AC_CHECK_SIZEOF(char)
147 AC_CHECK_SIZEOF(short)
148 AC_CHECK_SIZEOF(long)
150 AC_CHECK_SIZEOF(void *)
151 AC_CHECK_SIZEOF(long long)
152 AC_CHECK_SIZEOF(__int64)
154 ### See what our 64 bit type is called
155 AC_MSG_CHECKING([64-bit integer type])
160 dbusint64_constant='(val)'
161 dbusuint64_constant='(val)'
165 dbusint64_constant='(val##L)'
166 dbusuint64_constant='(val##UL)'
168 $ac_cv_sizeof_long_long)
169 dbusint64='long long'
170 dbusint64_constant='(val##LL)'
171 dbusuint64_constant='(val##ULL)'
173 $ac_cv_sizeof___int64)
175 dbusint64_constant='(val##i64)'
176 dbusuint64_constant='(val##ui64)'
180 if test -z "$dbusint64" ; then
181 DBUS_INT64_TYPE="no_int64_type_detected"
184 DBUS_UINT64_CONSTANT=
185 AC_MSG_RESULT([none found])
187 DBUS_INT64_TYPE="$dbusint64"
189 DBUS_INT64_CONSTANT="$dbusint64_constant"
190 DBUS_UINT64_CONSTANT="$dbusuint64_constant"
191 AC_MSG_RESULT($DBUS_INT64_TYPE)
194 AC_SUBST(DBUS_INT64_TYPE)
195 AC_SUBST(DBUS_INT64_CONSTANT)
196 AC_SUBST(DBUS_UINT64_CONSTANT)
197 AC_SUBST(DBUS_HAVE_INT64)
202 #### Various functions
203 AC_CHECK_LIB(socket,socket)
204 AC_CHECK_LIB(nsl,gethostbyname)
206 AC_CHECK_FUNCS(vsnprintf vasprintf nanosleep usleep poll setenv unsetenv socketpair getgrouplist)
208 AC_CHECK_HEADERS(execinfo.h, [AC_CHECK_FUNCS(backtrace)])
210 AC_CACHE_CHECK([for posix getpwnam_r],
211 ac_cv_func_posix_getpwnam_r,
217 struct passwd pwd, *pwptr = &pwd;
220 error = getpwnam_r ("", &pwd, buffer,
221 sizeof (buffer), &pwptr);
222 return (error < 0 && errno == ENOSYS)
225 [ac_cv_func_posix_getpwnam_r=yes],
226 [ac_cv_func_posix_getpwnam_r=no])])
227 if test "$ac_cv_func_posix_getpwnam_r" = yes; then
228 AC_DEFINE(HAVE_POSIX_GETPWNAM_R,1,
229 [Have POSIX function getpwnam_r])
231 AC_CACHE_CHECK([for nonposix getpwnam_r],
232 ac_cv_func_nonposix_getpwnam_r,
233 [AC_TRY_LINK([#include <pwd.h>],
236 getpwnam_r ("", &pwd, buffer,
238 [ac_cv_func_nonposix_getpwnam_r=yes],
239 [ac_cv_func_nonposix_getpwnam_r=no])])
240 if test "$ac_cv_func_nonposix_getpwnam_r" = yes; then
241 AC_DEFINE(HAVE_NONPOSIX_GETPWNAM_R,1,
242 [Have non-POSIX function getpwnam_r])
246 dnl check for writev header and writev function so we're
247 dnl good to go if HAVE_WRITEV gets defined.
248 AC_CHECK_HEADERS(sys/uio.h, [AC_CHECK_FUNCS(writev)])
250 dnl check for flavours of varargs macros (test from GLib)
251 AC_MSG_CHECKING(for ISO C99 varargs macros in C)
253 int a(int p1, int p2, int p3);
254 #define call_a(...) a(1,__VA_ARGS__)
256 ],dbus_have_iso_c_varargs=yes,dbus_have_iso_c_varargs=no)
257 AC_MSG_RESULT($dbus_have_iso_c_varargs)
259 AC_MSG_CHECKING(for GNUC varargs macros)
261 int a(int p1, int p2, int p3);
262 #define call_a(params...) a(1,params)
264 ],dbus_have_gnuc_varargs=yes,dbus_have_gnuc_varargs=no)
265 AC_MSG_RESULT($dbus_have_gnuc_varargs)
267 dnl Output varargs tests
268 if test x$dbus_have_iso_c_varargs = xyes; then
269 AC_DEFINE(HAVE_ISO_VARARGS,1,[Have ISO C99 varargs macros])
271 if test x$dbus_have_gnuc_varargs = xyes; then
272 AC_DEFINE(HAVE_GNUC_VARARGS,1,[Have GNU-style varargs macros])
275 dnl Check for various credentials.
276 AC_MSG_CHECKING(for struct cmsgcred)
278 #include <sys/types.h>
279 #include <sys/socket.h>
281 struct cmsgcred cred;
284 ],dbus_have_struct_cmsgcred=yes,dbus_have_struct_cmsgcred=no)
285 AC_MSG_RESULT($dbus_have_struct_cmsgcred)
287 if test x$dbus_have_struct_cmsgcred = xyes; then
288 AC_DEFINE(HAVE_CMSGCRED,1,[Have cmsgcred structure])
292 #### Sort out XML library
295 AC_CHECK_LIB(expat, XML_ParserCreate_MM,
296 [ AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false) ],
299 PKG_CHECK_MODULES(LIBXML, libxml-2.0, have_libxml=true, have_libxml=false)
301 # see what we want to use
302 dbus_use_libxml=false
304 if test x$with_xml = xexpat; then
306 if ! $have_expat ; then
307 AC_MSG_ERROR([Explicitly requested expat but expat not found])
309 elif test x$with_xml = xlibxml; then
311 if ! $have_libxml ; then
312 AC_MSG_ERROR([Explicitly requested libxml but libxml not found])
315 ### expat is the default because libxml can't currently survive
316 ### our brutal OOM-handling unit test setup.
317 ### http://bugzilla.gnome.org/show_bug.cgi?id=109368
318 if $have_expat ; then
321 elif $have_libxml ; then
325 AC_MSG_ERROR([No XML library found, check config.log for failed attempts])
329 AM_CONDITIONAL(DBUS_USE_EXPAT, $dbus_use_expat)
330 AM_CONDITIONAL(DBUS_USE_LIBXML, $dbus_use_libxml)
332 if $dbus_use_expat; then
336 if $dbus_use_libxml; then
337 XML_LIBS=$LIBXML_LIBS
338 XML_CFLAGS=$LIBXML_CFLAGS
341 #### Set up final flags
344 AC_SUBST(DBUS_CLIENT_CFLAGS)
345 AC_SUBST(DBUS_CLIENT_LIBS)
347 DBUS_BUS_CFLAGS=$XML_CFLAGS
348 DBUS_BUS_LIBS=$XML_LIBS
349 AC_SUBST(DBUS_BUS_CFLAGS)
350 AC_SUBST(DBUS_BUS_LIBS)
354 AC_SUBST(DBUS_TEST_CFLAGS)
355 AC_SUBST(DBUS_TEST_LIBS)
358 PKG_CHECK_MODULES(DBUS_GLIB, glib-2.0, have_glib=yes, have_glib=no)
359 PKG_CHECK_MODULES(DBUS_GLIB_THREADS, glib-2.0 gthread-2.0, have_glib_threads=yes, have_glib_threads=no)
361 if test x$have_glib = xno ; then
362 AC_MSG_WARN([GLib development libraries not found])
365 if test x$enable_glib = xyes; then
366 if test x$have_glib = xno; then
367 AC_MSG_ERROR([GLib explicitly required, and GLib development libraries not found])
371 if test x$enable_glib = xno; then
375 AM_CONDITIONAL(HAVE_GLIB, test x$have_glib = xyes)
376 AM_CONDITIONAL(HAVE_GLIB_THREADS, test x$have_glib_threads = xyes)
379 AC_SUBST(DBUS_GLIB_CFLAGS)
380 AC_SUBST(DBUS_GLIB_LIBS)
381 AC_SUBST(DBUS_GLIB_THREADS_LIBS)
385 AC_MSG_CHECKING([for qglobal.h])
386 if test -n "$QTDIR" -a -f "$QTDIR/include/qglobal.h"; then
388 DBUS_QT_CXXFLAGS="-I$QTDIR/include"
390 for dir in "${prefix}/include/qt" "/usr/include/qt-3.1" "/usr/include/qt3" "/usr/include/qt" "/usr/lib/qt/include"; do
391 if test -f "$dir/qglobal.h"; then
393 DBUS_QT_CXXFLAGS="-I$dir"
397 if test x"$have_qt" = x"yes"; then
398 AC_MSG_RESULT([found])
400 AC_MSG_RESULT([not found])
403 dnl linking to kdecore will give us a bit of help from libtool
404 if (! kde-config >& /dev/null); then
407 kdelibs=`kde-config --install lib --expandvars 2>/dev/null`
408 if test -z $kdelibs -o ! -f $kdelibs/libkdecore.la; then
411 DBUS_QT_LIBS="$kdelibs/libkdecore.la"
415 if test x$have_qt = xno ; then
416 AC_MSG_WARN([Qt development libraries not found])
419 if test x$enable_qt = xyes; then
420 if test x$have_qt = xno; then
421 AC_MSG_ERROR([Qt integration explicitly required, and Qt libraries not found])
425 if test x$enable_qt = xno; then
429 AM_CONDITIONAL(HAVE_QT, test x$have_qt = xyes)
432 AC_SUBST(DBUS_QT_CXXFLAGS)
433 AC_SUBST(DBUS_QT_LIBS)
437 AC_PATH_PROG(DOXYGEN, doxygen, no)
438 AC_PATH_PROG(DB2HTML, db2html, no)
440 AC_MSG_CHECKING([whether to build documentation])
442 if test x$DOXYGEN = xno -o x$DB2HTML = xno ; then
448 if test x$enable_docs = xauto ; then
449 if test x$have_docs_tools = xno ; then
456 if test x$enable_docs = xyes; then
457 if test x$have_docs_tools = xno; then
458 AC_MSG_ERROR([Building docs explicitly required, but Doxygen or db2html not found])
462 AM_CONDITIONAL(DBUS_DOCS_ENABLED, test x$enable_docs = xyes)
465 #### find the actual value for $prefix that we'll end up with
466 ## (I know this is broken and should be done in the Makefile, but
467 ## that's a major pain and almost nobody actually seems to care)
469 if test "x$prefix" = "xNONE"; then
470 REAL_PREFIX=$ac_default_prefix
475 #### Have to go $localstatedir->$prefix/var->/usr/local/var
476 #### someone please fix this a better way...
477 LOCALSTATEDIR_TMP="$localstatedir"
480 EXPANDED_LOCALSTATEDIR=`eval echo $LOCALSTATEDIR_TMP`
482 AC_SUBST(EXPANDED_LOCALSTATEDIR)
484 SYSCONFDIR_TMP="$sysconfdir"
487 EXPANDED_SYSCONFDIR=`eval echo $SYSCONFDIR_TMP`
489 AC_SUBST(EXPANDED_SYSCONFDIR)
494 EXPANDED_BINDIR=`eval echo $BINDIR_TMP`
496 AC_SUBST(EXPANDED_BINDIR)
498 #### Check our operating system
499 operating_system=unknown
500 if test -f /etc/redhat-release || test -f $EXPANDED_SYSCONFDIR/redhat-release ; then
501 operating_system=redhat
504 #### Sort out init scripts
506 if test x$with_init_scripts = x; then
507 if test xredhat = x$operating_system ; then
508 with_init_scripts=redhat
510 with_init_scripts=none
514 AM_CONDITIONAL(DBUS_INIT_SCRIPTS_RED_HAT, test x$with_init_scripts = xredhat)
517 ##### Set up location for system bus socket
518 if ! test -z "$with_system_socket"; then
519 DBUS_SYSTEM_SOCKET=$with_system_socket
521 DBUS_SYSTEM_SOCKET=${EXPANDED_LOCALSTATEDIR}/run/dbus/system_bus_socket
524 AC_SUBST(DBUS_SYSTEM_SOCKET)
526 #### Set up the pid file
527 if ! test -z "$with_system_pid_file"; then
528 DBUS_SYSTEM_PID_FILE=$with_system_pid_file
529 elif test x$operating_system = xredhat ; then
530 DBUS_SYSTEM_PID_FILE=${EXPANDED_LOCALSTATEDIR}/run/messagebus.pid
532 DBUS_SYSTEM_PID_FILE=${EXPANDED_LOCALSTATEDIR}/run/dbus/pid
535 AC_SUBST(DBUS_SYSTEM_PID_FILE)
537 #### Tell tests where to find certain stuff in builddir
538 ABSOLUTE_TOP_BUILDDIR=`cd ${ac_top_builddir}. && pwd`
540 AC_DEFUN(TEST_PATH, [
541 TEST_$1=${ABSOLUTE_TOP_BUILDDIR}/test/$2
542 AC_DEFINE_UNQUOTED(TEST_$1, "$TEST_$1",
543 [Full path to test file test/$2 in builddir])
547 TEST_PATH(SERVICE_DIR, data/valid-service-files)
548 TEST_PATH(SERVICE_BINARY, test-service)
549 TEST_PATH(EXIT_BINARY, test-exit)
550 TEST_PATH(SEGFAULT_BINARY, test-segfault)
551 TEST_PATH(SLEEP_FOREVER_BINARY, test-sleep-forever)
553 #### Find socket directories
554 if ! test -z "$TMPDIR" ; then
555 DEFAULT_SOCKET_DIR=$TMPDIR
556 elif ! test -z "$TEMP" ; then
557 DEFAULT_SOCKET_DIR=$TEMP
558 elif ! test -z "$TMP" ; then
559 DEFAULT_SOCKET_DIR=$TMP
561 DEFAULT_SOCKET_DIR=/tmp
564 if ! test -z "$with_test_socket_dir" ; then
565 TEST_SOCKET_DIR="$with_test_socket_dir"
567 TEST_SOCKET_DIR=$DEFAULT_SOCKET_DIR
569 AC_SUBST(TEST_SOCKET_DIR)
571 if ! test -z "$with_session_socket_dir" ; then
572 DBUS_SESSION_SOCKET_DIR="$with_session_socket_dir"
574 DBUS_SESSION_SOCKET_DIR=$DEFAULT_SOCKET_DIR
576 AC_SUBST(DBUS_SESSION_SOCKET_DIR)
586 dbus/dbus-arch-deps.h
595 test/data/valid-config-files/debug-allow-all.conf
596 test/data/valid-config-files/debug-allow-all-sha1.conf
597 test/data/valid-service-files/debug-echo.service
598 test/data/valid-service-files/debug-segfault.service
601 dnl ==========================================================================
607 source code location: ${srcdir}
613 Maintainer mode: ${USE_MAINTAINER_MODE}
614 gcc coverage profiling: ${enable_gcov}
615 Building unit tests: ${enable_tests}
616 Building verbose mode: ${enable_verbose_mode}
617 Building assertions: ${enable_asserts}
618 Building checks: ${enable_checks}
619 Building Qt bindings: ${have_qt}
620 Building GLib bindings: ${have_glib}
621 Building documentation: ${enable_docs}
622 Using XML parser: ${with_xml}
623 Init scripts style: ${with_init_scripts}
624 System bus socket: ${DBUS_SYSTEM_SOCKET}
625 System bus PID file: ${DBUS_SYSTEM_PID_FILE}
626 Session bus socket dir: ${DBUS_SESSION_SOCKET_DIR}
627 'make check' socket dir: ${TEST_SOCKET_DIR}
630 if test x$enable_tests = xyes; then
631 echo "NOTE: building with unit tests increases the size of the installed library and renders it insecure."
633 if test x$enable_gcov = xyes; then
634 echo "NOTE: building with coverage profiling is definitely for developers only."
636 if test x$enable_verbose_mode = xyes; then
637 echo "NOTE: building with verbose mode increases library size, may slightly increase security risk, and decreases performance."
639 if test x$enable_asserts = xyes; then
640 echo "NOTE: building with assertions increases library size and decreases performance."
642 if test x$enable_checks = xno; then
643 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."