Add a configure test for xmlReadMemory.

This commit is contained in:
Mike McCormack 2005-08-12 10:35:17 +00:00 committed by Alexandre Julliard
parent 56171eea2d
commit 70adb8f565
4 changed files with 95 additions and 5 deletions

72
configure vendored
View File

@ -8818,6 +8818,78 @@ _ACEOF
XML2INCL="$ac_xml_cflags"
fi
echo "$as_me:$LINENO: checking for xmlReadMemory in -lxml2" >&5
echo $ECHO_N "checking for xmlReadMemory in -lxml2... $ECHO_C" >&6
if test "${ac_cv_lib_xml2_xmlReadMemory+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lxml2 $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 gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char xmlReadMemory ();
int
main ()
{
xmlReadMemory ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&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'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_xml2_xmlReadMemory=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_xml2_xmlReadMemory=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_xml2_xmlReadMemory" >&5
echo "${ECHO_T}$ac_cv_lib_xml2_xmlReadMemory" >&6
if test $ac_cv_lib_xml2_xmlReadMemory = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_XMLREADMEMORY 1
_ACEOF
fi
fi
done

View File

@ -451,7 +451,10 @@ then
[AC_CHECK_LIB(xml2, xmlParseMemory,
[AC_DEFINE(HAVE_LIBXML2, 1, [Define if you have the libxml2 library])
XML2LIBS="$ac_xml_libs"
XML2INCL="$ac_xml_cflags"],,$ac_xml_libs)])
XML2INCL="$ac_xml_cflags"],,$ac_xml_libs)
AC_CHECK_LIB(xml2, xmlReadMemory,
[AC_DEFINE(HAVE_XMLREADMEMORY,1,[Define if libxml2 has the xmlReadMemory function])])
])
CPPFLAGS="$ac_save_CPPFLAGS"
fi

View File

@ -651,6 +651,20 @@ static HRESULT WINAPI domdoc_nodeFromID(
return E_NOTIMPL;
}
static xmlDocPtr doparse( char *ptr, int len )
{
#ifdef HAVE_XMLREADMEMORY
/*
* use xmlReadMemory if possible so we can supress
* writing errors to stderr
*/
return xmlReadMemory( ptr, len, NULL, NULL,
XML_PARSE_NOERROR | XML_PARSE_NOWARNING );
#else
return xmlParseMemory( ptr, len );
#endif
}
static xmlDocPtr doread( LPWSTR filename )
{
HANDLE handle, mapping;
@ -674,8 +688,7 @@ static xmlDocPtr doread( LPWSTR filename )
ptr = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, len );
if ( ptr )
{
xmldoc = xmlReadMemory( ptr, len, NULL, NULL,
XML_PARSE_NOERROR | XML_PARSE_NOWARNING );
xmldoc = doparse( ptr, len );
UnmapViewOfFile( ptr );
}
CloseHandle( mapping );
@ -832,8 +845,7 @@ static HRESULT WINAPI domdoc_loadXML(
if ( !bstr_to_utf8( bstrXML, &str, &len ) )
return S_FALSE;
xmldoc = xmlReadMemory( str, len, NULL, NULL,
XML_PARSE_NOERROR | XML_PARSE_NOWARNING );
xmldoc = doparse( str, len );
HeapFree( GetProcessHeap(), 0, str );
This->node = create_domdoc_node( xmldoc );

View File

@ -812,6 +812,9 @@
/* Define if you have the XKB extension */
#undef HAVE_XKB
/* Define if libxml2 has the xmlReadMemory function */
#undef HAVE_XMLREADMEMORY
/* Define if Xrender has the XRenderSetPictureTransform function */
#undef HAVE_XRENDERSETPICTURETRANSFORM