From 6a530aba76d4a47f8f5808a85ceed7c16d1b30cb Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 29 Nov 2006 15:59:03 -0800 Subject: [PATCH] msxml3: Fix compiles for systems with libxml2 version 2.6.14 and below. --- configure | 85 ++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 2 ++ dlls/msxml3/domdoc.c | 5 +++ include/config.h.in | 3 ++ 4 files changed, 95 insertions(+) diff --git a/configure b/configure index fa9389b1bc7..7f1e5888d22 100755 --- a/configure +++ b/configure @@ -10387,6 +10387,91 @@ cat >>confdefs.h <<\_ACEOF #define HAVE_XMLREADMEMORY 1 _ACEOF +fi + + { echo "$as_me:$LINENO: checking for xmlNewDocPI in -lxml2" >&5 +echo $ECHO_N "checking for xmlNewDocPI in -lxml2... $ECHO_C" >&6; } +if test "${ac_cv_lib_xml2_xmlNewDocPI+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lxml2 $ac_xml_libs $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char xmlNewDocPI (); +int +main () +{ +return xmlNewDocPI (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_xml2_xmlNewDocPI=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_xml2_xmlNewDocPI=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_xml2_xmlNewDocPI" >&5 +echo "${ECHO_T}$ac_cv_lib_xml2_xmlNewDocPI" >&6; } +if test $ac_cv_lib_xml2_xmlNewDocPI = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_XMLNEWDOCPI 1 +_ACEOF + fi diff --git a/configure.ac b/configure.ac index ab3556b81a6..097c72d3099 100644 --- a/configure.ac +++ b/configure.ac @@ -486,6 +486,8 @@ then XML2INCL="$ac_xml_cflags"],,$ac_xml_libs) AC_CHECK_LIB(xml2, xmlReadMemory, [AC_DEFINE(HAVE_XMLREADMEMORY,1,[Define if libxml2 has the xmlReadMemory function])],,$ac_xml_libs) + AC_CHECK_LIB(xml2, xmlNewDocPI, + [AC_DEFINE(HAVE_XMLNEWDOCPI,1,[Define if libxml2 has the xmlNewDocPI function])],,$ac_xml_libs) ]) CPPFLAGS="$ac_save_CPPFLAGS" ac_xslt_libs="`$PKG_CONFIG --libs libxslt 2>/dev/null`" diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c index 459e23473c6..c2fa232405e 100644 --- a/dlls/msxml3/domdoc.c +++ b/dlls/msxml3/domdoc.c @@ -761,6 +761,7 @@ static HRESULT WINAPI domdoc_createProcessingInstruction( BSTR data, IXMLDOMProcessingInstruction** pi ) { +#ifdef HAVE_XMLNEWDOCPI xmlNodePtr xmlnode; domdoc *This = impl_from_IXMLDOMDocument( iface ); xmlChar *xml_target, *xml_content; @@ -778,6 +779,10 @@ static HRESULT WINAPI domdoc_createProcessingInstruction( HeapFree(GetProcessHeap(), 0, xml_target); return S_OK; +#else + FIXME("Libxml 2.6.15 or greater required."); + return E_NOTIMPL; +#endif } diff --git a/include/config.h.in b/include/config.h.in index 69a0af923a1..24052dcd373 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -936,6 +936,9 @@ /* Define if you have the XKB extension */ #undef HAVE_XKB +/* Define if libxml2 has the xmlNewDocPI function */ +#undef HAVE_XMLNEWDOCPI + /* Define if libxml2 has the xmlReadMemory function */ #undef HAVE_XMLREADMEMORY