summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-08-23 15:25:42 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2009-08-29 17:07:38 +0100
commit8078cd194e95a10cf653c970d1ddd39049a511f2 (patch)
tree4ee7f0d49ef3eb37fbae0ae2d9ad0a5e613cdfc1
parent7447915381fc64bd0c66f7110c1dd0b8a10d73f5 (diff)
[boilerplate] Runtime library check
For the purposes of benchmarking it is useful to run cairo-perf against a different library from the one it was compiled against. In order to do so, we need to check that the runtime library contains the required entry points for our targets - which we can check by using dlsym.
-rw-r--r--boilerplate/Makefile.am3
-rw-r--r--boilerplate/cairo-boilerplate-directfb.c2
-rw-r--r--boilerplate/cairo-boilerplate-drm.c2
-rw-r--r--boilerplate/cairo-boilerplate-gl.c2
-rw-r--r--boilerplate/cairo-boilerplate-glitz-agl.c2
-rw-r--r--boilerplate/cairo-boilerplate-glitz-glx.c2
-rw-r--r--boilerplate/cairo-boilerplate-glitz-wgl.c2
-rw-r--r--boilerplate/cairo-boilerplate-pdf.c2
-rw-r--r--boilerplate/cairo-boilerplate-ps.c4
-rw-r--r--boilerplate/cairo-boilerplate-quartz.c2
-rw-r--r--boilerplate/cairo-boilerplate-script.c1
-rw-r--r--boilerplate/cairo-boilerplate-skia.c2
-rw-r--r--boilerplate/cairo-boilerplate-svg.c4
-rw-r--r--boilerplate/cairo-boilerplate-test-surfaces.c8
-rw-r--r--boilerplate/cairo-boilerplate-vg.c4
-rw-r--r--boilerplate/cairo-boilerplate-win32-printing.c2
-rw-r--r--boilerplate/cairo-boilerplate-win32.c2
-rw-r--r--boilerplate/cairo-boilerplate-xcb.c1
-rw-r--r--boilerplate/cairo-boilerplate-xlib.c4
-rw-r--r--boilerplate/cairo-boilerplate.c29
-rw-r--r--boilerplate/cairo-boilerplate.h1
-rw-r--r--configure.ac7
22 files changed, 85 insertions, 3 deletions
diff --git a/boilerplate/Makefile.am b/boilerplate/Makefile.am
index cb92c2bc0..10fb6af31 100644
--- a/boilerplate/Makefile.am
+++ b/boilerplate/Makefile.am
@@ -23,6 +23,9 @@ libcairoboilerplate_la_SOURCES = \
cairo-boilerplate-constructors.c \
$(NULL)
libcairoboilerplate_la_LIBADD = $(top_builddir)/src/libcairo.la
+if CAIRO_HAS_DL
+libcairoboilerplate_la_LIBADD += -ldl
+endif
if CAIRO_HAS_BEOS_SURFACE
# BeOS system headers trigger this warning
diff --git a/boilerplate/cairo-boilerplate-directfb.c b/boilerplate/cairo-boilerplate-directfb.c
index f7be03076..6815dd1b0 100644
--- a/boilerplate/cairo-boilerplate-directfb.c
+++ b/boilerplate/cairo-boilerplate-directfb.c
@@ -211,6 +211,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"directfb", "directfb", NULL, NULL,
CAIRO_SURFACE_TYPE_DIRECTFB, CAIRO_CONTENT_COLOR, 0,
+ "cairo_directfb_surface_create",
_cairo_boilerplate_directfb_create_surface,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
@@ -220,6 +221,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"directfb-bitmap", "directfb", NULL, NULL,
CAIRO_SURFACE_TYPE_DIRECTFB, CAIRO_CONTENT_COLOR_ALPHA, 0,
+ "cairo_directfb_surface_create",
_cairo_boilerplate_directfb_create_surface,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
diff --git a/boilerplate/cairo-boilerplate-drm.c b/boilerplate/cairo-boilerplate-drm.c
index 23e601e8b..34d67b546 100644
--- a/boilerplate/cairo-boilerplate-drm.c
+++ b/boilerplate/cairo-boilerplate-drm.c
@@ -70,6 +70,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"drm", "drm", NULL, NULL,
CAIRO_SURFACE_TYPE_DRM, CAIRO_CONTENT_COLOR_ALPHA, 1,
+ "cairo_drm_surface_create",
_cairo_boilerplate_drm_create_surface,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
@@ -80,6 +81,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"drm", "drm", NULL, NULL,
CAIRO_SURFACE_TYPE_DRM, CAIRO_CONTENT_COLOR, 1,
+ "cairo_drm_surface_create",
_cairo_boilerplate_drm_create_surface,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
diff --git a/boilerplate/cairo-boilerplate-gl.c b/boilerplate/cairo-boilerplate-gl.c
index 940fd756a..0facc5cb5 100644
--- a/boilerplate/cairo-boilerplate-gl.c
+++ b/boilerplate/cairo-boilerplate-gl.c
@@ -141,6 +141,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"gl", "gl", NULL, NULL,
CAIRO_SURFACE_TYPE_GL, CAIRO_CONTENT_COLOR_ALPHA, 1,
+ "cairo_gl_surface_create",
_cairo_boilerplate_gl_create_surface,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
@@ -151,6 +152,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"gl", "gl", NULL, NULL,
CAIRO_SURFACE_TYPE_GL, CAIRO_CONTENT_COLOR, 1,
+ "cairo_gl_surface_create",
_cairo_boilerplate_gl_create_surface,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
diff --git a/boilerplate/cairo-boilerplate-glitz-agl.c b/boilerplate/cairo-boilerplate-glitz-agl.c
index 61c43520a..679593bca 100644
--- a/boilerplate/cairo-boilerplate-glitz-agl.c
+++ b/boilerplate/cairo-boilerplate-glitz-agl.c
@@ -169,6 +169,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"glitz-agl", "glitz", NULL, NULL,
CAIRO_SURFACE_TYPE_GLITZ, CAIRO_CONTENT_COLOR_ALPHA, 0,
+ "cairo_glitz_surface_create",
_cairo_boilerplate_glitz_agl_create_surface,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
@@ -178,6 +179,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"glitz-agl", "glitz", NULL, NULL,
CAIRO_SURFACE_TYPE_GLITZ, CAIRO_CONTENT_COLOR, 0,
+ "cairo_glitz_surface_create",
_cairo_boilerplate_glitz_agl_create_surface,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
diff --git a/boilerplate/cairo-boilerplate-glitz-glx.c b/boilerplate/cairo-boilerplate-glitz-glx.c
index 6e3cfec37..d490aecb7 100644
--- a/boilerplate/cairo-boilerplate-glitz-glx.c
+++ b/boilerplate/cairo-boilerplate-glitz-glx.c
@@ -243,6 +243,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"glitz-glx", "glitz", NULL, NULL,
CAIRO_SURFACE_TYPE_GLITZ,CAIRO_CONTENT_COLOR_ALPHA, 0,
+ "cairo_glitz_surface_create",
_cairo_boilerplate_glitz_glx_create_surface,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
@@ -252,6 +253,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"glitz-glx", "glitz", NULL, NULL,
CAIRO_SURFACE_TYPE_GLITZ, CAIRO_CONTENT_COLOR, 0,
+ "cairo_glitz_surface_create",
_cairo_boilerplate_glitz_glx_create_surface,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
diff --git a/boilerplate/cairo-boilerplate-glitz-wgl.c b/boilerplate/cairo-boilerplate-glitz-wgl.c
index 3aeefdda0..f50d68b7c 100644
--- a/boilerplate/cairo-boilerplate-glitz-wgl.c
+++ b/boilerplate/cairo-boilerplate-glitz-wgl.c
@@ -166,6 +166,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"glitz-wgl", "glitz", NULL, NULL,
CAIRO_SURFACE_TYPE_GLITZ, CAIRO_CONTENT_COLOR_ALPHA, 0,
+ "cairo_glitz_surface_create",
_cairo_boilerplate_glitz_wgl_create_surface,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
@@ -175,6 +176,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"glitz-wgl", "glitz", NULL, NULL,
CAIRO_SURFACE_TYPE_GLITZ, CAIRO_CONTENT_COLOR, 0,
+ "cairo_glitz_surface_create",
_cairo_boilerplate_glitz_wgl_create_surface,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
diff --git a/boilerplate/cairo-boilerplate-pdf.c b/boilerplate/cairo-boilerplate-pdf.c
index 838038af8..591e16fdc 100644
--- a/boilerplate/cairo-boilerplate-pdf.c
+++ b/boilerplate/cairo-boilerplate-pdf.c
@@ -229,6 +229,7 @@ static const cairo_boilerplate_target_t targets[] = {
"pdf", "pdf", ".pdf", NULL,
CAIRO_SURFACE_TYPE_PDF,
CAIRO_TEST_CONTENT_COLOR_ALPHA_FLATTENED, 0,
+ "cairo_pdf_surface_create",
_cairo_boilerplate_pdf_create_surface,
_cairo_boilerplate_pdf_force_fallbacks,
_cairo_boilerplate_pdf_finish_surface,
@@ -240,6 +241,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"pdf", "pdf", ".pdf", NULL,
CAIRO_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR, 0,
+ "cairo_pdf_surface_create",
_cairo_boilerplate_pdf_create_surface,
_cairo_boilerplate_pdf_force_fallbacks,
_cairo_boilerplate_pdf_finish_surface,
diff --git a/boilerplate/cairo-boilerplate-ps.c b/boilerplate/cairo-boilerplate-ps.c
index 8619e47f8..53fecd6dc 100644
--- a/boilerplate/cairo-boilerplate-ps.c
+++ b/boilerplate/cairo-boilerplate-ps.c
@@ -294,6 +294,7 @@ static const cairo_boilerplate_target_t targets[] = {
"ps2", "ps", ".ps", NULL,
CAIRO_SURFACE_TYPE_PS,
CAIRO_TEST_CONTENT_COLOR_ALPHA_FLATTENED, 0,
+ "cairo_ps_surface_create",
_cairo_boilerplate_ps2_create_surface,
_cairo_boilerplate_ps_force_fallbacks,
_cairo_boilerplate_ps_finish_surface,
@@ -305,6 +306,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"ps2", "ps", ".ps", NULL,
CAIRO_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR, 0,
+ "cairo_ps_surface_create",
_cairo_boilerplate_ps2_create_surface,
_cairo_boilerplate_ps_force_fallbacks,
_cairo_boilerplate_ps_finish_surface,
@@ -317,6 +319,7 @@ static const cairo_boilerplate_target_t targets[] = {
"ps3", "ps", ".ps", NULL,
CAIRO_SURFACE_TYPE_PS,
CAIRO_TEST_CONTENT_COLOR_ALPHA_FLATTENED, 0,
+ "cairo_ps_surface_create",
_cairo_boilerplate_ps3_create_surface,
_cairo_boilerplate_ps_force_fallbacks,
_cairo_boilerplate_ps_finish_surface,
@@ -328,6 +331,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"ps3", "ps", ".ps", NULL,
CAIRO_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR, 0,
+ "cairo_ps_surface_create",
_cairo_boilerplate_ps3_create_surface,
_cairo_boilerplate_ps_force_fallbacks,
_cairo_boilerplate_ps_finish_surface,
diff --git a/boilerplate/cairo-boilerplate-quartz.c b/boilerplate/cairo-boilerplate-quartz.c
index 4c6235815..1948d837a 100644
--- a/boilerplate/cairo-boilerplate-quartz.c
+++ b/boilerplate/cairo-boilerplate-quartz.c
@@ -52,6 +52,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"quartz", "quartz", NULL, NULL,
CAIRO_SURFACE_TYPE_QUARTZ, CAIRO_CONTENT_COLOR_ALPHA, 0,
+ "cairo_quartz_surface_create",
_cairo_boilerplate_quartz_create_surface,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
@@ -60,6 +61,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"quartz", "quartz", NULL, NULL,
CAIRO_SURFACE_TYPE_QUARTZ, CAIRO_CONTENT_COLOR, 0,
+ "cairo_quartz_surface_create",
_cairo_boilerplate_quartz_create_surface,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
diff --git a/boilerplate/cairo-boilerplate-script.c b/boilerplate/cairo-boilerplate-script.c
index d1d76b5c8..e37fdf13e 100644
--- a/boilerplate/cairo-boilerplate-script.c
+++ b/boilerplate/cairo-boilerplate-script.c
@@ -129,6 +129,7 @@ _cairo_boilerplate_script_cleanup (void *closure)
static const cairo_boilerplate_target_t target[] = {{
"script", "script", ".cs", NULL,
CAIRO_SURFACE_TYPE_SCRIPT, CAIRO_CONTENT_COLOR_ALPHA, 0,
+ "cairo_script_surface_create",
_cairo_boilerplate_script_create_surface,
NULL,
_cairo_boilerplate_script_finish_surface,
diff --git a/boilerplate/cairo-boilerplate-skia.c b/boilerplate/cairo-boilerplate-skia.c
index e6364205f..13ab00b74 100644
--- a/boilerplate/cairo-boilerplate-skia.c
+++ b/boilerplate/cairo-boilerplate-skia.c
@@ -33,6 +33,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"skia", "skia", NULL, NULL,
CAIRO_SURFACE_TYPE_SKIA, CAIRO_CONTENT_COLOR_ALPHA, 0,
+ "cairo_skia_surface_create",
_cairo_boilerplate_skia_create_surface,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
@@ -41,6 +42,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"skia", "skia", NULL, NULL,
CAIRO_SURFACE_TYPE_SKIA, CAIRO_CONTENT_COLOR, 0,
+ "cairo_skia_surface_create",
_cairo_boilerplate_skia_create_surface,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
diff --git a/boilerplate/cairo-boilerplate-svg.c b/boilerplate/cairo-boilerplate-svg.c
index 56296f46f..a8a4d8b91 100644
--- a/boilerplate/cairo-boilerplate-svg.c
+++ b/boilerplate/cairo-boilerplate-svg.c
@@ -274,6 +274,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"svg11", "svg", NULL, NULL,
CAIRO_SURFACE_TYPE_SVG, CAIRO_CONTENT_COLOR_ALPHA, 1,
+ "cairo_svg_surface_create",
_cairo_boilerplate_svg11_create_surface,
_cairo_boilerplate_svg_force_fallbacks,
_cairo_boilerplate_svg_finish_surface,
@@ -285,6 +286,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"svg11", "svg", NULL, NULL,
CAIRO_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR, 1,
+ "cairo_svg_surface_create",
_cairo_boilerplate_svg11_create_surface,
_cairo_boilerplate_svg_force_fallbacks,
_cairo_boilerplate_svg_finish_surface,
@@ -296,6 +298,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"svg12", "svg", NULL, NULL,
CAIRO_SURFACE_TYPE_SVG, CAIRO_CONTENT_COLOR_ALPHA, 1,
+ "cairo_svg_surface_create",
_cairo_boilerplate_svg12_create_surface,
_cairo_boilerplate_svg_force_fallbacks,
_cairo_boilerplate_svg_finish_surface,
@@ -307,6 +310,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"svg12", "svg", NULL, NULL,
CAIRO_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR, 1,
+ "cairo_svg_surface_create",
_cairo_boilerplate_svg12_create_surface,
_cairo_boilerplate_svg_force_fallbacks,
_cairo_boilerplate_svg_finish_surface,
diff --git a/boilerplate/cairo-boilerplate-test-surfaces.c b/boilerplate/cairo-boilerplate-test-surfaces.c
index 3e7490ec5..7a3a16b98 100644
--- a/boilerplate/cairo-boilerplate-test-surfaces.c
+++ b/boilerplate/cairo-boilerplate-test-surfaces.c
@@ -233,6 +233,7 @@ static const cairo_boilerplate_target_t targets[] = {
"test-fallback", "image", NULL, NULL,
CAIRO_INTERNAL_SURFACE_TYPE_TEST_FALLBACK,
CAIRO_CONTENT_COLOR_ALPHA, 0,
+ "_cairo_test_fallback_surface_create",
_cairo_boilerplate_test_fallback_create_surface,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
@@ -242,6 +243,7 @@ static const cairo_boilerplate_target_t targets[] = {
"test-fallback", "image", NULL, NULL,
CAIRO_INTERNAL_SURFACE_TYPE_TEST_FALLBACK,
CAIRO_CONTENT_COLOR, 0,
+ "_cairo_test_fallback_surface_create",
_cairo_boilerplate_test_fallback_create_surface,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
@@ -251,6 +253,7 @@ static const cairo_boilerplate_target_t targets[] = {
"test-fallback16", "image", NULL, NULL,
CAIRO_INTERNAL_SURFACE_TYPE_TEST_FALLBACK,
CAIRO_CONTENT_COLOR_ALPHA, 0,
+ "_cairo_test_fallback16_surface_create",
_cairo_boilerplate_test_fallback16_create_surface,
NULL, NULL,
NULL, /* _cairo_boilerplate_get_image_surface, */
@@ -260,6 +263,7 @@ static const cairo_boilerplate_target_t targets[] = {
"test-fallback16", "image", NULL, NULL,
CAIRO_INTERNAL_SURFACE_TYPE_TEST_FALLBACK,
CAIRO_CONTENT_COLOR, 0,
+ "_cairo_test_fallback16_surface_create",
_cairo_boilerplate_test_fallback16_create_surface,
NULL, NULL,
NULL, /* _cairo_boilerplate_get_image_surface, */
@@ -270,6 +274,7 @@ static const cairo_boilerplate_target_t targets[] = {
"test-paginated", "image", NULL, NULL,
CAIRO_INTERNAL_SURFACE_TYPE_TEST_PAGINATED,
CAIRO_CONTENT_COLOR_ALPHA, 0,
+ "_cairo_test_paginated_surface_create",
_cairo_boilerplate_test_paginated_create_surface,
NULL, NULL,
_cairo_boilerplate_test_paginated_get_image_surface,
@@ -282,6 +287,7 @@ static const cairo_boilerplate_target_t targets[] = {
"test-paginated", "image", NULL, NULL,
CAIRO_INTERNAL_SURFACE_TYPE_TEST_PAGINATED,
CAIRO_CONTENT_COLOR, 0,
+ "_cairo_test_paginated_surface_create",
_cairo_boilerplate_test_paginated_create_surface,
NULL, NULL,
_cairo_boilerplate_test_paginated_get_image_surface,
@@ -296,6 +302,7 @@ static const cairo_boilerplate_target_t targets[] = {
"test-wrapping", "image", NULL, NULL,
CAIRO_INTERNAL_SURFACE_TYPE_TEST_WRAPPING,
CAIRO_CONTENT_COLOR_ALPHA, 0,
+ "_cairo_test_wrapping_surface_create",
_cairo_boilerplate_test_wrapping_create_surface,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
@@ -307,6 +314,7 @@ static const cairo_boilerplate_target_t targets[] = {
"null", "image", NULL, NULL,
CAIRO_INTERNAL_SURFACE_TYPE_NULL,
CAIRO_CONTENT_COLOR_ALPHA, 0,
+ "_cairo_test_null_surface_create",
_cairo_boilerplate_test_null_create_surface,
NULL, NULL,
NULL, NULL, NULL,
diff --git a/boilerplate/cairo-boilerplate-vg.c b/boilerplate/cairo-boilerplate-vg.c
index 75756ddbd..2ea1a07b0 100644
--- a/boilerplate/cairo-boilerplate-vg.c
+++ b/boilerplate/cairo-boilerplate-vg.c
@@ -305,6 +305,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"vg-glx", "vg", NULL, NULL,
CAIRO_SURFACE_TYPE_VG, CAIRO_CONTENT_COLOR_ALPHA, 1,
+ "cairo_vg_context_create_for_glx",
_cairo_boilerplate_vg_create_surface_glx,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
@@ -315,6 +316,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"vg-glx", "vg", NULL, NULL,
CAIRO_SURFACE_TYPE_VG, CAIRO_CONTENT_COLOR, 1,
+ "cairo_vg_context_create_for_glx",
_cairo_boilerplate_vg_create_surface_glx,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
@@ -327,6 +329,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"vg-egl", "vg", NULL, NULL,
CAIRO_SURFACE_TYPE_VG, CAIRO_CONTENT_COLOR_ALPHA, 1,
+ "cairo_vg_context_create_for_egl",
_cairo_boilerplate_vg_create_surface_egl,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
@@ -337,6 +340,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"vg-egl", "vg", NULL, NULL,
CAIRO_SURFACE_TYPE_VG, CAIRO_CONTENT_COLOR, 1,
+ "cairo_vg_context_create_for_egl",
_cairo_boilerplate_vg_create_surface_egl,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
diff --git a/boilerplate/cairo-boilerplate-win32-printing.c b/boilerplate/cairo-boilerplate-win32-printing.c
index 541401a03..ecaac5fe8 100644
--- a/boilerplate/cairo-boilerplate-win32-printing.c
+++ b/boilerplate/cairo-boilerplate-win32-printing.c
@@ -347,6 +347,7 @@ static const cairo_boilerplate_target_t targets[] = {
"win32-printing", "win32", ".ps", NULL,
CAIRO_SURFACE_TYPE_WIN32_PRINTING,
CAIRO_TEST_CONTENT_COLOR_ALPHA_FLATTENED, 0,
+ "cairo_win32_printing_surface_create",
_cairo_boilerplate_win32_printing_create_surface,
NULL, NULL,
_cairo_boilerplate_win32_printing_get_image_surface,
@@ -357,6 +358,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"win32-printing", "win32", ".ps", NULL,
CAIRO_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR, 0,
+ "cairo_win32_printing_surface_create",
_cairo_boilerplate_win32_printing_create_surface,
NULL, NULL,
_cairo_boilerplate_win32_printing_get_image_surface,
diff --git a/boilerplate/cairo-boilerplate-win32.c b/boilerplate/cairo-boilerplate-win32.c
index 420989b25..2b3abb186 100644
--- a/boilerplate/cairo-boilerplate-win32.c
+++ b/boilerplate/cairo-boilerplate-win32.c
@@ -52,6 +52,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"win32", "win32", NULL, NULL,
CAIRO_SURFACE_TYPE_WIN32, CAIRO_CONTENT_COLOR, 0,
+ "cairo_win32_surface_create_with_dib",
_cairo_boilerplate_win32_create_surface,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
@@ -63,6 +64,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"win32", "win32", NULL, NULL,
CAIRO_SURFACE_TYPE_WIN32, CAIRO_CONTENT_COLOR_ALPHA, 0,
+ "cairo_win32_surface_create_with_dib",
_cairo_boilerplate_win32_create_surface,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
diff --git a/boilerplate/cairo-boilerplate-xcb.c b/boilerplate/cairo-boilerplate-xcb.c
index 63c20e8a0..0653d8ce3 100644
--- a/boilerplate/cairo-boilerplate-xcb.c
+++ b/boilerplate/cairo-boilerplate-xcb.c
@@ -119,6 +119,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"xcb", "xcb", NULL, NULL,
CAIRO_SURFACE_TYPE_XCB, CAIRO_CONTENT_COLOR_ALPHA, 1,
+ "cairo_xcb_surface_create_with_xrender_format",
_cairo_boilerplate_xcb_create_surface,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
diff --git a/boilerplate/cairo-boilerplate-xlib.c b/boilerplate/cairo-boilerplate-xlib.c
index d67a938f6..fe54d9885 100644
--- a/boilerplate/cairo-boilerplate-xlib.c
+++ b/boilerplate/cairo-boilerplate-xlib.c
@@ -439,6 +439,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"xlib", "xlib", NULL, "xlib-reference",
CAIRO_SURFACE_TYPE_XLIB, CAIRO_CONTENT_COLOR_ALPHA, 1,
+ "cairo_xlib_surface_create_with_xrender_format",
_cairo_boilerplate_xlib_create_surface,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
@@ -449,6 +450,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"xlib", "xlib", NULL, "xlib-reference",
CAIRO_SURFACE_TYPE_XLIB, CAIRO_CONTENT_COLOR, 1,
+ "cairo_xlib_surface_create_with_xrender_format",
_cairo_boilerplate_xlib_create_surface,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
@@ -459,6 +461,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"xlib-reference", "xlib", NULL, NULL,
CAIRO_SURFACE_TYPE_XLIB, CAIRO_CONTENT_COLOR, 1,
+ "cairo_xlib_surface_create",
_cairo_boilerplate_xlib_reference_create_surface,
NULL, NULL,
NULL, /* get_image */
@@ -473,6 +476,7 @@ static const cairo_boilerplate_target_t targets[] = {
{
"xlib-fallback", "xlib", NULL, NULL,
CAIRO_SURFACE_TYPE_XLIB, CAIRO_CONTENT_COLOR, 1,
+ "cairo_xlib_surface_create",
_cairo_boilerplate_xlib_fallback_create_surface,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c
index 1abfe09ef..ebbad458c 100644
--- a/boilerplate/cairo-boilerplate.c
+++ b/boilerplate/cairo-boilerplate.c
@@ -45,6 +45,10 @@
#include <assert.h>
#include <errno.h>
+#if HAVE_DL
+#include <dlfcn.h>
+#endif
+
#if HAVE_UNISTD_H && HAVE_FCNTL_H && HAVE_SIGNAL_H && HAVE_SYS_STAT_H && HAVE_SYS_SOCKET_H && HAVE_SYS_UN_H
#include <unistd.h>
#include <fcntl.h>
@@ -278,7 +282,7 @@ static const cairo_boilerplate_target_t builtin_targets[] = {
{
"image", "image", NULL, NULL,
CAIRO_SURFACE_TYPE_IMAGE, CAIRO_CONTENT_COLOR_ALPHA, 0,
- _cairo_boilerplate_image_create_surface,
+ NULL, _cairo_boilerplate_image_create_surface,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
cairo_surface_write_to_png
@@ -286,7 +290,7 @@ static const cairo_boilerplate_target_t builtin_targets[] = {
{
"image", "image", NULL, NULL,
CAIRO_SURFACE_TYPE_IMAGE, CAIRO_CONTENT_COLOR, 0,
- _cairo_boilerplate_image_create_surface,
+ NULL, _cairo_boilerplate_image_create_surface,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
cairo_surface_write_to_png
@@ -295,6 +299,7 @@ static const cairo_boilerplate_target_t builtin_targets[] = {
{
"meta", "image", NULL, NULL,
CAIRO_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR_ALPHA, 0,
+ "cairo_meta_surface_create",
_cairo_boilerplate_meta_create_surface,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
@@ -305,6 +310,7 @@ static const cairo_boilerplate_target_t builtin_targets[] = {
{
"meta", "image", NULL, NULL,
CAIRO_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR, 0,
+ "cairo_meta_surface_create",
_cairo_boilerplate_meta_create_surface,
NULL, NULL,
_cairo_boilerplate_get_image_surface,
@@ -321,6 +327,19 @@ static struct cairo_boilerplate_target_list {
const cairo_boilerplate_target_t *target;
} *cairo_boilerplate_targets;
+static cairo_bool_t
+probe_target (const cairo_boilerplate_target_t *target)
+{
+ if (target->probe == NULL)
+ return TRUE;
+
+#if HAVE_DL
+ return dlsym (NULL, target->probe) != NULL;
+#else
+ return TRUE;
+#endif
+}
+
void
_cairo_boilerplate_register_backend (const cairo_boilerplate_target_t *targets,
unsigned int count)
@@ -329,9 +348,13 @@ _cairo_boilerplate_register_backend (const cairo_boilerplate_target_t *targets,
while (count--) {
struct cairo_boilerplate_target_list *list;
+ --targets;
+ if (! probe_target (targets))
+ continue;
+
list = xmalloc (sizeof (*list));
list->next = cairo_boilerplate_targets;
- list->target = --targets;
+ list->target = targets;
cairo_boilerplate_targets = list;
}
}
diff --git a/boilerplate/cairo-boilerplate.h b/boilerplate/cairo-boilerplate.h
index 377d2f913..82d42e8c5 100644
--- a/boilerplate/cairo-boilerplate.h
+++ b/boilerplate/cairo-boilerplate.h
@@ -157,6 +157,7 @@ typedef struct _cairo_boilerplate_target {
cairo_surface_type_t expected_type;
cairo_content_t content;
unsigned int error_tolerance;
+ const char *probe; /* runtime dl check */
cairo_boilerplate_create_surface_t create_surface;
cairo_boilerplate_force_fallbacks_t force_fallbacks;
cairo_boilerplate_finish_surface_t finish_surface;
diff --git a/configure.ac b/configure.ac
index fbc15763e..873e791e5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,6 +36,13 @@ AC_CHECK_LIB(z, compress,
[have_libz="no (requires zlib http://www.gzip.org/zlib/)"])],
[have_libz="no (requires zlib http://www.gzip.org/zlib/)"])
+AC_CHECK_LIB(dl, dlsym,
+ [AC_CHECK_HEADER(dlfcn.h, [
+ have_dl=yes
+ AC_DEFINE(HAVE_DL, 1, [Define to 1 if you have dl available]),
+ ], [have_dl=no])], [have_dl=no])
+AM_CONDITIONAL(CAIRO_HAS_DL, test "x$have_dl" = "xyes")
+
dnl ===========================================================================
CAIRO_ENABLE_SURFACE_BACKEND(xlib, Xlib, auto, [