configure.ac: Don't link weston to cairo or image libraries
[profile/ivi/weston-ivi-shell.git] / configure.ac
1 AC_PREREQ([2.64])
2 AC_INIT([weston],
3         [1.0.0],
4         [https://bugs.freedesktop.org/enter_bug.cgi?product=weston],
5         [weston],
6         [http://wayland.freedesktop.org/])
7
8 AC_CONFIG_HEADERS([config.h])
9
10 AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
11
12 AM_SILENT_RULES([yes])
13
14 # Check for programs
15 AC_PROG_CC
16 AC_PROG_CXX
17 AC_PROG_SED
18
19 # Initialize libtool
20 LT_PREREQ([2.2])
21 LT_INIT([disable-static])
22
23 AC_ARG_VAR([WESTON_NATIVE_BACKEND],
24            [Set the native backend to use, if Weston is not running under Wayland nor X11. @<:@default=drm-backend.so@:>@])
25
26 PKG_PROG_PKG_CONFIG()
27
28 AC_CHECK_FUNC([dlopen], [],
29               AC_CHECK_LIB([dl], [dlopen], DLOPEN_LIBS="-ldl"))
30 AC_SUBST(DLOPEN_LIBS)
31
32 AC_CHECK_HEADERS([execinfo.h])
33
34 AC_CHECK_FUNCS([mkostemp strchrnul])
35
36 PKG_CHECK_MODULES(COMPOSITOR,
37                   [wayland-server egl >= 7.10 glesv2 xkbcommon pixman-1])
38
39
40 AC_ARG_ENABLE(setuid-install, [  --enable-setuid-install],,
41               enable_setuid_install=yes)
42 AM_CONDITIONAL(ENABLE_SETUID_INSTALL, test x$enable_setuid_install = xyes)
43
44
45 AC_ARG_ENABLE(xwayland, [  --enable-xwayland],,
46               enable_xwayland=yes)
47 AM_CONDITIONAL(ENABLE_XWAYLAND, test x$enable_xwayland = xyes)
48 if test x$enable_xwayland = xyes; then
49   PKG_CHECK_MODULES([XWAYLAND], xcb xcb-xfixes xcursor cairo-xcb)
50   AC_DEFINE([BUILD_XWAYLAND], [1], [Build the X server launcher])
51
52   AC_ARG_WITH(xserver-path, AS_HELP_STRING([--with-xserver-path=PATH],
53               [Path to X server]), [XSERVER_PATH="$withval"],
54               [XSERVER_PATH="$bindir/Xorg"])
55   AC_SUBST([XSERVER_PATH])
56 fi
57
58
59 AC_ARG_ENABLE(x11-compositor, [  --enable-x11-compositor],,
60               enable_x11_compositor=yes)
61 AM_CONDITIONAL(ENABLE_X11_COMPOSITOR, test x$enable_x11_compositor = xyes)
62 if test x$enable_x11_compositor = xyes; then
63   PKG_CHECK_MODULES([XCB], xcb)
64   xcb_save_LIBS=$LIBS
65   xcb_save_CFLAGS=$CFLAGS
66   CFLAGS=$XCB_CFLAGS
67   LIBS=$XCB_LIBS
68   AC_CHECK_FUNCS([xcb_poll_for_queued_event])
69   LIBS=$xcb_save_LIBS
70   CFLAGS=$xcb_save_CFLAGS
71
72   X11_COMPOSITOR_MODULES="x11 x11-xcb"
73
74   PKG_CHECK_MODULES(X11_COMPOSITOR_XKB, [xcb-xkb],
75                     [have_xcb_xkb="yes"], [have_xcb_xkb="no"])
76   if test "x$have_xcb_xkb" = xyes; then
77         # Most versions of XCB have totally broken XKB bindings, where the
78         # events don't work.  Make sure we can actually use them.
79         xcb_xkb_save_CFLAGS=$CFLAGS
80         CFLAGS=$X11_COMPOSITOR_XKB_CFLAGS
81         AC_CHECK_MEMBER([struct xcb_xkb_state_notify_event_t.xkbType],
82                         [], [have_xcb_xkb=no], [[#include <xcb/xkb.h>]])
83         CFLAGS=$xcb_xkb_save_CFLAGS
84   fi
85   if test "x$have_xcb_xkb" = xyes; then
86         X11_COMPOSITOR_MODULES="$X11_COMPOSITOR_MODULES xcb-xkb"
87         AC_DEFINE([HAVE_XCB_XKB], [1], [libxcb supports XKB protocol])
88   fi
89
90   PKG_CHECK_MODULES(X11_COMPOSITOR, [$X11_COMPOSITOR_MODULES])
91   AC_DEFINE([BUILD_X11_COMPOSITOR], [1], [Build the X11 compositor])
92 fi
93
94
95 AC_ARG_ENABLE(drm-compositor, [  --enable-drm-compositor],,
96               enable_drm_compositor=yes)
97 AM_CONDITIONAL(ENABLE_DRM_COMPOSITOR, test x$enable_drm_compositor = xyes)
98 if test x$enable_drm_compositor = xyes; then
99   AC_DEFINE([BUILD_DRM_COMPOSITOR], [1], [Build the DRM compositor])
100   PKG_CHECK_MODULES(DRM_COMPOSITOR, [libudev >= 136 libdrm >= 2.4.30 gbm mtdev >= 1.1.0])
101 fi
102
103
104 AC_ARG_ENABLE(wayland-compositor, [  --enable-wayland-compositor],,
105               enable_wayland_compositor=yes)
106 AM_CONDITIONAL(ENABLE_WAYLAND_COMPOSITOR,
107                test x$enable_wayland_compositor = xyes)
108 if test x$enable_wayland_compositor = xyes; then
109   AC_DEFINE([BUILD_WAYLAND_COMPOSITOR], [1],
110             [Build the Wayland (nested) compositor])
111   PKG_CHECK_MODULES(WAYLAND_COMPOSITOR, [wayland-client wayland-egl])
112 fi
113
114
115 AC_ARG_ENABLE(headless-compositor, [  --enable-headless-compositor],,
116               enable_headless_compositor=yes)
117 AM_CONDITIONAL(ENABLE_HEADLESS_COMPOSITOR,
118                test x$enable_headless_compositor = xyes)
119
120
121 AC_ARG_ENABLE(android-compositor,
122               AS_HELP_STRING([--disable-android-compositor],
123                              [do not build-test the Android 4.0 backend]),,
124               enable_android_compositor=yes)
125 AM_CONDITIONAL(ENABLE_ANDROID_COMPOSITOR, test x$enable_android_compositor = xyes)
126 if test x$enable_android_compositor = xyes; then
127   AC_DEFINE([BUILD_ANDROID_COMPOSITOR], [1], [Build the compositor for Android 4.0])
128   PKG_CHECK_MODULES(ANDROID_COMPOSITOR, [mtdev >= 1.1.0])
129 fi
130
131
132 AC_ARG_ENABLE(rpi-compositor,
133               AS_HELP_STRING([--disable-rpi-compositor],
134                              [do not build the Raspberry Pi backend]),,
135               enable_rpi_compositor=yes)
136 AM_CONDITIONAL(ENABLE_RPI_COMPOSITOR, test "x$enable_rpi_compositor" = "xyes")
137 have_bcm_host="no"
138 if test x$enable_rpi_compositor = xyes; then
139   AC_DEFINE([BUILD_RPI_COMPOSITOR], [1], [Build the compositor for Raspberry Pi])
140   PKG_CHECK_MODULES(RPI_COMPOSITOR, [libudev >= 136 mtdev >= 1.1.0])
141   PKG_CHECK_MODULES(RPI_BCM_HOST, [bcm_host],
142                     [have_bcm_host="yes"
143                      AC_DEFINE([HAVE_BCM_HOST], [1], [have Raspberry Pi BCM headers])],
144                     [AC_MSG_WARN([Raspberry Pi BCM host libraries not found, will use stubs instead.])])
145 fi
146 AM_CONDITIONAL(INSTALL_RPI_COMPOSITOR, test "x$have_bcm_host" = "xyes")
147
148
149 AC_ARG_WITH(cairo-glesv2,
150             AS_HELP_STRING([--with-cairo-glesv2],
151                            [Use GLESv2 cairo instead of full GL]))
152 if test "x$with_cairo_glesv2" = "xyes"; then
153   cairo_modules="cairo-glesv2"
154   AC_DEFINE([USE_CAIRO_GLESV2], [1], [Use the GLESv2 GL cairo backend])
155 else
156   cairo_modules="cairo-gl"
157 fi
158
159 PKG_CHECK_MODULES(PIXMAN, [pixman-1])
160 PKG_CHECK_MODULES(PNG, [libpng])
161 PKG_CHECK_MODULES(WEBP, [libwebp], [have_webp=yes], [have_webp=no])
162 AS_IF([test "x$have_webp" = "xyes"],
163       [AC_DEFINE([HAVE_WEBP], [1], [Have webp])])
164
165 AC_CHECK_LIB([jpeg], [jpeg_CreateDecompress], have_jpeglib=yes)
166 if test x$have_jpeglib = xyes; then
167   JPEG_LIBS="-ljpeg"
168 else
169   AC_ERROR([libjpeg not found])
170 fi
171 AC_SUBST(JPEG_LIBS)
172
173 PKG_CHECK_MODULES(CAIRO, [cairo])
174
175 AC_ARG_ENABLE(simple-clients,
176               AS_HELP_STRING([--disable-simple-clients],
177                              [do not build the simple wl_shm clients]),,
178               enable_simple_clients=yes)
179 AM_CONDITIONAL(BUILD_SIMPLE_CLIENTS, test "x$enable_simple_clients" = "xyes")
180 if test x$enable_simple_clients = xyes; then
181   PKG_CHECK_MODULES(SIMPLE_CLIENT, [wayland-client])
182 fi
183
184 AC_ARG_ENABLE(simple-egl-clients,
185               AS_HELP_STRING([--disable-simple-egl-clients],
186                              [do not build the simple EGL clients]),,
187               enable_simple_egl_clients=yes)
188 AM_CONDITIONAL(BUILD_SIMPLE_EGL_CLIENTS, test "x$enable_simple_egl_clients" = "xyes")
189 if test x$enable_simple_egl_clients = xyes; then
190   PKG_CHECK_MODULES(SIMPLE_EGL_CLIENT,
191                     [egl >= 7.10 glesv2 wayland-client wayland-egl wayland-cursor])
192 fi
193
194 AC_ARG_ENABLE(clients, [  --enable-clients],, enable_clients=yes)
195 AM_CONDITIONAL(BUILD_CLIENTS, test x$enable_clients = xyes)
196 if test x$enable_clients = xyes; then
197   AC_DEFINE([BUILD_CLIENTS], [1], [Build the Wayland clients])
198
199   PKG_CHECK_MODULES(CLIENT, [wayland-client cairo >= 1.10.0 xkbcommon wayland-cursor])
200   PKG_CHECK_MODULES(WESTON_INFO, [wayland-client])
201
202   PKG_CHECK_MODULES(POPPLER, [poppler-glib glib-2.0 gobject-2.0 gio-2.0 ],
203                              [have_poppler=yes], [have_poppler=no])
204   PKG_CHECK_MODULES(CAIRO_EGL, [wayland-egl egl >= 7.10 cairo-egl >= 1.11.3 $cairo_modules],
205                     [have_cairo_egl=yes], [have_cairo_egl=no])
206   AS_IF([test "x$have_cairo_egl" = "xyes"],
207         [AC_DEFINE([HAVE_CAIRO_EGL], [1], [Have cairo-egl])],
208         [AC_MSG_WARN([clients will use cairo image, cairo-egl not used because $CAIRO_EGL_PKG_ERRORS])])
209 fi
210
211 AC_ARG_ENABLE(weston-launch, [  --enable-weston-launch],, enable_weston_launch=yes)
212 AM_CONDITIONAL(BUILD_WESTON_LAUNCH, test x$enable_weston_launch == xyes)
213 if test x$enable_weston_launch == xyes; then
214   PKG_CHECK_MODULES(WESTON_LAUNCH, [libdrm])
215   PKG_CHECK_MODULES(SYSTEMD_LOGIN, [libsystemd-login],
216                     [have_systemd_login=yes], [have_systemd_login=no])
217   AS_IF([test "x$have_systemd_login" = "xyes"],
218         [AC_DEFINE([HAVE_SYSTEMD_LOGIN], [1], [Have systemd-login])])
219
220   AC_CHECK_LIB([pam], [pam_open_session], [have_pam=yes], [have_pam=no])
221   if test x$have_pam == xno; then
222     AC_ERROR([weston-launch requires pam])
223   fi
224   WESTON_LAUNCH_LIBS="$WESTON_LAUNCH_LIBS -lpam"
225 fi
226
227 PKG_CHECK_MODULES(GLU, [glu], [have_glu=yes], [have_glu=no])
228 AM_CONDITIONAL(HAVE_GLU, test "x$have_glu" = "xyes")
229
230
231 AM_CONDITIONAL(HAVE_POPPLER, test "x$have_poppler" = "xyes")
232
233 AM_CONDITIONAL(BUILD_FULL_GL_CLIENTS,
234                test x$cairo_modules = "xcairo-gl" -a "x$have_cairo_egl" = "xyes")
235
236 AM_CONDITIONAL(ENABLE_DESKTOP_SHELL, true)
237
238 AC_ARG_ENABLE(tablet-shell,
239               AS_HELP_STRING([--disable-tablet-shell],
240                              [do not build tablet-shell server plugin and client]),,
241               enable_tablet_shell=yes)
242 AM_CONDITIONAL(ENABLE_TABLET_SHELL,
243                test "x$enable_tablet_shell" = "xyes")
244
245
246 AC_ARG_ENABLE(wcap-tools, [  --disable-wcap-tools],, enable_wcap_tools=yes)
247 AM_CONDITIONAL(BUILD_WCAP_TOOLS, test x$enable_wcap_tools = xyes)
248 if test x$enable_wcap_tools = xyes; then
249   AC_DEFINE([BUILD_WCAP_TOOLS], [1], [Build the wcap tools])
250   PKG_CHECK_MODULES(WCAP, [cairo])
251   WCAP_LIBS="$WCAP_LIBS -lm"
252 fi
253
254 AC_CHECK_PROG(RSVG_CONVERT, rsvg-convert, rsvg-convert)
255 AM_CONDITIONAL(HAVE_RSVG_CONVERT, test -n "$RSVG_CONVERT")
256
257 PKG_CHECK_MODULES(SETBACKLIGHT, [libudev libdrm], enable_setbacklight=yes, enable_setbacklight=no)
258 AM_CONDITIONAL(BUILD_SETBACKLIGHT, test "x$enable_setbacklight" = "xyes")
259
260 if test "x$GCC" = "xyes"; then
261         my_common_gcc_flags="-Wall -Wextra -Wno-unused-parameter \
262                 -Wno-missing-field-initializers -g -fvisibility=hidden"
263         GCC_CFLAGS="$my_common_gcc_flags \
264                 -Wstrict-prototypes -Wmissing-prototypes"
265         GCC_CXXFLAGS="$my_common_gcc_flags"
266 fi
267 AC_SUBST(GCC_CFLAGS)
268 AC_SUBST(GCC_CXXFLAGS)
269
270 if test "x$WESTON_NATIVE_BACKEND" = "x"; then
271         WESTON_NATIVE_BACKEND="drm-backend.so"
272 fi
273 AC_MSG_NOTICE([Weston's native backend: $WESTON_NATIVE_BACKEND])
274 AC_DEFINE_UNQUOTED([WESTON_NATIVE_BACKEND], ["$WESTON_NATIVE_BACKEND"],
275                    [The default backend to load, if not wayland nor x11.])
276
277 WAYLAND_SCANNER_RULES(['$(top_srcdir)/protocol'])
278
279 AC_CONFIG_FILES([Makefile
280                  shared/Makefile
281                  src/Makefile
282                  src/xwayland/Makefile
283                  clients/Makefile
284                  wcap/Makefile
285                  data/Makefile
286                  protocol/Makefile
287                  man/Makefile
288                  tests/Makefile])
289 AC_OUTPUT