configure.ac 45.7 KB
Newer Older
1
# clutter package version number, (as distinct from shared library version)
2 3 4 5 6 7 8 9 10
# 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
# 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
11
m4_define([clutter_major_version], [1])
Emmanuele Bassi's avatar
Emmanuele Bassi committed
12
m4_define([clutter_minor_version], [18])
Emmanuele Bassi's avatar
Emmanuele Bassi committed
13
m4_define([clutter_micro_version], [2])
14

15 16 17
# • for stable releases: increase the interface age by 1 for each release;
#   if the API changes, set to 0. interface_age and binary_age are used to
#   create the soname of the shared object:
18 19 20 21 22 23
#
#  (<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:
#
24 25 26
#   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
27
#   [ API addition, deprecation ]
28 29 30
#   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
31
#   ...
32
#
33
# • for development releases: keep clutter_interface_age to 0
Emmanuele Bassi's avatar
Emmanuele Bassi committed
34
m4_define([clutter_interface_age], [2])
Emmanuele Bassi's avatar
Emmanuele Bassi committed
35

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

Emmanuele Bassi's avatar
Emmanuele Bassi committed
38 39 40 41 42 43 44 45 46 47
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])

48
AC_PREREQ([2.63])
49

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

56
AC_CONFIG_SRCDIR([clutter/clutter.h])
57
AC_CONFIG_HEADERS([clutter/config.h])
58 59
AC_CONFIG_AUX_DIR([build])
AC_CONFIG_MACRO_DIR([build/autotools])
Matthew Allum's avatar
Matthew Allum committed
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 65 66 67 68 69 70
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])
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 76 77
CLUTTER_LT_CURRENT=lt_current
CLUTTER_LT_REV=lt_revision
CLUTTER_LT_AGE=lt_age
78 79
CLUTTER_LT_VERSION="$CLUTTER_LT_CURRENT:$CLUTTER_LT_REV:$CLUTTER_LT_AGE"
CLUTTER_LT_LDFLAGS="-version-info $CLUTTER_LT_VERSION"
80 81 82
AC_SUBST([CLUTTER_LT_CURRENT],  [lt_current])
AC_SUBST([CLUTTER_LT_REVISION], [lt_revision])
AC_SUBST([CLUTTER_LT_VERSION],  [$CLUTTER_LT_VERSION])
83

Emmanuele Bassi's avatar
Emmanuele Bassi committed
84 85
AC_PROG_SED

86 87
dnl = Preliminary platform checks =============================================

88
AC_CANONICAL_HOST
89 90 91 92 93

platform_win32=no
platform_quartz=no
platform_linux=no

94
AC_MSG_CHECKING([if building for some Win32 platform])
95 96 97 98 99 100 101
AS_CASE([$host],
        [*-*-mingw*|*-*-cygwin*],
        [
          CLUTTER_LT_LDFLAGS="$CLUTTER_LT_LDFLAGS -no-undefined"
          platform_win32=yes
        ],

102
        [*-*-linux*],
103 104 105 106
        [
          platform_linux=yes
        ],

107
        []
108
)
109
AC_MSG_RESULT([$platform_win32])
110

111
AM_CONDITIONAL(OS_WIN32, [test "$platform_win32" = "yes"])
112

113 114 115
AC_CHECK_HEADER([OpenGL/gl.h], [platform_quartz=yes], [platform_quartz=no])
AM_CONDITIONAL(OS_QUARTZ, [test "$platform_quartz" = "yes"])

116 117 118
AC_CHECK_HEADER([GL/glx.h], [platform_glx=yes], [platform_glx=no])
AC_CHECK_LIB([GL], [glXCreateContext], [platform_glx=yes], [platform_glx=no])
AM_CONDITIONAL(OS_GLX, [test "$platform_glx" = "yes"])
119
AM_CONDITIONAL(OS_LINUX, [test "$platform_linux" = "yes"])
120

121 122
AC_SUBST(CLUTTER_LT_LDFLAGS)

123 124 125
AC_CACHE_SAVE

dnl = Dependencies =========================================================
126

Matthew Allum's avatar
Matthew Allum committed
127
# Checks for programs.
128
AM_PROG_CC_C_O
129 130 131 132

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

Matthew Allum's avatar
Matthew Allum committed
134 135 136
# Checks for header files.
AC_HEADER_STDC

Emmanuele Bassi's avatar
Emmanuele Bassi committed
137
# required versions for dependencies
138
m4_define([glib_req_version],           [2.37.3])
139
m4_define([cogl_req_version],           [1.17.5])
Emmanuele Bassi's avatar
Emmanuele Bassi committed
140
m4_define([json_glib_req_version],      [0.12.0])
141
m4_define([atk_req_version],            [2.5.3])
142
m4_define([cairo_req_version],          [1.12.0])
143
m4_define([pango_req_version],          [1.30])
Emmanuele Bassi's avatar
Emmanuele Bassi committed
144 145
m4_define([gi_req_version],             [0.9.5])
m4_define([uprof_req_version],          [0.3])
Emmanuele Bassi's avatar
Emmanuele Bassi committed
146
m4_define([gtk_doc_req_version],        [1.20])
147
m4_define([xcomposite_req_version],     [0.4])
148
m4_define([gdk_req_version],            [3.3.18])
149
m4_define([libinput_req_version],       [0.1.0])
150
m4_define([libudev_req_version],        [136])
Emmanuele Bassi's avatar
Emmanuele Bassi committed
151

152 153 154 155 156 157 158 159 160
AC_SUBST([GLIB_REQ_VERSION],       [glib_req_version])
AC_SUBST([COGL_REQ_VERSION],       [cogl_req_version])
AC_SUBST([JSON_GLIB_REQ_VERSION],  [json_glib_req_version])
AC_SUBST([ATK_REQ_VERSION],        [atk_req_version])
AC_SUBST([CAIRO_REQ_VERSION],      [cairo_req_version])
AC_SUBST([PANGO_REQ_VERSION],      [pango_req_version])
AC_SUBST([GI_REQ_VERSION],         [gi_req_version])
AC_SUBST([UPROF_REQ_VERSION],      [uprof_req_version])
AC_SUBST([GTK_DOC_REQ_VERSION],    [gtk_doc_req_version])
161
AC_SUBST([XCOMPOSITE_REQ_VERSION], [xcomposite_req_version])
162
AC_SUBST([GDK_REQ_VERSION],        [gdk_req_version])
163 164
AC_SUBST([LIBINPUT_REQ_VERSION],   [libinput_req_version])
AC_SUBST([LIBUDEV_REQ_VERSION],    [libudev_req_version])
Emmanuele Bassi's avatar
Emmanuele Bassi committed
165

Matthew Allum's avatar
Matthew Allum committed
166
# Checks for typedefs, structures, and compiler characteristics.
Emmanuele Bassi's avatar
Emmanuele Bassi committed
167 168 169
AM_PATH_GLIB_2_0([glib_req_version],
                 [],
                 [AC_MSG_ERROR([glib-2.0 is required])],
170
                 [gobject gthread gmodule-no-export])
171

172
# Check for -Bsymbolic-functions to avoid intra-library PLT jumps
173
AC_ARG_ENABLE([Bsymbolic],
174
              [AS_HELP_STRING([--disable-Bsymbolic],
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
                              [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}"
              ])

Emmanuele Bassi's avatar
Emmanuele Bassi committed
193
AS_IF([test "x$enable_Bsymbolic" = "xyes"], [CLUTTER_LINK_FLAGS=-Wl[,]-Bsymbolic-functions])
194
AC_SUBST(CLUTTER_LINK_FLAGS)
195

196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225
# Check for the visibility flags
CLUTTER_HIDDEN_VISIBILITY_CFLAGS=""
case "$host" in
  *-*-mingw*)
    dnl on mingw32 we do -fvisibility=hidden and __declspec(dllexport)
    AC_DEFINE([_CLUTTER_EXTERN], [__attribute__((visibility("default"))) __declspec(dllexport) extern],
              [defines how to decorate public symbols while building])
    CFLAGS="${CFLAGS} -fvisibility=hidden"
    ;;
  *)
    dnl on other compilers, check if we can do -fvisibility=hidden
    SAVED_CFLAGS="${CFLAGS}"
    CFLAGS="-fvisibility=hidden"
    AC_MSG_CHECKING([for -fvisibility=hidden compiler flag])
    AC_TRY_COMPILE([], [int main (void) { return 0; }],
                   AC_MSG_RESULT(yes)
                   enable_fvisibility_hidden=yes,
                   AC_MSG_RESULT(no)
                   enable_fvisibility_hidden=no)
    CFLAGS="${SAVED_CFLAGS}"

    AS_IF([test "${enable_fvisibility_hidden}" = "yes"], [
      AC_DEFINE([_CLUTTER_EXTERN], [__attribute__((visibility("default"))) extern],
                [defines how to decorate public symbols while building])
      CLUTTER_HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden"
    ])
    ;;
esac
AC_SUBST(CLUTTER_HIDDEN_VISIBILITY_CFLAGS)

226
AC_CACHE_SAVE
227 228

dnl ========================================================================
229

230 231
FLAVOUR_LIBS=""
FLAVOUR_CFLAGS=""
232
CLUTTER_BACKENDS=""
233
CLUTTER_INPUT_BACKENDS=""
234
CLUTTER_CONFIG_DEFINES=
235

236
experimental_backend=no
237
experimental_input_backend=no
238

Emmanuele Bassi's avatar
Emmanuele Bassi committed
239
# base dependencies for core
240
CLUTTER_BASE_PC_FILES="cogl-1.0 >= $COGL_REQ_VERSION cogl-path-1.0 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"
Emmanuele Bassi's avatar
Emmanuele Bassi committed
241

242 243 244
# private base dependencies
CLUTTER_BASE_PC_FILES_PRIVATE=""

245 246
# backend specific pkg-config files
BACKEND_PC_FILES=""
247

248 249 250
# private backend specific dependencies
BACKEND_PC_FILES_PRIVATE=""

251 252
dnl === Clutter windowing system backend ======================================

253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276
AC_ARG_ENABLE([x11-backend],
              [AS_HELP_STRING([--enable-x11-backend=@<:@yes/no@:>@], [Enable the X11 backend (default=check)])],
              [enable_x11=$enableval],
              [enable_x11=check])
AC_ARG_ENABLE([win32-backend],
              [AS_HELP_STRING([--enable-win32-backend=@<:@yes/no@:>@], [Enable the Windows backend (default=check)])],
              [enable_win32=$enableval],
              [enable_win32=check])
AC_ARG_ENABLE([quartz-backend],
              [AS_HELP_STRING([--enable-quartz-backend=@<:@yes/no@:>@], [Enable the OS X backend (default=check)])],
              [enable_osx=$enableval],
              [enable_osx=check])
AC_ARG_ENABLE([gdk-backend],
              [AS_HELP_STRING([--enable-gdk-backend=@<:@yes/no@:>@], [Enable the GDK backend (default=check)])],
              [enable_gdk=$enableval],
              [enable_gdk=check])
AC_ARG_ENABLE([wayland-backend],
              [AS_HELP_STRING([--enable-wayland-backend=@<:@yes/no@:>@], [Enable the Wayland client backend (default=no)])],
              [enable_wayland=$enableval],
              [enable_wayland=no])
AC_ARG_ENABLE([egl-backend],
              [AS_HELP_STRING([--enable-egl-backend=@<:@yes/no@:>@], [Enable the EGL framebuffer backend (default=no)])],
              [enable_egl=$enableval],
              [enable_egl=no])
277 278 279 280
AC_ARG_ENABLE([cex100-backend],
              [AS_HELP_STRING([--enable-cex100-backend=@<:@yes/no@:>@], [Enable the CEx100 backend (default=no)])],
              [enable_cex100=$enableval],
              [enable_cex100=no])
281

282
dnl Define default values
283 284 285 286
AS_IF([test "x$enable_x11" = "xcheck"],
      [
        AS_IF([test "x$platform_glx" = "xyes"], [enable_x11=yes], [enable_x11=no])
      ])
287

288 289 290 291
AS_IF([test "x$enable_win32" = "xcheck"],
      [
        AS_IF([test "x$platform_win32" = "xyes"], [enable_win32=yes], [enable_win32=no])
      ])
Kristian Høgsberg's avatar
Kristian Høgsberg committed
292

293 294 295 296
AS_IF([test "x$enable_osx" = "xcheck"],
      [
        AS_IF([test "x$platform_quartz" = "xyes"], [enable_osx=yes], [enable_osx=no])
      ])
Kristian Høgsberg's avatar
Kristian Høgsberg committed
297

298 299 300 301
AS_IF([test "x$enable_gdk" = "xcheck"],
      [
        PKG_CHECK_EXISTS([gdk-3.0 >= gdk_req_version], [enable_gdk=yes], [enable_gdk=no])
      ])
Kristian Høgsberg's avatar
Kristian Høgsberg committed
302

303 304 305 306
dnl Per-backend rules
AS_IF([test "x$enable_x11" = "xyes"],
      [
        CLUTTER_BACKENDS="$CLUTTER_BACKENDS x11"
307
        CLUTTER_INPUT_BACKENDS="$CLUTTER_INPUT_BACKENDS x11"
Kristian Høgsberg's avatar
Kristian Høgsberg committed
308

309 310 311
        SUPPORT_X11=1
        SUPPORT_GLX=1
        SUPPORT_COGL=1
312

313 314 315
        # we use fontconfig API and pango-ft2 when the fontconfig
        # configuration changes; we don't expose any API for this
        # so we add pango-ft2 to the private Requires.
316 317 318
        PKG_CHECK_EXISTS([pangoft2],
                         [
                           AC_DEFINE([HAVE_PANGO_FT2], [1], [Supports PangoFt2])
319
                           BACKEND_PC_FILES_PRIVATE="$BACKEND_PC_FILES_PRIVATE pangoft2"
320 321
                         ],
                         [])
322

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

326 327 328
AS_IF([test "x$enable_gdk" = "xyes"],
      [
        CLUTTER_BACKENDS="$CLUTTER_BACKENDS gdk"
329
        CLUTTER_INPUT_BACKENDS="$CLUTTER_INPUT_BACKENDS gdk"
330

331 332
	SUPPORT_GDK=1
        SUPPORT_COGL=1
333

334 335
	BACKEND_PC_FILES="$BACKEND_PC_FILES gdk-3.0"
      ])
336

337 338 339
AS_IF([test "x$enable_wayland" = "xyes"],
      [
        CLUTTER_BACKENDS="$CLUTTER_BACKENDS wayland"
340
        CLUTTER_INPUT_BACKENDS="$CLUTTER_INPUT_BACKENDS wayland"
341

342
        experimental_backend="yes"
343

344
        SUPPORT_WAYLAND=1
345
        SUPPORT_COGL=1
346

347
        PKG_CHECK_EXISTS([wayland-client wayland-cursor xkbcommon gdk-pixbuf-2.0],
348
                         [
349
                            BACKEND_PC_FILES="$BACKEND_PC_FILES wayland-cursor wayland-client xkbcommon"
350 351
                            BACKEND_PC_FILES_PRIVATE="$BACKEND_PC_FILES_PRIVATE gdk-pixbuf-2.0"
                         ],
352
                         [])
353

354
        AC_DEFINE([HAVE_CLUTTER_WAYLAND], [1], [Have the Wayland client backend])
355 356 357
      ])

dnl Note this is orthogonal to the client side support and you can
358
dnl use the Wayland compositor features with any of the clutter
359 360
dnl backends with corresponding Cogl support.
AC_ARG_ENABLE([wayland-compositor],
361 362
              [AS_HELP_STRING([--enable-wayland-compositor=@<:@yes/no@:>@],
                              [Enable Wayland compositor features (default=no)])],
363 364 365 366 367 368 369 370 371 372
              [],
              [AS_IF([test "x$SUPPORT_EGL" = "x1"],
                     [enable_wayland_compositor=yes],
                     [enable_wayland_compositor=no])
              ])

AS_IF([test "x$enable_wayland_compositor" = "xyes"],
      [
        PKG_CHECK_EXISTS([wayland-server],
			 [BACKEND_PC_FILES="$BACKEND_PC_FILES wayland-server"], [])
373

374
        SUPPORT_WAYLAND_COMPOSITOR=1
375 376
        SUPPORT_COGL=1

377 378
	CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
#define CLUTTER_HAS_WAYLAND_COMPOSITOR_SUPPORT 1"
379
        AC_DEFINE([HAVE_CLUTTER_WAYLAND_COMPOSITOR], [1], [Have Wayland compositor support])
380
      ])
381

382 383 384
AM_CONDITIONAL(SUPPORT_WAYLAND_COMPOSITOR, [test "x$SUPPORT_WAYLAND_COMPOSITOR" = "x1"])

AS_IF([test "x$enable_wayland_compositor" != "xyes" -a "x$enable_wayland" != "xyes"],
385 386 387 388
      [
        # The wayland headers introduce so much symbol shadowing that build
        # logs become incomprehensible with -Wshadow so we only use it for
        # non-wayland builds.
389
	MAINTAINER_COMPILER_FLAGS="-Wshadow"
390
      ])
391

392
AS_IF([test "x$enable_cex100" = "xyes"],
393
      [
394
        CLUTTER_BACKENDS="$CLUTTER_BACKENDS cex100"
395

396
        experimental_backend="yes"
397

398
        SUPPORT_CEX100=1
399
        SUPPORT_COGL=1
400

401 402
        have_gdl=no
        AC_CHECK_HEADERS([libgdl.h], [have_gdl=yes])
403

404
        AS_IF([test "x$have_gdl" = "xno"],
405
              [
406 407 408 409 410 411 412
                AC_CHECK_HEADERS([CE4100/libgdl.h],
                                 [
                                   FLAVOUR_CFLAGS="-I/usr/include/CE4100"
                                   have_gdl=yes
                                   CLUTTER_CEX100_LIBGDL_PREFIX=CE4100/
                                 ])
              ])
413

414 415
        AS_IF([test "x$have_gdl" = "xno"],
              [AC_MSG_ERROR([libgdl.h not found but the CEx100 backend has been explicitly enabled])])
416

417
        AC_SUBST(CLUTTER_CEX100_LIBGDL_PREFIX)
418

419
        FLAVOUR_LIBS="$FLAVOUR_LIBS -lgdl"
420

421 422 423 424
        AC_DEFINE([CLUTTER_EGL_BACKEND_CEX100], [1], [Use CEX100 EGL backend])
        AC_DEFINE([CLUTTER_EGL_BACKEND_GENERIC], [1], [Use Generic EGL backend])
        AC_DEFINE([HAVE_CLUTTER_EGL], [1], [Have the EGL backend])
      ])
425

426 427 428
AS_IF([test "x$enable_egl" = "xyes"],
      [
        CLUTTER_BACKENDS="$CLUTTER_BACKENDS egl"
429

430
        experimental_backend="yes"
431

432 433
        SUPPORT_EGL=1
        SUPPORT_COGL=1
434 435 436 437 438 439 440

        FLAVOUR_LIBS="$FLAVOUR_LIBS $TSLIB_LIBS $EVDEV_LIBS"
        FLAVOUR_CFLAGS="$FLAVOUR_CFLAGS $TSLIB_CFLAGS $EVDEV_CFLAGS"

        AC_DEFINE([CLUTTER_EGL_BACKEND_GENERIC], [1], [Use Generic EGL backend])

        AC_DEFINE([HAVE_CLUTTER_EGL], [1], [Have the EGL backend])
441 442
      ])

443
AS_IF([test "x$enable_osx" = "xyes"],
444
      [
445
        CLUTTER_BACKENDS="$CLUTTER_BACKENDS osx"
446
        CLUTTER_INPUT_BACKENDS="$CLUTTER_INPUT_BACKENDS osx"
447 448 449 450 451 452

        AC_DEFINE([HAVE_CLUTTER_OSX], [1], [Have the OSX backend])

        FLAVOUR_LIBS="$FLAVOUR_LIBS -framework Cocoa -framework OpenGL"

        SUPPORT_OSX=1
453 454
      ])

455
AS_IF([test "x$enable_win32" = "xyes"],
Kristian Høgsberg's avatar
Kristian Høgsberg committed
456
      [
457
        CLUTTER_BACKENDS="$CLUTTER_BACKENDS win32"
458
        CLUTTER_INPUT_BACKENDS="$CLUTTER_INPUT_BACKENDS win32"
459 460 461 462 463 464 465 466 467

        AC_DEFINE([HAVE_CLUTTER_WIN32], [1], [Have the Win32 backend])

        FLAVOUR_LIBS="$FLAVOUR_LIBS -lopengl32 -lgdi32 -lwinmm"
        FLAVOUR_CFLAGS="$FLAVOUR_CFLAGS -D_WIN32_WINNT=0x0500"

        AC_CHECK_TOOL(WINDRES, [windres], [AC_MSG_ERROR([*** windres is required])])

        SUPPORT_WIN32=1
Kristian Høgsberg's avatar
Kristian Høgsberg committed
468 469
      ])

470
AS_IF([test "x$CLUTTER_BACKENDS" = "x"],
471
      [
472
        AC_MSG_ERROR([No backend enabled. You need to enable at least one backend.])
473 474
      ])

475 476 477 478 479
AS_IF([test "x$platform_linux" = "xyes"],
      [
        AC_DEFINE([OS_LINUX], [1], [Define to 1 if building for Linux])
      ])

480 481 482 483 484 485 486
# additional input backends

AC_ARG_ENABLE([tslib-input],
              [AS_HELP_STRING([--enable-tslib-input=@<:@yes/no@:>@], [Enable TSLib for input events (default=no)])],
              [enable_tslib=$enableval],
              [enable_tslib=no])
AC_ARG_ENABLE([evdev-input],
487
              [AS_HELP_STRING([--enable-evdev-input=@<:@yes/no@:>@], [Enable evdev for input events (default=no)])],
488
              [enable_evdev=$enableval],
489
              [enable_evdev=no])
490 491 492 493 494 495

AS_IF([test "x$enable_tslib" = "xyes"],
      [
        PKG_CHECK_MODULES(TSLIB, [tslib-1.0], [have_tslib=yes], [have_tslib=no])
        AS_IF([test "x$have_tslib" = "xyes"],
              [
496 497
                CLUTTER_INPUT_BACKENDS="$CLUTTER_INPUT_BACKENDS tslib"
                experimental_input_backend="yes"
498 499 500 501 502 503 504 505 506 507
                AC_DEFINE([HAVE_TSLIB], [1], [Have tslib for touchscreen handling])
                SUPPORT_TSLIB=1
              ])
      ])

AS_IF([test "x$enable_evdev" = "xyes"],
      [
        PKG_CHECK_MODULES(EVDEV, [gudev-1.0 xkbcommon], [have_evdev=yes], [have_evdev=no])
        AS_IF([test "x$have_evdev" = "xyes"],
              [
508
                CLUTTER_INPUT_BACKENDS="$CLUTTER_INPUT_BACKENDS evdev"
509
                BACKEND_PC_FILES_PRIVATE="$BACKEND_PC_FILES_PRIVATE libudev >= $LIBUDEV_REQ_VERSION libinput >= $LIBINPUT_REQ_VERSION xkbcommon"
510
                experimental_input_backend="yes"
511 512 513 514 515
                AC_DEFINE([HAVE_EVDEV], [1], [Have evdev support for input handling])
                SUPPORT_EVDEV=1
              ])
      ])

516 517 518 519 520 521 522
# conditionals for use in automake files...
AM_CONDITIONAL(SUPPORT_GLX,     [test "x$SUPPORT_GLX" = "x1"])
AM_CONDITIONAL(SUPPORT_X11,     [test "x$SUPPORT_X11" = "x1"])
AM_CONDITIONAL(SUPPORT_GDK,     [test "x$SUPPORT_GDK" = "x1"])
AM_CONDITIONAL(SUPPORT_EGL,     [test "x$SUPPORT_EGL" = "x1"])
AM_CONDITIONAL(SUPPORT_OSX,     [test "x$SUPPORT_OSX" = "x1"])
AM_CONDITIONAL(SUPPORT_WIN32,   [test "x$SUPPORT_WIN32" = "x1"])
523
AM_CONDITIONAL(SUPPORT_CEX100,  [test "x$SUPPORT_CEX100" = "x1"])
524 525 526
AM_CONDITIONAL(SUPPORT_WAYLAND, [test "x$SUPPORT_WAYLAND" = "x1"])

AM_CONDITIONAL(USE_COGL,  [test "x$SUPPORT_COGL" = "x1"])
527
AM_CONDITIONAL(USE_TSLIB, [test "x$have_tslib" = "xyes"])
528 529
AM_CONDITIONAL(USE_EVDEV, [test "x$have_evdev" = "xyes"])
AM_CONDITIONAL(USE_GLD,   [test "x$have_gdl" = "xyes"])
530

531
AM_CONDITIONAL(NEED_XKB_UTILS, [test "x$have_evdev" = "xyes" -o "x$SUPPORT_WAYLAND" = "x1"])
532

533 534 535 536 537
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.
538
AC_DEFINE([COGL_ENABLE_EXPERIMENTAL_2_0_API], [1], [Can use Cogl 2.0 API internally])
539

540 541 542 543
dnl strip leading spaces
CLUTTER_BACKENDS=${CLUTTER_BACKENDS#* }
AC_SUBST(CLUTTER_BACKENDS)

544 545 546
CLUTTER_INPUT_BACKENDS=${CLUTTER_INPUT_BACKENDS#* }
AC_SUBST(CLUTTER_INPUT_BACKENDS)

547 548
AC_CACHE_SAVE

549 550 551
dnl === Clutter configuration =================================================

# windowing systems
552
AS_IF([test "x$SUPPORT_X11" = "x1"],
553
      [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
554 555
#define CLUTTER_WINDOWING_X11 \"x11\"
#define CLUTTER_INPUT_X11 \"x11\""])
556 557
AS_IF([test "x$SUPPORT_GDK" = "x1"],
      [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
558 559
#define CLUTTER_WINDOWING_GDK \"gdk\"
#define CLUTTER_INPUT_GDK \"gdk\""])
560 561
AS_IF([test "x$SUPPORT_GLX" = "x1"],
      [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
562
#define CLUTTER_WINDOWING_GLX \"glx\""])
563 564
AS_IF([test "x$SUPPORT_EGL" = "x1"],
      [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
565
#define CLUTTER_WINDOWING_EGL \"eglnative\""])
566
AS_IF([test "x$SUPPORT_WAYLAND" = "x1"],
567
      [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
568
#define CLUTTER_WINDOWING_WAYLAND \"wayland\""])
569
AS_IF([test "x$SUPPORT_OSX" = "x1"],
570
      [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
571 572
#define CLUTTER_WINDOWING_OSX \"osx\"
#define CLUTTER_INPUT_OSX \"osx\""])
573
AS_IF([test "x$SUPPORT_WIN32" = "x1"],
574
      [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
575 576
#define CLUTTER_WINDOWING_WIN32 \"win32\"
#define CLUTTER_INPUT_WIN32 \"win32\""])
577
AS_IF([test "x$SUPPORT_CEX100" = "x1"],
578
      [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
579
#define CLUTTER_WINDOWING_CEX100 \"cex100\""])
580 581
AS_IF([test "x$SUPPORT_EVDEV" = "x1"],
      [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
582
#define CLUTTER_INPUT_EVDEV \"evdev\""])
583 584
AS_IF([test "x$SUPPORT_TSLIB" = "x1"],
      [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
585
#define CLUTTER_INPUT_TSLIB \"tslib\""])
586 587 588
AS_IF([test "x$SUPPORT_WAYLAND" = "x1"],
      [CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
#define CLUTTER_INPUT_WAYLAND \"wayland\""])
589

590 591 592 593
# the 'null' input backend is special
CLUTTER_CONFIG_DEFINES="$CLUTTER_CONFIG_DEFINES
#define CLUTTER_INPUT_NULL \"null\""

594 595
AC_SUBST([CLUTTER_CONFIG_DEFINES])

596
dnl === Clutter substitutions kept for backwards compatibility ================
597 598 599 600 601 602 603
AC_SUBST([CLUTTER_WINSYS],       [deprecated])
AC_SUBST([CLUTTER_WINSYS_BASE],  [deprecated])
AC_SUBST([CLUTTER_STAGE_TYPE],   [deprecated])
AC_SUBST([CLUTTER_SONAME_INFIX], [deprecated])
AC_SUBST([CLUTTER_FLAVOUR],      [deprecated])
AC_SUBST([CLUTTER_COGL],         [deprecated])
AC_SUBST([COGL_DRIVER],          [deprecated])
604

605 606
dnl === X11 checks, only for X11-based backends ===============================
X11_PC_FILES=""
607
X11_EXTS=""
608
x11_tests=no
609

610
AS_IF([test "x$SUPPORT_X11" = "x1"],
611 612 613
      [
        # base X11 includes and libraries
        AC_MSG_CHECKING([for X11])
614

615 616 617 618 619
        # 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"
620 621 622 623 624

                # 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`

625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644
                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])
                      ]
                )
              ]
        )
645 646 647 648 649 650 651 652 653 654

        # 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"
655
                X11_EXTS="$X11_EXTS xext"
656 657 658 659 660

                AC_MSG_RESULT([found])
              ],
              [AC_MSG_ERROR([Not found])]
        )
661 662 663 664 665 666 667

        # 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])
668

669 670
                X11_LIBS="$X11_LIBS -lXdamage"
                X11_PC_FILES="$X11_PC_FILES xdamage"
671
                X11_EXTS="$X11_EXTS xdamage"
672

673 674 675 676
                AC_MSG_RESULT([found])
              ],
              [AC_MSG_ERROR([not found])]
        )
677

678
        # XCOMPOSITE (optional)
679 680
        AC_MSG_CHECKING([for XCOMPOSITE extension >= $XCOMPOSITE_REQ_VERSION])
        PKG_CHECK_EXISTS([xcomposite >= $XCOMPOSITE_REQ_VERSION], [have_xcomposite=yes], [have_xcomposite=no])
681 682 683
        AS_IF([test "x$have_xcomposite" = "xyes"],
              [
                AC_DEFINE(HAVE_XCOMPOSITE, [1], [Define to 1 if we have the XCOMPOSITE X extension])
684

685
                X11_LIBS="$X11_LIBS -lXcomposite"
686
                X11_PC_FILES="$X11_PC_FILES xcomposite >= $XCOMPOSITE_REQ_VERSION"
687
                X11_EXTS="$X11_EXTS xcomposite"
688

689 690
                AC_MSG_RESULT([found])
              ],
691
              [AC_MSG_ERROR([not found])]
692 693
        )

694 695 696 697 698 699 700 701 702 703
        # X Generic Extensions (optional)
        clutter_save_CPPFLAGS="$CPPFLAGS"
        CPPFLAGS="$CPPFLAGS $X11_CFLAGS"

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

        have_xge=no
        AC_CHECK_FUNC([XGetEventData],
                      [
704
                        AC_DEFINE([HAVE_XGE], [1], [Define to 1 if X Generic Extensions is available])
705
                        have_xge=yes
706
                        X11_EXTS="$X11_EXTS xge"
707 708 709 710 711
                      ])

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

712
        # XI (optional)
713
        AC_ARG_ENABLE([xinput],
714 715
                      [AS_HELP_STRING([--enable-xinput], [Use the XI X extension])],
                      [],
716
                      [enable_xinput=yes])
717

718 719 720 721 722 723 724 725 726
        AS_IF([test "x$enable_xinput" = "xyes"],
              [
                PKG_CHECK_EXISTS([xi], [have_xinput=yes], [have_xinput=no])
              ],
              [
                have_xinput=no
              ])

        AS_CASE([$have_xinput],
727 728 729

                [yes],
                [
730 731 732 733 734 735 736 737
                  AC_CHECK_HEADERS([X11/extensions/XInput2.h],
                                   [
                                     have_xinput2=yes
                                     AC_DEFINE([HAVE_XINPUT_2],
                                               [1],
                                               [Define to 1 if XI2 is available])
                                   ])

738 739 740 741 742 743 744 745
                  clutter_save_LIBS="$LIBS"
                  LIBS="$LIBS -lXi"

                  AC_CHECK_FUNC([XIAllowTouchEvents],
                                [
                                  AC_CHECK_MEMBER([XIScrollClassInfo.number],
                                                  [
                                                    have_xinput_2_2=yes
746
                                                    AC_DEFINE([HAVE_XINPUT_2_2], [1], [Define to 1 if XInput 2.2 is available])
747 748 749 750 751 752
                                                  ],
                                                  [have_xinput_2_2=no],
                                                  [[#include <X11/extensions/XInput2.h>]])])

                  LIBS="$clutter_save_LIBS"

753
                  X11_LIBS="$X11_LIBS $XINPUT_LIBS"
754
                  X11_PC_FILES="$X11_PC_FILES xi"
755 756 757 758

                  AS_IF([test "x$have_xinput_2_2" = "xyes"],
                        [X11_EXTS="$X11_EXTS xi2.2"],
                        [X11_EXTS="$X11_EXTS xi2.0"])
759 760 761
                ],

                [no],
762 763 764 765
                [have_xinput2=no],

                [*],
                [AC_MSG_ERROR([Invalid argument for --enable-xinput])]
766 767
        )

768 769 770 771 772 773 774 775 776 777 778 779
        # 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
780 781

                        X11_EXTS="$X11_EXTS xkb"
782 783 784 785 786
                      ])

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

787
        x11_tests=yes
788
        BACKEND_PC_FILES="$BACKEND_PC_FILES $X11_PC_FILES"
789 790
        FLAVOUR_LIBS="$FLAVOUR_LIBS $X11_LIBS"
        FLAVOUR_CFLAGS="$FLAVOUR_CFLAGS $X11_CFLAGS"
791 792
      ]
)
793

794
AM_CONDITIONAL([BUILD_XI2], [test "x$have_xinput2" = "xyes"])
795
AM_CONDITIONAL([X11_TESTS], [test "x$x11_tests" = "xyes"])
796

797 798 799
X11_EXTS=${X11_EXTS#* }

AC_CACHE_SAVE
800

801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827
dnl === Enable GDK-Pixbuf in tests ============================================

m4_define([pixbuf_default], [yes])
AC_ARG_ENABLE([gdk-pixbuf],
              [AS_HELP_STRING([--enable-gdk-pixbuf=@<:@no/yes@:>@],
                              [Enable tests using GDK-Pixbuf @<:@default=]pixbuf_default[@:>@])],
              [enable_pixbuf=$enable_val],
              [enable_pixbuf=pixbuf_default])

AS_CASE([$enable_pixbuf],

        [yes],
        [
          PKG_CHECK_MODULES([GDK_PIXBUF], [gdk-pixbuf-2.0])
          AC_SUBST(GDK_PIXBUF_CFLAGS)
          AC_SUBST(GDK_PIXBUF_LIBS)
          pixbuf_tests=yes
        ],

        [no],
        [
          pixbuf_tests=no
        ]
)

AM_CONDITIONAL([PIXBUF_TESTS], [test "x$pixbuf_tests" = "xyes"])

828 829 830 831 832 833 834 835 836 837 838 839
# Check for cairo_set_device_scale, as we don't want to depend hard on
# this until there is a stable release with it
saved_CFLAGS="$CFLAGS"
saved_LIBS="$LIBS"
CAIRO_CFLAGS=`$PKG_CONFIG --cflags cairo`
CAIRO_LIBS=`$PKG_CONFIG --libs cairo`
CFLAGS="$CFLAGS $CAIRO_CFLAGS"
LIBS="$CAIRO_LIBS $LIBS"
AC_CHECK_FUNCS(cairo_surface_set_device_scale)
LIBS="$saved_LIBS"
CFLAGS="$saved_CFLAGS"

840
dnl === Enable debug level ====================================================
Matthew Allum's avatar
Matthew Allum committed
841

842 843
m4_define([debug_default], [m4_if(m4_eval(clutter_minor_version % 2), [1], [yes], [minimum])])
AC_ARG_ENABLE([debug],
844
              [AS_HELP_STRING([--enable-debug=@<:@no/minimum/yes@:>@],
845
                              [Control Clutter debugging level @<:@default=]debug_default[@:>@])],
846 847 848 849 850 851 852 853
              [],
              [enable_debug=debug_default])

AS_CASE([$enable_debug],

        [yes],
        [
          test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
854
          CLUTTER_DEBUG_CFLAGS="-DCLUTTER_ENABLE_DEBUG"
855 856 857
        ],

        [minimum],
858
        [CLUTTER_DEBUG_CFLAGS="-DG_DISABLE_CAST_CHECKS"],
859 860 861 862 863 864

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

        [AC_MSG_ERROR([Unknown argument for --enable-debug])]
)
865 866 867

AC_SUBST(CLUTTER_DEBUG_CFLAGS)

868 869 870 871 872 873 874 875 876 877
dnl === Enable deprecation guards ==================================================

m4_define([deprecated_default],
          [m4_if(m4_eval(clutter_minor_version % 2),
                 [1],
                 [no],
                 [yes])])

AC_ARG_ENABLE([deprecated],
              [AS_HELP_STRING([--enable-deprecated=@<:@no/yes@:>@],
878
                              [Whether deprecated symbols should be disabled when compiling Clutter @<:@default=]deprecated_default[@:>@])],
879 880 881 882 883 884 885
              [],
              [enable_deprecated=deprecated_default])

AS_CASE([$enable_deprecated],

        [no],
        [
886
          CLUTTER_DEPRECATED_CFLAGS="-DG_DISABLE_SINGLE_INCLUDES -DCOGL_DISABLE_DEPRECATED"
887 888 889 890
        ],

        [yes],
        [
891
          CLUTTER_DEPRECATED_CFLAGS="-DGLIB_DISABLE_DEPRECATION_WARNINGS"
892 893 894 895 896 897 898
        ],

        [AC_MSG_ERROR([Unknown argument for --enable-deprecated])]
)

AC_SUBST([CLUTTER_DEPRECATED_CFLAGS])

899 900
dnl === Profiling =============================================================

901 902
m4_define([profile_default], [no])
AC_ARG_ENABLE(profile,
903
              AS_HELP_STRING([--enable-profile=@<:@no/yes@:>@],
904
                             [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@:>@]),
905
              [],
906 907 908 909
              [enable_profile=profile_default])

AS_CASE([$enable_profile],

910 911 912 913
        [yes],
        [
          AS_IF([test "x$GCC" = "xyes"],
                [
914
                  PKG_CHECK_MODULES([PROFILE_DEP], [uprof-0.3])
915
                  CLUTTER_PROFILE_CFLAGS="-DCLUTTER_ENABLE_PROFILE $PROFILE_DEP_CFLAGS"
916
                  CLUTTER_PROFILE_LDFLAGS="$PROFILE_DEP_LIBS"
917 918 919 920 921 922 923 924 925 926 927 928 929 930 931

                  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])]
932 933 934 935 936
)
AM_CONDITIONAL(PROFILE, test "x$enable_profile" != "xno")
AC_SUBST(CLUTTER_PROFILE_CFLAGS)
AC_SUBST(CLUTTER_PROFILE_LDFLAGS)

937
dnl === Enable strict compiler flags ==========================================
938

939 940 941
# use strict compiler flags only when building from git; the rules for
# distcheck will take care of turning this on when making a release
m4_define([maintainer_flags_default], [m4_if(m4_eval(clutter_micro_version % 2), [1], [yes], [no])])
942
AC_ARG_ENABLE([maintainer-flags],
943
              [AS_HELP_STRING([--enable-maintainer-flags=@<:@no/yes/error@:>@],
944
                              [Use strict compiler flags @<:@default=]maintainer_flags_default[@:>@])],
945 946 947
              [],
              [enable_maintainer_flags=maintainer_flags_default])

948
MAINTAINER_COMPILER_FLAGS="$MAINTAINER_COMPILER_FLAGS
949
                           -Wall
950
                           -Wcast-align
951 952
                           -Wuninitialized
                           -Wno-strict-aliasing
953
                           -Werror=logical-op
954 955 956 957 958 959 960 961 962 963
                           -Werror=pointer-arith
                           -Werror=missing-declarations
                           -Werror=redundant-decls
                           -Werror=empty-body
                           -Werror=format
                           -Werror=format-security
                           -Werror=format-nonliteral
                           -Werror=init-self
                           -Werror=declaration-after-statement
                           -Werror=vla"
964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982

AS_CASE([$enable_maintainer_flags],
        [yes],
        [
          AS_COMPILER_FLAGS([MAINTAINER_CFLAGS], [$MAINTAINER_COMPILER_FLAGS])
        ],

        [no],
        [
        ],

        [error],
        [
          MAINTAINER_COMPILER_FLAGS="$MAINTAINER_COMPILER_FLAGS -Werror"
          AS_COMPILER_FLAGS([MAINTAINER_CFLAGS], [$MAINTAINER_COMPILER_FLAGS])
        ],

        [*],
        [AC_MSG_ERROR([Invalid option for --enable-maintainer-flags])]
983
)
984

985
# strip leading spaces
986
MAINTAINER_CFLAGS=${MAINTAINER_CFLAGS#*  }
987
AC_SUBST(MAINTAINER_CFLAGS)
988

989
dnl === Dependencies, compiler flags and linker libraries =====================
990
# strip leading space
991
BACKEND_PC_FILES=${BACKEND_PC_FILES#* }
992

993
# public dependencies, will fill the Requires: field of clutter.pc
994
CLUTTER_REQUIRES="$CLUTTER_BASE_PC_FILES $BACKEND_PC_FILES"
995 996
PKG_CHECK_MODULES(CLUTTER_DEPS, [$CLUTTER_REQUIRES])

997 998
# private dependencies, will fill the Requires.private: field of clutter.pc
AS_IF([test "x$CLUTTER_BASE_PC_FILES_PRIVATE" = "x" && test "x$BACKEND_PC_FILES_PRIVATE" = "x"],
999 1000 1001 1002
      [
        CLUTTER_REQUIRES_PRIVATE=""
        CLUTTER_DEPS_PRIVATE_CFLAGS=""
        CLUTTER_DEPS_PRIVATE_LIBS=""
1003 1004 1005 1006
      ],
      [
        CLUTTER_REQUIRES_PRIVATE="$CLUTTER_BASE_PC_FILES_PRIVATE $BACKEND_PC_FILES_PRIVATE"
        PKG_CHECK_MODULES(CLUTTER_DEPS_PRIVATE, [$CLUTTER_REQUIRES_PRIVATE])
1007
      ])
1008

1009
AC_SUBST(CLUTTER_REQUIRES)
1010 1011
AC_SUBST(CLUTTER_REQUIRES_PRIVATE)

1012 1013
CLUTTER_CFLAGS="$FLAVOUR_CFLAGS $CLUTTER_DEPS_CFLAGS $CLUTTER_DEPS_PRIVATE_CFLAGS $CLUTTER_PROFILE_CFLAGS $GLIB_CFLAGS"
CLUTTER_LIBS="$FLAVOUR_LIBS $CLUTTER_DEPS_LIBS $CLUTTER_DEPS_PRIVATE_LIBS $CLUTTER_PROFILE_LDFLAGS $GLIB_LIBS"
1014 1015 1016
AC_SUBST(CLUTTER_CFLAGS)
AC_SUBST(CLUTTER_LIBS)

1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038
dnl === Test coverage =========================================================

AC_ARG_ENABLE([gcov],
              [AS_HELP_STRING([--enable-gcov], [Enable gcov])],
              [use_gcov=$enableval],
              [use_gcov=no])

AS_IF([test "x$use_gcov" = "xyes"],
      [
        dnl we need gcc:
        AS_IF([test "$GCC" != "yes"], [AC_MSG_ERROR([GCC is required for --enable-gcov])])

        dnl Check if ccache is being used
        AC_CHECK_PROG(SHTOOL, shtool, shtool)
        AS_CASE([`$SHTOOL path $CC`],
                [*ccache*], [gcc_ccache=yes],
                [gcc_ccache=no])

        if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then
          AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
        fi

1039
        ltp_version_list="1.6 1.7 1.8 1.9 1.10"
1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090
        AC_CHECK_PROG(LTP, lcov, lcov)
        AC_CHECK_PROG(LTP_GENHTML, genhtml, genhtml)

        if test "$LTP"; then
          AC_CACHE_CHECK([for ltp version], clutter_cv_ltp_version,
                         [
                           clutter_cv_ltp_version=invalid
                           ltp_version=`$LTP -v 2>/dev/null | $SED -e 's/^.* //'`
                           for ltp_check_version in $ltp_version_list; do
                             if test "$ltp_version" = "$ltp_check_version"; then
                               clutter_cv_ltp_version="$ltp_check_version (ok)"
                             fi
                           done
                         ])
        else
          ltp_msg="To enable code coverage reporting you must have one of the following LTP versions installed: $ltp_version_list"
          AC_MSG_ERROR([$ltp_msg])
        fi

        case $clutter_cv_ltp_version in
          ""|invalid[)]
          ltp_msg="You must have one of the following versions of LTP: $ltp_version_list (found: $ltp_version)."
          AC_MSG_ERROR([$ltp_msg])
          LTP="exit 0;"
          ;;
        esac

        if test -z "$LTP_GENHTML"; then
          AC_MSG_ERROR([Could not find genhtml from the LTP package])
        fi

        AC_DEFINE(HAVE_GCOV, 1, [Whether you have gcov])

        dnl Remove all optimization flags from CFLAGS
        changequote({,})
        CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'`
        CLUTTER_CFLAGS=`echo "$CLUTTER_CFLAGS" | $SED -e 's/-O[0-9]*//g'`
        changequote([,])

        dnl Define the special gcc flags
        CLUTTER_GCOV_CFLAGS="-O0 -fprofile-arcs -ftest-coverage"
        CLUTTER_GCOV_LDADD="-lgcov"

        AC_SUBST(CLUTTER_GCOV_CFLAGS)
        AC_SUBST(CLUTTER_GCOV_LDADD)

        CLUTTER_CFLAGS="$CLUTTER_CFLAGS $CLUTTER_GCOV_CFLAGS"
        CLUTTER_LIBS="$CLUTTER_LIBS $CLUTTER_GCOV_LDADD"
      ])

AM_CONDITIONAL(ENABLE_GCOV, test "x$use_gcov" = "xyes")
1091

1092
dnl === GObject-Introspection check ===========================================
1093

Emmanuele Bassi's avatar
Emmanuele Bassi committed
1094
GOBJECT_INTROSPECTION_CHECK([gi_req_version])
1095

1096
dnl === GTK Doc check =========================================================
1097

Emmanuele Bassi's avatar
Emmanuele Bassi committed
1098
GTK_DOC_CHECK([gtk_doc_req_version], [--flavour no-tmpl])
1099

1100
# we don't want to build the documentation from a Git clone unless we
1101 1102 1103 1104 1105
# 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
#
1106
# we use autogen.sh as it exists only inside the Git clones, and it
1107
# is not packaged into tarballs.
1108
AM_CONDITIONAL([BUILD_GTK_DOC], [test "x$enable_gtk_doc" = "xyes" || test ! -f "autogen.sh"])
1109

1110
# prefixes for fixing gtk-doc references
1111
CAIRO_PREFIX="`$PKG_CONFIG --variable=prefix cairo`"
1112 1113
GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`"
PANGO_PREFIX="`$PKG_CONFIG --variable=prefix pango`"
1114
COGL_PREFIX="`$PKG_CONFIG --variable=prefix cogl-1.0`"
Emmanuele Bassi's avatar
Emmanuele Bassi committed
1115
ATK_PREFIX="`$PKG_CONFIG --variable=prefix atk`"
1116
AC_SUBST(CAIRO_PREFIX)
1117 1118
AC_SUBST(GLIB_PREFIX)
AC_SUBST(PANGO_PREFIX)
1119
AC_SUBST(COGL_PREFIX)
Emmanuele Bassi's avatar
Emmanuele Bassi committed
1120
AC_SUBST(ATK_PREFIX)
1121

1122 1123
dnl === Manual ================================================================

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

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

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

1148 1149
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
1150

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

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

1156
GETTEXT_PACKAGE="clutter-1.0"
1157
AC_SUBST(GETTEXT_PACKAGE)
Emmanuele Bassi's avatar
Emmanuele Bassi committed
1158 1159
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],
                   ["$GETTEXT_PACKAGE"],
1160
                   [The prefix for our gettext translation domains.])
1161
AS_ALL_LINGUAS
1162

1163 1164 1165 1166
dnl = Build optionals =========================================================

dnl === Conformance test suite ================================================

1167
GLIB_TESTS
1168 1169 1170 1171 1172 1173 1174

AC_ARG_ENABLE([examples],
              [AS_HELP_STRING([--disable-examples], [Whether examples should be built])],
              [],
              [enable_examples=yes])
AM_CONDITIONAL(BUILD_EXAMPLES, [test "x$enable_examples" = "xyes"])

1175 1176
dnl ===========================================================================

1177
AC_CONFIG_FILES([
1178
	Makefile
Emmanuele Bassi's avatar
Emmanuele Bassi committed
1179 1180
        README

1181 1182 1183
	build/Makefile
	build/autotools/Makefile
	build/mingw/Makefile
Chun-wei Fan's avatar
Chun-wei Fan committed
1184 1185 1186
	build/win32/Makefile
	build/win32/vs9/Makefile
	build/win32/vs10/Makefile
1187 1188

	clutter/Makefile
1189
	clutter/config.h.win32
1190
        clutter/clutter-config.h
1191 1192 1193 1194 1195
	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

1196
	clutter/cex100/clutter-cex100.h
1197 1198 1199 1200 1201 1202 1203

	tests/Makefile
	tests/accessibility/Makefile
	tests/conform/Makefile
	tests/interactive/Makefile
	tests/interactive/wrapper.sh
	tests/micro-bench/Makefile
1204
	tests/performance/Makefile
1205

1206 1207
        examples/Makefile

1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219
	doc/Makefile
	doc/reference/Makefile
	doc/reference/clutter/Makefile
	doc/reference/clutter/clutter-docs.xml
	doc/reference/cally/Makefile
	doc/reference/cally/cally-docs.xml
	doc/common/Makefile
	doc/cookbook/Makefile
	doc/cookbook/clutter-cookbook.xml
	doc/cookbook/examples/Makefile

	po/Makefile.in
Matthew Allum's avatar
Matthew Allum committed
1220
])
1221

1222 1223
AC_OUTPUT

1224
dnl === Summary ===============================================================
1225 1226

echo ""
1227 1228
echo "Clutter - $VERSION (${CLUTTER_RELEASE_STATUS})"

1229
# Global flags
1230
echo ""
1231 1232
echo " • Global:"
echo "        Prefix: ${prefix}"
1233 1234
echo "        Libdir: ${libdir}"
echo "        Sysconfdir: ${sysconfdir}"
1235

1236
# Compiler/Debug related flags
1237
echo ""
1238 1239
echo " • Compiler options:"
echo "        Clutter debug level: ${enable_debug}"
1240
echo "        Compiler flags: ${CFLAGS} ${MAINTAINER_CFLAGS}"
1241
echo "        Profiling enabled: ${enable_profile}"
1242
echo "        Enable coverage tests: ${use_gcov}"
1243
echo "        Enable deprecated symbols: ${enable_deprecated}"
1244

1245
# Documentation
1246 1247 1248
echo ""
echo " • Documentation:"
echo "        Build API Reference: ${enable_gtk_doc}"
1249
echo "        Build Additional Documentation: ${enable_docs} (Generate PDF: ${enable_pdfs})"
1250

1251
# Miscellaneous
1252 1253 1254
echo ""
echo " • Extra:"
echo "        Build introspection data: ${enable_introspection}"
1255
if test "x$x11_tests" = "xyes"; then
1256
echo "        Build X11-specific tests: ${x11_tests}"
1257 1258
fi
if test "x$pixbuf_tests" = "xyes"; then
1259
echo "        Build tests using GDK-Pixbuf: ${pixbuf_tests}"
1260
fi
1261
echo "        Install test suites: ${enable_installed_tests}"
1262
echo "        Build examples: ${enable_examples}"
1263

1264
# Clutter backend related flags
1265
echo ""
1266
echo " • Clutter Backends:"
1267 1268

if test "x$experimental_backend" = "xno"; then
1269
echo "        Windowing systems: ${CLUTTER_BACKENDS}"
1270
else
1271
echo "        Windowing systems: ${CLUTTER_BACKENDS} (WARNING: Experimental backends enabled)"
1272
fi
1273

1274 1275 1276 1277 1278 1279
if test "x$experimental_input_backend" = "xno"; then
echo "        Input backends: ${CLUTTER_INPUT_BACKENDS}"
else
echo "        Input backends: ${CLUTTER_INPUT_BACKENDS} (WARNING: Experimental backends enabled)"
fi

1280 1281
if test "x$SUPPORT_X11" = "x1"; then
echo ""
1282 1283
echo "     - X11 backend options:"
echo "        Enabled extensions: ${X11_EXTS}"
1284 1285
fi

1286
if test "x$SUPPORT_CEX100" = "x1"; then
1287
echo ""
1288
echo "     - CEx100 backend options (WARNING: Experimental):"
1289
echo "        libGDL include prefix: ${CLUTTER_CEX100_LIBGDL_PREFIX}"
1290 1291
fi

1292 1293 1294 1295
if test "x$SUPPORT_WAYLAND_COMPOSITOR" = "x1"; then
echo ""
echo "     - Wayland compositor support enabled (WARNING: Experimental)"
fi
1296

1297 1298
echo ""

1299
# General warning about experimental features
1300
if test "x$experimental_backend" = "xyes"; then
1301
echo ""
1302 1303
echo "☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠"
echo "*WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING*"
1304 1305 1306
echo ""
echo "  The stability of your build might be affected by one or more"
echo "  experimental backends or experimental and unsupported features"
1307 1308 1309
echo ""
echo "*WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING* *WARNING*"
echo "☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠"
1310
echo ""
1311
fi