From 9389cb78a8ea5b6579d091ab1030ab9f1b13efc2 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 8 Sep 2009 17:51:33 +0100 Subject: [build] Improve handling of missing test apparatus Improve detection, reporting and disabling of test backends when we lack the required libraries and utilities. --- boilerplate/Makefile.win32.features | 7 +++++++ boilerplate/cairo-boilerplate-pdf.c | 2 ++ boilerplate/cairo-boilerplate-ps.c | 2 ++ boilerplate/cairo-boilerplate-svg.c | 2 ++ build/Makefile.win32.features | 1 + build/Makefile.win32.features-h | 3 +++ build/configure.ac.features | 3 ++- configure.ac | 20 +++++++++++++------- perf/cairo-perf-compare-backends.c | 2 +- src/Makefile.win32.features | 7 +++++++ test/Makefile.am | 2 ++ test/any2ppm.c | 8 ++++++++ util/Makefile.am | 4 ++-- 13 files changed, 52 insertions(+), 11 deletions(-) diff --git a/boilerplate/Makefile.win32.features b/boilerplate/Makefile.win32.features index 498d0beb..ee45b084 100644 --- a/boilerplate/Makefile.win32.features +++ b/boilerplate/Makefile.win32.features @@ -354,3 +354,10 @@ ifeq ($(CAIRO_HAS_TRACE),1) enabled_cairo_boilerplate_private += $(cairo_boilerplate_trace_private) $(cairo_boilerplate_trace_headers) enabled_cairo_boilerplate_sources += $(cairo_boilerplate_trace_sources) endif + +all_cairo_boilerplate_private += $(cairo_boilerplate_interpreter_private) $(cairo_boilerplate_interpreter_headers) +all_cairo_boilerplate_sources += $(cairo_boilerplate_interpreter_sources) +ifeq ($(CAIRO_HAS_INTERPRETER),1) +enabled_cairo_boilerplate_private += $(cairo_boilerplate_interpreter_private) $(cairo_boilerplate_interpreter_headers) +enabled_cairo_boilerplate_sources += $(cairo_boilerplate_interpreter_sources) +endif diff --git a/boilerplate/cairo-boilerplate-pdf.c b/boilerplate/cairo-boilerplate-pdf.c index 591e16fd..191eb1b5 100644 --- a/boilerplate/cairo-boilerplate-pdf.c +++ b/boilerplate/cairo-boilerplate-pdf.c @@ -225,6 +225,7 @@ _cairo_boilerplate_pdf_force_fallbacks (cairo_surface_t *abstract_surface, } static const cairo_boilerplate_target_t targets[] = { +#if CAIRO_CAN_TEST_PDF_SURFACE { "pdf", "pdf", ".pdf", NULL, CAIRO_SURFACE_TYPE_PDF, @@ -250,5 +251,6 @@ static const cairo_boilerplate_target_t targets[] = { _cairo_boilerplate_pdf_cleanup, NULL, TRUE, TRUE }, +#endif }; CAIRO_BOILERPLATE (pdf, targets) diff --git a/boilerplate/cairo-boilerplate-ps.c b/boilerplate/cairo-boilerplate-ps.c index 53fecd6d..899a321b 100644 --- a/boilerplate/cairo-boilerplate-ps.c +++ b/boilerplate/cairo-boilerplate-ps.c @@ -290,6 +290,7 @@ _cairo_boilerplate_ps_force_fallbacks (cairo_surface_t *abstract_surface, } static const cairo_boilerplate_target_t targets[] = { +#if CAIRO_CAN_TEST_PS_SURFACE { "ps2", "ps", ".ps", NULL, CAIRO_SURFACE_TYPE_PS, @@ -340,5 +341,6 @@ static const cairo_boilerplate_target_t targets[] = { _cairo_boilerplate_ps_cleanup, NULL, TRUE, TRUE }, +#endif }; CAIRO_BOILERPLATE (ps, targets) diff --git a/boilerplate/cairo-boilerplate-svg.c b/boilerplate/cairo-boilerplate-svg.c index a8a4d8b9..316e33d3 100644 --- a/boilerplate/cairo-boilerplate-svg.c +++ b/boilerplate/cairo-boilerplate-svg.c @@ -266,6 +266,7 @@ _cairo_boilerplate_svg_force_fallbacks (cairo_surface_t *abstract_surface, } static const cairo_boilerplate_target_t targets[] = { +#if CAIRO_CAN_TEST_SVG_SURFACE /* It seems we should be able to round-trip SVG content perfectly * through librsvg and cairo, but for some mysterious reason, some * systems get an error of 1 for some pixels on some of the text @@ -319,5 +320,6 @@ static const cairo_boilerplate_target_t targets[] = { _cairo_boilerplate_svg_cleanup, NULL, TRUE, TRUE }, +#endif }; CAIRO_BOILERPLATE (svg, targets) diff --git a/build/Makefile.win32.features b/build/Makefile.win32.features index eb10b236..af88c951 100644 --- a/build/Makefile.win32.features +++ b/build/Makefile.win32.features @@ -31,3 +31,4 @@ CAIRO_HAS_SVG_SURFACE=1 CAIRO_HAS_TEST_SURFACES=0 CAIRO_HAS_XML_SURFACE=1 CAIRO_HAS_TRACE=1 +CAIRO_HAS_INTERPRETER=1 diff --git a/build/Makefile.win32.features-h b/build/Makefile.win32.features-h index 552a2d0a..1807aee9 100644 --- a/build/Makefile.win32.features-h +++ b/build/Makefile.win32.features-h @@ -101,5 +101,8 @@ endif @echo "#define CAIRO_HAS_USER_FONT 1" >> src/cairo-features.h ifeq ($(CAIRO_HAS_TRACE),1) @echo "#define CAIRO_HAS_TRACE 1" >> src/cairo-features.h +endif +ifeq ($(CAIRO_HAS_INTERPRETER),1) + @echo "#define CAIRO_HAS_INTERPRETER 1" >> src/cairo-features.h endif @echo "#endif" >> src/cairo-features.h diff --git a/build/configure.ac.features b/build/configure.ac.features index 2606850b..afa576a4 100644 --- a/build/configure.ac.features +++ b/build/configure.ac.features @@ -394,7 +394,8 @@ AC_DEFUN([CAIRO_REPORT], echo " Eagle functions: $use_eagle" echo "" echo "The following features and utilies:" - echo " cairo-trace: $use_trace" + echo " cairo-trace: $use_trace" + echo " cairo-script-interpreter: $use_interpreter" echo "" echo "And the following internal features:" echo " gtk-doc: $enable_gtk_doc" diff --git a/configure.ac b/configure.ac index c4b38d89..985ea717 100644 --- a/configure.ac +++ b/configure.ac @@ -504,7 +504,7 @@ if test "x$use_ps" = "xyes"; then libspectre_DEPENDENCY="libspectre >= $SPECTRE_VERSION_REQUIRED" PKG_CHECK_MODULES(LIBSPECTRE, $libspectre_DEPENDENCY, [any2ppm_ps=yes], - [AC_MSG_RESULT(no)]) + [test_ps="no (requires libspectre)"]) fi AM_CONDITIONAL(CAIRO_CAN_TEST_PS_SURFACE, test "x$test_ps" = "xyes") @@ -535,8 +535,8 @@ if test "x$use_pdf" = "xyes"; then PKG_CHECK_MODULES(POPPLER, $poppler_DEPENDENCY, [CAIRO_CHECK_FUNCS_WITH_FLAGS(poppler_page_render, [$POPPLER_CFLAGS], [$POPPLER_LIBS], [test_pdf=yes; any2ppm_pdf=yes], - [AC_MSG_RESULT(no); test_pdf="no (requires $poppler_DEPENDENCY)"])], - [AC_MSG_RESULT(no); test_pdf="no (requires $poppler_DEPENDENCY)"]) + [test_pdf="no (requires $poppler_DEPENDENCY)"])], + [test_pdf="no (requires $poppler_DEPENDENCY)"]) if test "x$test_pdf" = "xyes"; then 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)]) else @@ -566,8 +566,8 @@ if test "x$use_svg" = "xyes"; then PKG_CHECK_MODULES(LIBRSVG, $librsvg_DEPENDENCY gdk-2.0, [CAIRO_CHECK_FUNCS_WITH_FLAGS(rsvg_pixbuf_from_file, [$LIBRSVG_CFLAGS], [$LIBRSVG_LIBS], [test_svg=yes; any2ppm_svg=yes], - [AC_MSG_RESULT(no); test_svg="no (requires $librsvg_DEPENDENCY)"])], - [AC_MSG_RESULT(no); test_svg="no (requires $librsvg_DEPENDENCY)"]) + [test_svg="no (requires $librsvg_DEPENDENCY)"])], + [test_svg="no (requires $librsvg_DEPENDENCY)"]) if test "x$test_svg" = "xyes"; then AC_DEFINE([CAIRO_CAN_TEST_SVG_SURFACE], 1, [Define to 1 if the SVG backend can be tested]) else @@ -645,12 +645,18 @@ case $host in esac CAIRO_ENABLE(trace, cairo-trace, yes, [ - if test "x$have_ld_preload" != "xyes" -o "x$have_libz" != "xyes"; then + if test "x$have_ld_preload" != "xyes" -o \ + "x$have_libz" != "xyes" -o \ + "x$have_dl" != "xyes"; then use_trace="no (requires dynamic linker and zlib)" fi ]) -AM_CONDITIONAL(BUILD_SCRIPT, test "x$have_libz" = "xyes") +CAIRO_ENABLE(interpreter, cairo-script-interpreter, yes, [ + if test "x$have_libz" != "xyes" "x$have_dl" != "xyes"; then + use_interpreter="no (requires zlib)" + fi +]) AC_CHECK_LIB(bfd, bfd_openr, [AC_CHECK_HEADER(bfd.h, [have_bfd=yes], diff --git a/perf/cairo-perf-compare-backends.c b/perf/cairo-perf-compare-backends.c index 1f737eb3..1448169b 100644 --- a/perf/cairo-perf-compare-backends.c +++ b/perf/cairo-perf-compare-backends.c @@ -263,7 +263,7 @@ cairo_perf_reports_compare (cairo_perf_report_t *reports, diff = &diffs[i]; /* Discard as uninteresting a change which is less than the - * minimum change required, (default may be overriden on + * minimum change required, (default may be overridden on * command-line). */ if (fabs (diff->change) - 1.0 < options->min_change) continue; diff --git a/src/Makefile.win32.features b/src/Makefile.win32.features index 51640960..b1c81c3c 100644 --- a/src/Makefile.win32.features +++ b/src/Makefile.win32.features @@ -472,3 +472,10 @@ ifeq ($(CAIRO_HAS_TRACE),1) enabled_cairo_private += $(cairo_trace_private) $(cairo_trace_headers) enabled_cairo_sources += $(cairo_trace_sources) endif + +all_cairo_private += $(cairo_interpreter_private) $(cairo_interpreter_headers) +all_cairo_sources += $(cairo_interpreter_sources) +ifeq ($(CAIRO_HAS_INTERPRETER),1) +enabled_cairo_private += $(cairo_interpreter_private) $(cairo_interpreter_headers) +enabled_cairo_sources += $(cairo_interpreter_sources) +endif diff --git a/test/Makefile.am b/test/Makefile.am index fafeb436..d6bcb277 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -54,6 +54,7 @@ test_sources += $(multi_page_surface_test_sources) endif # Include fallback-resolution (once!) if we have any of the vector surfaces +if BUILD_ANY2PPM if CAIRO_HAS_SVG_SURFACE test = $(fallback_resolution_test_sources) endif @@ -63,6 +64,7 @@ endif if CAIRO_HAS_PS_SURFACE test = $(fallback_resolution_test_sources) endif +endif test_sources += $(test) TESTS += cairo-test-suite$(EXEEXT) diff --git a/test/any2ppm.c b/test/any2ppm.c index f35891fb..c93e457a 100644 --- a/test/any2ppm.c +++ b/test/any2ppm.c @@ -257,6 +257,7 @@ _create_image (void *closure, return cairo_surface_reference (*out); } +#if CAIRO_HAS_INTERPRETER static const char * _cairo_script_render_page (const char *filename, cairo_surface_t **surface_out) @@ -303,6 +304,13 @@ cs_convert (char **argv, int fd) return err; } +#else +static const char * +cs_convert (char **argv, int fd) +{ + return "compiled without CairoScript support."; +} +#endif #if CAIRO_CAN_TEST_PDF_SURFACE /* adapted from pdf2png.c */ diff --git a/util/Makefile.am b/util/Makefile.am index 6ee0ba93..4394fe3f 100644 --- a/util/Makefile.am +++ b/util/Makefile.am @@ -2,7 +2,7 @@ include $(top_srcdir)/build/Makefile.am.common SUBDIRS = . -if BUILD_SCRIPT +if CAIRO_HAS_INTERPRETER SUBDIRS += cairo-script endif @@ -25,7 +25,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/src \ $(CAIRO_CFLAGS) EXTRA_PROGRAMS += show-traps show-edges show-events -if BUILD_SCRIPT +if CAIRO_HAS_INTERPRETER EXTRA_PROGRAMS += trace-to-xml xml-to-trace endif -- cgit v1.2.3