mirror of
https://github.com/aria2/aria2.git
synced 2024-11-24 02:23:38 +08:00
3ea4fe447a
Fixed possible memory leak when an exception is thrown. * src/XML2SAXMetalinkProcessor.cc Added Expat support. If both libxml2 and Expat are installed, then libxml2 is used by default. MetalinkProcessorFactory chooses from XML2SAXMetalinkProcessor and ExpatMetalinkProcessor according to the configuration. * src/ExpatMetalinkProcessor.{h, cc} * src/main.cc: Removed libxml2 specific header and init/free function. * src/MetalinkProcessorFactory.{h, cc} * src/MetalinkHelper.cc * src/Metalinker.h: Removed unnecessary libxml2 header. * src/MetalinkProcessor.h * test/XML2SAXMetalinkProcessorTest.cc: Removed because MetalinkProcessorTest is used instead. * test/MetalinkProcessorTest.cc: Added. It is actually the same with XML2SAXMetalinkProcessor, replaced XML2SAXMetalinkProcessor with MetalinkProcessorFactory::newInstance(). * m4/libexpat.m4 * configure.ac: Added configuration options for libexpat.
34 lines
901 B
Plaintext
34 lines
901 B
Plaintext
AC_DEFUN([AM_PATH_LIBEXPAT],
|
|
[
|
|
AC_ARG_WITH([libexpat-prefix],
|
|
[ --with-libexpat-prefix=PREFIX Prefix where libexpat installed (optional)],
|
|
[libexpat_prefix=$withval],
|
|
[libexpat_prefix=""])
|
|
|
|
if test "x$libexpat_prefix" = "x"; then
|
|
libexpat_prefix="/usr"
|
|
fi
|
|
|
|
libexpat_prefix_lib=$libexpat_prefix/lib
|
|
libexpat_prefix_include=$libexpat_prefix/include
|
|
|
|
LIBS_save=$LIBS
|
|
CPPFLAGS_save=$CPPFLAGS
|
|
|
|
LIBS="-L$libexpat_prefix_lib $LIBS"
|
|
CPPFLAGS="-I$libexpat_prefix_include $CPPFLAGS"
|
|
|
|
AC_CHECK_LIB([expat], [XML_ParserCreate], [have_libexpat=yes])
|
|
if test "x$have_libexpat" = "xyes"; then
|
|
AC_DEFINE([HAVE_LIBEXPAT], [1], [Define to 1 if you have libexpat.])
|
|
LIBEXPAT_LIBS="-L$libexpat_prefix_lib -lexpat"
|
|
LIBEXPAT_CPPFLAGS="-I$libexpat_prefix_include"
|
|
AC_SUBST(LIBEXPAT_LIBS)
|
|
AC_SUBST(LIBEXPAT_CPPFLAGS)
|
|
fi
|
|
|
|
LIBS=$LIBS_save
|
|
CPPFLAGS=$CPPFLAGS_save
|
|
|
|
])
|