4 [cairo_version_major.cairo_version_minor.cairo_version_micro],
5 [http://bugs.freedesktop.org/enter_bug.cgi?product=cairo])
6 AC_CONFIG_SRCDIR(src/cairo.h)
7 AC_CONFIG_HEADERS(config.h)
8 AC_CONFIG_AUX_DIR(build)
9 AC_CONFIG_MACRO_DIR(build)
10 AM_INIT_AUTOMAKE([1.9.6 gnu -Wall no-define])
11 AC_LIBTOOL_WIN32_DLL dnl Must be called before AC_PROG_LIBTOOL
12 AC_PROG_LIBTOOL dnl ([1.4]) Don't remove!
13 DOLT dnl Make my libtool fast!
16 dnl ===========================================================================
18 dnl The order of the includes here is rather important
20 m4_include(build/configure.ac.version) dnl macros setting up various version declares
21 m4_include(build/configure.ac.tools) dnl checks for tools we use
22 m4_include(build/configure.ac.system) dnl checks for system functions, headers, libs
23 m4_include(build/configure.ac.features) dnl macros for backend/feature handling
24 m4_include(build/configure.ac.warnings) dnl checks for compiler warning
25 m4_include(build/configure.ac.analysis) dnl checks for analysis tools (lcov, etc)
28 dnl ===========================================================================
30 AC_CHECK_LIB(z, compress,
31 [AC_CHECK_HEADER(zlib.h, [have_libz=yes],
32 [have_libz="no (requires zlib http://www.gzip.org/zlib/)"])],
33 [have_libz="no (requires zlib http://www.gzip.org/zlib/)"])
35 dnl ===========================================================================
37 CAIRO_ENABLE_SURFACE_BACKEND(xlib, Xlib, auto, [
39 PKG_CHECK_MODULES(xlib, $xlib_REQUIRES, ,
43 if test "x$no_x" = xyes; then
44 use_xlib="no (requires X development libraries)"
46 xlib_NONPKGCONFIG_LIBS="$X_PRE_LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
47 xlib_NONPKGCONFIG_CFLAGS=$X_CFLAGS
51 CAIRO_ENABLE_SURFACE_BACKEND(xlib_xrender, Xlib Xrender, auto, [
52 if test "x$use_xlib" != "xyes"; then
53 use_xlib_xrender="no (requires --enable-xlib)"
55 dnl Check for Xrender header files if the Xrender package is not installed:
56 xlib_xrender_BASE=cairo-xlib
57 xlib_xrender_REQUIRES="xrender >= 0.6"
58 PKG_CHECK_MODULES(xlib_xrender, $xlib_xrender_REQUIRES, ,
60 xlib_xrender_REQUIRES=""
61 old_CPPFLAGS=$CPPFLAGS
62 CPPFLAGS="$CPPFLAGS $xlib_CFLAGS $xlib_NONPKGCONFIG_CFLAGS"
63 AC_CHECK_HEADER(X11/extensions/Xrender.h,
64 [xlib_xrender_NONPKGCONFIG_LIBS="-lXrender"],
65 [use_xlib_xrender="no (requires $xlib_xrender_REQUIRES http://freedesktop.org/Software/xlibs)"])
66 CPPFLAGS=$old_CPPFLAGS
71 dnl ===========================================================================
73 CAIRO_ENABLE_SURFACE_BACKEND(xcb, XCB, no, [
74 xcb_REQUIRES="xcb >= 0.9.92 xcb-render >= 0.9.92 xcb-renderutil"
75 PKG_CHECK_MODULES(xcb, $xcb_REQUIRES, , [AC_MSG_RESULT(no)
76 use_xcb="no (requires $xcb_REQUIRES http://xcb.freedesktop.org)"])
79 dnl ===========================================================================
81 CAIRO_ENABLE_SURFACE_BACKEND(quartz, Quartz, auto, [
82 dnl There is no pkgconfig for quartz; lets do a header check
83 AC_CHECK_HEADER(ApplicationServices/ApplicationServices.h, , [use_quartz="no (requires ApplicationServices framework)"])
84 if test "x$use_quartz" != "xyes" ; then
85 dnl check for CoreGraphics as a separate framework
86 AC_CHECK_HEADER(CoreGraphics/CoreGraphics.h, , [use_quartz="no (requires CoreGraphics framework)"])
87 quartz_LIBS="-Xlinker -framework -Xlinker CoreGraphics"
89 quartz_LIBS="-Xlinker -framework -Xlinker ApplicationServices"
93 CAIRO_ENABLE_FONT_BACKEND(quartz_font, Quartz, auto, [
94 use_quartz_font=$use_quartz
97 CAIRO_ENABLE_SURFACE_BACKEND(quartz_image, Quartz Image, no, [
98 use_quartz_image=$use_quartz
101 dnl ===========================================================================
103 CAIRO_ENABLE_SURFACE_BACKEND(win32, Microsoft Windows, auto, [
104 if test "x$have_windows" != xyes; then
105 use_win32="no (requires a Win32 platform)"
107 win32_LIBS="-lgdi32 -lmsimg32"
110 CAIRO_ENABLE_FONT_BACKEND(win32_font, Microsoft Windows, auto, [
111 use_win32_font=$use_win32
114 test_win32_printing=no
115 if test "x$use_win32" = "xyes"; then
116 AC_CHECK_PROG(GS, gs, gs)
118 AC_DEFINE([CAIRO_CAN_TEST_WIN32_PRINTING_SURFACE], 1, [Define to 1 if the Win32 Printing backend can be tested (needs ghostscript)])
119 test_win32_printing="yes"
121 AC_MSG_WARN([Win32 Printing backend will not be tested since ghostscript is not available])
122 test_win32_printing="no (requires ghostscript)"
126 AM_CONDITIONAL(CAIRO_CAN_TEST_WIN32_PRINTING_SURFACE, test "x$test_win32_printing" = "xyes")
128 dnl ===========================================================================
130 CAIRO_ENABLE_SURFACE_BACKEND(os2, OS/2, no, [
136 use_os2="no (requires an OS/2 platform)"
141 dnl ===========================================================================
143 CAIRO_ENABLE_SURFACE_BACKEND(beos, BeOS/Zeta, no, [
147 dnl Add libbe and libzeta if available
148 AC_CHECK_LIB(be,main,beos_LIBS="$beos_LIBS -lbe")
149 AC_CHECK_LIB(zeta,main,beos_LIBS="$beos_LIBS -lzeta")
152 use_beos="no (requires a BeOS platform)"
157 dnl ===========================================================================
159 CAIRO_ENABLE_FUNCTIONS(png, PNG, yes, [
161 AC_ARG_VAR([png_REQUIRES], [module name for libpng to search for using pkg-config])
162 if test "x$png_REQUIRES" = x; then
163 # libpng13 is GnuWin32's libpng-1.2.8 :-(
164 for l in libpng12 libpng13 libpng10 ; do
165 if $PKG_CONFIG --exists $l ; then
175 if test "x$use_png" = "xyes" ; then
176 PKG_CHECK_MODULES(png, $png_REQUIRES, , AC_MSG_RESULT(no))
178 AC_MSG_WARN([Could not find libpng in the pkg-config search path])
182 dnl ===========================================================================
184 GLITZ_MIN_VERSION=0.5.1
185 CAIRO_ENABLE_SURFACE_BACKEND(glitz, glitz, no, [
186 glitz_REQUIRES="glitz >= $GLITZ_MIN_VERSION"
187 PKG_CHECK_MODULES(glitz, $glitz_REQUIRES, , [AC_MSG_RESULT(no)
188 use_glitz="no (requires $glitz_REQUIRES http://freedesktop.org/Software/glitz)"])
191 if test "x$use_glitz" = "xyes";then
192 PKG_CHECK_MODULES(GLITZ_AGL, glitz-agl >= $GLITZ_MIN_VERSION,
193 [have_glitz_agl=yes], [have_glitz_agl=no; AC_MSG_RESULT(no)])
194 PKG_CHECK_MODULES(GLITZ_EGL, glitz-egl >= $GLITZ_MIN_VERSION,
195 [have_glitz_egl=yes], [have_glitz_egl=no; AC_MSG_RESULT(no)])
196 PKG_CHECK_MODULES(GLITZ_GLX, glitz-glx >= $GLITZ_MIN_VERSION,
197 [have_glitz_glx=yes], [have_glitz_glx=no; AC_MSG_RESULT(no)])
198 PKG_CHECK_MODULES(GLITZ_WGL, glitz-wgl >= $GLITZ_MIN_VERSION,
199 [have_glitz_wgl=yes], [have_glitz_wgl=no; AC_MSG_RESULT(no)])
201 if test "x$have_glitz_agl" = "xyes";then
202 AC_DEFINE(CAIRO_CAN_TEST_GLITZ_AGL_SURFACE, 1, [define if glitz backend can be tested against agl])
204 if test "x$have_glitz_egl" = "xyes";then
205 AC_DEFINE(CAIRO_CAN_TEST_GLITZ_EGL_SURFACE, 1, [define if glitz backend can be tested against egl])
207 if test "x$have_glitz_glx" = "xyes";then
208 AC_DEFINE(CAIRO_CAN_TEST_GLITZ_GLX_SURFACE, 1, [define if glitz backend can be tested against glx])
210 if test "x$have_glitz_wgl" = "xyes";then
211 AC_DEFINE(CAIRO_CAN_TEST_GLITZ_WGL_SURFACE, 1, [define if glitz backend can be tested against wgl])
215 AM_CONDITIONAL(CAIRO_CAN_TEST_GLITZ_AGL_SURFACE, test "x$have_glitz_agl" = "xyes")
216 AM_CONDITIONAL(CAIRO_CAN_TEST_GLITZ_EGL_SURFACE, test "x$have_glitz_egl" = "xyes")
217 AM_CONDITIONAL(CAIRO_CAN_TEST_GLITZ_GLX_SURFACE, test "x$have_glitz_glx" = "xyes")
218 AM_CONDITIONAL(CAIRO_CAN_TEST_GLITZ_WGL_SURFACE, test "x$have_glitz_wgl" = "xyes")
220 dnl ===========================================================================
222 CAIRO_ENABLE_SURFACE_BACKEND(directfb, directfb, no, [
223 directfb_REQUIRES=directfb
224 PKG_CHECK_MODULES(directfb, $directfb_REQUIRES, , AC_MSG_RESULT(no)
225 [use_directfb="no (requires $directfb_REQUIRES http://www.directfb.org)"])
228 dnl ===========================================================================
230 # We use pkg-config to look for freetype2, but fall back to
231 # freetype-config if it fails. We prefer pkg-config, since we can
232 # then just put freetype2 >= $FREETYPE_MIN_VERSION in
233 # Requires.private, but at least up to 2003-06-07, there was no
234 # freetype2.pc in the release.
236 # FreeType versions come in three forms:
237 # release (such as 2.1.9)
238 # libtool (such as 9.7.3) (returned by freetype-config and pkg-config)
239 # platform-specific/soname (such as 6.3.4)
240 # and they recommend you never use the platform-specific version
241 # (see docs/VERSION.DLL in freetype2 sources)
243 # Set these as appropriate:
245 # release number - for information only
246 FREETYPE_MIN_RELEASE=2.1.9
247 # libtool-specific version - this is what is checked
248 FREETYPE_MIN_VERSION=9.7.3
250 CAIRO_ENABLE_FONT_BACKEND(ft, FreeType, auto, [
251 ft_REQUIRES="fontconfig"
252 PKG_CHECK_MODULES(FONTCONFIG, $ft_REQUIRES,,
253 [AC_MSG_RESULT(no); use_ft="no (requires $ft_REQUIRES)"])
255 if test "x$use_ft" = "xyes"; then
257 CAIRO_CHECK_FUNCS_WITH_FLAGS(FcFini, [$FONTCONFIG_CFLAGS], [$FONTCONFIG_LIBS])
259 PKG_CHECK_MODULES(FREETYPE, freetype2 >= $FREETYPE_MIN_VERSION,
260 [freetype_pkgconfig=yes],
262 freetype_pkgconfig=no])
264 if test "x$freetype_pkgconfig" = "xyes"; then
265 ft_REQUIRES="freetype2 >= $FREETYPE_MIN_VERSION $ft_REQUIRES"
268 if test -z "$FREETYPE_CONFIG"; then
269 AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
271 if test "x$FREETYPE_CONFIG" = "xno" ; then
272 use_ft='no (freetype-config not found in path or $FREETYPE_CONFIG)'
274 AC_MSG_CHECKING(freetype2 libtool version)
276 FREETYPE_VERSION=`$FREETYPE_CONFIG --version`
278 VERSION_DEC=`echo $FREETYPE_VERSION | awk -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'`
279 MIN_VERSION_DEC=`echo $FREETYPE_MIN_VERSION | awk -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'`
280 if test $VERSION_DEC -lt $MIN_VERSION_DEC; then
281 AC_MSG_RESULT($FREETYPE_VERSION - Too old)
282 use_ft="no ($FREETYPE_VERSION found; version $FREETYPE_MIN_VERSION from release $FREETYPE_MIN_RELEASE required)"
284 AC_MSG_RESULT($FREETYPE_VERSION - OK)
286 ft_NONPKGCONFIG_CFLAGS=`$FREETYPE_CONFIG --cflags`
287 ft_NONPKGCONFIG_LIBS=`$FREETYPE_CONFIG --libs`
292 ft_CFLAGS="$FREETYPE_CFLAGS $FONTCONFIG_CFLAGS"
293 ft_LIBS="$FREETYPE_LIBS $FONTCONFIG_LIBS"
296 if test "x$use_ft" = "xyes"; then
298 _save_cflags="$CFLAGS"
299 LIBS="$LIBS $ft_LIBS"
300 CFLAGS="$CFLAGS $ft_CFLAGS"
301 AC_CHECK_MEMBER(FT_Bitmap_Size.y_ppem,
302 HAVE_FT_BITMAP_SIZE_Y_PPEM=1,
303 HAVE_FT_BITMAP_SIZE_Y_PPEM=0,
304 [#include <ft2build.h>
305 #include FT_FREETYPE_H])
306 AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,$HAVE_FT_BITMAP_SIZE_Y_PPEM,
307 [FT_Bitmap_Size structure includes y_ppem field])
309 AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table FT_Library_SetLcdFilter)
312 CFLAGS="$_save_cflags"
315 dnl ===========================================================================
317 AC_ARG_ENABLE(pthread,
318 AS_HELP_STRING([--disable-pthread],
319 [Do not use pthread]),
320 [use_pthread=$enableval], [use_pthread=auto])
323 if test "x$use_pthread" != "xno"; then
324 AC_CHECK_HEADERS([pthread.h], have_pthread=yes, have_pthread=no)
326 AM_CONDITIONAL(HAVE_PTHREAD, test "x$have_pthread" = "xyes")
327 if test "x$have_pthread" = xno -a "x$use_pthread" = xyes; then
328 AC_MSG_ERROR([pthread requested but not found])
331 dnl ===========================================================================
333 CAIRO_ENABLE_SURFACE_BACKEND(ps, PostScript, yes, [
334 # The ps backend requires zlib.
336 ps_NONPKGCONFIG_LIBS=-lz
339 dnl ===========================================================================
341 SPECTRE_VERSION_REQUIRED=0.2.0
344 if test "x$use_ps" = "xyes"; then
345 AC_CHECK_PROG(GS, gs, gs)
347 AC_DEFINE([CAIRO_CAN_TEST_PS_SURFACE], 1, [Define to 1 if the PS backend can be tested (needs ghostscript)])
350 AC_MSG_WARN([PS backend will not be tested since ghostscript is not available])
351 test_ps="no (requires ghostscript)"
354 libspectre_DEPENDENCY="libspectre >= $SPECTRE_VERSION_REQUIRED"
355 PKG_CHECK_MODULES(LIBSPECTRE, $libspectre_DEPENDENCY,
360 AM_CONDITIONAL(CAIRO_CAN_TEST_PS_SURFACE, test "x$test_ps" = "xyes")
361 AM_CONDITIONAL(CAIRO_HAS_SPECTRE, test "x$any2ppm_ps" = "xyes")
362 if test "x$any2ppm_ps" = "xyes"; then
363 AC_DEFINE([CAIRO_HAS_SPECTRE], 1, [Define to 1 if libspectre is available])
365 AC_SUBST(LIBSPECTRE_CFLAGS)
366 AC_SUBST(LIBSPECTRE_LIBS)
368 dnl ===========================================================================
370 CAIRO_ENABLE_SURFACE_BACKEND(pdf, PDF, yes, [
371 # The pdf backend requires zlib.
373 pdf_NONPKGCONFIG_LIBS=-lz
376 dnl ===========================================================================
378 # poppler-0.9.2 has an important bug fixes for user-font and an
379 # enhancement not to gobble nearly 1GiB of memory during test/large-font.
380 POPPLER_VERSION_REQUIRED=0.9.2
383 if test "x$use_pdf" = "xyes"; then
384 poppler_DEPENDENCY="poppler-glib >= $POPPLER_VERSION_REQUIRED"
385 PKG_CHECK_MODULES(POPPLER, $poppler_DEPENDENCY pango gtk+-2.0,
386 [CAIRO_CHECK_FUNCS_WITH_FLAGS(poppler_page_render, [$POPPLER_CFLAGS], [$POPPLER_LIBS],
387 [test_pdf=yes; any2ppm_pdf=yes],
388 [AC_MSG_RESULT(no); test_pdf="no (requires $poppler_DEPENDENCY)"])],
389 [AC_MSG_RESULT(no); test_pdf="no (requires $poppler_DEPENDENCY)"])
390 if test "x$test_pdf" = "xyes"; then
391 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)])
393 AC_MSG_WARN([PDF backend will not be tested since poppler >= $POPPLER_VERSION_REQUIRED is not available])
397 AM_CONDITIONAL(CAIRO_CAN_TEST_PDF_SURFACE, test "x$test_pdf" = "xyes")
398 AC_SUBST(POPPLER_CFLAGS)
399 AC_SUBST(POPPLER_LIBS)
401 AM_CONDITIONAL(CAIRO_HAS_MULTI_PAGE_SURFACES, test "x$use_ps" = "xyes" -o "x$use_pdf" = "xyes")
403 dnl ===========================================================================
405 CAIRO_ENABLE_SURFACE_BACKEND(svg, SVG, yes, [
406 if test "x$use_png" != "xyes"; then
407 use_svg="no (requires --enable-png)"
411 LIBRSVG_VERSION_REQUIRED=2.15.0
414 if test "x$use_svg" = "xyes"; then
415 librsvg_DEPENDENCY="librsvg-2.0 >= $LIBRSVG_VERSION_REQUIRED"
416 PKG_CHECK_MODULES(LIBRSVG, $librsvg_DEPENDENCY gdk-2.0,
417 [CAIRO_CHECK_FUNCS_WITH_FLAGS(rsvg_pixbuf_from_file, [$LIBRSVG_CFLAGS], [$LIBRSVG_LIBS],
418 [test_svg=yes; any2ppm_svg=yes],
419 [AC_MSG_RESULT(no); test_svg="no (requires $librsvg_DEPENDENCY)"])],
420 [AC_MSG_RESULT(no); test_svg="no (requires $librsvg_DEPENDENCY)"])
421 if test "x$test_svg" = "xyes"; then
422 AC_DEFINE([CAIRO_CAN_TEST_SVG_SURFACE], 1, [Define to 1 if the SVG backend can be tested])
424 AC_MSG_WARN([SVG backend will not be tested since librsvg >= $LIBRSVG_VERSION_REQUIRED is not available])
428 AM_CONDITIONAL(CAIRO_CAN_TEST_SVG_SURFACE, test "x$test_svg" = "xyes")
429 AC_SUBST(LIBRSVG_CFLAGS)
430 AC_SUBST(LIBRSVG_LIBS)
432 dnl ===========================================================================
434 dnl XXX make this a private feature?
435 CAIRO_ENABLE(test_surfaces, test surfaces, no)
437 dnl ===========================================================================
438 pixman_CFLAGS='-I$(top_srcdir)/../pixman/pixman'
439 pixman_LIBS='$(top_builddir)/../pixman/pixman/libpixman-1.la'
440 AC_SUBST(pixman_CFLAGS)
441 AC_SUBST(pixman_LIBS)
442 CAIRO_ENABLE_SURFACE_BACKEND(image, image, always, [
443 pixman_REQUIRES="pixman-1 >= 0.12.0"
444 PKG_CHECK_MODULES(pixman, $pixman_REQUIRES, , [AC_MSG_RESULT(no)
445 use_image="no (requires $pixman_REQUIRES http://cairographics.org/releases/)"])
446 image_REQUIRES=$pixman_REQUIRES
447 image_CFLAGS=$pixman_CFLAGS
448 image_LIBS=$pixman_LIBS
451 dnl ===========================================================================
453 CAIRO_ENABLE_FONT_BACKEND(user, user, always)
455 dnl ===========================================================================
456 dnl Build the external converter if we have any of the test backends
457 AM_CONDITIONAL(BUILD_ANY2PPM,
458 test "x$any2ppm_svg" = "xyes" \
459 -o "x$any2ppm_pdf" = "xyes" \
460 -o "x$any2ppm_ps" = "xyes")
462 dnl ===========================================================================
464 AC_ARG_ENABLE(some-floating-point,
465 AS_HELP_STRING([--disable-some-floating-point],
466 [Disable certain code paths that rely heavily on double precision
467 floating-point calculation. This option can improve
468 performance on systems without a double precision floating-point
469 unit, but might degrade performance on those that do.]), [
470 if test "x$enableval" = "xno"; then
471 # A value of 'no' for $enableval means that they want to disable, which
472 # means 'yes' for $disable_some_floating_point.
473 disable_some_floating_point=yes
475 ], [disable_some_floating_point=no])
477 AM_CONDITIONAL(DISABLE_SOME_FLOATING_POINT,
478 test "x$disable_some_floating_point" = "xyes")
479 if test "x$disable_some_floating_point" = "xyes"; then
480 AC_DEFINE(DISABLE_SOME_FLOATING_POINT, 1,
481 [Define to 1 to disable certain code paths that rely heavily on
482 double precision floating-point calculation])
485 dnl ===========================================================================
487 # We use GTK+ for some utility/debugging tools
488 PKG_CHECK_MODULES(gtk, "gtk+-2.0",, AC_MSG_RESULT(no))
490 AC_DEFINE([NDEBUG], 1, [I will not assert in platform code. I will not assert in platform code. I will not assert in platform code.])