0f1db8d45218df66f2fb3b88be12fa2a7bb803c8
[profile/ivi/clutter.git] / configure.ac
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 #   UNLESS there was an API addition/deprecation, in which case
9 #   - set clutter_interface_age to 0
10 # After the release:
11 # - increase clutter_micro_version to the next odd number
12 # - increase clutter_interface_version to the next odd number
13 m4_define([clutter_major_version], [1])
14 m4_define([clutter_minor_version], [5])
15 m4_define([clutter_micro_version], [13])
16
17 # increase the interface age by 1 for each release; if the API changes,
18 # set to 0. interface_age and binary_age are used to create the soname
19 # of the shared object:
20 #
21 #  (<minor> * 100 + <micro>) - <interface_age>
22 #
23 # this allows using the same soname for different micro-releases in case
24 # no API was added or deprecated. for instance:
25 #
26 #   clutter 1.2.0  -> 100 * 2 + 0  = 200, interface age = 0 -> 200
27 #   clutter 1.2.2  -> 100 * 2 + 2  = 202, interface age = 2 -> 200
28 #   clutter 1.2.4  -> 100 * 2 + 4  = 204, interface age = 4 -> 200
29 #   [ API addition, deprecation ]
30 #   clutter 1.2.6  -> 100 * 2 + 6  = 206, interface age = 0 -> 206
31 #   clutter 1.2.8  -> 100 * 2 + 8  = 208, interface age = 2 -> 206
32 #   clutter 1.2.10 -> 100 * 2 + 10 = 210, interface age = 4 -> 206
33 #   ...
34 #
35 m4_define([clutter_interface_age], [0])
36
37 m4_define([clutter_binary_age], [m4_eval(100 * clutter_minor_version + clutter_micro_version)])
38
39 m4_define([clutter_release_status],
40           [m4_if(m4_eval(clutter_micro_version % 2), [1], [git],
41                  [m4_if(m4_eval(clutter_minor_version % 2), [1], [snapshot],
42                                                                  [release])])])
43
44 m4_define([clutter_version], [clutter_major_version.clutter_minor_version.clutter_micro_version])
45
46 # change this only when breaking the API
47 m4_define([clutter_api_version], [1.0])
48
49 AC_PREREQ([2.63])
50
51 AC_INIT([clutter],
52         [clutter_version],
53         [http://bugzilla.clutter-project.org/enter_bug.cgi?product=clutter],
54         [clutter],
55         [http://www.clutter-project.org])
56
57 AC_CONFIG_SRCDIR([clutter/clutter.h])
58 AC_CONFIG_HEADERS([config.h])
59 AC_CONFIG_AUX_DIR([build])
60 AC_CONFIG_MACRO_DIR([build/autotools])
61
62 AM_INIT_AUTOMAKE([1.11 foreign -Wno-portability no-define no-dist-gzip dist-bzip2])
63
64 AM_SILENT_RULES([yes])
65
66 AC_SUBST([CLUTTER_MAJOR_VERSION],  [clutter_major_version])
67 AC_SUBST([CLUTTER_MINOR_VERSION],  [clutter_minor_version])
68 AC_SUBST([CLUTTER_MICRO_VERSION],  [clutter_micro_version])
69 AC_SUBST([CLUTTER_VERSION],        [clutter_version])
70 AC_SUBST([CLUTTER_API_VERSION],    [clutter_api_version])
71 AC_SUBST([CLUTTER_API_VERSION_AM], [$CLUTTER_MAJOR_VERSION\_0])
72 AC_SUBST([CLUTTER_RELEASE_STATUS], [clutter_release_status])
73
74 m4_define([lt_current],  [m4_eval(100 * clutter_minor_version + clutter_micro_version - clutter_interface_age)])
75 m4_define([lt_revision], [clutter_interface_age])
76 m4_define([lt_age],      [m4_eval(clutter_binary_age - clutter_interface_age)])
77 CLUTTER_LT_CURRENT=lt_current
78 CLUTTER_LT_REV=lt_revision
79 CLUTTER_LT_AGE=lt_age
80 CLUTTER_LT_VERSION="$CLUTTER_LT_CURRENT:$CLUTTER_LT_REV:$CLUTTER_LT_AGE"
81 CLUTTER_LT_LDFLAGS="-version-info $CLUTTER_LT_VERSION"
82
83 AC_MSG_CHECKING([if building for some Win32 platform])
84 case "$host" in
85   *-*-mingw*|*-*-cygwin*)
86     CLUTTER_LT_LDFLAGS="$CLUTTER_LT_LDFLAGS -no-undefined"
87     platform_win32=yes
88     ;;
89   *)
90     platform_win32=no
91     ;;
92 esac
93 AC_MSG_RESULT([$platform_win32])
94
95 AC_SUBST(CLUTTER_LT_VERSION)
96 AC_SUBST(CLUTTER_LT_LDFLAGS)
97
98 dnl The 'ffs' function is part of C99 so it isn't always
99 dnl available. Cogl has a fallback if needed.
100 AC_CHECK_FUNCS([ffs])
101
102 dnl ========================================================================
103
104 # Checks for programs.
105 AM_PROG_CC_C_O
106
107 # require libtool >= 2.2
108 LT_PREREQ([2.2.6])
109 LT_INIT([disable-static])
110
111 # Checks for header files.
112 AC_HEADER_STDC
113
114 # Checks for typedefs, structures, and compiler characteristics.
115 AM_PATH_GLIB_2_0([2.26.0],
116                  [have_glib=yes], [have_glib=no],
117                  [gobject gthread gmodule-no-export])
118 AS_IF([test "x$have_glib" = "xno"], AC_MSG_ERROR([glib-2.0 is required]))
119
120 # Check for -Bsymbolic-functions to avoid intra-library PLT jumps
121 AC_ARG_ENABLE([Bsymbolic],
122               [AC_HELP_STRING([--disable-Bsymbolic],
123                               [Avoid linking with -Bsymbolic])],
124               [],
125               [
126                 saved_LDFLAGS="${LDFLAGS}"
127                 AC_MSG_CHECKING([for -Bsymbolic-functions linker flag])
128                 LDFLAGS=-Wl,-Bsymbolic-functions
129                 AC_TRY_LINK([], [int main (void) { return 0; }],
130                             [
131                               AC_MSG_RESULT([yes])
132                               enable_Bsymbolic=yes
133                             ],
134                             [
135                               AC_MSG_RESULT([no])
136                               enable_Bsymbolic=no
137                             ])
138                 LDFLAGS="${saved_LDFLAGS}"
139               ])
140
141 AS_IF([test "x$enable_Bsymbolic" = "xyes"],
142       [CLUTTER_LINK_FLAGS=-Wl[,]-Bsymbolic-functions])
143 AC_SUBST(CLUTTER_LINK_FLAGS)
144
145 dnl ========================================================================
146
147 # defaults
148 CLUTTER_FLAVOUR=glx
149 FLAVOUR_LIBS=""
150 FLAVOUR_CFLAGS=""
151 CLUTTER_WINSYS_BASE=
152 CLUTTER_WINSYS_BASE_LIB=
153 CLUTTER_WINSYS=
154 cogl_gl_headers=""
155 glesversion=1.1
156 use_gles2_wrapper=no
157 experimental_backend=no
158 experimental_image=no
159
160 AC_ARG_WITH([flavour],
161             [AC_HELP_STRING([--with-flavour=@<:@glx/opengl-egl-xlib/wayland/eglx/eglnative/osx/win32/fruity/cex100@:>@],
162                             [Select the Clutter window system backend])],
163             [CLUTTER_FLAVOUR=$with_flavour])
164
165 AC_ARG_WITH([gles],
166             [AC_HELP_STRING([--with-gles=@<:@1.1/2.0@:>@],
167                             [Select Clutter GLES version (for EGL backends)])],
168             [glesversion=$with_gles])
169
170 # backend specific pkg-config files
171 BACKEND_PC_FILES=""
172
173 dnl === Clutter windowing system backend ======================================
174
175 AS_CASE([$CLUTTER_FLAVOUR],
176
177         [glx],
178         [
179           cogl_gl_headers="GL/gl.h"
180           CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_GLX"
181
182           SUPPORT_X11=1
183           SUPPORT_XLIB=1
184           SUPPORT_GLX=1
185
186           COGL_DRIVER="gl"
187
188           CLUTTER_WINSYS=glx
189           CLUTTER_WINSYS_BASE=x11
190           CLUTTER_WINSYS_BASE_LIB="x11/libclutter-x11.la"
191           CLUTTER_SONAME_INFIX=glx
192
193           # Mesa 7.3 added a GL pkg-config file, finally
194           PKG_CHECK_EXISTS([gl],
195                            [BACKEND_PC_FILES="$BACKEND_PC_FILES gl"],
196                            # if a pkg-config file isn't found just add -lGL
197                            # and hope for the best.
198                            [FLAVOUR_LIBS="$FLAVOUR_LIBS -lGL"])
199
200           # We might fall back to DRM for sync-to-vblank on GLX
201           PKG_CHECK_EXISTS([libdrm],
202                            [
203                              AC_DEFINE([HAVE_DRM], [1], [Have libdrm support])
204                              BACKEND_PC_FILES="$BACKEND_PC_FILES libdrm"
205                            ],
206                            [])
207         ],
208
209         [opengl-egl-xlib],
210         [
211           cogl_gl_headers="GL/gl.h"
212           CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_EGL"
213           CLUTTER_EGL_BACKEND="generic"
214
215           SUPPORT_X11=1
216           SUPPORT_XLIB=1
217           SUPPORT_EGL=1
218           SUPPORT_EGL_PLATFORM_POWERVR_X11=1
219
220           COGL_DRIVER="gl"
221
222           CLUTTER_WINSYS=egl
223           CLUTTER_WINSYS_BASE=x11
224           CLUTTER_WINSYS_BASE_LIB="x11/libclutter-x11.la"
225           # I think this winsys can be API and ABI compatible with the
226           # glx flavour so we can also be cheeky and use the same soname
227           CLUTTER_SONAME_INFIX=glx
228
229           PKG_CHECK_EXISTS([gl], [BACKEND_PC_FILES="$BACKEND_PC_FILES gl"], [])
230           PKG_CHECK_EXISTS([egl], [BACKEND_PC_FILES="$BACKEND_PC_FILES egl"], [])
231         ],
232
233         [wayland],
234         [
235           experimental_backend="yes"
236           cogl_gl_headers="GL/gl.h"
237           CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_WAYLAND"
238
239           SUPPORT_WAYLAND=1
240           SUPPORT_EGL_PLATFORM_DRM_SURFACELESS=1
241
242           COGL_DRIVER="gl"
243
244           CLUTTER_WINSYS=wayland
245           CLUTTER_SONAME_INFIX=wayland
246
247           PKG_CHECK_EXISTS([gl], [BACKEND_PC_FILES="$BACKEND_PC_FILES gl"], [])
248           PKG_CHECK_EXISTS([egl], [BACKEND_PC_FILES="$BACKEND_PC_FILES egl"], [])
249           PKG_CHECK_EXISTS([wayland-client xkbcommon],
250                            [BACKEND_PC_FILES="$BACKEND_PC_FILES wayland-client xkbcommon"], [])
251         ],
252
253         [eglx],
254         [
255           # the GL header is defined in the COGL checks above
256           CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_EGL"
257           CLUTTER_EGL_BACKEND="generic"
258
259           SUPPORT_X11=1
260           SUPPORT_XLIB=1
261           SUPPORT_EGL=1
262           SUPPORT_EGL_PLATFORM_POWERVR_X11=1
263
264           COGL_DRIVER="gles"
265
266           CLUTTER_WINSYS=egl
267           CLUTTER_WINSYS_BASE=x11
268           CLUTTER_WINSYS_BASE_LIB="x11/libclutter-x11.la"
269           CLUTTER_SONAME_INFIX=eglx
270         ],
271
272         [eglnative],
273         [
274           # the GL header is defined in the COGL checks above
275           CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_EGL"
276           CLUTTER_EGL_BACKEND="generic"
277
278           SUPPORT_EGL=1
279           SUPPORT_EGL_PLATFORM_POWERVR_NULL=1
280
281           PKG_CHECK_MODULES(TSLIB, [tslib-1.0], [have_tslib=yes], [have_tslib=no])
282           AS_IF([test "x$have_tslib" = "xyes"],
283                 [AC_DEFINE([HAVE_TSLIB], [1], [Have tslib for touchscreen handling])]
284           )
285
286           # evdev
287           PKG_CHECK_MODULES(EVDEV, [gudev-1.0 xkbcommon],
288                             [have_evdev=yes], [have_evdev=no])
289           AS_IF([test "x$have_evdev" = "xyes"],
290                 [AC_DEFINE([HAVE_EVDEV], 1,
291                            [Have evdev support for input handling])]
292           )
293
294           # Make sure we don't enable tslib and evdev at the same time, we
295           # don't support multiple event backends yet.
296           AS_IF([test "x$have_tslib" = "xyes" -a "x$have_evdev" = "xyes"],
297                 [AC_MSG_ERROR([Can't enable both tslib and evdev events])])
298
299           COGL_DRIVER="gles"
300
301           FLAVOUR_LIBS="$FLAVOUR_LIBS $TSLIB_LIBS $EVDEV_LIBS"
302           FLAVOUR_CFLAGS="$FLAVOUR_CFLAGS $TSLIB_CFLAGS $EVDEV_CFLAGS"
303
304           CLUTTER_WINSYS=egl
305           CLUTTER_SONAME_INFIX=eglnative
306         ],
307
308         [cex100],
309         [
310           CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_EGL"
311           CLUTTER_EGL_BACKEND="cex100"
312
313           SUPPORT_EGL=1
314           SUPPORT_EGL_PLATFORM_POWERVR_GDL=1
315
316           COGL_DRIVER="gles"
317
318           # The cex100 is a small specialization of the EGL backend
319           CLUTTER_WINSYS=egl
320           CLUTTER_SONAME_INFIX=cex100
321
322           found_gdl=no
323           AC_CHECK_HEADERS([libgdl.h], [found_gdl=yes])
324           AS_IF([test "x$found_gdl" = "xno"],
325                 [AC_CHECK_HEADERS([CE4100/libgdl.h],
326                                   [
327                                     FLAVOUR_CFLAGS="-I/usr/include/CE4100"
328                                     found_gdl=yes
329                                     CLUTTER_CEX100_LIBGDL_PREFIX=CE4100/
330                                   ])
331                 ])
332           AC_SUBST(CLUTTER_CEX100_LIBGDL_PREFIX)
333
334           AS_IF([test x"$found_gdl" = "xno"], [AC_MSG_ERROR([libgdl.h not found])])
335
336           # evdev
337           PKG_CHECK_MODULES(EVDEV, [gudev-1.0 xkbcommon],
338                             [have_evdev=yes], [have_evdev=no])
339           AS_IF([test "x$have_evdev" = "xyes"],
340                 [AC_DEFINE([HAVE_EVDEV], 1,
341                            [Have evdev support for input handling])]
342           )
343
344           FLAVOUR_CFLAGS="$FLAVOUR_CFLAGS $EVDEV_CFLAGS"
345           FLAVOUR_LIBS="$FLAVOUR_LIBS -lgdl $EVDEV_LIBS"
346         ],
347
348         [fruity],
349         [
350           experimental_backend="yes"
351           # the GL header is defined in the COGL checks above
352           CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_FRUITY"
353           AC_DEFINE([HAVE_CLUTTER_FRUITY], [1], [Have the Fruity backend])
354           AC_DEFINE([COGL_HAS_EGL_PLATFORM_FRUITY_SUPPORT], [1],
355                      [Cogl supports OpenGLES using the EGL API with Fruity platform typedefs])
356
357           COGL_DRIVER="gles"
358           # the fruity backend requires a different handling for GLES
359           glesversion=fruity
360
361           FLAVOUR_LIBS="$FLAVOUR_LIBS -ObjC -framework Foundation  -framework CoreFoundation  -framework CoreGraphics  -framework CoreSurface  -framework GraphicsServices  -framework OpenGLES  -framework LayerKit  -framework UIKit"
362
363           CLUTTER_WINSYS=fruity
364           CLUTTER_SONAME_INFIX=fruity
365         ],
366
367         [osx],
368         [
369           experimental_backend="yes"
370           cogl_gl_headers="OpenGL/gl.h"
371           CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_OSX"
372
373           AC_DEFINE([HAVE_CLUTTER_OSX], [1], [Have the OSX backend])
374           AC_DEFINE([COGL_HAS_OSX_SUPPORT], [1], [Cogl supports the OSX window system])
375
376           COGL_DRIVER="gl"
377           AC_DEFINE([HAVE_COGL_GL], [1], [Have GL for rendering])
378
379           FLAVOUR_LIBS="$FLAVOUR_LIBS -framework Cocoa -framework OpenGL"
380
381           CLUTTER_WINSYS=osx
382           CLUTTER_SONAME_INFIX=osx
383         ],
384
385         [win32],
386         [
387           cogl_gl_headers="GL/gl.h"
388           CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_WIN32"
389           AC_DEFINE([HAVE_CLUTTER_WIN32], [1], [Have the Win32 backend])
390           AC_DEFINE([COGL_HAS_WIN32_SUPPORT], [1], [Cogl supports the win32 window system])
391           AC_DEFINE([COGL_HAS_WGL_SUPPORT], [1], [Cogl supports OpenGL using the WGL API])
392
393           COGL_DRIVER="gl"
394           AC_DEFINE([HAVE_COGL_GL], [1], [Have GL for rendering])
395
396           FLAVOUR_LIBS="$FLAVOUR_LIBS -lopengl32 -lgdi32 -lwinmm"
397           FLAVOUR_CFLAGS="$FLAVOUR_CFLAGS -D_WIN32_WINNT=0x0500"
398
399           AC_CHECK_TOOL(WINDRES, windres, no)
400           if test "$WINDRES" = no; then
401              AC_MSG_ERROR([*** windres is required])
402           fi
403
404           CLUTTER_WINSYS=win32
405           CLUTTER_SONAME_INFIX=win32
406         ],
407
408         [AC_MSG_ERROR([Invalid backend for Clutter: use glx, osx, win32, eglx, eglnative or fruity])]
409 )
410
411 AS_IF([test "x$SUPPORT_X11" = "x1"],
412       [ AC_DEFINE([COGL_HAS_X11_SUPPORT], [1], [Cogl supports the X11 window system])])
413 AS_IF([test "x$SUPPORT_XLIB" = "x1"],
414       [ AC_DEFINE([COGL_HAS_XLIB_SUPPORT], [1], [Cogl supports X11 using the Xlib API])])
415
416 AS_IF([test "x$SUPPORT_GLX" = "x1"],
417       [
418         AC_DEFINE([COGL_HAS_GLX_SUPPORT], [1], [Cogl supports OpenGL using the GLX API])
419
420         AC_DEFINE([HAVE_CLUTTER_GLX], [1], [Have the GLX backend])
421
422         AC_CHECK_HEADERS([GL/glx.h],
423                          [],
424                          [AC_MSG_ERROR([Unable to locate required GLX headers])])
425
426         AC_CHECK_LIB(GL, [glXCreateContext],
427                      [HAVE_LIBGLX=yes],
428                      [AC_MSG_ERROR([Required GLX library not found])])
429       ])
430
431 AS_IF([test "x$SUPPORT_WAYLAND" = "x1"],
432       [
433         AC_DEFINE([HAVE_CLUTTER_WAYLAND], [1], [Have the Wayland backend])
434       ])
435
436 AS_IF([test "x$SUPPORT_EGL" = "x1"],
437       [
438         AC_DEFINE([HAVE_CLUTTER_EGL], [1], [Have the EGL backend])
439         AC_DEFINE([COGL_HAS_EGL_SUPPORT], [1], [Cogl supports GLES using the EGL API])
440       ])
441
442 AS_IF([test "x$CLUTTER_EGL_BACKEND" = "xgeneric"],
443       AC_DEFINE([CLUTTER_EGL_BACKEND_GENERIC], [1], [Use Generic EGL backend]))
444
445 AS_IF([test "x$CLUTTER_EGL_BACKEND" = "xcex100"],
446       AC_DEFINE([CLUTTER_EGL_BACKEND_CEX100], [1], [Use CEX100 EGL backend]))
447
448 AS_IF([test "x$SUPPORT_EGL_PLATFORM_POWERVR_X11" = "x1"],
449       [
450         AC_DEFINE([COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT], [1],
451                   [Cogl supports OpenGL[ES] using the EGL API with PowerVR X11 platform typedefs])
452       ])
453
454 AS_IF([test "x$SUPPORT_EGL_PLATFORM_POWERVR_NULL" = "x1"],
455       [
456         AC_DEFINE([COGL_HAS_EGL_PLATFORM_POWERVR_NULL_SUPPORT], [1],
457                   [Cogl supports OpenGL[ES] using the EGL API with PowerVR NULL platform typedefs])
458       ])
459
460 AS_IF([test "x$SUPPORT_EGL_PLATFORM_POWERVR_GDL" = "x1"],
461       [
462         AC_DEFINE([COGL_HAS_EGL_PLATFORM_POWERVR_GDL_SUPPORT], [1],
463                   [Cogl supports OpenGL[ES] using the EGL API with the GDL API])
464       ])
465
466 AS_IF([test "x$SUPPORT_EGL_PLATFORM_DRM_SURFACELESS" = "x1"],
467       [
468         AC_DEFINE([COGL_HAS_EGL_PLATFORM_DRM_SURFACELESS_SUPPORT], [1],
469                   [Cogl supports OpenGL[ES] using the EGL API with EGL_MESA_drm_display])
470       ])
471
472 # winsys conditionals for use in automake files...
473 AM_CONDITIONAL(SUPPORT_GLX, [test "x$SUPPORT_GLX" = "x1"])
474 AM_CONDITIONAL(SUPPORT_X11, [test "x$SUPPORT_X11" = "x1"])
475 AM_CONDITIONAL(SUPPORT_XLIB, [test "x$SUPPORT_XLIB" = "x1"])
476 AM_CONDITIONAL(SUPPORT_EGL, [test "x$SUPPORT_EGL" = "x1"])
477 AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_POWERVR_X11, [test "x$SUPPORT_EGL_PLATFORM_POWERVR_X11" = "x1"])
478 AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_POWERVR_NULL, [test "x$SUPPORT_EGL_PLATFORM_POWERVR_NULL" = "x1"])
479 AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_POWERVR_GDL, [test "x$SUPPORT_EGL_PLATFORM_POWERVR_GDL" = "x1"])
480 AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_FRUITY, [test "x$CLUTTER_WINSYS" = "xfruity"])
481 AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_DRM_SURFACELESS, [test "x$SUPPORT_EGL_PLATFORM_DRM_SURFACELESS" = "x1"])
482 AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_FRUITY, [test "x$CLUTTER_WINSYS" = "xfruity"])
483 AM_CONDITIONAL(SUPPORT_OSX, [test "x$CLUTTER_WINSYS" = "xosx"])
484 AM_CONDITIONAL(SUPPORT_FRUITY, [test "x$CLUTTER_WINSYS" = "xfruity"])
485 AM_CONDITIONAL(SUPPORT_WIN32, [test "x$CLUTTER_WINSYS" = "xwin32"])
486 AM_CONDITIONAL(SUPPORT_CEX100, [test "x$SUPPORT_EGL_PLATFORM_POWERVR_GDL" = "x1"])
487 AM_CONDITIONAL(SUPPORT_WAYLAND, [test "x$CLUTTER_WINSYS" = "xwayland"])
488
489 dnl === COGL driver backend =====================================================
490
491 AS_IF([test "x$COGL_DRIVER" = "xgl"],
492       [ AC_DEFINE([HAVE_COGL_GL], [1], [Have GL for rendering])
493         NEED_SEPARATE_EGL=yes
494       ])
495
496 cogl_gles_version_define=""
497
498 AS_IF([test "x$COGL_DRIVER" = "xgles"],
499
500       [
501         AS_CASE([$glesversion],
502
503           [1*],
504           [
505             cogl_gl_headers="GLES/gl.h GLES/glext.h"
506
507             AC_DEFINE([HAVE_COGL_GLES], 1, [Have GL/ES for rendering])
508             cogl_gles_version_define="COGL_HAS_GLES1"
509
510             PKG_CHECK_EXISTS([glesv1_cm],
511               [BACKEND_PC_FILES="$BACKEND_PC_FILES glesv1_cm"
512                NEED_SEPARATE_EGL=yes
513               ],
514               [
515                 AC_CHECK_HEADERS([$cogl_gl_headers],
516                                  [],
517                                  [AC_MSG_ERROR([Unable to locate required GLES headers])])
518
519                 # Check for a GLES 1.x Common Profile library with/without EGL.
520                 #
521                 # Note: historically GLES 1 libraries shipped with the
522                 # EGL and GLES symbols all bundled in one library. Now
523                 # the Khronos Implementers Guide defines two naming
524                 # schemes: -lGLES_CM should be used for a library that
525                 # bundles the GLES and EGL API together and -lGLESv1_CM
526                 # would be used for a standalone GLES API.
527                 AC_CHECK_LIB(GLES_CM, [eglInitialize],
528                   [FLAVOUR_LIBS="$FLAVOUR_LIBS -lGLES_CM"],
529                   [
530                     AC_CHECK_LIB(GLESv1_CM, [glFlush],
531                       [FLAVOUR_LIBS="$FLAVOUR_LIBS -lGLESv1_CM"
532                        NEED_SEPARATE_EGL=yes
533                       ],
534                       [AC_MSG_ERROR([Unable to locate required GLES 1.x Common Profile library])])
535                   ])
536               ])
537
538             AS_IF([test "x$NEED_SEPARATE_EGL" = "xyes"],
539               [
540                 PKG_CHECK_EXISTS([egl],
541                   [BACKEND_PC_FILES="$BACKEND_PC_FILES egl"
542                    NEED_SEPARATE_EGL=yes
543                   ],
544                   [
545                     AC_CHECK_HEADERS([GLES/egl.h],
546                                      [],
547                                      [AC_MSG_ERROR([Unable to locate required EGL headers])])
548
549                     AC_CHECK_LIB(EGL, [eglInitialize],
550                       [FLAVOUR_LIBS="$FLAVOUR_LIBS -lEGL"],
551                       [AC_MSG_ERROR([Unable to locate required EGL library])])
552                   ])
553               ])
554           ],
555
556           [2*],
557           [
558             cogl_gl_headers="GLES2/gl2.h GLES2/gl2ext.h"
559             use_gles2_wrapper=yes
560             AC_DEFINE([HAVE_COGL_GLES2], 1, [Have GL/ES for rendering])
561             cogl_gles_version_define="COGL_HAS_GLES2"
562
563             PKG_CHECK_EXISTS([glesv2],
564               [BACKEND_PC_FILES="$BACKEND_PC_FILES glesv2"],
565               [
566                 AC_CHECK_HEADERS([$cogl_gl_headers],
567                                  [],
568                                  [AC_MSG_ERROR([Unable to locate required GLES headers])],
569                                  [[#include <GLES2/gl2.h>
570                                  ]])
571
572                 FLAVOUR_LIBS="$FLAVOUR_LIBS -lGLESv2"
573               ])
574
575             PKG_CHECK_EXISTS([egl],
576               [BACKEND_PC_FILES="$BACKEND_PC_FILES egl"],
577               [
578                 AC_CHECK_HEADERS([EGL/egl.h],
579                                  [],
580                                  [AC_MSG_ERROR([Unable to locate required EGL headers])])
581
582                 AC_CHECK_LIB(EGL, [eglInitialize],
583                   [FLAVOUR_LIBS="$FLAVOUR_LIBS -lEGL"],
584                   [AC_MSG_ERROR([Unable to locate required EGL library])])
585
586                 FLAVOUR_LIBS="$FLAVOUR_LIBS -lEGL"
587               ]
588               )
589
590             NEED_SEPARATE_EGL=yes
591           ],
592
593           [fruity],
594           [
595             cogl_gl_headers="GLES/gl.h GLES/glext.h"
596             AC_DEFINE([HAVE_COGL_GLES], 1, [Have GL/ES for rendering])
597             cogl_gles_version_define="COGL_HAS_GLES1"
598
599             AC_CHECK_HEADERS([GLES/egl.h],
600                              [],
601                              [AC_MSG_ERROR([Unable to locate required GLES headers])])
602           ],
603
604           [AC_MSG_ERROR([Unknown argument for --with-gles])]
605         )
606       ]
607 )
608
609 AM_CONDITIONAL(USE_TSLIB, [test "x$have_tslib" = "xyes"])
610 AM_CONDITIONAL(SUPPORT_EVDEV, [test "x$have_evdev" = "xyes"])
611
612 AM_CONDITIONAL(USE_GLES2_WRAPPER, [test "x$use_gles2_wrapper" = "xyes"])
613
614 dnl The value of this variable will directly go in the install
615 dnl cogl-defines.h header
616 COGL_DEFINES="";
617 dnl Space-separated list of symbols that should be defined in
618 dnl cogl-defines.h
619 COGL_DEFINES_SYMBOLS="";
620
621 if test "x$SUPPORT_X11" = "x1"; then
622   COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_X11"
623 fi;
624
625 if test "x$SUPPORT_XLIB" = "x1"; then
626   COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_XLIB"
627 fi;
628
629 if test "x$NEED_SEPARATE_EGL" = "xyes"; then
630   AC_DEFINE([HAVE_STANDALONE_EGL], 1, [Have standalone EGL library])
631 fi
632
633 AS_CASE([$COGL_DRIVER],
634         [gl],
635         [COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_GL"
636          COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS CLUTTER_COGL_HAS_GL"],
637         [gles],
638         [COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_GLES"
639          COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS CLUTTER_COGL_HAS_GLES"
640          COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS $cogl_gles_version_define"
641          ],
642         [AC_MSG_ERROR([Unknown cogl driver $COGL_DRIVER])])
643
644 dnl Copy all of the words in COGL_DEFINES_SYMBOLS as separate #define
645 dnl lines in COGL_DEFINES
646 for x in $COGL_DEFINES_SYMBOLS; do
647   COGL_DEFINES="$COGL_DEFINES
648 #define $x 1"
649 done;
650
651 AC_SUBST(COGL_DEFINES)
652
653 AS_IF([test "x$cogl_gl_headers" = "x"], [AC_MSG_ERROR([Internal error: no GL header set])])
654
655 dnl cogl_gl_headers is a space separate list of headers to
656 dnl include. We'll now convert them to a single variable with a
657 dnl #include line for each header
658 COGL_GL_HEADER_INCLUDES=""
659 for x in $cogl_gl_headers; do
660   COGL_GL_HEADER_INCLUDES="$COGL_GL_HEADER_INCLUDES
661 #include <$x>"
662 done;
663 AC_SUBST(COGL_GL_HEADER_INCLUDES)
664
665 AM_CONDITIONAL([COGL_DRIVER_GLES], [test "x$COGL_DRIVER" = "xgles"])
666 AM_CONDITIONAL([COGL_DRIVER_GL],   [test "x$COGL_DRIVER" = "xgl"])
667
668 dnl Instead of using AM_CFLAGS to ensure
669 dnl COGL_ENABLE_EXPERIMENTAL_2_0_API is defined while compiling clutter
670 dnl and cogl code we use a define in config.h instead. This helps ensure
671 dnl other tools such as glib-mkenums and gir-scanner don't end up
672 dnl using the define also.
673 AC_DEFINE([COGL_ENABLE_EXPERIMENTAL_2_0_API], [1],
674           [Can use Cogl 2.0 API internally])
675
676 dnl === Clutter configuration =================================================
677
678 CLUTTER_CONFIG_DEFINES=
679
680 # windowing systems
681 AS_IF([test "x$SUPPORT_XLIB" = "x1"],
682       [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
683 #define CLUTTER_WINDOWING_X11 1"])
684 AS_IF([test "x$SUPPORT_GLX" = "x1"],
685       [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
686 #define CLUTTER_WINDOWING_GLX 1"])
687 AS_IF([test "x$SUPPORT_EGL" = "x1"],
688       [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
689 #define CLUTTER_WINDOWING_EGL 1"])
690 AS_IF([test "x$SUPPORT_WAYLAND" = "x1"],
691       [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
692 #define CLUTTER_WINDOWING_WAYLAND 1"])
693 AS_IF([test "x$SUPPORT_OSX" = "x1"],
694       [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
695 #define CLUTTER_WINDOWING_OSX 1"])
696 AS_IF([test "x$SUPPORT_WIN32" = "x1"],
697       [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
698 #define CLUTTER_WINDOWING_WIN32 1"])
699 AS_IF([test "x$SUPPORT_CEX100" = "x1"],
700       [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
701 #define CLUTTER_WINDOWING_CEX100 1"])
702
703 AC_SUBST([CLUTTER_CONFIG_DEFINES])
704
705 dnl === Clutter substitutions =================================================
706 # Eventually the idea of a winsys should be hidden from Clutter and moved
707 # into Cogl, but for now we have CLUTTER_WINSYS...
708 AC_SUBST([CLUTTER_WINSYS])
709 # The same goes for the winsys-base...
710 AC_SUBST([CLUTTER_WINSYS_BASE])
711 AC_SUBST([CLUTTER_WINSYS_BASE_LIB])
712 AC_SUBST(CLUTTER_STAGE_TYPE)
713 AC_SUBST(CLUTTER_SONAME_INFIX)
714
715 CLUTTER_WINSYS_LIB=libclutter-$CLUTTER_SONAME_INFIX-$CLUTTER_API_VERSION.la
716 AC_SUBST([CLUTTER_WINSYS_LIB])
717
718 dnl === Clutter substitutions kept for backwards compatibility ================
719 AC_SUBST([CLUTTER_FLAVOUR])
720 CLUTTER_COGL=$COGL_DRIVER
721 AC_SUBST([CLUTTER_COGL])
722
723 dnl === Cogl substitutions ====================================================
724 AC_SUBST([COGL_IMAGE_BACKEND])
725 COGL_WINSYS=$CLUTTER_WINSYS
726 AC_SUBST([COGL_WINSYS])
727 AC_SUBST([COGL_DRIVER])
728
729 dnl === Image loading backend =================================================
730 IMAGE_PC_FILES=""
731
732 # Peek which winsys the user wants so that we can couple the osx winsys with
733 # quartz imageloader.
734 AS_IF([test "x$COGL_WINSYS" = "xosx"], [COGL_IMAGE_BACKEND=quartz], [COGL_IMAGE_BACKEND=gdk-pixbuf])
735
736 AC_ARG_WITH([imagebackend],
737             [AC_HELP_STRING([--with-imagebackend=@<:@gdk-pixbuf/quartz/internal@:>@],
738                             [Select COGL image loading backend])],
739             [COGL_IMAGE_BACKEND=$with_imagebackend])
740
741 AS_CASE([$COGL_IMAGE_BACKEND],
742
743         [quartz],
744         [
745           experimental_image=yes
746           AC_DEFINE([USE_QUARTZ], 1, [Use Core Graphics (Quartz) for loading image data])
747         ],
748
749         [gdk-pixbuf],
750         [
751           AC_DEFINE([USE_GDKPIXBUF], 1, [Use GdkPixbuf for loading image data])
752           IMAGE_PC_FILES="gdk-pixbuf-2.0"
753         ],
754
755         [internal],
756         [
757           experimental_image=yes
758           AC_DEFINE([USE_INTERNAL], 1, [Use internal image decoding for loading image data])
759         ],
760
761         [AC_MSG_ERROR([Unknown argument for --with-imagebackend])]
762 )
763
764 dnl === X11 checks, only for X11-based backends ===============================
765 X11_PC_FILES=""
766 x11_tests=no
767
768 AS_IF([test "x$SUPPORT_XLIB" = "x1"],
769       [
770         # base X11 includes and libraries
771         AC_MSG_CHECKING([for X11])
772
773         # start with pkg-config
774         PKG_CHECK_EXISTS([x11], [have_x11=yes], [have_x11=no])
775         AS_IF([test "x$have_x11" = "xyes"],
776               [
777                 X11_PC_FILES="x11"
778
779                 # we actually need to ask for CFLAGS and LIBS
780                 X11_CFLAGS=`$PKG_CONFIG --cflags $X11_PC_FILES`
781                 X11_LIBS=`$PKG_CONFIG --libs $X11_PC_FILES`
782
783                 AC_MSG_RESULT([found])
784               ],
785               [
786                 # no pkg-config, let's go old school
787                 AC_PATH_X
788
789                 AS_IF([test "x$no_x" = "xyes"],
790                       [AC_MSG_ERROR([No X11 Libraries found])],
791                       [
792                         AS_IF([test "x$x_includes" != "xNONE" && test -n "$x_includes"],
793                               [X11_CFLAGS=-I`echo $x_includes | sed -e "s/:/ -I/g"`])
794
795                         AS_IF([test "x$x_libraries" != "xNONE" && test -n "$x_libraries"],
796                               [X11_LIBS=-L`echo $x_libraries | sed -e "s/:/ -L/g"`])
797
798                         AC_MSG_RESULT([found])
799                       ]
800                 )
801               ]
802         )
803
804         # XEXT (required)
805         AC_MSG_CHECKING([for XEXT extension])
806         PKG_CHECK_EXISTS([xext], [have_xext=yes], [have_xext=no])
807         AS_IF([test "x$have_xext" = "xyes"],
808               [
809                 AC_DEFINE(HAVE_XEXT, [1], [Define to 1 if we have the XEXT X extension])
810
811                 X11_LIBS="$X11_LIBS -lXext"
812                 X11_PC_FILES="$X11_PC_FILES xext"
813
814                 AC_MSG_RESULT([found])
815               ],
816               [AC_MSG_ERROR([Not found])]
817         )
818
819         # XFIXES (required)
820         AC_MSG_CHECKING([for XFIXES extension >= 3])
821         PKG_CHECK_EXISTS([xfixes >= 3], [have_xfixes=yes], [have_xfixes=no])
822         AS_IF([test "x$have_xfixes" = "xyes"],
823               [
824                 AC_DEFINE(HAVE_XFIXES, [1], [Define to 1 if we have the XFIXES X extension])
825
826                 X11_LIBS="$X11_LIBS -lXfixes"
827                 X11_PC_FILES="$X11_PC_FILES xfixes"
828
829                 AC_MSG_RESULT([found])
830               ],
831               [AC_MSG_ERROR([Not found])]
832         )
833
834         # XDAMAGE (required)
835         AC_MSG_CHECKING([for XDAMAGE extension])
836         PKG_CHECK_EXISTS([xdamage], [have_xdamage=yes], [have_xdamage=no])
837         AS_IF([test "x$have_xdamage" = "xyes"],
838               [
839                 AC_DEFINE(HAVE_XDAMAGE, [1], [Define to 1 if we have the XDAMAGE X extension])
840
841                 X11_LIBS="$X11_LIBS -lXdamage"
842                 X11_PC_FILES="$X11_PC_FILES xdamage"
843
844                 AC_MSG_RESULT([found])
845               ],
846               [AC_MSG_ERROR([not found])]
847         )
848
849         # XCOMPOSITE (optional)
850         AC_MSG_CHECKING([for XCOMPOSITE extension >= 0.4])
851         PKG_CHECK_EXISTS([xcomposite >= 0.4], [have_xcomposite=yes], [have_xcomposite=no])
852         AS_IF([test "x$have_xcomposite" = "xyes"],
853               [
854                 AC_DEFINE(HAVE_XCOMPOSITE, [1], [Define to 1 if we have the XCOMPOSITE X extension])
855
856                 X11_LIBS="$X11_LIBS -lXcomposite"
857                 X11_PC_FILES="$X11_PC_FILES xcomposite"
858
859                 AC_MSG_RESULT([found])
860               ],
861               [AC_MSG_ERROR([not found])]
862         )
863
864         # XINPUT (optional)
865         xinput=no
866         AC_ARG_ENABLE([xinput],
867                       [AS_HELP_STRING([--enable-xinput], [Use the XINPUT X extension])],
868                       [
869                         AS_IF([test "x$enableval" = "xyes"],
870                               [PKG_CHECK_MODULES(XINPUT, [xi], [xinput=yes], [xinput=no])]
871                         )
872                       ],
873                       [xinput=no])
874
875         AS_CASE([$xinput],
876
877                 [yes],
878                 [
879                   AC_DEFINE(HAVE_XINPUT, 1, [Use the XINPUT X extension])
880
881                   X11_LIBS="$X11_LIBS -lXi"
882                   X11_PC_FILES="$X11_PC_FILES xi"
883                 ],
884
885                 [no],
886                 [],
887         )
888
889         # XKB
890         clutter_save_CPPFLAGS="$CPPFLAGS"
891         CPPFLAGS="$CPPFLAGS $X11_CFLAGS"
892
893         clutter_save_LIBS="$LIBS"
894         LIBS="$LIBS $X11_LIBS"
895
896         have_xkb=no
897         AC_CHECK_FUNC([XkbQueryExtension],
898                       [
899                         AC_DEFINE(HAVE_XKB, 1, [Define to use XKB extension])
900                         have_xkb=yes
901                       ])
902
903         CPPFLAGS="$clutter_save_CPPFLAGS"
904         LIBS="$clutter_save_LIBS"
905
906         x11_tests=yes
907         BACKEND_PC_FILES="$BACKEND_PC_FILES $X11_PC_FILES"
908         FLAVOUR_LIBS="$FLAVOUR_LIBS $X11_LIBS"
909         FLAVOUR_CFLAGS="$FLAVOUR_CFLAGS $X11_CFLAGS"
910       ]
911 )
912
913 AM_CONDITIONAL(X11_TESTS, [test "x$x11_tests" = "xyes"])
914
915 dnl === Enable debug level ====================================================
916
917 m4_define([debug_default], [m4_if(m4_eval(clutter_minor_version % 2), [1], [yes], [minimum])])
918 AC_ARG_ENABLE([debug],
919               [AC_HELP_STRING([--enable-debug=@<:@no/minimum/yes@:>@],
920                               [Control Clutter debugging level @<:@default=debug_default@:>@])],
921               [],
922               [enable_debug=debug_default])
923
924 AS_CASE([$enable_debug],
925
926         [yes],
927         [
928           test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
929           CLUTTER_DEBUG_CFLAGS="-DCLUTTER_ENABLE_DEBUG"
930         ],
931
932         [minimum],
933         [CLUTTER_DEBUG_CFLAGS="-DCLUTTER_ENABLE_DEBUG -DG_DISABLE_CAST_CHECKS"],
934
935         [no],
936         [CLUTTER_DEBUG_CFLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"],
937
938         [AC_MSG_ERROR([Unknown argument for --enable-debug])]
939 )
940
941 AC_SUBST(CLUTTER_DEBUG_CFLAGS)
942
943 m4_define([cogl_debug_default], [minimum])
944 AC_ARG_ENABLE([cogl-debug],
945               [AC_HELP_STRING([--enable-cogl-debug=@<:@no/yes@:>@],
946                               [Control COGL debugging level @<:@default=cogl_debug_default@:>@])],
947               [],
948               [enable_cogl_debug=cogl_debug_default])
949
950 AS_CASE([$enable_cogl_debug],
951
952         [yes],
953         [COGL_DEBUG_CFLAGS="-DCOGL_GL_DEBUG -DCOGL_OBJECT_DEBUG -DCOGL_HANDLE_DEBUG -DCOGL_ENABLE_DEBUG"],
954
955         [minimum],
956         [COGL_DEBUG_CFLAGS="-DCOGL_ENABLE_DEBUG"],
957
958         [no],
959         [COGL_DEBUG_CFLAGS=""],
960
961         [AC_MSG_ERROR([Invalid value for --enable-cogl-debug])]
962 )
963
964 AC_SUBST(COGL_DEBUG_CFLAGS)
965
966 dnl === Conformance test suite ================================================
967
968 AC_ARG_ENABLE([conformance],
969               [AC_HELP_STRING([--enable-conformance=@<:@no/yes@:>@],
970                               [Build conformance test suite @<:@default=yes@:>@])],
971               [],
972               [enable_conformance=yes])
973
974 AM_CONDITIONAL([BUILD_TESTS], [test "x$enable_conformance" = "xyes"])
975
976 dnl === Profiling =============================================================
977
978 m4_define([profile_default], [no])
979 AC_ARG_ENABLE(profile,
980               AC_HELP_STRING([--enable-profile=@<:@no/yes@:>@],
981                              [Turn on profiling support. yes; All profiling probe points are compiled in and may be runtime enabled. no; No profiling support will built into clutter.  @<:@default=no@:>@]),
982               [],
983               [enable_profile=profile_default])
984
985 AS_CASE([$enable_profile],
986
987         [yes],
988         [
989           AS_IF([test "x$GCC" = "xyes"],
990                 [
991                   PKG_CHECK_MODULES([PROFILE_DEP], [uprof-0.3])
992                   CLUTTER_PROFILE_CFLAGS="-DCLUTTER_ENABLE_PROFILE -DCOGL_ENABLE_PROFILE $PROFILE_DEP_CFLAGS"
993                   CLUTTER_PROFILE_LDFLAGS="$PROFILE_DEP_LIBS"
994
995                   AS_IF([test "x$enable_debug" = "xyes"], [CLUTTER_PROFILE_CFLAGS+=" -DUPROF_DEBUG"])
996                 ],
997                 [
998                   AC_MSG_ERROR([--enable-profile is currently only supported if using GCC])
999                 ])
1000         ],
1001
1002         [no],
1003         [
1004           CLUTTER_PROFILE_CFLAGS=""
1005           CLUTTER_PROFILE_LDFLAGS=""
1006         ],
1007
1008         [*], [AC_MSG_ERROR([Invalid value for --enable-profile])]
1009 )
1010 AM_CONDITIONAL(PROFILE, test "x$enable_profile" != "xno")
1011 AC_SUBST(CLUTTER_PROFILE_CFLAGS)
1012 AC_SUBST(CLUTTER_PROFILE_LDFLAGS)
1013
1014 dnl === Coverage report =======================================================
1015
1016 AC_PATH_PROG([GCOV], [gcov], [enable_gcov=no])
1017
1018 AC_MSG_CHECKING([whether to build with gcov testing])
1019
1020 AC_ARG_ENABLE([gcov],
1021               [AS_HELP_STRING([--enable-gcov],
1022                               [Whether to enable coverage testing (requires gcc
1023 and gcov)])],
1024               [],
1025               [enable_gcov=no])
1026
1027 AS_IF([test "x$enable_gcov" = "xyes" && test "x$GCC" = "xyes"],
1028       [
1029         AS_IF([test "x$enable_conformance" = "xno"],
1030               [AC_MSG_WARN([Conformance test suite is disabled, the coverage report will be incomplete])],
1031               [AC_MSG_RESULT([yes])]
1032         )
1033
1034         GCOV_CFLAGS="-g -O0 -fprofile-arcs -ftest-coverage"
1035         GCOV_LDFLAGS="-lgcov"
1036       ],
1037       [AC_MSG_RESULT([no])]
1038 )
1039
1040 AM_CONDITIONAL([GCOV_ENABLED], [test "x$enable_gcov" = "xyes"])
1041 AC_SUBST([GCOV_CFLAGS])
1042 AC_SUBST([GCOV_LDFLAGS])
1043
1044 dnl === Enable strict compiler flags ==========================================
1045
1046 # use strict compiler flags only on development releases
1047 m4_define([maintainer_flags_default], [m4_if(m4_eval(clutter_minor_version % 2), [1], [yes], [no])])
1048 AC_ARG_ENABLE([maintainer-flags],
1049               [AC_HELP_STRING([--enable-maintainer-flags=@<:@no/yes@:>@],
1050                               [Use strict compiler flags @<:@default=maintainer_flags_default@:>@])],
1051               [],
1052               [enable_maintainer_flags=maintainer_flags_default])
1053
1054 AS_IF([test "x$enable_maintainer_flags" = "xyes" && test "x$GCC" = "xyes"],
1055       [
1056         AS_COMPILER_FLAGS([MAINTAINER_CFLAGS],
1057                           ["-Wall -Wshadow -Wcast-align -Wuninitialized
1058                             -Wno-strict-aliasing -Wempty-body -Wformat
1059                             -Wformat-security -Winit-self
1060                             -Wdeclaration-after-statement -Wvla"])
1061       ]
1062 )
1063
1064 AC_SUBST(MAINTAINER_CFLAGS)
1065
1066 dnl === Dependencies, compiler flags and linker libraries =====================
1067 CLUTTER_REQUIRES="cairo-gobject >= 1.10 atk >= 1.7 pangocairo >= 1.20 json-glib-1.0 >= 0.12 $IMAGE_PC_FILES $BACKEND_PC_FILES"
1068 PKG_CHECK_MODULES(CLUTTER_DEPS, [$CLUTTER_REQUIRES])
1069 AC_SUBST(CLUTTER_REQUIRES)
1070
1071 CLUTTER_CFLAGS="$FLAVOUR_CFLAGS $CLUTTER_DEPS_CFLAGS $CLUTTER_PROFILE_CFLAGS $GLIB_CFLAGS"
1072 CLUTTER_LIBS="$FLAVOUR_LIBS $CLUTTER_DEPS_LIBS $CLUTTER_PROFILE_LDFLAGS $GLIB_LIBS"
1073 AC_SUBST(CLUTTER_CFLAGS)
1074 AC_SUBST(CLUTTER_LIBS)
1075
1076 dnl === GObject-Introspection check ===========================================
1077
1078 GOBJECT_INTROSPECTION_CHECK([0.9.5])
1079
1080 dnl === GTK Doc check =========================================================
1081
1082 GTK_DOC_CHECK([1.13], [--flavour no-tmpl])
1083
1084 # we don't want to build the documentation from a Git clone unless we
1085 # explicitly tell configure to do so; this allows avoiding to recurse into
1086 # the documentation directory when building Clutter inside Poky for a
1087 # target device that doesn't have gtk-doc installed. for reference
1088 # see: http://bugzilla.openedhand.com/show_bug.cgi?id=1047
1089 #
1090 # we use autogen.sh as it exists only inside the Git clones, and it
1091 # is not packaged into tarballs.
1092 AM_CONDITIONAL([BUILD_GTK_DOC], [test "x$enable_gtk_doc" = "xyes" || test ! -f "autogen.sh"])
1093
1094 # prefixes for fixing gtk-doc references
1095 CAIRO_PREFIX="`$PKG_CONFIG --variable=prefix cairo`"
1096 GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`"
1097 PANGO_PREFIX="`$PKG_CONFIG --variable=prefix pango`"
1098 AC_SUBST(CAIRO_PREFIX)
1099 AC_SUBST(GLIB_PREFIX)
1100 AC_SUBST(PANGO_PREFIX)
1101
1102 dnl === Manual ================================================================
1103
1104 AC_ARG_ENABLE([docs],
1105               [AC_HELP_STRING([--enable-docs=@<:@no/yes@:>@],
1106                               [Build optional documentation; requires xsltproc and jw.])],
1107               [enable_docs=$enableval],
1108               [enable_docs=no])
1109
1110 enable_pdfs=no
1111 AS_IF([test "x$enable_docs" = "xyes"],
1112       [
1113         AC_PATH_PROG(JW, [jw], [no])
1114         AS_IF([test "x$JW" = "xno"],
1115               [
1116                 AC_MSG_WARN([jw not found; pdf generation has been disabled])
1117               ],
1118               [enable_pdfs=yes])
1119
1120         AC_PATH_PROG(XSLTPROC, [xsltproc], [no])
1121         AS_IF([test "x$XSLTPROC" = "xno"],
1122               [
1123                 AC_MSG_ERROR([xsltproc not found])
1124               ])
1125       ]
1126 )
1127
1128 AM_CONDITIONAL(ENABLE_DOCS, [test "x$enable_docs" = "xyes"])
1129 AM_CONDITIONAL(ENABLE_PDFS, [test "x$enable_pdfs" = "xyes"])
1130
1131 dnl === I18N ==================================================================
1132
1133 AM_GNU_GETTEXT_VERSION([0.17])
1134 AM_GNU_GETTEXT([external])
1135
1136 GETTEXT_PACKAGE="clutter-1.0"
1137 AC_SUBST(GETTEXT_PACKAGE)
1138 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,
1139                    "$GETTEXT_PACKAGE",
1140                    [The prefix for our gettext translation domains.])
1141 AS_ALL_LINGUAS
1142
1143 dnl ===========================================================================
1144
1145 AC_CONFIG_FILES([
1146         Makefile
1147
1148         build/Makefile
1149         build/autotools/Makefile
1150         build/mingw/Makefile
1151
1152         clutter/Makefile
1153         clutter/clutter-config.h
1154         clutter/clutter-version.h
1155         clutter/clutter-$CLUTTER_API_VERSION.pc:clutter/clutter.pc.in
1156
1157         clutter/cally/cally-$CLUTTER_API_VERSION.pc:clutter/cally/cally.pc.in
1158
1159         clutter/cogl/Makefile
1160         clutter/cogl/cogl/Makefile
1161         clutter/cogl/cogl/cogl-defines.h
1162         clutter/cogl/cogl/cogl-$CLUTTER_API_VERSION.pc:clutter/cogl/cogl/cogl.pc.in
1163         clutter/cogl/pango/Makefile
1164
1165         clutter/egl/clutter-cex100.h
1166
1167         tests/Makefile
1168         tests/accessibility/Makefile
1169         tests/conform/Makefile
1170         tests/conform/test-launcher.sh
1171         tests/data/Makefile
1172         tests/interactive/Makefile
1173         tests/interactive/wrapper.sh
1174         tests/micro-bench/Makefile
1175
1176         doc/Makefile
1177         doc/reference/Makefile
1178         doc/reference/clutter/Makefile
1179         doc/reference/clutter/clutter-docs.xml
1180         doc/reference/cogl/Makefile
1181         doc/reference/cogl/cogl-docs.xml
1182         doc/reference/cally/Makefile
1183         doc/reference/cally/cally-docs.xml
1184         doc/common/Makefile
1185         doc/manual/Makefile
1186         doc/manual/clutter-manual.xml
1187         doc/cookbook/Makefile
1188         doc/cookbook/clutter-cookbook.xml
1189         doc/cookbook/examples/Makefile
1190
1191         po/Makefile.in
1192 ])
1193
1194 AC_OUTPUT
1195
1196 dnl === Summary ===============================================================
1197
1198 echo ""
1199 echo "Clutter - $VERSION (${CLUTTER_RELEASE_STATUS})"
1200
1201 # Global flags
1202 echo ""
1203 echo " • Global:"
1204 echo "        Prefix: ${prefix}"
1205 echo "        Flavour: ${CLUTTER_WINSYS}/${COGL_DRIVER}"
1206 echo "        Target library: ${CLUTTER_WINSYS_LIB}"
1207
1208 # Compiler/Debug related flags
1209 echo ""
1210 echo " • Compiler options:"
1211 echo "        Clutter debug level: ${enable_debug}"
1212 echo "        COGL debug level: ${enable_cogl_debug}"
1213 echo "        Compiler flags: ${MAINTAINER_CFLAGS}"
1214 echo "        Profiling enabled: ${enable_profile}"
1215 echo "        Enable coverage tests: ${enable_gcov}"
1216
1217 # Documentation
1218 echo ""
1219 echo " • Documentation:"
1220 echo "        Build API Reference: ${enable_gtk_doc}"
1221 echo "        Build Additional Documentation: ${enable_docs} (Generate PDF: ${enable_pdfs})"
1222
1223 # Miscellaneous
1224 echo ""
1225 echo " • Extra:"
1226 echo "        Build introspection data: ${enable_introspection}"
1227 echo "        Build conformance test suite: ${enable_conformance}"
1228
1229 # Cogl flags
1230 echo ""
1231 echo " • Cogl Backend:"
1232 echo "        Driver: ${COGL_DRIVER}"
1233 echo "        GL header: ${cogl_gl_headers}"
1234
1235 if test "x$COGL_DRIVER" = "xgles"; then
1236   if test "x$use_gles2_wrapper" = "xyes"; then
1237 echo "        GLES version: 2.0"
1238   else
1239 echo "        GLES version: 1.1"
1240   fi
1241 fi
1242
1243 if test "x$experimental_image" = "xno"; then
1244 echo "        Image backend: ${COGL_IMAGE_BACKEND}"
1245 else
1246 echo "        Image backend: ${COGL_IMAGE_BACKEND} (WARNING: Experimental)"
1247 fi
1248
1249 # Clutter backend related flags
1250 echo ""
1251 echo " • Clutter Backend:"
1252
1253 if test "x$experimental_backend" = "xno"; then
1254 echo "        Windowing system: ${CLUTTER_WINSYS}"
1255 else
1256 echo "        Windowing system: ${CLUTTER_WINSYS} (WARNING: Experimental)"
1257 fi
1258
1259 if test "x$SUPPORT_XLIB" = "x1"; then
1260 echo "        Enable XComposite: ${have_xcomposite}"
1261 echo "        Enable XInput 1.0: ${xinput}"
1262 echo "        Enable XKB: ${have_xkb}"
1263 echo "        Enable X11 tests: ${x11_tests}"
1264 fi
1265
1266 echo ""
1267
1268 # General warning about experimental features
1269 if test "x$experimental_backend" = "xyes" ||
1270    test "x$experimental_image" = "xyes"
1271 then
1272 echo ""
1273 echo "☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠"
1274 echo " *WARNING*"
1275 echo ""
1276 echo "  The stability of your build might be affected by one or more"
1277 echo "  experimental backends or experimental and unsupported features"
1278 echo "☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠"
1279 echo ""
1280 fi