fix weston launch error
[platform/upstream/weston.git] / configure.ac
1 m4_define([weston_major_version], [5])
2 m4_define([weston_minor_version], [0])
3 m4_define([weston_micro_version], [0])
4 m4_define([weston_version],
5           [weston_major_version.weston_minor_version.weston_micro_version])
6 m4_define([libweston_major_version], [5])
7 m4_define([libweston_minor_version], [0])
8 m4_define([libweston_patch_version], [0])
9
10 AC_PREREQ([2.64])
11 AC_INIT([weston],
12         [weston_version],
13         [https://gitlab.freedesktop.org/wayland/weston/issues/],
14         [weston],
15         [https://wayland.freedesktop.org])
16
17 WAYLAND_PREREQ_VERSION="1.12.0"
18
19 AC_SUBST([WESTON_VERSION_MAJOR], [weston_major_version])
20 AC_SUBST([WESTON_VERSION_MINOR], [weston_minor_version])
21 AC_SUBST([WESTON_VERSION_MICRO], [weston_micro_version])
22 AC_SUBST([WESTON_VERSION], [weston_version])
23 AC_SUBST([LIBWESTON_MAJOR], [libweston_major_version])
24 # We use minor as current and age since on ABI/API break/removal we bump major
25 # so minor will be reset to 0.
26 m4_define([lt_current], [libweston_minor_version])
27 m4_define([lt_revision], [libweston_patch_version])
28 m4_define([lt_age], [libweston_minor_version])
29 AC_SUBST([LT_VERSION_INFO], [lt_current:lt_revision:lt_age])
30
31 AC_CONFIG_AUX_DIR([build-aux])
32 AC_CONFIG_HEADERS([config.h])
33 AC_CONFIG_MACRO_DIR([m4])
34
35 AC_USE_SYSTEM_EXTENSIONS
36 AC_SYS_LARGEFILE
37
38 save_CFLAGS="$CFLAGS"
39 export CFLAGS="$CFLAGS -Werror"
40 AC_HEADER_MAJOR
41 CFLAGS="$save_CFLAGS"
42
43 AM_INIT_AUTOMAKE([1.11 parallel-tests foreign no-dist-gzip dist-xz color-tests subdir-objects])
44
45 AM_SILENT_RULES([yes])
46
47 # Check Weston and libweston version consistency
48 m4_if(m4_cmp(weston_micro_version, [90]), [-1],
49       [
50         dnl micro < 90
51         dnl A final or stable release, not a pre-release:
52         dnl Weston and libweston versions must match.
53         m4_if(weston_version, libweston_major_version[.]libweston_minor_version[.]libweston_patch_version,
54               [],
55               [AC_MSG_ERROR([Weston and libweston version mismatch for a final release])])
56       ],
57       [
58         dnl A pre-release:
59         dnl libweston must be equal or greater than weston.
60         m4_case(m4_list_cmp([weston_major_version, weston_minor_version, weston_micro_version],
61                              [libweston_major_version, libweston_minor_version, libweston_patch_version]),
62                  [-1], [
63                         dnl weston < libweston
64                         dnl libweston must be weston_major+1.0.0
65                         m4_if(m4_eval(weston_major_version+1)[.0.0],
66                               libweston_major_version[.]libweston_minor_version[.]libweston_patch_version,
67                               [],
68                               [AC_MSG_ERROR([libweston version is greater but not (weston_major+1).0.0])])
69                  ],
70                  [0], [
71                         dnl weston == libweston, all ok
72                  ],
73                  [1], [
74                         dnl weston > libweston, wrong
75                         AC_MSG_ERROR([Weston version is greater than libweston.])
76                  ])
77        ])
78
79 # Check for programs
80 AC_PROG_CC
81 AC_PROG_SED
82
83 # Initialize libtool
84 LT_PREREQ([2.2])
85 LT_INIT([disable-static])
86
87 AC_ARG_VAR([WESTON_NATIVE_BACKEND],
88            [Set the native backend to use, if Weston is not running under Wayland nor X11. @<:@default=drm-backend.so@:>@])
89 AC_ARG_VAR([WESTON_SHELL_CLIENT],
90            [Set the default desktop shell client to load if none is specified in weston.ini. @<:@default=weston-desktop-shell@:>@])
91
92 PKG_PROG_PKG_CONFIG()
93
94 # Check for dlsym instead of dlopen because ASAN hijacks the latter
95 WESTON_SEARCH_LIBS([DL], [dl], [dlsym])
96
97 # In old glibc versions (< 2.17) clock_gettime() and clock_getres() are in librt
98 WESTON_SEARCH_LIBS([CLOCK_GETTIME], [rt], [clock_gettime])
99 WESTON_SEARCH_LIBS([CLOCK_GETRES], [rt], [clock_getres])
100
101 AC_CHECK_DECL(SFD_CLOEXEC,[],
102               [AC_MSG_ERROR("SFD_CLOEXEC is needed to compile weston")],
103               [[#include <sys/signalfd.h>]])
104 AC_CHECK_DECL(TFD_CLOEXEC,[],
105               [AC_MSG_ERROR("TFD_CLOEXEC is needed to compile weston")],
106               [[#include <sys/timerfd.h>]])
107 AC_CHECK_DECL(CLOCK_MONOTONIC,[],
108               [AC_MSG_ERROR("CLOCK_MONOTONIC is needed to compile weston")],
109               [[#include <time.h>]])
110 AC_CHECK_HEADERS([execinfo.h])
111
112 AC_CHECK_FUNCS([mkostemp strchrnul initgroups posix_fallocate])
113
114 # check for libdrm as a build-time dependency only
115 # libdrm 2.4.30 introduced drm_fourcc.h.
116 PKG_CHECK_MODULES(LIBDRM, [libdrm >= 2.4.68], [], [AC_MSG_ERROR([
117      libdrm is a hard build-time dependency for libweston core,
118      but a sufficient version was not found. However, libdrm
119      is not a runtime dependency unless you have features
120      enabled that require it.])])
121
122 COMPOSITOR_MODULES="wayland-server >= $WAYLAND_PREREQ_VERSION pixman-1 >= 0.25.2"
123
124 AC_CONFIG_FILES([doc/doxygen/tools.doxygen doc/doxygen/tooldev.doxygen])
125
126 AC_ARG_ENABLE(devdocs,
127               AS_HELP_STRING([--disable-devdocs],
128                              [do not enable building of developer documentation]),,
129               enable_devdocs=auto)
130 if test "x$enable_devdocs" != "xno"; then
131         AC_CHECK_PROGS([DOXYGEN], [doxygen])
132         if test "x$DOXYGEN" = "x" -a "x$enable_devdocs" = "xyes"; then
133                 AC_MSG_ERROR([Developer documentation explicitly requested, but Doxygen couldn't be found])
134         fi
135         if test "x$DOXYGEN" != "x"; then
136                 enable_devdocs=yes
137         else
138                 enable_devdocs=no
139         fi
140 fi
141 AM_CONDITIONAL(ENABLE_DEVDOCS, test "x$enable_devdocs" = "xyes")
142
143 AC_ARG_ENABLE(egl, [  --disable-egl],,
144               enable_egl=yes)
145 AM_CONDITIONAL(ENABLE_EGL, test x$enable_egl = xyes)
146 if test x$enable_egl = xyes; then
147         AC_DEFINE([ENABLE_EGL], [1], [Build Weston with EGL support])
148         PKG_CHECK_MODULES(EGL, [egl glesv2])
149         PKG_CHECK_MODULES([EGL_TESTS], [egl glesv2 wayland-client wayland-egl])
150         AC_CHECK_HEADERS([linux/sync_file.h])
151 fi
152
153 COMPOSITOR_MODULES="$COMPOSITOR_MODULES xkbcommon >= 0.3.0"
154
155 PKG_CHECK_MODULES(XKBCOMMON_COMPOSE, [xkbcommon >= 0.5.0],
156                   [AC_DEFINE(HAVE_XKBCOMMON_COMPOSE, 1,
157                      [Define if xkbcommon is 0.5.0 or newer])],true)
158
159 AC_ARG_ENABLE(setuid-install, [  --enable-setuid-install],,
160               enable_setuid_install=yes)
161 AM_CONDITIONAL(ENABLE_SETUID_INSTALL, test x$enable_setuid_install = xyes)
162
163
164 AC_ARG_ENABLE(xwayland, [  --enable-xwayland],,
165               enable_xwayland=yes)
166 AC_ARG_ENABLE(xwayland-test, [  --enable-xwayland-test],,
167               enable_xwayland_test=yes)
168 AM_CONDITIONAL(ENABLE_XWAYLAND, test x$enable_xwayland = xyes)
169 AM_CONDITIONAL(ENABLE_XWAYLAND_TEST, test x$enable_xwayland = xyes -a x$enable_xwayland_test = xyes)
170 if test x$enable_xwayland = xyes; then
171   PKG_CHECK_MODULES([XWAYLAND], xcb xcb-xfixes xcb-composite xcb-shape xcursor cairo-xcb)
172   AC_DEFINE([BUILD_XWAYLAND], [1], [Build the X server launcher])
173
174   AC_ARG_WITH(xserver-path, AS_HELP_STRING([--with-xserver-path=PATH],
175               [Path to X server]), [XSERVER_PATH="$withval"],
176               [XSERVER_PATH="/usr/bin/Xwayland"])
177   AC_SUBST([XSERVER_PATH])
178   if test x$enable_xwayland_test = xyes; then
179     PKG_CHECK_MODULES([XWAYLAND_TEST], x11)
180   fi
181 fi
182
183 AC_ARG_ENABLE(x11-compositor, [  --enable-x11-compositor],,
184               enable_x11_compositor=yes)
185 AM_CONDITIONAL(ENABLE_X11_COMPOSITOR, test x$enable_x11_compositor = xyes)
186 have_xcb_xkb=no
187 if test x$enable_x11_compositor = xyes; then
188   PKG_CHECK_MODULES([XCB], xcb >= 1.8)
189   X11_COMPOSITOR_MODULES="x11 x11-xcb xcb-shm"
190
191   PKG_CHECK_MODULES(X11_COMPOSITOR_XKB, [xcb-xkb >= 1.9],
192                     [have_xcb_xkb="yes"], [have_xcb_xkb="no"])
193   if test "x$have_xcb_xkb" = xyes; then
194         X11_COMPOSITOR_MODULES="$X11_COMPOSITOR_MODULES xcb-xkb"
195         AC_DEFINE([HAVE_XCB_XKB], [1], [libxcb supports XKB protocol])
196   fi
197
198   PKG_CHECK_MODULES(X11_COMPOSITOR, [$X11_COMPOSITOR_MODULES])
199   AC_DEFINE([BUILD_X11_COMPOSITOR], [1], [Build the X11 compositor])
200 fi
201
202
203 AC_ARG_ENABLE(drm-compositor, [  --enable-drm-compositor],,
204               enable_drm_compositor=yes)
205 AM_CONDITIONAL(ENABLE_DRM_COMPOSITOR, test x$enable_drm_compositor = xyes)
206 if test x$enable_drm_compositor = xyes; then
207   AC_DEFINE([BUILD_DRM_COMPOSITOR], [1], [Build the DRM compositor])
208   PKG_CHECK_MODULES(DRM_COMPOSITOR, [libudev >= 136 libdrm >= 2.4.30 gbm])
209   PKG_CHECK_MODULES(DRM_COMPOSITOR_MODIFIERS, [libdrm >= 2.4.71],
210                     [AC_DEFINE([HAVE_DRM_ADDFB2_MODIFIERS], 1, [libdrm supports modifiers])],
211                     [AC_MSG_WARN([libdrm does not support AddFB2 with modifiers])])
212   PKG_CHECK_MODULES(DRM_COMPOSITOR_ATOMIC, [libdrm >= 2.4.78],
213                     [AC_DEFINE([HAVE_DRM_ATOMIC], 1, [libdrm supports atomic API])],
214                     [AC_MSG_WARN([libdrm does not support atomic modesetting, will omit that capability])])
215   PKG_CHECK_MODULES(DRM_COMPOSITOR_FORMATS_BLOB, [libdrm >= 2.4.83],
216                     [AC_DEFINE([HAVE_DRM_FORMATS_BLOB], 1, [libdrm supports modifier advertisement])],
217                     [AC_MSG_WARN([libdrm does not support modifier advertisement])])
218   PKG_CHECK_MODULES(DRM_COMPOSITOR_GBM_MODIFIERS, [gbm >= 17.1],
219                     [AC_DEFINE([HAVE_GBM_MODIFIERS], 1, [GBM supports modifiers])],
220                     [AC_MSG_WARN([GBM does not support modifiers])])
221   PKG_CHECK_MODULES(DRM_COMPOSITOR_GBM, [gbm >= 17.2],
222                     [AC_DEFINE([HAVE_GBM_FD_IMPORT], 1, [gbm supports import with modifiers])],
223                     [AC_MSG_WARN([GBM does not support dmabuf import, will omit that capability])])
224 fi
225
226
227 PKG_CHECK_MODULES(LIBINPUT_BACKEND, [libinput >= 0.8.0])
228 PKG_CHECK_MODULES(COMPOSITOR, [$COMPOSITOR_MODULES])
229
230 PKG_CHECK_MODULES(WAYLAND_PROTOCOLS, [wayland-protocols >= 1.13],
231                   [ac_wayland_protocols_pkgdatadir=`$PKG_CONFIG --variable=pkgdatadir wayland-protocols`])
232 AC_SUBST(WAYLAND_PROTOCOLS_DATADIR, $ac_wayland_protocols_pkgdatadir)
233
234 AC_ARG_ENABLE(wayland-compositor, [  --enable-wayland-compositor],,
235               enable_wayland_compositor=yes)
236 AM_CONDITIONAL(ENABLE_WAYLAND_COMPOSITOR,
237                test x$enable_wayland_compositor = xyes)
238 if test x$enable_wayland_compositor = xyes; then
239   AC_DEFINE([BUILD_WAYLAND_COMPOSITOR], [1],
240             [Build the Wayland (nested) compositor])
241   PKG_CHECK_MODULES(WAYLAND_COMPOSITOR, [wayland-client >= $WAYLAND_PREREQ_VERSION wayland-cursor])
242   if test x$enable_egl = xyes; then
243     PKG_CHECK_MODULES(WAYLAND_COMPOSITOR_EGL, [wayland-egl])
244   fi
245 fi
246
247
248 AC_ARG_ENABLE(headless-compositor, [  --enable-headless-compositor],,
249               enable_headless_compositor=yes)
250 AM_CONDITIONAL(ENABLE_HEADLESS_COMPOSITOR,
251                test x$enable_headless_compositor = xyes)
252 if test x$enable_headless_compositor = xyes; then
253   AC_DEFINE([BUILD_HEADLESS_COMPOSITOR], [1], [Build the headless compositor])
254 fi
255
256
257 AC_ARG_ENABLE([fbdev-compositor], [  --enable-fbdev-compositor],,
258               enable_fbdev_compositor=yes)
259 AM_CONDITIONAL([ENABLE_FBDEV_COMPOSITOR],
260                [test x$enable_fbdev_compositor = xyes])
261 AS_IF([test x$enable_fbdev_compositor = xyes], [
262   AC_DEFINE([BUILD_FBDEV_COMPOSITOR], [1], [Build the fbdev compositor])
263   PKG_CHECK_MODULES([FBDEV_COMPOSITOR], [libudev >= 136])
264 ])
265
266 AC_ARG_ENABLE([rdp-compositor], [  --enable-rdp-compositor],,
267               enable_rdp_compositor=no)
268 AM_CONDITIONAL([ENABLE_RDP_COMPOSITOR],
269                [test x$enable_rdp_compositor = xyes])
270 if test x$enable_rdp_compositor = xyes; then
271   AC_DEFINE([BUILD_RDP_COMPOSITOR], [1], [Build the RDP compositor])
272   PKG_CHECK_MODULES(RDP_COMPOSITOR, [freerdp2 >= 2.0.0],
273     [],
274     [PKG_CHECK_MODULES(RDP_COMPOSITOR, [freerdp >= 1.1.0],[])]
275   )
276   SAVED_CPPFLAGS="$CPPFLAGS"
277   CPPFLAGS="$CPPFLAGS $RDP_COMPOSITOR_CFLAGS"
278
279   AC_CHECK_HEADERS([freerdp/version.h])
280   AC_CHECK_MEMBER([SURFACE_BITS_COMMAND.bmp],
281         [AC_DEFINE([HAVE_SURFACE_BITS_BMP], [1], [SURFACE_BITS_CMD has bmp field])],
282         [],
283         [[#include <freerdp/update.h>]]
284   )
285
286
287   CPPFLAGS="$SAVED_CPPFLAGS"
288 fi
289
290 AC_ARG_ENABLE([screen-sharing], [  --enable-screen-sharing],,
291               enable_screen_sharing=no)
292 AM_CONDITIONAL([ENABLE_SCREEN_SHARING],
293                [test x$enable_screen_sharing = xyes])
294 if test x$enable_screen_sharing = xyes; then
295   PKG_CHECK_MODULES(SCREEN_SHARE, [wayland-client])
296
297   if test x$enable_rdp_compositor != xyes; then
298     AC_MSG_WARN([The screen-share.so module requires the RDP backend.])
299   fi
300 fi
301
302 AC_ARG_WITH(cairo,
303             AS_HELP_STRING([--with-cairo=@<:@image|gl|glesv2@:>@]
304                            [Which Cairo renderer to use for the clients]),
305                            [],[with_cairo="image"])
306
307 if test "x$with_cairo" = "ximage"; then
308         cairo_modules="cairo"
309 else
310 if test "x$with_cairo" = "xgl"; then
311         cairo_modules="cairo-gl"
312         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.])
313 else
314 if test "x$with_cairo" = "xglesv2"; then
315         cairo_modules="cairo-glesv2"
316         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.])
317 else
318         AC_ERROR([Unknown cairo renderer requested])
319 fi
320 fi
321 fi
322
323 # Included for legacy compat
324 AC_ARG_WITH(cairo-glesv2,
325             AS_HELP_STRING([--with-cairo-glesv2],
326                            [Use GLESv2 cairo]))
327 if test "x$with_cairo_glesv2" = "xyes"; then
328   cairo_modules="cairo-glesv2"
329   with_cairo="glesv2"
330 fi
331
332 if test "x$cairo_modules" = "xcairo-glesv2"; then
333 AC_DEFINE([USE_CAIRO_GLESV2], [1], [Use the GLESv2 GL cairo backend])
334 fi
335
336 PKG_CHECK_MODULES(PIXMAN, [pixman-1])
337 PKG_CHECK_MODULES(PNG, [libpng])
338
339 AC_ARG_WITH([jpeg],
340             AS_HELP_STRING([--without-jpeg],
341                            [Use jpeglib for JPEG decoding support [default=auto]]))
342 AS_IF([test "x$with_jpeg" != "xno"],
343       [WESTON_SEARCH_LIBS([JPEG], [jpeg], [jpeg_CreateDecompress], [have_jpeglib=yes], [have_jpeglib=no])],
344       [have_jpeglib=no])
345 AS_IF([test "x$have_jpeglib" = "xyes"],
346       [AC_DEFINE([HAVE_JPEG], [1], [Have jpeglib])],
347       [AS_IF([test "x$with_jpeg" = "xyes"],
348              [AC_MSG_ERROR([JPEG support explicitly requested, but jpeglib couldn't be found])])])
349
350 AC_ARG_WITH([webp],
351             AS_HELP_STRING([--without-webp],
352                            [Use libwebp for WebP decoding support [default=auto]]))
353 AS_IF([test "x$with_webp" != "xno"],
354       [PKG_CHECK_MODULES(WEBP, [libwebp], [have_webp=yes], [have_webp=no])],
355       [have_webp=no])
356 AS_IF([test "x$have_webp" = "xyes"],
357       [AC_DEFINE([HAVE_WEBP], [1], [Have webp])],
358       [AS_IF([test "x$with_webp" = "xyes"],
359              [AC_MSG_ERROR([WebP support explicitly requested, but libwebp couldn't be found])])])
360
361 AC_ARG_ENABLE(vaapi-recorder, [  --enable-vaapi-recorder],,
362               enable_vaapi_recorder=auto)
363 have_libva=no
364 if test x$enable_vaapi_recorder != xno; then
365   PKG_CHECK_MODULES(LIBVA, [libva >= 0.34.0 libva-drm >= 0.34.0],
366                     [have_libva=yes], [have_libva=no])
367   if test "x$have_libva" = "xno" -a "x$enable_vaapi_recorder" = "xyes"; then
368     AC_MSG_ERROR([vaapi-recorder explicitly enabled, but libva couldn't be found])
369   fi
370   AS_IF([test "x$have_libva" = "xyes"],
371         [AC_DEFINE([BUILD_VAAPI_RECORDER], [1], [Build the vaapi recorder])])
372 fi
373 AM_CONDITIONAL(ENABLE_VAAPI_RECORDER, test "x$have_libva" = xyes)
374
375 PKG_CHECK_MODULES(CAIRO, [cairo])
376
377 PKG_CHECK_MODULES(TEST_CLIENT, [wayland-client >= $WAYLAND_PREREQ_VERSION pixman-1])
378
379 AC_ARG_ENABLE(simple-clients,
380               AS_HELP_STRING([--disable-simple-clients],
381                              [do not build the simple wl_shm clients]),,
382               enable_simple_clients=yes)
383 AM_CONDITIONAL(BUILD_SIMPLE_CLIENTS, test "x$enable_simple_clients" = "xyes")
384 if test x$enable_simple_clients = xyes; then
385   PKG_CHECK_MODULES(SIMPLE_CLIENT, [wayland-client])
386 fi
387
388 AC_ARG_ENABLE(simple-egl-clients,
389               AS_HELP_STRING([--disable-simple-egl-clients],
390                              [do not build the simple EGL clients]),,
391               enable_simple_egl_clients="$enable_egl")
392 AM_CONDITIONAL(BUILD_SIMPLE_EGL_CLIENTS, test "x$enable_simple_egl_clients" = "xyes")
393 if test x$enable_simple_egl_clients = xyes; then
394   PKG_CHECK_MODULES(SIMPLE_EGL_CLIENT,
395                     [egl glesv2 wayland-client wayland-egl wayland-cursor])
396 fi
397
398 AC_ARG_ENABLE(simple-dmabuf-drm-client,
399               AS_HELP_STRING([--disable-simple-dmabuf-drm-client],
400                              [do not build the simple dmabuf drm client]),,
401               enable_simple_dmabuf_drm_client="auto")
402 if ! test "x$enable_simple_dmabuf_drm_client" = "xno"; then
403   PKG_CHECK_MODULES(SIMPLE_DMABUF_DRM_CLIENT, [wayland-client libdrm], [have_simple_dmabuf_libs=yes],
404                     [have_simple_dmabuf_libs=no])
405
406   PKG_CHECK_MODULES(LIBDRM_PLATFORM_FREEDRENO, [libdrm_freedreno],
407       AC_DEFINE([HAVE_LIBDRM_FREEDRENO], [1], [Build freedreno dmabuf client]) have_simple_dmabuf_drm_client=yes,
408       [true])
409   PKG_CHECK_MODULES(LIBDRM_PLATFORM_INTEL, [libdrm_intel],
410       AC_DEFINE([HAVE_LIBDRM_INTEL], [1], [Build intel dmabuf client]) have_simple_dmabuf_drm_client=yes,
411       [true])
412   PKG_CHECK_MODULES(LIBDRM_PLATFORM_ETNAVIV, [libdrm_etnaviv],
413       AC_DEFINE([HAVE_LIBDRM_ETNAVIV], [1], [Build etnaviv dmabuf client]) have_simple_dmabuf_drm_client=yes,
414       [true])
415
416   if test "x$have_simple_dmabuf_drm_client" != "xyes" -o \
417           "x$have_simple_dmabuf_libs" = "xno" && \
418      test "x$enable_simple_dmabuf_drm_client" = "xyes"; then
419     AC_MSG_ERROR([DRM dmabuf client explicitly enabled, but none of libdrm_{intel,freedreno,etnaviv} found])
420   fi
421
422   if test "x$have_simple_dmabuf_drm_client" = "xyes" -a "x$have_simple_dmabuf_libs" = "xyes"; then
423     enable_simple_dmabuf_drm_client="yes"
424   fi
425 fi
426 AM_CONDITIONAL(BUILD_SIMPLE_DMABUF_DRM_CLIENT, test "x$enable_simple_dmabuf_drm_client" = "xyes")
427
428 AC_ARG_ENABLE(simple-dmabuf-v4l-client,
429               AS_HELP_STRING([--disable-simple-dmabuf-v4l-client],
430                              [do not build the simple dmabuf v4l client]),,
431               enable_simple_dmabuf_v4l_client="auto")
432 if ! test "x$enable_simple_dmabuf_v4l_client" = "xno"; then
433   PKG_CHECK_MODULES(SIMPLE_DMABUF_V4L_CLIENT, [wayland-client libdrm],
434                     have_simple_dmabuf_v4l_client=yes, have_simple_dmabuf_v4l_client=no)
435   if test "x$have_simple_dmabuf_v4l_client" = "xno" -a "x$enable_simple_dmabuf_v4l_client" = "xyes"; then
436     AC_MSG_ERROR([V4L dmabuf client explicitly enabled, but libdrm couldn't be found])
437   fi
438   enable_simple_dmabuf_v4l_client="$have_simple_dmabuf_v4l_client"
439 fi
440 AM_CONDITIONAL(BUILD_SIMPLE_DMABUF_V4L_CLIENT, test "x$enable_simple_dmabuf_v4l_client" = "xyes")
441
442 AC_ARG_ENABLE(clients, [  --enable-clients],, enable_clients=yes)
443 AM_CONDITIONAL(BUILD_CLIENTS, test x$enable_clients = xyes)
444 have_cairo_egl=no
445 if test x$enable_clients = xyes; then
446   AC_DEFINE([BUILD_CLIENTS], [1], [Build the Wayland clients])
447
448   PKG_CHECK_MODULES(CLIENT, [wayland-client >= $WAYLAND_PREREQ_VERSION cairo >= 1.10.0 xkbcommon wayland-cursor])
449   PKG_CHECK_MODULES(SERVER, [wayland-server])
450   PKG_CHECK_MODULES(WESTON_INFO, [wayland-client >= $WAYLAND_PREREQ_VERSION])
451
452   # Only check for cairo-egl if a GL or GLES renderer requested
453   AS_IF([test "x$cairo_modules" = "xcairo-gl" -o "x$cairo_modules" = "xcairo-glesv2"], [
454     PKG_CHECK_MODULES(CAIRO_EGL, [wayland-egl egl cairo-egl >= 1.11.3 $cairo_modules],
455                       [have_cairo_egl=yes], [have_cairo_egl=no])
456     AS_IF([test "x$have_cairo_egl" = "xyes"],
457           [AC_DEFINE([HAVE_CAIRO_EGL], [1], [Have cairo-egl])],
458           [AC_ERROR([cairo-egl not used because $CAIRO_EGL_PKG_ERRORS])])],
459   [have_cairo_egl=no])
460
461   PKG_CHECK_MODULES(PANGO, [pangocairo pango glib-2.0 >= 2.36], [have_pango=yes], [have_pango=no])
462 fi
463
464 AC_ARG_ENABLE(resize-optimization,
465               AS_HELP_STRING([--disable-resize-optimization],
466                              [disable resize optimization allocating a big buffer in toytoolkit]),,
467               enable_resize_optimization=yes)
468 AS_IF([test "x$enable_resize_optimization" = "xyes"],
469       [AC_DEFINE([USE_RESIZE_POOL], [1], [Use resize memory pool as a performance optimization])])
470
471 AC_ARG_ENABLE(weston-launch, [  --enable-weston-launch],, enable_weston_launch=yes)
472 AM_CONDITIONAL(BUILD_WESTON_LAUNCH, test x$enable_weston_launch = xyes)
473 if test x$enable_weston_launch = xyes; then
474   WESTON_SEARCH_LIBS([PAM], [pam], [pam_open_session], [have_pam=yes], [have_pam=no])
475   if test x$have_pam = xno; then
476     AC_ERROR([weston-launch requires pam])
477   fi
478 fi
479
480 AM_CONDITIONAL(HAVE_PANGO, test "x$have_pango" = "xyes")
481 if test "x$have_pango" = "xyes"; then
482   AC_DEFINE([HAVE_PANGO], [1], [Have pango])
483 fi
484
485 AM_CONDITIONAL(HAVE_CAIRO_GLESV2,
486                [test "x$have_cairo_egl" = "xyes" -a "x$cairo_modules" = "xcairo-glesv2" -a "x$enable_egl" = "xyes"])
487
488 AM_CONDITIONAL(BUILD_FULL_GL_CLIENTS,
489                test x$cairo_modules = "xcairo-gl" -a "x$have_cairo_egl" = "xyes" -a "x$enable_egl" = "xyes")
490
491 AM_CONDITIONAL(BUILD_SUBSURFACES_CLIENT,
492                [test '(' "x$have_cairo_egl" != "xyes" -o "x$cairo_modules" = "xcairo-glesv2" ')' -a "x$enable_simple_egl_clients" = "xyes"])
493
494 AM_CONDITIONAL(ENABLE_DESKTOP_SHELL, true)
495
496 AC_ARG_ENABLE(fullscreen-shell,
497               AS_HELP_STRING([--disable-fullscreen-shell],
498                              [do not build fullscreen-shell server plugin]),,
499               enable_fullscreen_shell=yes)
500 AM_CONDITIONAL(ENABLE_FULLSCREEN_SHELL,
501                test "x$enable_fullscreen_shell" = "xyes")
502
503 # CMS modules
504 AC_ARG_ENABLE(colord,
505               AS_HELP_STRING([--disable-colord],
506                              [do not build colord CMS support]),,
507               enable_colord=auto)
508 have_colord=no
509 if test "x$enable_colord" != "xno"; then
510         PKG_CHECK_MODULES(COLORD,
511                           colord >= 0.1.27,
512                           have_colord=yes,
513                           have_colord=no)
514         if test "x$have_colord" = "xno" -a "x$enable_colord" = "xyes"; then
515           AC_MSG_ERROR([colord support explicitly requested, but colord couldn't be found])
516         fi
517         if test "x$have_colord" = "xyes"; then
518              enable_colord=yes
519         fi
520 fi
521 AM_CONDITIONAL(ENABLE_COLORD, test "x$enable_colord" = "xyes")
522
523 # dbus support
524 AC_ARG_ENABLE(dbus,
525               AS_HELP_STRING([--disable-dbus],
526                              [do not build with dbus support]),,
527               enable_dbus=auto)
528 have_dbus=no
529 if test "x$enable_dbus" != "xno"; then
530         PKG_CHECK_MODULES(DBUS,
531                           dbus-1 >= 1.6,
532                           have_dbus=yes,
533                           have_dbus=no)
534         if test "x$have_dbus" = "xno" -a "x$enable_dbus" = "xyes"; then
535                 AC_MSG_ERROR([dbus support explicitly requested, but libdbus couldn't be found])
536         fi
537         if test "x$have_dbus" = "xyes"; then
538                 enable_dbus=yes
539                 AC_DEFINE([HAVE_DBUS], [1], [Build with dbus support])
540         else
541                 enable_dbus=no
542         fi
543 fi
544 AM_CONDITIONAL(ENABLE_DBUS, test "x$enable_dbus" = "xyes")
545
546 # systemd-login support
547 AC_ARG_ENABLE(systemd-login,
548               AS_HELP_STRING([--enable-systemd-login],
549                              [Enable logind support]),,
550               enable_systemd_login=auto)
551 if test x$enable_systemd_login != xno -a x$have_dbus != xno; then
552   PKG_CHECK_MODULES(SYSTEMD_LOGIN,
553                     [libsystemd >= 209],
554                     [have_systemd_login_209=yes;have_systemd_login=yes],
555                     [have_systemd_login_209=no;have_systemd_login=no])
556
557   # Older versions of systemd package systemd-login separately. Fall back on that
558   AS_IF([test x$have_systemd_login != xyes],[
559         PKG_CHECK_MODULES(SYSTEMD_LOGIN,
560                           [libsystemd-login >= 198],
561                           [have_systemd_login=yes],
562                           [have_systemd_login=no])
563         ])
564 else
565   have_systemd_login=no
566 fi
567
568 if test "x$have_systemd_login" = "xno" -a "x$enable_systemd_login" = "xyes"; then
569   AC_MSG_ERROR([systemd-login support explicitly enabled, but can't find libsystemd>=209, libsystemd-login or dbus])
570 fi
571
572 AS_IF([test "x$have_systemd_login" = "xyes"],
573       [AC_DEFINE([HAVE_SYSTEMD_LOGIN], [1], [Have systemd-login])])
574 AM_CONDITIONAL(HAVE_SYSTEMD_LOGIN, test "x$have_systemd_login" = "xyes")
575
576 AS_IF([test "x$have_systemd_login_209" = "xyes"],
577       [AC_DEFINE([HAVE_SYSTEMD_LOGIN_209], [1], [Have systemd-login >= 209])])
578
579
580 # Note that other features might want libxml2, or this feature might use
581 # alternative xml libraries at some point. Therefore the feature and
582 # pre-requisite concepts are split.
583 AC_ARG_ENABLE(junit_xml,
584               AS_HELP_STRING([--disable-junit-xml],
585                              [do not build with JUnit XML output]),,
586               enable_junit_xml=auto)
587 if test "x$enable_junit_xml" != "xno"; then
588         PKG_CHECK_MODULES(LIBXML2,
589                           [libxml-2.0 >= 2.6],
590                           have_libxml2=yes,
591                           have_libxml2=no)
592         if test "x$have_libxml2" = "xno" -a "x$enable_junit_xml" = "xyes"; then
593                 AC_MSG_ERROR([JUnit XML support explicitly requested, but libxml2 couldn't be found])
594         fi
595         if test "x$have_libxml2" = "xyes"; then
596                 enable_junit_xml=yes
597                 AC_DEFINE(ENABLE_JUNIT_XML, [1], [Build Weston with JUnit output support])
598         else
599                 enable_junit_xml=no
600         fi
601 fi
602 AM_CONDITIONAL(ENABLE_JUNIT_XML, test "x$enable_junit_xml" = "xyes")
603
604 # ivi-shell support
605 AC_ARG_ENABLE(ivi-shell,
606               AS_HELP_STRING([--disable-ivi-shell],
607                              [do not build ivi-shell server plugin and client]),,
608               enable_ivi_shell=yes)
609 AM_CONDITIONAL(ENABLE_IVI_SHELL, test "x$enable_ivi_shell" = "xyes")
610
611 AC_ARG_ENABLE(wcap-tools, [  --disable-wcap-tools],, enable_wcap_tools=yes)
612 AM_CONDITIONAL(BUILD_WCAP_TOOLS, test x$enable_wcap_tools = xyes)
613 if test x$enable_wcap_tools = xyes; then
614   AC_DEFINE([BUILD_WCAP_TOOLS], [1], [Build the wcap tools])
615   PKG_CHECK_MODULES(WCAP, [cairo])
616   WCAP_LIBS="$WCAP_LIBS -lm"
617 fi
618
619 PKG_CHECK_MODULES(SETBACKLIGHT, [libudev libdrm], enable_setbacklight=yes, enable_setbacklight=no)
620 AM_CONDITIONAL(BUILD_SETBACKLIGHT, test "x$enable_setbacklight" = "xyes")
621
622 if test "x$GCC" = "xyes"; then
623         GCC_CFLAGS="-Wall -Wextra -Wno-unused-parameter \
624                 -Wno-shift-negative-value -Wno-missing-field-initializers \
625                 -g -fvisibility=hidden \
626                 -Wstrict-prototypes -Wmissing-prototypes -Wsign-compare"
627 fi
628 AC_SUBST(GCC_CFLAGS)
629
630
631 if test "x$WESTON_NATIVE_BACKEND" = "x"; then
632         WESTON_NATIVE_BACKEND="drm-backend.so"
633 fi
634 AC_MSG_NOTICE([Weston's native backend: $WESTON_NATIVE_BACKEND])
635 AC_DEFINE_UNQUOTED([WESTON_NATIVE_BACKEND], ["$WESTON_NATIVE_BACKEND"],
636                    [The default backend to load, if not wayland nor x11.])
637
638 if test "x$WESTON_SHELL_CLIENT" = "x"; then
639         WESTON_SHELL_CLIENT="weston-desktop-shell"
640 fi
641 AC_MSG_NOTICE([Weston's default desktop shell client: $WESTON_SHELL_CLIENT])
642 AC_DEFINE_UNQUOTED([WESTON_SHELL_CLIENT], ["$WESTON_SHELL_CLIENT"],
643                    [The default desktop shell client to load.])
644
645 AC_ARG_ENABLE(demo-clients-install,
646               AS_HELP_STRING([--enable-demo-clients-install],
647                              [Install demo clients built with weston]),,
648                              enable_demo_clients_install=no)
649 AM_CONDITIONAL(INSTALL_DEMO_CLIENTS, [test "x$enable_demo_clients_install" = "xyes"])
650
651 AC_ARG_ENABLE(lcms,
652               AS_HELP_STRING([--disable-lcms],
653                              [Disable lcms support]),,
654               enable_lcms=auto)
655 have_lcms=no
656 if test "x$enable_lcms" != "xno"; then
657         PKG_CHECK_MODULES(LCMS,
658                           lcms2,
659                           have_lcms=yes,
660                           have_lcms=no)
661         if test "x$have_lcms" = "xno" -a "x$enable_lcms" = "xyes"; then
662           AC_MSG_ERROR([lcms support explicitly requested, but lcms couldn't be found])
663         fi
664         if test "x$have_lcms" = "xyes"; then
665                 enable_lcms=yes
666                 AC_DEFINE(HAVE_LCMS, 1, [Have lcms support])
667         fi
668 fi
669 AM_CONDITIONAL(HAVE_LCMS, [test "x$enable_lcms" = xyes])
670
671 AC_PATH_PROG([wayland_scanner], [wayland-scanner])
672 if test x$wayland_scanner = x; then
673         PKG_CHECK_MODULES(WAYLAND_SCANNER, [wayland-scanner])
674         wayland_scanner=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner`
675 fi
676
677 AC_ARG_ENABLE(systemd_notify,
678               AS_HELP_STRING([--enable-systemd-notify],
679                              [Enables systemd notifications to
680                               notify systemd about weston state
681                               and update watchdog.
682                               Also sockets provided by systemd
683                               in case of socket-base activation
684                               are added to wayland display]),,
685               enable_systemd_notify=no)
686 AM_CONDITIONAL(SYSTEMD_NOTIFY_SUPPORT, test x$enable_systemd_notify = xyes)
687 if test "x$enable_systemd_notify" = "xyes"; then
688   AC_DEFINE([SYSTEMD_NOTIFY_SUPPORT], [1], [Build the systemd sd_notify support])
689   PKG_CHECK_MODULES(SYSTEMD_DAEMON, [libsystemd])
690 fi
691
692 AC_CONFIG_FILES([Makefile libweston/version.h compositor/weston.pc])
693
694 # AC_CONFIG_FILES needs the full name when running autoconf, so we need to use
695 # libweston_abi_version here, and outside [] because of m4 quoting rules
696 AC_CONFIG_FILES([libweston/libweston-]libweston_major_version[.pc:libweston/libweston.pc.in])
697 AC_CONFIG_FILES([libweston/libweston-]libweston_major_version[-uninstalled.pc:libweston/libweston-uninstalled.pc.in])
698 AC_CONFIG_FILES([libweston-desktop/libweston-desktop-]libweston_major_version[.pc:libweston-desktop/libweston-desktop.pc.in])
699 AC_CONFIG_FILES([libweston-desktop/libweston-desktop-]libweston_major_version[-uninstalled.pc:libweston-desktop/libweston-desktop-uninstalled.pc.in])
700
701 AM_CONDITIONAL([HAVE_GIT_REPO], [test -f $srcdir/.git/logs/HEAD])
702
703 AC_OUTPUT
704
705 AC_MSG_RESULT([
706         Native Backend                  ${WESTON_NATIVE_BACKEND}
707         setuid Install                  ${enable_setuid_install}
708
709         Cairo Renderer                  ${with_cairo}
710         EGL                             ${enable_egl}
711         xcb_xkb                         ${have_xcb_xkb}
712         XWayland                        ${enable_xwayland}
713         dbus                            ${enable_dbus}
714
715         ivi-shell                       ${enable_ivi_shell}
716
717         Build wcap utility              ${enable_wcap_tools}
718         Build Fullscreen Shell          ${enable_fullscreen_shell}
719         Enable developer documentation  ${enable_devdocs}
720
721         weston-launch utility           ${enable_weston_launch}
722         systemd-login support           ${have_systemd_login}
723         systemd notify support          ${enable_systemd_notify}
724
725         DRM Compositor                  ${enable_drm_compositor}
726         X11 Compositor                  ${enable_x11_compositor}
727         Wayland Compositor              ${enable_wayland_compositor}
728         Headless Compositor             ${enable_headless_compositor}
729         FBDEV Compositor                ${enable_fbdev_compositor}
730         RDP Compositor                  ${enable_rdp_compositor}
731         Screen Sharing                  ${enable_screen_sharing}
732         JUnit XML output                ${enable_junit_xml}
733
734         Build Clients                   ${enable_clients}
735         Build EGL Clients               ${have_cairo_egl}
736         Build Simple Clients            ${enable_simple_clients}
737         Build Simple EGL Clients        ${enable_simple_egl_clients}
738
739         Install Demo Clients            ${enable_demo_clients_install}
740
741         Colord Support                  ${have_colord}
742         LCMS2 Support                   ${have_lcms}
743         libjpeg Support                 ${have_jpeglib}
744         libwebp Support                 ${have_webp}
745         VA H.264 encoding Support       ${have_libva}
746 ])