Build the ODT driver only if libxml2 is available.
authorBen Pfaff <blp@gnu.org>
Thu, 11 Feb 2010 04:43:10 +0000 (20:43 -0800)
committerBen Pfaff <blp@gnu.org>
Sat, 20 Feb 2010 01:16:13 +0000 (17:16 -0800)
Reported by Michel Boaventura <michel@michelboaventura.com>.

INSTALL
README
configure.ac
doc/invoking.texi
src/output/automake.mk
src/output/driver.c

diff --git a/INSTALL b/INSTALL
index 0f4f5c9687567dfaa9c322407387f889ed7d19be..f391f56313c11de18de9d9187aa1543c9faf936f 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -66,6 +66,11 @@ Gnumeric files.
 
     * libxml2 (http://xmlsoft.org/).  
 
+Installing the following packages will allow your PSPP binary to write
+OpenDocument text (ODT) files:
+
+    * libxml2 (http://xmlsoft.org/).  
+
 The following packages are optional.
 
     * libncurses (http://www.gnu.org/software/ncurses/).  Without it,
diff --git a/README b/README
index e54877a10fdb90c31c1c766985084c91953b4d50..d1c78db2c20bca092cbde646171aec4fc78068b6 100644 (file)
--- a/README
+++ b/README
@@ -4,7 +4,7 @@ is a free replacement for the proprietary program SPSS.
 PSPP development is ongoing. It already supports a large subset of
 SPSS's syntax.  Its statistical procedure support is currently
 limited, but growing.  At your option, PSPP will produce statistical
-reports in ASCII, PostScript, PDF, HTML, or SVG formats. 
+reports in ASCII, PostScript, PDF, HTML, SVG, or OpenDocument formats. 
 
 Instructions for PSPP installation are in INSTALL, including a list of
 prerequisite packages and other PSPP-specific information.  Full
index 491cfeacf6c8cf9a55219ab1dd468745407be196..4d6cab7c2229b656041ae4668db9d9bf83402391 100644 (file)
@@ -126,18 +126,43 @@ if test x"$with_libpq" != x"no" ; then
 fi
 AM_CONDITIONAL(PSQL_SUPPORT, test -n "$PG_CONFIG")
 
-dnl Checks needed for Gnumeric reader
-gnm_support=yes;
-PKG_CHECK_MODULES(LIBXML2, libxml-2.0,,
-                          [PSPP_OPTIONAL_PREREQ([libxml2]); gnm_support=no;]);
-AC_SEARCH_LIBS(gzopen,z,,[PSPP_OPTIONAL_PREREQ([zlib]); gnm_support=no;])
-AC_CHECK_HEADERS(zlib.h,,[PSPP_OPTIONAL_PREREQ([zlib]); gnm_support=no;])
-
-if test x"$gnm_support" = x"yes" ; then 
-   AC_DEFINE([GNM_SUPPORT], 1,
-   [Define to 1 if building in support for reading Gnumeric files.])
+dnl Check for libxml2
+PKG_CHECK_MODULES(
+  [LIBXML2], [libxml-2.0], 
+  [HAVE_LIBXML2=yes],
+  [HAVE_LIBXML2=no
+   PSPP_OPTIONAL_PREREQ([libxml2])])
+
+dnl Check for zlib.
+AC_SEARCH_LIBS(
+  [gzopen], [z],
+  [HAVE_ZLIB=yes],
+  [HAVE_ZLIB=no
+   PSPP_OPTIONAL_PREREQ([zlib])])
+AC_CHECK_HEADERS(
+  [zlib.h], 
+  [],
+  [HAVE_ZLIB=no
+   PSPP_OPTIONAL_PREREQ([zlib])])
+
+dnl Gnumeric support requires libxml2 and zlib.
+if test $HAVE_LIBXML2 = yes && test $HAVE_ZLIB = yes; then
+  GNM_SUPPORT=yes
+  AC_DEFINE(
+    [GNM_SUPPORT], [1],
+    [Define to 1 if building in support for reading Gnumeric files.])
+else
+  GNM_SUPPORT=no
 fi
-AM_CONDITIONAL(GNM_SUPPORT, test x"$gnm_support" = x"yes")
+AM_CONDITIONAL([GNM_SUPPORT], [test $GNM_SUPPORT = yes])
+
+dnl ODT support requires libxml2.
+if test $HAVE_LIBXML2 = yes; then
+  AC_DEFINE(
+    [ODT_SUPPORT], [1],
+    [Define to 1 if building in support for writing ODT files.])
+fi
+AM_CONDITIONAL([ODT_SUPPORT], [test $HAVE_LIBXML2 = yes])
 
 AC_ARG_WITH(
   gui_tools,
index 86ddc31f12516c79424aa92ad40ecfbc7d5c703f..830d176463baccdb4f8de9261b162bc30954907b 100644 (file)
@@ -360,6 +360,9 @@ To produce output as an OpenDocument text (ODT) document, specify
 @option{-o @var{file}} on the PSPP command line.  If @var{file} does
 not end in @file{.odt}, you must also specify @option{-O format=odt}.
 
+ODT support is only available if your installation of PSPP was
+compiled with the libxml2 library.
+
 The OpenDocument output format does not have any configurable options.
 
 @node Comma-Separated Value Output Options
index 259f3b0e6a95afd8e8d04f3e9e6801b1ff1a477d..e5781b0af7d3bb4e3f8fdf1ff4ccfbd61acc6f87 100644 (file)
@@ -34,7 +34,6 @@ 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 \
@@ -68,5 +67,8 @@ src_output_liboutput_la_SOURCES += \
        src/output/charts/roc-chart-cairo.c \
        src/output/charts/scree-cairo.c
 endif
+if ODT_SUPPORT
+src_output_liboutput_la_SOURCES += src/output/odt.c
+endif
 
 EXTRA_DIST += src/output/OChangeLog
index 203644584f162eade6f30663c26ffaa81625d58d..6d836354a16f20b952670ab19a47cac5609707f4 100644 (file)
@@ -246,8 +246,10 @@ output_driver_track_current_command (const struct output_item *output_item,
 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 odt_driver_factory;
 extern const struct output_driver_factory csv_driver_factory;
+#ifdef ODT_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;
@@ -259,8 +261,10 @@ static const struct output_driver_factory *factories[] =
     &txt_driver_factory,
     &list_driver_factory,
     &html_driver_factory,
-    &odt_driver_factory,
     &csv_driver_factory,
+#ifdef ODT_SUPPORT
+    &odt_driver_factory,
+#endif
 #ifdef HAVE_CAIRO
     &pdf_driver_factory,
     &ps_driver_factory,