Post-release bump to 0.9.7
[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, (eg. from CVS)
3 # An even micro number indicates a released version.
4 m4_define([clutter_major_version], [0])
5 m4_define([clutter_minor_version], [9])
6 m4_define([clutter_micro_version], [7])
7
8 m4_define([clutter_version], [clutter_major_version.clutter_minor_version.clutter_micro_version])
9 m4_define([clutter_api_version], [clutter_major_version.clutter_minor_version])
10
11 # increase the interface age by 2 for each release; if the API changes,
12 # set to 0. interface_age and binary_age are used to create the soname
13 # of the shared object:
14 #
15 #  (<minor> * 100 + <micro>) - <interface_age>
16 #
17 # this allows using the same soname for different micro-releases in case
18 # no API was added or deprecated. for instance:
19 #
20 #   clutter 1.2.0 -> 100 * 2 + 0 = 200, interface age = 0 -> 200
21 #   clutter 1.2.2 -> 100 * 2 + 2 = 202, interface age = 2 -> 200
22 #   clutter 1.2.4 -> 100 * 2 + 4 = 204, interface age = 4 -> 200
23 #   [ API addition, deprecation ]
24 #   clutter 1.2.6 -> 100 * 2 + 6 = 206, interface age = 0 -> 206
25 #   ...
26 #
27 m4_define([clutter_interface_age], [0])
28 m4_define([clutter_binary_age], [m4_eval(100 * clutter_minor_version + clutter_micro_version)])
29
30 AC_PREREQ([2.59])
31
32 AC_INIT([clutter],
33         [clutter_version],
34         [http://bugzilla.o-hand.com/enter_bug.cgi?product=Clutter])
35 AC_CONFIG_MACRO_DIR([build/autotools])
36 AC_CONFIG_SRCDIR([clutter/clutter.h])
37 AM_CONFIG_HEADER([config.h])
38
39 AM_INIT_AUTOMAKE([1.9])
40
41 CLUTTER_MAJOR_VERSION=clutter_major_version
42 CLUTTER_MINOR_VERSION=clutter_minor_version
43 CLUTTER_MICRO_VERSION=clutter_micro_version
44 CLUTTER_VERSION=clutter_version
45 CLUTTER_API_VERSION=clutter_api_version
46 CLUTTER_MAJORMINOR=clutter_major_version.clutter_minor_version
47 AC_SUBST(CLUTTER_MAJOR_VERSION)
48 AC_SUBST(CLUTTER_MINOR_VERSION)
49 AC_SUBST(CLUTTER_MICRO_VERSION)
50 AC_SUBST(CLUTTER_VERSION)
51 AC_SUBST(CLUTTER_API_VERSION)
52 AC_SUBST(CLUTTER_MAJORMINOR)
53
54 m4_define([lt_current],  [m4_eval(clutter_binary_age - clutter_interface_age)])
55 m4_define([lt_revision], [clutter_interface_age])
56 m4_define([lt_age],      [m4_eval(clutter_binary_age - clutter_interface_age)])
57 CLUTTER_LT_CURRENT=lt_current
58 CLUTTER_LT_REV=lt_revision
59 CLUTTER_LT_AGE=lt_age
60 CLUTTER_LT_VERSION="$CLUTTER_LT_CURRENT:$CLUTTER_LT_REV:$CLUTTER_LT_AGE"
61 CLUTTER_LT_LDFLAGS="-version-info $CLUTTER_LT_VERSION"
62
63 AC_SUBST(CLUTTER_LT_VERSION)
64 AC_SUBST(CLUTTER_LT_LDFLAGS)
65
66 dnl ========================================================================
67
68 # Checks for programs.
69 AM_PROG_CC_C_O
70 AC_DISABLE_STATIC
71 AC_PROG_LIBTOOL
72 DOLT
73
74 # Checks for header files.
75 AC_HEADER_STDC
76 AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h])
77
78 # Checks for typedefs, structures, and compiler characteristics.
79 AC_C_CONST
80
81 # Checks for library functions.
82 AC_FUNC_MALLOC
83 AC_FUNC_MMAP
84 AC_CHECK_FUNCS([memset memcpy strcasecmp])
85
86 AC_PATH_PROG([GLIB_MKENUMS], [glib-mkenums])
87 AC_PATH_PROG([GLIB_GENMARSHAL], [glib-genmarshal])
88
89 PKG_PROG_PKG_CONFIG
90
91 dnl ========================================================================
92
93 # defaults
94 backendextra=
95 backendextralib=
96 clutterbackend=glx
97 clutter_gl_header=""
98 glesversion=1.1
99 use_gles2_wrapper=no
100 experimental_backend=no
101 experimental_image=no
102
103 AC_ARG_WITH([flavour],
104             [AC_HELP_STRING([--with-flavour=@<:@glx/eglx/eglnative/sdl/osx/win32/fruity@:>@],
105                             [Select the Clutter backend])],
106             [clutterbackend=$with_flavour])
107
108 AC_ARG_WITH([gles],
109             [AC_HELP_STRING([--with-gles=@<:@1.1/2.0@:>@],
110                             [Select Clutter GLES version (for EGL backends)])],
111             [glesversion=$with_gles])
112
113 # the fruity backend requires a different handling for GLES
114 AS_IF([test "x$clutterbackend" = "xfruity"], [glesversion=fruity])
115
116 # backend specific pkg-config files
117 BACKEND_PC_FILES=""
118
119 # This is only used to decide whether to build tests/tools/disable-npots.la
120 AC_CHECK_LIB(dl, [dlopen], [HAVE_LIBDL=yes], [HAVE_LIBDL=no])
121 AM_CONDITIONAL(HAVE_LIBDL, [test "x$HAVE_LIBDL" = "xyes"])
122
123 dnl === COGL GLES backend =====================================================
124
125 AS_IF([test "x$clutterbackend" = "xeglnative" ||
126        test "x$clutterbackend" = "xeglx"      ||
127        test "x$clutterbackend" = "xfruity"],
128
129       [
130         AS_CASE([$glesversion],
131
132                 [1*],
133                 [
134                   clutter_gl_header="GLES/gl.h"
135
136                   CLUTTER_COGL="gles"
137                   AC_DEFINE([HAVE_COGL_GLES], 1, [Have GL/ES for rendering])
138                   AC_SUBST(COGL_GLES_VERSION, [COGL_HAS_GLES1])
139
140                   AC_CHECK_HEADERS([GLES/egl.h],
141                                    [],
142                                    [AC_MSG_ERROR([Unable to locate required GLES headers])])
143
144
145                   # check for upper/lower case libgles_em
146                   # The powervr sdk uses lower case.
147                   AC_CHECK_LIB(GLES_CM, [eglInitialize],
148                                [HAVE_LIBGLES=yes],
149                                [HAVE_LIBGLES=no])
150
151                   AS_IF([test "x$HAVE_LIBGLES" = "xyes"],
152                         [GLES_LIBS="-lGLES_CM"],
153                         [
154                           AC_CHECK_LIB(GLESv1_CM, [eglInitialize],
155                                        [HAVE_LIBGLES=yes],
156                                        [HAVE_LIBGLES=no])
157
158                           AS_IF([test "x$HAVE_LIBGLES" = "xyes"],
159                                 [GLES_LIBS="-lGLESv1_CM"],
160                                 [
161                                   AC_CHECK_LIB(gles_cm, [eglInitialize],
162                                                [HAVE_LIBGLES=yes],
163                                                [HAVE_LIBGLES=no])
164
165                                   AS_IF([test "x$HAVE_LIBGLES" = "xyes"],
166                                         [GLES_LIBS="-lgles_cm"],
167                                         [
168                                           AC_MSG_ERROR([GLES library not found and egl backend requested.])
169                                         ]
170                                   )
171                                 ]
172                           )
173                         ]
174                   )
175                 ],
176
177                 [2*],
178                 [
179                   clutter_gl_header="GLES2/gl2.h"
180                   use_gles2_wrapper=yes
181                   CLUTTER_COGL="gles"
182                   AC_DEFINE([HAVE_COGL_GLES2], 1, [Have GL/ES for rendering])
183                   AC_SUBST(COGL_GLES_VERSION, [COGL_HAS_GLES2])
184
185                   AC_CHECK_HEADERS([EGL/egl.h],
186                                    [],
187                                    [AC_MSG_ERROR([Unable to locate required GLES headers])])
188
189                   GLES_LIBS="-lGLESv2 -lEGL"
190                 ],
191
192                 [fruity],
193                 [
194                   clutter_gl_header="GLES/gl.h"
195                   CLUTTER_COGL="gles"
196                   AC_DEFINE([HAVE_COGL_GLES], 1, [Have GL/ES for rendering])
197                   AC_SUBST(COGL_GLES_VERSION, [COGL_HAS_GLES1])
198
199                   AC_CHECK_HEADERS([GLES/egl.h],
200                                    [],
201                                    [AC_MSG_ERROR([Unable to locate required GLES headers])])
202                 ],
203
204                 [AC_MSG_ERROR([Unknown argument for --with-gles])]
205         )
206       ]
207 )
208
209 AM_CONDITIONAL(USE_GLES2_WRAPPER, [test "x$use_gles2_wrapper" = "xyes"])
210
211 dnl === Clutter windowing system backend ======================================
212
213 AS_CASE([$clutterbackend],
214
215         [sdl],
216         [
217           experimental_backend="yes"
218           clutter_gl_header="GL/gl.h"
219           CLUTTER_FLAVOUR="sdl"
220           CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_SDL"
221           AC_DEFINE([HAVE_CLUTTER_SDL], [1], [Have the SDL backend])
222
223           CLUTTER_COGL="gl"
224           AC_DEFINE([HAVE_COGL_GL], [1], [Have GL for rendering])
225
226           AC_PATH_PROG(SDL_CONFIG, [sdl-config])
227           AS_IF([test "x$SDL_CONFIG" = "x"],
228                 [AC_MSG_ERROR([No sdl-config binary found in path])],
229                 [
230                   SDL_CFLAGS=`$SDL_CONFIG --cflags`
231                   SDL_LIBS=`$SDL_CONFIG --libs`
232
233                   AS_CASE([$host],
234
235                           [*mingw32*],
236                           [
237                             # Use -lopengl32 under Windows instead of -lGL
238                             SDL_LIBS="$SDL_LIBS -lopengl32"
239                             CLUTTER_LT_LDFLAGS="$CLUTTER_LT_LDFLAGS -no-undefined"
240                           ],
241
242                           [
243                             AC_CHECK_LIB(GL, [glEnable], [HAVE_LIBGL=yes], [HAVE_LIBGL=no])
244                             AS_IF([test "x$HAVE_LIBGL" = "xno"], [AC_MSG_ERROR([libGL not found])])
245                             SDL_LIBS="$SDL_LIBS -lGL"
246                           ]
247                   )
248                 ]
249           )
250         ],
251
252         [glx],
253         [
254           clutter_gl_header="GL/gl.h"
255           CLUTTER_FLAVOUR="glx"
256           CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_GLX"
257           AC_DEFINE([HAVE_CLUTTER_GLX], [1], [Have the GLX backend])
258
259           CLUTTER_COGL="gl"
260           AC_DEFINE([HAVE_COGL_GL], [1], [Have GL for rendering])
261
262           AC_CHECK_HEADERS([GL/glx.h],
263                            [],
264                            [AC_MSG_ERROR([Unable to locate required GLX headers])])
265
266           AC_CHECK_LIB(GL, [glXCreateContext],
267                        [HAVE_LIBGLX=yes],
268                        [AC_MSG_ERROR([Required GLX library not found])])
269
270           GLX_LIBS="$X11_LIBS -lGL"
271           GLX_CFLAGS="$X11_CFLAGS"
272
273           backendextra=x11
274           backendextralib="x11/libclutter-x11.la"
275
276           # Mesa 7.3 added a GL pkg-config file, finally
277           PKG_CHECK_EXISTS([gl], [BACKEND_PC_FILES="$BACKEND_PC_FILES gl"], [])
278         ],
279
280         [eglx],
281         [
282           # the GL header is defined in the COGL checks above
283           CLUTTER_FLAVOUR="eglx"
284           CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_EGL"
285           AC_DEFINE([HAVE_CLUTTER_EGL], [1], [Have the EGL backend])
286
287           EGL_LIBS="$GLES_LIBS $X11_LIBS"
288           EGL_CFLAGS="$GLES_CFLAGS $X11_CFLAGS"
289
290           backendextra=x11
291           backendextralib="x11/libclutter-x11.la"
292
293           # Mesa 7.3 added a GL pkg-config file, finally
294           PKG_CHECK_EXISTS([gl], [BACKEND_PC_FILES="$BACKEND_PC_FILES gl"], [])
295         ],
296
297         [eglnative],
298         [
299           # the GL header is defined in the COGL checks above
300           CLUTTER_FLAVOUR="eglnative"
301           CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_EGLNATIVE"
302           AC_DEFINE([HAVE_CLUTTER_EGL], [1], [Have the EGL backend])
303
304           PKG_CHECK_MODULES(TSLIB, [tslib-1.0], [have_tslib=yes], [have_tslib=no])
305           AS_IF([test "x$have_tslib" = "xyes"],
306                 [AC_DEFINE([HAVE_TSLIB], [1], [Have tslib for touchscreen handling])]
307           )
308
309           EGL_LIBS="$GLES_LIBS $TSLIB_LIBS"
310           EGL_CFLAGS="$TSLIB_CFLAGS"
311         ],
312
313         [fruity],
314         [
315           experimental_backend="yes"
316           # the GL header is defined in the COGL checks above
317           CLUTTER_FLAVOUR="fruity"
318           CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_FRUITY"
319           AC_DEFINE([HAVE_CLUTTER_FRUITY], [1], [Have the Fruity backend])
320
321           EGL_LIBS="-ObjC -framework Foundation  -framework CoreFoundation  -framework CoreGraphics  -framework CoreSurface  -framework GraphicsServices  -framework OpenGLES  -framework LayerKit  -framework UIKit"
322           EGL_CFLAGS=""
323         ],
324
325         [osx],
326         [
327           experimental_backend="yes"
328           clutter_gl_header="OpenGL/gl.h"
329           CLUTTER_FLAVOUR="osx"
330           CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_OSX"
331           AC_DEFINE([HAVE_CLUTTER_OSX], [1], [Have the OSX backend])
332
333           CLUTTER_COGL="gl"
334           AC_DEFINE([HAVE_COGL_GL], [1], [Have GL for rendering])
335
336           OSX_LIBS="-framework Cocoa -framework OpenGL"
337         ],
338
339         [win32],
340         [
341           clutter_gl_header="GL/gl.h"
342           CLUTTER_FLAVOUR="win32"
343           CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_WIN32"
344           AC_DEFINE([HAVE_CLUTTER_WIN32], [1], [Have the Win32 backend])
345
346           CLUTTER_COGL="gl"
347           AC_DEFINE([HAVE_COGL_GL], [1], [Have GL for rendering])
348
349           WIN32_CFLAGS="-D_WIN32_WINNT=0x0500"
350           WIN32_LIBS="-lopengl32 -lgdi32 -lwinmm"
351           CLUTTER_LT_LDFLAGS="$CLUTTER_LT_LDFLAGS -no-undefined"
352         ],
353
354         [AC_MSG_ERROR([Invalid backend for Clutter: use glx, sdl, osx, win32, eglx, eglnative or fruity])]
355 )
356
357 # at this point we must have a GL header to check
358 AS_IF([test "x$clutter_gl_header" = "x"], [AC_MSG_ERROR([Internal error: no GL header set])])
359 AC_CHECK_HEADERS([$clutter_gl_header],
360                  [],
361                  [AC_MSG_ERROR([Unable to locate required GLES headers])])
362
363 CLUTTER_GL_HEADER=$clutter_gl_header
364
365 AC_SUBST([clutterbackend])
366 AC_SUBST([imagebackend])
367 AC_SUBST([backendextra])
368 AC_SUBST([backendextralib])
369 AC_SUBST(CLUTTER_FLAVOUR)
370 AC_SUBST(CLUTTER_COGL)
371 AC_SUBST(CLUTTER_GL_HEADER)
372 AC_SUBST(CLUTTER_STAGE_TYPE)
373
374 clutterbackendlib=libclutter-$clutterbackend-$CLUTTER_API_VERSION.la
375 AC_SUBST([clutterbackendlib])
376
377 dnl === Image loading backend =================================================
378 IMAGE_PC_FILES=""
379
380 # Peek which flavour the user wants so that we can couple the osx flavour with
381 # quartz imageloader.
382 AS_IF([test "x$with_flavour" = "xosx"], [imagebackend=quartz], [imagebackend=gdk-pixbuf])
383
384 AC_ARG_WITH([imagebackend],
385             [AC_HELP_STRING([--with-imagebackend=@<:@gdk-pixbuf/quartz/internal@:>@],
386                             [Select COGL image loading backend])],
387             [imagebackend=$with_imagebackend])
388
389 AS_CASE([$imagebackend],
390
391         [quartz],
392         [
393           experimental_image=yes
394           AC_DEFINE([USE_QUARTZ], 1, [Use Core Graphics (Quartz) for loading image data])
395         ],
396
397         [gdk-pixbuf],
398         [
399           AC_DEFINE([USE_GDKPIXBUF], 1, [Use GdkPixbuf for loading image data])
400           IMAGE_PC_FILES="gdk-pixbuf-2.0"
401         ],
402
403         [internal],
404         [
405           experimental_image=yes
406           AC_DEFINE([USE_INTERNAL], 1, [Use internal image decoding for loading image data])
407         ],
408
409         [AC_MSG_ERROR([Unknown argument for --with-imagebackend])]
410 )
411
412 dnl === X11 checks, only for X11-based backends ===============================
413 X11_PC_FILES=""
414 x11_tests=no
415
416 AS_IF([test "x$clutterbackend" = "xglx" || test "x$clutterbackend" = "xeglx"],
417       [
418         # base X11 includes and libraries
419         AC_MSG_CHECKING([for X11])
420
421         # start with pkg-config
422         PKG_CHECK_EXISTS([x11], [have_x11=yes], [have_x11=no])
423         AS_IF([test "x$have_x11" = "xyes"],
424               [
425                 X11_PC_FILES="x11"
426                 AC_MSG_RESULT([found])
427               ],
428               [
429                 # no pkg-config, let's go old school
430                 AC_PATH_X
431
432                 AS_IF([test "x$no_x" = "xyes"],
433                       [AC_MSG_ERROR([No X11 Libraries found])],
434                       [
435                         AS_IF([test "x$x_includes" != "xNONE" && test -n "$x_includes"],
436                               [X11_CFLAGS=-I`echo $x_includes | sed -e "s/:/ -I/g"`])
437
438                         AS_IF([test "x$x_libraries" != "xNONE" && test -n "$x_libraries"],
439                               [X11_LIBS=-L`echo $x_libraries | sed -e "s/:/ -L/g"`])
440
441                         AC_MSG_RESULT([found])
442                       ]
443                 )
444               ]
445         )
446
447         # XEXT (required)
448         AC_MSG_CHECKING([for XEXT extension])
449         PKG_CHECK_EXISTS([xext], [have_xext=yes], [have_xext=no])
450         AS_IF([test "x$have_xext" = "xyes"],
451               [
452                 AC_DEFINE(HAVE_XEXT, [1], [Define to 1 if we have the XEXT X extension])
453
454                 X11_LIBS="$X11_LIBS -lXext"
455                 X11_PC_FILES="$X11_PC_FILES xext"
456
457                 AC_MSG_RESULT([found])
458               ],
459               [AC_MSG_ERROR([Not found])]
460         )
461
462         # XFIXES (required)
463         AC_MSG_CHECKING([for XFIXES extension >= 3])
464         PKG_CHECK_EXISTS([xfixes >= 3], [have_xfixes=yes], [have_xfixes=no])
465         AS_IF([test "x$have_xfixes" = "xyes"],
466               [
467                 AC_DEFINE(HAVE_XFIXES, [1], [Define to 1 if we have the XFIXES X extension])
468
469                 X11_LIBS="$X11_LIBS -lXfixes"
470                 X11_PC_FILES="$X11_PC_FILES xfixes"
471
472                 AC_MSG_RESULT([found])
473               ],
474               [AC_MSG_ERROR([Not found])]
475         )
476
477         # XDAMAGE (required)
478         AC_MSG_CHECKING([for XDAMAGE extension])
479         PKG_CHECK_EXISTS([xdamage], [have_xdamage=yes], [have_xdamage=no])
480         AS_IF([test "x$have_xdamage" = "xyes"],
481               [
482                 AC_DEFINE(HAVE_XDAMAGE, [1], [Define to 1 if we have the XDAMAGE X extension])
483
484                 X11_LIBS="$X11_LIBS -lXdamage"
485                 X11_PC_FILES="$X11_PC_FILES xdamage"
486
487                 AC_MSG_RESULT([found])
488               ],
489               [AC_MSG_ERROR([not found])]
490         )
491
492         # XCOMPOSITE (optional)
493         AC_MSG_CHECKING([for XCOMPOSITE extension >= 0.4])
494         PKG_CHECK_EXISTS([xcomposite >= 0.4], [have_xcomposite=yes], [have_xcomposite=no])
495         AS_IF([test "x$have_xcomposite" = "xyes"],
496               [
497                 AC_DEFINE(HAVE_XCOMPOSITE, [1], [Define to 1 if we have the XCOMPOSITE X extension])
498
499                 X11_LIBS="$X11_LIBS -lXcomposite"
500                 X11_PC_FILES="$X11_PC_FILES xcomposite"
501
502                 AC_MSG_RESULT([found])
503               ],
504               [AC_MSG_RESULT([not found])]
505         )
506
507         # XINPUT (optional) - FIXME this is wrong
508         xinput=no
509         AC_ARG_ENABLE([xinput],
510                       [AS_HELP_STRING([--enable-xinput], [Use the XINPUT X extension])],
511                       [
512                         AS_IF([test "x$enableval" = "xyes"],
513                               [PKG_CHECK_MODULES(XINPUT, [xi], [xinput=yes], [xinput=no])]
514                         )
515                       ],
516                       [xinput=no])
517
518         AS_CASE([$xinput],
519
520                 [yes],
521                 [
522                   AC_DEFINE(HAVE_XINPUT, 1, Use the XINPUT X extension)
523
524                   X11_LIBS="$X11_LIBS -lXi"
525                   X11_PC_FILES="$X11_PC_FILES xi"
526                 ],
527
528                 [no],
529                 [],
530         )
531
532         # X11-specific tests are enabled conditionally
533         AS_IF([test "x$have_xcomposite" = "xyes"], [x11_tests=yes], [x11_tests=no])
534
535         BACKEND_PC_FILES="$BACKEND_PC_FILES $X11_PC_FILES"
536       ]
537 )
538
539 AM_CONDITIONAL(X11_TESTS, [test "x$x11_tests" = "xyes"])
540
541 dnl === JSON parser check =====================================================
542
543 # allow building clutter with an external dependency on json-glib
544 # using the --with-json=check argument, but keep the default to
545 # the internal version
546 AC_ARG_WITH([json],
547             AC_HELP_STRING([--with-json=@<:@internal/check@:>@],
548                            [Select the JSON-GLib copy to use @<:@default=internal@:>@]),
549             [],
550             [with_json=internal])
551
552 AS_CASE([$with_json],
553
554         [internal],
555         [
556           JSON_PREFIX=json
557           have_json=no
558         ],
559
560         [check],
561         [
562           AC_MSG_CHECKING([for installed JSON-GLib])
563           PKG_CHECK_EXISTS([json-glib-1.0], [have_json=yes], [have_json=no])
564           AS_IF([test "x$have_json" = "xyes"],
565                 [
566                   JSON_PREFIX=json-glib
567                   JSON_GLIB_PC=json-glib-1.0
568
569                   AC_DEFINE(HAVE_JSON_GLIB, 1, [Have the JSON-GLib library installed])
570
571                   AC_MSG_RESULT([found])
572                 ],
573                 [
574                   JSON_PREFIX=json
575                   AC_MSG_RESULT([not found, using internal copy])
576                 ]
577           )
578         ],
579
580         [AC_MSG_ERROR([Unknown argument for --with-json])]
581 )
582
583 AC_SUBST(JSON_PREFIX)
584 AM_CONDITIONAL(LOCAL_JSON_GLIB, test "x$have_json" = "xno")
585
586 dnl === Dependencies, compiler flags and linker libraries =====================
587 CLUTTER_REQUIRES="cairo >= 1.4 pangocairo >= 1.20 gobject-2.0 >= 2.16 gthread-2.0 gmodule-no-export-2.0 $IMAGE_PC_FILES $BACKEND_PC_FILES $JSON_GLIB_PC"
588
589 PKG_CHECK_MODULES(CLUTTER_DEPS, [$CLUTTER_REQUIRES])
590
591 AC_SUBST(CLUTTER_REQUIRES)
592
593 CLUTTER_CFLAGS="$SDL_CFLAGS $EGL_CFLAGS $GLX_CFLAGS $OSX_CFLAGS $WIN32_CFLAGS $CLUTTER_DEPS_CFLAGS"
594 CLUTTER_LIBS="$SDL_LIBS $EGL_LIBS $X11_LIBS $GLX_LIBS $OSX_LIBS $WIN32_LIBS $CLUTTER_DEPS_LIBS"
595
596 AC_SUBST(CLUTTER_CFLAGS)
597 AC_SUBST(CLUTTER_LIBS)
598
599 dnl === Enable debug level ====================================================
600
601 m4_define([debug_default], [m4_if(m4_eval(clutter_minor_version % 2), [1], [yes], [minimum])])
602 AC_ARG_ENABLE([debug],
603               [AC_HELP_STRING([--enable-debug=@<:@no/minimum/yes@:>@],
604                               [Control Clutter debugging level @<:@default=debug_default@:>@])],
605               [],
606               [enable_debug=debug_default])
607
608 AS_CASE([$enable_debug],
609
610         [yes],
611         [
612           test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
613           CLUTTER_DEBUG_CFLAGS="-DCLUTTER_ENABLE_DEBUG"
614         ],
615
616         [minimum],
617         [CLUTTER_DEBUG_CFLAGS="-DCLUTTER_ENABLE_DEBUG -DG_DISABLE_CAST_CHECKS"],
618
619         [no],
620         [CLUTTER_DEBUG_CFLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"],
621
622         [AC_MSG_ERROR([Unknown argument for --enable-debug])]
623 )
624
625 AC_SUBST(CLUTTER_DEBUG_CFLAGS)
626
627 m4_define([cogl_debug_default], [m4_if(m4_eval(clutter_minor_version % 2), [1], [minimum], [no])])
628 AC_ARG_ENABLE([cogl-debug],
629               [AC_HELP_STRING([--enable-cogl-debug=@<:@no/yes@:>@],
630                               [Control COGL debugging level @<:@default=cogl_debug_default@:>@])],
631               [],
632               [enable_cogl_debug=cogl_debug_default])
633
634 AS_CASE([$enable_cogl_debug],
635
636         [yes],
637         [COGL_DEBUG_CFLAGS="-DCOGL_GL_DEBUG -DCOGL_HANDLE_DEBUG -DCOGL_ENABLE_DEBUG"],
638
639         [minimum],
640         [COGL_DEBUG_CFLAGS="-DCOGL_ENABLE_DEBUG"],
641
642         [no],
643         [COGL_DEBUG_CFLAGS=""],
644
645         [AC_MSG_ERROR([Invalid value for --enable-cogl-debug])]
646 )
647
648 AC_SUBST(COGL_DEBUG_CFLAGS)
649
650 dnl === Enable strict compiler flags ==========================================
651
652 # use strict compiler flags only on development releases
653 m4_define([maintainer_flags_default], [m4_if(m4_eval(clutter_minor_version % 2), [1], [yes], [no])])
654 AC_ARG_ENABLE([maintainer-flags],
655               [AC_HELP_STRING([--enable-maintainer-flags=@<:@no/yes@:>@],
656                               [Use strict compiler flags @<:@default=maintainer_flags_default@:>@])],
657               [],
658               [enable_maintainer_flags=maintainer_flags_default])
659
660 AS_IF([test "x$enable_maintainer_flags" = "xyes" && test "x$GCC" = "xyes"],
661       [
662         AS_COMPILER_FLAGS([MAINTAINER_CFLAGS],
663                           ["-Wall -Wshadow -Wcast-align -Wno-uninitialized
664                             -Wno-strict-aliasing -Wempty-body -Wformat-security
665                             -Winit-self"])
666       ]
667 )
668
669 AC_SUBST(MAINTAINER_CFLAGS)
670
671 dnl === GObject-Introspection check ===========================================
672
673 GOBJECT_INTROSPECTION_CHECK([0.6.3])
674
675 dnl === GTK Doc check =========================================================
676
677 GTK_DOC_CHECK([1.11])
678
679 # we don't want to build the documentation from a SVN checkout unless we
680 # explicitly tell configure to do so; this allows avoiding to recurse into
681 # the documentation directory when building Clutter inside Poky for a
682 # target device that doesn't have gtk-doc installed. for reference
683 # see: http://bugzilla.openedhand.com/show_bug.cgi?id=1047
684 #
685 # we use autogen.sh as it exists only inside the SVN checkouts, and it
686 # is not packaged into tarballs.
687 AM_CONDITIONAL([BUILD_GTK_DOC], [test "x$enable_gtk_doc" = "xyes" || test ! -f "autogen.sh"])
688
689 # prefixes for fixing gtk-doc references
690 GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`"
691 PANGO_PREFIX="`$PKG_CONFIG --variable=prefix pango`"
692 AC_SUBST(GLIB_PREFIX)
693 AC_SUBST(PANGO_PREFIX)
694
695 dnl === Manual ================================================================
696
697 AC_ARG_ENABLE([manual],
698               [AC_HELP_STRING([--enable-manual=@<:@no/yes@:>@],
699                               [Build application developers manual. Requires jw and xmlto.])],
700               [enable_manual=$enableval],
701               [enable_manual=no])
702
703 AS_IF([test "x$enable_manual" = "xyes"],
704       [
705         AC_PATH_PROG(JW, [jw], [no])
706         AS_IF([test "x$JW" = "xno"],
707               [AC_MSG_ERROR(['jw' program needed by the manual not found in path])]
708         )
709
710         AC_PATH_PROG(XMLTO, [xmlto], [no])
711         AS_IF([test "x$XMLTO" = "xno"],
712               [AC_MSG_ERROR(['xmlto' program needed by the manual not found in path])]
713         )
714       ]
715 )
716
717 AM_CONDITIONAL(ENABLE_MANUAL, [test "x$enable_manual" = "xyes"])
718
719 dnl === I18N ==================================================================
720
721 GETTEXT_PACKAGE="clutter-$CLUTTER_API_VERSION"
722 AC_SUBST(GETTEXT_PACKAGE)
723 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,
724                    "$GETTEXT_PACKAGE",
725                    [The prefix for our gettext translation domains.])
726
727 ALL_LINGUAS="`grep -v '^#' "$srcdir/po/LINGUAS" | tr '\n' ' '`"
728 AM_GLIB_GNU_GETTEXT
729 GLIB_DEFINE_LOCALEDIR(LOCALEDIR)
730
731 dnl ===========================================================================
732
733 SHAVE_INIT([build/autotools], [enable])
734
735 AC_CONFIG_FILES([
736         Makefile
737         build/Makefile
738         build/autotools/Makefile
739         build/autotools/shave
740         build/autotools/shave-libtool
741         clutter/Makefile
742         clutter/clutter-version.h
743         clutter/clutter-json.h
744         clutter/x11/Makefile
745         clutter/x11/clutter-x11.pc
746         clutter/glx/Makefile
747         clutter/eglx/Makefile
748         clutter/eglnative/Makefile
749         clutter/fruity/Makefile
750         clutter/osx/Makefile
751         clutter/win32/Makefile
752         clutter/win32/clutter-win32.pc
753         clutter/sdl/Makefile
754         clutter/cogl/Makefile
755         clutter/cogl/common/Makefile
756         clutter/cogl/cogl.h
757         clutter/cogl/cogl-defines-gl.h:clutter/cogl/gl/cogl-defines.h.in
758         clutter/cogl/cogl-defines-gles.h:clutter/cogl/gles/cogl-defines.h.in
759         clutter/cogl/cogl.pc
760         clutter/cogl/gl/Makefile
761         clutter/cogl/gles/Makefile
762         clutter/json/Makefile
763         clutter/pango/Makefile
764         tests/Makefile
765         tests/conform/Makefile
766         tests/data/Makefile
767         tests/interactive/Makefile
768         tests/micro-bench/Makefile
769         tests/tools/Makefile
770         doc/Makefile
771         doc/reference/Makefile
772         doc/reference/clutter/Makefile
773         doc/reference/clutter/clutter-docs.xml
774         doc/reference/cogl/Makefile
775         doc/reference/cogl/cogl-docs.xml
776         doc/manual/clutter-manual.xml
777         doc/manual/Makefile
778         po/Makefile.in
779         clutter.pc
780 ])
781
782 AC_OUTPUT
783
784 dnl === Summary ===============================================================
785
786 echo ""
787 echo "                     Clutter    $VERSION"
788 echo "                   ===================="
789 echo ""
790 echo "                      prefix:   ${prefix}"
791 echo ""
792 echo "                     Flavour:   ${clutterbackend}/${CLUTTER_COGL}"
793 if test "x$clutterbackend" = "xeglx" || test "x$clutterbackend" = "xglx"; then
794   echo "                      XInput:   ${xinput}"
795 fi
796 echo "                  GL headers:   ${CLUTTER_GL_HEADER}"
797 echo "               Image backend:   ${imagebackend}"
798 echo "              Target library:   ${clutterbackendlib}"
799 echo "         Clutter debug level:   ${enable_debug}"
800 echo "            COGL debug level:   ${enable_cogl_debug}"
801 echo "              Compiler flags:   ${CPPFLAGS} ${MAINTAINER_CFLAGS}"
802 echo "     Build API documentation:   ${enable_gtk_doc}"
803 echo "  Build manual documentation:   ${enable_manual}"
804 echo "    Build introspection data:   ${enable_introspection}"
805 echo ""
806
807 # you can add more configuration options or flags that will bring up the
808 # the experimental/unstable warning summary.
809
810 if test "x$experimental_backend" = "xyes"; then
811   experimental_stuff="$experimental_stuff   Clutter backend:  ${clutterbackend}\n"
812 fi
813
814 if test "x$experimental_image" = "xyes"; then
815   experimental_stuff="$experimental_stuff     Image backend:  ${imagebackend}\n"
816 fi
817
818 if test "x$experimental_stuff" != "x"; then
819   echo ""
820   echo "☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠"
821   echo " *WARNING*"
822   echo ""
823   echo "  The stability of your build might be affected by one or more"
824   echo "  experimental backends or experimental and unsupported features:"
825   echo ""
826   echo -e "$experimental_stuff"
827   echo "☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠"
828   echo ""
829 fi