From: Bruno Haible Date: Fri, 15 Feb 2019 20:40:56 +0000 (+0100) Subject: libtextstyle: Don't use an external libglib. X-Git-Tag: v0.20~152 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dc1ee480094149ab2a89198c87e25adc1820cc9c;p=thirdparty%2Fgettext.git libtextstyle: Don't use an external libglib. * gnulib-local/m4/libglib.m4 (gl_LIBGLIB): Accept an optional FORCE-INCLUDED argument. * libtextstyle/gnulib-local/modules/libglib.diff: New file. --- diff --git a/gnulib-local/m4/libglib.m4 b/gnulib-local/m4/libglib.m4 index fe533cb92..bef6fa31d 100644 --- a/gnulib-local/m4/libglib.m4 +++ b/gnulib-local/m4/libglib.m4 @@ -1,53 +1,48 @@ -# libglib.m4 serial 3 (gettext-0.17) -dnl Copyright (C) 2006-2007 Free Software Foundation, Inc. +# libglib.m4 serial 4 +dnl Copyright (C) 2006-2007, 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_LIBGLIB +dnl gives the user the option to decide whether to use the included or +dnl an external libglib. +dnl gl_LIBGLIB(FORCE-INCLUDED) +dnl forces the use of the included or an external libglib. AC_DEFUN([gl_LIBGLIB], [ - AC_MSG_CHECKING([whether included glib is requested]) - AC_ARG_WITH([included-glib], - [ --with-included-glib use the glib2 included here], - [gl_cv_libglib_force_included=$withval], - [gl_cv_libglib_force_included=no]) - AC_MSG_RESULT([$gl_cv_libglib_force_included]) + ifelse([$1], , [ + AC_MSG_CHECKING([whether included glib is requested]) + AC_ARG_WITH([included-glib], + [ --with-included-glib use the glib2 included here], + [gl_cv_libglib_force_included=$withval], + [gl_cv_libglib_force_included=no]) + AC_MSG_RESULT([$gl_cv_libglib_force_included]) + ], [gl_cv_libglib_force_included=$1]) gl_cv_libglib_use_included="$gl_cv_libglib_force_included" LIBGLIB= LTLIBGLIB= INCGLIB= - if test "$gl_cv_libglib_use_included" != yes; then - dnl Figure out whether we can use a preinstalled libglib-2.0, or have to use - dnl the included one. - AC_CACHE_VAL([gl_cv_libglib], [ - gl_cv_libglib=no - gl_cv_LIBGLIB= - gl_cv_LTLIBGLIB= - gl_cv_INCGLIB= - gl_save_LIBS="$LIBS" - dnl Search for libglib2 and define LIBGLIB_2_0, LTLIBGLIB_2_0 and - dnl INCGLIB_2_0 accordingly. - dnl Don't use glib-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. - AC_LIB_LINKFLAGS_BODY([glib-2.0]) - LIBS="$gl_save_LIBS $LIBGLIB_2_0" - AC_TRY_LINK([#include -#ifndef G_BEGIN_DECLS -error this glib.h includes a glibconfig.h from a glib version 1.x -#endif -], - [g_string_new ("foo");], - [gl_cv_libglib=yes - gl_cv_LIBGLIB="$LIBGLIB_2_0" - gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0" - ]) - if test "$gl_cv_libglib" != yes; then - gl_save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $INCGLIB_2_0" + ifelse([$1], [yes], , [ + if test "$gl_cv_libglib_use_included" != yes; then + dnl Figure out whether we can use a preinstalled libglib-2.0, or have to use + dnl the included one. + AC_CACHE_VAL([gl_cv_libglib], [ + gl_cv_libglib=no + gl_cv_LIBGLIB= + gl_cv_LTLIBGLIB= + gl_cv_INCGLIB= + gl_save_LIBS="$LIBS" + dnl Search for libglib2 and define LIBGLIB_2_0, LTLIBGLIB_2_0 and + dnl INCGLIB_2_0 accordingly. + dnl Don't use glib-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. + AC_LIB_LINKFLAGS_BODY([glib-2.0]) + LIBS="$gl_save_LIBS $LIBGLIB_2_0" AC_TRY_LINK([#include #ifndef G_BEGIN_DECLS error this glib.h includes a glibconfig.h from a glib version 1.x @@ -57,40 +52,54 @@ error this glib.h includes a glibconfig.h from a glib version 1.x [gl_cv_libglib=yes gl_cv_LIBGLIB="$LIBGLIB_2_0" gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0" - gl_cv_INCGLIB="$INCGLIB_2_0" ]) if test "$gl_cv_libglib" != yes; then - dnl Often the include files are installed in /usr/include/glib-2.0 - dnl and /usr/lib/glib-2.0/include. - if test -n "$LIBGLIB_2_0_PREFIX"; then - CPPFLAGS="$gl_save_CPPFLAGS -I$LIBGLIB_2_0_PREFIX/include/glib-2.0 -I$LIBGLIB_2_0_PREFIX/$acl_libdirstem/glib-2.0/include" - AC_TRY_LINK([#include + gl_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $INCGLIB_2_0" + AC_TRY_LINK([#include #ifndef G_BEGIN_DECLS error this glib.h includes a glibconfig.h from a glib version 1.x #endif ], - [g_string_new ("foo");], - [gl_cv_libglib=yes - gl_cv_LIBGLIB="$LIBGLIB_2_0" - gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0" - gl_cv_INCGLIB="-I$LIBGLIB_2_0_PREFIX/include/glib-2.0 -I$LIBGLIB_2_0_PREFIX/$acl_libdirstem/glib-2.0/include" - ]) + [g_string_new ("foo");], + [gl_cv_libglib=yes + gl_cv_LIBGLIB="$LIBGLIB_2_0" + gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0" + gl_cv_INCGLIB="$INCGLIB_2_0" + ]) + if test "$gl_cv_libglib" != yes; then + dnl Often the include files are installed in /usr/include/glib-2.0 + dnl and /usr/lib/glib-2.0/include. + if test -n "$LIBGLIB_2_0_PREFIX"; then + CPPFLAGS="$gl_save_CPPFLAGS -I$LIBGLIB_2_0_PREFIX/include/glib-2.0 -I$LIBGLIB_2_0_PREFIX/$acl_libdirstem/glib-2.0/include" + AC_TRY_LINK([#include +#ifndef G_BEGIN_DECLS +error this glib.h includes a glibconfig.h from a glib version 1.x +#endif +], + [g_string_new ("foo");], + [gl_cv_libglib=yes + gl_cv_LIBGLIB="$LIBGLIB_2_0" + gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0" + gl_cv_INCGLIB="-I$LIBGLIB_2_0_PREFIX/include/glib-2.0 -I$LIBGLIB_2_0_PREFIX/$acl_libdirstem/glib-2.0/include" + ]) + fi fi + CPPFLAGS="$gl_save_CPPFLAGS" fi - CPPFLAGS="$gl_save_CPPFLAGS" + LIBS="$gl_save_LIBS" + ]) + AC_MSG_CHECKING([for glib]) + AC_MSG_RESULT([$gl_cv_libglib]) + if test $gl_cv_libglib = yes; then + LIBGLIB="$gl_cv_LIBGLIB" + LTLIBGLIB="$gl_cv_LTLIBGLIB" + INCGLIB="$gl_cv_INCGLIB" + else + gl_cv_libglib_use_included=yes fi - LIBS="$gl_save_LIBS" - ]) - AC_MSG_CHECKING([for glib]) - AC_MSG_RESULT([$gl_cv_libglib]) - if test $gl_cv_libglib = yes; then - LIBGLIB="$gl_cv_LIBGLIB" - LTLIBGLIB="$gl_cv_LTLIBGLIB" - INCGLIB="$gl_cv_INCGLIB" - else - gl_cv_libglib_use_included=yes fi - fi + ]) AC_SUBST([LIBGLIB]) AC_SUBST([LTLIBGLIB]) AC_SUBST([INCGLIB]) diff --git a/libtextstyle/gnulib-local/modules/libglib.diff b/libtextstyle/gnulib-local/modules/libglib.diff new file mode 100644 index 000000000..b13b2e828 --- /dev/null +++ b/libtextstyle/gnulib-local/modules/libglib.diff @@ -0,0 +1,19 @@ +--- libglib.orig 2019-02-08 20:25:17.922495262 +0100 ++++ libglib 2019-02-15 00:54:59.402112246 +0100 +@@ -26,7 +26,15 @@ + no-c++ + + configure.ac: +-gl_LIBGLIB ++# In libtextstyle, we don't want to use an external libglib, because its ++# 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', ++# 'readelf -d ... | grep NEEDED', and 'nm --dynamic ...': ++# - libglib-2.0.so has more than 300 relocations and depends on libpcre. ++# - But libtextstyle needs only less than 10% of libglib: out of the more ++# than 1600 exported symbols, libtextstyle needs less than 160. ++# So, force the use of the included libglib part. ++gl_LIBGLIB([yes]) + + Makefile.am: + if INCLUDED_LIBGLIB