configure.ac 44.5 KB
Newer Older
1
# clutter package version number, (as distinct from shared library version)
2 3 4 5 6 7 8 9 10 11 12
# An odd micro number indicates in-progress development from Git
# An even micro number indicates a released version
#
# Making a point release:
# - increase clutter_micro_version to the next even number
# - increase clutter_interface_age to the next even number
#   UNLESS there was an API addition/deprecation, in which case
#   - set clutter_interface_age to 0
# After the release:
# - increase clutter_micro_version to the next odd number
# - increase clutter_interface_version to the next odd number
Emmanuele Bassi's avatar
Emmanuele Bassi committed
13
m4_define([clutter_major_version], [1])
Emmanuele Bassi's avatar
Emmanuele Bassi committed
14
m4_define([clutter_minor_version], [6])
15
m4_define([clutter_micro_version], [1])
16

17
# increase the interface age by 1 for each release; if the API changes,
18 19 20 21 22 23 24 25
# set to 0. interface_age and binary_age are used to create the soname
# of the shared object:
#
#  (<minor> * 100 + <micro>) - <interface_age>
#
# this allows using the same soname for different micro-releases in case
# no API was added or deprecated. for instance:
#
26 27 28
#   clutter 1.2.0  -> 100 * 2 + 0  = 200, interface age = 0 -> 200
#   clutter 1.2.2  -> 100 * 2 + 2  = 202, interface age = 2 -> 200
#   clutter 1.2.4  -> 100 * 2 + 4  = 204, interface age = 4 -> 200
29
#   [ API addition, deprecation ]
30 31 32
#   clutter 1.2.6  -> 100 * 2 + 6  = 206, interface age = 0 -> 206
#   clutter 1.2.8  -> 100 * 2 + 8  = 208, interface age = 2 -> 206
#   clutter 1.2.10 -> 100 * 2 + 10 = 210, interface age = 4 -> 206
33
#   ...
34
#
35
m4_define([clutter_interface_age], [1])
Emmanuele Bassi's avatar
Emmanuele Bassi committed
36

37
m4_define([clutter_binary_age], [m4_eval(100 * clutter_minor_version + clutter_micro_version)])
38

Emmanuele Bassi's avatar
Emmanuele Bassi committed
39 40 41 42 43 44 45 46 47 48
m4_define([clutter_release_status],
          [m4_if(m4_eval(clutter_micro_version % 2), [1], [git],
                 [m4_if(m4_eval(clutter_minor_version % 2), [1], [snapshot],
                                                                 [release])])])

m4_define([clutter_version], [clutter_major_version.clutter_minor_version.clutter_micro_version])

# change this only when breaking the API
m4_define([clutter_api_version], [1.0])

49
AC_PREREQ([2.63])
50

51
AC_INIT([clutter],
52
        [clutter_version],
53
        [http://bugzilla.clutter-project.org/enter_bug.cgi?product=clutter],
54 55
        [clutter],
        [http://www.clutter-project.org])
56

57
AC_CONFIG_SRCDIR([clutter/clutter.h])
58 59 60
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([build])
AC_CONFIG_MACRO_DIR([build/autotools])
Matthew Allum's avatar
Matthew Allum committed
61

62
AM_INIT_AUTOMAKE([1.11 foreign -Wno-portability no-define no-dist-gzip dist-bzip2])
63 64

AM_SILENT_RULES([yes])
65

66 67 68 69 70 71 72
AC_SUBST([CLUTTER_MAJOR_VERSION],  [clutter_major_version])
AC_SUBST([CLUTTER_MINOR_VERSION],  [clutter_minor_version])
AC_SUBST([CLUTTER_MICRO_VERSION],  [clutter_micro_version])
AC_SUBST([CLUTTER_VERSION],        [clutter_version])
AC_SUBST([CLUTTER_API_VERSION],    [clutter_api_version])
AC_SUBST([CLUTTER_API_VERSION_AM], [$CLUTTER_MAJOR_VERSION\_0])
AC_SUBST([CLUTTER_RELEASE_STATUS], [clutter_release_status])
73

74
m4_define([lt_current],  [m4_eval(100 * clutter_minor_version + clutter_micro_version - clutter_interface_age)])
75
m4_define([lt_revision], [clutter_interface_age])
76
m4_define([lt_age],      [m4_eval(clutter_binary_age - clutter_interface_age)])
77 78 79
CLUTTER_LT_CURRENT=lt_current
CLUTTER_LT_REV=lt_revision
CLUTTER_LT_AGE=lt_age
80 81 82
CLUTTER_LT_VERSION="$CLUTTER_LT_CURRENT:$CLUTTER_LT_REV:$CLUTTER_LT_AGE"
CLUTTER_LT_LDFLAGS="-version-info $CLUTTER_LT_VERSION"

83 84 85 86 87 88 89 90 91 92 93 94
AC_MSG_CHECKING([if building for some Win32 platform])
case "$host" in
  *-*-mingw*|*-*-cygwin*)
    CLUTTER_LT_LDFLAGS="$CLUTTER_LT_LDFLAGS -no-undefined"
    platform_win32=yes
    ;;
  *)
    platform_win32=no
    ;;
esac
AC_MSG_RESULT([$platform_win32])

95 96 97
AC_SUBST(CLUTTER_LT_VERSION)
AC_SUBST(CLUTTER_LT_LDFLAGS)

98 99 100 101
dnl The 'ffs' function is part of C99 so it isn't always
dnl available. Cogl has a fallback if needed.
AC_CHECK_FUNCS([ffs])

102 103
dnl ========================================================================

Matthew Allum's avatar
Matthew Allum committed
104
# Checks for programs.
105
AM_PROG_CC_C_O
106 107 108 109

# require libtool >= 2.2
LT_PREREQ([2.2.6])
LT_INIT([disable-static])
110

Matthew Allum's avatar
Matthew Allum committed
111 112 113 114
# Checks for header files.
AC_HEADER_STDC

# Checks for typedefs, structures, and compiler characteristics.
115 116
AM_PATH_GLIB_2_0([2.26.0],
                 [have_glib=yes], [have_glib=no],
117 118
                 [gobject gthread gmodule-no-export])
AS_IF([test "x$have_glib" = "xno"], AC_MSG_ERROR([glib-2.0 is required]))
119

120
# Check for -Bsymbolic-functions to avoid intra-library PLT jumps
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
AC_ARG_ENABLE([Bsymbolic],
              [AC_HELP_STRING([--disable-Bsymbolic],
                              [Avoid linking with -Bsymbolic])],
              [],
              [
                saved_LDFLAGS="${LDFLAGS}"
                AC_MSG_CHECKING([for -Bsymbolic-functions linker flag])
                LDFLAGS=-Wl,-Bsymbolic-functions
                AC_TRY_LINK([], [int main (void) { return 0; }],
                            [
                              AC_MSG_RESULT([yes])
                              enable_Bsymbolic=yes
                            ],
                            [
                              AC_MSG_RESULT([no])
                              enable_Bsymbolic=no
                            ])
                LDFLAGS="${saved_LDFLAGS}"
              ])

AS_IF([test "x$enable_Bsymbolic" = "xyes"],
      [CLUTTER_LINK_FLAGS=-Wl[,]-Bsymbolic-functions])
143
AC_SUBST(CLUTTER_LINK_FLAGS)
144

145 146
dnl ========================================================================

147
# defaults
148
CLUTTER_FLAVOUR=glx
149 150
FLAVOUR_LIBS=""
FLAVOUR_CFLAGS=""
151 152
CLUTTER_WINSYS_BASE=
CLUTTER_WINSYS_BASE_LIB=
153
CLUTTER_WINSYS=
154
cogl_gl_headers=""
155
glesversion=1.1
156
use_gles2_wrapper=no
157 158
experimental_backend=no
experimental_image=no
159

160
AC_ARG_WITH([flavour],
Kristian Høgsberg's avatar
Kristian Høgsberg committed
161
            [AC_HELP_STRING([--with-flavour=@<:@glx/opengl-egl-xlib/wayland/eglx/eglnative/osx/win32/fruity/cex100@:>@],
162
                            [Select the Clutter window system backend])],
163
            [CLUTTER_FLAVOUR=$with_flavour])
164

165 166 167 168
AC_ARG_WITH([gles],
            [AC_HELP_STRING([--with-gles=@<:@1.1/2.0@:>@],
                            [Select Clutter GLES version (for EGL backends)])],
            [glesversion=$with_gles])
169

170 171
# backend specific pkg-config files
BACKEND_PC_FILES=""
172

173 174
dnl === Clutter windowing system backend ======================================

175
AS_CASE([$CLUTTER_FLAVOUR],
176 177 178

        [glx],
        [
179
          cogl_gl_headers="GL/gl.h"
180
          CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_GLX"
181

182 183 184
          SUPPORT_X11=1
          SUPPORT_XLIB=1
          SUPPORT_GLX=1
185

186
          COGL_DRIVER="gl"
187

188
          CLUTTER_WINSYS=glx
189 190
          CLUTTER_WINSYS_BASE=x11
          CLUTTER_WINSYS_BASE_LIB="x11/libclutter-x11.la"
191
          CLUTTER_SONAME_INFIX=glx
192 193

          # Mesa 7.3 added a GL pkg-config file, finally
194 195 196 197 198
          PKG_CHECK_EXISTS([gl],
                           [BACKEND_PC_FILES="$BACKEND_PC_FILES gl"],
                           # if a pkg-config file isn't found just add -lGL
                           # and hope for the best.
                           [FLAVOUR_LIBS="$FLAVOUR_LIBS -lGL"])
Emmanuele Bassi's avatar
Emmanuele Bassi committed
199 200 201 202 203 204 205 206

          # We might fall back to DRM for sync-to-vblank on GLX
          PKG_CHECK_EXISTS([libdrm],
                           [
                             AC_DEFINE([HAVE_DRM], [1], [Have libdrm support])
                             BACKEND_PC_FILES="$BACKEND_PC_FILES libdrm"
                           ],
                           [])
207 208
        ],

209 210
        [opengl-egl-xlib],
        [
211
          cogl_gl_headers="GL/gl.h"
212
          CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_EGL"
213
          CLUTTER_EGL_BACKEND="generic"
214 215 216 217 218 219 220 221

          SUPPORT_X11=1
          SUPPORT_XLIB=1
          SUPPORT_EGL=1
          SUPPORT_EGL_PLATFORM_POWERVR_X11=1

          COGL_DRIVER="gl"

222
          CLUTTER_WINSYS=egl
223 224 225 226 227 228 229 230 231 232
          CLUTTER_WINSYS_BASE=x11
          CLUTTER_WINSYS_BASE_LIB="x11/libclutter-x11.la"
          # I think this winsys can be API and ABI compatible with the
          # glx flavour so we can also be cheeky and use the same soname
          CLUTTER_SONAME_INFIX=glx

          PKG_CHECK_EXISTS([gl], [BACKEND_PC_FILES="$BACKEND_PC_FILES gl"], [])
          PKG_CHECK_EXISTS([egl], [BACKEND_PC_FILES="$BACKEND_PC_FILES egl"], [])
        ],

Kristian Høgsberg's avatar
Kristian Høgsberg committed
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252
        [wayland],
        [
          experimental_backend="yes"
          cogl_gl_headers="GL/gl.h"
          CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_WAYLAND"

          SUPPORT_WAYLAND=1
          SUPPORT_EGL_PLATFORM_DRM_SURFACELESS=1

          COGL_DRIVER="gl"

          CLUTTER_WINSYS=wayland
          CLUTTER_SONAME_INFIX=wayland

          PKG_CHECK_EXISTS([gl], [BACKEND_PC_FILES="$BACKEND_PC_FILES gl"], [])
          PKG_CHECK_EXISTS([egl], [BACKEND_PC_FILES="$BACKEND_PC_FILES egl"], [])
          PKG_CHECK_EXISTS([wayland-client xkbcommon],
			   [BACKEND_PC_FILES="$BACKEND_PC_FILES wayland-client xkbcommon"], [])
        ],

253 254 255 256
        [eglx],
        [
          # the GL header is defined in the COGL checks above
          CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_EGL"
257
          CLUTTER_EGL_BACKEND="generic"
258

259 260 261 262
          SUPPORT_X11=1
          SUPPORT_XLIB=1
          SUPPORT_EGL=1
          SUPPORT_EGL_PLATFORM_POWERVR_X11=1
263

264
          COGL_DRIVER="gles"
265

266
          CLUTTER_WINSYS=egl
267 268
          CLUTTER_WINSYS_BASE=x11
          CLUTTER_WINSYS_BASE_LIB="x11/libclutter-x11.la"
269
          CLUTTER_SONAME_INFIX=eglx
270 271 272 273 274
        ],

        [eglnative],
        [
          # the GL header is defined in the COGL checks above
275
          CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_EGL"
276
          CLUTTER_EGL_BACKEND="generic"
277 278 279

          SUPPORT_EGL=1
          SUPPORT_EGL_PLATFORM_POWERVR_NULL=1
280 281 282 283 284 285

          PKG_CHECK_MODULES(TSLIB, [tslib-1.0], [have_tslib=yes], [have_tslib=no])
          AS_IF([test "x$have_tslib" = "xyes"],
                [AC_DEFINE([HAVE_TSLIB], [1], [Have tslib for touchscreen handling])]
          )

286 287 288 289 290 291 292 293 294 295 296 297 298
          # evdev
          PKG_CHECK_MODULES(EVDEV, [gudev-1.0 xkbcommon],
                            [have_evdev=yes], [have_evdev=no])
          AS_IF([test "x$have_evdev" = "xyes"],
                [AC_DEFINE([HAVE_EVDEV], 1,
                           [Have evdev support for input handling])]
          )

          # Make sure we don't enable tslib and evdev at the same time, we
          # don't support multiple event backends yet.
          AS_IF([test "x$have_tslib" = "xyes" -a "x$have_evdev" = "xyes"],
                [AC_MSG_ERROR([Can't enable both tslib and evdev events])])

299 300
          COGL_DRIVER="gles"

301 302
          FLAVOUR_LIBS="$FLAVOUR_LIBS $TSLIB_LIBS $EVDEV_LIBS"
          FLAVOUR_CFLAGS="$FLAVOUR_CFLAGS $TSLIB_CFLAGS $EVDEV_CFLAGS"
303

304
          CLUTTER_WINSYS=egl
305
          CLUTTER_SONAME_INFIX=eglnative
306 307
        ],

308 309 310
        [cex100],
        [
          CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_EGL"
311
          CLUTTER_EGL_BACKEND="cex100"
312 313 314 315 316 317 318 319 320 321 322

          SUPPORT_EGL=1
          SUPPORT_EGL_PLATFORM_POWERVR_GDL=1

          COGL_DRIVER="gles"

          # The cex100 is a small specialization of the EGL backend
          CLUTTER_WINSYS=egl
          CLUTTER_SONAME_INFIX=cex100

          found_gdl=no
323 324 325 326 327 328 329 330 331
          AC_CHECK_HEADERS([libgdl.h], [found_gdl=yes])
          AS_IF([test "x$found_gdl" = "xno"],
                [AC_CHECK_HEADERS([CE4100/libgdl.h],
                                  [
                                    FLAVOUR_CFLAGS="-I/usr/include/CE4100"
                                    found_gdl=yes
                                    CLUTTER_CEX100_LIBGDL_PREFIX=CE4100/
                                  ])
                ])
332
          AC_SUBST(CLUTTER_CEX100_LIBGDL_PREFIX)
333

334
          AS_IF([test x"$found_gdl" = "xno"], [AC_MSG_ERROR([libgdl.h not found])])
335

336 337 338 339 340 341 342 343 344 345
          # evdev
          PKG_CHECK_MODULES(EVDEV, [gudev-1.0 xkbcommon],
                            [have_evdev=yes], [have_evdev=no])
          AS_IF([test "x$have_evdev" = "xyes"],
                [AC_DEFINE([HAVE_EVDEV], 1,
                           [Have evdev support for input handling])]
          )

          FLAVOUR_CFLAGS="$FLAVOUR_CFLAGS $EVDEV_CFLAGS"
          FLAVOUR_LIBS="$FLAVOUR_LIBS -lgdl $EVDEV_LIBS"
346 347
        ],

348 349
        [fruity],
        [
350
          experimental_backend="yes"
351 352 353
          # the GL header is defined in the COGL checks above
          CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_FRUITY"
          AC_DEFINE([HAVE_CLUTTER_FRUITY], [1], [Have the Fruity backend])
354 355
          AC_DEFINE([COGL_HAS_EGL_PLATFORM_FRUITY_SUPPORT], [1],
                     [Cogl supports OpenGLES using the EGL API with Fruity platform typedefs])
356

357
          COGL_DRIVER="gles"
358 359
          # the fruity backend requires a different handling for GLES
          glesversion=fruity
360

361
          FLAVOUR_LIBS="$FLAVOUR_LIBS -ObjC -framework Foundation  -framework CoreFoundation  -framework CoreGraphics  -framework CoreSurface  -framework GraphicsServices  -framework OpenGLES  -framework LayerKit  -framework UIKit"
362 363

          CLUTTER_WINSYS=fruity
364
          CLUTTER_SONAME_INFIX=fruity
365 366 367 368
        ],

        [osx],
        [
369
          experimental_backend="yes"
370
          cogl_gl_headers="OpenGL/gl.h"
371
          CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_OSX"
372

373
          AC_DEFINE([HAVE_CLUTTER_OSX], [1], [Have the OSX backend])
374
          AC_DEFINE([COGL_HAS_OSX_SUPPORT], [1], [Cogl supports the OSX window system])
375

376
          COGL_DRIVER="gl"
377 378
          AC_DEFINE([HAVE_COGL_GL], [1], [Have GL for rendering])

379
          FLAVOUR_LIBS="$FLAVOUR_LIBS -framework Cocoa -framework OpenGL"
380 381

          CLUTTER_WINSYS=osx
382
          CLUTTER_SONAME_INFIX=osx
383 384 385 386
        ],

        [win32],
        [
387
          cogl_gl_headers="GL/gl.h"
388 389
          CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_WIN32"
          AC_DEFINE([HAVE_CLUTTER_WIN32], [1], [Have the Win32 backend])
390 391
          AC_DEFINE([COGL_HAS_WIN32_SUPPORT], [1], [Cogl supports the win32 window system])
          AC_DEFINE([COGL_HAS_WGL_SUPPORT], [1], [Cogl supports OpenGL using the WGL API])
392

393
          COGL_DRIVER="gl"
394 395
          AC_DEFINE([HAVE_COGL_GL], [1], [Have GL for rendering])

396 397
          FLAVOUR_LIBS="$FLAVOUR_LIBS -lopengl32 -lgdi32 -lwinmm"
          FLAVOUR_CFLAGS="$FLAVOUR_CFLAGS -D_WIN32_WINNT=0x0500"
398 399 400 401 402

          AC_CHECK_TOOL(WINDRES, windres, no)
          if test "$WINDRES" = no; then
             AC_MSG_ERROR([*** windres is required])
          fi
403 404

          CLUTTER_WINSYS=win32
405
          CLUTTER_SONAME_INFIX=win32
406 407
        ],

Emmanuele Bassi's avatar
Emmanuele Bassi committed
408
        [AC_MSG_ERROR([Invalid backend for Clutter: use glx, osx, win32, eglx, eglnative or fruity])]
409
)
410

411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430
AS_IF([test "x$SUPPORT_X11" = "x1"],
      [ AC_DEFINE([COGL_HAS_X11_SUPPORT], [1], [Cogl supports the X11 window system])])
AS_IF([test "x$SUPPORT_XLIB" = "x1"],
      [ AC_DEFINE([COGL_HAS_XLIB_SUPPORT], [1], [Cogl supports X11 using the Xlib API])])

AS_IF([test "x$SUPPORT_GLX" = "x1"],
      [
        AC_DEFINE([COGL_HAS_GLX_SUPPORT], [1], [Cogl supports OpenGL using the GLX API])

        AC_DEFINE([HAVE_CLUTTER_GLX], [1], [Have the GLX backend])

        AC_CHECK_HEADERS([GL/glx.h],
                         [],
                         [AC_MSG_ERROR([Unable to locate required GLX headers])])

        AC_CHECK_LIB(GL, [glXCreateContext],
                     [HAVE_LIBGLX=yes],
                     [AC_MSG_ERROR([Required GLX library not found])])
      ])

Kristian Høgsberg's avatar
Kristian Høgsberg committed
431 432 433 434 435
AS_IF([test "x$SUPPORT_WAYLAND" = "x1"],
      [
        AC_DEFINE([HAVE_CLUTTER_WAYLAND], [1], [Have the Wayland backend])
      ])

436 437 438 439 440 441
AS_IF([test "x$SUPPORT_EGL" = "x1"],
      [
        AC_DEFINE([HAVE_CLUTTER_EGL], [1], [Have the EGL backend])
        AC_DEFINE([COGL_HAS_EGL_SUPPORT], [1], [Cogl supports GLES using the EGL API])
      ])

442 443 444 445 446 447
AS_IF([test "x$CLUTTER_EGL_BACKEND" = "xgeneric"],
      AC_DEFINE([CLUTTER_EGL_BACKEND_GENERIC], [1], [Use Generic EGL backend]))

AS_IF([test "x$CLUTTER_EGL_BACKEND" = "xcex100"],
      AC_DEFINE([CLUTTER_EGL_BACKEND_CEX100], [1], [Use CEX100 EGL backend]))

Kristian Høgsberg's avatar
Kristian Høgsberg committed
448
AS_IF([test "x$SUPPORT_EGL_PLATFORM_POWERVR_X11" = "x1"],
449 450
      [
        AC_DEFINE([COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT], [1],
Kristian Høgsberg's avatar
Kristian Høgsberg committed
451
                  [Cogl supports OpenGL[ES] using the EGL API with PowerVR X11 platform typedefs])
452 453
      ])

Kristian Høgsberg's avatar
Kristian Høgsberg committed
454
AS_IF([test "x$SUPPORT_EGL_PLATFORM_POWERVR_NULL" = "x1"],
455 456
      [
        AC_DEFINE([COGL_HAS_EGL_PLATFORM_POWERVR_NULL_SUPPORT], [1],
Kristian Høgsberg's avatar
Kristian Høgsberg committed
457
                  [Cogl supports OpenGL[ES] using the EGL API with PowerVR NULL platform typedefs])
458 459
      ])

Kristian Høgsberg's avatar
Kristian Høgsberg committed
460
AS_IF([test "x$SUPPORT_EGL_PLATFORM_POWERVR_GDL" = "x1"],
461 462
      [
        AC_DEFINE([COGL_HAS_EGL_PLATFORM_POWERVR_GDL_SUPPORT], [1],
Kristian Høgsberg's avatar
Kristian Høgsberg committed
463
                  [Cogl supports OpenGL[ES] using the EGL API with the GDL API])
464 465
      ])

Kristian Høgsberg's avatar
Kristian Høgsberg committed
466 467 468 469 470
AS_IF([test "x$SUPPORT_EGL_PLATFORM_DRM_SURFACELESS" = "x1"],
      [
        AC_DEFINE([COGL_HAS_EGL_PLATFORM_DRM_SURFACELESS_SUPPORT], [1],
                  [Cogl supports OpenGL[ES] using the EGL API with EGL_MESA_drm_display])
      ])
471

472
# winsys conditionals for use in automake files...
473 474 475 476 477 478
AM_CONDITIONAL(SUPPORT_GLX, [test "x$SUPPORT_GLX" = "x1"])
AM_CONDITIONAL(SUPPORT_X11, [test "x$SUPPORT_X11" = "x1"])
AM_CONDITIONAL(SUPPORT_XLIB, [test "x$SUPPORT_XLIB" = "x1"])
AM_CONDITIONAL(SUPPORT_EGL, [test "x$SUPPORT_EGL" = "x1"])
AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_POWERVR_X11, [test "x$SUPPORT_EGL_PLATFORM_POWERVR_X11" = "x1"])
AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_POWERVR_NULL, [test "x$SUPPORT_EGL_PLATFORM_POWERVR_NULL" = "x1"])
479
AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_POWERVR_GDL, [test "x$SUPPORT_EGL_PLATFORM_POWERVR_GDL" = "x1"])
480
AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_FRUITY, [test "x$CLUTTER_WINSYS" = "xfruity"])
Kristian Høgsberg's avatar
Kristian Høgsberg committed
481 482
AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_DRM_SURFACELESS, [test "x$SUPPORT_EGL_PLATFORM_DRM_SURFACELESS" = "x1"])
AM_CONDITIONAL(SUPPORT_EGL_PLATFORM_FRUITY, [test "x$CLUTTER_WINSYS" = "xfruity"])
483
AM_CONDITIONAL(SUPPORT_OSX, [test "x$CLUTTER_WINSYS" = "xosx"])
484
AM_CONDITIONAL(SUPPORT_FRUITY, [test "x$CLUTTER_WINSYS" = "xfruity"])
485
AM_CONDITIONAL(SUPPORT_WIN32, [test "x$CLUTTER_WINSYS" = "xwin32"])
486
AM_CONDITIONAL(SUPPORT_CEX100, [test "x$SUPPORT_EGL_PLATFORM_POWERVR_GDL" = "x1"])
Kristian Høgsberg's avatar
Kristian Høgsberg committed
487
AM_CONDITIONAL(SUPPORT_WAYLAND, [test "x$CLUTTER_WINSYS" = "xwayland"])
488

489 490 491
dnl === COGL driver backend =====================================================

AS_IF([test "x$COGL_DRIVER" = "xgl"],
Kristian Høgsberg's avatar
Kristian Høgsberg committed
492 493 494
      [ AC_DEFINE([HAVE_COGL_GL], [1], [Have GL for rendering])
	NEED_SEPARATE_EGL=yes
      ])
495

496 497
cogl_gles_version_define=""

498
AS_IF([test "x$COGL_DRIVER" = "xgles"],
499 500 501 502

      [
        AS_CASE([$glesversion],

503 504
          [1*],
          [
505
            cogl_gl_headers="GLES/gl.h GLES/glext.h"
506 507

            AC_DEFINE([HAVE_COGL_GLES], 1, [Have GL/ES for rendering])
508
            cogl_gles_version_define="COGL_HAS_GLES1"
509 510

            PKG_CHECK_EXISTS([glesv1_cm],
511 512 513
              [BACKEND_PC_FILES="$BACKEND_PC_FILES glesv1_cm"
               NEED_SEPARATE_EGL=yes
              ],
514
              [
515
                AC_CHECK_HEADERS([$cogl_gl_headers],
516 517 518 519 520 521 522 523 524 525 526
                                 [],
                                 [AC_MSG_ERROR([Unable to locate required GLES headers])])

                # Check for a GLES 1.x Common Profile library with/without EGL.
                #
                # Note: historically GLES 1 libraries shipped with the
                # EGL and GLES symbols all bundled in one library. Now
                # the Khronos Implementers Guide defines two naming
                # schemes: -lGLES_CM should be used for a library that
                # bundles the GLES and EGL API together and -lGLESv1_CM
                # would be used for a standalone GLES API.
527
                AC_CHECK_LIB(GLES_CM, [eglInitialize],
528 529 530 531 532 533 534 535
                  [FLAVOUR_LIBS="$FLAVOUR_LIBS -lGLES_CM"],
                  [
                    AC_CHECK_LIB(GLESv1_CM, [glFlush],
                      [FLAVOUR_LIBS="$FLAVOUR_LIBS -lGLESv1_CM"
                       NEED_SEPARATE_EGL=yes
                      ],
                      [AC_MSG_ERROR([Unable to locate required GLES 1.x Common Profile library])])
                  ])
536 537
              ])

538 539 540
            AS_IF([test "x$NEED_SEPARATE_EGL" = "xyes"],
              [
                PKG_CHECK_EXISTS([egl],
Kristian Høgsberg's avatar
Kristian Høgsberg committed
541 542 543
                  [BACKEND_PC_FILES="$BACKEND_PC_FILES egl"
		   NEED_SEPARATE_EGL=yes
		  ],
544 545 546 547 548 549 550 551 552 553
                  [
                    AC_CHECK_HEADERS([GLES/egl.h],
                                     [],
                                     [AC_MSG_ERROR([Unable to locate required EGL headers])])

                    AC_CHECK_LIB(EGL, [eglInitialize],
                      [FLAVOUR_LIBS="$FLAVOUR_LIBS -lEGL"],
                      [AC_MSG_ERROR([Unable to locate required EGL library])])
                  ])
              ])
554 555 556 557
          ],

          [2*],
          [
558
            cogl_gl_headers="GLES2/gl2.h GLES2/gl2ext.h"
559 560
            use_gles2_wrapper=yes
            AC_DEFINE([HAVE_COGL_GLES2], 1, [Have GL/ES for rendering])
561
            cogl_gles_version_define="COGL_HAS_GLES2"
562 563

            PKG_CHECK_EXISTS([glesv2],
564 565
              [BACKEND_PC_FILES="$BACKEND_PC_FILES glesv2"],
              [
566
                AC_CHECK_HEADERS([$cogl_gl_headers],
567
                                 [],
568 569 570
                                 [AC_MSG_ERROR([Unable to locate required GLES headers])],
                                 [[#include <GLES2/gl2.h>
                                 ]])
571 572 573

                FLAVOUR_LIBS="$FLAVOUR_LIBS -lGLESv2"
              ])
574 575 576 577 578 579 580

            PKG_CHECK_EXISTS([egl],
              [BACKEND_PC_FILES="$BACKEND_PC_FILES egl"],
              [
                AC_CHECK_HEADERS([EGL/egl.h],
                                 [],
                                 [AC_MSG_ERROR([Unable to locate required EGL headers])])
581 582 583 584 585

                AC_CHECK_LIB(EGL, [eglInitialize],
                  [FLAVOUR_LIBS="$FLAVOUR_LIBS -lEGL"],
                  [AC_MSG_ERROR([Unable to locate required EGL library])])

586 587 588
                FLAVOUR_LIBS="$FLAVOUR_LIBS -lEGL"
              ]
              )
Kristian Høgsberg's avatar
Kristian Høgsberg committed
589 590

	    NEED_SEPARATE_EGL=yes
591 592 593 594
          ],

          [fruity],
          [
595
            cogl_gl_headers="GLES/gl.h GLES/glext.h"
596
            AC_DEFINE([HAVE_COGL_GLES], 1, [Have GL/ES for rendering])
597
            cogl_gles_version_define="COGL_HAS_GLES1"
598 599 600 601 602 603 604

            AC_CHECK_HEADERS([GLES/egl.h],
                             [],
                             [AC_MSG_ERROR([Unable to locate required GLES headers])])
          ],

          [AC_MSG_ERROR([Unknown argument for --with-gles])]
605 606 607 608
        )
      ]
)

609
AM_CONDITIONAL(USE_TSLIB, [test "x$have_tslib" = "xyes"])
610
AM_CONDITIONAL(SUPPORT_EVDEV, [test "x$have_evdev" = "xyes"])
611

612 613
AM_CONDITIONAL(USE_GLES2_WRAPPER, [test "x$use_gles2_wrapper" = "xyes"])

614 615
dnl The value of this variable will directly go in the install
dnl cogl-defines.h header
616
COGL_DEFINES="";
617 618 619 620 621 622 623 624 625 626 627 628
dnl Space-separated list of symbols that should be defined in
dnl cogl-defines.h
COGL_DEFINES_SYMBOLS="";

if test "x$SUPPORT_X11" = "x1"; then
  COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_X11"
fi;

if test "x$SUPPORT_XLIB" = "x1"; then
  COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_XLIB"
fi;

Kristian Høgsberg's avatar
Kristian Høgsberg committed
629 630 631 632
if test "x$NEED_SEPARATE_EGL" = "xyes"; then
  AC_DEFINE([HAVE_STANDALONE_EGL], 1, [Have standalone EGL library])
fi

633 634 635 636 637 638
AS_CASE([$COGL_DRIVER],
        [gl],
        [COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_GL"
         COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS CLUTTER_COGL_HAS_GL"],
        [gles],
        [COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_GLES"
639 640 641
         COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS CLUTTER_COGL_HAS_GLES"
         COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS $cogl_gles_version_define"
         ],
642 643 644 645 646 647 648 649 650 651 652
        [AC_MSG_ERROR([Unknown cogl driver $COGL_DRIVER])])

dnl Copy all of the words in COGL_DEFINES_SYMBOLS as separate #define
dnl lines in COGL_DEFINES
for x in $COGL_DEFINES_SYMBOLS; do
  COGL_DEFINES="$COGL_DEFINES
#define $x 1"
done;

AC_SUBST(COGL_DEFINES)

653 654 655 656 657 658 659 660 661 662 663
AS_IF([test "x$cogl_gl_headers" = "x"], [AC_MSG_ERROR([Internal error: no GL header set])])

dnl cogl_gl_headers is a space separate list of headers to
dnl include. We'll now convert them to a single variable with a
dnl #include line for each header
COGL_GL_HEADER_INCLUDES=""
for x in $cogl_gl_headers; do
  COGL_GL_HEADER_INCLUDES="$COGL_GL_HEADER_INCLUDES
#include <$x>"
done;
AC_SUBST(COGL_GL_HEADER_INCLUDES)
664

665 666
AM_CONDITIONAL([COGL_DRIVER_GLES], [test "x$COGL_DRIVER" = "xgles"])
AM_CONDITIONAL([COGL_DRIVER_GL],   [test "x$COGL_DRIVER" = "xgl"])
667

668 669 670 671 672 673 674 675
dnl Instead of using AM_CFLAGS to ensure
dnl COGL_ENABLE_EXPERIMENTAL_2_0_API is defined while compiling clutter
dnl and cogl code we use a define in config.h instead. This helps ensure
dnl other tools such as glib-mkenums and gir-scanner don't end up
dnl using the define also.
AC_DEFINE([COGL_ENABLE_EXPERIMENTAL_2_0_API], [1],
          [Can use Cogl 2.0 API internally])

676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704
dnl === Clutter configuration =================================================

CLUTTER_CONFIG_DEFINES=

# windowing systems
AS_IF([test "x$SUPPORT_XLIB" = "x1"],
      [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
#define CLUTTER_WINDOWING_X11 1"])
AS_IF([test "x$SUPPORT_GLX" = "x1"],
      [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
#define CLUTTER_WINDOWING_GLX 1"])
AS_IF([test "x$SUPPORT_EGL" = "x1"],
      [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
#define CLUTTER_WINDOWING_EGL 1"])
AS_IF([test "x$SUPPORT_WAYLAND" = "x1"],
      [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
#define CLUTTER_WINDOWING_WAYLAND 1"])
AS_IF([test "x$SUPPORT_OSX" = "x1"],
      [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
#define CLUTTER_WINDOWING_OSX 1"])
AS_IF([test "x$SUPPORT_WIN32" = "x1"],
      [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
#define CLUTTER_WINDOWING_WIN32 1"])
AS_IF([test "x$SUPPORT_CEX100" = "x1"],
      [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
#define CLUTTER_WINDOWING_CEX100 1"])

AC_SUBST([CLUTTER_CONFIG_DEFINES])

705 706 707 708 709 710 711
dnl === Clutter substitutions =================================================
# Eventually the idea of a winsys should be hidden from Clutter and moved
# into Cogl, but for now we have CLUTTER_WINSYS...
AC_SUBST([CLUTTER_WINSYS])
# The same goes for the winsys-base...
AC_SUBST([CLUTTER_WINSYS_BASE])
AC_SUBST([CLUTTER_WINSYS_BASE_LIB])
712
AC_SUBST(CLUTTER_STAGE_TYPE)
713
AC_SUBST(CLUTTER_SONAME_INFIX)
714

715
CLUTTER_WINSYS_LIB=libclutter-$CLUTTER_SONAME_INFIX-$CLUTTER_API_VERSION.la
716 717 718 719 720 721 722 723 724 725 726 727
AC_SUBST([CLUTTER_WINSYS_LIB])

dnl === Clutter substitutions kept for backwards compatibility ================
AC_SUBST([CLUTTER_FLAVOUR])
CLUTTER_COGL=$COGL_DRIVER
AC_SUBST([CLUTTER_COGL])

dnl === Cogl substitutions ====================================================
AC_SUBST([COGL_IMAGE_BACKEND])
COGL_WINSYS=$CLUTTER_WINSYS
AC_SUBST([COGL_WINSYS])
AC_SUBST([COGL_DRIVER])
728

729 730
dnl === Image loading backend =================================================
IMAGE_PC_FILES=""
731

732
# Peek which winsys the user wants so that we can couple the osx winsys with
733
# quartz imageloader.
734
AS_IF([test "x$COGL_WINSYS" = "xosx"], [COGL_IMAGE_BACKEND=quartz], [COGL_IMAGE_BACKEND=gdk-pixbuf])
735

736
AC_ARG_WITH([imagebackend],
737 738
            [AC_HELP_STRING([--with-imagebackend=@<:@gdk-pixbuf/quartz/internal@:>@],
                            [Select COGL image loading backend])],
739
            [COGL_IMAGE_BACKEND=$with_imagebackend])
740

741
AS_CASE([$COGL_IMAGE_BACKEND],
742

743
        [quartz],
744 745 746 747
        [
          experimental_image=yes
          AC_DEFINE([USE_QUARTZ], 1, [Use Core Graphics (Quartz) for loading image data])
        ],
748

749 750 751 752 753
        [gdk-pixbuf],
        [
          AC_DEFINE([USE_GDKPIXBUF], 1, [Use GdkPixbuf for loading image data])
          IMAGE_PC_FILES="gdk-pixbuf-2.0"
        ],
754

755
        [internal],
756 757 758 759
        [
          experimental_image=yes
          AC_DEFINE([USE_INTERNAL], 1, [Use internal image decoding for loading image data])
        ],
760

761 762
        [AC_MSG_ERROR([Unknown argument for --with-imagebackend])]
)
763

764 765
dnl === X11 checks, only for X11-based backends ===============================
X11_PC_FILES=""
766
x11_tests=no
767

768
AS_IF([test "x$SUPPORT_XLIB" = "x1"],
769 770 771
      [
        # base X11 includes and libraries
        AC_MSG_CHECKING([for X11])
772

773 774 775 776 777
        # start with pkg-config
        PKG_CHECK_EXISTS([x11], [have_x11=yes], [have_x11=no])
        AS_IF([test "x$have_x11" = "xyes"],
              [
                X11_PC_FILES="x11"
778 779 780 781 782

                # we actually need to ask for CFLAGS and LIBS
                X11_CFLAGS=`$PKG_CONFIG --cflags $X11_PC_FILES`
                X11_LIBS=`$PKG_CONFIG --libs $X11_PC_FILES`

783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802
                AC_MSG_RESULT([found])
              ],
              [
                # no pkg-config, let's go old school
                AC_PATH_X

                AS_IF([test "x$no_x" = "xyes"],
                      [AC_MSG_ERROR([No X11 Libraries found])],
                      [
                        AS_IF([test "x$x_includes" != "xNONE" && test -n "$x_includes"],
                              [X11_CFLAGS=-I`echo $x_includes | sed -e "s/:/ -I/g"`])

                        AS_IF([test "x$x_libraries" != "xNONE" && test -n "$x_libraries"],
                              [X11_LIBS=-L`echo $x_libraries | sed -e "s/:/ -L/g"`])

                        AC_MSG_RESULT([found])
                      ]
                )
              ]
        )
803 804 805 806 807 808 809 810 811 812 813 814 815 816 817

        # XEXT (required)
        AC_MSG_CHECKING([for XEXT extension])
        PKG_CHECK_EXISTS([xext], [have_xext=yes], [have_xext=no])
        AS_IF([test "x$have_xext" = "xyes"],
              [
                AC_DEFINE(HAVE_XEXT, [1], [Define to 1 if we have the XEXT X extension])

                X11_LIBS="$X11_LIBS -lXext"
                X11_PC_FILES="$X11_PC_FILES xext"

                AC_MSG_RESULT([found])
              ],
              [AC_MSG_ERROR([Not found])]
        )
818 819 820 821 822 823 824 825 826 827

        # XFIXES (required)
        AC_MSG_CHECKING([for XFIXES extension >= 3])
        PKG_CHECK_EXISTS([xfixes >= 3], [have_xfixes=yes], [have_xfixes=no])
        AS_IF([test "x$have_xfixes" = "xyes"],
              [
                AC_DEFINE(HAVE_XFIXES, [1], [Define to 1 if we have the XFIXES X extension])

                X11_LIBS="$X11_LIBS -lXfixes"
                X11_PC_FILES="$X11_PC_FILES xfixes"
828

829 830 831 832
                AC_MSG_RESULT([found])
              ],
              [AC_MSG_ERROR([Not found])]
        )
833

834 835 836 837 838 839
        # XDAMAGE (required)
        AC_MSG_CHECKING([for XDAMAGE extension])
        PKG_CHECK_EXISTS([xdamage], [have_xdamage=yes], [have_xdamage=no])
        AS_IF([test "x$have_xdamage" = "xyes"],
              [
                AC_DEFINE(HAVE_XDAMAGE, [1], [Define to 1 if we have the XDAMAGE X extension])
840

841 842
                X11_LIBS="$X11_LIBS -lXdamage"
                X11_PC_FILES="$X11_PC_FILES xdamage"
843

844 845 846 847
                AC_MSG_RESULT([found])
              ],
              [AC_MSG_ERROR([not found])]
        )
848

849 850 851 852 853 854
        # XCOMPOSITE (optional)
        AC_MSG_CHECKING([for XCOMPOSITE extension >= 0.4])
        PKG_CHECK_EXISTS([xcomposite >= 0.4], [have_xcomposite=yes], [have_xcomposite=no])
        AS_IF([test "x$have_xcomposite" = "xyes"],
              [
                AC_DEFINE(HAVE_XCOMPOSITE, [1], [Define to 1 if we have the XCOMPOSITE X extension])
855

856 857
                X11_LIBS="$X11_LIBS -lXcomposite"
                X11_PC_FILES="$X11_PC_FILES xcomposite"
858

859 860
                AC_MSG_RESULT([found])
              ],
861
              [AC_MSG_ERROR([not found])]
862 863
        )

864
        # XI (optional)
865
        AC_ARG_ENABLE([xinput],
866 867
                      [AS_HELP_STRING([--enable-xinput], [Use the XI X extension])],
                      [],
868
                      [enable_xinput=yes])
869

870 871 872 873 874 875 876 877 878
        AS_IF([test "x$enable_xinput" = "xyes"],
              [
                PKG_CHECK_EXISTS([xi], [have_xinput=yes], [have_xinput=no])
              ],
              [
                have_xinput=no
              ])

        AS_CASE([$have_xinput],
879 880 881

                [yes],
                [
882 883 884 885 886 887 888 889 890 891 892 893 894 895 896
                  AC_CHECK_HEADERS([X11/extensions/XInput2.h],
                                   [
                                     have_xinput2=yes
                                     AC_DEFINE([HAVE_XINPUT_2],
                                               [1],
                                               [Define to 1 if XI2 is available])
                                   ],
                                   [
                                     have_xinput2=no
                                     AC_DEFINE([HAVE_XINPUT],
                                               [1],
                                               [Define to 1 if XInput is available])
                                   ])

                  X11_LIBS="$X11_LIBS $XINPUT_LIBS"
897 898 899 900
                  X11_PC_FILES="$X11_PC_FILES xi"
                ],

                [no],
901 902 903 904
                [have_xinput2=no],

                [*],
                [AC_MSG_ERROR([Invalid argument for --enable-xinput])]
905 906
        )

907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923
        # XKB
        clutter_save_CPPFLAGS="$CPPFLAGS"
        CPPFLAGS="$CPPFLAGS $X11_CFLAGS"

        clutter_save_LIBS="$LIBS"
        LIBS="$LIBS $X11_LIBS"

        have_xkb=no
        AC_CHECK_FUNC([XkbQueryExtension],
                      [
                        AC_DEFINE(HAVE_XKB, 1, [Define to use XKB extension])
                        have_xkb=yes
                      ])

        CPPFLAGS="$clutter_save_CPPFLAGS"
        LIBS="$clutter_save_LIBS"

924
        x11_tests=yes
925
        BACKEND_PC_FILES="$BACKEND_PC_FILES $X11_PC_FILES"
926 927
        FLAVOUR_LIBS="$FLAVOUR_LIBS $X11_LIBS"
        FLAVOUR_CFLAGS="$FLAVOUR_CFLAGS $X11_CFLAGS"
928 929
      ]
)
930

931
AM_CONDITIONAL([BUILD_XI2], [test "x$have_xinput2" = "xyes"])
932
AM_CONDITIONAL(X11_TESTS, [test "x$x11_tests" = "xyes"])
933

934
dnl === Enable debug level ====================================================
Matthew Allum's avatar
Matthew Allum committed
935

936 937 938 939 940 941 942 943 944 945 946 947
m4_define([debug_default], [m4_if(m4_eval(clutter_minor_version % 2), [1], [yes], [minimum])])
AC_ARG_ENABLE([debug],
              [AC_HELP_STRING([--enable-debug=@<:@no/minimum/yes@:>@],
                              [Control Clutter debugging level @<:@default=debug_default@:>@])],
              [],
              [enable_debug=debug_default])

AS_CASE([$enable_debug],

        [yes],
        [
          test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
948
          CLUTTER_DEBUG_CFLAGS="-DCLUTTER_ENABLE_DEBUG"
949 950 951
        ],

        [minimum],
952
        [CLUTTER_DEBUG_CFLAGS="-DCLUTTER_ENABLE_DEBUG -DG_DISABLE_CAST_CHECKS"],
953 954 955 956 957 958

        [no],
        [CLUTTER_DEBUG_CFLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"],

        [AC_MSG_ERROR([Unknown argument for --enable-debug])]
)
959 960 961

AC_SUBST(CLUTTER_DEBUG_CFLAGS)

962
m4_define([cogl_debug_default], [minimum])
963 964
AC_ARG_ENABLE([cogl-debug],
              [AC_HELP_STRING([--enable-cogl-debug=@<:@no/yes@:>@],
965
                              [Control COGL debugging level @<:@default=cogl_debug_default@:>@])],
966
              [],
967
              [enable_cogl_debug=cogl_debug_default])
968

969
AS_CASE([$enable_cogl_debug],
970

971
        [yes],
972
        [COGL_DEBUG_CFLAGS="-DCOGL_GL_DEBUG -DCOGL_OBJECT_DEBUG -DCOGL_HANDLE_DEBUG -DCOGL_ENABLE_DEBUG"],
973

974 975
        [minimum],
        [COGL_DEBUG_CFLAGS="-DCOGL_ENABLE_DEBUG"],
976

977 978
        [no],
        [COGL_DEBUG_CFLAGS=""],
979

980
        [AC_MSG_ERROR([Invalid value for --enable-cogl-debug])]
981 982 983 984
)

AC_SUBST(COGL_DEBUG_CFLAGS)

985 986 987 988 989 990 991 992 993 994 995 996
dnl === Conformance test suite ================================================

AC_ARG_ENABLE([conformance],
              [AC_HELP_STRING([--enable-conformance=@<:@no/yes@:>@],
                              [Build conformance test suite @<:@default=yes@:>@])],
              [],
              [enable_conformance=yes])

AM_CONDITIONAL([BUILD_TESTS], [test "x$enable_conformance" = "xyes"])

dnl === Profiling =============================================================

997 998 999 1000
m4_define([profile_default], [no])
AC_ARG_ENABLE(profile,
              AC_HELP_STRING([--enable-profile=@<:@no/yes@:>@],
                             [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@:>@]),
1001
              [],
1002 1003 1004 1005
              [enable_profile=profile_default])

AS_CASE([$enable_profile],

1006 1007 1008 1009
        [yes],
        [
          AS_IF([test "x$GCC" = "xyes"],
                [
1010
                  PKG_CHECK_MODULES([PROFILE_DEP], [uprof-0.3])
1011 1012
                  CLUTTER_PROFILE_CFLAGS="-DCLUTTER_ENABLE_PROFILE -DCOGL_ENABLE_PROFILE $PROFILE_DEP_CFLAGS"
                  CLUTTER_PROFILE_LDFLAGS="$PROFILE_DEP_LIBS"
1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027

                  AS_IF([test "x$enable_debug" = "xyes"], [CLUTTER_PROFILE_CFLAGS+=" -DUPROF_DEBUG"])
                ],
                [
                  AC_MSG_ERROR([--enable-profile is currently only supported if using GCC])
                ])
        ],

        [no],
        [
          CLUTTER_PROFILE_CFLAGS=""
          CLUTTER_PROFILE_LDFLAGS=""
        ],

        [*], [AC_MSG_ERROR([Invalid value for --enable-profile])]
1028 1029 1030 1031 1032
)
AM_CONDITIONAL(PROFILE, test "x$enable_profile" != "xno")
AC_SUBST(CLUTTER_PROFILE_CFLAGS)
AC_SUBST(CLUTTER_PROFILE_LDFLAGS)

1033 1034 1035 1036 1037 1038 1039 1040
dnl === Coverage report =======================================================

AC_PATH_PROG([GCOV], [gcov], [enable_gcov=no])

AC_MSG_CHECKING([whether to build with gcov testing])

AC_ARG_ENABLE([gcov],
              [AS_HELP_STRING([--enable-gcov],
1041
                              [Whether to enable coverage testing (requires gcc
1042 1043 1044 1045 1046 1047
and gcov)])],
              [],
              [enable_gcov=no])

AS_IF([test "x$enable_gcov" = "xyes" && test "x$GCC" = "xyes"],
      [
1048 1049 1050 1051 1052
        AS_IF([test "x$enable_conformance" = "xno"],
              [AC_MSG_WARN([Conformance test suite is disabled, the coverage report will be incomplete])],
              [AC_MSG_RESULT([yes])]
        )

1053 1054
        GCOV_CFLAGS="-g -O0 -fprofile-arcs -ftest-coverage"
        GCOV_LDFLAGS="-lgcov"
1055 1056
      ],
      [AC_MSG_RESULT([no])]
1057 1058 1059 1060 1061 1062
)

AM_CONDITIONAL([GCOV_ENABLED], [test "x$enable_gcov" = "xyes"])
AC_SUBST([GCOV_CFLAGS])
AC_SUBST([GCOV_LDFLAGS])

1063
dnl === Enable strict compiler flags ==========================================
1064 1065

# use strict compiler flags only on development releases
1066
m4_define([maintainer_flags_default], [m4_if(m4_eval(clutter_minor_version % 2), [1], [yes], [no])])
1067
AC_ARG_ENABLE([maintainer-flags],
1068 1069 1070 1071 1072 1073 1074
              [AC_HELP_STRING([--enable-maintainer-flags=@<:@no/yes@:>@],
                              [Use strict compiler flags @<:@default=maintainer_flags_default@:>@])],
              [],
              [enable_maintainer_flags=maintainer_flags_default])

AS_IF([test "x$enable_maintainer_flags" = "xyes" && test "x$GCC" = "xyes"],
      [
1075
        AS_COMPILER_FLAGS([MAINTAINER_CFLAGS],
1076
                          ["-Wall -Wshadow -Wcast-align -Wuninitialized
1077
                            -Wno-strict-aliasing -Wempty-body -Wformat
1078 1079
                            -Wformat-security -Winit-self
                            -Wdeclaration-after-statement -Wvla"])
1080 1081
      ]
)
1082

1083
AC_SUBST(MAINTAINER_CFLAGS)
1084

1085
dnl === Dependencies, compiler flags and linker libraries =====================
1086
CLUTTER_REQUIRES="cairo-gobject >= 1.10 atk >= 1.7 pangocairo >= 1.20 json-glib-1.0 >= 0.12 $IMAGE_PC_FILES $BACKEND_PC_FILES"
1087 1088 1089
PKG_CHECK_MODULES(CLUTTER_DEPS, [$CLUTTER_REQUIRES])
AC_SUBST(CLUTTER_REQUIRES)

1090 1091
CLUTTER_CFLAGS="$FLAVOUR_CFLAGS $CLUTTER_DEPS_CFLAGS $CLUTTER_PROFILE_CFLAGS $GLIB_CFLAGS"
CLUTTER_LIBS="$FLAVOUR_LIBS $CLUTTER_DEPS_LIBS $CLUTTER_PROFILE_LDFLAGS $GLIB_LIBS"
1092 1093 1094
AC_SUBST(CLUTTER_CFLAGS)
AC_SUBST(CLUTTER_LIBS)

1095
dnl === GObject-Introspection check ===========================================
1096

1097
GOBJECT_INTROSPECTION_CHECK([0.9.5])
1098

1099
dnl === GTK Doc check =========================================================
1100

1101
GTK_DOC_CHECK([1.13], [--flavour no-tmpl])
1102

1103
# we don't want to build the documentation from a Git clone unless we
1104 1105 1106 1107 1108
# explicitly tell configure to do so; this allows avoiding to recurse into
# the documentation directory when building Clutter inside Poky for a
# target device that doesn't have gtk-doc installed. for reference
# see: http://bugzilla.openedhand.com/show_bug.cgi?id=1047
#
1109
# we use autogen.sh as it exists only inside the Git clones, and it
1110
# is not packaged into tarballs.
1111
AM_CONDITIONAL([BUILD_GTK_DOC], [test "x$enable_gtk_doc" = "xyes" || test ! -f "autogen.sh"])
1112

1113
# prefixes for fixing gtk-doc references
1114
CAIRO_PREFIX="`$PKG_CONFIG --variable=prefix cairo`"
1115 1116
GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`"
PANGO_PREFIX="`$PKG_CONFIG --variable=prefix pango`"
1117
AC_SUBST(CAIRO_PREFIX)
1118 1119
AC_SUBST(GLIB_PREFIX)
AC_SUBST(PANGO_PREFIX)
1120

1121 1122
dnl === Manual ================================================================

1123 1124 1125 1126 1127 1128 1129 1130
AC_ARG_ENABLE([docs],
              [AC_HELP_STRING([--enable-docs=@<:@no/yes@:>@],
                              [Build optional documentation; requires xsltproc and jw.])],
              [enable_docs=$enableval],
              [enable_docs=no])

enable_pdfs=no
AS_IF([test "x$enable_docs" = "xyes"],
1131 1132 1133
      [
        AC_PATH_PROG(JW, [jw], [no])
        AS_IF([test "x$JW" = "xno"],
1134 1135 1136 1137
              [
                AC_MSG_WARN([jw not found; pdf generation has been disabled])
              ],
              [enable_pdfs=yes])
1138 1139 1140

        AC_PATH_PROG(XSLTPROC, [xsltproc], [no])
        AS_IF([test "x$XSLTPROC" = "xno"],
1141 1142 1143
              [
                AC_MSG_ERROR([xsltproc not found])
              ])
1144 1145
      ]
)
Matthew Allum's avatar
Matthew Allum committed
1146

1147 1148
AM_CONDITIONAL(ENABLE_DOCS, [test "x$enable_docs" = "xyes"])
AM_CONDITIONAL(ENABLE_PDFS, [test "x$enable_pdfs" = "xyes"])
Matthew Allum's avatar
Matthew Allum committed
1149

1150
dnl === I18N ==================================================================
Matthew Allum's avatar
Matthew Allum committed
1151

1152
AM_GNU_GETTEXT_VERSION([0.17])
1153 1154
AM_GNU_GETTEXT([external])

1155
GETTEXT_PACKAGE="clutter-1.0"
1156
AC_SUBST(GETTEXT_PACKAGE)
1157 1158
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,
                   "$GETTEXT_PACKAGE",
1159
                   [The prefix for our gettext translation domains.])
1160
AS_ALL_LINGUAS
1161

1162 1163
dnl ===========================================================================

1164
AC_CONFIG_FILES([
1165 1166 1167 1168 1169 1170 1171
	Makefile

	build/Makefile
	build/autotools/Makefile
	build/mingw/Makefile

	clutter/Makefile
1172
        clutter/clutter-config.h
1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210
	clutter/clutter-version.h
	clutter/clutter-$CLUTTER_API_VERSION.pc:clutter/clutter.pc.in

	clutter/cally/cally-$CLUTTER_API_VERSION.pc:clutter/cally/cally.pc.in

	clutter/cogl/Makefile
	clutter/cogl/cogl/Makefile
	clutter/cogl/cogl/cogl-defines.h
	clutter/cogl/cogl/cogl-$CLUTTER_API_VERSION.pc:clutter/cogl/cogl/cogl.pc.in
	clutter/cogl/pango/Makefile

	clutter/egl/clutter-cex100.h

	tests/Makefile
	tests/accessibility/Makefile
	tests/conform/Makefile
	tests/conform/test-launcher.sh
	tests/data/Makefile
	tests/interactive/Makefile
	tests/interactive/wrapper.sh
	tests/micro-bench/Makefile

	doc/Makefile
	doc/reference/Makefile
	doc/reference/clutter/Makefile
	doc/reference/clutter/clutter-docs.xml
	doc/reference/cogl/Makefile
	doc/reference/cogl/cogl-docs.xml
	doc/reference/cally/Makefile
	doc/reference/cally/cally-docs.xml
	doc/common/Makefile
	doc/manual/Makefile
	doc/manual/clutter-manual.xml
	doc/cookbook/Makefile
	doc/cookbook/clutter-cookbook.xml
	doc/cookbook/examples/Makefile

	po/Makefile.in
Matthew Allum's avatar
Matthew Allum committed
1211
])
1212

1213 1214
AC_OUTPUT

1215
dnl === Summary ===============================================================
1216 1217

echo ""
1218 1219
echo "Clutter - $VERSION (${CLUTTER_RELEASE_STATUS})"

1220
# Global flags
1221
echo ""
1222 1223 1224 1225 1226
echo " • Global:"
echo "        Prefix: ${prefix}"
echo "        Flavour: ${CLUTTER_WINSYS}/${COGL_DRIVER}"
echo "        Target library: ${CLUTTER_WINSYS_LIB}"

1227
# Compiler/Debug related flags
1228
echo ""
1229 1230 1231 1232
echo " • Compiler options:"
echo "        Clutter debug level: ${enable_debug}"
echo "        COGL debug level: ${enable_cogl_debug}"
echo "        Compiler flags: ${MAINTAINER_CFLAGS}"
1233
echo "        Profiling enabled: ${enable_profile}"
1234
echo "        Enable coverage tests: ${enable_gcov}"
1235

1236
# Documentation
1237 1238 1239
echo ""
echo " • Documentation:"
echo "        Build API Reference: ${enable_gtk_doc}"
1240
echo "        Build Additional Documentation: ${enable_docs} (Generate PDF: ${enable_pdfs})"
1241

1242
# Miscellaneous
1243 1244 1245
echo ""
echo " • Extra:"
echo "        Build introspection data: ${enable_introspection}"
1246
echo "        Build conformance test suite: ${enable_conformance}"
1247

1248
# Cogl flags
1249
echo ""
1250
echo " • Cogl Backend:"
1251
echo "        Driver: ${COGL_DRIVER}"
1252
echo "        GL header: ${cogl_gl_headers}"
1253

1254 1255 1256 1257 1258 1259 1260 1261
if test "x$COGL_DRIVER" = "xgles"; then
  if test "x$use_gles2_wrapper" = "xyes"; then
echo "        GLES version: 2.0"
  else
echo "        GLES version: 1.1"
  fi
fi

1262 1263 1264 1265 1266
if test "x$experimental_image" = "xno"; then
echo "        Image backend: ${COGL_IMAGE_BACKEND}"
else
echo "        Image backend: ${COGL_IMAGE_BACKEND} (WARNING: Experimental)"
fi
1267

1268
# Clutter backend related flags
1269 1270 1271 1272 1273 1274 1275
echo ""
echo " • Clutter Backend:"

if test "x$experimental_backend" = "xno"; then
echo "        Windowing system: ${CLUTTER_WINSYS}"
else
echo "        Windowing system: ${CLUTTER_WINSYS} (WARNING: Experimental)"
1276
fi
1277

1278
if test "x$SUPPORT_XLIB" = "x1"; then
1279
echo "        Enable XComposite: ${have_xcomposite}"
1280 1281
echo "        Enable XInput: ${have_xinput}"
echo "        Enable XI2: ${have_xinput2}"
1282
echo "        Enable XKB: ${have_xkb}"
1283
echo "        Enable X11 tests: ${x11_tests}"
1284 1285
fi

1286 1287
echo ""

1288
# General warning about experimental features
1289
if test "x$experimental_backend" = "xyes" ||
1290 1291
   test "x$experimental_image" = "xyes"
then
1292 1293 1294 1295 1296 1297 1298 1299
echo ""
echo "☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠"
echo " *WARNING*"
echo ""
echo "  The stability of your build might be affected by one or more"
echo "  experimental backends or experimental and unsupported features"
echo "☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠"
echo ""
1300
fi