Upload Tizen2.0 source
[framework/graphics/cairo.git] / configure.ac
1 AC_PREREQ([2.63])
2 CAIRO_PARSE_VERSION
3 AC_INIT([cairo],
4         [cairo_version_major.cairo_version_minor.cairo_version_micro],
5         [http://bugs.freedesktop.org/enter_bug.cgi?product=cairo],
6         [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)
13
14 AM_INIT_AUTOMAKE([1.11 foreign -Wall no-define no-dist-gzip dist-xz])
15 AM_SILENT_RULES([yes])
16
17 # Initialize libtool
18 LT_PREREQ([2.2])
19 LT_INIT([win32-dll])
20
21 # Api documentation
22 GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
23
24 AC_SYS_LARGEFILE
25
26 dnl ===========================================================================
27 dnl
28 dnl The order of the includes here is rather important
29 dnl
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
38 AC_CACHE_SAVE
39
40 dnl ===========================================================================
41
42 AC_CHECK_LIB(z, compress,
43          [AC_CHECK_HEADER(zlib.h, [
44           have_libz=yes
45           AC_DEFINE(HAVE_ZLIB, 1, [Define to 1 if you have zlib available])
46          ],
47          [have_libz="no (requires zlib http://www.gzip.org/zlib/)"])],
48          [have_libz="no (requires zlib http://www.gzip.org/zlib/)"])
49
50 AC_CHECK_LIB(dl, dlsym,
51              [have_dlsym=yes; have_dl=yes],
52              [have_dlsym=no; have_dl=no])
53 if test "x$have_dlsym" = "xno"; then
54    AC_CHECK_FUNC(dlsym, [have_dlsym=yes], [have_dlsym=no])
55 fi
56 AC_CHECK_HEADERS(dlfcn.h, [have_dlsym=yes], [have_dlsym=no])
57 AM_CONDITIONAL(CAIRO_HAS_DL, test "x$have_dl" = "xyes")
58 if test "x$have_dlsym" = "xyes"; then
59   AC_DEFINE([CAIRO_HAS_DLSYM], 1, [Define to 1 if dlsym is available])
60 fi
61 AM_CONDITIONAL(CAIRO_HAS_DLSYM, test "x$have_dlsym" = "xyes")
62
63 dnl ===========================================================================
64
65 CAIRO_ENABLE_SURFACE_BACKEND(xlib, Xlib, auto, [
66   xlib_REQUIRES="x11"
67   PKG_CHECK_MODULES(xlib, $xlib_REQUIRES, ,
68                     [AC_MSG_RESULT(no)
69                      xlib_REQUIRES=""
70                      AC_PATH_XTRA
71                      if test "x$no_x" = xyes; then
72                        use_xlib="no (requires X development libraries)"
73                      else
74                        xlib_NONPKGCONFIG_LIBS="$X_PRE_LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
75                        xlib_NONPKGCONFIG_CFLAGS=$X_CFLAGS
76                      fi])
77 ])
78
79 CAIRO_ENABLE_SURFACE_BACKEND(xlib_xrender, Xlib Xrender, auto, [
80   if test "x$use_xlib" != "xyes"; then
81     use_xlib_xrender="no (requires --enable-xlib)"
82   else
83     dnl Check for Xrender header files if the Xrender package is not installed:
84     xlib_xrender_BASE=cairo-xlib
85     xlib_xrender_REQUIRES="xrender >= 0.6"
86     PKG_CHECK_MODULES(xlib_xrender, $xlib_xrender_REQUIRES, ,
87                       [AC_MSG_RESULT(no)
88                        xlib_xrender_REQUIRES=""
89                        old_CPPFLAGS=$CPPFLAGS
90                        CPPFLAGS="$CPPFLAGS $xlib_CFLAGS $xlib_NONPKGCONFIG_CFLAGS"
91                        AC_CHECK_HEADER(X11/extensions/Xrender.h,
92                                        [xlib_xrender_NONPKGCONFIG_LIBS="-lXrender"],
93                                        [use_xlib_xrender="no (requires $xlib_xrender_REQUIRES http://freedesktop.org/Software/xlibs)"])
94                        CPPFLAGS=$old_CPPFLAGS
95                       ])
96
97     old_CFLAGS=$CFLAGS
98     old_LIBS=$LIBS
99     CFLAGS="$CFLAGS $xlib_CFLAGS $xlib_NONPKGCONFIG_CFLAGS $xlib_xrender_CFLAGS $xlib_xrender_NONPKGCONFIG_CFLAGS"
100     LIBS="$LIBS $xlib_LIBS $xlib_NONPKGCONFIG_LIBS $xlib_xrender_LIBS $xlib_xrender_NONPKGCONFIG_LIBS"
101     AC_CHECK_FUNCS([XRenderCreateLinearGradient XRenderCreateRadialGradient XRenderCreateConicalGradient])
102     CFLAGS=$old_CFLAGS
103     LIBS=$old_LIBS
104
105   fi
106 ])
107
108 dnl ===========================================================================
109
110 CAIRO_ENABLE_SURFACE_BACKEND(xcb, XCB, auto, [
111   xcb_REQUIRES="xcb >= 1.6 xcb-render >= 1.6"
112   PKG_CHECK_MODULES(xcb, $xcb_REQUIRES, ,
113                     [AC_MSG_RESULT(no)
114                     use_xcb="no (requires $xcb_REQUIRES http://xcb.freedesktop.org)"])
115 ])
116
117 CAIRO_ENABLE_FUNCTIONS(xlib_xcb, Xlib/XCB, no, [
118   if test "x$use_xcb" = "xyes" -a "x$use_xlib" = "xyes"; then
119     xlib_xcb_REQUIRES="x11-xcb"
120     PKG_CHECK_MODULES(xlib_xcb, $xlib_xcb_REQUIRES, ,
121                       [AC_MSG_RESULT(no)
122                       use_xlib_xcb="no (requires $xlib_xcb_REQUIRES http://xcb.freedesktop.org)"])
123   else
124     use_xlib_xcb="no (requires both --enable-xlib and --enable-xcb)"
125   fi
126 ])
127
128 CAIRO_ENABLE_FUNCTIONS(xcb_shm, XCB/SHM, auto, [
129   if test "x$use_xcb" = "xyes"; then
130       xcb_shm_REQUIRES="xcb-shm"
131       PKG_CHECK_MODULES(xcb_shm, $xcb_shm_REQUIRES, ,
132                         [AC_MSG_RESULT(no)
133                         use_xcb_shm="no (requires $xcb_shm http://xcb.freedesktop.org)"])
134   else
135     use_xcb_shm="no (requires --enable-xcb)"
136   fi
137 ])
138
139 dnl ===========================================================================
140
141 CAIRO_ENABLE_SURFACE_BACKEND(qt, Qt, no, [
142   qt_REQUIRES="QtGui >= 4.4.0"
143   PKG_CHECK_MODULES(qt, $qt_REQUIRES, ,
144                     [AC_MSG_RESULT(no)
145                      qt_REQUIRES=""
146                      use_qt="no (requires Qt4 development libraries)"
147                      ])
148 ])
149
150 dnl ===========================================================================
151
152 CAIRO_ENABLE_SURFACE_BACKEND(quartz, Quartz, auto, [
153   dnl There is no pkgconfig for quartz; lets do a header check
154   AC_CHECK_HEADER(ApplicationServices/ApplicationServices.h, , [use_quartz="no (requires ApplicationServices framework)"])
155   if test "x$use_quartz" != "xyes" ; then
156     dnl check for CoreGraphics as a separate framework
157     AC_CHECK_HEADER(CoreGraphics/CoreGraphics.h, , [use_quartz="no (requires CoreGraphics framework)"])
158     quartz_LIBS="-Xlinker -framework -Xlinker CoreGraphics"
159   else
160     quartz_LIBS="-Xlinker -framework -Xlinker ApplicationServices"
161   fi
162 ])
163
164 CAIRO_ENABLE_FONT_BACKEND(quartz_font, Quartz, auto, [
165   use_quartz_font=$use_quartz
166 ])
167
168 CAIRO_ENABLE_SURFACE_BACKEND(quartz_image, Quartz Image, no, [
169   use_quartz_image=$use_quartz
170 ])
171
172 dnl ===========================================================================
173
174 CAIRO_ENABLE_SURFACE_BACKEND(win32, Microsoft Windows, auto, [
175   if test "x$have_windows" != xyes; then
176     use_win32="no (requires a Win32 platform)"
177   fi
178   win32_LIBS="-lgdi32 -lmsimg32"
179 ])
180
181 CAIRO_ENABLE_FONT_BACKEND(win32_font, Microsoft Windows, auto, [
182   use_win32_font=$use_win32
183 ])
184
185 test_win32_printing=no
186 if test "x$use_win32" = "xyes"; then
187   AC_CHECK_PROG(GS, gs, gs)
188   if test "$GS"; then
189     AC_DEFINE([CAIRO_CAN_TEST_WIN32_PRINTING_SURFACE], 1, [Define to 1 if the Win32 Printing backend can be tested (needs ghostscript)])
190     test_win32_printing="yes"
191   else
192     AC_MSG_WARN([Win32 Printing backend will not be tested since ghostscript is not available])
193     test_win32_printing="no (requires ghostscript)"
194   fi
195 fi
196
197 AM_CONDITIONAL(CAIRO_CAN_TEST_WIN32_PRINTING_SURFACE, test "x$test_win32_printing" = "xyes")
198
199 dnl ===========================================================================
200
201 CAIRO_ENABLE_SURFACE_BACKEND(skia, Skia, no, [
202   AC_ARG_WITH([skia],
203               [AS_HELP_STRING([--with-skia=/path/to/skia],
204                               [directory to find compiled skia sources])],
205               [skia_DIR="$withval"],
206               [skia_DIR="`pwd`/../skia"])
207   AC_ARG_WITH([skia-bulid],
208               [AS_HELP_STRING([--with-skia-build=(Release|Debug)]
209                               [build of skia to link with, default is Release])],
210               [skia_BUILD="$withval"],
211               [skia_BUILD="Release"])
212   skia_NONPKGCONFIG_CFLAGS="-I$skia_DIR/include/config -I$skia_DIR/include/core -I$skia_DIR/include/effects"
213   if test "x$skia_BUILD" = x"Release"; then
214         skia_NONPKGCONFIG_CFLAGS="-DSK_RELEASE -DSK_CAN_USE_FLOAT $skia_NONPKGCONFIG_CFLAGS"
215   fi
216   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"
217   AC_SUBST(skia_DIR)
218 ])
219
220 dnl ===========================================================================
221
222 CAIRO_ENABLE_SURFACE_BACKEND(os2, OS/2, no, [
223   case "$host" in
224     *-*-os2*)
225       :
226       ;;
227     *)
228       use_os2="no (requires an OS/2 platform)"
229       ;;
230   esac
231 ])
232
233 dnl ===========================================================================
234
235 CAIRO_ENABLE_SURFACE_BACKEND(beos, BeOS/Zeta, no, [
236   case "$host" in
237     *-*-beos)
238       beos_LIBS=""
239       dnl Add libbe and libzeta if available
240       AC_CHECK_LIB(be,main,beos_LIBS="$beos_LIBS -lbe")
241       AC_CHECK_LIB(zeta,main,beos_LIBS="$beos_LIBS -lzeta")
242       ;;
243     *)
244       use_beos="no (requires a BeOS platform)"
245       ;;
246   esac
247 ])
248
249 dnl ===========================================================================
250
251 CAIRO_ENABLE_SURFACE_BACKEND(drm, DRM, no, [
252   drm_REQUIRES="libudev >= 136"
253   PKG_CHECK_MODULES(drm, $drm_REQUIRES, , [AC_MSG_RESULT(no)
254   use_drm="no (requires $drm_REQUIRES, udev is available from git://git.kernel.org/pub/scm/linux/hotplug/udev.git)"])
255 ])
256
257 CAIRO_ENABLE_SURFACE_BACKEND(gallium, Gallium3D, no, [
258   if test "x$use_drm" = "xyes"; then
259       AC_ARG_WITH([gallium],
260                   [AS_HELP_STRING([--with-gallium=/path/to/mesa],
261                                   [directory to find gallium enabled mesa])],
262                   [mesa_DIR="$withval"],
263                   [mesa_DIR="`pwd`/../mesa"])
264       gallium_DIR="$mesa_DIR/src/gallium"
265       gallium_NONPKGCONFIG_CFLAGS="-I$mesa_DIR/include -I$mesa_DIR/src/mesa -I$gallium_DIR/include -I$gallium_DIR/auxiliary"
266       gallium_NONPKGCONFIG_LIBS="-lGL"
267       AC_SUBST(mesa_DIR)
268       AC_SUBST(gallium_DIR)
269   else
270     use_gallium="no (requires --enable-drm)"
271   fi
272 ])
273
274 dnl ===========================================================================
275
276 CAIRO_ENABLE_FUNCTIONS(png, PNG, yes, [
277   use_png=no
278   AC_ARG_VAR([png_REQUIRES], [module name for libpng to search for using pkg-config])
279   if test "x$png_REQUIRES" = x; then
280     # libpng13 is GnuWin32's libpng-1.2.8 :-(
281     for l in libpng libpng14 libpng12 libpng13 libpng10; do
282       if $PKG_CONFIG --exists $l ; then
283         png_REQUIRES=$l
284         use_png=yes
285         break
286       fi
287     done
288   else
289     use_png=yes
290   fi
291
292   if test "x$use_png" = "xyes" ; then 
293     PKG_CHECK_MODULES(png, $png_REQUIRES, , AC_MSG_RESULT(no))
294   else
295     AC_MSG_WARN([Could not find libpng in the pkg-config search path])
296   fi    
297 ])
298
299 dnl ===========================================================================
300 CAIRO_ENABLE_SURFACE_BACKEND(gl, OpenGL, no, [
301   gl_REQUIRES="gl"
302   PKG_CHECK_MODULES(gl, $gl_REQUIRES,, [
303           dnl Fallback to searching for headers
304           AC_CHECK_HEADER(GL/gl.h,, [use_gl="no (gl.pc nor OpenGL headers not found)"])
305           if test "x$use_gl" = "xyes"; then
306               gl_NONPKGCONFIG_CFLAGS=
307               gl_NONPKGCONFIG_LIBS="-lGL"
308           fi])
309
310   if test "x$have_dl" = "xyes" -a "x$have_dlsym" = "xyes"; then
311     gl_LIBS="$gl_LIBS -ldl"
312   fi
313
314   need_glx_functions=yes
315   need_wgl_functions=yes
316   need_egl_functions=yes
317 ])
318
319 dnl ===========================================================================
320 CAIRO_ENABLE_SURFACE_BACKEND(glesv2, OpenGLESv2, no, [
321   glesv2_REQUIRES="gles20"
322   PKG_CHECK_MODULES(glesv2, $glesv2_REQUIRES,, [
323           dnl Fallback to searching for headers
324           AC_CHECK_HEADER(GLES2/gl2.h,, [use_glesv2="no (glesv2.pc nor OpenGL ES 2.0 headers not found)"])
325           if test "x$use_glesv2" = "xyes"; then
326               glesv2_NONPKGCONFIG_CFLAGS=
327               glesv2_NONPKGCONFIG_LIBS="-lGLESv2"
328           fi])
329
330   if test "x$have_dl" = "xyes" -a "x$have_dlsym" = "xyes"; then
331     glesv2_LIBS="$glesv2_LIBS -ldl"
332   fi
333
334   need_egl_functions=yes
335 ])
336
337 dnl ===========================================================================
338 CAIRO_ENABLE_SURFACE_BACKEND(cogl, Cogl, no, [
339   cogl_REQUIRES="cogl-2.0-experimental"
340   PKG_CHECK_MODULES(cogl, $cogl_REQUIRES,, [use_cogl="no"])
341 ])
342
343 dnl ===========================================================================
344
345 CAIRO_ENABLE_SURFACE_BACKEND(directfb, directfb, no, [
346   directfb_REQUIRES=directfb
347   PKG_CHECK_MODULES(directfb, $directfb_REQUIRES, , AC_MSG_RESULT(no)
348                     [use_directfb="no (requires $directfb_REQUIRES http://www.directfb.org)"])
349 ])
350
351 dnl ===========================================================================
352
353 CAIRO_ENABLE_SURFACE_BACKEND(vg, OpenVG, no, [
354   dnl There is no pkgconfig for OpenVG; lets do a header check
355   AC_CHECK_HEADER(VG/openvg.h,, [use_vg="no (OpenVG headers not found)"])
356   if test "x$use_vg" = "xyes"; then
357       vg_NONPKGCONFIG_CFLAGS=
358       vg_NONPKGCONFIG_LIBS="-lOpenVG"
359       need_egl_functions=yes
360       need_glx_functions=yes
361   fi
362 ])
363
364 CAIRO_ENABLE_FUNCTIONS(egl, EGL, auto, [
365   if test "x$need_egl_functions" = "xyes"; then
366       egl_REQUIRES="egl"
367       PKG_CHECK_MODULES(egl, $egl_REQUIRES, ,
368                     [egl_REQUIRES=""
369                      AC_CHECK_HEADER(EGL/egl.h,, [use_egl="no (EGL headers not found)"])
370                      if test "x$use_egl" = "xyes"; then
371                          egl_NONPKGCONFIG_CFLAGS=
372                          egl_NONPKGCONFIG_LIBS=
373                          save_LIBS="$LIBS"
374                          other_egl_LIBS=""
375                          # Temporary workaround for missing link from egl13
376                          AC_CHECK_LIB(csi, csi_stream_attachresource, other_egl_LIBS="-lcsi")
377                          LIBS="$other_egl_LIBS $LIBS"
378                          for egl_lib in EGL egl13 egl12 egl11; do
379                              if test -z "$egl_NONPKGCONFIG_LIBS"; then
380                                  AC_CHECK_LIB($egl_lib, eglGetError, egl_NONPKGCONFIG_LIBS="-l$egl_lib")
381                              fi
382                          done
383                          if test -z "$egl_NONPKGCONFIG_LIBS"; then
384                              use_egl="no (EGL library not found)"
385                          else
386                              egl_NONPKGCONFIG_LIBS="$egl_NONPKGCONFIG_LIBS $other_egl_LIBS"
387                          fi
388                          LIBS="$save_LIBS"
389                      fi
390         ])
391   else
392       use_egl="no (not required by any backend)"
393   fi
394 ])
395
396 CAIRO_ENABLE_FUNCTIONS(glx, GLX, auto, [
397   if test "x$need_glx_functions" = "xyes"; then
398     save_CFLAGS="$CFLAGS"
399     CFLAGS="$CFLAGS $gl_CFLAGS $gl_NONPKGCONFIG_CFLAGS"
400     AC_CHECK_HEADER(GL/glx.h,, [use_glx="no (GLX headers not found)"])
401     glx_NONPKGCONFIG_CFLAGS=
402     glx_NONPKGCONFIG_LIBS="-lGL"
403     CFLAGS="$save_CFLAGS"
404   else
405       use_glx="no (not required by any backend)"
406   fi
407 ])
408
409 CAIRO_ENABLE_FUNCTIONS(wgl, WGL, auto, [
410   if test "x$need_wgl_functions" = "xyes"; then
411     AC_CHECK_HEADER(windows.h,, [use_wgl="no (WGL headers not found)"])
412   else
413       use_wgl="no (not required by any backend)"
414   fi
415 ])
416
417 dnl ===========================================================================
418
419 any2ppm_cs=no
420 CAIRO_ENABLE_SURFACE_BACKEND(script, script, yes, [
421   any2ppm_cs=yes
422 ])
423
424 dnl ===========================================================================
425
426 # We use pkg-config to look for freetype2, but fall back to
427 # freetype-config if it fails.  We prefer pkg-config, since we can
428 # then just put freetype2 >= $FREETYPE_MIN_VERSION in
429 # Requires.private, but at least up to 2003-06-07, there was no
430 # freetype2.pc in the release.
431 #
432 # FreeType versions come in three forms:
433 #   release (such as 2.1.9)
434 #   libtool (such as 9.7.3) (returned by freetype-config and pkg-config)
435 #   platform-specific/soname (such as 6.3.4)
436 # and they recommend you never use the platform-specific version
437 # (see docs/VERSION.DLL in freetype2 sources)
438 #
439 # Set these as appropriate:
440
441 # release number - for information only
442 FREETYPE_MIN_RELEASE=2.1.9
443 # libtool-specific version - this is what is checked
444 FREETYPE_MIN_VERSION=9.7.3
445
446 CAIRO_ENABLE_FONT_BACKEND(ft, FreeType, auto, [
447
448     PKG_CHECK_MODULES(FREETYPE, freetype2 >= $FREETYPE_MIN_VERSION,
449                       [freetype_pkgconfig=yes],
450                       [AC_MSG_RESULT(no)
451                        freetype_pkgconfig=no])
452   
453     if test "x$freetype_pkgconfig" = "xyes"; then
454       ft_REQUIRES="freetype2 >= $FREETYPE_MIN_VERSION $ft_REQUIRES"
455     else
456   
457       if test -z "$FREETYPE_CONFIG"; then
458         AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
459       fi
460       if test "x$FREETYPE_CONFIG" = "xno" ; then
461         use_ft='no (freetype-config not found in path or $FREETYPE_CONFIG)'
462       else
463         AC_MSG_CHECKING(freetype2 libtool version)
464
465         FREETYPE_VERSION=`$FREETYPE_CONFIG --version`
466         AX_COMPARE_VERSION([$FREETYPE_VERSION], [gt], [$FREETYPE_MIN_VERSION],
467                            [AC_MSG_RESULT($FREETYPE_VERSION - OK)
468                            ft_NONPKGCONFIG_CFLAGS=`$FREETYPE_CONFIG --cflags`
469                            ft_NONPKGCONFIG_LIBS=`$FREETYPE_CONFIG --libs`],
470                            [AC_MSG_RESULT($FREETYPE_VERSION - Too old)
471                            use_ft="no ($FREETYPE_VERSION found; version $FREETYPE_MIN_VERSION from release $FREETYPE_MIN_RELEASE required)"])
472       fi
473     fi
474
475   ft_CFLAGS="$FREETYPE_CFLAGS"
476   ft_LIBS="$FREETYPE_LIBS"
477 ])
478
479 FONTCONFIG_MIN_VERSION=2.2.95
480 CAIRO_ENABLE_FONT_BACKEND(fc, Fontconfig, auto, [
481   use_fc=$use_ft
482   if test "x$use_fc" = "xyes"; then
483     fc_REQUIRES="fontconfig >= $FONTCONFIG_MIN_VERSION"
484     PKG_CHECK_MODULES(FONTCONFIG, $fc_REQUIRES,,
485                       [AC_MSG_RESULT(no); use_fc="no (requires $fc_REQUIRES)"])
486   fi
487   fc_CFLAGS="$FONTCONFIG_CFLAGS"
488   fc_LIBS="$FONTCONFIG_LIBS"
489 ])
490
491 if test "x$use_ft" = "xyes"; then
492   _save_libs="$LIBS"
493   _save_cflags="$CFLAGS"
494   LIBS="$LIBS $ft_LIBS"
495   CFLAGS="$CFLAGS $ft_CFLAGS"
496   AC_CHECK_MEMBER(FT_Bitmap_Size.y_ppem,
497                   HAVE_FT_BITMAP_SIZE_Y_PPEM=1,
498                   HAVE_FT_BITMAP_SIZE_Y_PPEM=0,
499                   [#include <ft2build.h>
500                    #include FT_FREETYPE_H])
501   AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,$HAVE_FT_BITMAP_SIZE_Y_PPEM,
502                      [FT_Bitmap_Size structure includes y_ppem field])
503
504   AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_GlyphSlot_Oblique FT_Load_Sfnt_Table FT_Library_SetLcdFilter)
505
506   LIBS="$_save_libs"
507   CFLAGS="$_save_cflags"
508 fi
509
510 if test "x$use_fc" = "xyes"; then
511   CAIRO_CHECK_FUNCS_WITH_FLAGS(FcInit FcFini, [$FONTCONFIG_CFLAGS], [$FONTCONFIG_LIBS])
512 fi
513
514 dnl ===========================================================================
515
516 CAIRO_ENABLE_SURFACE_BACKEND(ps, PostScript, yes, [
517     # The ps backend requires zlib.
518     use_ps=$have_libz
519     ps_NONPKGCONFIG_LIBS=-lz
520 ])
521
522 dnl ===========================================================================
523
524 SPECTRE_VERSION_REQUIRED=0.2.0
525 test_ps=no
526 any2ppm_ps=no
527 if test "x$use_ps" = "xyes"; then
528   AC_CHECK_PROG(GS, gs, gs)
529   if test "$GS"; then
530     AC_DEFINE([CAIRO_CAN_TEST_PS_SURFACE], 1, [Define to 1 if the PS backend can be tested (needs ghostscript)])
531     test_ps="yes"
532   else
533     AC_MSG_WARN([PS backend will not be tested since ghostscript is not available])
534     test_ps="no (requires ghostscript)"
535   fi
536
537   libspectre_DEPENDENCY="libspectre >= $SPECTRE_VERSION_REQUIRED"
538   PKG_CHECK_MODULES(LIBSPECTRE, $libspectre_DEPENDENCY,
539                     [any2ppm_ps=yes],
540                     [test_ps="no (requires libspectre)"])
541 fi
542
543 AM_CONDITIONAL(CAIRO_CAN_TEST_PS_SURFACE, test "x$test_ps" = "xyes")
544 AM_CONDITIONAL(CAIRO_HAS_SPECTRE, test "x$any2ppm_ps" = "xyes")
545 if test "x$any2ppm_ps" = "xyes"; then
546     AC_DEFINE([CAIRO_HAS_SPECTRE], 1, [Define to 1 if libspectre is available])
547 fi
548 AC_SUBST(LIBSPECTRE_CFLAGS)
549 AC_SUBST(LIBSPECTRE_LIBS)
550
551 dnl ===========================================================================
552
553 CAIRO_ENABLE_SURFACE_BACKEND(pdf, PDF, yes, [
554     # The pdf backend requires zlib.
555     use_pdf=$have_libz
556     pdf_NONPKGCONFIG_LIBS=-lz
557 ])
558
559 dnl ===========================================================================
560
561 # poppler-0.17.4 fixes text-pattern and text-transform
562 POPPLER_VERSION_REQUIRED=0.17.4
563 test_pdf=no
564 any2ppm_pdf=no
565 if test "x$use_pdf" = "xyes"; then
566   poppler_DEPENDENCY="poppler-glib >= $POPPLER_VERSION_REQUIRED"
567   PKG_CHECK_MODULES(POPPLER, $poppler_DEPENDENCY,
568                     [CAIRO_CHECK_FUNCS_WITH_FLAGS(poppler_page_render, [$POPPLER_CFLAGS], [$POPPLER_LIBS],
569                     [test_pdf=yes; any2ppm_pdf=yes],
570                     [test_pdf="no (requires $poppler_DEPENDENCY)"])],
571                     [test_pdf="no (requires $poppler_DEPENDENCY)"])
572   if test "x$test_pdf" = "xyes"; then
573     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)])
574   else
575     AC_MSG_WARN([PDF backend will not be tested since poppler >= $POPPLER_VERSION_REQUIRED is not available])
576   fi
577 fi
578
579 AM_CONDITIONAL(CAIRO_CAN_TEST_PDF_SURFACE, test "x$test_pdf" = "xyes")
580 AC_SUBST(POPPLER_CFLAGS)
581 AC_SUBST(POPPLER_LIBS)
582
583 AM_CONDITIONAL(CAIRO_HAS_MULTI_PAGE_SURFACES, test "x$use_ps" = "xyes" -o "x$use_pdf" = "xyes")
584
585 dnl ===========================================================================
586
587 CAIRO_ENABLE_SURFACE_BACKEND(svg, SVG, yes, [
588   if test "x$use_png" != "xyes"; then
589     use_svg="no (requires --enable-png)"
590   fi
591 ])
592
593 LIBRSVG_VERSION_REQUIRED=2.15.0
594 test_svg=no
595 any2ppm_svg=no
596 if test "x$use_svg" = "xyes"; then
597   librsvg_DEPENDENCY="librsvg-2.0 >= $LIBRSVG_VERSION_REQUIRED"
598   PKG_CHECK_MODULES(LIBRSVG, $librsvg_DEPENDENCY gdk-2.0,
599                     [CAIRO_CHECK_FUNCS_WITH_FLAGS(rsvg_pixbuf_from_file, [$LIBRSVG_CFLAGS], [$LIBRSVG_LIBS],
600                     [test_svg=yes; any2ppm_svg=yes],
601                     [test_svg="no (requires $librsvg_DEPENDENCY)"])],
602                     [test_svg="no (requires $librsvg_DEPENDENCY)"])
603   if test "x$test_svg" = "xyes"; then
604     AC_DEFINE([CAIRO_CAN_TEST_SVG_SURFACE], 1, [Define to 1 if the SVG backend can be tested])
605   else
606     AC_MSG_WARN([SVG backend will not be tested since librsvg >= $LIBRSVG_VERSION_REQUIRED is not available])
607   fi
608 fi
609
610 AM_CONDITIONAL(CAIRO_CAN_TEST_SVG_SURFACE, test "x$test_svg" = "xyes")
611 AC_SUBST(LIBRSVG_CFLAGS)
612 AC_SUBST(LIBRSVG_LIBS)
613
614 dnl ===========================================================================
615
616 dnl XXX make this a private feature?
617 CAIRO_ENABLE(test_surfaces, test surfaces, no)
618
619 dnl ===========================================================================
620
621 CAIRO_ENABLE_SURFACE_BACKEND(image, image, always, [
622   pixman_REQUIRES="pixman-1 >= 0.22.0"
623   PKG_CHECK_MODULES(pixman, $pixman_REQUIRES, , [AC_MSG_RESULT(no)
624   use_image="no (requires $pixman_REQUIRES http://cairographics.org/releases/)"])
625   image_REQUIRES=$pixman_REQUIRES
626   image_CFLAGS=$pixman_CFLAGS
627   image_LIBS=$pixman_LIBS
628 ])
629
630 dnl ===========================================================================
631
632 CAIRO_ENABLE_SURFACE_BACKEND(mime, mime, always)
633 CAIRO_ENABLE_SURFACE_BACKEND(recording, recording, always)
634 CAIRO_ENABLE_SURFACE_BACKEND(observer, observer, always)
635 CAIRO_ENABLE_SURFACE_BACKEND(tee, tee, no)
636 CAIRO_ENABLE_SURFACE_BACKEND(xml, xml, no, [
637     use_xml=$have_libz
638     xml_NONPKGCONFIG_LIBS=-lz
639 ])
640
641 dnl ===========================================================================
642
643 CAIRO_ENABLE_FONT_BACKEND(user, user, always)
644
645 dnl ===========================================================================
646 dnl
647 dnl This needs to be last on our list of features so that the pthread libs and flags
648 dnl gets prefixed in front of everything else in CAIRO_{CFLAGS,LIBS}.
649 dnl
650 have_real_pthread=no
651 have_pthread=no
652 CAIRO_ENABLE(pthread, pthread, auto, [CAIRO_CONFIGURE_PTHREAD])
653 AM_CONDITIONAL(HAVE_REAL_PTHREAD, test "x$use_pthread" = "xyes" -a "x$have_real_pthread" = "xyes")
654 AM_CONDITIONAL(HAVE_PTHREAD, test "x$use_pthread" = "xyes")
655 AC_SUBST(pthread_CFLAGS)
656 AC_SUBST(pthread_LIBS)
657 AC_SUBST(real_pthread_CFLAGS)
658 AC_SUBST(real_pthread_LIBS)
659
660
661 dnl ===========================================================================
662 dnl Build gobject integration library
663
664 CAIRO_ENABLE_FUNCTIONS(gobject, gobject, auto, [
665   gobject_REQUIRES="gobject-2.0 glib-2.0"
666   PKG_CHECK_MODULES(GOBJECT, $gobject_REQUIRES, , [AC_MSG_RESULT(no)
667   use_gobject="no (requires $gobject_REQUIRES http://download.gnome.org/pub/GNOME/sources/glib/)"])
668   gobject_NONPKGCONFIG_EXTRA_LIBS="-L\${libdir} -lcairo-gobject"
669 ])
670 dnl I'm too lazy to fix the caching properly
671 if test "x$use_gobject" = "xyes"; then
672   PKG_CHECK_MODULES(GOBJECT, $gobject_REQUIRES)
673 fi
674
675 dnl ===========================================================================
676 dnl Default to quick testing during development, but force a full test before
677 dnl release
678
679 AC_ARG_ENABLE(full-testing,
680   AS_HELP_STRING([--enable-full-testing],
681                  [Sets the test suite to perform full testing by default, which
682                   will dramatically slow down make check, but is a
683                   *requirement* before release.]), [
684 if test "x$enableval" = "xyes"; then
685     CAIRO_TEST_MODE=full
686     AC_SUBST(CAIRO_TEST_MODE)
687 fi
688 ])
689
690 dnl ===========================================================================
691 dnl Build the external converter if we have any of the test backends
692 AM_CONDITIONAL(BUILD_ANY2PPM,
693                test "x$any2ppm_svg" = "xyes" \
694                  -o "x$any2ppm_pdf" = "xyes" \
695                  -o "x$any2ppm_ps"  = "xyes" \
696                  -o "x$any2ppm_cs"  = "xyes")
697
698 dnl ===========================================================================
699 dnl Some utilities need to dlopen the shared libraries, so they need to
700 dnl know how libtools will name them
701
702 case $host in
703 *-*-darwin*)
704         SHLIB_EXT="dylib"
705         ;;
706 *)
707         SHLIB_EXT="so"
708         ;;
709 esac
710 AC_DEFINE_UNQUOTED(SHARED_LIB_EXT, "${SHLIB_EXT}", [Shared library file extension])
711 AC_SUBST(SHLIB_EXT)
712
713 dnl ===========================================================================
714 dnl The tracing utility requires LD_PRELOAD, so only build it for systems
715 dnl that are known to work.
716
717 case $host in
718 *-linux*|*-*bsd*|*-solaris*|*-*-darwin*|*-dragonfly*|*-*-gnu*)
719         have_ld_preload="yes"
720         ;;
721 *)
722         have_ld_preload="no"
723         ;;
724 esac
725
726 CAIRO_ENABLE(trace, cairo-trace, auto, [
727         if test "x$have_ld_preload" != "xyes" -o \
728                 "x$have_libz" != "xyes" -o \
729                 "x$have_real_pthread" != "xyes" -o \
730                 "x$have_dlsym" != "xyes"; then
731                 use_trace="no (requires dynamic linker and zlib and real pthreads)"
732         fi
733 ])
734
735 CAIRO_ENABLE(interpreter, cairo-script-interpreter, yes, [
736         if test "x$have_libz" != "xyes"; then
737                 use_interpreter="no (requires zlib)"
738         fi
739 ])
740
741 AC_CHECK_LIB(bfd, bfd_openr,
742          [AC_CHECK_HEADER(bfd.h, [have_bfd=yes],
743          [have_bfd=no])], [have_bfd=no])
744 AC_CHECK_HEADER(libiberty.h,, [have_bfd=no])
745 if test "x$have_bfd" = "xyes"; then
746     AC_DEFINE([HAVE_BFD], [1], [Define to 1 if you have the binutils development files installed])
747     BFD_LIBS=-lbfd
748     AC_SUBST(BFD_LIBS)
749 fi
750
751 CAIRO_ENABLE(symbol_lookup, symbol-lookup, auto, [
752         if test "x$have_bfd" != "xyes"; then
753                 use_symbol_lookup="no (requires bfd)"
754         fi
755 ])
756
757 PKG_CHECK_MODULES(glib, glib-2.0, have_glib=yes, have_glib=no)
758 AC_SUBST(glib_CFLAGS)
759 AC_SUBST(glib_LIBS)
760 AM_CONDITIONAL(BUILD_SPHINX, test "x$have_glib" = "xyes")
761
762 save_LIBS="$LIBS"
763 AC_CHECK_LIB(rt, shm_open, shm_LIBS="-lrt")
764 AC_SUBST(shm_LIBS)
765 LIBS="$save_LIBS"
766
767 dnl ===========================================================================
768
769 AC_ARG_ENABLE(some-floating-point,
770   AS_HELP_STRING([--disable-some-floating-point],
771                  [Disable certain code paths that rely heavily on double precision
772                   floating-point calculation. This option can improve
773                   performance on systems without a double precision floating-point
774                   unit, but might degrade performance on those that do.]), [
775 if test "x$enableval" = "xno"; then
776   # A value of 'no' for $enableval means that they want to disable, which
777   # means 'yes' for $disable_some_floating_point.
778   disable_some_floating_point=yes
779 fi
780 ], [disable_some_floating_point=no])
781
782 AM_CONDITIONAL(DISABLE_SOME_FLOATING_POINT,
783                test "x$disable_some_floating_point" = "xyes")
784 if test "x$disable_some_floating_point" = "xyes"; then
785   AC_DEFINE(DISABLE_SOME_FLOATING_POINT, 1,
786             [Define to 1 to disable certain code paths that rely heavily on
787              double precision floating-point calculation])
788 fi
789
790 dnl ===========================================================================
791
792 dnl Extra stuff we need to do when building C++ code
793 need_cxx="no"
794 AS_IF([test "x$use_skia" = "xyes"], [need_cxx="yes"])
795 AS_IF([test "x$use_qt" = "xyes"], [need_cxx="yes"])
796 AS_IF([test "x$use_beos" = "xyes"], [need_cxx="yes"])
797
798 AM_CONDITIONAL(BUILD_CXX, test "x$need_cxx" = "xyes")
799
800 dnl ===========================================================================
801
802 # We use GTK+ for some utility/debugging tools
803 PKG_CHECK_MODULES(gtk, "gtk+-2.0",have_gtk=yes, have_gtk=no)
804 AM_CONDITIONAL(HAVE_GTK, test "x$have_gtk" = "xyes")
805
806 AC_CONFIG_FILES([
807 Makefile
808 boilerplate/Makefile
809 src/Makefile
810 test/Makefile
811 test/pdiff/Makefile
812 perf/Makefile
813 perf/micro/Makefile
814 util/Makefile
815 util/cairo-fdr/Makefile
816 util/cairo-gobject/Makefile
817 util/cairo-missing/Makefile
818 util/cairo-script/Makefile
819 util/cairo-script/examples/Makefile
820 util/cairo-sphinx/Makefile
821 util/cairo-trace/Makefile
822 util/cairo-trace/cairo-trace
823 doc/Makefile
824 doc/public/Makefile
825 ])
826
827 AC_OUTPUT
828 CAIRO_REPORT