This eliminates a lot of difficult-to-maintain conditional compilation.
It also fixes the broken build of the manual when Cairo was not available.
If you don't have a version already, you can install GNU
libiconv (http://www.gnu.org/software/libiconv/).
+ * Cairo (http://cairographics.org/), version 1.12 or later.
+
+ * Pango (http://www.pango.org/), version 1.22 or later.
+
* zlib (http://www.zlib.net/).
* libxml2 (http://xmlsoft.org/).
* gettext version 0.20 or later.
-The following packages are required to enable PSPP's graphing
-features. If you cannot arrange to install them, you must run
-`configure' with --without-cairo (in which case you will get no graphing
-capability).
-
- * Cairo (http://cairographics.org/), version 1.12 or later.
-
- * Pango (http://www.pango.org/), version 1.22 or later.
-
The following packages are required to enable PSPPIRE, the graphical
user interface for PSPP. If you cannot install them or do not wish to
use the GUI, you must run `configure' with --without-gui.
Optional Features
=================
-`--without-cairo'
- Don't compile in support for charts (using Cairo and Pango). This
- is useful if your system lacks these libraries.
-
`--without-gui'
Don't build the PSPPIRE gui. Use this option if you only want to
build the command line version of PSPP.
- Cairo and Pango required to build the GUI, so --without-cairo
- implies --without-gui.
-
`--without-lib{xx}'
Optional libraries should normally be detected and the relevant
functionality will be built they exist. However, on some poorly
* The user manual, in its Info and HTML versions, now includes
graphical output examples and screenshots.
- * gettext 0.20 or later is required for building.
+ * Build changes:
+
+ - The Cairo and Pango libraries are now required.
+
+ - gettext 0.20 or later is now required.
* Output improvements:
AC_ARG_VAR([PSPPIRE_LDFLAGS], [linker flags to be used for linking the psppire binary only])
# Support for Cairo and Pango.
-AC_ARG_WITH([cairo],
- [AS_HELP_STRING(
- [--without-cairo],
- [Don't build support for charts (using Cairo and Pango);
- implies --without-gui])],
- [], [with_cairo=yes])
-AM_CONDITIONAL([HAVE_CAIRO], [test "$with_cairo" != no])
-if test "$with_cairo" != no; then
- PKG_CHECK_MODULES([CAIRO], [cairo >= 1.5 pango >= 1.22 pangocairo],
- [CPPFLAGS="$CPPFLAGS $CAIRO_CFLAGS"
- AC_DEFINE([HAVE_CAIRO], 1,
- [Define to 1 if Cairo and Pango are available.])],
- [PSPP_REQUIRED_PREREQ([cairo 1.5 or later and pango 1.22 or later (or use --without-cairo)])])
-fi
+PKG_CHECK_MODULES([CAIRO], [cairo >= 1.5 pango >= 1.22 pangocairo],
+ [CPPFLAGS="$CPPFLAGS $CAIRO_CFLAGS"],
+ [PSPP_REQUIRED_PREREQ([cairo 1.5 or later and pango 1.22 or later])])
dnl One of the tests uses xmllint.
AC_CACHE_CHECK([for an xmllint program which fits our needs],[ac_cv_path_XMLLINT],
[AS_HELP_STRING([--without-gui],
[Don't build the PSPPIRE GUI (using GTK+)])],
[], [with_gui=yes])
-AM_CONDITIONAL([building_gui],
- [test "$with_cairo" != no && test "$with_gui" != "no"])
-if test "$with_cairo" != no && test "$with_gui" != "no"; then
+AM_CONDITIONAL([building_gui], [test "$with_gui" != "no"])
+if test "$with_gui" != "no"; then
PKG_CHECK_MODULES([GTHREAD], [gthread-2.0], [],
[PSPP_REQUIRED_PREREQ([gthread 2.0 (or use --without-gui)])])
To produce output in PDF, PostScript, SVG, or PNG format, specify
@option{-o @var{file}} on the @pspp{} command line, optionally
followed by any of the options shown in the table below to customize
-the output format. These output formats are only available if your
-installation of @pspp{} was compiled with the Cairo library.
+the output format.
PDF, PostScript, and SVG use real units: each dimension among the
options listed below may have a suffix @samp{mm} for millimeters,
default is the file name specified on @option{-o} with the extension
stripped off and replaced by @file{-#.png}.
-Specify @code{none} to disable chart output. Charts are always
-disabled if your installation of @pspp{} was compiled without the
-Cairo library.
+Specify @code{none} to disable chart output.
@item @option{-O foreground-color=@var{color}}
@itemx @option{-O background-color=@var{color}}
#include "libpspp/u8-line.h"
#include "libpspp/version.h"
#include "output/ascii.h"
-#ifdef HAVE_CAIRO
#include "output/cairo-chart.h"
-#endif
#include "output/chart-item-provider.h"
#include "output/driver-provider.h"
#include "output/image-item.h"
bool emphasis; /* Enable bold and underline in output? */
char *chart_file_name; /* Name of files used for charts. */
-#ifdef HAVE_CAIRO
/* Colours for charts */
struct cell_color fg;
struct cell_color bg;
-#endif
/* How the page width is determined: */
enum {
: VIEW_WIDTH);
a->min_hbreak = parse_int (opt (d, o, "min-hbreak", "-1"), -1, INT_MAX);
-#ifdef HAVE_CAIRO
a->bg = parse_color (opt (d, o, "background-color", "#FFFFFFFFFFFF"));
a->fg = parse_color (opt (d, o, "foreground-color", "#000000000000"));
-#endif
const char *default_box = (terminal && (!strcmp (locale_charset (), "UTF-8")
|| term_is_utf8_xterm ())
if (is_table_item (output_item))
ascii_output_table_item (a, to_table_item (output_item));
-#ifdef HAVE_CAIRO
else if (is_image_item (output_item) && a->chart_file_name != NULL)
{
struct image_item *image_item = to_image_item (output_item);
free (file_name);
}
}
-#endif /* HAVE_CAIRO */
else if (is_text_item (output_item))
{
const struct text_item *text_item = to_text_item (output_item);
src_output_liboutput_la_SOURCES = \
src/output/ascii.c \
src/output/ascii.h \
+ src/output/cairo-chart.c \
+ src/output/cairo-chart.h \
+ src/output/cairo-fsm.c \
+ src/output/cairo-fsm.h \
+ src/output/cairo-pager.c \
+ src/output/cairo-pager.h \
+ src/output/cairo.c \
src/output/chart-item-provider.h \
src/output/chart-item.c \
src/output/chart-item.h \
+ src/output/charts/barchart-cairo.c \
+ src/output/charts/barchart.c \
+ src/output/charts/barchart.h \
+ src/output/charts/boxplot-cairo.c \
src/output/charts/boxplot.c \
src/output/charts/boxplot.h \
+ src/output/charts/np-plot-cairo.c \
src/output/charts/np-plot.c \
src/output/charts/np-plot.h \
- src/output/charts/barchart.c \
- src/output/charts/barchart.h \
+ src/output/charts/piechart-cairo.c \
src/output/charts/piechart.c \
src/output/charts/piechart.h \
+ src/output/charts/plot-hist-cairo.c \
src/output/charts/plot-hist.c \
src/output/charts/plot-hist.h \
+ src/output/charts/roc-chart-cairo.c \
src/output/charts/roc-chart.c \
src/output/charts/roc-chart.h \
- src/output/charts/spreadlevel-plot.c \
- src/output/charts/spreadlevel-plot.h \
- src/output/charts/scree.c \
- src/output/charts/scree.h \
+ src/output/charts/scatterplot-cairo.c \
src/output/charts/scatterplot.c \
src/output/charts/scatterplot.h \
+ src/output/charts/scree-cairo.c \
+ src/output/charts/scree.c \
+ src/output/charts/scree.h \
+ src/output/charts/spreadlevel-cairo.c \
+ src/output/charts/spreadlevel-plot.c \
+ src/output/charts/spreadlevel-plot.h \
src/output/csv.c \
src/output/driver-provider.h \
src/output/driver.c \
src/output/driver.h \
- src/output/image-item.c \
- src/output/image-item.h \
- src/output/tex-glyphs.c \
- src/output/tex-glyphs.h \
- src/output/tex-parsing.c \
- src/output/tex-parsing.h \
- src/output/tex-rendering.c \
- src/output/tex-rendering.h \
src/output/group-item.c \
src/output/group-item.h \
src/output/html.c \
+ src/output/image-item.c \
+ src/output/image-item.h \
src/output/journal.c \
src/output/journal.h \
src/output/measure.c \
src/output/table-provider.h \
src/output/table.c \
src/output/table.h \
+ src/output/tex-glyphs.c \
+ src/output/tex-glyphs.h \
+ src/output/tex-parsing.c \
+ src/output/tex-parsing.h \
+ src/output/tex-rendering.c \
+ src/output/tex-rendering.h \
src/output/tex.c \
src/output/text-item.c \
src/output/text-item.h
-if HAVE_CAIRO
-src_output_liboutput_la_SOURCES += \
- src/output/cairo-chart.c \
- src/output/cairo-chart.h \
- src/output/cairo-fsm.c \
- src/output/cairo-fsm.h \
- src/output/cairo-pager.c \
- src/output/cairo-pager.h \
- src/output/cairo.c \
- src/output/charts/boxplot-cairo.c \
- src/output/charts/np-plot-cairo.c \
- src/output/charts/barchart-cairo.c \
- src/output/charts/piechart-cairo.c \
- src/output/charts/plot-hist-cairo.c \
- src/output/charts/roc-chart-cairo.c \
- src/output/charts/scree-cairo.c \
- src/output/charts/spreadlevel-cairo.c \
- src/output/charts/scatterplot-cairo.c
-endif
nodist_src_output_liboutput_la_SOURCES =
EXTRA_DIST += \
#include <stdbool.h>
-#ifdef HAVE_CAIRO
-
#include <cairo/cairo.h>
#include <pango/pango-font.h>
#include "output/table.h"
int xr_fsm_draw_slice (struct xr_fsm *, cairo_t *, int space);
bool xr_fsm_is_empty (const struct xr_fsm *);
-#endif /* HAVE_CAIRO */
-
#endif /* output/cairo-fsm.h */
#include <stdbool.h>
-#ifdef HAVE_CAIRO
-
/* Cairo output driver paginater. */
#include <cairo/cairo.h>
void xr_pager_finish_page (struct xr_pager *);
bool xr_pager_needs_new_page (struct xr_pager *);
-#endif /* HAVE_CAIRO */
-
#endif /* output/cairo-pager.h */
return output_driver_get_engine (driver) != NULL;
}
\f
-extern const struct output_driver_factory txt_driver_factory;
-extern const struct output_driver_factory list_driver_factory;
-extern const struct output_driver_factory html_driver_factory;
extern const struct output_driver_factory csv_driver_factory;
+extern const struct output_driver_factory html_driver_factory;
+extern const struct output_driver_factory list_driver_factory;
extern const struct output_driver_factory odt_driver_factory;
-extern const struct output_driver_factory spv_driver_factory;
-#ifdef HAVE_CAIRO
extern const struct output_driver_factory pdf_driver_factory;
+extern const struct output_driver_factory png_driver_factory;
extern const struct output_driver_factory ps_driver_factory;
+extern const struct output_driver_factory spv_driver_factory;
extern const struct output_driver_factory svg_driver_factory;
-extern const struct output_driver_factory png_driver_factory;
-#endif
extern const struct output_driver_factory tex_driver_factory;
+extern const struct output_driver_factory txt_driver_factory;
static const struct output_driver_factory *factories[] =
{
&csv_driver_factory,
&odt_driver_factory,
&spv_driver_factory,
-#ifdef HAVE_CAIRO
&pdf_driver_factory,
&ps_driver_factory,
&svg_driver_factory,
&png_driver_factory,
-#endif
&tex_driver_factory,
NULL
};
#include "libpspp/i18n.h"
#include "libpspp/message.h"
#include "libpspp/version.h"
-#ifdef HAVE_CAIRO
#include "output/cairo-chart.h"
-#endif
#include "output/chart-item.h"
#include "output/driver-provider.h"
#include "output/image-item.h"
struct html_driver
{
struct output_driver driver;
-#ifdef HAVE_CAIRO
struct cell_color fg;
struct cell_color bg;
-#endif
struct file_handle *handle;
char *chart_file_name;
fh_get_file_name (fh)));
html->file = NULL;
html->chart_cnt = 1;
-#ifdef HAVE_CAIRO
html->bg = parse_color (opt (d, o, "background-color", "#FFFFFFFFFFFF"));
html->fg = parse_color (opt (d, o, "foreground-color", "#000000000000"));
-#endif
html->file = fn_open (html->handle, "w");
if (html->file == NULL)
{
struct table_item *table_item = to_table_item (output_item);
html_output_table (html, table_item);
}
-#ifdef HAVE_CAIRO
else if (is_image_item (output_item) && html->chart_file_name != NULL)
{
struct image_item *image_item = to_image_item (output_item);
free (file_name);
}
}
-#endif /* HAVE_CAIRO */
else if (is_text_item (output_item))
{
struct text_item *text_item = to_text_item (output_item);
#include "gl/xalloc.h"
#include "gl/xvasprintf.h"
-#ifdef HAVE_CAIRO
/* Creates and returns a new image item containing IMAGE. Takes ownership of
IMAGE. */
struct image_item *
};
return item;
}
-#endif
/* Submits ITEM to the configured output drivers, and transfers ownership to
the output subsystem. */
struct image_item *new = xmalloc (sizeof *new);
*new = (struct image_item) {
.output_item = OUTPUT_ITEM_CLONE_INITIALIZER (&old->output_item),
-#ifdef HAVE_CAIRO
.image = cairo_surface_reference (old->image),
-#endif
};
return new;
}
image_item_destroy (struct output_item *output_item)
{
struct image_item *item = to_image_item (output_item);
-#ifdef HAVE_CAIRO
cairo_surface_destroy (item->image);
-#endif
free (item);
}
#ifndef OUTPUT_IMAGE_ITEM_H
#define OUTPUT_IMAGE_ITEM_H 1
-#ifdef HAVE_CAIRO
#include <cairo.h>
-#endif
#include <stdbool.h>
#include "output/output-item.h"
struct image_item
{
struct output_item output_item; /* Superclass */
-#ifdef HAVE_CAIRO
cairo_surface_t *image;
-#endif
};
-#ifdef HAVE_CAIRO
struct image_item *image_item_create (cairo_surface_t *);
-#endif
-
struct image_item *image_item_unshare (struct image_item *);
\f
/* This boilerplate for image_item, a subclass of output_item, was
#include "data/file-handle-def.h"
#include "libpspp/cast.h"
-#ifdef HAVE_CAIRO
#include "output/cairo-chart.h"
-#endif
#include "output/chart-item.h"
#include "output/group-item.h"
+#include "output/image-item.h"
#include "output/page-eject-item.h"
#include "output/page-setup-item.h"
#include "output/table-item.h"
if (table_item->pt)
spv_writer_put_table (spv->writer, table_item->pt);
}
-#ifdef HAVE_CAIRO
else if (is_chart_item (output_item))
{
cairo_surface_t *surface = xr_draw_image_chart (
spv_writer_put_image (spv->writer, surface);
cairo_surface_destroy (surface);
}
-#endif
+ else if (is_image_item (output_item))
+ spv_writer_put_image (spv->writer, to_image_item (output_item)->image);
else if (is_text_item (output_item))
{
char *command_id = output_get_command_name ();
spv_writer_close_file (w, "");
}
-#ifdef HAVE_CAIRO
static cairo_status_t
write_to_zip (void *zw_, const unsigned char *data, unsigned int length)
{
free (uri);
}
-#endif
void
spv_writer_eject_page (struct spv_writer *w)
struct spv_writer;
struct text_item;
-#ifdef HAVE_CAIRO
#include <cairo.h>
-#endif
#include "libpspp/compiler.h"
const char *command_id);
void spv_writer_put_table (struct spv_writer *, const struct pivot_table *);
-#ifdef HAVE_CAIRO
void spv_writer_put_image (struct spv_writer *, cairo_surface_t *);
-#endif
void spv_writer_eject_page (struct spv_writer *);
return item->type == SPV_ITEM_IMAGE;
}
-#ifdef HAVE_CAIRO
static cairo_status_t
read_from_zip_member (void *zm_, unsigned char *data, unsigned int length)
{
return item->image;
}
-#endif
struct spv_item *
spv_item_next (const struct spv_item *item)
pivot_value_destroy (item->text);
free (item->png_member);
-#ifdef HAVE_CAIRO
if (item->image)
cairo_surface_destroy (item->image);
-#endif
free (item);
}
{
if (spv_item_is_table (item))
spv_item_get_table (item);
-#ifdef HAVE_CAIRO
else if (spv_item_is_image (item))
spv_item_get_image (item);
-#endif
}
bool
top-level headings as a child item.
*/
+#include <cairo.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
-#ifdef HAVE_CAIRO
-#include <cairo.h>
-#endif
-
#include "libpspp/compiler.h"
struct fmt_spec;
/* SPV_ITEM_IMAGE only. */
char *png_member;
-#ifdef HAVE_CAIRO
cairo_surface_t *image;
-#endif
};
void spv_item_format_path (const struct spv_item *, struct string *);
const struct pivot_value *spv_item_get_text (const struct spv_item *);
bool spv_item_is_image (const struct spv_item *);
-#ifdef HAVE_CAIRO
cairo_surface_t *spv_item_get_image (const struct spv_item *);
-#endif
bool spv_item_is_visible (const struct spv_item *);
#include "libpspp/message.h"
#include "libpspp/temp-file.h"
#include "libpspp/version.h"
-#ifdef HAVE_CAIRO
#include "output/cairo-chart.h"
-#endif
#include "output/chart-item.h"
#include "output/driver-provider.h"
#include "output/image-item.h"
/* A hash table containing any Tex macros which need to be emitted. */
struct hmap macros;
bool require_graphics;
-#ifdef HAVE_CAIRO
struct cell_color fg;
struct cell_color bg;
-#endif
struct file_handle *handle;
char *chart_file_name;
tex->chart_file_name = parse_chart_file_name (opt (d, o, "charts",
fh_get_file_name (fh)));
tex->chart_cnt = 1;
-#ifdef HAVE_CAIRO
tex->bg = parse_color (opt (d, o, "background-color", "#FFFFFFFFFFFF"));
tex->fg = parse_color (opt (d, o, "foreground-color", "#000000000000"));
-#endif
tex->file = fn_open (tex->handle, "w");
if (tex->file == NULL)
struct table_item *table_item = to_table_item (output_item);
tex_output_table (tex, table_item);
}
-#ifdef HAVE_CAIRO
else if (is_image_item (output_item) && tex->chart_file_name != NULL)
{
struct image_item *image_item = to_image_item (output_item);
free (file_name);
}
}
-#endif /* HAVE_CAIRO */
else if (is_text_item (output_item))
{
struct text_item *text_item = to_text_item (output_item);
register_driver (&options, "-");
-#ifdef HAVE_CAIRO
/* Render to <base>.pdf. */
string_map_insert (&options, "top-margin", "0");
string_map_insert (&options, "bottom-margin", "0");
string_map_insert (&options, "paper-size", "99x99in");
string_map_insert (&options, "trim", "true");
register_driver (&options, "%s.pdf", output_base);
-#endif
string_map_insert (&options, "box", "unicode");
register_driver (&options, "%s.txt", output_base);
#include <config.h>
-#ifdef HAVE_CAIRO
#include <cairo.h>
-#endif
#include <getopt.h>
#include <limits.h>
#include <stdlib.h>
break;
case SPV_ITEM_IMAGE:
-#ifdef HAVE_CAIRO
image_item_submit (image_item_create (cairo_surface_reference (
spv_item_get_image (item))));
-#endif
break;
case SPV_ITEM_TREE: