1# clutter package version number, (as distinct from shared library version)
2# An odd micro number indicates in-progress development from Git
3# An even micro number indicates a released version
4#
5# Making a point release:
6# - increase clutter_micro_version to the next even number
7# - increase clutter_interface_age to the next even number
8# After the release:
9# - increase clutter_micro_version to the next odd number
10# - increase clutter_interface_version to the next odd number
11m4_define([clutter_major_version], [1])
12m4_define([clutter_minor_version], [26])
13m4_define([clutter_micro_version], [4])
14
15# • for stable releases: increase the interface age by 1 for each release
16# • for development releases: keep clutter_interface_age to 0
17m4_define([clutter_interface_age],
18          [m4_if(m4_eval(clutter_minor_version % 2), [1],
19                 [0],
20                 [clutter_micro_version])])
21
22m4_define([clutter_binary_age], [m4_eval(100 * clutter_minor_version + clutter_micro_version)])
23
24m4_define([clutter_release_status],
25          [m4_if(m4_eval(clutter_micro_version % 2), [1], [git],
26                 [m4_if(m4_eval(clutter_minor_version % 2), [1], [snapshot],
27                                                                 [release])])])
28
29m4_define([clutter_version], [clutter_major_version.clutter_minor_version.clutter_micro_version])
30
31# change this only when breaking the API
32m4_define([clutter_api_version], [1.0])
33
34AC_PREREQ([2.63])
35
36AC_INIT([clutter],
37        [clutter_version],
38        [http://bugzilla.gnome.org/enter_bug.cgi?product=clutter],
39        [clutter],
40        [http://www.clutter-project.org])
41
42AC_CONFIG_SRCDIR([clutter/clutter.h])
43AC_CONFIG_HEADERS([clutter/config.h])
44AC_CONFIG_AUX_DIR([build-aux])
45AC_CONFIG_MACRO_DIR([build-aux/autotools])
46
47AM_INIT_AUTOMAKE([1.11 foreign -Wno-portability no-define no-dist-gzip dist-xz tar-ustar])
48AM_SILENT_RULES([yes])
49
50AC_SUBST([CLUTTER_MAJOR_VERSION],  [clutter_major_version])
51AC_SUBST([CLUTTER_MINOR_VERSION],  [clutter_minor_version])
52AC_SUBST([CLUTTER_MICRO_VERSION],  [clutter_micro_version])
53AC_SUBST([CLUTTER_VERSION],        [clutter_version])
54AC_SUBST([CLUTTER_API_VERSION],    [clutter_api_version])
55AC_SUBST([CLUTTER_API_VERSION_AM], [$CLUTTER_MAJOR_VERSION\_0])
56AC_SUBST([CLUTTER_RELEASE_STATUS], [clutter_release_status])
57
58m4_define([lt_current],  [m4_eval(100 * clutter_minor_version + clutter_micro_version - clutter_interface_age)])
59m4_define([lt_revision], [clutter_interface_age])
60m4_define([lt_age],      [m4_eval(clutter_binary_age - clutter_interface_age)])
61CLUTTER_LT_CURRENT=lt_current
62CLUTTER_LT_REV=lt_revision
63CLUTTER_LT_AGE=lt_age
64CLUTTER_LT_VERSION="$CLUTTER_LT_CURRENT:$CLUTTER_LT_REV:$CLUTTER_LT_AGE"
65CLUTTER_LT_LDFLAGS="-version-info $CLUTTER_LT_VERSION"
66AC_SUBST([CLUTTER_LT_CURRENT],  [lt_current])
67AC_SUBST([CLUTTER_LT_REVISION], [lt_revision])
68AC_SUBST([CLUTTER_LT_VERSION],  [$CLUTTER_LT_VERSION])
69
70AC_PROG_SED
71
72dnl = Preliminary platform checks =============================================
73
74AC_CANONICAL_HOST
75
76platform_win32=no
77platform_quartz=no
78platform_linux=no
79
80AC_MSG_CHECKING([if building for some Win32 platform])
81AS_CASE([$host],
82        [*-*-mingw*|*-*-cygwin*],
83        [
84          CLUTTER_LT_LDFLAGS="$CLUTTER_LT_LDFLAGS -no-undefined"
85          platform_win32=yes
86        ],
87
88        [*-*-linux*],
89        [
90          platform_linux=yes
91        ],
92
93        []
94)
95AC_MSG_RESULT([$platform_win32])
96
97AM_CONDITIONAL(OS_WIN32, [test "$platform_win32" = "yes"])
98
99AC_CHECK_HEADER([OpenGL/gl.h], [platform_quartz=yes], [platform_quartz=no])
100AM_CONDITIONAL(OS_QUARTZ, [test "$platform_quartz" = "yes"])
101
102AM_CONDITIONAL(OS_LINUX, [test "$platform_linux" = "yes"])
103
104AC_SUBST(CLUTTER_LT_LDFLAGS)
105
106AC_CACHE_SAVE
107
108dnl = Dependencies =========================================================
109
110# Checks for programs.
111AM_PROG_CC_C_O
112
113# require libtool >= 2.2
114LT_PREREQ([2.2.6])
115LT_INIT([disable-static])
116LT_LIB_M
117
118# Checks for header files.
119AC_HEADER_STDC
120
121# required versions for dependencies
122m4_define([glib_req_version],           [2.53.4])
123m4_define([cogl_req_version],           [1.21.2])
124m4_define([json_glib_req_version],      [0.12.0])
125m4_define([atk_req_version],            [2.5.3])
126m4_define([cairo_req_version],          [1.14.0])
127m4_define([pango_req_version],          [1.30])
128m4_define([gi_req_version],             [1.39.0])
129m4_define([gtk_doc_req_version],        [1.20])
130m4_define([xcomposite_req_version],     [0.4])
131m4_define([gdk_req_version],            [3.22.6])
132m4_define([libinput_req_version],       [0.19.0])
133m4_define([libudev_req_version],        [136])
134
135AC_SUBST([GLIB_REQ_VERSION],       [glib_req_version])
136AC_SUBST([COGL_REQ_VERSION],       [cogl_req_version])
137AC_SUBST([JSON_GLIB_REQ_VERSION],  [json_glib_req_version])
138AC_SUBST([ATK_REQ_VERSION],        [atk_req_version])
139AC_SUBST([CAIRO_REQ_VERSION],      [cairo_req_version])
140AC_SUBST([PANGO_REQ_VERSION],      [pango_req_version])
141AC_SUBST([GI_REQ_VERSION],         [gi_req_version])
142AC_SUBST([GTK_DOC_REQ_VERSION],    [gtk_doc_req_version])
143AC_SUBST([XCOMPOSITE_REQ_VERSION], [xcomposite_req_version])
144AC_SUBST([GDK_REQ_VERSION],        [gdk_req_version])
145AC_SUBST([LIBINPUT_REQ_VERSION],   [libinput_req_version])
146AC_SUBST([LIBUDEV_REQ_VERSION],    [libudev_req_version])
147
148# Checks for typedefs, structures, and compiler characteristics.
149AM_PATH_GLIB_2_0([glib_req_version],
150                 [],
151                 [AC_MSG_ERROR([glib-2.0 is required])],
152                 [gobject gio gthread gmodule-no-export])
153
154# Check for -Bsymbolic-functions to avoid intra-library PLT jumps
155AC_ARG_ENABLE([Bsymbolic],
156              [AS_HELP_STRING([--disable-Bsymbolic],
157                              [Avoid linking with -Bsymbolic])],
158              [],
159              [
160                saved_LDFLAGS="${LDFLAGS}"
161                AC_MSG_CHECKING([for -Bsymbolic-functions linker flag])
162                LDFLAGS=-Wl,-Bsymbolic-functions
163                AC_TRY_LINK([], [return 0],
164                            [
165                              AC_MSG_RESULT([yes])
166                              enable_Bsymbolic=yes
167                            ],
168                            [
169                              AC_MSG_RESULT([no])
170                              enable_Bsymbolic=no
171                            ])
172                LDFLAGS="${saved_LDFLAGS}"
173              ])
174
175AS_IF([test "x$enable_Bsymbolic" = "xyes"], [CLUTTER_LINK_FLAGS=-Wl[,]-Bsymbolic-functions])
176AC_SUBST(CLUTTER_LINK_FLAGS)
177
178# Check for the visibility flags
179CLUTTER_HIDDEN_VISIBILITY_CFLAGS=""
180case "$host" in
181  *-*-mingw*)
182    dnl on mingw32 we do -fvisibility=hidden and __declspec(dllexport)
183    AC_DEFINE([_CLUTTER_EXTERN], [__attribute__((visibility("default"))) __declspec(dllexport) extern],
184              [defines how to decorate public symbols while building])
185    CFLAGS="${CFLAGS} -fvisibility=hidden"
186    ;;
187  *)
188    dnl on other compilers, check if we can do -fvisibility=hidden
189    SAVED_CFLAGS="${CFLAGS}"
190    CFLAGS="-fvisibility=hidden"
191    AC_MSG_CHECKING([for -fvisibility=hidden compiler flag])
192    AC_TRY_COMPILE([], [return 0],
193                   AC_MSG_RESULT(yes)
194                   enable_fvisibility_hidden=yes,
195                   AC_MSG_RESULT(no)
196                   enable_fvisibility_hidden=no)
197    CFLAGS="${SAVED_CFLAGS}"
198
199    AS_IF([test "${enable_fvisibility_hidden}" = "yes"], [
200      AC_DEFINE([_CLUTTER_EXTERN], [__attribute__((visibility("default"))) extern],
201                [defines how to decorate public symbols while building])
202      CLUTTER_HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden"
203    ])
204    ;;
205esac
206AC_SUBST(CLUTTER_HIDDEN_VISIBILITY_CFLAGS)
207
208AC_CACHE_SAVE
209
210dnl ========================================================================
211
212FLAVOUR_LIBS=""
213FLAVOUR_CFLAGS=""
214CLUTTER_BACKENDS=""
215CLUTTER_INPUT_BACKENDS=""
216CLUTTER_CONFIG_DEFINES=
217
218experimental_backend=no
219experimental_input_backend=no
220
221# base dependencies for core
222CLUTTER_BASE_PC_FILES="cogl-1.0 >= $COGL_REQ_VERSION cogl-path-1.0 cairo-gobject >= $CAIRO_REQ_VERSION gio-2.0 >= glib_req_version atk >= $ATK_REQ_VERSION pangocairo >= $PANGO_REQ_VERSION cogl-pango-1.0 json-glib-1.0 >= $JSON_GLIB_REQ_VERSION"
223
224# private base dependencies
225CLUTTER_BASE_PC_FILES_PRIVATE=""
226
227# backend specific pkg-config files
228BACKEND_PC_FILES=""
229
230# private backend specific dependencies
231BACKEND_PC_FILES_PRIVATE=""
232
233dnl === Clutter windowing system backend ======================================
234
235AC_ARG_ENABLE([x11-backend],
236              [AS_HELP_STRING([--enable-x11-backend=@<:@yes/no@:>@], [Enable the X11 backend (default=check)])],
237              [enable_x11=$enableval],
238              [enable_x11=check])
239AC_ARG_ENABLE([win32-backend],
240              [AS_HELP_STRING([--enable-win32-backend=@<:@yes/no@:>@], [Enable the Windows backend (default=check)])],
241              [enable_win32=$enableval],
242              [enable_win32=check])
243AC_ARG_ENABLE([quartz-backend],
244              [AS_HELP_STRING([--enable-quartz-backend=@<:@yes/no@:>@], [Enable the OS X backend (default=check)])],
245              [enable_osx=$enableval],
246              [enable_osx=check])
247AC_ARG_ENABLE([gdk-backend],
248              [AS_HELP_STRING([--enable-gdk-backend=@<:@yes/no@:>@], [Enable the GDK backend (default=check)])],
249              [enable_gdk=$enableval],
250              [enable_gdk=check])
251AC_ARG_ENABLE([wayland-backend],
252              [AS_HELP_STRING([--enable-wayland-backend=@<:@yes/no@:>@], [Enable the Wayland client backend (default=check)])],
253              [enable_wayland=$enableval],
254              [enable_wayland=check])
255AC_ARG_ENABLE([egl-backend],
256              [AS_HELP_STRING([--enable-egl-backend=@<:@yes/no@:>@], [Enable the EGL framebuffer backend (default=no)])],
257              [enable_egl=$enableval],
258              [enable_egl=check])
259AC_ARG_ENABLE([mir-backend],
260              [AS_HELP_STRING([--enable-mir-backend=@<:@yes/no@:>@], [Enable the Mir client backend (default=no)])],
261              [enable_mir=$enableval],
262              [enable_mir=no])
263AC_ARG_ENABLE([cex100-backend],
264              [AS_HELP_STRING([--enable-cex100-backend=@<:@yes/no@:>@], [Enable the CEx100 backend (default=no)])],
265              [enable_cex100=$enableval],
266              [enable_cex100=no])
267
268dnl Additional input backends
269AC_ARG_ENABLE([tslib-input],
270              [AS_HELP_STRING([--enable-tslib-input=@<:@yes/no@:>@], [Enable TSLib for input events (default=no)])],
271              [enable_tslib=$enableval],
272              [enable_tslib=no])
273AC_ARG_ENABLE([evdev-input],
274              [AS_HELP_STRING([--enable-evdev-input=@<:@yes/no@:>@], [Enable evdev for input events (default=check)])],
275              [enable_evdev=$enableval],
276              [enable_evdev=check])
277
278dnl Define default values
279AS_IF([test "x$enable_x11" = xcheck], [
280  PKG_CHECK_EXISTS([x11], [enable_x11=yes], [enable_x11=no])
281])
282
283AS_IF([test "x$enable_win32" = xcheck], [
284  AS_IF([test "x$platform_win32" = "xyes"], [enable_win32=yes], [enable_win32=no])
285])
286
287AS_IF([test "x$enable_osx" = xcheck], [
288  AS_IF([test "x$platform_quartz" = "xyes"], [enable_osx=yes], [enable_osx=no])
289])
290
291AS_IF([test "x$enable_gdk" = xcheck], [
292  PKG_CHECK_EXISTS([gdk-3.0 >= gdk_req_version], [enable_gdk=yes], [enable_gdk=no])
293])
294
295AS_IF([test "x$enable_egl" = xcheck], [
296  PKG_CHECK_EXISTS([egl], [enable_egl=yes], [enable_egl=no])
297  PKG_CHECK_EXISTS([libinput], [enable_evdev=yes], [enable_evdev=no])
298])
299
300dnl Per-backend rules
301AS_IF([test "x$enable_x11" = "xyes"],
302      [
303        CLUTTER_BACKENDS="$CLUTTER_BACKENDS x11"
304        CLUTTER_INPUT_BACKENDS="$CLUTTER_INPUT_BACKENDS x11"
305
306        SUPPORT_X11=1
307        SUPPORT_GLX=1
308        SUPPORT_COGL=1
309
310        # we use fontconfig API and pango-ft2 when the fontconfig
311        # configuration changes; we don't expose any API for this
312        # so we add pango-ft2 to the private Requires.
313        PKG_CHECK_EXISTS([pangoft2],
314                         [
315                           AC_DEFINE([HAVE_PANGO_FT2], [1], [Supports PangoFt2])
316                           BACKEND_PC_FILES_PRIVATE="$BACKEND_PC_FILES_PRIVATE pangoft2"
317                         ],
318                         [])
319      ])
320
321AS_IF([test "x$enable_gdk" = "xyes"],
322      [
323        CLUTTER_BACKENDS="$CLUTTER_BACKENDS gdk"
324        CLUTTER_INPUT_BACKENDS="$CLUTTER_INPUT_BACKENDS gdk"
325
326	SUPPORT_GDK=1
327        SUPPORT_COGL=1
328
329	BACKEND_PC_FILES="$BACKEND_PC_FILES gdk-3.0"
330      ])
331
332AS_IF([test "x$enable_wayland" != xno],
333      [
334        # We need to manually check for Wayland support in Cogl because
335        # the windowing systems are not exposed in the pkg-config file
336        saved_CFLAGS="${CFLAGS}"
337        CFLAGS="`$PKG_CONFIG --cflags cogl-1.0`"
338
339        AC_MSG_CHECKING([for Wayland Cogl backend])
340
341        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
342#include <cogl/cogl.h>
343]],
344[[
345#ifndef COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT
346#error Cogl compiled without Wayland support
347#endif
348]])], [
349          AC_MSG_RESULT(yes)
350          have_cogl_wayland=yes
351        ], [
352          AC_MSG_RESULT(no)
353          have_cogl_wayland=no
354        ])
355
356        CFLAGS="${saved_CFLAGS}"
357        AS_IF([test "x$have_cogl_wayland" = xyes],
358              [
359                PKG_CHECK_EXISTS([wayland-client wayland-cursor xkbcommon gdk-pixbuf-2.0],
360                                 [
361                                   BACKEND_PC_FILES="$BACKEND_PC_FILES wayland-cursor wayland-client xkbcommon"
362                                   BACKEND_PC_FILES_PRIVATE="$BACKEND_PC_FILES_PRIVATE gdk-pixbuf-2.0"
363
364                                   CLUTTER_BACKENDS="$CLUTTER_BACKENDS wayland"
365                                   CLUTTER_INPUT_BACKENDS="$CLUTTER_INPUT_BACKENDS wayland"
366
367                                   SUPPORT_WAYLAND=1
368                                   SUPPORT_COGL=1
369                                 ],
370                                 [
371                                   AS_IF([test "x$enable_wayland" = xyes],
372                                         [AC_MSG_ERROR(["*** Missing dependencies for Wayland support ***"])],
373                                         [enable_wayland=no])
374                                 ])
375              ],
376              [
377                AS_IF([test "x$enable_wayland" = xyes],
378                      [AC_MSG_ERROR("*** Cogl is missing Wayland support ***")],
379                      [enable_wayland=no])
380              ])
381      ])
382
383dnl Note this is orthogonal to the client side support and you can
384dnl use the Wayland compositor features with any of the clutter
385dnl backends with corresponding Cogl support.
386AC_ARG_ENABLE([wayland-compositor],
387              [AS_HELP_STRING([--enable-wayland-compositor=@<:@yes/no@:>@],
388                              [Enable Wayland compositor features (default=no)])],
389              [],
390              [AS_IF([test "x$SUPPORT_EGL" = "x1"],
391                     [enable_wayland_compositor=yes],
392                     [enable_wayland_compositor=no])
393              ])
394
395AS_IF([test "x$enable_wayland_compositor" = "xyes"],
396      [
397        PKG_CHECK_EXISTS([wayland-server],
398			 [BACKEND_PC_FILES="$BACKEND_PC_FILES wayland-server"], [])
399
400        SUPPORT_WAYLAND_COMPOSITOR=1
401        SUPPORT_COGL=1
402
403	CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
404#define CLUTTER_HAS_WAYLAND_COMPOSITOR_SUPPORT 1"
405      ])
406
407AM_CONDITIONAL(SUPPORT_WAYLAND_COMPOSITOR, [test "x$SUPPORT_WAYLAND_COMPOSITOR" = "x1"])
408
409AS_IF([test "x$enable_cex100" = "xyes"],
410      [
411        CLUTTER_BACKENDS="$CLUTTER_BACKENDS cex100"
412
413        experimental_backend="yes"
414
415        SUPPORT_CEX100=1
416        SUPPORT_COGL=1
417
418        have_gdl=no
419        AC_CHECK_HEADERS([libgdl.h], [have_gdl=yes])
420
421        AS_IF([test "x$have_gdl" = "xno"],
422              [
423                AC_CHECK_HEADERS([CE4100/libgdl.h],
424                                 [
425                                   FLAVOUR_CFLAGS="-I/usr/include/CE4100"
426                                   have_gdl=yes
427                                   CLUTTER_CEX100_LIBGDL_PREFIX=CE4100/
428                                 ])
429              ])
430
431        AS_IF([test "x$have_gdl" = "xno"],
432              [AC_MSG_ERROR([libgdl.h not found but the CEx100 backend has been explicitly enabled])])
433
434        AC_SUBST(CLUTTER_CEX100_LIBGDL_PREFIX)
435
436        FLAVOUR_LIBS="$FLAVOUR_LIBS -lgdl"
437
438        AC_DEFINE([CLUTTER_EGL_BACKEND_CEX100], [1], [Use CEX100 EGL backend])
439        AC_DEFINE([CLUTTER_EGL_BACKEND_GENERIC], [1], [Use Generic EGL backend])
440      ])
441
442AS_IF([test "x$enable_egl" = "xyes"],
443      [
444        CLUTTER_BACKENDS="$CLUTTER_BACKENDS egl"
445
446        SUPPORT_EGL=1
447        SUPPORT_COGL=1
448
449        FLAVOUR_LIBS="$FLAVOUR_LIBS $TSLIB_LIBS $EVDEV_LIBS"
450        FLAVOUR_CFLAGS="$FLAVOUR_CFLAGS $TSLIB_CFLAGS $EVDEV_CFLAGS"
451
452        AC_DEFINE([CLUTTER_EGL_BACKEND_GENERIC], [1], [Use Generic EGL backend])
453      ])
454
455AS_IF([test "x$enable_osx" = "xyes"],
456      [
457        CLUTTER_BACKENDS="$CLUTTER_BACKENDS osx"
458        CLUTTER_INPUT_BACKENDS="$CLUTTER_INPUT_BACKENDS osx"
459
460        FLAVOUR_LIBS="$FLAVOUR_LIBS -framework Cocoa -framework OpenGL"
461
462        SUPPORT_OSX=1
463      ])
464
465AS_IF([test "x$enable_win32" = "xyes"],
466      [
467        CLUTTER_BACKENDS="$CLUTTER_BACKENDS win32"
468        CLUTTER_INPUT_BACKENDS="$CLUTTER_INPUT_BACKENDS win32"
469
470        FLAVOUR_LIBS="$FLAVOUR_LIBS -lopengl32 -lgdi32 -lwinmm"
471        FLAVOUR_CFLAGS="$FLAVOUR_CFLAGS -D_WIN32_WINNT=0x0500"
472
473        AC_CHECK_TOOL(WINDRES, [windres], [AC_MSG_ERROR([*** windres is required])])
474
475        SUPPORT_WIN32=1
476      ])
477
478AS_IF([test "x$enable_mir" = "xyes"],
479      [
480        CLUTTER_BACKENDS="$CLUTTER_BACKENDS mir"
481        CLUTTER_INPUT_BACKENDS="$CLUTTER_INPUT_BACKENDS mir"
482
483        SUPPORT_MIR=1
484        SUPPORT_COGL=1
485
486        # We need to manually check for Mir support in Cogl because
487        # the windowing systems are not exposed in the pkg-config file
488        saved_CFLAGS="${CFLAGS}"
489        CFLAGS="`$PKG_CONFIG --cflags cogl-1.0`"
490
491        AC_MSG_CHECKING([for Mir Cogl backend])
492
493        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
494#include <cogl/cogl.h>
495]],
496[[
497#ifndef COGL_HAS_EGL_PLATFORM_MIR_SUPPORT
498#error Cogl compiled without Mir support
499#endif
500]])], [
501          AC_MSG_RESULT(yes)
502          have_cogl_mir=yes
503        ], [
504          AC_MSG_RESULT(no)
505          have_cogl_mir=no
506        ])
507
508        AS_IF([test "x$have_cogl_mir" = xno], [AC_MSG_ERROR("*** Cogl is missing Mir support.")])
509
510        PKG_CHECK_EXISTS([mirclient],
511                         [BACKEND_PC_FILES="$BACKEND_PC_FILES mirclient"],
512                         [])
513      ])
514
515AS_IF([test "x$CLUTTER_BACKENDS" = "x"],
516      [
517        AC_MSG_ERROR([No backend enabled. You need to enable at least one backend.])
518      ])
519
520AS_IF([test "x$platform_linux" = "xyes"],
521      [
522        AC_DEFINE([OS_LINUX], [1], [Define to 1 if building for Linux])
523      ])
524
525AS_IF([test "x$enable_tslib" = xyes], [
526  PKG_CHECK_EXISTS([tslib-1.0], [have_tslib=yes], [have_tslib=no])
527  AS_IF([test "x$have_tslib" = xyes], [
528    CLUTTER_INPUT_BACKENDS="$CLUTTER_INPUT_BACKENDS tslib"
529    experimental_input_backend="yes"
530    AC_DEFINE([HAVE_TSLIB], [1], [Have tslib for touchscreen handling])
531    SUPPORT_TSLIB=1
532  ])
533])
534
535AS_IF([test "x$enable_evdev" = xyes], [
536  PKG_CHECK_EXISTS([libinput gudev-1.0 xkbcommon], [have_evdev=yes], [have_evdev=no])
537  AS_IF([test "x$have_evdev" = "xyes"], [
538    CLUTTER_INPUT_BACKENDS="$CLUTTER_INPUT_BACKENDS evdev"
539    BACKEND_PC_FILES_PRIVATE="$BACKEND_PC_FILES_PRIVATE libudev >= $LIBUDEV_REQ_VERSION libinput >= $LIBINPUT_REQ_VERSION xkbcommon"
540    AC_DEFINE([HAVE_EVDEV], [1], [Have evdev support for input handling])
541    SUPPORT_EVDEV=1
542  ])
543])
544
545# conditionals for use in automake files...
546AM_CONDITIONAL(SUPPORT_GLX,     [test "x$SUPPORT_GLX" = "x1"])
547AM_CONDITIONAL(SUPPORT_X11,     [test "x$SUPPORT_X11" = "x1"])
548AM_CONDITIONAL(SUPPORT_GDK,     [test "x$SUPPORT_GDK" = "x1"])
549AM_CONDITIONAL(SUPPORT_EGL,     [test "x$SUPPORT_EGL" = "x1"])
550AM_CONDITIONAL(SUPPORT_OSX,     [test "x$SUPPORT_OSX" = "x1"])
551AM_CONDITIONAL(SUPPORT_WIN32,   [test "x$SUPPORT_WIN32" = "x1"])
552AM_CONDITIONAL(SUPPORT_CEX100,  [test "x$SUPPORT_CEX100" = "x1"])
553AM_CONDITIONAL(SUPPORT_WAYLAND, [test "x$SUPPORT_WAYLAND" = "x1"])
554AM_CONDITIONAL(SUPPORT_MIR,     [test "x$SUPPORT_MIR" = "x1"])
555
556AM_CONDITIONAL(USE_COGL,  [test "x$SUPPORT_COGL" = "x1"])
557AM_CONDITIONAL(USE_TSLIB, [test "x$have_tslib" = "xyes"])
558AM_CONDITIONAL(USE_EVDEV, [test "x$have_evdev" = "xyes"])
559AM_CONDITIONAL(USE_GLD,   [test "x$have_gdl" = "xyes"])
560
561AM_CONDITIONAL(NEED_XKB_UTILS, [test "x$have_evdev" = "xyes" -o "x$SUPPORT_WAYLAND" = "x1"])
562
563dnl Instead of using AM_CFLAGS to ensure
564dnl COGL_ENABLE_EXPERIMENTAL_2_0_API is defined while compiling clutter
565dnl and cogl code we use a define in config.h instead. This helps ensure
566dnl other tools such as glib-mkenums and gir-scanner don't end up
567dnl using the define also.
568AC_DEFINE([COGL_ENABLE_EXPERIMENTAL_2_0_API], [1], [Can use Cogl 2.0 API internally])
569
570AC_ARG_WITH([default-drivers],
571            [AS_HELP_STRING([--with-default-drivers=DRIVER], [Comma-separated list of Cogl drivers to use])],
572            [clutter_drivers=$withval],
573            [clutter_drivers="*"])
574
575AC_DEFINE_UNQUOTED([CLUTTER_DRIVERS], ["$clutter_drivers"], [List of Cogl drivers])
576
577dnl strip leading spaces
578CLUTTER_BACKENDS=${CLUTTER_BACKENDS#* }
579AC_SUBST(CLUTTER_BACKENDS)
580
581CLUTTER_INPUT_BACKENDS=${CLUTTER_INPUT_BACKENDS#* }
582AC_SUBST(CLUTTER_INPUT_BACKENDS)
583
584AC_CACHE_SAVE
585
586dnl === Clutter configuration =================================================
587
588# windowing systems
589AS_IF([test "x$SUPPORT_X11" = "x1"],
590      [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
591#define CLUTTER_WINDOWING_X11 \"x11\"
592#define CLUTTER_INPUT_X11 \"x11\""])
593AS_IF([test "x$SUPPORT_GDK" = "x1"],
594      [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
595#define CLUTTER_WINDOWING_GDK \"gdk\"
596#define CLUTTER_INPUT_GDK \"gdk\""])
597AS_IF([test "x$SUPPORT_GLX" = "x1"],
598      [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
599#define CLUTTER_WINDOWING_GLX \"glx\""])
600AS_IF([test "x$SUPPORT_EGL" = "x1"],
601      [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
602#define CLUTTER_WINDOWING_EGL \"eglnative\""])
603AS_IF([test "x$SUPPORT_WAYLAND" = "x1"],
604      [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
605#define CLUTTER_WINDOWING_WAYLAND \"wayland\""])
606AS_IF([test "x$SUPPORT_MIR" = "x1"],
607      [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
608#define CLUTTER_WINDOWING_MIR \"mir\"
609#define CLUTTER_INPUT_MIR \"mir\""])
610AS_IF([test "x$SUPPORT_OSX" = "x1"],
611      [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
612#define CLUTTER_WINDOWING_OSX \"osx\"
613#define CLUTTER_INPUT_OSX \"osx\""])
614AS_IF([test "x$SUPPORT_WIN32" = "x1"],
615      [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
616#define CLUTTER_WINDOWING_WIN32 \"win32\"
617#define CLUTTER_INPUT_WIN32 \"win32\""])
618AS_IF([test "x$SUPPORT_CEX100" = "x1"],
619      [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
620#define CLUTTER_WINDOWING_CEX100 \"cex100\""])
621AS_IF([test "x$SUPPORT_EVDEV" = "x1"],
622      [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
623#define CLUTTER_INPUT_EVDEV \"evdev\""])
624AS_IF([test "x$SUPPORT_TSLIB" = "x1"],
625      [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
626#define CLUTTER_INPUT_TSLIB \"tslib\""])
627AS_IF([test "x$SUPPORT_WAYLAND" = "x1"],
628      [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
629#define CLUTTER_INPUT_WAYLAND \"wayland\""])
630
631# the 'null' input backend is special
632CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
633#define CLUTTER_INPUT_NULL \"null\""
634
635AC_SUBST([CLUTTER_CONFIG_DEFINES])
636
637dnl === Clutter substitutions kept for backwards compatibility ================
638AC_SUBST([CLUTTER_WINSYS],       [deprecated])
639AC_SUBST([CLUTTER_WINSYS_BASE],  [deprecated])
640AC_SUBST([CLUTTER_STAGE_TYPE],   [deprecated])
641AC_SUBST([CLUTTER_SONAME_INFIX], [deprecated])
642AC_SUBST([CLUTTER_FLAVOUR],      [deprecated])
643AC_SUBST([CLUTTER_COGL],         [deprecated])
644AC_SUBST([COGL_DRIVER],          [deprecated])
645
646dnl === X11 checks, only for X11-based backends ===============================
647X11_PC_FILES=""
648X11_EXTS=""
649x11_tests=no
650
651AS_IF([test "x$SUPPORT_X11" = "x1"],
652      [
653        # base X11 includes and libraries
654        AC_MSG_CHECKING([for X11])
655
656        # start with pkg-config
657        PKG_CHECK_EXISTS([x11], [have_x11=yes], [have_x11=no])
658        AS_IF([test "x$have_x11" = "xyes"],
659              [
660                X11_PC_FILES="x11"
661
662                # we actually need to ask for CFLAGS and LIBS
663                X11_CFLAGS=`$PKG_CONFIG --cflags $X11_PC_FILES`
664                X11_LIBS=`$PKG_CONFIG --libs $X11_PC_FILES`
665
666                AC_MSG_RESULT([found])
667              ],
668              [
669                # no pkg-config, let's go old school
670                AC_PATH_X
671
672                AS_IF([test "x$no_x" = "xyes"],
673                      [AC_MSG_ERROR([No X11 Libraries found])],
674                      [
675                        AS_IF([test "x$x_includes" != "xNONE" && test -n "$x_includes"],
676                              [X11_CFLAGS=-I`echo $x_includes | sed -e "s/:/ -I/g"`])
677
678                        AS_IF([test "x$x_libraries" != "xNONE" && test -n "$x_libraries"],
679                              [X11_LIBS=-L`echo $x_libraries | sed -e "s/:/ -L/g"`])
680
681                        AC_MSG_RESULT([found])
682                      ]
683                )
684              ]
685        )
686
687        # XEXT (required)
688        AC_MSG_CHECKING([for XEXT extension])
689        PKG_CHECK_EXISTS([xext], [have_xext=yes], [have_xext=no])
690        AS_IF([test "x$have_xext" = "xyes"],
691              [
692                AC_DEFINE(HAVE_XEXT, [1], [Define to 1 if we have the XEXT X extension])
693
694                X11_LIBS="$X11_LIBS -lXext"
695                X11_PC_FILES="$X11_PC_FILES xext"
696                X11_EXTS="$X11_EXTS xext"
697
698                AC_MSG_RESULT([found])
699              ],
700              [AC_MSG_ERROR([Not found])]
701        )
702
703        # XDAMAGE (required)
704        AC_MSG_CHECKING([for XDAMAGE extension])
705        PKG_CHECK_EXISTS([xdamage], [have_xdamage=yes], [have_xdamage=no])
706        AS_IF([test "x$have_xdamage" = "xyes"],
707              [
708                AC_DEFINE(HAVE_XDAMAGE, [1], [Define to 1 if we have the XDAMAGE X extension])
709
710                X11_LIBS="$X11_LIBS -lXdamage"
711                X11_PC_FILES="$X11_PC_FILES xdamage"
712                X11_EXTS="$X11_EXTS xdamage"
713
714                AC_MSG_RESULT([found])
715              ],
716              [AC_MSG_ERROR([not found])]
717        )
718
719        # XCOMPOSITE (optional)
720        AC_MSG_CHECKING([for XCOMPOSITE extension >= $XCOMPOSITE_REQ_VERSION])
721        PKG_CHECK_EXISTS([xcomposite >= $XCOMPOSITE_REQ_VERSION], [have_xcomposite=yes], [have_xcomposite=no])
722        AS_IF([test "x$have_xcomposite" = "xyes"],
723              [
724                AC_DEFINE(HAVE_XCOMPOSITE, [1], [Define to 1 if we have the XCOMPOSITE X extension])
725
726                X11_LIBS="$X11_LIBS -lXcomposite"
727                X11_PC_FILES="$X11_PC_FILES xcomposite >= $XCOMPOSITE_REQ_VERSION"
728                X11_EXTS="$X11_EXTS xcomposite"
729
730                AC_MSG_RESULT([found])
731              ],
732              [AC_MSG_ERROR([not found])]
733        )
734
735        # X Generic Extensions (optional)
736        clutter_save_CPPFLAGS="$CPPFLAGS"
737        CPPFLAGS="$CPPFLAGS $X11_CFLAGS"
738
739        clutter_save_LIBS="$LIBS"
740        LIBS="$LIBS $X11_LIBS"
741
742        have_xge=no
743        AC_CHECK_FUNC([XGetEventData],
744                      [
745                        AC_DEFINE([HAVE_XGE], [1], [Define to 1 if X Generic Extensions is available])
746                        have_xge=yes
747                        X11_EXTS="$X11_EXTS xge"
748                      ])
749
750        CPPFLAGS="$clutter_save_CPPFLAGS"
751        LIBS="$clutter_save_LIBS"
752
753        # XI (optional)
754        AC_ARG_ENABLE([xinput],
755                      [AS_HELP_STRING([--enable-xinput], [Use the XI X extension])],
756                      [],
757                      [enable_xinput=yes])
758
759        AS_IF([test "x$enable_xinput" = "xyes"],
760              [
761                PKG_CHECK_EXISTS([xi], [have_xinput=yes], [have_xinput=no])
762              ],
763              [
764                have_xinput=no
765              ])
766
767        AS_CASE([$have_xinput],
768
769                [yes],
770                [
771                  AC_CHECK_HEADERS([X11/extensions/XInput2.h],
772                                   [
773                                     have_xinput2=yes
774                                     AC_DEFINE([HAVE_XINPUT_2],
775                                               [1],
776                                               [Define to 1 if XI2 is available])
777                                   ])
778
779                  clutter_save_LIBS="$LIBS"
780                  LIBS="$LIBS -lXi"
781
782                  AC_CHECK_FUNC([XIAllowTouchEvents],
783                                [
784                                  AC_CHECK_MEMBER([XIScrollClassInfo.number],
785                                                  [
786                                                    have_xinput_2_2=yes
787                                                    AC_DEFINE([HAVE_XINPUT_2_2], [1], [Define to 1 if XInput 2.2 is available])
788                                                  ],
789                                                  [have_xinput_2_2=no],
790                                                  [[#include <X11/extensions/XInput2.h>]])])
791
792                  LIBS="$clutter_save_LIBS"
793
794                  X11_LIBS="$X11_LIBS $XINPUT_LIBS"
795                  X11_PC_FILES="$X11_PC_FILES xi"
796
797                  AS_IF([test "x$have_xinput_2_2" = "xyes"],
798                        [X11_EXTS="$X11_EXTS xi2.2"],
799                        [X11_EXTS="$X11_EXTS xi2.0"])
800                ],
801
802                [no],
803                [have_xinput2=no],
804
805                [*],
806                [AC_MSG_ERROR([Invalid argument for --enable-xinput])]
807        )
808
809        # XKB
810        clutter_save_CPPFLAGS="$CPPFLAGS"
811        CPPFLAGS="$CPPFLAGS $X11_CFLAGS"
812
813        clutter_save_LIBS="$LIBS"
814        LIBS="$LIBS $X11_LIBS"
815
816        have_xkb=no
817        AC_CHECK_FUNC([XkbQueryExtension],
818                      [
819                        AC_DEFINE(HAVE_XKB, 1, [Define to use XKB extension])
820                        have_xkb=yes
821
822                        X11_EXTS="$X11_EXTS xkb"
823                      ])
824
825        CPPFLAGS="$clutter_save_CPPFLAGS"
826        LIBS="$clutter_save_LIBS"
827
828        x11_tests=yes
829        BACKEND_PC_FILES="$BACKEND_PC_FILES $X11_PC_FILES"
830        FLAVOUR_LIBS="$FLAVOUR_LIBS $X11_LIBS"
831        FLAVOUR_CFLAGS="$FLAVOUR_CFLAGS $X11_CFLAGS"
832      ]
833)
834
835AM_CONDITIONAL([BUILD_XI2], [test "x$have_xinput2" = "xyes"])
836AM_CONDITIONAL([X11_TESTS], [test "x$x11_tests" = "xyes"])
837
838X11_EXTS=${X11_EXTS#* }
839
840AC_CACHE_SAVE
841
842dnl === Enable GDK-Pixbuf in tests ============================================
843
844m4_define([pixbuf_default], [yes])
845AC_ARG_ENABLE([gdk-pixbuf],
846              [AS_HELP_STRING([--enable-gdk-pixbuf=@<:@no/yes@:>@],
847                              [Enable tests using GDK-Pixbuf @<:@default=]pixbuf_default[@:>@])],
848              [enable_pixbuf=$enable_val],
849              [enable_pixbuf=pixbuf_default])
850
851AS_CASE([$enable_pixbuf],
852
853        [yes],
854        [
855          PKG_CHECK_MODULES([GDK_PIXBUF], [gdk-pixbuf-2.0])
856          AC_SUBST(GDK_PIXBUF_CFLAGS)
857          AC_SUBST(GDK_PIXBUF_LIBS)
858          pixbuf_tests=yes
859        ],
860
861        [no],
862        [
863          pixbuf_tests=no
864        ]
865)
866
867AM_CONDITIONAL([PIXBUF_TESTS], [test "x$pixbuf_tests" = "xyes"])
868
869dnl === Enable debug level ====================================================
870
871m4_define([debug_default], [m4_if(m4_eval(clutter_minor_version % 2), [1], [yes], [minimum])])
872AC_ARG_ENABLE([debug],
873              [AS_HELP_STRING([--enable-debug=@<:@no/minimum/yes@:>@],
874                              [Control Clutter debugging level @<:@default=]debug_default[@:>@])],
875              [],
876              [enable_debug=debug_default])
877
878AS_CASE([$enable_debug],
879
880        [yes],
881        [
882          test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
883          CLUTTER_DEBUG_CFLAGS="-DCLUTTER_ENABLE_DEBUG"
884        ],
885
886        [minimum],
887        [CLUTTER_DEBUG_CFLAGS="-DG_DISABLE_CAST_CHECKS"],
888
889        [no],
890        [CLUTTER_DEBUG_CFLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"],
891
892        [AC_MSG_ERROR([Unknown argument for --enable-debug])]
893)
894
895AC_SUBST(CLUTTER_DEBUG_CFLAGS)
896
897dnl === Enable deprecation guards ==================================================
898
899m4_define([deprecated_default],
900          [m4_if(m4_eval(clutter_minor_version % 2),
901                 [1],
902                 [no],
903                 [yes])])
904
905AC_ARG_ENABLE([deprecated],
906              [AS_HELP_STRING([--enable-deprecated=@<:@no/yes@:>@],
907                              [Whether deprecated symbols should be disabled when compiling Clutter @<:@default=]deprecated_default[@:>@])],
908              [],
909              [enable_deprecated=deprecated_default])
910
911AS_CASE([$enable_deprecated],
912
913        [no],
914        [
915          CLUTTER_DEPRECATED_CFLAGS="-DG_DISABLE_SINGLE_INCLUDES -DCOGL_DISABLE_DEPRECATED"
916        ],
917
918        [yes],
919        [
920          CLUTTER_DEPRECATED_CFLAGS="-DGLIB_DISABLE_DEPRECATION_WARNINGS"
921        ],
922
923        [AC_MSG_ERROR([Unknown argument for --enable-deprecated])]
924)
925
926AC_SUBST([CLUTTER_DEPRECATED_CFLAGS])
927
928dnl === Enable strict compiler flags ==========================================
929
930# use strict compiler flags only when building from git; the rules for
931# distcheck will take care of turning this on when making a release
932m4_define([maintainer_flags_default], [m4_if(m4_eval(clutter_micro_version % 2), [1], [yes], [no])])
933AC_ARG_ENABLE([maintainer-flags],
934              [AS_HELP_STRING([--enable-maintainer-flags=@<:@no/yes/error@:>@],
935                              [Use strict compiler flags @<:@default=]maintainer_flags_default[@:>@])],
936              [],
937              [enable_maintainer_flags=maintainer_flags_default])
938
939MAINTAINER_COMPILER_FLAGS="$MAINTAINER_COMPILER_FLAGS
940                           -Wall
941                           -Wcast-align
942                           -Wuninitialized
943                           -Wno-strict-aliasing
944                           -Wshadow"
945
946AC_ARG_ENABLE([Werror],
947              [AS_HELP_STRING([--disable-Werror], [Removes -Werror from compiler flags])],
948              [],
949              [enable_Werror=yes])
950
951AS_IF([test "x$enable_Werror" = xyes], [
952  MAINTAINER_COMPILER_FLAGS="$MAINTAINER_COMPILER_FLAGS
953                             -Werror=logical-op
954                             -Werror=pointer-arith
955                             -Werror=missing-declarations
956                             -Werror=redundant-decls
957                             -Werror=empty-body
958                             -Werror=format
959                             -Werror=format-security
960                             -Werror=format-nonliteral
961                             -Werror=init-self
962                             -Werror=declaration-after-statement
963                             -Werror=vla"
964])
965
966AS_CASE([$enable_maintainer_flags],
967        [yes],
968        [
969          AS_COMPILER_FLAGS([MAINTAINER_CFLAGS], [$MAINTAINER_COMPILER_FLAGS])
970        ],
971
972        [no],
973        [
974        ],
975
976        [error],
977        [
978          MAINTAINER_COMPILER_FLAGS="$MAINTAINER_COMPILER_FLAGS -Werror"
979          AS_COMPILER_FLAGS([MAINTAINER_CFLAGS], [$MAINTAINER_COMPILER_FLAGS])
980        ],
981
982        [*],
983        [AC_MSG_ERROR([Invalid option for --enable-maintainer-flags])]
984)
985
986# strip leading spaces
987MAINTAINER_CFLAGS=${MAINTAINER_CFLAGS#*  }
988AC_SUBST(MAINTAINER_CFLAGS)
989
990dnl === Dependencies, compiler flags and linker libraries =====================
991# strip leading space
992BACKEND_PC_FILES=${BACKEND_PC_FILES#* }
993
994# public dependencies, will fill the Requires: field of clutter.pc
995CLUTTER_REQUIRES="$CLUTTER_BASE_PC_FILES $BACKEND_PC_FILES"
996PKG_CHECK_MODULES(CLUTTER_DEPS, [$CLUTTER_REQUIRES])
997
998# private dependencies, will fill the Requires.private: field of clutter.pc
999AS_IF([test "x$CLUTTER_BASE_PC_FILES_PRIVATE" = "x" && test "x$BACKEND_PC_FILES_PRIVATE" = "x"],
1000      [
1001        CLUTTER_REQUIRES_PRIVATE=""
1002        CLUTTER_DEPS_PRIVATE_CFLAGS=""
1003        CLUTTER_DEPS_PRIVATE_LIBS=""
1004      ],
1005      [
1006        CLUTTER_REQUIRES_PRIVATE="$CLUTTER_BASE_PC_FILES_PRIVATE $BACKEND_PC_FILES_PRIVATE"
1007        PKG_CHECK_MODULES(CLUTTER_DEPS_PRIVATE, [$CLUTTER_REQUIRES_PRIVATE])
1008      ])
1009
1010AC_SUBST(CLUTTER_REQUIRES)
1011AC_SUBST(CLUTTER_REQUIRES_PRIVATE)
1012
1013CLUTTER_CFLAGS="$FLAVOUR_CFLAGS $CLUTTER_DEPS_CFLAGS $CLUTTER_DEPS_PRIVATE_CFLAGS $GLIB_CFLAGS"
1014CLUTTER_LIBS="$FLAVOUR_LIBS $CLUTTER_DEPS_LIBS $CLUTTER_DEPS_PRIVATE_LIBS $GLIB_LIBS"
1015AC_SUBST(CLUTTER_CFLAGS)
1016AC_SUBST(CLUTTER_LIBS)
1017
1018dnl === Test coverage =========================================================
1019
1020AC_ARG_ENABLE([gcov],
1021              [AS_HELP_STRING([--enable-gcov], [Enable gcov])],
1022              [use_gcov=$enableval],
1023              [use_gcov=no])
1024
1025AS_IF([test "x$use_gcov" = "xyes"],
1026      [
1027        dnl we need gcc:
1028        AS_IF([test "$GCC" != "yes"], [AC_MSG_ERROR([GCC is required for --enable-gcov])])
1029
1030        dnl Check if ccache is being used
1031        AC_CHECK_PROG(SHTOOL, shtool, shtool)
1032        AS_CASE([`$SHTOOL path $CC`],
1033                [*ccache*], [gcc_ccache=yes],
1034                [gcc_ccache=no])
1035
1036        if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then
1037          AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
1038        fi
1039
1040        ltp_version_list="1.6 1.7 1.8 1.9 1.10"
1041        AC_CHECK_PROG(LTP, lcov, lcov)
1042        AC_CHECK_PROG(LTP_GENHTML, genhtml, genhtml)
1043
1044        if test "$LTP"; then
1045          AC_CACHE_CHECK([for ltp version], clutter_cv_ltp_version,
1046                         [
1047                           clutter_cv_ltp_version=invalid
1048                           ltp_version=`$LTP -v 2>/dev/null | $SED -e 's/^.* //'`
1049                           for ltp_check_version in $ltp_version_list; do
1050                             if test "$ltp_version" = "$ltp_check_version"; then
1051                               clutter_cv_ltp_version="$ltp_check_version (ok)"
1052                             fi
1053                           done
1054                         ])
1055        else
1056          ltp_msg="To enable code coverage reporting you must have one of the following LTP versions installed: $ltp_version_list"
1057          AC_MSG_ERROR([$ltp_msg])
1058        fi
1059
1060        case $clutter_cv_ltp_version in
1061          ""|invalid[)]
1062          ltp_msg="You must have one of the following versions of LTP: $ltp_version_list (found: $ltp_version)."
1063          AC_MSG_ERROR([$ltp_msg])
1064          LTP="exit 0;"
1065          ;;
1066        esac
1067
1068        if test -z "$LTP_GENHTML"; then
1069          AC_MSG_ERROR([Could not find genhtml from the LTP package])
1070        fi
1071
1072        AC_DEFINE(HAVE_GCOV, 1, [Whether you have gcov])
1073
1074        dnl Remove all optimization flags from CFLAGS
1075        changequote({,})
1076        CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'`
1077        CLUTTER_CFLAGS=`echo "$CLUTTER_CFLAGS" | $SED -e 's/-O[0-9]*//g'`
1078        changequote([,])
1079
1080        dnl Define the special gcc flags
1081        CLUTTER_GCOV_CFLAGS="-O0 -fprofile-arcs -ftest-coverage"
1082        CLUTTER_GCOV_LDADD="-lgcov"
1083
1084        AC_SUBST(CLUTTER_GCOV_CFLAGS)
1085        AC_SUBST(CLUTTER_GCOV_LDADD)
1086
1087        CLUTTER_CFLAGS="$CLUTTER_CFLAGS $CLUTTER_GCOV_CFLAGS"
1088        CLUTTER_LIBS="$CLUTTER_LIBS $CLUTTER_GCOV_LDADD"
1089      ])
1090
1091AM_CONDITIONAL(ENABLE_GCOV, test "x$use_gcov" = "xyes")
1092
1093dnl === GObject-Introspection check ===========================================
1094
1095GOBJECT_INTROSPECTION_CHECK([gi_req_version])
1096
1097dnl === GTK Doc check =========================================================
1098
1099GTK_DOC_CHECK([gtk_doc_req_version], [--flavour no-tmpl])
1100
1101# we don't want to build the documentation from a Git clone unless we
1102# explicitly tell configure to do so; this allows avoiding to recurse into
1103# the documentation directory when building Clutter inside Poky for a
1104# target device that doesn't have gtk-doc installed. for reference
1105# see: http://bugzilla.openedhand.com/show_bug.cgi?id=1047
1106#
1107# we use autogen.sh as it exists only inside the Git clones, and it
1108# is not packaged into tarballs.
1109AM_CONDITIONAL([BUILD_GTK_DOC], [test "x$enable_gtk_doc" = "xyes" || test ! -f "autogen.sh"])
1110
1111# prefixes for fixing gtk-doc references
1112CAIRO_PREFIX="`$PKG_CONFIG --variable=prefix cairo`"
1113GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`"
1114PANGO_PREFIX="`$PKG_CONFIG --variable=prefix pango`"
1115COGL_PREFIX="`$PKG_CONFIG --variable=prefix cogl-1.0`"
1116ATK_PREFIX="`$PKG_CONFIG --variable=prefix atk`"
1117AC_SUBST(CAIRO_PREFIX)
1118AC_SUBST(GLIB_PREFIX)
1119AC_SUBST(PANGO_PREFIX)
1120AC_SUBST(COGL_PREFIX)
1121AC_SUBST(ATK_PREFIX)
1122
1123dnl === Manual ================================================================
1124
1125AC_ARG_ENABLE([docs],
1126              [AS_HELP_STRING([--enable-docs=@<:@no/yes@:>@],
1127                              [Build optional documentation; requires xsltproc and jw.])],
1128              [enable_docs=$enableval],
1129              [enable_docs=no])
1130
1131enable_pdfs=no
1132AS_IF([test "x$enable_docs" = "xyes"],
1133      [
1134        AC_PATH_PROG(JW, [jw], [no])
1135        AS_IF([test "x$JW" = "xno"],
1136              [
1137                AC_MSG_WARN([jw not found; pdf generation has been disabled])
1138              ],
1139              [enable_pdfs=yes])
1140
1141        AC_PATH_PROG(XSLTPROC, [xsltproc], [no])
1142        AS_IF([test "x$XSLTPROC" = "xno"],
1143              [
1144                AC_MSG_ERROR([xsltproc not found])
1145              ])
1146      ]
1147)
1148
1149AM_CONDITIONAL(ENABLE_DOCS, [test "x$enable_docs" = "xyes"])
1150AM_CONDITIONAL(ENABLE_PDFS, [test "x$enable_pdfs" = "xyes"])
1151
1152dnl === I18N ==================================================================
1153
1154AM_GNU_GETTEXT_VERSION([0.17])
1155AM_GNU_GETTEXT([external])
1156
1157GETTEXT_PACKAGE="clutter-1.0"
1158AC_SUBST(GETTEXT_PACKAGE)
1159AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],
1160                   ["$GETTEXT_PACKAGE"],
1161                   [The prefix for our gettext translation domains.])
1162AS_ALL_LINGUAS
1163
1164dnl = Build optionals =========================================================
1165
1166dnl === Conformance test suite ================================================
1167
1168GLIB_TESTS
1169
1170AC_ARG_ENABLE([examples],
1171              [AS_HELP_STRING([--disable-examples], [Whether examples should be built])],
1172              [],
1173              [enable_examples=yes])
1174AM_CONDITIONAL(BUILD_EXAMPLES, [test "x$enable_examples" = "xyes"])
1175
1176dnl ===========================================================================
1177
1178AC_CONFIG_FILES([
1179	Makefile
1180
1181	build-aux/Makefile
1182	build-aux/autotools/Makefile
1183	build-aux/mingw/Makefile
1184	build-aux/win32/Makefile
1185	build-aux/win32/vs9/Makefile
1186	build-aux/win32/vs10/Makefile
1187
1188	clutter/Makefile
1189	clutter/config.h.win32
1190        clutter/clutter-config.h
1191	clutter/clutter-version.h
1192	clutter/clutter-$CLUTTER_API_VERSION.pc:clutter/clutter.pc.in
1193
1194	clutter/cally/cally-$CLUTTER_API_VERSION.pc:clutter/cally/cally.pc.in
1195
1196	clutter/cex100/clutter-cex100.h
1197
1198	tests/Makefile
1199	tests/accessibility/Makefile
1200	tests/conform/Makefile
1201	tests/interactive/Makefile
1202	tests/interactive/wrapper.sh
1203	tests/micro-bench/Makefile
1204	tests/performance/Makefile
1205
1206        examples/Makefile
1207
1208	doc/Makefile
1209	doc/reference/Makefile
1210	doc/cookbook/Makefile
1211	doc/cookbook/clutter-cookbook.xml
1212	doc/cookbook/examples/Makefile
1213
1214	po/Makefile.in
1215])
1216
1217AC_OUTPUT
1218
1219dnl === Summary ===============================================================
1220
1221echo ""
1222echo "Clutter - $VERSION (${CLUTTER_RELEASE_STATUS})"
1223
1224# Global flags
1225echo ""
1226echo " • Global:"
1227echo "        Prefix: ${prefix}"
1228echo "        Libdir: ${libdir}"
1229echo "        Sysconfdir: ${sysconfdir}"
1230
1231# Compiler/Debug related flags
1232echo ""
1233echo " • Compiler options:"
1234echo "        Clutter debug level: ${enable_debug}"
1235echo "        Compiler flags: ${CFLAGS} ${MAINTAINER_CFLAGS}"
1236echo "        Enable coverage tests: ${use_gcov}"
1237echo "        Enable deprecated symbols: ${enable_deprecated}"
1238
1239# Documentation
1240echo ""
1241echo " • Documentation:"
1242echo "        Build API Reference: ${enable_gtk_doc}"
1243echo "        Build Additional Documentation: ${enable_docs} (Generate PDF: ${enable_pdfs})"
1244
1245# Miscellaneous
1246echo ""
1247echo " • Extra:"
1248echo "        Build introspection data: ${enable_introspection}"
1249if test "x$x11_tests" = "xyes"; then
1250echo "        Build X11-specific tests: ${x11_tests}"
1251fi
1252if test "x$pixbuf_tests" = "xyes"; then
1253echo "        Build tests using GDK-Pixbuf: ${pixbuf_tests}"
1254fi
1255echo "        Install test suites: ${enable_installed_tests}"
1256echo "        Build examples: ${enable_examples}"
1257
1258# Clutter backend related flags
1259echo ""
1260echo " • Clutter Backends:"
1261
1262if test "x$experimental_backend" = "xno"; then
1263echo "        Windowing systems: ${CLUTTER_BACKENDS}"
1264else
1265echo "        Windowing systems: ${CLUTTER_BACKENDS} (WARNING: Experimental backends enabled)"
1266fi
1267
1268if test "x$experimental_input_backend" = "xno"; then
1269echo "        Input backends: ${CLUTTER_INPUT_BACKENDS}"
1270else
1271echo "        Input backends: ${CLUTTER_INPUT_BACKENDS} (WARNING: Experimental backends enabled)"
1272fi
1273
1274echo "        Cogl drivers: $clutter_drivers"
1275
1276if test "x$SUPPORT_X11" = "x1"; then
1277echo ""
1278echo "     - X11 backend options:"
1279echo "        Enabled extensions: ${X11_EXTS}"
1280fi
1281
1282if test "x$SUPPORT_CEX100" = "x1"; then
1283echo ""
1284echo "     - CEx100 backend options (WARNING: Experimental):"
1285echo "        libGDL include prefix: ${CLUTTER_CEX100_LIBGDL_PREFIX}"
1286fi
1287
1288if test "x$SUPPORT_WAYLAND_COMPOSITOR" = "x1"; then
1289echo ""
1290echo "     - Wayland compositor support enabled (WARNING: Experimental)"
1291fi
1292
1293echo ""
1294
1295# General warning about experimental features
1296if test "x$experimental_backend" = xyes -o "x$experimental_input_backend" = xyes; then
1297echo ""
1298echo "☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠"
1299echo "*WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING*"
1300echo ""
1301echo "  The stability of your build might be affected by one or more"
1302echo "  experimental backends or experimental and unsupported features"
1303echo ""
1304echo "*WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING*"
1305echo "☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠"
1306echo ""
1307fi
1308