build: Move EGL-related files under egl/
[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 # After the release:
9 # - increase clutter_micro_version to the next odd number
10 # - increase clutter_interface_version to the next odd number
11 m4_define([clutter_major_version], [1])
12 m4_define([clutter_minor_version], [9])
13 m4_define([clutter_micro_version], [1])
14
15 # • for stable releases: increase the interface age by 1 for each release;
16 #   if the API changes, set to 0. interface_age and binary_age are used to
17 #   create the soname of the shared object:
18 #
19 #  (<minor> * 100 + <micro>) - <interface_age>
20 #
21 # this allows using the same soname for different micro-releases in case
22 # no API was added or deprecated. for instance:
23 #
24 #   clutter 1.2.0  -> 100 * 2 + 0  = 200, interface age = 0 -> 200
25 #   clutter 1.2.2  -> 100 * 2 + 2  = 202, interface age = 2 -> 200
26 #   clutter 1.2.4  -> 100 * 2 + 4  = 204, interface age = 4 -> 200
27 #   [ API addition, deprecation ]
28 #   clutter 1.2.6  -> 100 * 2 + 6  = 206, interface age = 0 -> 206
29 #   clutter 1.2.8  -> 100 * 2 + 8  = 208, interface age = 2 -> 206
30 #   clutter 1.2.10 -> 100 * 2 + 10 = 210, interface age = 4 -> 206
31 #   ...
32 #
33 # • for development releases: keep clutter_interface_age to 0
34 m4_define([clutter_interface_age], [0])
35
36 m4_define([clutter_binary_age], [m4_eval(100 * clutter_minor_version + clutter_micro_version)])
37
38 m4_define([clutter_release_status],
39           [m4_if(m4_eval(clutter_micro_version % 2), [1], [git],
40                  [m4_if(m4_eval(clutter_minor_version % 2), [1], [snapshot],
41                                                                  [release])])])
42
43 m4_define([clutter_version], [clutter_major_version.clutter_minor_version.clutter_micro_version])
44
45 # change this only when breaking the API
46 m4_define([clutter_api_version], [1.0])
47
48 AC_PREREQ([2.63])
49
50 AC_INIT([clutter],
51         [clutter_version],
52         [http://bugzilla.gnome.org/enter_bug.cgi?product=clutter],
53         [clutter],
54         [http://www.clutter-project.org])
55
56 AC_CONFIG_SRCDIR([clutter/clutter.h])
57 AC_CONFIG_HEADERS([config.h])
58 AC_CONFIG_AUX_DIR([build])
59 AC_CONFIG_MACRO_DIR([build/autotools])
60
61 AM_INIT_AUTOMAKE([1.11 foreign -Wno-portability no-define no-dist-gzip dist-xz tar-ustar])
62 AM_SILENT_RULES([yes])
63
64 AC_SUBST([CLUTTER_MAJOR_VERSION],  [clutter_major_version])
65 AC_SUBST([CLUTTER_MINOR_VERSION],  [clutter_minor_version])
66 AC_SUBST([CLUTTER_MICRO_VERSION],  [clutter_micro_version])
67 AC_SUBST([CLUTTER_VERSION],        [clutter_version])
68 AC_SUBST([CLUTTER_API_VERSION],    [clutter_api_version])
69 AC_SUBST([CLUTTER_API_VERSION_AM], [$CLUTTER_MAJOR_VERSION\_0])
70 AC_SUBST([CLUTTER_RELEASE_STATUS], [clutter_release_status])
71
72 m4_define([lt_current],  [m4_eval(100 * clutter_minor_version + clutter_micro_version - clutter_interface_age)])
73 m4_define([lt_revision], [clutter_interface_age])
74 m4_define([lt_age],      [m4_eval(clutter_binary_age - clutter_interface_age)])
75 CLUTTER_LT_CURRENT=lt_current
76 CLUTTER_LT_REV=lt_revision
77 CLUTTER_LT_AGE=lt_age
78 CLUTTER_LT_VERSION="$CLUTTER_LT_CURRENT:$CLUTTER_LT_REV:$CLUTTER_LT_AGE"
79 CLUTTER_LT_LDFLAGS="-version-info $CLUTTER_LT_VERSION"
80 AC_SUBST([CLUTTER_LT_CURRENT],  [lt_current])
81 AC_SUBST([CLUTTER_LT_REVISION], [lt_revision])
82 AC_SUBST([CLUTTER_LT_VERSION],  [$CLUTTER_LT_VERSION])
83
84 AC_PROG_SED
85
86 AC_CANONICAL_HOST
87
88 platform_win32=no
89 platform_quartz=no
90 platform_linux=no
91
92 AC_MSG_CHECKING([if building for some Win32 platform])
93 AS_CASE([$host],
94         [*-*-mingw*|*-*-cygwin*],
95         [
96           CLUTTER_LT_LDFLAGS="$CLUTTER_LT_LDFLAGS -no-undefined"
97           platform_win32=yes
98         ],
99
100         []
101 )
102 AC_MSG_RESULT([$platform_win32])
103
104 AM_CONDITIONAL(OS_WIN32, [test "$platform_win32" = "yes"])
105
106 AC_CHECK_HEADER([OpenGL/gl.h], [platform_quartz=yes], [platform_quartz=no])
107 AM_CONDITIONAL(OS_QUARTZ, [test "$platform_quartz" = "yes"])
108
109 AC_CHECK_HEADER([GL/glx.h], [platform_glx=yes], [platform_glx=no])
110 AC_CHECK_LIB([GL], [glXCreateContext], [platform_glx=yes], [platform_glx=no])
111 AM_CONDITIONAL(OS_GLX, [test "$platform_glx" = "yes"])
112
113 AC_SUBST(CLUTTER_LT_LDFLAGS)
114
115 dnl ========================================================================
116
117 # Checks for programs.
118 AM_PROG_CC_C_O
119
120 # require libtool >= 2.2
121 LT_PREREQ([2.2.6])
122 LT_INIT([disable-static])
123
124 # Checks for header files.
125 AC_HEADER_STDC
126
127 # required versions for dependencies
128 m4_define([glib_req_version],           [2.31.0])
129 m4_define([cogl_req_version],           [1.9.1])
130 m4_define([json_glib_req_version],      [0.12.0])
131 m4_define([atk_req_version],            [2.1.5])
132 m4_define([cairo_req_version],          [1.10])
133 m4_define([pango_req_version],          [1.20])
134 m4_define([gi_req_version],             [0.9.5])
135 m4_define([uprof_req_version],          [0.3])
136 m4_define([gtk_doc_req_version],        [1.15])
137 m4_define([xfixes_req_version],         [3])
138 m4_define([xcomposite_req_version],     [0.4])
139
140 AC_SUBST([GLIB_REQ_VERSION],       [glib_req_version])
141 AC_SUBST([COGL_REQ_VERSION],       [cogl_req_version])
142 AC_SUBST([JSON_GLIB_REQ_VERSION],  [json_glib_req_version])
143 AC_SUBST([ATK_REQ_VERSION],        [atk_req_version])
144 AC_SUBST([CAIRO_REQ_VERSION],      [cairo_req_version])
145 AC_SUBST([PANGO_REQ_VERSION],      [pango_req_version])
146 AC_SUBST([GI_REQ_VERSION],         [gi_req_version])
147 AC_SUBST([UPROF_REQ_VERSION],      [uprof_req_version])
148 AC_SUBST([GTK_DOC_REQ_VERSION],    [gtk_doc_req_version])
149 AC_SUBST([XFIXES_REQ_VERSION],     [xfixes_req_version])
150 AC_SUBST([XCOMPOSITE_REQ_VERSION], [xcomposite_req_version])
151
152 # Checks for typedefs, structures, and compiler characteristics.
153 AM_PATH_GLIB_2_0([glib_req_version],
154                  [],
155                  [AC_MSG_ERROR([glib-2.0 is required])],
156                  [gobject gthread gmodule-no-export])
157
158 # Check for -Bsymbolic-functions to avoid intra-library PLT jumps
159 AC_ARG_ENABLE([Bsymbolic],
160               [AS_HELP_STRING([--disable-Bsymbolic],
161                               [Avoid linking with -Bsymbolic])],
162               [],
163               [
164                 saved_LDFLAGS="${LDFLAGS}"
165                 AC_MSG_CHECKING([for -Bsymbolic-functions linker flag])
166                 LDFLAGS=-Wl,-Bsymbolic-functions
167                 AC_TRY_LINK([], [int main (void) { return 0; }],
168                             [
169                               AC_MSG_RESULT([yes])
170                               enable_Bsymbolic=yes
171                             ],
172                             [
173                               AC_MSG_RESULT([no])
174                               enable_Bsymbolic=no
175                             ])
176                 LDFLAGS="${saved_LDFLAGS}"
177               ])
178
179 AS_IF([test "x$enable_Bsymbolic" = "xyes"], [CLUTTER_LINK_FLAGS=-Wl[,]-Bsymbolic-functions])
180 AC_SUBST(CLUTTER_LINK_FLAGS)
181
182 dnl ========================================================================
183
184 # defaults
185 AS_IF([test "x$platform_win32" = "xyes"],  [CLUTTER_FLAVOUR=win32],
186       [test "x$platform_quartz" = "xyes"], [CLUTTER_FLAVOUR=osx],
187       [CLUTTER_FLAVOUR=glx])
188
189 FLAVOUR_LIBS=""
190 FLAVOUR_CFLAGS=""
191 CLUTTER_BACKENDS=""
192
193 experimental_backend=no
194
195 # base dependencies for core
196 CLUTTER_BASE_PC_FILES="cogl-1.0 >= $COGL_REQ_VERSION cairo-gobject >= $CAIRO_REQ_VERSION atk >= $ATK_REQ_VERSION pangocairo >= $PANGO_REQ_VERSION cogl-pango-1.0 json-glib-1.0 >= $JSON_GLIB_REQ_VERSION"
197
198 # backend specific pkg-config files
199 BACKEND_PC_FILES=""
200
201 dnl === Clutter windowing system backend ======================================
202
203 AC_ARG_ENABLE([x11],
204               [AS_HELP_STRING([--enable-x11=@<:@yes/no@:>@], [Enable the X11 backend (default=no)])],
205               [],
206               [enable_x11=maybe])
207 AC_ARG_ENABLE([win32],
208               [AS_HELP_STRING([--enable-win32=@<:@yes/no@:>@], [Enable the Windows backend (default=no)])],
209               [],
210               [enable_win32=maybe])
211 AC_ARG_ENABLE([osx],
212               [AS_HELP_STRING([--enable-osx=@<:@yes/no@:>@], [Enable the OS X backend (default=no)])],
213               [],
214               [enable_osx=maybe])
215 AC_ARG_ENABLE([gdk],
216               [AS_HELP_STRING([--enable-gdk=@<:@yes/no@:>@], [Enable the GDK backend (default=no)])],
217               [],
218               [enable_gdk=no])
219 AC_ARG_ENABLE([wayland],
220               [AS_HELP_STRING([--enable-wayland=@<:@yes/no@:>@], [Enable the Wayland client backend (default=no)])],
221               [],
222               [enable_wayland=no])
223 AC_ARG_ENABLE([egl],
224               [AS_HELP_STRING([--enable-egl=@<:@yes/no@:>@], [Enable the EGL framebuffer backend (default=no)])]
225               [],
226               [enable_egl=no])
227
228 dnl Define default values
229 AS_IF([test "x$platform_glx" = "xyes"], [enable_x11=yes])
230 AS_IF([test "x$platform_win32" = "xyes"], [enable_win32=yes])
231 AS_IF([test "x$platform_quartz" = "xyes"], [enable_osx=yes])
232
233 dnl Per-backend rules
234 AS_IF([test "x$enable_x11" = "xyes"],
235       [
236         CLUTTER_BACKENDS="$CLUTTER_BACKENDS x11"
237
238         SUPPORT_X11=1
239         SUPPORT_GLX=1
240         SUPPORT_COGL=1
241
242         # Mesa 7.3 added a GL pkg-config file, finally, but if a pkg-config
243         # file isn't found just add -lGL and hope for the best.
244         PKG_CHECK_EXISTS([gl],
245                          [BACKEND_PC_FILES="$BACKEND_PC_FILES gl"],
246                          [FLAVOUR_LIBS="$FLAVOUR_LIBS -lGL"])
247
248         # if Mesa has support for egl, we can use it as well
249         PKG_CHECK_EXISTS([egl],
250                          [
251                            BACKEND_PC_FILES="$BACKEND_PC_FILES egl"
252                            SUPPORT_EGL=1
253                          ],
254                          [])
255
256         # We might fall back to DRM for sync-to-vblank on GLX
257         PKG_CHECK_EXISTS([libdrm],
258                          [
259                            AC_DEFINE([HAVE_DRM], [1], [Have libdrm support])
260                            BACKEND_PC_FILES="$BACKEND_PC_FILES libdrm"
261                          ],
262                          [])
263
264         # we use fontconfig API and pango-fc when the fontconfig
265         # configuration changes
266         PKG_CHECK_EXISTS([pangoft2],
267                          [
268                            AC_DEFINE([HAVE_PANGO_FT2], [1], [Supports PangoFt2])
269                            BACKEND_PC_FILES="$BACKEND_PC_FILES pangoft2"
270                          ],
271                          [])
272
273         AC_DEFINE([HAVE_CLUTTER_GLX], [1], [Have the GLX backend])
274       ])
275
276 AS_IF([test "x$enable_gdk" = "xyes"],
277       [
278         CLUTTER_BACKENDS="$CLUTTER_BACKENDS gdk"
279
280         SUPPORT_GDK=1
281         SUPPORT_COGL=1
282
283         BACKEND_PC_FILES="$BACKEND_PC_FILES gdk-3.0"
284         PKG_CHECK_EXISTS([gl], [BACKEND_PC_FILES="$BACKEND_PC_FILES gl"], [])
285       ])
286
287 AS_IF([test "x$enable_wayland" = "xyes"],
288       [
289         CLUTTER_BACKENDS="$CLUTTER_BACKENDS wayland"
290
291         experimental_backend="yes"
292
293         SUPPORT_WAYLAND=1
294
295         PKG_CHECK_EXISTS([gl], [BACKEND_PC_FILES="$BACKEND_PC_FILES gl"], [])
296         PKG_CHECK_EXISTS([egl], [BACKEND_PC_FILES="$BACKEND_PC_FILES egl"], [])
297         PKG_CHECK_EXISTS([wayland-client xkbcommon],
298                          [BACKEND_PC_FILES="$BACKEND_PC_FILES wayland-client xkbcommon"],
299                          [])
300
301         AC_DEFINE([HAVE_CLUTTER_WAYLAND], [1], [Have the Wayland backend])
302       ])
303
304 AS_IF([test "x$enable_egl" = "xyes"],
305       [
306         CLUTTER_BACKENDS="$CLUTTER_BACKENDS egl"
307
308         SUPPORT_EGL=1
309         SUPPORT_COGL=1
310
311         AC_ARG_WITH([tslib],
312                     [AS_HELP_STRING([--with-tslib=@<:@yes/no@:>@], [Use TSLib for events])],
313                     [],
314                     [with_tslib=yes])
315
316         AC_ARG_WITH([evdev],
317                     [AS_HELP_STRING([--with-evdev=@<:@yes/no@:>@], [Use evdev for events])],
318                     [],
319                     [with_evdev=yes])
320
321         AC_ARG_WITH([gdl],
322                     [AS_HELP_STRING([--with-gdl=@<:@yes/no@:>@], [Use libgdl for CE3100/CE4100 support])],
323                     [],
324                     [with_gdl=no])
325
326         AS_IF([test "x$with_tslib" = "xyes"],
327               [
328                 PKG_CHECK_MODULES(TSLIB, [tslib-1.0], [have_tslib=yes], [have_tslib=no])
329                 AS_IF([test "x$have_tslib" = "xyes"],
330                       [
331                         AC_DEFINE([HAVE_TSLIB], [1], [Have tslib for touchscreen handling])
332                       ])
333               ])
334
335         AS_IF([test "x$with_evdev" = "xyes"],
336               [
337                 PKG_CHECK_MODULES(EVDEV, [gudev-1.0 xkbcommon], [have_evdev=yes], [have_evdev=no])
338                 AS_IF([test "x$have_evdev" = "xyes"],
339                       [
340                         AC_DEFINE([HAVE_EVDEV], [1], [Have evdev support for input handling])
341                       ])
342               ])
343
344         AS_IF([test "x$with_gdl" = "xyes"],
345               [
346                 have_gdl=no
347
348                 AC_CHECK_HEADERS([libgdl.h], [have_gdl=yes])
349
350                 AS_IF([test "x$have_gdl" = "xno"],
351                       [
352                         AC_CHECK_HEADERS([CE4100/libgdl.h],
353                                          [
354                                            FLAVOUR_CFLAGS="-I/usr/include/CE4100"
355                                            have_gdl=yes
356                                            CLUTTER_CEX100_LIBGDL_PREFIX=CE4100/
357                                          ])
358                       ])
359
360                 AC_SUBST(CLUTTER_CEX100_LIBGDL_PREFIX)
361
362                 AS_IF([test "x$have_gdl" = "xno"], [AC_MSG_ERROR([libgdl.h not found])])
363
364                 FLAVOUR_LIBS="$FLAVOUR_LIBS -lgdl"
365
366                 SUPPORT_EGL_PLATFORM_GDL=1
367
368                 AC_DEFINE([CLUTTER_EGL_BACKEND_CEX100], [1], [Use CEX100 EGL backend])
369               ])
370
371         # Make sure we don't enable tslib and evdev at the same time, we
372         # don't support multiple event backends yet.
373         AS_IF([test "x$have_tslib" = "xyes" -a "x$have_evdev" = "xyes"],
374               [
375                 AC_MSG_ERROR([Cannot enable both tslib and evdev events])
376               ])
377
378         FLAVOUR_LIBS="$FLAVOUR_LIBS $TSLIB_LIBS $EVDEV_LIBS"
379         FLAVOUR_CFLAGS="$FLAVOUR_CFLAGS $TSLIB_CFLAGS $EVDEV_CFLAGS"
380
381         AC_DEFINE([CLUTTER_EGL_BACKEND_GENERIC], [1], [Use Generic EGL backend])
382
383         AC_DEFINE([HAVE_CLUTTER_EGL], [1], [Have the EGL backend])
384       ])
385
386 AS_IF([test "x$enable_osx" = "xyes"],
387       [
388         CLUTTER_BACKENDS="$CLUTTER_BACKENDS osx"
389
390         AC_DEFINE([HAVE_CLUTTER_OSX], [1], [Have the OSX backend])
391
392         FLAVOUR_LIBS="$FLAVOUR_LIBS -framework Cocoa -framework OpenGL"
393
394         SUPPORT_OSX=1
395       ])
396
397 AS_IF([test "x$enable_win32" = "xyes"],
398       [
399         CLUTTER_BACKENDS="$CLUTTER_BACKENDS win32"
400
401         AC_DEFINE([HAVE_CLUTTER_WIN32], [1], [Have the Win32 backend])
402
403         FLAVOUR_LIBS="$FLAVOUR_LIBS -lopengl32 -lgdi32 -lwinmm"
404         FLAVOUR_CFLAGS="$FLAVOUR_CFLAGS -D_WIN32_WINNT=0x0500"
405
406         AC_CHECK_TOOL(WINDRES, [windres], [AC_MSG_ERROR([*** windres is required])])
407
408         SUPPORT_WIN32=1
409       ])
410
411 AS_IF([test "x$CLUTTER_BACKENDS" = "x"],
412       [
413         AC_MSG_ERROR([No backend enabled. You need to enable at least one backend.])
414       ])
415
416 # conditionals for use in automake files...
417 AM_CONDITIONAL(SUPPORT_GLX,     [test "x$SUPPORT_GLX" = "x1"])
418 AM_CONDITIONAL(SUPPORT_X11,     [test "x$SUPPORT_X11" = "x1"])
419 AM_CONDITIONAL(SUPPORT_GDK,     [test "x$SUPPORT_GDK" = "x1"])
420 AM_CONDITIONAL(SUPPORT_EGL,     [test "x$SUPPORT_EGL" = "x1"])
421 AM_CONDITIONAL(SUPPORT_OSX,     [test "x$SUPPORT_OSX" = "x1"])
422 AM_CONDITIONAL(SUPPORT_WIN32,   [test "x$SUPPORT_WIN32" = "x1"])
423 AM_CONDITIONAL(SUPPORT_CEX100,  [test "x$SUPPORT_EGL_PLATFORM_GDL" = "x1"])
424 AM_CONDITIONAL(SUPPORT_WAYLAND, [test "x$SUPPORT_WAYLAND" = "x1"])
425 AM_CONDITIONAL(SUPPORT_STUB,    [test "x$SUPPORT_WIN32" = "x1" -o \
426                                       "x$SUPPORT_OSX" = "x1" -o \
427                                       "x$SUPPORT_WAYLAND" = "x1"])
428
429 AM_CONDITIONAL(USE_COGL,  [test "x$SUPPORT_COGL" = "x1"])
430 AM_CONDITIONAL(USE_TSLIB, [test "x$have_tslib" = "xyes"])
431 AM_CONDITIONAL(USE_EVDEV, [test "x$have_evdev" = "xyes"])
432 AM_CONDITIONAL(USE_GLD,   [test "x$have_gdl" = "xyes"])
433
434 dnl Instead of using AM_CFLAGS to ensure
435 dnl COGL_ENABLE_EXPERIMENTAL_2_0_API is defined while compiling clutter
436 dnl and cogl code we use a define in config.h instead. This helps ensure
437 dnl other tools such as glib-mkenums and gir-scanner don't end up
438 dnl using the define also.
439 AC_DEFINE([COGL_ENABLE_EXPERIMENTAL_2_0_API], [1], [Can use Cogl 2.0 API internally])
440
441 dnl strip leading spaces
442 CLUTTER_BACKENDS=${CLUTTER_BACKENDS#* }
443 AC_SUBST(CLUTTER_BACKENDS)
444
445 dnl === Clutter configuration =================================================
446
447 CLUTTER_CONFIG_DEFINES=
448
449 # windowing systems
450 AS_IF([test "x$SUPPORT_X11" = "x1"],
451       [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
452 #define CLUTTER_WINDOWING_X11 1"])
453 AS_IF([test "x$SUPPORT_GDK" = "x1"],
454       [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
455 #define CLUTTER_WINDOWING_GDK 1"])
456 AS_IF([test "x$SUPPORT_GLX" = "x1"],
457       [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
458 #define CLUTTER_WINDOWING_GLX 1"])
459 AS_IF([test "x$SUPPORT_EGL" = "x1"],
460       [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
461 #define CLUTTER_WINDOWING_EGL 1"])
462 AS_IF([test "x$SUPPORT_WAYLAND" = "x1"],
463       [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
464 #define CLUTTER_WINDOWING_WAYLAND 1"])
465 AS_IF([test "x$SUPPORT_OSX" = "x1"],
466       [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
467 #define CLUTTER_WINDOWING_OSX 1"])
468 AS_IF([test "x$SUPPORT_WIN32" = "x1"],
469       [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
470 #define CLUTTER_WINDOWING_WIN32 1"])
471 AS_IF([test "x$SUPPORT_EGL_PLATFORM_GDL" = "x1"],
472       [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
473 #define CLUTTER_WINDOWING_CEX100 1"])
474
475 AC_SUBST([CLUTTER_CONFIG_DEFINES])
476
477 dnl === Clutter substitutions kept for backwards compatibility ================
478 AC_SUBST([CLUTTER_WINSYS],       [deprecated])
479 AC_SUBST([CLUTTER_WINSYS_BASE],  [deprecated])
480 AC_SUBST([CLUTTER_STAGE_TYPE],   [deprecated])
481 AC_SUBST([CLUTTER_SONAME_INFIX], [deprecated])
482 AC_SUBST([CLUTTER_FLAVOUR],      [deprecated])
483 AC_SUBST([CLUTTER_COGL],         [deprecated])
484 AC_SUBST([COGL_DRIVER],          [deprecated])
485
486 dnl === Image loading backend =================================================
487 IMAGE_PC_FILES=""
488
489 dnl === X11 checks, only for X11-based backends ===============================
490 X11_PC_FILES=""
491 x11_tests=no
492
493 AS_IF([test "x$SUPPORT_X11" = "x1"],
494       [
495         # base X11 includes and libraries
496         AC_MSG_CHECKING([for X11])
497
498         # start with pkg-config
499         PKG_CHECK_EXISTS([x11], [have_x11=yes], [have_x11=no])
500         AS_IF([test "x$have_x11" = "xyes"],
501               [
502                 X11_PC_FILES="x11"
503
504                 # we actually need to ask for CFLAGS and LIBS
505                 X11_CFLAGS=`$PKG_CONFIG --cflags $X11_PC_FILES`
506                 X11_LIBS=`$PKG_CONFIG --libs $X11_PC_FILES`
507
508                 AC_MSG_RESULT([found])
509               ],
510               [
511                 # no pkg-config, let's go old school
512                 AC_PATH_X
513
514                 AS_IF([test "x$no_x" = "xyes"],
515                       [AC_MSG_ERROR([No X11 Libraries found])],
516                       [
517                         AS_IF([test "x$x_includes" != "xNONE" && test -n "$x_includes"],
518                               [X11_CFLAGS=-I`echo $x_includes | sed -e "s/:/ -I/g"`])
519
520                         AS_IF([test "x$x_libraries" != "xNONE" && test -n "$x_libraries"],
521                               [X11_LIBS=-L`echo $x_libraries | sed -e "s/:/ -L/g"`])
522
523                         AC_MSG_RESULT([found])
524                       ]
525                 )
526               ]
527         )
528
529         # XEXT (required)
530         AC_MSG_CHECKING([for XEXT extension])
531         PKG_CHECK_EXISTS([xext], [have_xext=yes], [have_xext=no])
532         AS_IF([test "x$have_xext" = "xyes"],
533               [
534                 AC_DEFINE(HAVE_XEXT, [1], [Define to 1 if we have the XEXT X extension])
535
536                 X11_LIBS="$X11_LIBS -lXext"
537                 X11_PC_FILES="$X11_PC_FILES xext"
538
539                 AC_MSG_RESULT([found])
540               ],
541               [AC_MSG_ERROR([Not found])]
542         )
543
544         # XFIXES (required)
545         AC_MSG_CHECKING([for XFIXES extension >= $XFIXES_REQ_VERSION])
546         PKG_CHECK_EXISTS([xfixes >= $XFIXES_REQ_VERSION], [have_xfixes=yes], [have_xfixes=no])
547         AS_IF([test "x$have_xfixes" = "xyes"],
548               [
549                 AC_DEFINE(HAVE_XFIXES, [1], [Define to 1 if we have the XFIXES X extension])
550
551                 X11_LIBS="$X11_LIBS -lXfixes"
552                 X11_PC_FILES="$X11_PC_FILES xfixes >= $XFIXES_REQ_VERSION"
553
554                 AC_MSG_RESULT([found])
555               ],
556               [AC_MSG_ERROR([Not found])]
557         )
558
559         # XDAMAGE (required)
560         AC_MSG_CHECKING([for XDAMAGE extension])
561         PKG_CHECK_EXISTS([xdamage], [have_xdamage=yes], [have_xdamage=no])
562         AS_IF([test "x$have_xdamage" = "xyes"],
563               [
564                 AC_DEFINE(HAVE_XDAMAGE, [1], [Define to 1 if we have the XDAMAGE X extension])
565
566                 X11_LIBS="$X11_LIBS -lXdamage"
567                 X11_PC_FILES="$X11_PC_FILES xdamage"
568
569                 AC_MSG_RESULT([found])
570               ],
571               [AC_MSG_ERROR([not found])]
572         )
573
574         # XCOMPOSITE (optional)
575         AC_MSG_CHECKING([for XCOMPOSITE extension >= $XCOMPOSITE_REQ_VERSION])
576         PKG_CHECK_EXISTS([xcomposite >= $XCOMPOSITE_REQ_VERSION], [have_xcomposite=yes], [have_xcomposite=no])
577         AS_IF([test "x$have_xcomposite" = "xyes"],
578               [
579                 AC_DEFINE(HAVE_XCOMPOSITE, [1], [Define to 1 if we have the XCOMPOSITE X extension])
580
581                 X11_LIBS="$X11_LIBS -lXcomposite"
582                 X11_PC_FILES="$X11_PC_FILES xcomposite >= $XCOMPOSITE_REQ_VERSION"
583
584                 AC_MSG_RESULT([found])
585               ],
586               [AC_MSG_ERROR([not found])]
587         )
588
589         # X Generic Extensions (optional)
590         clutter_save_CPPFLAGS="$CPPFLAGS"
591         CPPFLAGS="$CPPFLAGS $X11_CFLAGS"
592
593         clutter_save_LIBS="$LIBS"
594         LIBS="$LIBS $X11_LIBS"
595
596         have_xge=no
597         AC_CHECK_FUNC([XGetEventData],
598                       [
599                         AC_DEFINE([HAVE_XGE], [1], [Define to 1 if X Generic Extensions is available])
600                         have_xge=yes
601                       ])
602
603         CPPFLAGS="$clutter_save_CPPFLAGS"
604         LIBS="$clutter_save_LIBS"
605
606         # XI (optional)
607         AC_ARG_ENABLE([xinput],
608                       [AS_HELP_STRING([--enable-xinput], [Use the XI X extension])],
609                       [],
610                       [enable_xinput=yes])
611
612         AS_IF([test "x$enable_xinput" = "xyes"],
613               [
614                 PKG_CHECK_EXISTS([xi], [have_xinput=yes], [have_xinput=no])
615               ],
616               [
617                 have_xinput=no
618               ])
619
620         AS_CASE([$have_xinput],
621
622                 [yes],
623                 [
624                   AC_CHECK_HEADERS([X11/extensions/XInput2.h],
625                                    [
626                                      have_xinput2=yes
627                                      AC_DEFINE([HAVE_XINPUT_2],
628                                                [1],
629                                                [Define to 1 if XI2 is available])
630                                    ],
631                                    [
632                                      have_xinput2=no
633                                      AC_DEFINE([HAVE_XINPUT],
634                                                [1],
635                                                [Define to 1 if XInput is available])
636                                    ])
637
638                   X11_LIBS="$X11_LIBS $XINPUT_LIBS"
639                   X11_PC_FILES="$X11_PC_FILES xi"
640                 ],
641
642                 [no],
643                 [have_xinput2=no],
644
645                 [*],
646                 [AC_MSG_ERROR([Invalid argument for --enable-xinput])]
647         )
648
649         # XKB
650         clutter_save_CPPFLAGS="$CPPFLAGS"
651         CPPFLAGS="$CPPFLAGS $X11_CFLAGS"
652
653         clutter_save_LIBS="$LIBS"
654         LIBS="$LIBS $X11_LIBS"
655
656         have_xkb=no
657         AC_CHECK_FUNC([XkbQueryExtension],
658                       [
659                         AC_DEFINE(HAVE_XKB, 1, [Define to use XKB extension])
660                         have_xkb=yes
661                       ])
662
663         CPPFLAGS="$clutter_save_CPPFLAGS"
664         LIBS="$clutter_save_LIBS"
665
666         x11_tests=yes
667         BACKEND_PC_FILES="$BACKEND_PC_FILES $X11_PC_FILES"
668         FLAVOUR_LIBS="$FLAVOUR_LIBS $X11_LIBS"
669         FLAVOUR_CFLAGS="$FLAVOUR_CFLAGS $X11_CFLAGS"
670       ]
671 )
672
673 AM_CONDITIONAL([BUILD_XI2], [test "x$have_xinput2" = "xyes"])
674 AM_CONDITIONAL([X11_TESTS], [test "x$x11_tests" = "xyes"])
675
676 dnl === Enable debug level ====================================================
677
678 m4_define([debug_default], [m4_if(m4_eval(clutter_minor_version % 2), [1], [yes], [minimum])])
679 AC_ARG_ENABLE([debug],
680               [AS_HELP_STRING([--enable-debug=@<:@no/minimum/yes@:>@],
681                               [Control Clutter debugging level @<:@default=]debug_default[@:>@])],
682               [],
683               [enable_debug=debug_default])
684
685 AS_CASE([$enable_debug],
686
687         [yes],
688         [
689           test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
690           CLUTTER_DEBUG_CFLAGS="-DCLUTTER_ENABLE_DEBUG"
691         ],
692
693         [minimum],
694         [CLUTTER_DEBUG_CFLAGS="-DCLUTTER_ENABLE_DEBUG -DG_DISABLE_CAST_CHECKS"],
695
696         [no],
697         [CLUTTER_DEBUG_CFLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"],
698
699         [AC_MSG_ERROR([Unknown argument for --enable-debug])]
700 )
701
702 AC_SUBST(CLUTTER_DEBUG_CFLAGS)
703
704 dnl === Enable deprecation guards ==================================================
705
706 m4_define([deprecated_default],
707           [m4_if(m4_eval(clutter_minor_version % 2),
708                  [1],
709                  [no],
710                  [yes])])
711
712 AC_ARG_ENABLE([deprecated],
713               [AS_HELP_STRING([--enable-deprecated=@<:@no/yes@:>@],
714                               [Whether deprecated symbols should be disabled when compiling Clutter @<:@default=]deprecated_default[@:>@])],
715               [],
716               [enable_deprecated=deprecated_default])
717
718 AS_CASE([$enable_deprecated],
719
720         [no],
721         [
722           CLUTTER_DEPRECATED_CFLAGS="-DG_DISABLE_SINGLE_INCLUDES -DCOGL_DISABLE_DEPRECATED -DCLUTTER_DISABLE_DEPRECATED"
723         ],
724
725         [yes],
726         [
727           CLUTTER_DEPRECATED_CFLAGS="-DGLIB_DISABLE_DEPRECATION_WARNINGS -DCLUTTER_DISABLE_DEPRECATION_WARNINGS"
728         ],
729
730         [AC_MSG_ERROR([Unknown argument for --enable-deprecated])]
731 )
732
733 AC_SUBST([CLUTTER_DEPRECATED_CFLAGS])
734
735
736 dnl === Conformance test suite ================================================
737
738 AC_ARG_ENABLE([conformance],
739               [AS_HELP_STRING([--enable-conformance=@<:@no/yes@:>@],
740                               [Build conformance test suite @<:@default=yes@:>@])],
741               [],
742               [enable_conformance=yes])
743
744 AM_CONDITIONAL([BUILD_TESTS], [test "x$enable_conformance" = "xyes"])
745
746 dnl === Profiling =============================================================
747
748 m4_define([profile_default], [no])
749 AC_ARG_ENABLE(profile,
750               AS_HELP_STRING([--enable-profile=@<:@no/yes@:>@],
751                              [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@:>@]),
752               [],
753               [enable_profile=profile_default])
754
755 AS_CASE([$enable_profile],
756
757         [yes],
758         [
759           AS_IF([test "x$GCC" = "xyes"],
760                 [
761                   PKG_CHECK_MODULES([PROFILE_DEP], [uprof-0.3])
762                   CLUTTER_PROFILE_CFLAGS="-DCLUTTER_ENABLE_PROFILE $PROFILE_DEP_CFLAGS"
763                   CLUTTER_PROFILE_LDFLAGS="$PROFILE_DEP_LIBS"
764
765                   AS_IF([test "x$enable_debug" = "xyes"], [CLUTTER_PROFILE_CFLAGS+=" -DUPROF_DEBUG"])
766                 ],
767                 [
768                   AC_MSG_ERROR([--enable-profile is currently only supported if using GCC])
769                 ])
770         ],
771
772         [no],
773         [
774           CLUTTER_PROFILE_CFLAGS=""
775           CLUTTER_PROFILE_LDFLAGS=""
776         ],
777
778         [*], [AC_MSG_ERROR([Invalid value for --enable-profile])]
779 )
780 AM_CONDITIONAL(PROFILE, test "x$enable_profile" != "xno")
781 AC_SUBST(CLUTTER_PROFILE_CFLAGS)
782 AC_SUBST(CLUTTER_PROFILE_LDFLAGS)
783
784 dnl === Coverage report =======================================================
785
786 AC_PATH_PROG([GCOV], [gcov], [enable_gcov=no])
787
788 AC_MSG_CHECKING([whether to build with gcov testing])
789
790 AC_ARG_ENABLE([gcov],
791               [AS_HELP_STRING([--enable-gcov],
792                               [Whether to enable coverage testing (requires gcc
793 and gcov)])],
794               [],
795               [enable_gcov=no])
796
797 AS_IF([test "x$enable_gcov" = "xyes" && test "x$GCC" = "xyes"],
798       [
799         AS_IF([test "x$enable_conformance" = "xno"],
800               [AC_MSG_WARN([Conformance test suite is disabled, the coverage report will be incomplete])],
801               [AC_MSG_RESULT([yes])]
802         )
803
804         GCOV_CFLAGS="-g -O0 -fprofile-arcs -ftest-coverage"
805         GCOV_LDFLAGS="-lgcov"
806       ],
807       [AC_MSG_RESULT([no])]
808 )
809
810 AM_CONDITIONAL([GCOV_ENABLED], [test "x$enable_gcov" = "xyes"])
811 AC_SUBST([GCOV_CFLAGS])
812 AC_SUBST([GCOV_LDFLAGS])
813
814 dnl === Enable strict compiler flags ==========================================
815
816 # use strict compiler flags only when building from git; the rules for
817 # distcheck will take care of turning this on when making a release
818 m4_define([maintainer_flags_default], [m4_if(m4_eval(clutter_micro_version % 2), [1], [yes], [no])])
819 AC_ARG_ENABLE([maintainer-flags],
820               [AS_HELP_STRING([--enable-maintainer-flags=@<:@no/yes/error@:>@],
821                               [Use strict compiler flags @<:@default=]maintainer_flags_default[@:>@])],
822               [],
823               [enable_maintainer_flags=maintainer_flags_default])
824
825 MAINTAINER_COMPILER_FLAGS="-Wall -Wshadow -Wcast-align -Wuninitialized
826                            -Wno-strict-aliasing -Wempty-body -Wformat
827                            -Wformat-security -Winit-self
828                            -Wdeclaration-after-statement -Wvla
829                            -Wpointer-arith"
830
831 AS_CASE([$enable_maintainer_flags],
832         [yes],
833         [
834           AS_COMPILER_FLAGS([MAINTAINER_CFLAGS], [$MAINTAINER_COMPILER_FLAGS])
835         ],
836
837         [no],
838         [
839         ],
840
841         [error],
842         [
843           MAINTAINER_COMPILER_FLAGS="$MAINTAINER_COMPILER_FLAGS -Werror"
844           AS_COMPILER_FLAGS([MAINTAINER_CFLAGS], [$MAINTAINER_COMPILER_FLAGS])
845         ],
846
847         [*],
848         [AC_MSG_ERROR([Invalid option for --enable-maintainer-flags])]
849 )
850
851 # strip leading spaces
852 MAINTAINER_CFLAGS=${MAINTAINER_CFLAGS#*  }
853 AC_SUBST(MAINTAINER_CFLAGS)
854
855 dnl === Dependencies, compiler flags and linker libraries =====================
856 # strip leading space
857 BACKEND_PC_FILES=${BACKEND_PC_FILES#* }
858
859 CLUTTER_REQUIRES="$CLUTTER_BASE_PC_FILES $IMAGE_PC_FILES $BACKEND_PC_FILES"
860 PKG_CHECK_MODULES(CLUTTER_DEPS, [$CLUTTER_REQUIRES])
861 AC_SUBST(CLUTTER_REQUIRES)
862
863 CLUTTER_CFLAGS="$FLAVOUR_CFLAGS $CLUTTER_DEPS_CFLAGS $CLUTTER_PROFILE_CFLAGS $GLIB_CFLAGS"
864 CLUTTER_LIBS="$FLAVOUR_LIBS $CLUTTER_DEPS_LIBS $CLUTTER_PROFILE_LDFLAGS $GLIB_LIBS"
865 AC_SUBST(CLUTTER_CFLAGS)
866 AC_SUBST(CLUTTER_LIBS)
867
868
869 dnl === GObject-Introspection check ===========================================
870
871 GOBJECT_INTROSPECTION_CHECK([gi_req_version])
872
873 dnl === GTK Doc check =========================================================
874
875 GTK_DOC_CHECK([gtk_doc_req_version], [--flavour no-tmpl])
876
877 # we don't want to build the documentation from a Git clone unless we
878 # explicitly tell configure to do so; this allows avoiding to recurse into
879 # the documentation directory when building Clutter inside Poky for a
880 # target device that doesn't have gtk-doc installed. for reference
881 # see: http://bugzilla.openedhand.com/show_bug.cgi?id=1047
882 #
883 # we use autogen.sh as it exists only inside the Git clones, and it
884 # is not packaged into tarballs.
885 AM_CONDITIONAL([BUILD_GTK_DOC], [test "x$enable_gtk_doc" = "xyes" || test ! -f "autogen.sh"])
886
887 # prefixes for fixing gtk-doc references
888 CAIRO_PREFIX="`$PKG_CONFIG --variable=prefix cairo`"
889 GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`"
890 PANGO_PREFIX="`$PKG_CONFIG --variable=prefix pango`"
891 COGL_PREFIX="`$PKG_CONFIG --variable=prefix cogl-1.0`"
892 ATK_PREFIX="`$PKG_CONFIG --variable=prefix atk`"
893 AC_SUBST(CAIRO_PREFIX)
894 AC_SUBST(GLIB_PREFIX)
895 AC_SUBST(PANGO_PREFIX)
896 AC_SUBST(COGL_PREFIX)
897 AC_SUBST(ATK_PREFIX)
898
899 dnl === Manual ================================================================
900
901 AC_ARG_ENABLE([docs],
902               [AS_HELP_STRING([--enable-docs=@<:@no/yes@:>@],
903                               [Build optional documentation; requires xsltproc and jw.])],
904               [enable_docs=$enableval],
905               [enable_docs=no])
906
907 enable_pdfs=no
908 AS_IF([test "x$enable_docs" = "xyes"],
909       [
910         AC_PATH_PROG(JW, [jw], [no])
911         AS_IF([test "x$JW" = "xno"],
912               [
913                 AC_MSG_WARN([jw not found; pdf generation has been disabled])
914               ],
915               [enable_pdfs=yes])
916
917         AC_PATH_PROG(XSLTPROC, [xsltproc], [no])
918         AS_IF([test "x$XSLTPROC" = "xno"],
919               [
920                 AC_MSG_ERROR([xsltproc not found])
921               ])
922       ]
923 )
924
925 AM_CONDITIONAL(ENABLE_DOCS, [test "x$enable_docs" = "xyes"])
926 AM_CONDITIONAL(ENABLE_PDFS, [test "x$enable_pdfs" = "xyes"])
927
928 dnl === I18N ==================================================================
929
930 AM_GNU_GETTEXT_VERSION([0.17])
931 AM_GNU_GETTEXT([external])
932
933 GETTEXT_PACKAGE="clutter-1.0"
934 AC_SUBST(GETTEXT_PACKAGE)
935 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],
936                    ["$GETTEXT_PACKAGE"],
937                    [The prefix for our gettext translation domains.])
938 AS_ALL_LINGUAS
939
940 dnl ===========================================================================
941
942 AC_CONFIG_FILES([
943         Makefile
944
945         README
946
947         build/Makefile
948         build/autotools/Makefile
949         build/mingw/Makefile
950
951         clutter/Makefile
952         clutter/clutter-config.h
953         clutter/clutter-version.h
954         clutter/clutter-$CLUTTER_API_VERSION.pc:clutter/clutter.pc.in
955
956         clutter/cally/cally-$CLUTTER_API_VERSION.pc:clutter/cally/cally.pc.in
957
958         clutter/egl/clutter-cex100.h
959
960         tests/Makefile
961         tests/accessibility/Makefile
962         tests/conform/Makefile
963         tests/conform/test-launcher.sh
964         tests/data/Makefile
965         tests/interactive/Makefile
966         tests/interactive/wrapper.sh
967         tests/micro-bench/Makefile
968         tests/performance/Makefile
969
970         doc/Makefile
971         doc/reference/Makefile
972         doc/reference/clutter/Makefile
973         doc/reference/clutter/clutter-docs.xml
974         doc/reference/cally/Makefile
975         doc/reference/cally/cally-docs.xml
976         doc/common/Makefile
977         doc/cookbook/Makefile
978         doc/cookbook/clutter-cookbook.xml
979         doc/cookbook/examples/Makefile
980
981         po/Makefile.in
982 ])
983
984 AC_OUTPUT
985
986 dnl === Summary ===============================================================
987
988 echo ""
989 echo "Clutter - $VERSION (${CLUTTER_RELEASE_STATUS})"
990
991 # Global flags
992 echo ""
993 echo " • Global:"
994 echo "        Prefix: ${prefix}"
995 echo "        Libdir: ${libdir}"
996 echo "        Sysconfdir: ${sysconfdir}"
997
998 # Compiler/Debug related flags
999 echo ""
1000 echo " • Compiler options:"
1001 echo "        Clutter debug level: ${enable_debug}"
1002 echo "        Compiler flags: ${CFLAGS} ${MAINTAINER_CFLAGS}"
1003 echo "        Profiling enabled: ${enable_profile}"
1004 echo "        Enable coverage tests: ${enable_gcov}"
1005 echo "        Enable deprecated symbols: ${enable_deprecated}"
1006
1007 # Documentation
1008 echo ""
1009 echo " • Documentation:"
1010 echo "        Build API Reference: ${enable_gtk_doc}"
1011 echo "        Build Additional Documentation: ${enable_docs} (Generate PDF: ${enable_pdfs})"
1012
1013 # Miscellaneous
1014 echo ""
1015 echo " • Extra:"
1016 echo "        Build introspection data: ${enable_introspection}"
1017 echo "        Build conformance test suite: ${enable_conformance}"
1018 echo "        Build X11-specific tests: ${x11_tests}"
1019
1020 # Clutter backend related flags
1021 echo ""
1022 echo " • Clutter Backends:"
1023
1024 if test "x$experimental_backend" = "xno"; then
1025 echo "        Windowing systems: ${CLUTTER_BACKENDS}"
1026 else
1027 echo "        Windowing systems: ${CLUTTER_BACKENDS} (WARNING: Experimental backends enabled)"
1028 fi
1029
1030 if test "x$SUPPORT_X11" = "x1"; then
1031 echo ""
1032 echo "        Enable XComposite: ${have_xcomposite}"
1033 echo "        Enable XInput: ${have_xinput}"
1034 echo "        Enable Xge: ${have_xge}"
1035 echo "        Enable XI2: ${have_xinput2}"
1036 echo "        Enable XKB: ${have_xkb}"
1037 fi
1038
1039 if test "x$SUPPORT_EGL" = "x1"; then
1040 echo ""
1041 echo "        Enable TSLib: ${have_tslib}"
1042 echo "        Enable evdev: ${have_evdev}"
1043 echo "        Enable GDL: ${have_gdl}"
1044 fi
1045
1046 echo ""
1047
1048 # General warning about experimental features
1049 if test "x$experimental_backend" = "xyes"; then
1050 echo ""
1051 echo "☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠"
1052 echo " *WARNING*"
1053 echo ""
1054 echo "  The stability of your build might be affected by one or more"
1055 echo "  experimental backends or experimental and unsupported features"
1056 echo "☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠"
1057 echo ""
1058 fi