From: Bruno Haible Date: Fri, 15 Feb 2019 20:40:51 +0000 (+0100) Subject: libtextstyle: Don't use an external libxml. X-Git-Tag: v0.20~153 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=87927a4e2e1c57ae52af5f52bdefd306a1181d22;p=thirdparty%2Fgettext.git libtextstyle: Don't use an external libxml. * gnulib-local/m4/libxml.m4 (gl_LIBXML): Accept an optional FORCE-INCLUDED argument. * libtextstyle/gnulib-local/modules/libxml.diff: New file. --- diff --git a/gnulib-local/m4/libxml.m4 b/gnulib-local/m4/libxml.m4 index be8253efa..34ee6ab15 100644 --- a/gnulib-local/m4/libxml.m4 +++ b/gnulib-local/m4/libxml.m4 @@ -1,62 +1,55 @@ -# libxml.m4 serial 6 (gettext-0.18.2) -dnl Copyright (C) 2006, 2008, 2011, 2013, 2016 Free Software Foundation, Inc. +# libxml.m4 serial 7 +dnl Copyright (C) 2006, 2008, 2011, 2013, 2016, 2019 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl From Bruno Haible. +dnl gl_LIBXML +dnl gives the user the option to decide whether to use the included or +dnl an external libxml. +dnl gl_LIBXML(FORCE-INCLUDED) +dnl forces the use of the included or an external libxml. AC_DEFUN([gl_LIBXML], [ AC_REQUIRE([AM_ICONV_LINK]) - AC_MSG_CHECKING([whether included libxml is requested]) - AC_ARG_WITH([included-libxml], - [ --with-included-libxml use the libxml2 included here], - [gl_cv_libxml_force_included=$withval], - [gl_cv_libxml_force_included=no]) - AC_MSG_RESULT([$gl_cv_libxml_force_included]) + ifelse([$1], , [ + AC_MSG_CHECKING([whether included libxml is requested]) + AC_ARG_WITH([included-libxml], + [ --with-included-libxml use the libxml2 included here], + [gl_cv_libxml_force_included=$withval], + [gl_cv_libxml_force_included=no]) + AC_MSG_RESULT([$gl_cv_libxml_force_included]) + ], [gl_cv_libxml_force_included=$1]) gl_cv_libxml_use_included="$gl_cv_libxml_force_included" LIBXML= LTLIBXML= INCXML= - if test "$gl_cv_libxml_use_included" != yes; then - dnl Figure out whether we can use a preinstalled libxml2, or have to use - dnl the included one. - AC_CACHE_VAL([gl_cv_libxml], [ - gl_cv_libxml=no - gl_cv_LIBXML= - gl_cv_LTLIBXML= - gl_cv_INCXML= - gl_save_LIBS="$LIBS" - LIBS="$LIBS $LIBICONV" - dnl Search for libxml2 and define LIBXML2, LTLIBXML2 and INCXML2 - dnl accordingly. - dnl Don't use xml2-config nor pkg-config, since it doesn't work when - dnl cross-compiling or when the C compiler in use is different from the - dnl one that built the library. - dnl Use a test program that tries to invoke xmlFree. On Cygwin 1.7.x, - dnl libxml2 is built in such a way that uses of xmlFree work fine with - dnl -Wl,--enable-auto-import but lead to a link error with - dnl -Wl,--disable-auto-import. - AC_LIB_LINKFLAGS_BODY([xml2]) - LIBS="$gl_save_LIBS $LIBXML2 $LIBICONV" - AC_TRY_LINK([#include - #include - #include - ], - [xmlCheckVersion (0); - xmlFree ((void *) 0); - xmlXPathSetContextNode ((void *)0, (void *)0); - ], - [gl_cv_libxml=yes - gl_cv_LIBXML="$LIBXML2 $LIBICONV" - gl_cv_LTLIBXML="$LTLIBXML2 $LTLIBICONV" - ]) - if test "$gl_cv_libxml" != yes; then - gl_save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $INCXML2" + ifelse([$1], [yes], , [ + if test "$gl_cv_libxml_use_included" != yes; then + dnl Figure out whether we can use a preinstalled libxml2, or have to use + dnl the included one. + AC_CACHE_VAL([gl_cv_libxml], [ + gl_cv_libxml=no + gl_cv_LIBXML= + gl_cv_LTLIBXML= + gl_cv_INCXML= + gl_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + dnl Search for libxml2 and define LIBXML2, LTLIBXML2 and INCXML2 + dnl accordingly. + dnl Don't use xml2-config nor pkg-config, since it doesn't work when + dnl cross-compiling or when the C compiler in use is different from the + dnl one that built the library. + dnl Use a test program that tries to invoke xmlFree. On Cygwin 1.7.x, + dnl libxml2 is built in such a way that uses of xmlFree work fine with + dnl -Wl,--enable-auto-import but lead to a link error with + dnl -Wl,--disable-auto-import. + AC_LIB_LINKFLAGS_BODY([xml2]) + LIBS="$gl_save_LIBS $LIBXML2 $LIBICONV" AC_TRY_LINK([#include #include #include @@ -68,55 +61,71 @@ AC_DEFUN([gl_LIBXML], [gl_cv_libxml=yes gl_cv_LIBXML="$LIBXML2 $LIBICONV" gl_cv_LTLIBXML="$LTLIBXML2 $LTLIBICONV" - gl_cv_INCXML="$INCXML2" ]) if test "$gl_cv_libxml" != yes; then - dnl Often the include files are installed in /usr/include/libxml2. - dnl In libxml2-2.5, is self-contained. - dnl In libxml2-2.6, it includes which is - dnl self-contained. - libxml2_include_dir= - AC_TRY_CPP([#include ], - [gl_ABSOLUTE_HEADER([libxml2/libxml/xmlexports.h]) - libxml2_include_dir=`echo "$gl_cv_absolute_libxml2_libxml_xmlexports_h" | sed -e 's,.libxml.xmlexports\.h$,,'` + gl_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $INCXML2" + AC_TRY_LINK([#include + #include + #include + ], + [xmlCheckVersion (0); + xmlFree ((void *) 0); + xmlXPathSetContextNode ((void *)0, (void *)0); + ], + [gl_cv_libxml=yes + gl_cv_LIBXML="$LIBXML2 $LIBICONV" + gl_cv_LTLIBXML="$LTLIBXML2 $LTLIBICONV" + gl_cv_INCXML="$INCXML2" ]) - if test -z "$libxml2_include_dir"; then - AC_TRY_CPP([#include ], - [gl_ABSOLUTE_HEADER([libxml2/libxml/xmlversion.h]) - libxml2_include_dir=`echo "$gl_cv_absolute_libxml2_libxml_xmlversion_h" | sed -e 's,.libxml.xmlversion\.h$,,'` - ]) - fi - if test -n "$libxml2_include_dir" && test -d "$libxml2_include_dir"; then - CPPFLAGS="$gl_save_CPPFLAGS -I$libxml2_include_dir" - AC_TRY_LINK([#include - #include - #include - ], - [xmlCheckVersion (0); - xmlFree ((void *) 0); - xmlXPathSetContextNode ((void *)0, (void *)0); - ], - [gl_cv_libxml=yes - gl_cv_LIBXML="$LIBXML2 $LIBICONV" - gl_cv_LTLIBXML="$LTLIBXML2 $LTLIBICONV" - gl_cv_INCXML="-I$libxml2_include_dir" + if test "$gl_cv_libxml" != yes; then + dnl Often the include files are installed in /usr/include/libxml2. + dnl In libxml2-2.5, is self-contained. + dnl In libxml2-2.6, it includes which is + dnl self-contained. + libxml2_include_dir= + AC_TRY_CPP([#include ], + [gl_ABSOLUTE_HEADER([libxml2/libxml/xmlexports.h]) + libxml2_include_dir=`echo "$gl_cv_absolute_libxml2_libxml_xmlexports_h" | sed -e 's,.libxml.xmlexports\.h$,,'` ]) + if test -z "$libxml2_include_dir"; then + AC_TRY_CPP([#include ], + [gl_ABSOLUTE_HEADER([libxml2/libxml/xmlversion.h]) + libxml2_include_dir=`echo "$gl_cv_absolute_libxml2_libxml_xmlversion_h" | sed -e 's,.libxml.xmlversion\.h$,,'` + ]) + fi + if test -n "$libxml2_include_dir" && test -d "$libxml2_include_dir"; then + CPPFLAGS="$gl_save_CPPFLAGS -I$libxml2_include_dir" + AC_TRY_LINK([#include + #include + #include + ], + [xmlCheckVersion (0); + xmlFree ((void *) 0); + xmlXPathSetContextNode ((void *)0, (void *)0); + ], + [gl_cv_libxml=yes + gl_cv_LIBXML="$LIBXML2 $LIBICONV" + gl_cv_LTLIBXML="$LTLIBXML2 $LTLIBICONV" + gl_cv_INCXML="-I$libxml2_include_dir" + ]) + fi fi + CPPFLAGS="$gl_save_CPPFLAGS" fi - CPPFLAGS="$gl_save_CPPFLAGS" + LIBS="$gl_save_LIBS" + ]) + AC_MSG_CHECKING([for libxml]) + AC_MSG_RESULT([$gl_cv_libxml]) + if test $gl_cv_libxml = yes; then + LIBXML="$gl_cv_LIBXML" + LTLIBXML="$gl_cv_LTLIBXML" + INCXML="$gl_cv_INCXML" + else + gl_cv_libxml_use_included=yes fi - LIBS="$gl_save_LIBS" - ]) - AC_MSG_CHECKING([for libxml]) - AC_MSG_RESULT([$gl_cv_libxml]) - if test $gl_cv_libxml = yes; then - LIBXML="$gl_cv_LIBXML" - LTLIBXML="$gl_cv_LTLIBXML" - INCXML="$gl_cv_INCXML" - else - gl_cv_libxml_use_included=yes fi - fi + ]) AC_SUBST([LIBXML]) AC_SUBST([LTLIBXML]) AC_SUBST([INCXML]) diff --git a/libtextstyle/gnulib-local/modules/libxml.diff b/libtextstyle/gnulib-local/modules/libxml.diff new file mode 100644 index 000000000..d5c7bd4ff --- /dev/null +++ b/libtextstyle/gnulib-local/modules/libxml.diff @@ -0,0 +1,28 @@ +*** libxml.orig 2018-10-28 14:37:07.007164889 +0100 +--- libxml 2019-02-14 22:19:29.994771110 +0100 +*************** +*** 118,124 **** + fabs + + configure.ac: +! gl_LIBXML + + Makefile.am: + if INCLUDED_LIBXML +--- 118,133 ---- + fabs + + configure.ac: +! # In libtextstyle, we don't want to use an external libxml, because its +! # dependencies and their dynamic relocations have an impact on the startup +! # time of a program that is linked with it. As you can see by using +! # 'readelf -r ... | wc -l' and 'readelf -d ... | grep NEEDED': +! # - libxml2.so has more than 3300 relocations and depends on libicuuc. +! # - libicuuc.so has more than 4900 relocations and depends on libstdc++. +! # - libstdc++.so has more than 4600 relocations. +! # These are more than 12800 relocations, to perform at program startup. +! # So, force the use of the included libxml part. +! gl_LIBXML([yes]) + + Makefile.am: + if INCLUDED_LIBXML