1m4_define([weston_major_version], [1])
2m4_define([weston_minor_version], [9])
3m4_define([weston_micro_version], [0])
4m4_define([weston_version],
5          [weston_major_version.weston_minor_version.weston_micro_version])
6
7AC_PREREQ([2.64])
8AC_INIT([weston],
9        [weston_version],
10        [https://bugs.freedesktop.org/enter_bug.cgi?product=Wayland&component=weston&version=weston_version],
11        [weston],
12        [http://wayland.freedesktop.org])
13
14AC_SUBST([WESTON_VERSION_MAJOR], [weston_major_version])
15AC_SUBST([WESTON_VERSION_MINOR], [weston_minor_version])
16AC_SUBST([WESTON_VERSION_MICRO], [weston_micro_version])
17AC_SUBST([WESTON_VERSION], [weston_version])
18
19AC_CONFIG_AUX_DIR([build-aux])
20AC_CONFIG_HEADERS([config.h])
21AC_CONFIG_MACRO_DIR([m4])
22
23AC_USE_SYSTEM_EXTENSIONS
24AC_SYS_LARGEFILE
25
26AM_INIT_AUTOMAKE([1.11 parallel-tests foreign no-dist-gzip dist-xz color-tests subdir-objects])
27
28AM_SILENT_RULES([yes])
29
30# Check for programs
31AC_PROG_CC
32AC_PROG_SED
33
34# Initialize libtool
35LT_PREREQ([2.2])
36LT_INIT([disable-static])
37
38AC_ARG_VAR([WESTON_NATIVE_BACKEND],
39           [Set the native backend to use, if Weston is not running under Wayland nor X11. @<:@default=drm-backend.so@:>@])
40AC_ARG_VAR([WESTON_SHELL_CLIENT],
41           [Set the default desktop shell client to load if none is specified in weston.ini. @<:@default=weston-desktop-shell@:>@])
42
43PKG_PROG_PKG_CONFIG()
44
45AC_CHECK_FUNC([dlopen], [],
46              AC_CHECK_LIB([dl], [dlopen], DLOPEN_LIBS="-ldl"))
47AC_SUBST(DLOPEN_LIBS)
48
49AC_CHECK_DECL(SFD_CLOEXEC,[],
50	      [AC_MSG_ERROR("SFD_CLOEXEC is needed to compile weston")],
51	      [[#include <sys/signalfd.h>]])
52AC_CHECK_DECL(TFD_CLOEXEC,[],
53	      [AC_MSG_ERROR("TFD_CLOEXEC is needed to compile weston")],
54	      [[#include <sys/timerfd.h>]])
55AC_CHECK_DECL(CLOCK_MONOTONIC,[],
56	      [AC_MSG_ERROR("CLOCK_MONOTONIC is needed to compile weston")],
57	      [[#include <time.h>]])
58AC_CHECK_HEADERS([execinfo.h])
59
60AC_CHECK_FUNCS([mkostemp strchrnul initgroups posix_fallocate])
61
62COMPOSITOR_MODULES="wayland-server >= 1.9.0 pixman-1 >= 0.25.2"
63
64AC_CONFIG_FILES([doc/doxygen/tools.doxygen doc/doxygen/tooldev.doxygen])
65
66AC_ARG_ENABLE(devdocs,
67	      AS_HELP_STRING([--disable-devdocs],
68			     [do not enable building of developer documentation]),,
69	      enable_devdocs=auto)
70if test "x$enable_devdocs" != "xno"; then
71	AC_CHECK_PROGS([DOXYGEN], [doxygen])
72	if test "x$DOXYGEN" = "x" -a "x$enable_devdocs" = "xyes"; then
73		AC_MSG_ERROR([Developer documentation explicitly requested, but Doxygen couldn't be found])
74	fi
75	if test "x$DOXYGEN" != "x"; then
76		enable_devdocs=yes
77	else
78		enable_devdocs=no
79	fi
80fi
81AM_CONDITIONAL(ENABLE_DEVDOCS, test "x$enable_devdocs" = "xyes")
82
83AC_ARG_ENABLE(egl, [  --disable-egl],,
84              enable_egl=yes)
85AM_CONDITIONAL(ENABLE_EGL, test x$enable_egl = xyes)
86if test x$enable_egl = xyes; then
87	AC_DEFINE([ENABLE_EGL], [1], [Build Weston with EGL support])
88	PKG_CHECK_MODULES(EGL, [egl >= 7.10 glesv2])
89        PKG_CHECK_MODULES([EGL_TESTS], [egl >= 7.10 glesv2 wayland-client wayland-egl])
90	PKG_CHECK_MODULES([GL_RENDERER], [libdrm])
91fi
92
93AC_ARG_ENABLE(xkbcommon,
94	      AS_HELP_STRING([--disable-xkbcommon], [Disable libxkbcommon
95			      support: This is only useful in environments
96			      where you do not have a hardware keyboard. If
97			      libxkbcommon support is disabled clients will not
98			      be sent a keymap and and must know how to
99			      interpret the keycode sent for any key event.]),,
100	      enable_xkbcommon=yes)
101if test x$enable_xkbcommon = xyes; then
102	AC_DEFINE(ENABLE_XKBCOMMON, [1], [Build Weston with libxkbcommon support])
103	COMPOSITOR_MODULES="$COMPOSITOR_MODULES xkbcommon >= 0.3.0"
104fi
105
106AC_ARG_ENABLE(setuid-install, [  --enable-setuid-install],,
107	      enable_setuid_install=yes)
108AM_CONDITIONAL(ENABLE_SETUID_INSTALL, test x$enable_setuid_install = xyes)
109
110
111AC_ARG_ENABLE(xwayland, [  --enable-xwayland],,
112	      enable_xwayland=yes)
113AC_ARG_ENABLE(xwayland-test, [  --enable-xwayland-test],,
114              enable_xwayland_test=yes)
115AM_CONDITIONAL(ENABLE_XWAYLAND, test x$enable_xwayland = xyes)
116AM_CONDITIONAL(ENABLE_XWAYLAND_TEST, test x$enable_xwayland = xyes -a x$enable_xwayland_test = xyes)
117if test x$enable_xwayland = xyes; then
118  PKG_CHECK_MODULES([XWAYLAND], xcb xcb-xfixes xcb-composite xcursor cairo-xcb)
119  AC_DEFINE([BUILD_XWAYLAND], [1], [Build the X server launcher])
120
121  AC_ARG_WITH(xserver-path, AS_HELP_STRING([--with-xserver-path=PATH],
122              [Path to X server]), [XSERVER_PATH="$withval"],
123              [XSERVER_PATH="/usr/bin/Xwayland"])
124  AC_SUBST([XSERVER_PATH])
125  if test x$enable_xwayland_test = xyes; then
126    PKG_CHECK_MODULES([XWAYLAND_TEST], x11)
127  fi
128fi
129
130PKG_CHECK_MODULES(LIBDRM, [libdrm],
131                  [AC_DEFINE(HAVE_LIBDRM, 1, [Define if libdrm is available]) have_libdrm=yes], have_libdrm=no)
132
133AC_ARG_ENABLE(x11-compositor, [  --enable-x11-compositor],,
134	      enable_x11_compositor=yes)
135AM_CONDITIONAL(ENABLE_X11_COMPOSITOR, test x$enable_x11_compositor = xyes)
136if test x$enable_x11_compositor = xyes; then
137  PKG_CHECK_MODULES([XCB], xcb)
138  xcb_save_LIBS=$LIBS
139  xcb_save_CFLAGS=$CFLAGS
140  CFLAGS=$XCB_CFLAGS
141  LIBS=$XCB_LIBS
142  AC_CHECK_FUNCS([xcb_poll_for_queued_event])
143  LIBS=$xcb_save_LIBS
144  CFLAGS=$xcb_save_CFLAGS
145
146  X11_COMPOSITOR_MODULES="x11 x11-xcb xcb-shm"
147
148  PKG_CHECK_MODULES(X11_COMPOSITOR_XKB, [xcb-xkb],
149		    [have_xcb_xkb="yes"], [have_xcb_xkb="no"])
150  if test "x$have_xcb_xkb" = xyes; then
151	# Most versions of XCB have totally broken XKB bindings, where the
152	# events don't work.  Make sure we can actually use them.
153	xcb_xkb_save_CFLAGS=$CFLAGS
154	CFLAGS=$X11_COMPOSITOR_XKB_CFLAGS
155	AC_CHECK_MEMBER([struct xcb_xkb_state_notify_event_t.xkbType],
156			[], [have_xcb_xkb=no], [[#include <xcb/xkb.h>]])
157	CFLAGS=$xcb_xkb_save_CFLAGS
158  fi
159  if test "x$have_xcb_xkb" = xyes; then
160	X11_COMPOSITOR_MODULES="$X11_COMPOSITOR_MODULES xcb-xkb"
161	AC_DEFINE([HAVE_XCB_XKB], [1], [libxcb supports XKB protocol])
162  fi
163
164  PKG_CHECK_MODULES(X11_COMPOSITOR, [$X11_COMPOSITOR_MODULES])
165  AC_DEFINE([BUILD_X11_COMPOSITOR], [1], [Build the X11 compositor])
166fi
167
168
169AC_ARG_ENABLE(drm-compositor, [  --enable-drm-compositor],,
170	      enable_drm_compositor=yes)
171AM_CONDITIONAL(ENABLE_DRM_COMPOSITOR, test x$enable_drm_compositor = xyes)
172if test x$enable_drm_compositor = xyes; then
173  AC_DEFINE([BUILD_DRM_COMPOSITOR], [1], [Build the DRM compositor])
174  PKG_CHECK_MODULES(DRM_COMPOSITOR, [libudev >= 136 libdrm >= 2.4.30 gbm mtdev >= 1.1.0])
175  PKG_CHECK_MODULES(DRM_COMPOSITOR_GBM, [gbm >= 10.2],
176		    [AC_DEFINE([HAVE_GBM_FD_IMPORT], 1, [gbm supports dmabuf import])],
177		    [AC_MSG_WARN([gbm does not support dmabuf import, will omit that capability])])
178fi
179
180
181PKG_CHECK_MODULES(LIBINPUT_BACKEND, [libinput >= 0.8.0])
182PKG_CHECK_MODULES(COMPOSITOR, [$COMPOSITOR_MODULES])
183
184AC_ARG_ENABLE(wayland-compositor, [  --enable-wayland-compositor],,
185	      enable_wayland_compositor=yes)
186AM_CONDITIONAL(ENABLE_WAYLAND_COMPOSITOR,
187	       test x$enable_wayland_compositor = xyes -a x$enable_egl = xyes)
188if test x$enable_wayland_compositor = xyes -a x$enable_egl = xyes; then
189  AC_DEFINE([BUILD_WAYLAND_COMPOSITOR], [1],
190	    [Build the Wayland (nested) compositor])
191  PKG_CHECK_MODULES(WAYLAND_COMPOSITOR, [wayland-client >= 1.5.91 wayland-egl wayland-cursor])
192fi
193
194
195AC_ARG_ENABLE(headless-compositor, [  --enable-headless-compositor],,
196	      enable_headless_compositor=yes)
197AM_CONDITIONAL(ENABLE_HEADLESS_COMPOSITOR,
198	       test x$enable_headless_compositor = xyes)
199if test x$enable_headless_compositor = xyes; then
200  AC_DEFINE([BUILD_HEADLESS_COMPOSITOR], [1], [Build the headless compositor])
201fi
202
203
204AC_ARG_ENABLE(rpi-compositor,
205	      AS_HELP_STRING([--disable-rpi-compositor],
206	                     [do not build the Raspberry Pi backend]),,
207	      enable_rpi_compositor=yes)
208AM_CONDITIONAL(ENABLE_RPI_COMPOSITOR, test "x$enable_rpi_compositor" = "xyes")
209have_bcm_host="no"
210if test "x$enable_rpi_compositor" = "xyes"; then
211  AC_DEFINE([BUILD_RPI_COMPOSITOR], [1], [Build the compositor for Raspberry Pi])
212  PKG_CHECK_MODULES(RPI_COMPOSITOR, [libudev >= 136 mtdev >= 1.1.0])
213  PKG_CHECK_MODULES(RPI_BCM_HOST, [bcm_host],
214                    [have_bcm_host="yes"
215                     AC_DEFINE([HAVE_BCM_HOST], [1], [have Raspberry Pi BCM headers])],
216                    [AC_MSG_WARN([Raspberry Pi BCM host libraries not found, will use stubs instead.])])
217fi
218AM_CONDITIONAL(INSTALL_RPI_COMPOSITOR, test "x$have_bcm_host" = "xyes")
219
220
221AC_ARG_ENABLE([fbdev-compositor], [  --enable-fbdev-compositor],,
222              enable_fbdev_compositor=yes)
223AM_CONDITIONAL([ENABLE_FBDEV_COMPOSITOR],
224               [test x$enable_fbdev_compositor = xyes])
225AS_IF([test x$enable_fbdev_compositor = xyes], [
226  AC_DEFINE([BUILD_FBDEV_COMPOSITOR], [1], [Build the fbdev compositor])
227  PKG_CHECK_MODULES([FBDEV_COMPOSITOR], [libudev >= 136 mtdev >= 1.1.0])
228])
229
230AC_ARG_ENABLE([rdp-compositor], [  --enable-rdp-compositor],,
231              enable_rdp_compositor=no)
232AM_CONDITIONAL([ENABLE_RDP_COMPOSITOR],
233               [test x$enable_rdp_compositor = xyes])
234if test x$enable_rdp_compositor = xyes; then
235  AC_DEFINE([BUILD_RDP_COMPOSITOR], [1], [Build the RDP compositor])
236  PKG_CHECK_MODULES(RDP_COMPOSITOR, [freerdp >= 1.1.0])
237
238  SAVED_CPPFLAGS="$CPPFLAGS"
239  CPPFLAGS="$CPPFLAGS $RDP_COMPOSITOR_CFLAGS"
240  AC_CHECK_HEADERS([freerdp/version.h])
241  CPPFLAGS="$SAVED_CPPFLAGS"
242fi
243
244AC_ARG_ENABLE([screen-sharing], [  --enable-screen-sharing],,
245              enable_screen_sharing=no)
246AM_CONDITIONAL([ENABLE_SCREEN_SHARING],
247               [test x$enable_screen_sharing = xyes])
248if test x$enable_screen_sharing = xyes; then
249  PKG_CHECK_MODULES(SCREEN_SHARE, [wayland-client])
250
251  if test x$enable_rdp_compositor != xyes; then
252    AC_MSG_WARN([The screen-share.so module requires the RDP backend.])
253  fi
254fi
255
256AC_ARG_WITH(cairo,
257	    AS_HELP_STRING([--with-cairo=@<:@image|gl|glesv2@:>@]
258			   [Which Cairo renderer to use for the clients]),
259			   [],[with_cairo="image"])
260
261if test "x$with_cairo" = "ximage"; then
262	cairo_modules="cairo"
263else
264if test "x$with_cairo" = "xgl"; then
265	cairo_modules="cairo-gl"
266	AC_MSG_WARN([The --with-cairo=gl option can cause increased resource usage and potential instability, and thus is not recommended.  It is needed only for a few special demo programs.])
267else
268if test "x$with_cairo" = "xglesv2"; then
269	cairo_modules="cairo-glesv2"
270	AC_MSG_WARN([The --with-cairo=gles2 option can cause increased resource usage and potential instability, and thus is not recommended.  It is needed only for a few special demo programs.])
271else
272	AC_ERROR([Unknown cairo renderer requested])
273fi
274fi
275fi
276
277# Included for legacy compat
278AC_ARG_WITH(cairo-glesv2,
279            AS_HELP_STRING([--with-cairo-glesv2],
280                           [Use GLESv2 cairo]))
281if test "x$with_cairo_glesv2" = "xyes"; then
282  cairo_modules="cairo-glesv2"
283  with_cairo="glesv2"
284fi
285
286if test "x$cairo_modules" = "xcairo-glesv2"; then
287AC_DEFINE([USE_CAIRO_GLESV2], [1], [Use the GLESv2 GL cairo backend])
288fi
289
290PKG_CHECK_MODULES(PIXMAN, [pixman-1])
291PKG_CHECK_MODULES(PNG, [libpng])
292PKG_CHECK_MODULES(WEBP, [libwebp], [have_webp=yes], [have_webp=no])
293AS_IF([test "x$have_webp" = "xyes"],
294      [AC_DEFINE([HAVE_WEBP], [1], [Have webp])])
295
296AC_ARG_ENABLE(vaapi-recorder, [  --enable-vaapi-recorder],,
297	      enable_vaapi_recorder=auto)
298if test x$enable_vaapi_recorder != xno; then
299  PKG_CHECK_MODULES(LIBVA, [libva >= 0.34.0 libva-drm >= 0.34.0],
300                    [have_libva=yes], [have_libva=no])
301  if test "x$have_libva" = "xno" -a "x$enable_vaapi_recorder" = "xyes"; then
302    AC_MSG_ERROR([vaapi-recorder explicitly enabled, but libva couldn't be found])
303  fi
304  AS_IF([test "x$have_libva" = "xyes"],
305        [AC_DEFINE([BUILD_VAAPI_RECORDER], [1], [Build the vaapi recorder])])
306fi
307AM_CONDITIONAL(ENABLE_VAAPI_RECORDER, test "x$have_libva" = xyes)
308
309
310AC_CHECK_LIB([jpeg], [jpeg_CreateDecompress], have_jpeglib=yes)
311if test x$have_jpeglib = xyes; then
312  JPEG_LIBS="-ljpeg"
313else
314  AC_ERROR([libjpeg not found])
315fi
316AC_SUBST(JPEG_LIBS)
317
318PKG_CHECK_MODULES(CAIRO, [cairo])
319
320PKG_CHECK_MODULES(TEST_CLIENT, [wayland-client >= 1.9.0])
321
322AC_ARG_ENABLE(simple-clients,
323              AS_HELP_STRING([--disable-simple-clients],
324                             [do not build the simple wl_shm clients]),,
325              enable_simple_clients=yes)
326AM_CONDITIONAL(BUILD_SIMPLE_CLIENTS, test "x$enable_simple_clients" = "xyes")
327if test x$enable_simple_clients = xyes; then
328  PKG_CHECK_MODULES(SIMPLE_CLIENT, [wayland-client])
329fi
330
331AC_ARG_ENABLE(simple-egl-clients,
332              AS_HELP_STRING([--disable-simple-egl-clients],
333                             [do not build the simple EGL clients]),,
334              enable_simple_egl_clients="$enable_egl")
335AM_CONDITIONAL(BUILD_SIMPLE_EGL_CLIENTS, test "x$enable_simple_egl_clients" = "xyes")
336if test x$enable_simple_egl_clients = xyes; then
337  PKG_CHECK_MODULES(SIMPLE_EGL_CLIENT,
338                    [egl >= 7.10 glesv2 wayland-client wayland-egl wayland-cursor])
339fi
340
341AC_ARG_ENABLE(simple-intel-dmabuf-client,
342              AS_HELP_STRING([--disable-simple-intel-dmabuf-client],
343                             [do not build the simple intel dmabuf client]),,
344              enable_simple_intel_dmabuf_client="auto")
345if ! test "x$enable_simple_intel_dmabuf_client" = "xno"; then
346  PKG_CHECK_MODULES(SIMPLE_DMABUF_CLIENT, [wayland-client libdrm libdrm_intel],
347		    have_simple_dmabuf_client=yes, have_simple_dmabuf_client=no)
348  if test "x$have_simple_dmabuf_client" = "xno" -a "x$enable_simple_intel_dmabuf_client" = "xyes"; then
349    AC_MSG_ERROR([Intel dmabuf client explicitly enabled, but libdrm_intel couldn't be found])
350  fi
351  enable_simple_intel_dmabuf_client="$have_simple_dmabuf_client"
352fi
353AM_CONDITIONAL(BUILD_SIMPLE_INTEL_DMABUF_CLIENT, test "x$enable_simple_intel_dmabuf_client" = "xyes")
354
355AC_ARG_ENABLE(clients, [  --enable-clients],, enable_clients=yes)
356AM_CONDITIONAL(BUILD_CLIENTS, test x$enable_clients = xyes)
357if test x$enable_clients = xyes; then
358  AC_DEFINE([BUILD_CLIENTS], [1], [Build the Wayland clients])
359
360  PKG_CHECK_MODULES(CLIENT, [wayland-client >= 1.5.91 cairo >= 1.10.0 xkbcommon wayland-cursor])
361  PKG_CHECK_MODULES(SERVER, [wayland-server])
362  PKG_CHECK_MODULES(WESTON_INFO, [wayland-client >= 1.5.91])
363
364  # Only check for cairo-egl if a GL or GLES renderer requested
365  AS_IF([test "x$cairo_modules" = "xcairo-gl" -o "x$cairo_modules" = "xcairo-glesv2"], [
366    PKG_CHECK_MODULES(CAIRO_EGL, [wayland-egl egl >= 7.10 cairo-egl >= 1.11.3 $cairo_modules],
367                      [have_cairo_egl=yes], [have_cairo_egl=no])
368    AS_IF([test "x$have_cairo_egl" = "xyes"],
369	  [AC_DEFINE([HAVE_CAIRO_EGL], [1], [Have cairo-egl])],
370	  [AC_ERROR([cairo-egl not used because $CAIRO_EGL_PKG_ERRORS])])],
371  [have_cairo_egl=no])
372
373  PKG_CHECK_MODULES(PANGO, [pangocairo], [have_pango=yes], [have_pango=no])
374fi
375
376AC_ARG_ENABLE(resize-optimization,
377              AS_HELP_STRING([--disable-resize-optimization],
378                             [disable resize optimization allocating a big buffer in toytoolkit]),,
379              enable_resize_optimization=yes)
380AS_IF([test "x$enable_resize_optimization" = "xyes"],
381      [AC_DEFINE([USE_RESIZE_POOL], [1], [Use resize memory pool as a performance optimization])])
382
383PKG_CHECK_MODULES(SYSTEMD_LOGIN, [libsystemd-login >= 198],
384                  [have_systemd_login=yes], [have_systemd_login=no])
385AS_IF([test "x$have_systemd_login" = "xyes"],
386      [AC_DEFINE([HAVE_SYSTEMD_LOGIN], [1], [Have systemd-login])])
387AM_CONDITIONAL(HAVE_SYSTEMD_LOGIN, test "x$have_systemd_login" = "xyes")
388
389PKG_CHECK_MODULES(SYSTEMD_LOGIN_209, [libsystemd-login >= 209],
390                  [have_systemd_login_209=yes], [have_systemd_login_209=no])
391AS_IF([test "x$have_systemd_login_209" = "xyes"],
392      [AC_DEFINE([HAVE_SYSTEMD_LOGIN_209], [1], [Have systemd-login >= 209])])
393
394AC_ARG_ENABLE(weston-launch, [  --enable-weston-launch],, enable_weston_launch=yes)
395AM_CONDITIONAL(BUILD_WESTON_LAUNCH, test x$enable_weston_launch == xyes)
396if test x$enable_weston_launch == xyes; then
397  AC_CHECK_LIB([pam], [pam_open_session], [have_pam=yes], [have_pam=no])
398  if test x$have_pam == xno; then
399    AC_ERROR([weston-launch requires pam])
400  fi
401  PAM_LIBS=-lpam
402  AC_SUBST(PAM_LIBS)
403fi
404
405AM_CONDITIONAL(HAVE_PANGO, test "x$have_pango" = "xyes")
406
407AM_CONDITIONAL(HAVE_CAIRO_GLESV2,
408	       [test "x$have_cairo_egl" = "xyes" -a "x$cairo_modules" = "xcairo-glesv2" -a "x$enable_egl" = "xyes"])
409
410AM_CONDITIONAL(BUILD_FULL_GL_CLIENTS,
411	       test x$cairo_modules = "xcairo-gl" -a "x$have_cairo_egl" = "xyes" -a "x$enable_egl" = "xyes")
412
413AM_CONDITIONAL(BUILD_SUBSURFACES_CLIENT,
414	       [test '(' "x$have_cairo_egl" != "xyes" -o "x$cairo_modules" = "xcairo-glesv2" ')' -a "x$enable_simple_egl_clients" = "xyes"])
415
416AM_CONDITIONAL(ENABLE_DESKTOP_SHELL, true)
417
418AC_ARG_ENABLE(fullscreen-shell,
419              AS_HELP_STRING([--disable-fullscreen-shell],
420                             [do not build fullscreen-shell server plugin]),,
421	      enable_fullscreen_shell=yes)
422AM_CONDITIONAL(ENABLE_FULLSCREEN_SHELL,
423	       test "x$enable_fullscreen_shell" = "xyes")
424
425# CMS modules
426AC_ARG_ENABLE(colord,
427              AS_HELP_STRING([--disable-colord],
428                             [do not build colord CMS support]),,
429	      enable_colord=auto)
430if test "x$enable_colord" != "xno"; then
431	PKG_CHECK_MODULES(COLORD,
432			  colord >= 0.1.27,
433			  have_colord=yes,
434			  have_colord=no)
435	if test "x$have_colord" = "xno" -a "x$enable_colord" = "xyes"; then
436	  AC_MSG_ERROR([colord support explicitly requested, but colord couldn't be found])
437	fi
438	if test "x$have_colord" = "xyes"; then
439	     enable_colord=yes
440	fi
441fi
442AM_CONDITIONAL(ENABLE_COLORD, test "x$enable_colord" = "xyes")
443
444# dbus support
445AC_ARG_ENABLE(dbus,
446              AS_HELP_STRING([--disable-dbus],
447                             [do not build with dbus support]),,
448              enable_dbus=auto)
449if test "x$enable_dbus" != "xno"; then
450        PKG_CHECK_MODULES(DBUS,
451                          dbus-1 >= 1.6,
452                          have_dbus=yes,
453                          have_dbus=no)
454        if test "x$have_dbus" = "xno" -a "x$enable_dbus" = "xyes"; then
455                AC_MSG_ERROR([dbus support explicitly requested, but libdbus couldn't be found])
456        fi
457        if test "x$have_dbus" = "xyes"; then
458                enable_dbus=yes
459                AC_DEFINE([HAVE_DBUS], [1], [Build with dbus support])
460        else
461                enable_dbus=no
462        fi
463fi
464AM_CONDITIONAL(ENABLE_DBUS, test "x$enable_dbus" = "xyes")
465
466# Note that other features might want libxml2, or this feature might use
467# alternative xml libraries at some point. Therefore the feature and
468# pre-requisite concepts are split.
469AC_ARG_ENABLE(junit_xml,
470	      AS_HELP_STRING([--disable-junit-xml],
471			     [do not build with JUnit XML output]),,
472	      enable_junit_xml=auto)
473if test "x$enable_junit_xml" != "xno"; then
474	PKG_CHECK_MODULES(LIBXML2,
475			  [libxml-2.0 >= 2.6],
476			  have_libxml2=yes,
477			  have_libxml2=no)
478	if test "x$have_libxml2" = "xno" -a "x$enable_junit_xml" = "xyes"; then
479		AC_MSG_ERROR([JUnit XML support explicitly requested, but libxml2 couldn't be found])
480	fi
481	if test "x$have_libxml2" = "xyes"; then
482		enable_junit_xml=yes
483		AC_DEFINE(ENABLE_JUNIT_XML, [1], [Build Weston with JUnit output support])
484	else
485		enable_junit_xml=no
486	fi
487fi
488AM_CONDITIONAL(ENABLE_JUNIT_XML, test "x$enable_junit_xml" = "xyes")
489
490# ivi-shell support
491AC_ARG_ENABLE(ivi-shell,
492              AS_HELP_STRING([--disable-ivi-shell],
493                             [do not build ivi-shell server plugin and client]),,
494	      enable_ivi_shell=yes)
495AM_CONDITIONAL(ENABLE_IVI_SHELL, test "x$enable_ivi_shell" = "xyes")
496
497AC_ARG_ENABLE(wcap-tools, [  --disable-wcap-tools],, enable_wcap_tools=yes)
498AM_CONDITIONAL(BUILD_WCAP_TOOLS, test x$enable_wcap_tools = xyes)
499if test x$enable_wcap_tools = xyes; then
500  AC_DEFINE([BUILD_WCAP_TOOLS], [1], [Build the wcap tools])
501  PKG_CHECK_MODULES(WCAP, [cairo])
502  WCAP_LIBS="$WCAP_LIBS -lm"
503fi
504
505PKG_CHECK_MODULES(SETBACKLIGHT, [libudev libdrm], enable_setbacklight=yes, enable_setbacklight=no)
506AM_CONDITIONAL(BUILD_SETBACKLIGHT, test "x$enable_setbacklight" = "xyes")
507
508if test "x$GCC" = "xyes"; then
509	GCC_CFLAGS="-Wall -Wextra -Wno-unused-parameter \
510		-Wno-missing-field-initializers -g -fvisibility=hidden \
511		-Wstrict-prototypes -Wmissing-prototypes -Wsign-compare"
512fi
513AC_SUBST(GCC_CFLAGS)
514
515AC_ARG_ENABLE(libunwind,
516              AS_HELP_STRING([--disable-libunwind],
517                             [Disable libunwind usage for backtraces]),,
518              enable_libunwind=auto)
519AM_CONDITIONAL(HAVE_LIBUNWIND, [test "x$enable_libunwind" = xyes])
520if test "x$enable_libunwind" != "xno"; then
521        PKG_CHECK_MODULES(LIBUNWIND,
522                          libunwind,
523                          have_libunwind=yes,
524                          have_libunwind=no)
525        if test "x$have_libunwind" = "xno" -a "x$enable_libunwind" = "xyes"; then
526          AC_MSG_ERROR([libunwind support explicitly requested, but libunwind couldn't be found])
527        fi
528        if test "x$have_libunwind" = "xyes"; then
529             enable_libunwind=yes
530             AC_DEFINE(HAVE_LIBUNWIND, 1, [Have libunwind support])
531        fi
532fi
533
534
535if test "x$WESTON_NATIVE_BACKEND" = "x"; then
536	WESTON_NATIVE_BACKEND="drm-backend.so"
537fi
538AC_MSG_NOTICE([Weston's native backend: $WESTON_NATIVE_BACKEND])
539AC_DEFINE_UNQUOTED([WESTON_NATIVE_BACKEND], ["$WESTON_NATIVE_BACKEND"],
540		   [The default backend to load, if not wayland nor x11.])
541
542if test "x$WESTON_SHELL_CLIENT" = "x"; then
543	WESTON_SHELL_CLIENT="weston-desktop-shell"
544fi
545AC_MSG_NOTICE([Weston's default desktop shell client: $WESTON_SHELL_CLIENT])
546AC_DEFINE_UNQUOTED([WESTON_SHELL_CLIENT], ["$WESTON_SHELL_CLIENT"],
547		   [The default desktop shell client to load.])
548
549AC_ARG_ENABLE(demo-clients-install,
550              AS_HELP_STRING([--enable-demo-clients-install],
551                             [Install demo clients built with weston]),,
552			     enable_demo_clients_install=no)
553AM_CONDITIONAL(INSTALL_DEMO_CLIENTS, [test "x$enable_demo_clients_install" = "xyes"])
554
555PKG_CHECK_MODULES(LCMS, lcms2,
556                  [have_lcms=yes], [have_lcms=no])
557if test "x$have_lcms" = xyes; then
558       AC_DEFINE(HAVE_LCMS, 1, [Have lcms support])
559fi
560AM_CONDITIONAL(HAVE_LCMS, [test "x$have_lcms" = xyes])
561
562AC_PATH_PROG([wayland_scanner], [wayland-scanner])
563if test x$wayland_scanner = x; then
564	PKG_CHECK_MODULES(WAYLAND_SCANNER, [wayland-scanner])
565	wayland_scanner=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner`
566fi
567
568AC_CONFIG_FILES([Makefile src/version.h src/weston.pc])
569
570AM_CONDITIONAL([HAVE_GIT_REPO], [test -f $srcdir/.git/logs/HEAD])
571
572AC_OUTPUT
573
574AC_MSG_RESULT([
575	Native Backend			${WESTON_NATIVE_BACKEND}
576	setuid Install			${enable_setuid_install}
577
578	Cairo Renderer			${with_cairo}
579	EGL				${enable_egl}
580	libxkbcommon			${enable_xkbcommon}
581	xcb_xkb				${have_xcb_xkb}
582	XWayland			${enable_xwayland}
583	dbus				${enable_dbus}
584
585	ivi-shell			${enable_ivi_shell}
586
587	Build wcap utility		${enable_wcap_tools}
588	Build Fullscreen Shell		${enable_fullscreen_shell}
589	Enable developer documentation	${enable_devdocs}
590
591	weston-launch utility		${enable_weston_launch}
592	systemd-login support		${have_systemd_login}
593
594	DRM Compositor			${enable_drm_compositor}
595	X11 Compositor			${enable_x11_compositor}
596	Wayland Compositor		${enable_wayland_compositor}
597	Headless Compositor		${enable_headless_compositor}
598	RPI Compositor			${enable_rpi_compositor}
599	FBDEV Compositor		${enable_fbdev_compositor}
600	RDP Compositor			${enable_rdp_compositor}
601	Screen Sharing			${enable_screen_sharing}
602	JUnit XML output		${enable_junit_xml}
603
604	Raspberry Pi BCM headers	${have_bcm_host}
605
606	Build Clients			${enable_clients}
607	Build EGL Clients		${have_cairo_egl}
608	Build Simple Clients		${enable_simple_clients}
609	Build Simple EGL Clients	${enable_simple_egl_clients}
610
611	Install Demo Clients		${enable_demo_clients_install}
612
613	Colord Support			${have_colord}
614	LCMS2 Support			${have_lcms}
615	libwebp Support			${have_webp}
616	libunwind Support		${have_libunwind}
617	VA H.264 encoding Support	${have_libva}
618])
619