6 AM_INIT_AUTOMAKE(dbus, 0.3)
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=yes)
31 AC_ARG_ENABLE(asserts, [ --enable-asserts include assertion checks],enable_asserts=$enableval,enable_asserts=yes)
32 AC_ARG_ENABLE(gcov, [ --enable-gcov compile with coverage profiling instrumentation (gcc only)],enable_gcov=$enableval,enable_gcov=no)
34 dnl DBUS_BUILD_TESTS controls unit tests built in to .c files
35 dnl and also some stuff in the test/ subdir
36 AM_CONDITIONAL(DBUS_BUILD_TESTS, test x$enable_tests = xyes)
37 if test x$enable_tests = xyes; then
38 AC_DEFINE(DBUS_BUILD_TESTS,1,[Build test code])
41 if test x$enable_verbose_mode = xyes; then
42 AC_DEFINE(DBUS_ENABLE_VERBOSE_MODE,1,[Support a verbose mode])
44 if test x$enable_asserts = xno; then
45 AC_DEFINE(DBUS_DISABLE_ASSERT,1,[Disable assertion checking])
48 if test "x$GCC" = "xyes"; then
51 *[\ \ ]-Wall[\ \ ]*) ;;
52 *) CFLAGS="$CFLAGS -Wall" ;;
56 *[\ \ ]-Wchar-subscripts[\ \ ]*) ;;
57 *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
61 *[\ \ ]-Wmissing-declarations[\ \ ]*) ;;
62 *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
66 *[\ \ ]-Wmissing-prototypes[\ \ ]*) ;;
67 *) CFLAGS="$CFLAGS -Wmissing-prototypes" ;;
71 *[\ \ ]-Wnested-externs[\ \ ]*) ;;
72 *) CFLAGS="$CFLAGS -Wnested-externs" ;;
76 *[\ \ ]-Wpointer-arith[\ \ ]*) ;;
77 *) CFLAGS="$CFLAGS -Wpointer-arith" ;;
81 *[\ \ ]-Wcast-align[\ \ ]*) ;;
82 *) CFLAGS="$CFLAGS -Wcast-align" ;;
86 *[\ \ ]-Wsign-compare[\ \ ]*) ;;
87 *) CFLAGS="$CFLAGS -Wsign-compare" ;;
90 if test "x$enable_ansi" = "xyes"; then
92 *[\ \ ]-ansi[\ \ ]*) ;;
93 *) CFLAGS="$CFLAGS -ansi" ;;
97 *[\ \ ]-pedantic[\ \ ]*) ;;
98 *) CFLAGS="$CFLAGS -pedantic" ;;
101 if test x$enable_gcov = xyes; then
103 *[\ \ ]-fprofile-arcs[\ \ ]*) ;;
104 *) CFLAGS="$CFLAGS -fprofile-arcs" ;;
107 *[\ \ ]-ftest-coverage[\ \ ]*) ;;
108 *) CFLAGS="$CFLAGS -ftest-coverage" ;;
111 ## remove optimization
112 CFLAGS=`echo "$CFLAGS" | sed -e 's/-O[0-9]*//g'`
116 if test x$enable_gcov = xyes; then
117 AC_MSG_ERROR([--enable-gcov can only be used with gcc])
123 AC_CHECK_SIZEOF(char)
124 AC_CHECK_SIZEOF(short)
125 AC_CHECK_SIZEOF(long)
127 AC_CHECK_SIZEOF(void *)
128 AC_CHECK_SIZEOF(long long)
129 AC_CHECK_SIZEOF(__int64)
134 AC_CHECK_FUNCS(vsnprintf vasprintf getpwnam_r nanosleep usleep poll)
136 dnl check for writev header and writev function so we're
137 dnl good to go if HAVE_WRITEV gets defined.
138 AC_CHECK_HEADERS(sys/uio.h, [AC_CHECK_FUNCS(writev)])
140 dnl check for flavours of varargs macros (test from GLib)
141 AC_MSG_CHECKING(for ISO C99 varargs macros in C)
143 int a(int p1, int p2, int p3);
144 #define call_a(...) a(1,__VA_ARGS__)
146 ],dbus_have_iso_c_varargs=yes,dbus_have_iso_c_varargs=no)
147 AC_MSG_RESULT($dbus_have_iso_c_varargs)
149 AC_MSG_CHECKING(for GNUC varargs macros)
151 int a(int p1, int p2, int p3);
152 #define call_a(params...) a(1,params)
154 ],dbus_have_gnuc_varargs=yes,dbus_have_gnuc_varargs=no)
155 AC_MSG_RESULT($dbus_have_gnuc_varargs)
157 dnl Output varargs tests
158 if test x$dbus_have_iso_c_varargs = xyes; then
159 AC_DEFINE(HAVE_ISO_VARARGS,1,[Have ISO C99 varargs macros])
161 if test x$dbus_have_gnuc_varargs = xyes; then
162 AC_DEFINE(HAVE_GNUC_VARARGS,1,[Have GNU-style varargs macros])
168 AC_SUBST(DBUS_CLIENT_CFLAGS)
169 AC_SUBST(DBUS_CLIENT_LIBS)
173 AC_SUBST(DBUS_BUS_CFLAGS)
174 AC_SUBST(DBUS_BUS_LIBS)
178 AC_SUBST(DBUS_TEST_CFLAGS)
179 AC_SUBST(DBUS_TEST_LIBS)
182 PKG_CHECK_MODULES(DBUS_GLIB, glib-2.0, have_glib=yes, have_glib=no)
184 if test x$have_glib = xno ; then
185 AC_MSG_WARN([GLib development libraries not found])
188 if test x$enable_glib = xyes; then
189 if test x$have_glib = xno; then
190 AC_MSG_ERROR([GLib explicitly required, and GLib development libraries not found])
194 if test x$enable_glib = xno; then
198 AM_CONDITIONAL(HAVE_GLIB, test x$have_glib = xyes)
201 AC_SUBST(DBUS_GLIB_CFLAGS)
202 AC_SUBST(DBUS_GLIB_LIBS)
206 if test -n "$QTDIR" -a -f $QTDIR/include/qglobal.h; then
208 DBUS_QT_CXXFLAGS=-I$QTDIR/include
211 dnl linking to kdecore will give us a bit of help from libtool
212 kdelibs=`kde-config --install lib --expandvars 2>/dev/null`
213 if test -z $kdelibs -a -f $kdelibs/libkdecore.la; then
216 DBUS_QT_LIBS=$kdelibs/libkdecore.la
219 if test x$have_qt = xno ; then
220 AC_MSG_WARN([Qt development libraries not found])
223 if test x$enable_qt = xyes; then
224 if test x$have_qt = xno; then
225 AC_MSG_ERROR([Qt integration explicitly required, and Qt libraries not found])
229 if test x$enable_qt = xno; then
233 AM_CONDITIONAL(HAVE_QT, test x$have_qt = xyes)
236 AC_SUBST(DBUS_QT_CXXFLAGS)
237 AC_SUBST(DBUS_QT_LIBS)
252 dnl ==========================================================================
258 source code location: ${srcdir}
262 Maintainer mode: ${USE_MAINTAINER_MODE}
263 gcc coverage profiling: ${enable_gcov}
264 Building unit tests: ${enable_tests}
265 Building verbose mode: ${enable_verbose_mode}
266 Building assertions: ${enable_asserts}
267 Building Qt bindings: ${have_qt}
268 Building GLib bindings: ${have_glib}
271 if test x$enable_tests = xyes; then
272 echo "NOTE: building with unit tests increases the size of the installed library"
274 if test x$enable_gcov = xyes; then
275 echo "NOTE: building with coverage profiling is definitely for developers only"
277 if test x$enable_verbose_mode = xyes; then
278 echo "NOTE: building with verbose mode increases library size, but is probably a good idea anyway."
280 if test x$enable_asserts = xyes; then
281 echo "NOTE: building with assertions increases library size, but is probably a good idea anyway."