diff options
author | Wu, Yong <yong.wu@intel.com> | 2009-06-19 14:43:09 +0800 |
---|---|---|
committer | Wu, Yong <yong.wu@intel.com> | 2009-06-19 14:43:09 +0800 |
commit | 13ef63d15dccb8075e5d1ce06a6c058b63489413 (patch) | |
tree | 07214760d9ddbb38521baeba72b89b661f1363d8 | |
parent | c0b9889852b22d7cab1ebdb6bb26736e2fd746ac (diff) |
Bug 3312. add expat support. Synthesis can work in 3 modes: a) system
expat, b) system xmltok, c) builtin xmltok. The original configuration
works with either system xmltok or builtin xmltok. We added the expat
support and made expat as the default xml parser.
-rw-r--r-- | configure.in | 69 | ||||
-rwxr-xr-x | src/sysync/syncappbase.h | 6 |
2 files changed, 62 insertions, 13 deletions
diff --git a/configure.in b/configure.in index 299a91c..cf9fe6c 100644 --- a/configure.in +++ b/configure.in @@ -17,7 +17,8 @@ dnl separately. TODO: build bundled sources? PKG_CHECK_MODULES(PCRE, libpcre) PKG_CHECK_MODULES(SQLITE3, sqlite3) AC_CHECK_HEADER(zlib.h, , [AC_ERROR(zlib.h not found.)]) -AC_CHECK_HEADER(xmltok/xmlparse.h, have_xmltok="yes") +AC_CHECK_HEADER(xmltok/xmlparse.h, have_system_xmltok="yes") +AC_CHECK_HEADER(expat.h, have_system_expat="yes") dnl libical might be installed stand-alone (upstream) dnl or bundled with libecal. Upstream is preferred and @@ -37,22 +38,64 @@ AC_ARG_WITH(xmltok, "system" = use header files and libxmlparse from standard search paths. "path" = use header files in "path/include" and libxmlparse in "path/lib". Default is system if header files are found, otherwise builtin.]), - [ if test "$withval" = "builtin"; then xmltok_builtin="yes" - elif test "$withval" = "system"; then - if test "$have_xmltok" = "yes"; then XMLPARSE_LIBS="-lxmlparse" - else AC_ERROR(xmltok/xmplarse.h not found.) - fi - else - XMLPARSE_LIBS="-L$withval/lib -lxmlparse" - XMLPARSE_CFLAGS="-I$withval/include" + [ if test "$withval" = "builtin"; then with_xmltok="builtin" + elif test "$withval" = "system" || test "$withval" = "yes"; then with_xmltok="system" + else with_xmltok="$withval" fi ], - [ if test "$have_xmltok" = "yes"; then XMLPARSE_LIBS="-lxmlparse" - else xmltok_builtin="yes" - fi ]) + [ with_xmltok="no" ]) + +AC_ARG_WITH(expat, + AS_HELP_STRING([--with-expat=<system|path>], + [Choose expat as the XML parser library. + "system" = use header files and libexpat from standard search paths. + "path" = use header files in "path/include", and libxmlparse in "path/lib". + Default is system if header files are found, otherwise builtin.]), + [ if test "$withval" = "system" || test "$withval" = "yes"; then with_expat="system" + else with_expath="$withval" + fi ], + [ with_expat="no" ]) + +if test "$with_xmltok" = "no" && test "$with_expat" = "no"; then + if test "$have_system_expat" = "yes"; then + with_expat="yes" + XMLPARSE_LIBS="-lexpat" + elif test "$have_system_xmltok" = "yes"; then + with_xmltok="yes" + XMLPARSE_LIBS="-lxmlparse" + else + with_xmltok="builtin" + fi +elif test "$with_expat" != "no"; then + if test "$with_expat" = "system"; then + if test "$have_system_expat" = "yes"; then XMLPARSE_LIBS="-lexpat" + else AC_ERROR(expat.h not found.) + fi + else # user path + XMLPARSE_LIBS="-L$with_expat/lib -lexpat" + XMLPARSE_CFLAGS="-I$with_expat/include" + fi +else # with_xmltok + if test "$with_xmltok" = "system"; then + if test "$have_system_xmltok" = "yes"; then XMLPARSE_LIBS="-lxmlparse" + else AC_ERROR(xmltok/xmplarse.h not found.) + fi + elif test "$with_xmltok" != "builtin"; then + XMLPARSE_LIBS="-L$with_xmltok/lib -lxmlparse" + XMLPARSE_CFLAGS="-I$with_xmltok/include" + fi +fi + +if test "$with_expat" = "yes"; then + AC_DEFINE(HAVE_EXPAT, 1, [Define to 1 to use expat as XML parser]) +elif test "$with_xmltok" != "builtin"; then + AC_DEFINE(HAVE_SYS_XMLTOK, 1, [Define to 1 use system xmltok as XML parser]) +else + AC_DEFINE(HAVE_BUILTIN_XMLTOK, 1, [Define to 1 use builtin xmltok as XML Parser]) +fi AC_SUBST(XMLPARSE_LIBS) AC_SUBST(XMLPARSE_CFLAGS) -AM_CONDITIONAL([COND_XMLPARSE], [test "$xmltok_builtin" = "yes"]) +AM_CONDITIONAL([COND_XMLPARSE], [test "$with_xmltok" = "builtin"]) AC_CHECK_HEADER(stdint.h) diff --git a/src/sysync/syncappbase.h b/src/sysync/syncappbase.h index 1dec9d5..a920916 100755 --- a/src/sysync/syncappbase.h +++ b/src/sysync/syncappbase.h @@ -20,7 +20,13 @@ // expat if not hardcoded config #ifndef HARDCODED_CONFIG +# if HAVE_EXPAT +#include <expat.h> +# elif HAVE_SYS_XMLTOK +#include <xmltok/xmlparse.h> +# else /* HAVE_BUILTIN_XMLTOK */ #include "xmlparse.h" +# endif #endif |