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