From 51f6adf4ab3e07cc3073ea572117b5dc2862c6e6 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sun, 29 Apr 2018 17:15:54 -0700 Subject: [PATCH 1/1] Make libxml2 a required build dependency. This makes the logic for what is required versus optional much simpler. An upcoming commit will introduce a new libxml2 user. --- INSTALL | 12 +--- NEWS | 12 ++-- configure.ac | 30 +------- src/data/gnumeric-reader.c | 65 +++--------------- src/data/ods-reader.c | 68 ++++--------------- src/data/ods-reader.h | 2 + src/data/spreadsheet-reader.c | 44 ++++-------- src/output/automake.mk | 4 +- src/output/driver.c | 4 -- tests/atlocal.in | 2 - .../language/data-io/get-data-spreadsheet.at | 5 -- 11 files changed, 48 insertions(+), 200 deletions(-) diff --git a/INSTALL b/INSTALL index 835092ede1..2ab967c2b8 100644 --- a/INSTALL +++ b/INSTALL @@ -70,6 +70,8 @@ The following packages are required to install PSPP: * zlib (http://www.zlib.net/). + * libxml2 (http://xmlsoft.org/). + 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 @@ -96,16 +98,6 @@ use the GUI, you must run `configure' with --without-gui. The following packages are optional: -Installing the following packages will allow your PSPP program to read -Gnumeric files. - - * libxml2 (http://xmlsoft.org/). - -Installing the following packages will allow your PSPP program to write -OpenDocument text (ODT) files: - - * libxml2 (http://xmlsoft.org/). - Other optional packages: * libreadline and libhistory diff --git a/NEWS b/NEWS index e876620021..7b943b15fb 100644 --- a/NEWS +++ b/NEWS @@ -6,11 +6,15 @@ Please send PSPP bug reports to bug-gnu-pspp@gnu.org. Changes from 1.0.1 to 1.1.0: - ** The code implementing the sheet rendering has been removed. Instead we - use a third party library: spread-sheet-widget. + * Build changes: + + - zlib is now a required dependency. (Previously it was optional.) + + * The code implementing the sheet rendering has been removed. Instead we + use a third party library: spread-sheet-widget. - ** The "NOMISSING" keyword when generating syntax for piecharts in the frequencies - command was omitted. This has been corrected. + * The "NOMISSING" keyword when generating syntax for piecharts in the + frequencies command was omitted. This has been corrected. Changes from 1.0.0 to 1.0.1: diff --git a/configure.ac b/configure.ac index 18dd2e83f0..5e2c714b60 100644 --- a/configure.ac +++ b/configure.ac @@ -216,10 +216,7 @@ AC_SUBST([PSQL_SUPPORT]) dnl Check for libxml2 PKG_CHECK_MODULES( - [LIBXML2], [libxml-2.0], - [HAVE_LIBXML2=yes], - [HAVE_LIBXML2=no - PSPP_OPTIONAL_PREREQ([libxml2])]) + [LIBXML2], [libxml-2.0], [], [PSPP_REQUIRED_PREREQ([libxml2])]) dnl Check for zlib. AC_SEARCH_LIBS([gzopen], [z], [], [PSPP_REQUIRED_PREREQ([zlib])]) @@ -237,31 +234,6 @@ AC_DEFINE( [crc32], [gl_crc32], [Avoid making zlib call gnulib's crc32() instead of its own.]) -dnl Gnumeric and OpenDocument (read) support requires libxml2 and zlib. -if test $HAVE_LIBXML2 = yes; then - GNM_READ_SUPPORT=yes - ODF_READ_SUPPORT=yes - AC_DEFINE( - [GNM_READ_SUPPORT], [1], - [Define to 1 if building in support for reading Gnumeric files.]) - AC_DEFINE( - [ODF_READ_SUPPORT], [1], - [Define to 1 if building in support for reading OpenDocument files.]) -else - GNM_READ_SUPPORT=no - ODF_READ_SUPPORT=no -fi -AC_SUBST([GNM_READ_SUPPORT]) -AC_SUBST([ODF_READ_SUPPORT]) - -dnl ODF support requires libxml2 (zlib is optional). -if test $HAVE_LIBXML2 = yes; then - AC_DEFINE( - [ODF_WRITE_SUPPORT], [1], - [Define to 1 if building in support for writing OpenDocument files.]) -fi -AM_CONDITIONAL([ODF_WRITE_SUPPORT], [test $HAVE_LIBXML2 = yes]) - AC_ARG_WITH( gui_tools, [AS_HELP_STRING([--with-gui-tools], [build the gui developer tools. For DEVELOPERS only! There is no reason why users will need this flag.])]) diff --git a/src/data/gnumeric-reader.c b/src/data/gnumeric-reader.c index 0ef8e4e14e..589bdbe8c5 100644 --- a/src/data/gnumeric-reader.c +++ b/src/data/gnumeric-reader.c @@ -16,57 +16,8 @@ #include -#include "libpspp/message.h" -#include "libpspp/misc.h" - -#include "gl/minmax.h" -#include "gl/c-strtod.h" - -#include "gettext.h" -#define _(msgid) gettext (msgid) -#define N_(msgid) (msgid) - -#include "spreadsheet-reader.h" - -#if !GNM_READ_SUPPORT - -struct spreadsheet * -gnumeric_probe (const char *filename, bool report_errors) -{ - if (report_errors) - msg (ME, _("Support for %s files was not compiled into this installation of PSPP"), "Gnumeric"); - - return NULL; -} - -const char * -gnumeric_get_sheet_name (struct spreadsheet *s, int n) -{ - return NULL; -} - -char * -gnumeric_get_sheet_range (struct spreadsheet *s, int n) -{ - return NULL; -} - -struct casereader * -gnumeric_make_reader (struct spreadsheet *spreadsheet, - const struct spreadsheet_read_options *opts) -{ - return NULL; -} - -void -gnumeric_unref (struct spreadsheet *r) -{ -} - - -#else - #include "data/gnumeric-reader.h" +#include "spreadsheet-reader.h" #include #include @@ -74,19 +25,26 @@ gnumeric_unref (struct spreadsheet *r) #include #include -#include "data/format.h" -#include "data/data-in.h" #include "data/case.h" #include "data/casereader-provider.h" +#include "data/data-in.h" #include "data/dictionary.h" +#include "data/format.h" #include "data/identifier.h" #include "data/value.h" #include "data/variable.h" #include "libpspp/i18n.h" +#include "libpspp/message.h" +#include "libpspp/misc.h" #include "libpspp/str.h" +#include "gl/c-strtod.h" +#include "gl/minmax.h" #include "gl/xalloc.h" +#include "gettext.h" +#define _(msgid) gettext (msgid) +#define N_(msgid) (msgid) /* Shamelessly lifted from the Gnumeric sources: https://git.gnome.org/browse/gnumeric/tree/src/value.h @@ -979,6 +937,3 @@ gnm_file_casereader_read (struct casereader *reader UNUSED, void *r_) return NULL; } } - - -#endif /* GNM_READ_SUPPORT */ diff --git a/src/data/ods-reader.c b/src/data/ods-reader.c index 736985ea8b..387bea00ac 100644 --- a/src/data/ods-reader.c +++ b/src/data/ods-reader.c @@ -16,81 +16,38 @@ #include -#include "libpspp/message.h" -#include "libpspp/misc.h" -#include "libpspp/assertion.h" - -#include "data/data-in.h" - -#include "gl/c-strtod.h" -#include "gl/minmax.h" - -#include "gettext.h" -#define _(msgid) gettext (msgid) -#define N_(msgid) (msgid) - #include "ods-reader.h" #include "spreadsheet-reader.h" -#if !ODF_READ_SUPPORT - -struct spreadsheet * -ods_probe (const char *filename, bool report_errors) -{ - if (report_errors) - msg (ME, _("Support for %s files was not compiled into this installation of PSPP"), "OpenDocument"); - - return NULL; -} - -const char * -ods_get_sheet_name (struct spreadsheet *s, int n) -{ - return NULL; -} - -char * -ods_get_sheet_range (struct spreadsheet *s, int n) -{ - return NULL; -} - -struct casereader * -ods_make_reader (struct spreadsheet *spreadsheet, - const struct spreadsheet_read_options *opts) -{ - return NULL; -} - - -void -ods_unref (struct spreadsheet *r) -{ -} - -#else - -#include "libpspp/zip-reader.h" - - #include #include #include #include #include -#include "data/format.h" #include "data/case.h" #include "data/casereader-provider.h" +#include "data/data-in.h" #include "data/dictionary.h" +#include "data/format.h" #include "data/identifier.h" #include "data/value.h" #include "data/variable.h" +#include "libpspp/assertion.h" #include "libpspp/i18n.h" +#include "libpspp/message.h" +#include "libpspp/misc.h" #include "libpspp/str.h" +#include "libpspp/zip-reader.h" +#include "gl/c-strtod.h" +#include "gl/minmax.h" #include "gl/xalloc.h" +#include "gettext.h" +#define _(msgid) gettext (msgid) +#define N_(msgid) (msgid) + static void ods_file_casereader_destroy (struct casereader *, void *); static struct ccase *ods_file_casereader_read (struct casereader *, void *); @@ -1044,4 +1001,3 @@ ods_file_casereader_read (struct casereader *reader UNUSED, void *r_) return c; } -#endif diff --git a/src/data/ods-reader.h b/src/data/ods-reader.h index e5751d3e08..9602a310c1 100644 --- a/src/data/ods-reader.h +++ b/src/data/ods-reader.h @@ -17,6 +17,8 @@ #ifndef ODS_READ_H #define ODS_READ_H 1 +#include + struct casereader; struct dictionary; diff --git a/src/data/spreadsheet-reader.c b/src/data/spreadsheet-reader.c index 86dfe48c0c..08a37157e4 100644 --- a/src/data/spreadsheet-reader.c +++ b/src/data/spreadsheet-reader.c @@ -29,18 +29,6 @@ #include #include -#ifdef ODF_READ_SUPPORT -static const bool ODF_READING_SUPPORTED = true; -#else -static const bool ODF_READING_SUPPORTED = false; -#endif - -#ifdef GNM_READ_SUPPORT -static const bool GNM_READING_SUPPORTED = true; -#else -static const bool GNM_READING_SUPPORTED = false; -#endif - void spreadsheet_ref (struct spreadsheet *s) { @@ -53,12 +41,10 @@ spreadsheet_unref (struct spreadsheet *s) switch (s->type) { case SPREADSHEET_ODS: - assert (ODF_READING_SUPPORTED); ods_unref (s); break; case SPREADSHEET_GNUMERIC: - assert (GNM_READING_SUPPORTED); gnumeric_unref (s); break; default: @@ -72,13 +58,11 @@ struct casereader * spreadsheet_make_reader (struct spreadsheet *s, const struct spreadsheet_read_options *opts) { - if (ODF_READING_SUPPORTED) - if ( s->type == SPREADSHEET_ODS) - return ods_make_reader (s, opts); + if ( s->type == SPREADSHEET_ODS) + return ods_make_reader (s, opts); - if (GNM_READING_SUPPORTED) - if ( s->type == SPREADSHEET_GNUMERIC) - return gnumeric_make_reader (s, opts); + if ( s->type == SPREADSHEET_GNUMERIC) + return gnumeric_make_reader (s, opts); return NULL; } @@ -86,13 +70,11 @@ spreadsheet_make_reader (struct spreadsheet *s, const char * spreadsheet_get_sheet_name (struct spreadsheet *s, int n) { - if (ODF_READING_SUPPORTED) - if ( s->type == SPREADSHEET_ODS) - return ods_get_sheet_name (s, n); + if ( s->type == SPREADSHEET_ODS) + return ods_get_sheet_name (s, n); - if (GNM_READING_SUPPORTED) - if ( s->type == SPREADSHEET_GNUMERIC) - return gnumeric_get_sheet_name (s, n); + if ( s->type == SPREADSHEET_GNUMERIC) + return gnumeric_get_sheet_name (s, n); return NULL; } @@ -101,13 +83,11 @@ spreadsheet_get_sheet_name (struct spreadsheet *s, int n) char * spreadsheet_get_sheet_range (struct spreadsheet *s, int n) { - if (ODF_READING_SUPPORTED) - if ( s->type == SPREADSHEET_ODS) - return ods_get_sheet_range (s, n); + if ( s->type == SPREADSHEET_ODS) + return ods_get_sheet_range (s, n); - if (GNM_READING_SUPPORTED) - if ( s->type == SPREADSHEET_GNUMERIC) - return gnumeric_get_sheet_range (s, n); + if ( s->type == SPREADSHEET_GNUMERIC) + return gnumeric_get_sheet_range (s, n); return NULL; } diff --git a/src/output/automake.mk b/src/output/automake.mk index 7e2a9afe6c..9412c07f49 100644 --- a/src/output/automake.mk +++ b/src/output/automake.mk @@ -57,6 +57,7 @@ src_output_liboutput_la_SOURCES = \ src/output/message-item.h \ src/output/msglog.c \ src/output/msglog.h \ + src/output/odt.c \ src/output/options.c \ src/output/options.h \ src/output/output-item-provider.h \ @@ -94,9 +95,6 @@ src_output_liboutput_la_SOURCES += \ src/output/charts/spreadlevel-cairo.c \ src/output/charts/scatterplot-cairo.c endif -if ODF_WRITE_SUPPORT -src_output_liboutput_la_SOURCES += src/output/odt.c -endif EXTRA_DIST += \ src/output/README \ diff --git a/src/output/driver.c b/src/output/driver.c index afb5084fa1..58e7850d4e 100644 --- a/src/output/driver.c +++ b/src/output/driver.c @@ -287,9 +287,7 @@ 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; -#ifdef ODF_WRITE_SUPPORT extern const struct output_driver_factory odt_driver_factory; -#endif #ifdef HAVE_CAIRO extern const struct output_driver_factory pdf_driver_factory; extern const struct output_driver_factory ps_driver_factory; @@ -302,9 +300,7 @@ static const struct output_driver_factory *factories[] = &list_driver_factory, &html_driver_factory, &csv_driver_factory, -#ifdef ODF_WRITE_SUPPORT &odt_driver_factory, -#endif #ifdef HAVE_CAIRO &pdf_driver_factory, &ps_driver_factory, diff --git a/tests/atlocal.in b/tests/atlocal.in index 38679c050c..cd3b8e2ada 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -20,8 +20,6 @@ # Variables used internally by the testsuite. EXEEXT='@EXEEXT@' -GNM_READ_SUPPORT='@GNM_READ_SUPPORT@' -ODF_READ_SUPPORT='@ODF_READ_SUPPORT@' PERL='@PERL@' WITH_PERL_MODULE='@WITH_PERL_MODULE@' host='@host@' diff --git a/tests/language/data-io/get-data-spreadsheet.at b/tests/language/data-io/get-data-spreadsheet.at index cc03ade983..6c838d99bd 100644 --- a/tests/language/data-io/get-data-spreadsheet.at +++ b/tests/language/data-io/get-data-spreadsheet.at @@ -18,12 +18,10 @@ m4_define([SPREADSHEET_TEST_PREP],[dnl m4_if($1,[GNM],[dnl AT_CHECK([gzip -c $top_srcdir/tests/language/data-io/Book1.gnm.unzipped > Book1.gnumeric])dnl m4_define([testsheet],[Book1.gnumeric])dnl - AT_SKIP_IF([test n$GNM_READ_SUPPORT != nyes])dnl ]) dnl m4_if($1,[ODS],[dnl AT_CHECK([cp $top_srcdir/tests/language/data-io/test.ods test.ods])dnl m4_define([testsheet],[test.ods])dnl - AT_SKIP_IF([test n$ODF_READ_SUPPORT != nyes])dnl ])dnl ]) @@ -170,7 +168,6 @@ CHECK_SPREADSHEET_READER([GNM]) dnl Check for a bug where gnumeric files were interpreted incorrectly AT_SETUP([GET DATA /TYPE=GNM sheet index bug]) -AT_SKIP_IF([test n$GNM_READ_SUPPORT != nyes]) AT_DATA([minimal3.gnumeric],[dnl @@ -319,7 +316,6 @@ AT_CLEANUP dnl Check for a bug where certain gnumeric files failed an assertion AT_SETUP([GET DATA /TYPE=GNM assert-fail]) -AT_SKIP_IF([test n$GNM_READ_SUPPORT != nyes]) AT_DATA([read.sps],[dnl GET DATA /TYPE=GNM @@ -376,7 +372,6 @@ CHECK_SPREADSHEET_READER([ODS]) AT_SETUP([GET DATA /TYPE=ODS crash]) -AT_SKIP_IF([test n$ODF_READ_SUPPORT != nyes]) AT_CHECK([cp $top_srcdir/tests/language/data-io/newone.ods this.ods])dnl -- 2.30.2