9806da9e5018b509ae6ce842edbe0fc363023cea
[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_ISC_POSIX
21 AC_HEADER_STDC
22 AM_PROG_LIBTOOL
23
24 AC_ARG_ENABLE(qt,      [  --enable-qt      enable Qt-friendly client library],enable_qt=$enableval,enable_qt=no)
25 AC_ARG_ENABLE(glib,    [  --enable-glib    enable GLib-friendly client library],enable_glib=$enableval,enable_glib=auto)
26 AC_ARG_ENABLE(tests,   [  --enable-tests enable unit test code],enable_tests=yes,enable_tests=no)
27 AC_ARG_ENABLE(ansi,    [  --enable-ansi enable -ansi -pedantic gcc flags],enable_ansi=yes,enable_ansi=no)
28
29 dnl DBUS_BUILD_TESTS controls unit tests built in to .c files 
30 dnl and also some stuff in the test/ subdir
31 AM_CONDITIONAL(DBUS_BUILD_TESTS, test x$enable_tests = xyes)
32 if test x$enable_tests = xyes; then
33     AC_DEFINE(DBUS_BUILD_TESTS,1,[Build test code])
34 fi
35
36 changequote(,)dnl
37 if test "x$GCC" = "xyes"; then
38   case " $CFLAGS " in
39   *[\ \ ]-Wall[\ \      ]*) ;;
40   *) CFLAGS="$CFLAGS -Wall" ;;
41   esac
42
43   case " $CFLAGS " in
44   *[\ \ ]-Wchar-subscripts[\ \  ]*) ;;
45   *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
46   esac
47
48   case " $CFLAGS " in
49   *[\ \ ]-Wmissing-declarations[\ \     ]*) ;;
50   *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
51   esac
52
53   case " $CFLAGS " in
54   *[\ \ ]-Wmissing-prototypes[\ \       ]*) ;;
55   *) CFLAGS="$CFLAGS -Wmissing-prototypes" ;;
56   esac
57
58   case " $CFLAGS " in
59   *[\ \ ]-Wnested-externs[\ \   ]*) ;;
60   *) CFLAGS="$CFLAGS -Wnested-externs" ;;
61   esac
62
63   case " $CFLAGS " in
64   *[\ \ ]-Wpointer-arith[\ \    ]*) ;;
65   *) CFLAGS="$CFLAGS -Wpointer-arith" ;;
66   esac
67
68   case " $CFLAGS " in
69   *[\ \ ]-Wcast-align[\ \       ]*) ;;
70   *) CFLAGS="$CFLAGS -Wcast-align" ;;
71   esac
72
73   case " $CFLAGS " in
74   *[\ \ ]-Wsign-compare[\ \     ]*) ;;
75   *) CFLAGS="$CFLAGS -Wsign-compare" ;;
76   esac
77
78   if test "x$enable_ansi" = "xyes"; then
79     case " $CFLAGS " in
80     *[\ \       ]-ansi[\ \      ]*) ;;
81     *) CFLAGS="$CFLAGS -ansi" ;;
82     esac
83
84     case " $CFLAGS " in
85     *[\ \       ]-pedantic[\ \  ]*) ;;
86     *) CFLAGS="$CFLAGS -pedantic" ;;
87     esac
88   fi
89 fi
90 changequote([,])dnl
91
92 AC_CHECK_SIZEOF(char)
93 AC_CHECK_SIZEOF(short)
94 AC_CHECK_SIZEOF(long)
95 AC_CHECK_SIZEOF(int)
96 AC_CHECK_SIZEOF(void *)
97 AC_CHECK_SIZEOF(long long)
98 AC_CHECK_SIZEOF(__int64)
99
100 ## byte order
101 AC_C_BIGENDIAN
102
103 AC_CHECK_FUNCS(vsnprintf vasprintf)
104
105 dnl check for writev header and writev function so we're 
106 dnl good to go if HAVE_WRITEV gets defined.
107 AC_CHECK_HEADERS(sys/uio.h, [AC_CHECK_FUNCS(writev)])
108
109 DBUS_CLIENT_CFLAGS=
110 DBUS_CLIENT_LIBS=
111 AC_SUBST(DBUS_CLIENT_CFLAGS)
112 AC_SUBST(DBUS_CLIENT_LIBS)
113
114 DBUS_BUS_CFLAGS=
115 DBUS_BUS_LIBS=
116 AC_SUBST(DBUS_BUS_CFLAGS)
117 AC_SUBST(DBUS_BUS_LIBS)
118
119 DBUS_TEST_CFLAGS=
120 DBUS_TEST_LIBS=
121 AC_SUBST(DBUS_TEST_CFLAGS)
122 AC_SUBST(DBUS_TEST_LIBS)
123
124 # Glib detection
125 PKG_CHECK_MODULES(DBUS_GLIB, glib-2.0, have_glib=yes, have_glib=no)
126
127 if test x$have_glib = xno ; then
128     AC_MSG_WARN([GLib development libraries not found])
129 fi
130
131 if test x$enable_glib = xyes; then
132     if test x$have_glib = xno; then
133         AC_MSG_ERROR([GLib explicitly required, and GLib development libraries not found])
134     fi
135 fi
136
137 if test x$enable_glib = xno; then
138    have_glib=no;
139 fi
140
141 AM_CONDITIONAL(HAVE_GLIB, test x$have_glib = xyes)
142
143 dnl GLib flags
144 AC_SUBST(DBUS_GLIB_CFLAGS)
145 AC_SUBST(DBUS_GLIB_LIBS)
146
147 AC_OUTPUT([
148 Makefile
149 Doxyfile
150 dbus/Makefile
151 glib/Makefile
152 bus/Makefile
153 test/Makefile
154 doc/Makefile
155 dbus-1.0.pc
156 dbus-glib-1.0.pc
157 ])
158
159 dnl ==========================================================================
160 echo "
161                     D-BUS $VERSION
162                   ==============
163
164         prefix:                 ${prefix}
165         source code location:   ${srcdir}
166         compiler:               ${CC}
167
168         Building unit tests:    ${enable_tests}
169         Building Qt bindings:   ${enable_qt}
170         Building GLib bindings: ${have_glib}
171 "
172
173 if test x$enable_tests = xyes; then
174         echo "NOTE: building with unit tests increases the size of the installed library"
175 fi
176 if test x$enable_qt = xyes; then
177         echo "NOTE: Qt bindings don't actually exist yet"
178 fi
179