Make libxml2 a required build dependency.
authorBen Pfaff <blp@cs.stanford.edu>
Mon, 30 Apr 2018 00:15:54 +0000 (17:15 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Mon, 30 Apr 2018 00:25:22 +0000 (17:25 -0700)
This makes the logic for what is required versus optional much simpler.  An
upcoming commit will introduce a new libxml2 user.

INSTALL
NEWS
configure.ac
src/data/gnumeric-reader.c
src/data/ods-reader.c
src/data/ods-reader.h
src/data/spreadsheet-reader.c
src/output/automake.mk
src/output/driver.c
tests/atlocal.in
tests/language/data-io/get-data-spreadsheet.at

diff --git a/INSTALL b/INSTALL
index 835092ede10b29846541546b2682bcbe1b6593d3..2ab967c2b858eee1d6f6176b64b1c414d78d30b3 100644 (file)
--- 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 e8766200217c7914d5753c421329d5feb9b1748c..7b943b15fb1dd8fb7fe8d9ef0426895b929ad51e 100644 (file)
--- 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:
 
index 18dd2e83f081db0c5507b1f9cf4b5f3424bc1075..5e2c714b60a8cdb5cd04342e969aa061613af3e8 100644 (file)
@@ -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.])])
index 0ef8e4e14e431ce3b049d6a823b02d32ac0394f5..589bdbe8c5d02119e1ea2046b8e89248eb83b387 100644 (file)
 
 #include <config.h>
 
-#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 <assert.h>
 #include <stdbool.h>
@@ -74,19 +25,26 @@ gnumeric_unref (struct spreadsheet *r)
 #include <libxml/xmlreader.h>
 #include <zlib.h>
 
-#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 */
index 736985ea8be29a8c6bc4947de7591e7f889f89b5..387bea00ac28c2d319546046afdf77f82d0c3198 100644 (file)
 
 #include <config.h>
 
-#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 <assert.h>
 #include <stdbool.h>
 #include <errno.h>
 #include <libxml/xmlreader.h>
 #include <zlib.h>
 
-#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
index e5751d3e087b27a041bff9c49054940921755e27..9602a310c1dd0889bebb95eaf7b5b556e3b4e712 100644 (file)
@@ -17,6 +17,8 @@
 #ifndef ODS_READ_H
 #define ODS_READ_H 1
 
+#include <stdbool.h>
+
 struct casereader;
 struct dictionary;
 
index 86dfe48c0c43c296c2e21d4446585959a55ef018..08a37157e4a62c880d3c8cf93bf868685cd1d486 100644 (file)
 #include <gl/c-xvasprintf.h>
 #include <stdlib.h>
 
-#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;
 }
index 7e2a9afe6ce78ae5179f0cbac86d067ff65fbda2..9412c07f4933b4873e8fda8c00a4ccfda5ef3956 100644 (file)
@@ -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 \
index afb5084fa1d2abc0d76c59d77179fe5a86902b97..58e7850d4e01f6866fe8449f7849c94c03692d93 100644 (file)
@@ -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,
index 38679c050c1c63f8f5dceb1d540fdab8eeffc404..cd3b8e2ada47e3bf10eb03dd524abd4b4fc00847 100644 (file)
@@ -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@'
index cc03ade98325186414404dd83ad6831b63b4b809..6c838d99bdcaab4fc9492c1aa51e74f9826384c6 100644 (file)
@@ -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
 <?xml version="1.0" encoding="UTF-8"?>
 <gnm:Workbook xmlns:gnm="http://www.gnumeric.org/v10.dtd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.gnumeric.org/v9.xsd">
@@ -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