diff options
-rw-r--r-- | Makefile.am | 15 | ||||
-rw-r--r-- | NEWS | 24 | ||||
-rw-r--r-- | README | 3 | ||||
-rwxr-xr-x | acprep | 12 | ||||
-rw-r--r-- | config.cc | 2 | ||||
-rw-r--r-- | configure.in | 47 | ||||
-rw-r--r-- | gnucash.cc | 9 | ||||
-rw-r--r-- | ledger.texi | 2 | ||||
-rw-r--r-- | main.cc | 2 | ||||
-rw-r--r-- | main.py | 2 | ||||
-rw-r--r-- | py_eval.cc | 4 | ||||
-rwxr-xr-x | setup.py | 4 | ||||
-rw-r--r-- | textual.cc | 2 | ||||
-rw-r--r-- | xml.cc | 8 |
14 files changed, 94 insertions, 42 deletions
diff --git a/Makefile.am b/Makefile.am index cb72d504..09ddbd35 100644 --- a/Makefile.am +++ b/Makefile.am @@ -20,6 +20,10 @@ libledger_a_SOURCES = \ valexpr.cc \ value.cc \ walk.cc +if HAVE_EXPAT +libledger_a_CXXFLAGS += -DHAVE_EXPAT=1 +libledger_a_SOURCES += gnucash.cc xml.cc +endif if HAVE_XMLPARSE libledger_a_CXXFLAGS += -DHAVE_XMLPARSE=1 libledger_a_SOURCES += gnucash.cc xml.cc @@ -79,6 +83,10 @@ ledger_LDADD = $(LIBOBJS) libledger.a -lboost_python -lpython$(PYTHON_VERSION) else ledger_LDADD = $(LIBOBJS) libledger.a endif +if HAVE_EXPAT +ledger_CXXFLAGS += -DHAVE_EXPAT=1 +ledger_LDADD += -lexpat +endif if HAVE_XMLPARSE ledger_CXXFLAGS += -DHAVE_XMLPARSE=1 ledger_LDADD += -lxmlparse -lxmltok @@ -99,6 +107,11 @@ if HAVE_BOOST_PYTHON noinst_PROGRAMS = ledger.so +if HAVE_EXPAT +HAVE_EXPAT_VALUE = true +else +HAVE_EXPAT_VALUE = false +endif if HAVE_XMLPARSE HAVE_XMLPARSE_VALUE = true else @@ -112,12 +125,14 @@ endif ledger.so: py_eval.cc libledger.a CFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS) -L." \ + HAVE_EXPAT="$(HAVE_EXPAT_VALUE)" \ HAVE_XMLPARSE="$(HAVE_XMLPARSE_VALUE)" \ HAVE_LIBOFX="$(HAVE_LIBOFX_VALUE)" \ python setup.py build --build-lib=. install-exec-hook: CFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS) -L." \ + HAVE_EXPAT="$(HAVE_EXPAT_VALUE)" \ HAVE_XMLPARSE="$(HAVE_XMLPARSE_VALUE)" \ HAVE_LIBOFX="$(HAVE_LIBOFX_VALUE)" \ python setup.py install --prefix=$(prefix) @@ -2,19 +2,17 @@ * 2.4 -- The --end date is now inclusive. - -- Both "-$100.00" and "$-100.00" are supported as equivalent amounts. +- Both "-$100.00" and "$-100.00" are now equivalent amounts. - Simple, inline math (using the operators +-/*, and/or parentheses) - is now supported in transactions. For example: + is supported in transactions. For example: 2004/05/27 Book Store Expenses:Dining $20.00 + $2.50 Liabilities:MasterCard - This won't register the tax/tip in its own account, but it might - make later reading of the ledger file easier. + This won't register the tax/tip in its own account, but might make + later reading of the ledger file easier. - Use of a "catch all" account is now possible, which auto-balances entries that contain _only one transaction_. For sanity's sake this @@ -28,14 +26,6 @@ This is equivalent to the entry in the previous bullet. -- Further, entries with a single transaction may specify that - transaction directly after the payee, if followed by two or more - spaces: - - A Liabilities:MasterCard - - 2004/05/27 Book Store Expenses:Dining $20.00 + $2.50 - - Entries that contain a single transaction with no amount now always balance, even if multiple commodities are involved. This means that the following is now supported which wasn't previously: @@ -46,9 +36,13 @@ Retirement 300 FUNDC Equity:Adjustments -- Fixed some obscure bugs relating to QIF parsing, and budgeting and +- Fixed several bugs relating to QIF parsing, budgeting and forecasting. +- The configure process now looks for libexpat, in addition to + searching for libxmlparse+libxmltok (which is how expat used to be + packaged). + * 2.3 - The directive "!alias ALIAS = ACCOUNT" makes it possible to use @@ -42,8 +42,7 @@ If you wish to read Gnucash data files, you will also need two XML libraries, which may or may not be available in a single package (it depends on your distribution): - xmlparse - xmltok + libexpat, or libxmlparse and libxmltok Once you have determined where the headers and libraries for the above packages are installed, run the script "configure", passing those @@ -11,10 +11,10 @@ else fi autoconf -INCDIRS="-I/sw/include -I/usr/include/httpd/xml -I/sw/include/python2.3" -INCDIRS="$INCDIRS -I/sw/include/libofx" +INCDIRS="-I/sw/include -I/usr/include/httpd/xml -I/usr/include/python2.3" +#INCDIRS="$INCDIRS -I/sw/include/libofx" INCDIRS="$INCDIRS -Wno-long-double" -LIBDIRS="-L/sw/lib -L/sw/lib/python2.3/config" +LIBDIRS="-L/sw/lib -L/usr/lib/python2.3/config" if [ "$1" = "--debug" ]; then ./configure CPPFLAGS="$INCDIRS" LDFLAGS="$LIBDIRS" CXXFLAGS="-g" \ @@ -24,13 +24,13 @@ elif [ "$1" = "--debug-python" ]; then --enable-debug --enable-python elif [ "$1" = "--opt" ]; then ./configure CPPFLAGS="$INCDIRS" LDFLAGS="$LIBDIRS" \ - CXXFLAGS="-fomit-frame-pointer -fastf -mcpu=7450 -fPIC" + CXXFLAGS="-fomit-frame-pointer -O3 -mcpu=7450 -fPIC" elif [ "$1" = "--flat-opt" ]; then ./configure CPPFLAGS="$INCDIRS" LDFLAGS="$LIBDIRS" \ - CXXFLAGS="-fomit-frame-pointer -fastf -mcpu=7450" + CXXFLAGS="-fomit-frame-pointer -O3 -mcpu=7450" elif [ "$1" = "--safe-opt" ]; then ./configure CPPFLAGS="$INCDIRS" LDFLAGS="$LIBDIRS" \ - CXXFLAGS="-fomit-frame-pointer -fastf -mcpu=7450 -fPIC -DDEBUG_LEVEL=1" \ + CXXFLAGS="-fomit-frame-pointer -O3 -mcpu=7450 -fPIC -DDEBUG_LEVEL=1" \ --enable-python elif [ "$1" = "--perf" ]; then ./configure CPPFLAGS="$INCDIRS" LDFLAGS="$LIBDIRS" CXXFLAGS="-g -pg" @@ -343,7 +343,7 @@ See LICENSE file included with the distribution for details and disclaimer.\n"; #ifdef USE_BOOST_PYTHON out << ", python"; #endif -#ifdef HAVE_XMLPARSE +#if defined(HAVE_EXPAT) || defined(HAVE_XMLPARSE) out << ", xml"; #endif #ifdef HAVE_LIBOFX diff --git a/configure.in b/configure.in index a709ec9a..21dbf1eb 100644 --- a/configure.in +++ b/configure.in @@ -99,7 +99,7 @@ else AC_MSG_FAILURE("Could not find pcre library (set CPPFLAGS and LDFLAGS?)") fi -# check for xmlparse +# check for expat or xmlparse AC_ARG_ENABLE(xml, [ --enable-xml Turn on support for XML parsing], [case "${enableval}" in @@ -111,23 +111,50 @@ AM_CONDITIONAL(USE_XML, test x$xml = xtrue) if [test x$xml = xtrue ]; then AC_CACHE_CHECK( - [if libxmlparse is available], - [libxmlparse_avail], - [libxmlparse_save_libs=$LIBS - LIBS="-lxmlparse -lxmltok $LIBS" + [if libexpat is available], + [libexpat_avail], + [libexpat_save_libs=$LIBS + LIBS="-lexpat $LIBS" AC_LANG_PUSH(C++) AC_TRY_LINK( [#include <stdio.h> extern "C" { - #include <xmlparse.h> // expat XML parser + #include <expat.h> // expat XML parser }], [XML_Parser parser = XML_ParserCreate(NULL); return parser != NULL;], - [libxmlparse_avail=true], - [libxmlparse_avail=false]) + [libexpat_avail=true], + [libexpat_avail=false]) AC_LANG_POP - LIBS=$libxmlparse_save_libs]) - AM_CONDITIONAL(HAVE_XMLPARSE, test x$libxmlparse_avail = xtrue) + LIBS=$libexpat_save_libs]) + AM_CONDITIONAL(HAVE_EXPAT, test x$libexpat_avail = xtrue) +else + AM_CONDITIONAL(HAVE_EXPAT, false) +fi + +if [test x$xml = xtrue ]; then + if [test x$libexpat_avail = xfalse ]; then + AC_CACHE_CHECK( + [if libxmlparse is available], + [libxmlparse_avail], + [libxmlparse_save_libs=$LIBS + LIBS="-lxmlparse -lxmltok $LIBS" + AC_LANG_PUSH(C++) + AC_TRY_LINK( + [#include <stdio.h> + extern "C" { + #include <xmlparse.h> // expat XML parser + }], + [XML_Parser parser = XML_ParserCreate(NULL); + return parser != NULL;], + [libxmlparse_avail=true], + [libxmlparse_avail=false]) + AC_LANG_POP + LIBS=$libxmlparse_save_libs]) + AM_CONDITIONAL(HAVE_XMLPARSE, test x$libxmlparse_avail = xtrue) + else + AM_CONDITIONAL(HAVE_XMLPARSE, false) + fi else AM_CONDITIONAL(HAVE_XMLPARSE, false) fi @@ -2,13 +2,20 @@ #include "journal.h" #include "format.h" #include "error.h" +#include "acconf.h" #include <iostream> #include <sstream> #include <cstring> extern "C" { -#include <xmlparse.h> // expat XML parser +#if defined(HAVE_EXPAT) +#include <expat.h> // expat XML parser +#elif defined(HAVE_XMLPARSE) +#include <xmlparse.h> // expat XML parser +#else +#error "No XML parser library defined." +#endif } namespace ledger { diff --git a/ledger.texi b/ledger.texi index 4a94168f..b7aa084a 100644 --- a/ledger.texi +++ b/ledger.texi @@ -3896,7 +3896,7 @@ example: That is the extent of the XML data format used by Ledger. It will output such data if the @command{xml} command is used, and can read -the same data as long as the @file{xmlparse} library was available +the same data as long as the @file{expat} library was available when Ledger was built. @node Extending with Python, , Using XML, Top @@ -473,7 +473,7 @@ def vmax(d, val):\n\ else if (command == "x") formatter = new format_emacs_transactions(*out); else if (command == "X") { -#ifdef HAVE_XMLPARSE +#if defined(HAVE_EXPAT) || defined(HAVE_XMLPARSE) formatter = new format_xml_entries(*out, config.show_totals); #else throw error("XML support was not compiled into this copy of Ledger"); @@ -122,7 +122,7 @@ else: # so that Ledger will try each one in turn whenever it is presented # with a data file. They are attempted in reverse order to their # registry. Note that Gnucash parsing is only available if the Ledger -# module was built with such support (which requires the xmlparse C +# module was built with such support (which requires the expat C # library). bin_parser = BinaryParser () @@ -19,7 +19,7 @@ void export_parser(); void export_textual(); void export_binary(); void export_qif(); -#ifdef HAVE_XMLPARSE +#if defined(HAVE_EXPAT) || defined(HAVE_XMLPARSE) void export_xml(); void export_gnucash(); #endif @@ -46,7 +46,7 @@ void initialize_ledger_for_python() export_textual(); export_binary(); export_qif(); -#ifdef HAVE_XMLPARSE +#if defined(HAVE_EXPAT) || defined(HAVE_XMLPARSE) export_xml(); export_gnucash(); #endif @@ -6,6 +6,10 @@ import os libs = ["ledger", "boost_python", "gmp", "pcre"] +if os.environ.has_key ("HAVE_EXPAT") and\ + os.environ["HAVE_EXPAT"] == "true": + libs.extend (["expat"]) + if os.environ.has_key ("HAVE_XMLPARSE") and\ os.environ["HAVE_XMLPARSE"] == "true": libs.extend (["xmlparse", "xmltok"]) @@ -400,7 +400,7 @@ bool textual_parser_t::test(std::istream& in) const in.read(buf, 5); if (std::strncmp(buf, "<?xml", 5) == 0) { -#ifdef HAVE_XMLPARSE +#if defined(HAVE_EXPAT) || defined(HAVE_XMLPARSE) throw parse_error(path, linenum, "Ledger file contains XML data, but format was not recognized"); #else throw parse_error(path, linenum, "Ledger file contains XML data, but no XML support present"); @@ -8,7 +8,13 @@ #include <cstring> extern "C" { -#include <xmlparse.h> // expat XML parser +#if defined(HAVE_EXPAT) +#include <expat.h> // expat XML parser +#elif defined(HAVE_XMLPARSE) +#include <xmlparse.h> // expat XML parser +#else +#error "No XML parser library defined." +#endif } namespace ledger { |