very basic check for Qt integration. Another proof that Qt's build
[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.1)
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 AM_MAINTAINER_MODE
18
19 AC_PROG_CC
20 AC_PROG_CXX
21 AC_ISC_POSIX
22 AC_HEADER_STDC
23 AM_PROG_LIBTOOL
24
25 AC_ARG_ENABLE(qt,      [  --enable-qt      enable Qt-friendly client library],enable_qt=$enableval,enable_qt=auto)
26 AC_ARG_ENABLE(glib,    [  --enable-glib    enable GLib-friendly client library],enable_glib=$enableval,enable_glib=auto)
27 AC_ARG_ENABLE(tests,   [  --enable-tests enable unit test code],enable_tests=yes,enable_tests=no)
28 AC_ARG_ENABLE(ansi,    [  --enable-ansi enable -ansi -pedantic gcc flags],enable_ansi=yes,enable_ansi=no)
29
30 dnl DBUS_BUILD_TESTS controls unit tests built in to .c files 
31 dnl and also some stuff in the test/ subdir
32 AM_CONDITIONAL(DBUS_BUILD_TESTS, test x$enable_tests = xyes)
33 if test x$enable_tests = xyes; then
34     AC_DEFINE(DBUS_BUILD_TESTS,1,[Build test code])
35 fi
36
37 changequote(,)dnl
38 if test "x$GCC" = "xyes"; then
39   case " $CFLAGS " in
40   *[\ \ ]-Wall[\ \      ]*) ;;
41   *) CFLAGS="$CFLAGS -Wall" ;;
42   esac
43
44   case " $CFLAGS " in
45   *[\ \ ]-Wchar-subscripts[\ \  ]*) ;;
46   *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
47   esac
48
49   case " $CFLAGS " in
50   *[\ \ ]-Wmissing-declarations[\ \     ]*) ;;
51   *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
52   esac
53
54   case " $CFLAGS " in
55   *[\ \ ]-Wmissing-prototypes[\ \       ]*) ;;
56   *) CFLAGS="$CFLAGS -Wmissing-prototypes" ;;
57   esac
58
59   case " $CFLAGS " in
60   *[\ \ ]-Wnested-externs[\ \   ]*) ;;
61   *) CFLAGS="$CFLAGS -Wnested-externs" ;;
62   esac
63
64   case " $CFLAGS " in
65   *[\ \ ]-Wpointer-arith[\ \    ]*) ;;
66   *) CFLAGS="$CFLAGS -Wpointer-arith" ;;
67   esac
68
69   case " $CFLAGS " in
70   *[\ \ ]-Wcast-align[\ \       ]*) ;;
71   *) CFLAGS="$CFLAGS -Wcast-align" ;;
72   esac
73
74   case " $CFLAGS " in
75   *[\ \ ]-Wsign-compare[\ \     ]*) ;;
76   *) CFLAGS="$CFLAGS -Wsign-compare" ;;
77   esac
78
79   if test "x$enable_ansi" = "xyes"; then
80     case " $CFLAGS " in
81     *[\ \       ]-ansi[\ \      ]*) ;;
82     *) CFLAGS="$CFLAGS -ansi" ;;
83     esac
84
85     case " $CFLAGS " in
86     *[\ \       ]-pedantic[\ \  ]*) ;;
87     *) CFLAGS="$CFLAGS -pedantic" ;;
88     esac
89   fi
90 fi
91 changequote([,])dnl
92
93 AC_CHECK_SIZEOF(char)
94 AC_CHECK_SIZEOF(short)
95 AC_CHECK_SIZEOF(long)
96 AC_CHECK_SIZEOF(int)
97 AC_CHECK_SIZEOF(void *)
98 AC_CHECK_SIZEOF(long long)
99 AC_CHECK_SIZEOF(__int64)
100
101 ## byte order
102 AC_C_BIGENDIAN
103
104 AC_CHECK_FUNCS(vsnprintf vasprintf)
105
106 dnl check for writev header and writev function so we're 
107 dnl good to go if HAVE_WRITEV gets defined.
108 AC_CHECK_HEADERS(sys/uio.h, [AC_CHECK_FUNCS(writev)])
109
110 DBUS_CLIENT_CFLAGS=
111 DBUS_CLIENT_LIBS=
112 AC_SUBST(DBUS_CLIENT_CFLAGS)
113 AC_SUBST(DBUS_CLIENT_LIBS)
114
115 DBUS_BUS_CFLAGS=
116 DBUS_BUS_LIBS=
117 AC_SUBST(DBUS_BUS_CFLAGS)
118 AC_SUBST(DBUS_BUS_LIBS)
119
120 DBUS_TEST_CFLAGS=
121 DBUS_TEST_LIBS=
122 AC_SUBST(DBUS_TEST_CFLAGS)
123 AC_SUBST(DBUS_TEST_LIBS)
124
125 # Glib detection
126 PKG_CHECK_MODULES(DBUS_GLIB, glib-2.0, have_glib=yes, have_glib=no)
127
128 if test x$have_glib = xno ; then
129     AC_MSG_WARN([GLib development libraries not found])
130 fi
131
132 if test x$enable_glib = xyes; then
133     if test x$have_glib = xno; then
134         AC_MSG_ERROR([GLib explicitly required, and GLib development libraries not found])
135     fi
136 fi
137
138 if test x$enable_glib = xno; then
139    have_glib=no;
140 fi
141
142 AM_CONDITIONAL(HAVE_GLIB, test x$have_glib = xyes)
143
144 dnl GLib flags
145 AC_SUBST(DBUS_GLIB_CFLAGS)
146 AC_SUBST(DBUS_GLIB_LIBS)
147
148 # Qt detection
149 have_qt=no
150 if test -n "$QTDIR" -a -f $QTDIR/include/qglobal.h; then
151     have_qt=yes
152     DBUS_QT_CXXFLAGS=-I$QTDIR/include
153 fi
154
155 dnl linking to kdecore will give us a bit of help from libtool
156 kdelibs=`kde-config --install lib --expandvars 2>/dev/null`
157 if test -z $kdelibs -a -f $kdelibs/libkdecore.la; then
158     have_qt=no
159 else
160     DBUS_QT_LIBS=$kdelibs/libkdecore.la
161 fi
162
163 if test x$have_qt = xno ; then
164     AC_MSG_WARN([Qt development libraries not found])
165 fi
166
167 if test x$enable_qt = xyes; then
168     if test x$have_qt = xno; then
169         AC_MSG_ERROR([Qt integration explicitly required, and Qt libraries not found])
170     fi
171 fi
172
173 if test x$enable_qt = xno; then
174    have_qt=no;
175 fi
176
177 AM_CONDITIONAL(HAVE_QT, test x$have_qt = xyes)
178
179 dnl Qt flags
180 AC_SUBST(DBUS_QT_CXXFLAGS)
181 AC_SUBST(DBUS_QT_LIBS)
182
183 AC_OUTPUT([
184 Makefile
185 Doxyfile
186 dbus/Makefile
187 glib/Makefile
188 qt/Makefile
189 bus/Makefile
190 test/Makefile
191 doc/Makefile
192 dbus-1.0.pc
193 dbus-glib-1.0.pc
194 ])
195
196 dnl ==========================================================================
197 echo "
198                     D-BUS $VERSION
199                   ==============
200
201         prefix:                 ${prefix}
202         source code location:   ${srcdir}
203         compiler:               ${CC}
204
205         Building unit tests:    ${enable_tests}
206         Building Qt bindings:   ${have_qt}
207         Building GLib bindings: ${have_glib}
208 "
209
210 if test x$enable_tests = xyes; then
211         echo "NOTE: building with unit tests increases the size of the installed library"
212 fi