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