4 [cairo_version_major.cairo_version_minor.cairo_version_micro],
5 [http://bugs.freedesktop.org/enter_bug.cgi?product=cairo],
7 [http://cairographics.org/])
8 AC_CONFIG_AUX_DIR(build)
9 AC_CONFIG_MACRO_DIR(build)
10 AC_USE_SYSTEM_EXTENSIONS
11 AC_CONFIG_SRCDIR(src/cairo.h)
12 AC_CONFIG_HEADERS(config.h)
14 AC_CHECK_HEADERS([unistd.h sys/ioctl.h])
16 AM_INIT_AUTOMAKE([1.11 foreign -Wall no-define no-dist-gzip dist-xz])
17 AM_SILENT_RULES([yes])
18 m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) dnl Workaround for Automake 1.12
25 GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
29 dnl ===========================================================================
31 dnl The order of the includes here is rather important
33 m4_include(build/configure.ac.version) dnl macros setting up various version declares
34 m4_include(build/configure.ac.tools) dnl checks for tools we use
35 m4_include(build/configure.ac.features) dnl macros for backend/feature handling
36 m4_include(build/configure.ac.warnings) dnl checks for compiler warning
37 m4_include(build/configure.ac.system) dnl checks for system functions, headers, libs
38 m4_include(build/configure.ac.analysis) dnl checks for analysis tools (lcov, etc)
39 m4_include(build/configure.ac.noversion) dnl disable builtin libtool versioning
40 m4_include(build/configure.ac.pthread) dnl checks for pthreads
43 dnl ===========================================================================
45 AC_CHECK_LIB(z, compress,
46 [AC_CHECK_HEADER(zlib.h, [
48 AC_DEFINE(HAVE_ZLIB, 1, [Define to 1 if you have zlib available])
50 [have_libz="no (requires zlib http://www.gzip.org/zlib/)"])],
51 [have_libz="no (requires zlib http://www.gzip.org/zlib/)"])
54 AC_CHECK_LIB(lzo2, lzo2a_decompress,
55 [AC_CHECK_HEADER(lzo/lzo2a.h, [
57 AC_DEFINE(HAVE_LZO, 1, [Define to 1 if you have lzo available])
60 [have_lzo="no (requires lzpo http://www.oberhumer.com/opensource/lzo/)"])],
61 [have_lzo="no (requires lzpo http://www.oberhumer.com/opensource/lzo/)"])
65 AC_CHECK_LIB(dl, dlsym,
66 [have_dlsym=yes; have_dl=yes],
67 [have_dlsym=no; have_dl=no])
68 if test "x$have_dlsym" = "xno"; then
69 AC_CHECK_FUNC(dlsym, [have_dlsym=yes], [have_dlsym=no])
71 AC_CHECK_HEADERS(dlfcn.h, [have_dlsym=yes], [have_dlsym=no])
72 AM_CONDITIONAL(CAIRO_HAS_DL, test "x$have_dl" = "xyes")
73 if test "x$have_dlsym" = "xyes"; then
74 AC_DEFINE([CAIRO_HAS_DLSYM], 1, [Define to 1 if dlsym is available])
76 AM_CONDITIONAL(CAIRO_HAS_DLSYM, test "x$have_dlsym" = "xyes")
78 dnl ===========================================================================
80 CAIRO_ENABLE_SURFACE_BACKEND(xlib, Xlib, auto, [
81 xlib_REQUIRES="x11 xext"
82 PKG_CHECK_MODULES(xlib, $xlib_REQUIRES, ,
85 if test "x$no_x" = xyes; then
86 use_xlib="no (requires X development libraries)"
88 xlib_NONPKGCONFIG_LIBS="$X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS"
89 xlib_NONPKGCONFIG_CFLAGS=$X_CFLAGS
92 AC_CHECK_HEADER(sys/ipc.h)
93 AC_CHECK_HEADER(sys/shm.h)
95 if test "$ac_cv_header_sys_ipc_h" = "yes" -a "$ac_cv_header_sys_shm_h" = "yes"; then
96 AC_MSG_CHECKING(whether shmctl IPC_RMID allowes subsequent attaches)
98 #include <sys/types.h>
104 int id = shmget (IPC_PRIVATE, 4, IPC_CREAT | 0600);
105 if (id == -1) return 2;
106 shmaddr = shmat (id, 0, 0);
107 shmctl (id, IPC_RMID, 0);
108 if ((char*) shmat (id, 0, 0) == (char*) -1) {
117 AC_DEFINE(IPC_RMID_DEFERRED_RELEASE, 1,
118 [Define to 1 if shared memory segments are released deferred.])
121 AC_MSG_RESULT(assuming no))
124 AC_CHECK_HEADERS([X11/extensions/XShm.h X11/extensions/shmproto.h X11/extensions/shmstr.h], [], [],
125 [#include <X11/Xlibint.h>
126 #include <X11/Xproto.h>])
129 CAIRO_ENABLE_SURFACE_BACKEND(xlib_xrender, Xlib Xrender, auto, [
130 if test "x$use_xlib" != "xyes"; then
131 use_xlib_xrender="no (requires --enable-xlib)"
133 dnl Check for Xrender header files if the Xrender package is not installed:
134 xlib_xrender_BASE=cairo-xlib
135 xlib_xrender_REQUIRES="xrender >= 0.6"
136 PKG_CHECK_MODULES(xlib_xrender, $xlib_xrender_REQUIRES, ,
137 [xlib_xrender_REQUIRES=""
138 old_CPPFLAGS=$CPPFLAGS
139 CPPFLAGS="$CPPFLAGS $xlib_CFLAGS $xlib_NONPKGCONFIG_CFLAGS"
140 AC_CHECK_HEADER(X11/extensions/Xrender.h,
141 [xlib_xrender_NONPKGCONFIG_LIBS="-lXrender"],
142 [use_xlib_xrender="no (requires $xlib_xrender_REQUIRES http://freedesktop.org/Software/xlibs)"],
143 [#include <X11/X.h>])
144 CPPFLAGS=$old_CPPFLAGS
149 CFLAGS="$CFLAGS $xlib_CFLAGS $xlib_NONPKGCONFIG_CFLAGS $xlib_xrender_CFLAGS $xlib_xrender_NONPKGCONFIG_CFLAGS"
150 LIBS="$LIBS $xlib_LIBS $xlib_NONPKGCONFIG_LIBS $xlib_xrender_LIBS $xlib_xrender_NONPKGCONFIG_LIBS"
151 AC_CHECK_FUNCS([XRenderCreateSolidFill XRenderCreateLinearGradient XRenderCreateRadialGradient XRenderCreateConicalGradient])
158 dnl ===========================================================================
160 CAIRO_ENABLE_SURFACE_BACKEND(xcb, XCB, auto, [
161 xcb_REQUIRES="xcb >= 1.6 xcb-render >= 1.6"
162 PKG_CHECK_MODULES(xcb, $xcb_REQUIRES, ,
163 [use_xcb="no (requires $xcb_REQUIRES http://xcb.freedesktop.org)"])
166 CAIRO_ENABLE_FUNCTIONS(xlib_xcb, Xlib/XCB, no, [
167 if test "x$use_xcb" = "xyes" -a "x$use_xlib" = "xyes"; then
168 xlib_xcb_REQUIRES="x11-xcb"
169 PKG_CHECK_MODULES(xlib_xcb, $xlib_xcb_REQUIRES, ,
170 [use_xlib_xcb="no (requires $xlib_xcb_REQUIRES http://xcb.freedesktop.org)"])
172 use_xlib_xcb="no (requires both --enable-xlib and --enable-xcb)"
176 CAIRO_ENABLE_FUNCTIONS(xcb_shm, XCB/SHM, auto, [
177 if test "x$use_xcb" = "xyes"; then
178 xcb_shm_REQUIRES="xcb-shm"
179 PKG_CHECK_MODULES(xcb_shm, $xcb_shm_REQUIRES, ,
180 [use_xcb_shm="no (requires $xcb_shm http://xcb.freedesktop.org)"])
182 use_xcb_shm="no (requires --enable-xcb)"
186 dnl ===========================================================================
188 CAIRO_ENABLE_SURFACE_BACKEND(qt, Qt, no, [
189 qt_REQUIRES="QtGui >= 4.4.0"
190 PKG_CHECK_MODULES(qt, $qt_REQUIRES, ,
192 use_qt="no (requires Qt4 development libraries)"
194 qt_NONPKGCONFIG_LIBS="-lstdc++"
197 dnl ===========================================================================
199 CAIRO_ENABLE_SURFACE_BACKEND(quartz, Quartz, auto, [
200 dnl There is no pkgconfig for quartz; lets do a header check
201 AC_CHECK_HEADER(ApplicationServices/ApplicationServices.h, , [use_quartz="no (requires ApplicationServices framework)"])
202 if test "x$use_quartz" != "xyes" ; then
203 dnl check for CoreGraphics as a separate framework
204 AC_CHECK_HEADER(CoreGraphics/CoreGraphics.h, , [use_quartz="no (requires CoreGraphics framework)"])
205 quartz_LIBS="-Xlinker -framework -Xlinker CoreGraphics"
207 quartz_LIBS="-Xlinker -framework -Xlinker ApplicationServices"
211 CAIRO_ENABLE_FONT_BACKEND(quartz_font, Quartz, auto, [
212 use_quartz_font=$use_quartz
215 CAIRO_ENABLE_SURFACE_BACKEND(quartz_image, Quartz Image, no, [
216 use_quartz_image=$use_quartz
219 dnl ===========================================================================
221 CAIRO_ENABLE_SURFACE_BACKEND(win32, Microsoft Windows, auto, [
222 if test "x$have_windows" != xyes; then
223 use_win32="no (requires a Win32 platform)"
225 win32_LIBS="-lgdi32 -lmsimg32"
228 CAIRO_ENABLE_FONT_BACKEND(win32_font, Microsoft Windows, auto, [
229 use_win32_font=$use_win32
232 test_win32_printing=no
233 if test "x$use_win32" = "xyes"; then
234 AC_CHECK_PROG(GS, gs, gs)
236 AC_DEFINE([CAIRO_CAN_TEST_WIN32_PRINTING_SURFACE], 1, [Define to 1 if the Win32 Printing backend can be tested (needs ghostscript)])
237 test_win32_printing="yes"
239 AC_MSG_WARN([Win32 Printing backend will not be tested since ghostscript is not available])
240 test_win32_printing="no (requires ghostscript)"
244 AM_CONDITIONAL(CAIRO_CAN_TEST_WIN32_PRINTING_SURFACE, test "x$test_win32_printing" = "xyes")
246 dnl ===========================================================================
248 CAIRO_ENABLE_SURFACE_BACKEND(skia, Skia, no, [
250 [AS_HELP_STRING([--with-skia=/path/to/skia],
251 [directory to find compiled skia sources])],
252 [skia_DIR="$withval"],
253 [skia_DIR="`pwd`/../skia"])
254 AC_ARG_WITH([skia-build-type],
255 [AS_HELP_STRING([--with-skia-build-type=(Release|Debug)]
256 [build of skia to link with, default is Release])],
257 [skia_BUILD_TYPE="$withval"],
258 [skia_BUILD_TYPE="Release"])
259 skia_NONPKGCONFIG_CFLAGS="-I$skia_DIR/include/config -I$skia_DIR/include/core -I$skia_DIR/include/effects"
260 if test "x$skia_BUILD_TYPE" = "xRelease"; then
261 skia_NONPKGCONFIG_CFLAGS="-DSK_RELEASE -DSK_CAN_USE_FLOAT $skia_NONPKGCONFIG_CFLAGS"
263 skia_NONPKGCONFIG_LIBS="-L$skia_DIR/out/$skia_BUILD_TYPE/lib.target/ -lskia -lstdc++"
267 dnl ===========================================================================
269 CAIRO_ENABLE_SURFACE_BACKEND(os2, OS/2, no, [
275 use_os2="no (requires an OS/2 platform)"
280 dnl ===========================================================================
282 CAIRO_ENABLE_SURFACE_BACKEND(beos, BeOS/Zeta, no, [
286 dnl Add libbe and libzeta if available
287 AC_CHECK_LIB(be,main,beos_LIBS="$beos_LIBS -lbe")
288 AC_CHECK_LIB(zeta,main,beos_LIBS="$beos_LIBS -lzeta")
291 use_beos="no (requires a BeOS platform)"
296 dnl ===========================================================================
298 CAIRO_ENABLE_SURFACE_BACKEND(drm, DRM, no, [
299 drm_REQUIRES="libudev >= 136"
300 PKG_CHECK_MODULES(drm, $drm_REQUIRES, ,
301 [use_drm="no (requires $drm_REQUIRES, udev is available from git://git.kernel.org/pub/scm/linux/hotplug/udev.git)"])
304 CAIRO_ENABLE_SURFACE_BACKEND(gallium, Gallium3D, no, [
305 if test "x$use_drm" = "xyes"; then
306 AC_ARG_WITH([gallium],
307 [AS_HELP_STRING([--with-gallium=/path/to/mesa],
308 [directory to find gallium enabled mesa])],
309 [mesa_DIR="$withval"],
310 [mesa_DIR="`pwd`/../mesa"])
311 gallium_DIR="$mesa_DIR/src/gallium"
312 gallium_NONPKGCONFIG_CFLAGS="-I$mesa_DIR/include -I$mesa_DIR/src/mesa -I$gallium_DIR/include -I$gallium_DIR/auxiliary"
313 gallium_NONPKGCONFIG_LIBS="-lGL"
315 AC_SUBST(gallium_DIR)
317 use_gallium="no (requires --enable-drm)"
321 dnl ===========================================================================
323 CAIRO_ENABLE_FUNCTIONS(png, PNG, yes, [
325 AC_ARG_VAR([png_REQUIRES], [module name for libpng to search for using pkg-config])
326 if test "x$png_REQUIRES" = x; then
327 # libpng13 is GnuWin32's libpng-1.2.8 :-(
328 for l in libpng libpng14 libpng12 libpng13 libpng10; do
329 if $PKG_CONFIG --exists $l ; then
339 if test "x$use_png" = "xyes" ; then
340 PKG_CHECK_MODULES(png, $png_REQUIRES, , : )
342 AC_MSG_WARN([Could not find libpng in the pkg-config search path])
346 dnl ===========================================================================
347 CAIRO_ENABLE_SURFACE_BACKEND(gl, OpenGL, no, [
349 PKG_CHECK_MODULES(gl, $gl_REQUIRES,, [
350 dnl Fallback to searching for headers
351 AC_CHECK_HEADER(GL/gl.h,, [use_gl="no (gl.pc nor OpenGL headers not found)"])
352 if test "x$use_gl" = "xyes"; then
353 gl_NONPKGCONFIG_CFLAGS=
354 gl_NONPKGCONFIG_LIBS="-lGL"
357 if test "x$have_dl" = "xyes" -a "x$have_dlsym" = "xyes"; then
358 gl_LIBS="$gl_LIBS -ldl"
361 need_glx_functions=yes
362 need_wgl_functions=yes
363 need_egl_functions=yes
366 dnl ===========================================================================
367 CAIRO_ENABLE_SURFACE_BACKEND(glesv2, OpenGLESv2, no, [
368 glesv2_REQUIRES="glesv2"
369 PKG_CHECK_MODULES(glesv2, $glesv2_REQUIRES,, [
370 dnl Fallback to searching for headers
371 AC_CHECK_HEADER(GLES2/gl2.h,, [use_glesv2="no (glesv2.pc nor OpenGL ES 2.0 headers not found)"])
372 if test "x$use_glesv2" = "xyes"; then
373 glesv2_NONPKGCONFIG_CFLAGS=
374 glesv2_NONPKGCONFIG_LIBS="-lGLESv2"
377 if test "x$have_dl" = "xyes" -a "x$have_dlsym" = "xyes"; then
378 glesv2_LIBS="$glesv2_LIBS -ldl"
381 if test "x$use_glesv2" = "xyes" -a "x$use_gl" = "xyes"; then
382 AC_MSG_ERROR([use either --enable-gl=yes or --enable-glesv2=yes. Not both at the same time.])
385 need_egl_functions=yes
388 dnl ===========================================================================
389 CAIRO_ENABLE_SURFACE_BACKEND(cogl, Cogl, no, [
390 cogl_REQUIRES="cogl-2.0-experimental"
391 PKG_CHECK_MODULES(cogl, $cogl_REQUIRES,, [use_cogl="no"])
394 dnl ===========================================================================
396 CAIRO_ENABLE_SURFACE_BACKEND(directfb, directfb, no, [
397 directfb_REQUIRES=directfb
398 PKG_CHECK_MODULES(directfb, $directfb_REQUIRES, ,
399 [use_directfb="no (requires $directfb_REQUIRES http://www.directfb.org)"])
402 dnl ===========================================================================
404 CAIRO_ENABLE_SURFACE_BACKEND(vg, OpenVG, no, [
405 dnl There is no pkgconfig for OpenVG; lets do a header check
406 AC_CHECK_HEADER(VG/openvg.h,, [use_vg="no (OpenVG headers not found)"])
407 if test "x$use_vg" = "xyes"; then
408 vg_NONPKGCONFIG_CFLAGS=
409 vg_NONPKGCONFIG_LIBS="-lOpenVG"
410 need_egl_functions=yes
411 need_glx_functions=yes
415 CAIRO_ENABLE_FUNCTIONS(egl, EGL, auto, [
416 if test "x$need_egl_functions" = "xyes"; then
418 PKG_CHECK_MODULES(egl, $egl_REQUIRES, ,
420 AC_CHECK_HEADER(EGL/egl.h,, [use_egl="no (EGL headers not found)"])
421 if test "x$use_egl" = "xyes"; then
422 egl_NONPKGCONFIG_CFLAGS=
423 egl_NONPKGCONFIG_LIBS=
426 # Temporary workaround for missing link from egl13
427 AC_CHECK_LIB(csi, csi_stream_attachresource, other_egl_LIBS="-lcsi")
428 LIBS="$other_egl_LIBS $LIBS"
429 for egl_lib in EGL egl13 egl12 egl11; do
430 if test -z "$egl_NONPKGCONFIG_LIBS"; then
431 AC_CHECK_LIB($egl_lib, eglGetError, egl_NONPKGCONFIG_LIBS="-l$egl_lib")
434 if test -z "$egl_NONPKGCONFIG_LIBS"; then
435 use_egl="no (EGL library not found)"
437 egl_NONPKGCONFIG_LIBS="$egl_NONPKGCONFIG_LIBS $other_egl_LIBS"
443 use_egl="no (not required by any backend)"
447 CAIRO_ENABLE_FUNCTIONS(glx, GLX, auto, [
448 if test "x$need_glx_functions" = "xyes"; then
449 save_CFLAGS="$CFLAGS"
450 CFLAGS="$CFLAGS $gl_CFLAGS $gl_NONPKGCONFIG_CFLAGS"
451 AC_CHECK_HEADER(GL/glx.h,, [use_glx="no (GLX headers not found)"])
452 glx_NONPKGCONFIG_CFLAGS=
453 glx_NONPKGCONFIG_LIBS="-lGL"
454 CFLAGS="$save_CFLAGS"
456 use_glx="no (not required by any backend)"
460 CAIRO_ENABLE_FUNCTIONS(wgl, WGL, auto, [
461 if test "x$need_wgl_functions" = "xyes"; then
462 AC_CHECK_HEADER(windows.h,, [use_wgl="no (WGL headers not found)"])
464 use_wgl="no (not required by any backend)"
468 dnl ===========================================================================
471 CAIRO_ENABLE_SURFACE_BACKEND(script, script, yes, [
475 dnl ===========================================================================
477 # We use pkg-config to look for freetype2, but fall back to
478 # freetype-config if it fails. We prefer pkg-config, since we can
479 # then just put freetype2 >= $FREETYPE_MIN_VERSION in
480 # Requires.private, but at least up to 2003-06-07, there was no
481 # freetype2.pc in the release.
483 # FreeType versions come in three forms:
484 # release (such as 2.1.9)
485 # libtool (such as 9.7.3) (returned by freetype-config and pkg-config)
486 # platform-specific/soname (such as 6.3.4)
487 # and they recommend you never use the platform-specific version
488 # (see docs/VERSION.DLL in freetype2 sources)
490 # Set these as appropriate:
492 # release number - for information only
493 FREETYPE_MIN_RELEASE=2.1.9
494 # libtool-specific version - this is what is checked
495 FREETYPE_MIN_VERSION=9.7.3
497 CAIRO_ENABLE_FONT_BACKEND(ft, FreeType, auto, [
499 PKG_CHECK_MODULES(FREETYPE, freetype2 >= $FREETYPE_MIN_VERSION,
500 [freetype_pkgconfig=yes],
501 [freetype_pkgconfig=no])
503 if test "x$freetype_pkgconfig" = "xyes"; then
504 ft_REQUIRES="freetype2 >= $FREETYPE_MIN_VERSION $ft_REQUIRES"
507 if test -z "$FREETYPE_CONFIG"; then
508 AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
510 if test "x$FREETYPE_CONFIG" = "xno" ; then
511 use_ft='no (freetype-config not found in path or $FREETYPE_CONFIG)'
513 AC_MSG_CHECKING(freetype2 libtool version)
515 FREETYPE_VERSION=`$FREETYPE_CONFIG --version`
516 AX_COMPARE_VERSION([$FREETYPE_VERSION], [gt], [$FREETYPE_MIN_VERSION],
517 [AC_MSG_RESULT($FREETYPE_VERSION - OK)
518 ft_NONPKGCONFIG_CFLAGS=`$FREETYPE_CONFIG --cflags`
519 ft_NONPKGCONFIG_LIBS=`$FREETYPE_CONFIG --libs`],
520 [AC_MSG_RESULT($FREETYPE_VERSION - Too old)
521 use_ft="no ($FREETYPE_VERSION found; version $FREETYPE_MIN_VERSION from release $FREETYPE_MIN_RELEASE required)"])
525 ft_CFLAGS="$FREETYPE_CFLAGS"
526 ft_LIBS="$FREETYPE_LIBS"
529 FONTCONFIG_MIN_VERSION=2.2.95
530 CAIRO_ENABLE_FONT_BACKEND(fc, Fontconfig, auto, [
532 if test "x$use_fc" = "xyes"; then
533 fc_REQUIRES="fontconfig >= $FONTCONFIG_MIN_VERSION"
534 PKG_CHECK_MODULES(FONTCONFIG, $fc_REQUIRES,,
535 [use_fc="no (requires $fc_REQUIRES)"])
537 fc_CFLAGS="$FONTCONFIG_CFLAGS"
538 fc_LIBS="$FONTCONFIG_LIBS"
541 if test "x$use_ft" = "xyes"; then
543 _save_cflags="$CFLAGS"
544 LIBS="$LIBS $ft_LIBS"
545 CFLAGS="$CFLAGS $ft_CFLAGS"
547 AC_CHECK_FUNCS(FT_Get_X11_Font_Format FT_GlyphSlot_Embolden FT_GlyphSlot_Oblique FT_Load_Sfnt_Table FT_Library_SetLcdFilter)
550 CFLAGS="$_save_cflags"
553 if test "x$use_fc" = "xyes"; then
554 CAIRO_CHECK_FUNCS_WITH_FLAGS(FcInit FcFini, [$FONTCONFIG_CFLAGS], [$FONTCONFIG_LIBS])
557 dnl ===========================================================================
559 CAIRO_ENABLE_SURFACE_BACKEND(ps, PostScript, yes, [
560 # The ps backend requires zlib.
562 ps_NONPKGCONFIG_LIBS=-lz
565 dnl ===========================================================================
567 SPECTRE_VERSION_REQUIRED=0.2.0
570 if test "x$use_ps" = "xyes"; then
571 AC_CHECK_PROG(GS, gs, gs)
573 AC_DEFINE([CAIRO_CAN_TEST_PS_SURFACE], 1, [Define to 1 if the PS backend can be tested (needs ghostscript)])
576 AC_MSG_WARN([PS backend will not be tested since ghostscript is not available])
577 test_ps="no (requires ghostscript)"
580 libspectre_DEPENDENCY="libspectre >= $SPECTRE_VERSION_REQUIRED"
581 PKG_CHECK_MODULES(LIBSPECTRE, $libspectre_DEPENDENCY,
583 [test_ps="no (requires libspectre)"])
586 AM_CONDITIONAL(CAIRO_CAN_TEST_PS_SURFACE, test "x$test_ps" = "xyes")
587 AM_CONDITIONAL(CAIRO_HAS_SPECTRE, test "x$any2ppm_ps" = "xyes")
588 if test "x$any2ppm_ps" = "xyes"; then
589 AC_DEFINE([CAIRO_HAS_SPECTRE], 1, [Define to 1 if libspectre is available])
591 AC_SUBST(LIBSPECTRE_CFLAGS)
592 AC_SUBST(LIBSPECTRE_LIBS)
594 dnl ===========================================================================
596 CAIRO_ENABLE_SURFACE_BACKEND(pdf, PDF, yes, [
597 # The pdf backend requires zlib.
599 pdf_NONPKGCONFIG_LIBS=-lz
602 dnl ===========================================================================
604 # poppler-0.17.4 fixes text-pattern and text-transform
605 POPPLER_VERSION_REQUIRED=0.17.4
608 if test "x$use_pdf" = "xyes"; then
609 poppler_DEPENDENCY="poppler-glib >= $POPPLER_VERSION_REQUIRED"
610 PKG_CHECK_MODULES(POPPLER, $poppler_DEPENDENCY,
611 [CAIRO_CHECK_FUNCS_WITH_FLAGS(poppler_page_render, [$POPPLER_CFLAGS], [$POPPLER_LIBS],
612 [test_pdf=yes; any2ppm_pdf=yes],
613 [test_pdf="no (requires $poppler_DEPENDENCY)"])],
614 [test_pdf="no (requires $poppler_DEPENDENCY)"])
615 if test "x$test_pdf" = "xyes"; then
616 AC_DEFINE([CAIRO_CAN_TEST_PDF_SURFACE], 1, [Define to 1 if the PDF backend can be tested (need poppler and other dependencies for pdf2png)])
618 AC_MSG_WARN([PDF backend will not be tested since poppler >= $POPPLER_VERSION_REQUIRED is not available])
622 AM_CONDITIONAL(CAIRO_CAN_TEST_PDF_SURFACE, test "x$test_pdf" = "xyes")
623 AC_SUBST(POPPLER_CFLAGS)
624 AC_SUBST(POPPLER_LIBS)
626 AM_CONDITIONAL(CAIRO_HAS_MULTI_PAGE_SURFACES, test "x$use_ps" = "xyes" -o "x$use_pdf" = "xyes")
628 dnl ===========================================================================
630 CAIRO_ENABLE_SURFACE_BACKEND(svg, SVG, yes, [
631 if test "x$use_png" != "xyes"; then
632 use_svg="no (requires --enable-png)"
636 LIBRSVG_VERSION_REQUIRED=2.35.0
639 if test "x$use_svg" = "xyes"; then
640 librsvg_DEPENDENCY="librsvg-2.0 >= $LIBRSVG_VERSION_REQUIRED"
641 PKG_CHECK_MODULES(LIBRSVG, $librsvg_DEPENDENCY gdk-2.0,
642 [CAIRO_CHECK_FUNCS_WITH_FLAGS(rsvg_pixbuf_from_file, [$LIBRSVG_CFLAGS], [$LIBRSVG_LIBS],
643 [test_svg=yes; any2ppm_svg=yes],
644 [test_svg="no (requires $librsvg_DEPENDENCY)"])],
645 [test_svg="no (requires $librsvg_DEPENDENCY)"])
646 if test "x$test_svg" = "xyes"; then
647 AC_DEFINE([CAIRO_CAN_TEST_SVG_SURFACE], 1, [Define to 1 if the SVG backend can be tested])
649 AC_MSG_WARN([SVG backend will not be tested since librsvg >= $LIBRSVG_VERSION_REQUIRED is not available])
653 AM_CONDITIONAL(CAIRO_CAN_TEST_SVG_SURFACE, test "x$test_svg" = "xyes")
654 AC_SUBST(LIBRSVG_CFLAGS)
655 AC_SUBST(LIBRSVG_LIBS)
657 dnl ===========================================================================
659 dnl XXX make this a private feature?
660 CAIRO_ENABLE(test_surfaces, test surfaces, no)
662 dnl ===========================================================================
664 CAIRO_ENABLE_SURFACE_BACKEND(image, image, always, [
665 pixman_REQUIRES="pixman-1 >= 0.30.0"
666 PKG_CHECK_MODULES(pixman, $pixman_REQUIRES, ,
667 [use_image="no (requires $pixman_REQUIRES http://cairographics.org/releases/)"])
668 image_REQUIRES=$pixman_REQUIRES
669 image_CFLAGS=$pixman_CFLAGS
670 image_LIBS=$pixman_LIBS
673 if pkg-config --exists 'pixman-1 >= 0.27.1'; then
674 AC_DEFINE([HAS_PIXMAN_GLYPHS], 1, [Enable pixman glyph cache])
678 dnl ===========================================================================
680 CAIRO_ENABLE_SURFACE_BACKEND(mime, mime, always)
681 CAIRO_ENABLE_SURFACE_BACKEND(recording, recording, always)
682 CAIRO_ENABLE_SURFACE_BACKEND(observer, observer, always)
683 CAIRO_ENABLE_SURFACE_BACKEND(tee, tee, no)
684 CAIRO_ENABLE_SURFACE_BACKEND(xml, xml, no, [
686 xml_NONPKGCONFIG_LIBS=-lz
689 dnl ===========================================================================
691 CAIRO_ENABLE_FONT_BACKEND(user, user, always)
693 dnl ===========================================================================
695 dnl This needs to be last on our list of features so that the pthread libs and flags
696 dnl gets prefixed in front of everything else in CAIRO_{CFLAGS,LIBS}.
700 CAIRO_ENABLE(pthread, pthread, auto, [CAIRO_CONFIGURE_PTHREAD])
701 AM_CONDITIONAL(HAVE_REAL_PTHREAD, test "x$use_pthread" = "xyes" -a "x$have_real_pthread" = "xyes")
702 AM_CONDITIONAL(HAVE_PTHREAD, test "x$use_pthread" = "xyes")
703 AC_SUBST(pthread_CFLAGS)
704 AC_SUBST(pthread_LIBS)
705 AC_SUBST(real_pthread_CFLAGS)
706 AC_SUBST(real_pthread_LIBS)
709 dnl ===========================================================================
710 dnl Build gobject integration library
712 CAIRO_ENABLE_FUNCTIONS(gobject, gobject, auto, [
713 gobject_REQUIRES="gobject-2.0 glib-2.0 >= 2.14"
714 PKG_CHECK_MODULES(GOBJECT, $gobject_REQUIRES, ,
715 [use_gobject="no (requires $gobject_REQUIRES http://download.gnome.org/pub/GNOME/sources/glib/)"])
716 gobject_NONPKGCONFIG_EXTRA_LIBS="-L\${libdir} -lcairo-gobject"
718 dnl I'm too lazy to fix the caching properly
719 if test "x$use_gobject" = "xyes"; then
720 PKG_CHECK_MODULES(GOBJECT, $gobject_REQUIRES, : )
723 dnl ===========================================================================
724 dnl Default to quick testing during development, but force a full test before
727 AC_ARG_ENABLE(full-testing,
728 AS_HELP_STRING([--enable-full-testing],
729 [Sets the test suite to perform full testing by default, which
730 will dramatically slow down make check, but is a
731 *requirement* before release.]), [
732 if test "x$enableval" = "xyes"; then
734 AC_SUBST(CAIRO_TEST_MODE)
738 dnl ===========================================================================
739 dnl Build the external converter if we have any of the test backends
740 AM_CONDITIONAL(BUILD_ANY2PPM,
741 test "x$any2ppm_svg" = "xyes" \
742 -o "x$any2ppm_pdf" = "xyes" \
743 -o "x$any2ppm_ps" = "xyes" \
744 -o "x$any2ppm_cs" = "xyes")
746 dnl ===========================================================================
747 dnl Some utilities need to dlopen the shared libraries, so they need to
748 dnl know how libtools will name them
758 AC_DEFINE_UNQUOTED(SHARED_LIB_EXT, "${SHLIB_EXT}", [Shared library file extension])
761 dnl ===========================================================================
762 dnl The tracing utility requires LD_PRELOAD, so only build it for systems
763 dnl that are known to work.
766 *-linux*|*-*bsd*|*-solaris*|*-*-darwin*|*-dragonfly*|*-*-gnu*)
767 have_ld_preload="yes"
774 CAIRO_ENABLE(trace, cairo-trace, auto, [
775 if test "x$have_ld_preload" != "xyes" -o \
776 "x$have_libz" != "xyes" -o \
777 "x$have_real_pthread" != "xyes" -o \
778 "x$have_dlsym" != "xyes"; then
779 use_trace="no (requires dynamic linker and zlib and real pthreads)"
783 CAIRO_ENABLE(interpreter, cairo-script-interpreter, yes, [
784 if test "x$have_libz" != "xyes"; then
785 use_interpreter="no (requires zlib)"
789 AC_CHECK_LIB(bfd, bfd_openr,
790 [AC_CHECK_HEADER(bfd.h, [have_bfd=yes],
791 [have_bfd=no])], [have_bfd=no])
792 AC_CHECK_HEADER(libiberty.h,, [have_bfd=no])
793 if test "x$have_bfd" = "xyes"; then
794 AC_DEFINE([HAVE_BFD], [1], [Define to 1 if you have the binutils development files installed])
799 CAIRO_ENABLE(symbol_lookup, symbol-lookup, auto, [
800 if test "x$have_bfd" != "xyes"; then
801 use_symbol_lookup="no (requires bfd)"
805 PKG_CHECK_MODULES(glib, glib-2.0, have_glib=yes, have_glib=no)
806 AC_SUBST(glib_CFLAGS)
808 AM_CONDITIONAL(BUILD_SPHINX, test "x$have_glib" = "xyes" -a "x$have_windows" = "xno")
811 AC_CHECK_LIB(rt, shm_open, shm_LIBS="-lrt")
815 dnl ===========================================================================
817 AC_ARG_ENABLE(some-floating-point,
818 AS_HELP_STRING([--disable-some-floating-point],
819 [Disable certain code paths that rely heavily on double precision
820 floating-point calculation. This option can improve
821 performance on systems without a double precision floating-point
822 unit, but might degrade performance on those that do.]), [
823 if test "x$enableval" = "xno"; then
824 # A value of 'no' for $enableval means that they want to disable, which
825 # means 'yes' for $disable_some_floating_point.
826 disable_some_floating_point=yes
828 ], [disable_some_floating_point=no])
830 AM_CONDITIONAL(DISABLE_SOME_FLOATING_POINT,
831 test "x$disable_some_floating_point" = "xyes")
832 if test "x$disable_some_floating_point" = "xyes"; then
833 AC_DEFINE(DISABLE_SOME_FLOATING_POINT, 1,
834 [Define to 1 to disable certain code paths that rely heavily on
835 double precision floating-point calculation])
838 dnl ===========================================================================
840 dnl Extra stuff we need to do when building C++ code
842 AS_IF([test "x$use_skia" = "xyes"], [need_cxx="yes"])
843 AS_IF([test "x$use_qt" = "xyes"], [need_cxx="yes"])
844 AS_IF([test "x$use_beos" = "xyes"], [need_cxx="yes"])
846 AM_CONDITIONAL(BUILD_CXX, test "x$need_cxx" = "xyes")
848 dnl ===========================================================================
850 # We use GTK+ for some utility/debugging tools
851 PKG_CHECK_MODULES(gtk, "gtk+-2.0",have_gtk=yes, have_gtk=no)
852 AM_CONDITIONAL(HAVE_GTK, test "x$have_gtk" = "xyes")
863 util/cairo-fdr/Makefile
864 util/cairo-gobject/Makefile
865 util/cairo-missing/Makefile
866 util/cairo-script/Makefile
867 util/cairo-script/examples/Makefile
868 util/cairo-sphinx/Makefile
869 util/cairo-trace/Makefile
870 util/cairo-trace/cairo-trace
874 AC_CONFIG_COMMANDS([cairo-trace],
875 [chmod a+x util/cairo-trace/cairo-trace])