6 AM_INIT_AUTOMAKE(dbus, 0.5)
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_LIB(socket,socket)
135 AC_CHECK_LIB(nsl,gethostbyname)
137 AC_CHECK_FUNCS(vsnprintf vasprintf nanosleep usleep poll setenv)
139 AC_CACHE_CHECK([for posix getpwnam_r],
140 ac_cv_func_posix_getpwnam_r,
146 struct passwd pwd, *pwptr = &pwd;
149 error = getpwnam_r ("", &pwd, buffer,
150 sizeof (buffer), &pwptr);
151 return (error < 0 && errno == ENOSYS)
154 [ac_cv_func_posix_getpwnam_r=yes],
155 [ac_cv_func_posix_getpwnam_r=no])])
156 if test "$ac_cv_func_posix_getpwnam_r" = yes; then
157 AC_DEFINE(HAVE_POSIX_GETPWNAM_R,1,
158 [Have POSIX function getpwnam_r])
160 AC_CACHE_CHECK([for nonposix getpwnam_r],
161 ac_cv_func_nonposix_getpwnam_r,
162 [AC_TRY_LINK([#include <pwd.h>],
165 getpwnam_r ("", &pwd, buffer,
167 [ac_cv_func_nonposix_getpwnam_r=yes],
168 [ac_cv_func_nonposix_getpwnam_r=no])])
169 if test "$ac_cv_func_nonposix_getpwnam_r" = yes; then
170 AC_DEFINE(HAVE_NONPOSIX_GETPWNAM_R,1,
171 [Have non-POSIX function getpwnam_r])
175 dnl check for writev header and writev function so we're
176 dnl good to go if HAVE_WRITEV gets defined.
177 AC_CHECK_HEADERS(sys/uio.h, [AC_CHECK_FUNCS(writev)])
179 dnl check for flavours of varargs macros (test from GLib)
180 AC_MSG_CHECKING(for ISO C99 varargs macros in C)
182 int a(int p1, int p2, int p3);
183 #define call_a(...) a(1,__VA_ARGS__)
185 ],dbus_have_iso_c_varargs=yes,dbus_have_iso_c_varargs=no)
186 AC_MSG_RESULT($dbus_have_iso_c_varargs)
188 AC_MSG_CHECKING(for GNUC varargs macros)
190 int a(int p1, int p2, int p3);
191 #define call_a(params...) a(1,params)
193 ],dbus_have_gnuc_varargs=yes,dbus_have_gnuc_varargs=no)
194 AC_MSG_RESULT($dbus_have_gnuc_varargs)
196 dnl Output varargs tests
197 if test x$dbus_have_iso_c_varargs = xyes; then
198 AC_DEFINE(HAVE_ISO_VARARGS,1,[Have ISO C99 varargs macros])
200 if test x$dbus_have_gnuc_varargs = xyes; then
201 AC_DEFINE(HAVE_GNUC_VARARGS,1,[Have GNU-style varargs macros])
204 dnl Check for various credentials.
205 AC_MSG_CHECKING(for struct cmsgcred)
207 #include <sys/types.h>
208 #include <sys/socket.h>
210 struct cmsgcred cred;
213 ],dbus_have_struct_cmsgcred=yes,dbus_have_struct_cmsgcred=no)
214 AC_MSG_RESULT($dbus_have_struct_cmsgcred)
216 if test x$dbus_have_struct_cmsgcred = xyes; then
217 AC_DEFINE(HAVE_CMSGCRED,1,[Have cmsgcred structure])
222 AC_SUBST(DBUS_CLIENT_CFLAGS)
223 AC_SUBST(DBUS_CLIENT_LIBS)
227 AC_SUBST(DBUS_BUS_CFLAGS)
228 AC_SUBST(DBUS_BUS_LIBS)
232 AC_SUBST(DBUS_TEST_CFLAGS)
233 AC_SUBST(DBUS_TEST_LIBS)
236 PKG_CHECK_MODULES(DBUS_GLIB, glib-2.0, have_glib=yes, have_glib=no)
237 PKG_CHECK_MODULES(DBUS_GLIB_THREADS, glib-2.0 gthread-2.0, have_glib_threads=yes, have_glib_threads=no)
239 if test x$have_glib = xno ; then
240 AC_MSG_WARN([GLib development libraries not found])
243 if test x$enable_glib = xyes; then
244 if test x$have_glib = xno; then
245 AC_MSG_ERROR([GLib explicitly required, and GLib development libraries not found])
249 if test x$enable_glib = xno; then
253 AM_CONDITIONAL(HAVE_GLIB, test x$have_glib = xyes)
254 AM_CONDITIONAL(HAVE_GLIB_THREADS, test x$have_glib_threads = xyes)
257 AC_SUBST(DBUS_GLIB_CFLAGS)
258 AC_SUBST(DBUS_GLIB_LIBS)
259 AC_SUBST(DBUS_GLIB_THREADS_LIBS)
263 if test -n "$QTDIR" -a -f $QTDIR/include/qglobal.h; then
265 DBUS_QT_CXXFLAGS=-I$QTDIR/include
268 dnl linking to kdecore will give us a bit of help from libtool
269 kdelibs=`kde-config --install lib --expandvars 2>/dev/null`
270 if test -z $kdelibs -a -f $kdelibs/libkdecore.la; then
273 DBUS_QT_LIBS=$kdelibs/libkdecore.la
276 if test x$have_qt = xno ; then
277 AC_MSG_WARN([Qt development libraries not found])
280 if test x$enable_qt = xyes; then
281 if test x$have_qt = xno; then
282 AC_MSG_ERROR([Qt integration explicitly required, and Qt libraries not found])
286 if test x$enable_qt = xno; then
290 AM_CONDITIONAL(HAVE_QT, test x$have_qt = xyes)
293 AC_SUBST(DBUS_QT_CXXFLAGS)
294 AC_SUBST(DBUS_QT_LIBS)
309 dnl ==========================================================================
315 source code location: ${srcdir}
319 Maintainer mode: ${USE_MAINTAINER_MODE}
320 gcc coverage profiling: ${enable_gcov}
321 Building unit tests: ${enable_tests}
322 Building verbose mode: ${enable_verbose_mode}
323 Building assertions: ${enable_asserts}
324 Building Qt bindings: ${have_qt}
325 Building GLib bindings: ${have_glib}
328 if test x$enable_tests = xyes; then
329 echo "NOTE: building with unit tests increases the size of the installed library"
331 if test x$enable_gcov = xyes; then
332 echo "NOTE: building with coverage profiling is definitely for developers only"
334 if test x$enable_verbose_mode = xyes; then
335 echo "NOTE: building with verbose mode increases library size, but is probably a good idea anyway."
337 if test x$enable_asserts = xyes; then
338 echo "NOTE: building with assertions increases library size, but is probably a good idea anyway."