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])
24 GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
28 dnl ===========================================================================
30 dnl The order of the includes here is rather important
32 m4_include(build/configure.ac.version) dnl macros setting up various version declares
33 m4_include(build/configure.ac.tools) dnl checks for tools we use
34 m4_include(build/configure.ac.features) dnl macros for backend/feature handling
35 m4_include(build/configure.ac.warnings) dnl checks for compiler warning
36 m4_include(build/configure.ac.system) dnl checks for system functions, headers, libs
37 m4_include(build/configure.ac.analysis) dnl checks for analysis tools (lcov, etc)
38 m4_include(build/configure.ac.noversion) dnl disable builtin libtool versioning
39 m4_include(build/configure.ac.pthread) dnl checks for pthreads
42 dnl ===========================================================================
44 AC_CHECK_LIB(z, compress,
45 [AC_CHECK_HEADER(zlib.h, [
47 AC_DEFINE(HAVE_ZLIB, 1, [Define to 1 if you have zlib available])
49 [have_libz="no (requires zlib http://www.gzip.org/zlib/)"])],
50 [have_libz="no (requires zlib http://www.gzip.org/zlib/)"])
53 AC_CHECK_LIB(lzo2, lzo2a_decompress,
54 [AC_CHECK_HEADER(lzo/lzo2a.h, [
56 AC_DEFINE(HAVE_LZO, 1, [Define to 1 if you have lzo available])
59 [have_lzo="no (requires lzpo http://www.oberhumer.com/opensource/lzo/)"])],
60 [have_lzo="no (requires lzpo http://www.oberhumer.com/opensource/lzo/)"])
64 AC_CHECK_LIB(dl, dlsym,
65 [have_dlsym=yes; have_dl=yes],
66 [have_dlsym=no; have_dl=no])
67 if test "x$have_dlsym" = "xno"; then
68 AC_CHECK_FUNC(dlsym, [have_dlsym=yes], [have_dlsym=no])
70 AC_CHECK_HEADERS(dlfcn.h, [have_dlsym=yes], [have_dlsym=no])
71 AM_CONDITIONAL(CAIRO_HAS_DL, test "x$have_dl" = "xyes")
72 if test "x$have_dlsym" = "xyes"; then
73 AC_DEFINE([CAIRO_HAS_DLSYM], 1, [Define to 1 if dlsym is available])
75 AM_CONDITIONAL(CAIRO_HAS_DLSYM, test "x$have_dlsym" = "xyes")
77 dnl ===========================================================================
79 CAIRO_ENABLE_SURFACE_BACKEND(xlib, Xlib, auto, [
80 xlib_REQUIRES="x11 xext"
81 PKG_CHECK_MODULES(xlib, $xlib_REQUIRES, ,
84 if test "x$no_x" = xyes; then
85 use_xlib="no (requires X development libraries)"
87 xlib_NONPKGCONFIG_LIBS="$X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS"
88 xlib_NONPKGCONFIG_CFLAGS=$X_CFLAGS
91 AC_CHECK_HEADER(sys/ipc.h)
92 AC_CHECK_HEADER(sys/shm.h)
94 if test "$ac_cv_header_sys_ipc_h" = "yes" -a "$ac_cv_header_sys_shm_h" = "yes"; then
95 AC_MSG_CHECKING(whether shmctl IPC_RMID allowes subsequent attaches)
97 #include <sys/types.h>
103 int id = shmget (IPC_PRIVATE, 4, IPC_CREAT | 0600);
104 if (id == -1) return 2;
105 shmaddr = shmat (id, 0, 0);
106 shmctl (id, IPC_RMID, 0);
107 if ((char*) shmat (id, 0, 0) == (char*) -1) {
116 AC_DEFINE(IPC_RMID_DEFERRED_RELEASE, 1,
117 [Define to 1 if shared memory segments are released deferred.])
120 AC_MSG_RESULT(assuming no))
123 AC_CHECK_HEADERS([X11/extensions/XShm.h X11/extensions/shmproto.h X11/extensions/shmstr.h], [], [],
124 [#include <X11/Xlibint.h>
125 #include <X11/Xproto.h>])
128 CAIRO_ENABLE_SURFACE_BACKEND(xlib_xrender, Xlib Xrender, auto, [
129 if test "x$use_xlib" != "xyes"; then
130 use_xlib_xrender="no (requires --enable-xlib)"
132 dnl Check for Xrender header files if the Xrender package is not installed:
133 xlib_xrender_BASE=cairo-xlib
134 xlib_xrender_REQUIRES="xrender >= 0.6"
135 PKG_CHECK_MODULES(xlib_xrender, $xlib_xrender_REQUIRES, ,
136 [xlib_xrender_REQUIRES=""
137 old_CPPFLAGS=$CPPFLAGS
138 CPPFLAGS="$CPPFLAGS $xlib_CFLAGS $xlib_NONPKGCONFIG_CFLAGS"
139 AC_CHECK_HEADER(X11/extensions/Xrender.h,
140 [xlib_xrender_NONPKGCONFIG_LIBS="-lXrender"],
141 [use_xlib_xrender="no (requires $xlib_xrender_REQUIRES http://freedesktop.org/Software/xlibs)"],
142 [#include <X11/X.h>])
143 CPPFLAGS=$old_CPPFLAGS
148 CFLAGS="$CFLAGS $xlib_CFLAGS $xlib_NONPKGCONFIG_CFLAGS $xlib_xrender_CFLAGS $xlib_xrender_NONPKGCONFIG_CFLAGS"
149 LIBS="$LIBS $xlib_LIBS $xlib_NONPKGCONFIG_LIBS $xlib_xrender_LIBS $xlib_xrender_NONPKGCONFIG_LIBS"
150 AC_CHECK_FUNCS([XRenderCreateLinearGradient XRenderCreateRadialGradient XRenderCreateConicalGradient])
157 dnl ===========================================================================
159 CAIRO_ENABLE_SURFACE_BACKEND(xcb, XCB, auto, [
160 xcb_REQUIRES="xcb >= 1.6 xcb-render >= 1.6"
161 PKG_CHECK_MODULES(xcb, $xcb_REQUIRES, ,
162 [use_xcb="no (requires $xcb_REQUIRES http://xcb.freedesktop.org)"])
165 CAIRO_ENABLE_FUNCTIONS(xlib_xcb, Xlib/XCB, no, [
166 if test "x$use_xcb" = "xyes" -a "x$use_xlib" = "xyes"; then
167 xlib_xcb_REQUIRES="x11-xcb"
168 PKG_CHECK_MODULES(xlib_xcb, $xlib_xcb_REQUIRES, ,
169 [use_xlib_xcb="no (requires $xlib_xcb_REQUIRES http://xcb.freedesktop.org)"])
171 use_xlib_xcb="no (requires both --enable-xlib and --enable-xcb)"
175 CAIRO_ENABLE_FUNCTIONS(xcb_shm, XCB/SHM, auto, [
176 if test "x$use_xcb" = "xyes"; then
177 xcb_shm_REQUIRES="xcb-shm"
178 PKG_CHECK_MODULES(xcb_shm, $xcb_shm_REQUIRES, ,
179 [use_xcb_shm="no (requires $xcb_shm http://xcb.freedesktop.org)"])
181 use_xcb_shm="no (requires --enable-xcb)"
185 dnl ===========================================================================
187 CAIRO_ENABLE_SURFACE_BACKEND(qt, Qt, no, [
188 qt_REQUIRES="QtGui >= 4.4.0"
189 PKG_CHECK_MODULES(qt, $qt_REQUIRES, ,
191 use_qt="no (requires Qt4 development libraries)"
195 dnl ===========================================================================
197 CAIRO_ENABLE_SURFACE_BACKEND(quartz, Quartz, auto, [
198 dnl There is no pkgconfig for quartz; lets do a header check
199 AC_CHECK_HEADER(ApplicationServices/ApplicationServices.h, , [use_quartz="no (requires ApplicationServices framework)"])
200 if test "x$use_quartz" != "xyes" ; then
201 dnl check for CoreGraphics as a separate framework
202 AC_CHECK_HEADER(CoreGraphics/CoreGraphics.h, , [use_quartz="no (requires CoreGraphics framework)"])
203 quartz_LIBS="-Xlinker -framework -Xlinker CoreGraphics"
205 quartz_LIBS="-Xlinker -framework -Xlinker ApplicationServices"
209 CAIRO_ENABLE_FONT_BACKEND(quartz_font, Quartz, auto, [
210 use_quartz_font=$use_quartz
213 CAIRO_ENABLE_SURFACE_BACKEND(quartz_image, Quartz Image, no, [
214 use_quartz_image=$use_quartz
217 dnl ===========================================================================
219 CAIRO_ENABLE_SURFACE_BACKEND(win32, Microsoft Windows, auto, [
220 if test "x$have_windows" != xyes; then
221 use_win32="no (requires a Win32 platform)"
223 win32_LIBS="-lgdi32 -lmsimg32"
226 CAIRO_ENABLE_FONT_BACKEND(win32_font, Microsoft Windows, auto, [
227 use_win32_font=$use_win32
230 test_win32_printing=no
231 if test "x$use_win32" = "xyes"; then
232 AC_CHECK_PROG(GS, gs, gs)
234 AC_DEFINE([CAIRO_CAN_TEST_WIN32_PRINTING_SURFACE], 1, [Define to 1 if the Win32 Printing backend can be tested (needs ghostscript)])
235 test_win32_printing="yes"
237 AC_MSG_WARN([Win32 Printing backend will not be tested since ghostscript is not available])
238 test_win32_printing="no (requires ghostscript)"
242 AM_CONDITIONAL(CAIRO_CAN_TEST_WIN32_PRINTING_SURFACE, test "x$test_win32_printing" = "xyes")
244 dnl ===========================================================================
246 CAIRO_ENABLE_SURFACE_BACKEND(skia, Skia, no, [
248 [AS_HELP_STRING([--with-skia=/path/to/skia],
249 [directory to find compiled skia sources])],
250 [skia_DIR="$withval"],
251 [skia_DIR="`pwd`/../skia"])
252 AC_ARG_WITH([skia-bulid],
253 [AS_HELP_STRING([--with-skia-build=(Release|Debug)]
254 [build of skia to link with, default is Release])],
255 [skia_BUILD="$withval"],
256 [skia_BUILD="Release"])
257 skia_NONPKGCONFIG_CFLAGS="-I$skia_DIR/include/config -I$skia_DIR/include/core -I$skia_DIR/include/effects"
258 if test "x$skia_BUILD" = x"Release"; then
259 skia_NONPKGCONFIG_CFLAGS="-DSK_RELEASE -DSK_CAN_USE_FLOAT $skia_NONPKGCONFIG_CFLAGS"
261 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"
265 dnl ===========================================================================
267 CAIRO_ENABLE_SURFACE_BACKEND(os2, OS/2, no, [
273 use_os2="no (requires an OS/2 platform)"
278 dnl ===========================================================================
280 CAIRO_ENABLE_SURFACE_BACKEND(beos, BeOS/Zeta, no, [
284 dnl Add libbe and libzeta if available
285 AC_CHECK_LIB(be,main,beos_LIBS="$beos_LIBS -lbe")
286 AC_CHECK_LIB(zeta,main,beos_LIBS="$beos_LIBS -lzeta")
289 use_beos="no (requires a BeOS platform)"
294 dnl ===========================================================================
296 CAIRO_ENABLE_SURFACE_BACKEND(drm, DRM, no, [
297 drm_REQUIRES="libudev >= 136"
298 PKG_CHECK_MODULES(drm, $drm_REQUIRES, ,
299 [use_drm="no (requires $drm_REQUIRES, udev is available from git://git.kernel.org/pub/scm/linux/hotplug/udev.git)"])
302 CAIRO_ENABLE_SURFACE_BACKEND(gallium, Gallium3D, no, [
303 if test "x$use_drm" = "xyes"; then
304 AC_ARG_WITH([gallium],
305 [AS_HELP_STRING([--with-gallium=/path/to/mesa],
306 [directory to find gallium enabled mesa])],
307 [mesa_DIR="$withval"],
308 [mesa_DIR="`pwd`/../mesa"])
309 gallium_DIR="$mesa_DIR/src/gallium"
310 gallium_NONPKGCONFIG_CFLAGS="-I$mesa_DIR/include -I$mesa_DIR/src/mesa -I$gallium_DIR/include -I$gallium_DIR/auxiliary"
311 gallium_NONPKGCONFIG_LIBS="-lGL"
313 AC_SUBST(gallium_DIR)
315 use_gallium="no (requires --enable-drm)"
319 dnl ===========================================================================
321 CAIRO_ENABLE_FUNCTIONS(png, PNG, yes, [
323 AC_ARG_VAR([png_REQUIRES], [module name for libpng to search for using pkg-config])
324 if test "x$png_REQUIRES" = x; then
325 # libpng13 is GnuWin32's libpng-1.2.8 :-(
326 for l in libpng libpng14 libpng12 libpng13 libpng10; do
327 if $PKG_CONFIG --exists $l ; then
337 if test "x$use_png" = "xyes" ; then
338 PKG_CHECK_MODULES(png, $png_REQUIRES, , : )
340 AC_MSG_WARN([Could not find libpng in the pkg-config search path])
344 dnl ===========================================================================
345 CAIRO_ENABLE_SURFACE_BACKEND(gl, OpenGL, no, [
347 PKG_CHECK_MODULES(gl, $gl_REQUIRES,, [
348 dnl Fallback to searching for headers
349 AC_CHECK_HEADER(GL/gl.h,, [use_gl="no (gl.pc nor OpenGL headers not found)"])
350 if test "x$use_gl" = "xyes"; then
351 gl_NONPKGCONFIG_CFLAGS=
352 gl_NONPKGCONFIG_LIBS="-lGL"
355 if test "x$have_dl" = "xyes" -a "x$have_dlsym" = "xyes"; then
356 gl_LIBS="$gl_LIBS -ldl"
359 need_glx_functions=yes
360 need_wgl_functions=yes
361 need_egl_functions=yes
364 dnl ===========================================================================
365 CAIRO_ENABLE_SURFACE_BACKEND(glesv2, OpenGLESv2, no, [
366 glesv2_REQUIRES="glesv2"
367 PKG_CHECK_MODULES(glesv2, $glesv2_REQUIRES,, [
368 dnl Fallback to searching for headers
369 AC_CHECK_HEADER(GLES2/gl2.h,, [use_glesv2="no (glesv2.pc nor OpenGL ES 2.0 headers not found)"])
370 if test "x$use_glesv2" = "xyes"; then
371 glesv2_NONPKGCONFIG_CFLAGS=
372 glesv2_NONPKGCONFIG_LIBS="-lGLESv2"
375 if test "x$have_dl" = "xyes" -a "x$have_dlsym" = "xyes"; then
376 glesv2_LIBS="$glesv2_LIBS -ldl"
379 need_egl_functions=yes
382 dnl ===========================================================================
383 CAIRO_ENABLE_SURFACE_BACKEND(cogl, Cogl, no, [
384 cogl_REQUIRES="cogl-2.0-experimental"
385 PKG_CHECK_MODULES(cogl, $cogl_REQUIRES,, [use_cogl="no"])
388 dnl ===========================================================================
390 CAIRO_ENABLE_SURFACE_BACKEND(directfb, directfb, no, [
391 directfb_REQUIRES=directfb
392 PKG_CHECK_MODULES(directfb, $directfb_REQUIRES, ,
393 [use_directfb="no (requires $directfb_REQUIRES http://www.directfb.org)"])
396 dnl ===========================================================================
398 CAIRO_ENABLE_SURFACE_BACKEND(vg, OpenVG, no, [
399 dnl There is no pkgconfig for OpenVG; lets do a header check
400 AC_CHECK_HEADER(VG/openvg.h,, [use_vg="no (OpenVG headers not found)"])
401 if test "x$use_vg" = "xyes"; then
402 vg_NONPKGCONFIG_CFLAGS=
403 vg_NONPKGCONFIG_LIBS="-lOpenVG"
404 need_egl_functions=yes
405 need_glx_functions=yes
409 CAIRO_ENABLE_FUNCTIONS(egl, EGL, auto, [
410 if test "x$need_egl_functions" = "xyes"; then
412 PKG_CHECK_MODULES(egl, $egl_REQUIRES, ,
414 AC_CHECK_HEADER(EGL/egl.h,, [use_egl="no (EGL headers not found)"])
415 if test "x$use_egl" = "xyes"; then
416 egl_NONPKGCONFIG_CFLAGS=
417 egl_NONPKGCONFIG_LIBS=
420 # Temporary workaround for missing link from egl13
421 AC_CHECK_LIB(csi, csi_stream_attachresource, other_egl_LIBS="-lcsi")
422 LIBS="$other_egl_LIBS $LIBS"
423 for egl_lib in EGL egl13 egl12 egl11; do
424 if test -z "$egl_NONPKGCONFIG_LIBS"; then
425 AC_CHECK_LIB($egl_lib, eglGetError, egl_NONPKGCONFIG_LIBS="-l$egl_lib")
428 if test -z "$egl_NONPKGCONFIG_LIBS"; then
429 use_egl="no (EGL library not found)"
431 egl_NONPKGCONFIG_LIBS="$egl_NONPKGCONFIG_LIBS $other_egl_LIBS"
437 use_egl="no (not required by any backend)"
441 CAIRO_ENABLE_FUNCTIONS(glx, GLX, auto, [
442 if test "x$need_glx_functions" = "xyes"; then
443 save_CFLAGS="$CFLAGS"
444 CFLAGS="$CFLAGS $gl_CFLAGS $gl_NONPKGCONFIG_CFLAGS"
445 AC_CHECK_HEADER(GL/glx.h,, [use_glx="no (GLX headers not found)"])
446 glx_NONPKGCONFIG_CFLAGS=
447 glx_NONPKGCONFIG_LIBS="-lGL"
448 CFLAGS="$save_CFLAGS"
450 use_glx="no (not required by any backend)"
454 CAIRO_ENABLE_FUNCTIONS(wgl, WGL, auto, [
455 if test "x$need_wgl_functions" = "xyes"; then
456 AC_CHECK_HEADER(windows.h,, [use_wgl="no (WGL headers not found)"])
458 use_wgl="no (not required by any backend)"
462 dnl ===========================================================================
465 CAIRO_ENABLE_SURFACE_BACKEND(script, script, yes, [
469 dnl ===========================================================================
471 # We use pkg-config to look for freetype2, but fall back to
472 # freetype-config if it fails. We prefer pkg-config, since we can
473 # then just put freetype2 >= $FREETYPE_MIN_VERSION in
474 # Requires.private, but at least up to 2003-06-07, there was no
475 # freetype2.pc in the release.
477 # FreeType versions come in three forms:
478 # release (such as 2.1.9)
479 # libtool (such as 9.7.3) (returned by freetype-config and pkg-config)
480 # platform-specific/soname (such as 6.3.4)
481 # and they recommend you never use the platform-specific version
482 # (see docs/VERSION.DLL in freetype2 sources)
484 # Set these as appropriate:
486 # release number - for information only
487 FREETYPE_MIN_RELEASE=2.1.9
488 # libtool-specific version - this is what is checked
489 FREETYPE_MIN_VERSION=9.7.3
491 CAIRO_ENABLE_FONT_BACKEND(ft, FreeType, auto, [
493 PKG_CHECK_MODULES(FREETYPE, freetype2 >= $FREETYPE_MIN_VERSION,
494 [freetype_pkgconfig=yes],
495 [freetype_pkgconfig=no])
497 if test "x$freetype_pkgconfig" = "xyes"; then
498 ft_REQUIRES="freetype2 >= $FREETYPE_MIN_VERSION $ft_REQUIRES"
501 if test -z "$FREETYPE_CONFIG"; then
502 AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
504 if test "x$FREETYPE_CONFIG" = "xno" ; then
505 use_ft='no (freetype-config not found in path or $FREETYPE_CONFIG)'
507 AC_MSG_CHECKING(freetype2 libtool version)
509 FREETYPE_VERSION=`$FREETYPE_CONFIG --version`
510 AX_COMPARE_VERSION([$FREETYPE_VERSION], [gt], [$FREETYPE_MIN_VERSION],
511 [AC_MSG_RESULT($FREETYPE_VERSION - OK)
512 ft_NONPKGCONFIG_CFLAGS=`$FREETYPE_CONFIG --cflags`
513 ft_NONPKGCONFIG_LIBS=`$FREETYPE_CONFIG --libs`],
514 [AC_MSG_RESULT($FREETYPE_VERSION - Too old)
515 use_ft="no ($FREETYPE_VERSION found; version $FREETYPE_MIN_VERSION from release $FREETYPE_MIN_RELEASE required)"])
519 ft_CFLAGS="$FREETYPE_CFLAGS"
520 ft_LIBS="$FREETYPE_LIBS"
523 FONTCONFIG_MIN_VERSION=2.2.95
524 CAIRO_ENABLE_FONT_BACKEND(fc, Fontconfig, auto, [
526 if test "x$use_fc" = "xyes"; then
527 fc_REQUIRES="fontconfig >= $FONTCONFIG_MIN_VERSION"
528 PKG_CHECK_MODULES(FONTCONFIG, $fc_REQUIRES,,
529 [use_fc="no (requires $fc_REQUIRES)"])
531 fc_CFLAGS="$FONTCONFIG_CFLAGS"
532 fc_LIBS="$FONTCONFIG_LIBS"
535 if test "x$use_ft" = "xyes"; then
537 _save_cflags="$CFLAGS"
538 LIBS="$LIBS $ft_LIBS"
539 CFLAGS="$CFLAGS $ft_CFLAGS"
541 AC_CHECK_FUNCS(FT_Get_X11_Font_Format FT_GlyphSlot_Embolden FT_GlyphSlot_Oblique FT_Load_Sfnt_Table FT_Library_SetLcdFilter)
544 CFLAGS="$_save_cflags"
547 if test "x$use_fc" = "xyes"; then
548 CAIRO_CHECK_FUNCS_WITH_FLAGS(FcInit FcFini, [$FONTCONFIG_CFLAGS], [$FONTCONFIG_LIBS])
551 dnl ===========================================================================
553 CAIRO_ENABLE_SURFACE_BACKEND(ps, PostScript, yes, [
554 # The ps backend requires zlib.
556 ps_NONPKGCONFIG_LIBS=-lz
559 dnl ===========================================================================
561 SPECTRE_VERSION_REQUIRED=0.2.0
564 if test "x$use_ps" = "xyes"; then
565 AC_CHECK_PROG(GS, gs, gs)
567 AC_DEFINE([CAIRO_CAN_TEST_PS_SURFACE], 1, [Define to 1 if the PS backend can be tested (needs ghostscript)])
570 AC_MSG_WARN([PS backend will not be tested since ghostscript is not available])
571 test_ps="no (requires ghostscript)"
574 libspectre_DEPENDENCY="libspectre >= $SPECTRE_VERSION_REQUIRED"
575 PKG_CHECK_MODULES(LIBSPECTRE, $libspectre_DEPENDENCY,
577 [test_ps="no (requires libspectre)"])
580 AM_CONDITIONAL(CAIRO_CAN_TEST_PS_SURFACE, test "x$test_ps" = "xyes")
581 AM_CONDITIONAL(CAIRO_HAS_SPECTRE, test "x$any2ppm_ps" = "xyes")
582 if test "x$any2ppm_ps" = "xyes"; then
583 AC_DEFINE([CAIRO_HAS_SPECTRE], 1, [Define to 1 if libspectre is available])
585 AC_SUBST(LIBSPECTRE_CFLAGS)
586 AC_SUBST(LIBSPECTRE_LIBS)
588 dnl ===========================================================================
590 CAIRO_ENABLE_SURFACE_BACKEND(pdf, PDF, yes, [
591 # The pdf backend requires zlib.
593 pdf_NONPKGCONFIG_LIBS=-lz
596 dnl ===========================================================================
598 # poppler-0.17.4 fixes text-pattern and text-transform
599 POPPLER_VERSION_REQUIRED=0.17.4
602 if test "x$use_pdf" = "xyes"; then
603 poppler_DEPENDENCY="poppler-glib >= $POPPLER_VERSION_REQUIRED"
604 PKG_CHECK_MODULES(POPPLER, $poppler_DEPENDENCY,
605 [CAIRO_CHECK_FUNCS_WITH_FLAGS(poppler_page_render, [$POPPLER_CFLAGS], [$POPPLER_LIBS],
606 [test_pdf=yes; any2ppm_pdf=yes],
607 [test_pdf="no (requires $poppler_DEPENDENCY)"])],
608 [test_pdf="no (requires $poppler_DEPENDENCY)"])
609 if test "x$test_pdf" = "xyes"; then
610 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)])
612 AC_MSG_WARN([PDF backend will not be tested since poppler >= $POPPLER_VERSION_REQUIRED is not available])
616 AM_CONDITIONAL(CAIRO_CAN_TEST_PDF_SURFACE, test "x$test_pdf" = "xyes")
617 AC_SUBST(POPPLER_CFLAGS)
618 AC_SUBST(POPPLER_LIBS)
620 AM_CONDITIONAL(CAIRO_HAS_MULTI_PAGE_SURFACES, test "x$use_ps" = "xyes" -o "x$use_pdf" = "xyes")
622 dnl ===========================================================================
624 CAIRO_ENABLE_SURFACE_BACKEND(svg, SVG, yes, [
625 if test "x$use_png" != "xyes"; then
626 use_svg="no (requires --enable-png)"
630 LIBRSVG_VERSION_REQUIRED=2.15.0
633 if test "x$use_svg" = "xyes"; then
634 librsvg_DEPENDENCY="librsvg-2.0 >= $LIBRSVG_VERSION_REQUIRED"
635 PKG_CHECK_MODULES(LIBRSVG, $librsvg_DEPENDENCY gdk-2.0,
636 [CAIRO_CHECK_FUNCS_WITH_FLAGS(rsvg_pixbuf_from_file, [$LIBRSVG_CFLAGS], [$LIBRSVG_LIBS],
637 [test_svg=yes; any2ppm_svg=yes],
638 [test_svg="no (requires $librsvg_DEPENDENCY)"])],
639 [test_svg="no (requires $librsvg_DEPENDENCY)"])
640 if test "x$test_svg" = "xyes"; then
641 AC_DEFINE([CAIRO_CAN_TEST_SVG_SURFACE], 1, [Define to 1 if the SVG backend can be tested])
643 AC_MSG_WARN([SVG backend will not be tested since librsvg >= $LIBRSVG_VERSION_REQUIRED is not available])
647 AM_CONDITIONAL(CAIRO_CAN_TEST_SVG_SURFACE, test "x$test_svg" = "xyes")
648 AC_SUBST(LIBRSVG_CFLAGS)
649 AC_SUBST(LIBRSVG_LIBS)
651 dnl ===========================================================================
653 dnl XXX make this a private feature?
654 CAIRO_ENABLE(test_surfaces, test surfaces, no)
656 dnl ===========================================================================
658 CAIRO_ENABLE_SURFACE_BACKEND(image, image, always, [
659 pixman_REQUIRES="pixman-1 >= 0.16.0"
660 PKG_CHECK_MODULES(pixman, $pixman_REQUIRES, ,
661 [use_image="no (requires $pixman_REQUIRES http://cairographics.org/releases/)"])
662 image_REQUIRES=$pixman_REQUIRES
663 image_CFLAGS=$pixman_CFLAGS
664 image_LIBS=$pixman_LIBS
667 if pkg-config --exists 'pixman-1 >= 0.27.1'; then
668 AC_DEFINE([HAS_PIXMAN_GLYPHS], 1, [Enable pixman glyph cache])
672 dnl ===========================================================================
674 CAIRO_ENABLE_SURFACE_BACKEND(mime, mime, always)
675 CAIRO_ENABLE_SURFACE_BACKEND(recording, recording, always)
676 CAIRO_ENABLE_SURFACE_BACKEND(observer, observer, always)
677 CAIRO_ENABLE_SURFACE_BACKEND(tee, tee, no)
678 CAIRO_ENABLE_SURFACE_BACKEND(xml, xml, no, [
680 xml_NONPKGCONFIG_LIBS=-lz
683 dnl ===========================================================================
685 CAIRO_ENABLE_FONT_BACKEND(user, user, always)
687 dnl ===========================================================================
689 dnl This needs to be last on our list of features so that the pthread libs and flags
690 dnl gets prefixed in front of everything else in CAIRO_{CFLAGS,LIBS}.
694 CAIRO_ENABLE(pthread, pthread, auto, [CAIRO_CONFIGURE_PTHREAD])
695 AM_CONDITIONAL(HAVE_REAL_PTHREAD, test "x$use_pthread" = "xyes" -a "x$have_real_pthread" = "xyes")
696 AM_CONDITIONAL(HAVE_PTHREAD, test "x$use_pthread" = "xyes")
697 AC_SUBST(pthread_CFLAGS)
698 AC_SUBST(pthread_LIBS)
699 AC_SUBST(real_pthread_CFLAGS)
700 AC_SUBST(real_pthread_LIBS)
703 dnl ===========================================================================
704 dnl Build gobject integration library
706 CAIRO_ENABLE_FUNCTIONS(gobject, gobject, auto, [
707 gobject_REQUIRES="gobject-2.0 glib-2.0"
708 PKG_CHECK_MODULES(GOBJECT, $gobject_REQUIRES, ,
709 [use_gobject="no (requires $gobject_REQUIRES http://download.gnome.org/pub/GNOME/sources/glib/)"])
710 gobject_NONPKGCONFIG_EXTRA_LIBS="-L\${libdir} -lcairo-gobject"
712 dnl I'm too lazy to fix the caching properly
713 if test "x$use_gobject" = "xyes"; then
714 PKG_CHECK_MODULES(GOBJECT, $gobject_REQUIRES, : )
717 dnl ===========================================================================
718 dnl Default to quick testing during development, but force a full test before
721 AC_ARG_ENABLE(full-testing,
722 AS_HELP_STRING([--enable-full-testing],
723 [Sets the test suite to perform full testing by default, which
724 will dramatically slow down make check, but is a
725 *requirement* before release.]), [
726 if test "x$enableval" = "xyes"; then
728 AC_SUBST(CAIRO_TEST_MODE)
732 dnl ===========================================================================
733 dnl Build the external converter if we have any of the test backends
734 AM_CONDITIONAL(BUILD_ANY2PPM,
735 test "x$any2ppm_svg" = "xyes" \
736 -o "x$any2ppm_pdf" = "xyes" \
737 -o "x$any2ppm_ps" = "xyes" \
738 -o "x$any2ppm_cs" = "xyes")
740 dnl ===========================================================================
741 dnl Some utilities need to dlopen the shared libraries, so they need to
742 dnl know how libtools will name them
752 AC_DEFINE_UNQUOTED(SHARED_LIB_EXT, "${SHLIB_EXT}", [Shared library file extension])
755 dnl ===========================================================================
756 dnl The tracing utility requires LD_PRELOAD, so only build it for systems
757 dnl that are known to work.
760 *-linux*|*-*bsd*|*-solaris*|*-*-darwin*|*-dragonfly*|*-*-gnu*)
761 have_ld_preload="yes"
768 CAIRO_ENABLE(trace, cairo-trace, auto, [
769 if test "x$have_ld_preload" != "xyes" -o \
770 "x$have_libz" != "xyes" -o \
771 "x$have_real_pthread" != "xyes" -o \
772 "x$have_dlsym" != "xyes"; then
773 use_trace="no (requires dynamic linker and zlib and real pthreads)"
777 CAIRO_ENABLE(interpreter, cairo-script-interpreter, yes, [
778 if test "x$have_libz" != "xyes"; then
779 use_interpreter="no (requires zlib)"
783 AC_CHECK_LIB(bfd, bfd_openr,
784 [AC_CHECK_HEADER(bfd.h, [have_bfd=yes],
785 [have_bfd=no])], [have_bfd=no])
786 AC_CHECK_HEADER(libiberty.h,, [have_bfd=no])
787 if test "x$have_bfd" = "xyes"; then
788 AC_DEFINE([HAVE_BFD], [1], [Define to 1 if you have the binutils development files installed])
793 CAIRO_ENABLE(symbol_lookup, symbol-lookup, auto, [
794 if test "x$have_bfd" != "xyes"; then
795 use_symbol_lookup="no (requires bfd)"
799 PKG_CHECK_MODULES(glib, glib-2.0, have_glib=yes, have_glib=no)
800 AC_SUBST(glib_CFLAGS)
802 AM_CONDITIONAL(BUILD_SPHINX, test "x$have_glib" = "xyes")
805 AC_CHECK_LIB(rt, shm_open, shm_LIBS="-lrt")
809 dnl ===========================================================================
811 AC_ARG_ENABLE(some-floating-point,
812 AS_HELP_STRING([--disable-some-floating-point],
813 [Disable certain code paths that rely heavily on double precision
814 floating-point calculation. This option can improve
815 performance on systems without a double precision floating-point
816 unit, but might degrade performance on those that do.]), [
817 if test "x$enableval" = "xno"; then
818 # A value of 'no' for $enableval means that they want to disable, which
819 # means 'yes' for $disable_some_floating_point.
820 disable_some_floating_point=yes
822 ], [disable_some_floating_point=no])
824 AM_CONDITIONAL(DISABLE_SOME_FLOATING_POINT,
825 test "x$disable_some_floating_point" = "xyes")
826 if test "x$disable_some_floating_point" = "xyes"; then
827 AC_DEFINE(DISABLE_SOME_FLOATING_POINT, 1,
828 [Define to 1 to disable certain code paths that rely heavily on
829 double precision floating-point calculation])
832 dnl ===========================================================================
834 dnl Extra stuff we need to do when building C++ code
836 AS_IF([test "x$use_skia" = "xyes"], [need_cxx="yes"])
837 AS_IF([test "x$use_qt" = "xyes"], [need_cxx="yes"])
838 AS_IF([test "x$use_beos" = "xyes"], [need_cxx="yes"])
840 AM_CONDITIONAL(BUILD_CXX, test "x$need_cxx" = "xyes")
842 dnl ===========================================================================
844 # We use GTK+ for some utility/debugging tools
845 PKG_CHECK_MODULES(gtk, "gtk+-2.0",have_gtk=yes, have_gtk=no)
846 AM_CONDITIONAL(HAVE_GTK, test "x$have_gtk" = "xyes")
857 util/cairo-fdr/Makefile
858 util/cairo-gobject/Makefile
859 util/cairo-missing/Makefile
860 util/cairo-script/Makefile
861 util/cairo-script/examples/Makefile
862 util/cairo-sphinx/Makefile
863 util/cairo-trace/Makefile
864 util/cairo-trace/cairo-trace