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 AM_INIT_AUTOMAKE([1.11 foreign -Wall no-define no-dist-gzip dist-xz])
15 AM_SILENT_RULES([yes])
22 GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
26 dnl ===========================================================================
28 dnl The order of the includes here is rather important
30 m4_include(build/configure.ac.version) dnl macros setting up various version declares
31 m4_include(build/configure.ac.tools) dnl checks for tools we use
32 m4_include(build/configure.ac.features) dnl macros for backend/feature handling
33 m4_include(build/configure.ac.warnings) dnl checks for compiler warning
34 m4_include(build/configure.ac.system) dnl checks for system functions, headers, libs
35 m4_include(build/configure.ac.analysis) dnl checks for analysis tools (lcov, etc)
36 m4_include(build/configure.ac.noversion) dnl disable builtin libtool versioning
37 m4_include(build/configure.ac.pthread) dnl checks for pthreads
40 dnl ===========================================================================
42 AC_CHECK_LIB(z, compress,
43 [AC_CHECK_HEADER(zlib.h, [
45 AC_DEFINE(HAVE_ZLIB, 1, [Define to 1 if you have zlib available])
47 [have_libz="no (requires zlib http://www.gzip.org/zlib/)"])],
48 [have_libz="no (requires zlib http://www.gzip.org/zlib/)"])
51 AC_CHECK_LIB(lzo2, lzo2a_decompress,
52 [AC_CHECK_HEADER(lzo/lzo2a.h, [
54 AC_DEFINE(HAVE_LZO, 1, [Define to 1 if you have lzo available])
57 [have_lzo="no (requires lzpo http://www.oberhumer.com/opensource/lzo/)"])],
58 [have_lzo="no (requires lzpo http://www.oberhumer.com/opensource/lzo/)"])
62 AC_CHECK_LIB(dl, dlsym,
63 [have_dlsym=yes; have_dl=yes],
64 [have_dlsym=no; have_dl=no])
65 if test "x$have_dlsym" = "xno"; then
66 AC_CHECK_FUNC(dlsym, [have_dlsym=yes], [have_dlsym=no])
68 AC_CHECK_HEADERS(dlfcn.h, [have_dlsym=yes], [have_dlsym=no])
69 AM_CONDITIONAL(CAIRO_HAS_DL, test "x$have_dl" = "xyes")
70 if test "x$have_dlsym" = "xyes"; then
71 AC_DEFINE([CAIRO_HAS_DLSYM], 1, [Define to 1 if dlsym is available])
73 AM_CONDITIONAL(CAIRO_HAS_DLSYM, test "x$have_dlsym" = "xyes")
75 dnl ===========================================================================
77 CAIRO_ENABLE_SURFACE_BACKEND(xlib, Xlib, auto, [
78 xlib_REQUIRES="x11 xext"
79 PKG_CHECK_MODULES(xlib, $xlib_REQUIRES, ,
82 if test "x$no_x" = xyes; then
83 use_xlib="no (requires X development libraries)"
85 xlib_NONPKGCONFIG_LIBS="$X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS"
86 xlib_NONPKGCONFIG_CFLAGS=$X_CFLAGS
89 AC_CHECK_HEADER(sys/ipc.h)
90 AC_CHECK_HEADER(sys/shm.h)
92 if test "$ac_cv_header_sys_ipc_h" = "yes" -a "$ac_cv_header_sys_shm_h" = "yes"; then
93 AC_MSG_CHECKING(whether shmctl IPC_RMID allowes subsequent attaches)
95 #include <sys/types.h>
101 int id = shmget (IPC_PRIVATE, 4, IPC_CREAT | 0600);
102 if (id == -1) return 2;
103 shmaddr = shmat (id, 0, 0);
104 shmctl (id, IPC_RMID, 0);
105 if ((char*) shmat (id, 0, 0) == (char*) -1) {
114 AC_DEFINE(IPC_RMID_DEFERRED_RELEASE, 1,
115 [Define to 1 if shared memory segments are released deferred.])
118 AC_MSG_RESULT(assuming no))
121 AC_CHECK_HEADERS([X11/extensions/XShm.h X11/extensions/shmproto.h X11/extensions/shmstr.h], [], [],
122 [#include <X11/Xlibint.h>
123 #include <X11/Xproto.h>])
126 CAIRO_ENABLE_SURFACE_BACKEND(xlib_xrender, Xlib Xrender, auto, [
127 if test "x$use_xlib" != "xyes"; then
128 use_xlib_xrender="no (requires --enable-xlib)"
130 dnl Check for Xrender header files if the Xrender package is not installed:
131 xlib_xrender_BASE=cairo-xlib
132 xlib_xrender_REQUIRES="xrender >= 0.6"
133 PKG_CHECK_MODULES(xlib_xrender, $xlib_xrender_REQUIRES, ,
134 [xlib_xrender_REQUIRES=""
135 old_CPPFLAGS=$CPPFLAGS
136 CPPFLAGS="$CPPFLAGS $xlib_CFLAGS $xlib_NONPKGCONFIG_CFLAGS"
137 AC_CHECK_HEADER(X11/extensions/Xrender.h,
138 [xlib_xrender_NONPKGCONFIG_LIBS="-lXrender"],
139 [use_xlib_xrender="no (requires $xlib_xrender_REQUIRES http://freedesktop.org/Software/xlibs)"],
140 [#include <X11/X.h>])
141 CPPFLAGS=$old_CPPFLAGS
146 CFLAGS="$CFLAGS $xlib_CFLAGS $xlib_NONPKGCONFIG_CFLAGS $xlib_xrender_CFLAGS $xlib_xrender_NONPKGCONFIG_CFLAGS"
147 LIBS="$LIBS $xlib_LIBS $xlib_NONPKGCONFIG_LIBS $xlib_xrender_LIBS $xlib_xrender_NONPKGCONFIG_LIBS"
148 AC_CHECK_FUNCS([XRenderCreateLinearGradient XRenderCreateRadialGradient XRenderCreateConicalGradient])
155 dnl ===========================================================================
157 CAIRO_ENABLE_SURFACE_BACKEND(xcb, XCB, auto, [
158 xcb_REQUIRES="xcb >= 1.6 xcb-render >= 1.6"
159 PKG_CHECK_MODULES(xcb, $xcb_REQUIRES, ,
160 [use_xcb="no (requires $xcb_REQUIRES http://xcb.freedesktop.org)"])
163 CAIRO_ENABLE_FUNCTIONS(xlib_xcb, Xlib/XCB, no, [
164 if test "x$use_xcb" = "xyes" -a "x$use_xlib" = "xyes"; then
165 xlib_xcb_REQUIRES="x11-xcb"
166 PKG_CHECK_MODULES(xlib_xcb, $xlib_xcb_REQUIRES, ,
167 [use_xlib_xcb="no (requires $xlib_xcb_REQUIRES http://xcb.freedesktop.org)"])
169 use_xlib_xcb="no (requires both --enable-xlib and --enable-xcb)"
173 CAIRO_ENABLE_FUNCTIONS(xcb_shm, XCB/SHM, auto, [
174 if test "x$use_xcb" = "xyes"; then
175 xcb_shm_REQUIRES="xcb-shm"
176 PKG_CHECK_MODULES(xcb_shm, $xcb_shm_REQUIRES, ,
177 [use_xcb_shm="no (requires $xcb_shm http://xcb.freedesktop.org)"])
179 use_xcb_shm="no (requires --enable-xcb)"
183 dnl ===========================================================================
185 CAIRO_ENABLE_SURFACE_BACKEND(qt, Qt, no, [
186 qt_REQUIRES="QtGui >= 4.4.0"
187 PKG_CHECK_MODULES(qt, $qt_REQUIRES, ,
189 use_qt="no (requires Qt4 development libraries)"
193 dnl ===========================================================================
195 CAIRO_ENABLE_SURFACE_BACKEND(quartz, Quartz, auto, [
196 dnl There is no pkgconfig for quartz; lets do a header check
197 AC_CHECK_HEADER(ApplicationServices/ApplicationServices.h, , [use_quartz="no (requires ApplicationServices framework)"])
198 if test "x$use_quartz" != "xyes" ; then
199 dnl check for CoreGraphics as a separate framework
200 AC_CHECK_HEADER(CoreGraphics/CoreGraphics.h, , [use_quartz="no (requires CoreGraphics framework)"])
201 quartz_LIBS="-Xlinker -framework -Xlinker CoreGraphics"
203 quartz_LIBS="-Xlinker -framework -Xlinker ApplicationServices"
207 CAIRO_ENABLE_FONT_BACKEND(quartz_font, Quartz, auto, [
208 use_quartz_font=$use_quartz
211 CAIRO_ENABLE_SURFACE_BACKEND(quartz_image, Quartz Image, no, [
212 use_quartz_image=$use_quartz
215 dnl ===========================================================================
217 CAIRO_ENABLE_SURFACE_BACKEND(win32, Microsoft Windows, auto, [
218 if test "x$have_windows" != xyes; then
219 use_win32="no (requires a Win32 platform)"
221 win32_LIBS="-lgdi32 -lmsimg32"
224 CAIRO_ENABLE_FONT_BACKEND(win32_font, Microsoft Windows, auto, [
225 use_win32_font=$use_win32
228 test_win32_printing=no
229 if test "x$use_win32" = "xyes"; then
230 AC_CHECK_PROG(GS, gs, gs)
232 AC_DEFINE([CAIRO_CAN_TEST_WIN32_PRINTING_SURFACE], 1, [Define to 1 if the Win32 Printing backend can be tested (needs ghostscript)])
233 test_win32_printing="yes"
235 AC_MSG_WARN([Win32 Printing backend will not be tested since ghostscript is not available])
236 test_win32_printing="no (requires ghostscript)"
240 AM_CONDITIONAL(CAIRO_CAN_TEST_WIN32_PRINTING_SURFACE, test "x$test_win32_printing" = "xyes")
242 dnl ===========================================================================
244 CAIRO_ENABLE_SURFACE_BACKEND(skia, Skia, no, [
246 [AS_HELP_STRING([--with-skia=/path/to/skia],
247 [directory to find compiled skia sources])],
248 [skia_DIR="$withval"],
249 [skia_DIR="`pwd`/../skia"])
250 AC_ARG_WITH([skia-bulid],
251 [AS_HELP_STRING([--with-skia-build=(Release|Debug)]
252 [build of skia to link with, default is Release])],
253 [skia_BUILD="$withval"],
254 [skia_BUILD="Release"])
255 skia_NONPKGCONFIG_CFLAGS="-I$skia_DIR/include/config -I$skia_DIR/include/core -I$skia_DIR/include/effects"
256 if test "x$skia_BUILD" = x"Release"; then
257 skia_NONPKGCONFIG_CFLAGS="-DSK_RELEASE -DSK_CAN_USE_FLOAT $skia_NONPKGCONFIG_CFLAGS"
259 skia_NONPKGCONFIG_LIBS="--start-group $skia_DIR/out/$skia_BUILD/obj.target/gyp/libeffects.a $skia_DIR/out/$skia_BUILD/obj.target/gyp/libimages.a $skia_DIR/out/$skia_BUILD/obj.target/gyp/libutils.a $skia_DIR/out/$skia_BUILD/obj.target/gyp/libopts.a $skia_DIR/out/$skia_BUILD/obj.target/gyp/libcore.a -end-group"
263 dnl ===========================================================================
265 CAIRO_ENABLE_SURFACE_BACKEND(os2, OS/2, no, [
271 use_os2="no (requires an OS/2 platform)"
276 dnl ===========================================================================
278 CAIRO_ENABLE_SURFACE_BACKEND(beos, BeOS/Zeta, no, [
282 dnl Add libbe and libzeta if available
283 AC_CHECK_LIB(be,main,beos_LIBS="$beos_LIBS -lbe")
284 AC_CHECK_LIB(zeta,main,beos_LIBS="$beos_LIBS -lzeta")
287 use_beos="no (requires a BeOS platform)"
292 dnl ===========================================================================
294 CAIRO_ENABLE_SURFACE_BACKEND(drm, DRM, no, [
295 drm_REQUIRES="libudev >= 136"
296 PKG_CHECK_MODULES(drm, $drm_REQUIRES, ,
297 [use_drm="no (requires $drm_REQUIRES, udev is available from git://git.kernel.org/pub/scm/linux/hotplug/udev.git)"])
300 CAIRO_ENABLE_SURFACE_BACKEND(gallium, Gallium3D, no, [
301 if test "x$use_drm" = "xyes"; then
302 AC_ARG_WITH([gallium],
303 [AS_HELP_STRING([--with-gallium=/path/to/mesa],
304 [directory to find gallium enabled mesa])],
305 [mesa_DIR="$withval"],
306 [mesa_DIR="`pwd`/../mesa"])
307 gallium_DIR="$mesa_DIR/src/gallium"
308 gallium_NONPKGCONFIG_CFLAGS="-I$mesa_DIR/include -I$mesa_DIR/src/mesa -I$gallium_DIR/include -I$gallium_DIR/auxiliary"
309 gallium_NONPKGCONFIG_LIBS="-lGL"
311 AC_SUBST(gallium_DIR)
313 use_gallium="no (requires --enable-drm)"
317 dnl ===========================================================================
319 CAIRO_ENABLE_FUNCTIONS(png, PNG, yes, [
321 AC_ARG_VAR([png_REQUIRES], [module name for libpng to search for using pkg-config])
322 if test "x$png_REQUIRES" = x; then
323 # libpng13 is GnuWin32's libpng-1.2.8 :-(
324 for l in libpng libpng14 libpng12 libpng13 libpng10; do
325 if $PKG_CONFIG --exists $l ; then
335 if test "x$use_png" = "xyes" ; then
336 PKG_CHECK_MODULES(png, $png_REQUIRES, , : )
338 AC_MSG_WARN([Could not find libpng in the pkg-config search path])
342 dnl ===========================================================================
343 CAIRO_ENABLE_SURFACE_BACKEND(gl, OpenGL, no, [
345 PKG_CHECK_MODULES(gl, $gl_REQUIRES,, [
346 dnl Fallback to searching for headers
347 AC_CHECK_HEADER(GL/gl.h,, [use_gl="no (gl.pc nor OpenGL headers not found)"])
348 if test "x$use_gl" = "xyes"; then
349 gl_NONPKGCONFIG_CFLAGS=
350 gl_NONPKGCONFIG_LIBS="-lGL"
353 if test "x$have_dl" = "xyes" -a "x$have_dlsym" = "xyes"; then
354 gl_LIBS="$gl_LIBS -ldl"
357 need_glx_functions=yes
358 need_wgl_functions=yes
359 need_egl_functions=yes
362 dnl ===========================================================================
363 CAIRO_ENABLE_SURFACE_BACKEND(glesv2, OpenGLESv2, no, [
364 glesv2_REQUIRES="glesv2"
365 PKG_CHECK_MODULES(glesv2, $glesv2_REQUIRES,, [
366 dnl Fallback to searching for headers
367 AC_CHECK_HEADER(GLES2/gl2.h,, [use_glesv2="no (glesv2.pc nor OpenGL ES 2.0 headers not found)"])
368 if test "x$use_glesv2" = "xyes"; then
369 glesv2_NONPKGCONFIG_CFLAGS=
370 glesv2_NONPKGCONFIG_LIBS="-lGLESv2"
373 if test "x$have_dl" = "xyes" -a "x$have_dlsym" = "xyes"; then
374 glesv2_LIBS="$glesv2_LIBS -ldl"
377 need_egl_functions=yes
380 dnl ===========================================================================
381 CAIRO_ENABLE_SURFACE_BACKEND(cogl, Cogl, no, [
382 cogl_REQUIRES="cogl-2.0-experimental"
383 PKG_CHECK_MODULES(cogl, $cogl_REQUIRES,, [use_cogl="no"])
386 dnl ===========================================================================
388 CAIRO_ENABLE_SURFACE_BACKEND(directfb, directfb, no, [
389 directfb_REQUIRES=directfb
390 PKG_CHECK_MODULES(directfb, $directfb_REQUIRES, ,
391 [use_directfb="no (requires $directfb_REQUIRES http://www.directfb.org)"])
394 dnl ===========================================================================
396 CAIRO_ENABLE_SURFACE_BACKEND(vg, OpenVG, no, [
397 dnl There is no pkgconfig for OpenVG; lets do a header check
398 AC_CHECK_HEADER(VG/openvg.h,, [use_vg="no (OpenVG headers not found)"])
399 if test "x$use_vg" = "xyes"; then
400 vg_NONPKGCONFIG_CFLAGS=
401 vg_NONPKGCONFIG_LIBS="-lOpenVG"
402 need_egl_functions=yes
403 need_glx_functions=yes
407 CAIRO_ENABLE_FUNCTIONS(egl, EGL, auto, [
408 if test "x$need_egl_functions" = "xyes"; then
410 PKG_CHECK_MODULES(egl, $egl_REQUIRES, ,
412 AC_CHECK_HEADER(EGL/egl.h,, [use_egl="no (EGL headers not found)"])
413 if test "x$use_egl" = "xyes"; then
414 egl_NONPKGCONFIG_CFLAGS=
415 egl_NONPKGCONFIG_LIBS=
418 # Temporary workaround for missing link from egl13
419 AC_CHECK_LIB(csi, csi_stream_attachresource, other_egl_LIBS="-lcsi")
420 LIBS="$other_egl_LIBS $LIBS"
421 for egl_lib in EGL egl13 egl12 egl11; do
422 if test -z "$egl_NONPKGCONFIG_LIBS"; then
423 AC_CHECK_LIB($egl_lib, eglGetError, egl_NONPKGCONFIG_LIBS="-l$egl_lib")
426 if test -z "$egl_NONPKGCONFIG_LIBS"; then
427 use_egl="no (EGL library not found)"
429 egl_NONPKGCONFIG_LIBS="$egl_NONPKGCONFIG_LIBS $other_egl_LIBS"
435 use_egl="no (not required by any backend)"
439 CAIRO_ENABLE_FUNCTIONS(glx, GLX, auto, [
440 if test "x$need_glx_functions" = "xyes"; then
441 save_CFLAGS="$CFLAGS"
442 CFLAGS="$CFLAGS $gl_CFLAGS $gl_NONPKGCONFIG_CFLAGS"
443 AC_CHECK_HEADER(GL/glx.h,, [use_glx="no (GLX headers not found)"])
444 glx_NONPKGCONFIG_CFLAGS=
445 glx_NONPKGCONFIG_LIBS="-lGL"
446 CFLAGS="$save_CFLAGS"
448 use_glx="no (not required by any backend)"
452 CAIRO_ENABLE_FUNCTIONS(wgl, WGL, auto, [
453 if test "x$need_wgl_functions" = "xyes"; then
454 AC_CHECK_HEADER(windows.h,, [use_wgl="no (WGL headers not found)"])
456 use_wgl="no (not required by any backend)"
460 dnl ===========================================================================
463 CAIRO_ENABLE_SURFACE_BACKEND(script, script, yes, [
467 dnl ===========================================================================
469 # We use pkg-config to look for freetype2, but fall back to
470 # freetype-config if it fails. We prefer pkg-config, since we can
471 # then just put freetype2 >= $FREETYPE_MIN_VERSION in
472 # Requires.private, but at least up to 2003-06-07, there was no
473 # freetype2.pc in the release.
475 # FreeType versions come in three forms:
476 # release (such as 2.1.9)
477 # libtool (such as 9.7.3) (returned by freetype-config and pkg-config)
478 # platform-specific/soname (such as 6.3.4)
479 # and they recommend you never use the platform-specific version
480 # (see docs/VERSION.DLL in freetype2 sources)
482 # Set these as appropriate:
484 # release number - for information only
485 FREETYPE_MIN_RELEASE=2.1.9
486 # libtool-specific version - this is what is checked
487 FREETYPE_MIN_VERSION=9.7.3
489 CAIRO_ENABLE_FONT_BACKEND(ft, FreeType, auto, [
491 PKG_CHECK_MODULES(FREETYPE, freetype2 >= $FREETYPE_MIN_VERSION,
492 [freetype_pkgconfig=yes],
493 [freetype_pkgconfig=no])
495 if test "x$freetype_pkgconfig" = "xyes"; then
496 ft_REQUIRES="freetype2 >= $FREETYPE_MIN_VERSION $ft_REQUIRES"
499 if test -z "$FREETYPE_CONFIG"; then
500 AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
502 if test "x$FREETYPE_CONFIG" = "xno" ; then
503 use_ft='no (freetype-config not found in path or $FREETYPE_CONFIG)'
505 AC_MSG_CHECKING(freetype2 libtool version)
507 FREETYPE_VERSION=`$FREETYPE_CONFIG --version`
508 AX_COMPARE_VERSION([$FREETYPE_VERSION], [gt], [$FREETYPE_MIN_VERSION],
509 [AC_MSG_RESULT($FREETYPE_VERSION - OK)
510 ft_NONPKGCONFIG_CFLAGS=`$FREETYPE_CONFIG --cflags`
511 ft_NONPKGCONFIG_LIBS=`$FREETYPE_CONFIG --libs`],
512 [AC_MSG_RESULT($FREETYPE_VERSION - Too old)
513 use_ft="no ($FREETYPE_VERSION found; version $FREETYPE_MIN_VERSION from release $FREETYPE_MIN_RELEASE required)"])
517 ft_CFLAGS="$FREETYPE_CFLAGS"
518 ft_LIBS="$FREETYPE_LIBS"
521 FONTCONFIG_MIN_VERSION=2.2.95
522 CAIRO_ENABLE_FONT_BACKEND(fc, Fontconfig, auto, [
524 if test "x$use_fc" = "xyes"; then
525 fc_REQUIRES="fontconfig >= $FONTCONFIG_MIN_VERSION"
526 PKG_CHECK_MODULES(FONTCONFIG, $fc_REQUIRES,,
527 [use_fc="no (requires $fc_REQUIRES)"])
529 fc_CFLAGS="$FONTCONFIG_CFLAGS"
530 fc_LIBS="$FONTCONFIG_LIBS"
533 if test "x$use_ft" = "xyes"; then
535 _save_cflags="$CFLAGS"
536 LIBS="$LIBS $ft_LIBS"
537 CFLAGS="$CFLAGS $ft_CFLAGS"
539 AC_CHECK_FUNCS(FT_Get_X11_Font_Format FT_GlyphSlot_Embolden FT_GlyphSlot_Oblique FT_Load_Sfnt_Table FT_Library_SetLcdFilter)
542 CFLAGS="$_save_cflags"
545 if test "x$use_fc" = "xyes"; then
546 CAIRO_CHECK_FUNCS_WITH_FLAGS(FcInit FcFini, [$FONTCONFIG_CFLAGS], [$FONTCONFIG_LIBS])
549 dnl ===========================================================================
551 CAIRO_ENABLE_SURFACE_BACKEND(ps, PostScript, yes, [
552 # The ps backend requires zlib.
554 ps_NONPKGCONFIG_LIBS=-lz
557 dnl ===========================================================================
559 SPECTRE_VERSION_REQUIRED=0.2.0
562 if test "x$use_ps" = "xyes"; then
563 AC_CHECK_PROG(GS, gs, gs)
565 AC_DEFINE([CAIRO_CAN_TEST_PS_SURFACE], 1, [Define to 1 if the PS backend can be tested (needs ghostscript)])
568 AC_MSG_WARN([PS backend will not be tested since ghostscript is not available])
569 test_ps="no (requires ghostscript)"
572 libspectre_DEPENDENCY="libspectre >= $SPECTRE_VERSION_REQUIRED"
573 PKG_CHECK_MODULES(LIBSPECTRE, $libspectre_DEPENDENCY,
575 [test_ps="no (requires libspectre)"])
578 AM_CONDITIONAL(CAIRO_CAN_TEST_PS_SURFACE, test "x$test_ps" = "xyes")
579 AM_CONDITIONAL(CAIRO_HAS_SPECTRE, test "x$any2ppm_ps" = "xyes")
580 if test "x$any2ppm_ps" = "xyes"; then
581 AC_DEFINE([CAIRO_HAS_SPECTRE], 1, [Define to 1 if libspectre is available])
583 AC_SUBST(LIBSPECTRE_CFLAGS)
584 AC_SUBST(LIBSPECTRE_LIBS)
586 dnl ===========================================================================
588 CAIRO_ENABLE_SURFACE_BACKEND(pdf, PDF, yes, [
589 # The pdf backend requires zlib.
591 pdf_NONPKGCONFIG_LIBS=-lz
594 dnl ===========================================================================
596 # poppler-0.17.4 fixes text-pattern and text-transform
597 POPPLER_VERSION_REQUIRED=0.17.4
600 if test "x$use_pdf" = "xyes"; then
601 poppler_DEPENDENCY="poppler-glib >= $POPPLER_VERSION_REQUIRED"
602 PKG_CHECK_MODULES(POPPLER, $poppler_DEPENDENCY,
603 [CAIRO_CHECK_FUNCS_WITH_FLAGS(poppler_page_render, [$POPPLER_CFLAGS], [$POPPLER_LIBS],
604 [test_pdf=yes; any2ppm_pdf=yes],
605 [test_pdf="no (requires $poppler_DEPENDENCY)"])],
606 [test_pdf="no (requires $poppler_DEPENDENCY)"])
607 if test "x$test_pdf" = "xyes"; then
608 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)])
610 AC_MSG_WARN([PDF backend will not be tested since poppler >= $POPPLER_VERSION_REQUIRED is not available])
614 AM_CONDITIONAL(CAIRO_CAN_TEST_PDF_SURFACE, test "x$test_pdf" = "xyes")
615 AC_SUBST(POPPLER_CFLAGS)
616 AC_SUBST(POPPLER_LIBS)
618 AM_CONDITIONAL(CAIRO_HAS_MULTI_PAGE_SURFACES, test "x$use_ps" = "xyes" -o "x$use_pdf" = "xyes")
620 dnl ===========================================================================
622 CAIRO_ENABLE_SURFACE_BACKEND(svg, SVG, yes, [
623 if test "x$use_png" != "xyes"; then
624 use_svg="no (requires --enable-png)"
628 LIBRSVG_VERSION_REQUIRED=2.15.0
631 if test "x$use_svg" = "xyes"; then
632 librsvg_DEPENDENCY="librsvg-2.0 >= $LIBRSVG_VERSION_REQUIRED"
633 PKG_CHECK_MODULES(LIBRSVG, $librsvg_DEPENDENCY gdk-2.0,
634 [CAIRO_CHECK_FUNCS_WITH_FLAGS(rsvg_pixbuf_from_file, [$LIBRSVG_CFLAGS], [$LIBRSVG_LIBS],
635 [test_svg=yes; any2ppm_svg=yes],
636 [test_svg="no (requires $librsvg_DEPENDENCY)"])],
637 [test_svg="no (requires $librsvg_DEPENDENCY)"])
638 if test "x$test_svg" = "xyes"; then
639 AC_DEFINE([CAIRO_CAN_TEST_SVG_SURFACE], 1, [Define to 1 if the SVG backend can be tested])
641 AC_MSG_WARN([SVG backend will not be tested since librsvg >= $LIBRSVG_VERSION_REQUIRED is not available])
645 AM_CONDITIONAL(CAIRO_CAN_TEST_SVG_SURFACE, test "x$test_svg" = "xyes")
646 AC_SUBST(LIBRSVG_CFLAGS)
647 AC_SUBST(LIBRSVG_LIBS)
649 dnl ===========================================================================
651 dnl XXX make this a private feature?
652 CAIRO_ENABLE(test_surfaces, test surfaces, no)
654 dnl ===========================================================================
656 CAIRO_ENABLE_SURFACE_BACKEND(image, image, always, [
657 pixman_REQUIRES="pixman-1 >= 0.22.0"
658 PKG_CHECK_MODULES(pixman, $pixman_REQUIRES, ,
659 [use_image="no (requires $pixman_REQUIRES http://cairographics.org/releases/)"])
660 image_REQUIRES=$pixman_REQUIRES
661 image_CFLAGS=$pixman_CFLAGS
662 image_LIBS=$pixman_LIBS
665 if pkg-config --exists 'pixman-1 >= 0.27.1'; then
666 AC_DEFINE([HAS_PIXMAN_GLYPHS], 1, [Enable pixman glyph cache])
670 dnl ===========================================================================
672 CAIRO_ENABLE_SURFACE_BACKEND(mime, mime, always)
673 CAIRO_ENABLE_SURFACE_BACKEND(recording, recording, always)
674 CAIRO_ENABLE_SURFACE_BACKEND(observer, observer, always)
675 CAIRO_ENABLE_SURFACE_BACKEND(tee, tee, no)
676 CAIRO_ENABLE_SURFACE_BACKEND(xml, xml, no, [
678 xml_NONPKGCONFIG_LIBS=-lz
681 dnl ===========================================================================
683 CAIRO_ENABLE_FONT_BACKEND(user, user, always)
685 dnl ===========================================================================
687 dnl This needs to be last on our list of features so that the pthread libs and flags
688 dnl gets prefixed in front of everything else in CAIRO_{CFLAGS,LIBS}.
692 CAIRO_ENABLE(pthread, pthread, auto, [CAIRO_CONFIGURE_PTHREAD])
693 AM_CONDITIONAL(HAVE_REAL_PTHREAD, test "x$use_pthread" = "xyes" -a "x$have_real_pthread" = "xyes")
694 AM_CONDITIONAL(HAVE_PTHREAD, test "x$use_pthread" = "xyes")
695 AC_SUBST(pthread_CFLAGS)
696 AC_SUBST(pthread_LIBS)
697 AC_SUBST(real_pthread_CFLAGS)
698 AC_SUBST(real_pthread_LIBS)
701 dnl ===========================================================================
702 dnl Build gobject integration library
704 CAIRO_ENABLE_FUNCTIONS(gobject, gobject, auto, [
705 gobject_REQUIRES="gobject-2.0 glib-2.0"
706 PKG_CHECK_MODULES(GOBJECT, $gobject_REQUIRES, ,
707 [use_gobject="no (requires $gobject_REQUIRES http://download.gnome.org/pub/GNOME/sources/glib/)"])
708 gobject_NONPKGCONFIG_EXTRA_LIBS="-L\${libdir} -lcairo-gobject"
710 dnl I'm too lazy to fix the caching properly
711 if test "x$use_gobject" = "xyes"; then
712 PKG_CHECK_MODULES(GOBJECT, $gobject_REQUIRES, : )
715 dnl ===========================================================================
716 dnl Default to quick testing during development, but force a full test before
719 AC_ARG_ENABLE(full-testing,
720 AS_HELP_STRING([--enable-full-testing],
721 [Sets the test suite to perform full testing by default, which
722 will dramatically slow down make check, but is a
723 *requirement* before release.]), [
724 if test "x$enableval" = "xyes"; then
726 AC_SUBST(CAIRO_TEST_MODE)
730 dnl ===========================================================================
731 dnl Build the external converter if we have any of the test backends
732 AM_CONDITIONAL(BUILD_ANY2PPM,
733 test "x$any2ppm_svg" = "xyes" \
734 -o "x$any2ppm_pdf" = "xyes" \
735 -o "x$any2ppm_ps" = "xyes" \
736 -o "x$any2ppm_cs" = "xyes")
738 dnl ===========================================================================
739 dnl Some utilities need to dlopen the shared libraries, so they need to
740 dnl know how libtools will name them
750 AC_DEFINE_UNQUOTED(SHARED_LIB_EXT, "${SHLIB_EXT}", [Shared library file extension])
753 dnl ===========================================================================
754 dnl The tracing utility requires LD_PRELOAD, so only build it for systems
755 dnl that are known to work.
758 *-linux*|*-*bsd*|*-solaris*|*-*-darwin*|*-dragonfly*|*-*-gnu*)
759 have_ld_preload="yes"
766 CAIRO_ENABLE(trace, cairo-trace, auto, [
767 if test "x$have_ld_preload" != "xyes" -o \
768 "x$have_libz" != "xyes" -o \
769 "x$have_real_pthread" != "xyes" -o \
770 "x$have_dlsym" != "xyes"; then
771 use_trace="no (requires dynamic linker and zlib and real pthreads)"
775 CAIRO_ENABLE(interpreter, cairo-script-interpreter, yes, [
776 if test "x$have_libz" != "xyes"; then
777 use_interpreter="no (requires zlib)"
781 AC_CHECK_LIB(bfd, bfd_openr,
782 [AC_CHECK_HEADER(bfd.h, [have_bfd=yes],
783 [have_bfd=no])], [have_bfd=no])
784 AC_CHECK_HEADER(libiberty.h,, [have_bfd=no])
785 if test "x$have_bfd" = "xyes"; then
786 AC_DEFINE([HAVE_BFD], [1], [Define to 1 if you have the binutils development files installed])
791 CAIRO_ENABLE(symbol_lookup, symbol-lookup, auto, [
792 if test "x$have_bfd" != "xyes"; then
793 use_symbol_lookup="no (requires bfd)"
797 PKG_CHECK_MODULES(glib, glib-2.0, have_glib=yes, have_glib=no)
798 AC_SUBST(glib_CFLAGS)
800 AM_CONDITIONAL(BUILD_SPHINX, test "x$have_glib" = "xyes")
803 AC_CHECK_LIB(rt, shm_open, shm_LIBS="-lrt")
807 dnl ===========================================================================
809 AC_ARG_ENABLE(some-floating-point,
810 AS_HELP_STRING([--disable-some-floating-point],
811 [Disable certain code paths that rely heavily on double precision
812 floating-point calculation. This option can improve
813 performance on systems without a double precision floating-point
814 unit, but might degrade performance on those that do.]), [
815 if test "x$enableval" = "xno"; then
816 # A value of 'no' for $enableval means that they want to disable, which
817 # means 'yes' for $disable_some_floating_point.
818 disable_some_floating_point=yes
820 ], [disable_some_floating_point=no])
822 AM_CONDITIONAL(DISABLE_SOME_FLOATING_POINT,
823 test "x$disable_some_floating_point" = "xyes")
824 if test "x$disable_some_floating_point" = "xyes"; then
825 AC_DEFINE(DISABLE_SOME_FLOATING_POINT, 1,
826 [Define to 1 to disable certain code paths that rely heavily on
827 double precision floating-point calculation])
830 dnl ===========================================================================
832 dnl Extra stuff we need to do when building C++ code
834 AS_IF([test "x$use_skia" = "xyes"], [need_cxx="yes"])
835 AS_IF([test "x$use_qt" = "xyes"], [need_cxx="yes"])
836 AS_IF([test "x$use_beos" = "xyes"], [need_cxx="yes"])
838 AM_CONDITIONAL(BUILD_CXX, test "x$need_cxx" = "xyes")
840 dnl ===========================================================================
842 # We use GTK+ for some utility/debugging tools
843 PKG_CHECK_MODULES(gtk, "gtk+-2.0",have_gtk=yes, have_gtk=no)
844 AM_CONDITIONAL(HAVE_GTK, test "x$have_gtk" = "xyes")
855 util/cairo-fdr/Makefile
856 util/cairo-gobject/Makefile
857 util/cairo-missing/Makefile
858 util/cairo-script/Makefile
859 util/cairo-script/examples/Makefile
860 util/cairo-sphinx/Makefile
861 util/cairo-trace/Makefile
862 util/cairo-trace/cairo-trace