Detect and use xsltCleanupGlobals when available

This introduces usage of an additional libxslt cleanup function,
xsltCleanupGlobals, when the configure script detects that it is
available. Early versions of the library did not include this function.

(closes issue ASTERISK-22570)
Reported by: Corey Farrell
Patches:
    xsltCleanupGlobals.patch uploaded by Corey Farrell (License 5909)
........

Merged revisions 400384 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400385 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kinsey Moore 2013-10-03 18:00:15 +00:00
parent e3d69a5628
commit 3578bc30fd
4 changed files with 129 additions and 1 deletions

122
configure vendored
View File

@ -1,5 +1,5 @@
#! /bin/sh
# From configure.ac Revision: 400078 .
# From configure.ac Revision: 400186 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for asterisk trunk.
#
@ -967,6 +967,10 @@ PBX_LTDL
LTDL_DIR
LTDL_INCLUDE
LTDL_LIB
PBX_LIBXSLT_CLEANUP
LIBXSLT_CLEANUP_DIR
LIBXSLT_CLEANUP_INCLUDE
LIBXSLT_CLEANUP_LIB
PBX_LIBXSLT
LIBXSLT_DIR
LIBXSLT_INCLUDE
@ -9591,6 +9595,18 @@ fi
LIBXSLT_CLEANUP_DESCRIP="LibXSLT Library Cleanup Function"
LIBXSLT_CLEANUP_OPTION=libxslt
LIBXSLT_CLEANUP_DIR=${LIBXSLT_DIR}
PBX_LIBXSLT_CLEANUP=0
LTDL_DESCRIP="libtool"
LTDL_OPTION="ltdl"
PBX_LTDL=0
@ -12972,6 +12988,110 @@ fi
if test "x${PBX_LIBXSLT_CLEANUP}" != "x1" -a "${USE_LIBXSLT_CLEANUP}" != "no"; then
pbxlibdir=""
# if --with-LIBXSLT_CLEANUP=DIR has been specified, use it.
if test "x${LIBXSLT_CLEANUP_DIR}" != "x"; then
if test -d ${LIBXSLT_CLEANUP_DIR}/lib; then
pbxlibdir="-L${LIBXSLT_CLEANUP_DIR}/lib"
else
pbxlibdir="-L${LIBXSLT_CLEANUP_DIR}"
fi
fi
pbxfuncname="xsltCleanupGlobals"
if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers
AST_LIBXSLT_CLEANUP_FOUND=yes
else
ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
CFLAGS="${CFLAGS} ${LIBXML2_INCLUDE}"
as_ac_Lib=`$as_echo "ac_cv_lib_xslt_${pbxfuncname}" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lxslt" >&5
$as_echo_n "checking for ${pbxfuncname} in -lxslt... " >&6; }
if eval \${$as_ac_Lib+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lxslt ${pbxlibdir} ${LIBXML2_LIB} $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* 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 ${pbxfuncname} ();
int
main ()
{
return ${pbxfuncname} ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
eval "$as_ac_Lib=yes"
else
eval "$as_ac_Lib=no"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
eval ac_res=\$$as_ac_Lib
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
AST_LIBXSLT_CLEANUP_FOUND=yes
else
AST_LIBXSLT_CLEANUP_FOUND=no
fi
CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
fi
# now check for the header.
if test "${AST_LIBXSLT_CLEANUP_FOUND}" = "yes"; then
LIBXSLT_CLEANUP_LIB="${pbxlibdir} -lxslt ${LIBXML2_LIB}"
# if --with-LIBXSLT_CLEANUP=DIR has been specified, use it.
if test "x${LIBXSLT_CLEANUP_DIR}" != "x"; then
LIBXSLT_CLEANUP_INCLUDE="-I${LIBXSLT_CLEANUP_DIR}/include"
fi
LIBXSLT_CLEANUP_INCLUDE="${LIBXSLT_CLEANUP_INCLUDE} ${LIBXML2_INCLUDE}"
if test "xlibxslt/xsltInternals.h" = "x" ; then # no header, assume found
LIBXSLT_CLEANUP_HEADER_FOUND="1"
else # check for the header
ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${LIBXSLT_CLEANUP_INCLUDE}"
ac_fn_c_check_header_mongrel "$LINENO" "libxslt/xsltInternals.h" "ac_cv_header_libxslt_xsltInternals_h" "$ac_includes_default"
if test "x$ac_cv_header_libxslt_xsltInternals_h" = xyes; then :
LIBXSLT_CLEANUP_HEADER_FOUND=1
else
LIBXSLT_CLEANUP_HEADER_FOUND=0
fi
CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
fi
if test "x${LIBXSLT_CLEANUP_HEADER_FOUND}" = "x0" ; then
LIBXSLT_CLEANUP_LIB=""
LIBXSLT_CLEANUP_INCLUDE=""
else
if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library
LIBXSLT_CLEANUP_LIB=""
fi
PBX_LIBXSLT_CLEANUP=1
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBXSLT_CLEANUP 1
_ACEOF
fi
fi
fi
fi
# some embedded systems omit internationalization (locale) support

View File

@ -415,6 +415,7 @@ AST_LIBCURL_CHECK_CONFIG([], [7.10.1])
AST_EXT_LIB_SETUP([LIBEDIT], [NetBSD Editline library], [libedit], [, use 'internal' Editline otherwise])
AST_EXT_LIB_SETUP([LIBXML2], [LibXML2], [libxml2])
AST_EXT_LIB_SETUP([LIBXSLT], [LibXSLT], [libxslt])
AST_EXT_LIB_SETUP_OPTIONAL([LIBXSLT_CLEANUP], [LibXSLT Library Cleanup Function], [LIBXSLT], [libxslt])
AST_EXT_LIB_SETUP([LTDL], [libtool], [ltdl])
AST_EXT_LIB_SETUP([LUA], [Lua], [lua])
AST_EXT_LIB_SETUP([MISDN], [mISDN user], [misdn])
@ -570,6 +571,7 @@ if test "${disable_xmldoc}" != "yes"; then
fi
AST_EXT_LIB_CHECK([LIBXSLT], [xslt], [xsltLoadStylesheetPI], [libxslt/xsltInternals.h], [${LIBXML2_LIB}], [${LIBXML2_INCLUDE}])
AST_EXT_LIB_CHECK([LIBXSLT_CLEANUP], [xslt], [xsltCleanupGlobals], [libxslt/xsltInternals.h], [${LIBXML2_LIB}], [${LIBXML2_INCLUDE}])
fi

View File

@ -400,6 +400,9 @@
/* Define to 1 if you have the LibXSLT library. */
#undef HAVE_LIBXSLT
/* Define to 1 if LIBXSLT has the LibXSLT Library Cleanup Function feature. */
#undef HAVE_LIBXSLT_CLEANUP
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H

View File

@ -55,6 +55,9 @@ int ast_xml_init(void)
int ast_xml_finish(void)
{
xmlCleanupParser();
#ifdef HAVE_LIBXSLT_CLEANUP
xsltCleanupGlobals();
#endif
return 0;
}