]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
libtextstyle: Don't use an external libcroco.
authorBruno Haible <bruno@clisp.org>
Fri, 15 Feb 2019 20:40:36 +0000 (21:40 +0100)
committerBruno Haible <bruno@clisp.org>
Fri, 15 Feb 2019 20:44:08 +0000 (21:44 +0100)
* gnulib-local/m4/libcroco.m4 (gl_LIBCROCO): Accept an optional FORCE-INCLUDED
argument.
* libtextstyle/gnulib-local/modules/libcroco.diff: New file.
* libtextstyle/autogen.sh: Pass another --local-dir option to gnulib-tool.

gnulib-local/m4/libcroco.m4
libtextstyle/autogen.sh
libtextstyle/gnulib-local/modules/libcroco.diff [new file with mode: 0644]

index f4958fbc579476a11d67b30c1de7f4bc33444aa2..bc53cc6dbd053eb588357e05314b05001b5ef986 100644 (file)
@@ -1,88 +1,99 @@
-# libcroco.m4 serial 2 (gettext-0.17)
-dnl Copyright (C) 2006-2007 Free Software Foundation, Inc.
+# libcroco.m4 serial 3
+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_LIBCROCO
+dnl   gives the user the option to decide whether to use the included or
+dnl   an external libcroco.
+dnl gl_LIBCROCO(FORCE-INCLUDED)
+dnl   forces the use of the included or an external libcroco.
 AC_DEFUN([gl_LIBCROCO],
 [
-  dnl libcroco depends on libglib.
-  AC_REQUIRE([gl_LIBGLIB])
+  ifelse([$1], [yes], , [
+    dnl libcroco depends on libglib.
+    AC_REQUIRE([gl_LIBGLIB])
+  ])
 
-  AC_MSG_CHECKING([whether included libcroco is requested])
-  AC_ARG_WITH([included-libcroco],
-    [  --with-included-libcroco  use the libcroco included here],
-    [gl_cv_libcroco_force_included=$withval],
-    [gl_cv_libcroco_force_included=no])
-  AC_MSG_RESULT([$gl_cv_libcroco_force_included])
+  ifelse([$1], , [
+    AC_MSG_CHECKING([whether included libcroco is requested])
+    AC_ARG_WITH([included-libcroco],
+      [  --with-included-libcroco  use the libcroco included here],
+      [gl_cv_libcroco_force_included=$withval],
+      [gl_cv_libcroco_force_included=no])
+    AC_MSG_RESULT([$gl_cv_libcroco_force_included])
+  ], [gl_cv_libcroco_force_included=$1])
 
   gl_cv_libcroco_use_included="$gl_cv_libcroco_force_included"
   LIBCROCO=
   LTLIBCROCO=
   INCCROCO=
-  if test "$gl_cv_libcroco_use_included" != yes; then
-    dnl Figure out whether we can use a preinstalled libcroco-0.6, or have to
-    dnl use the included one.
-    AC_CACHE_VAL([gl_cv_libcroco], [
-      gl_cv_libcroco=no
-      gl_cv_LIBCROCO=
-      gl_cv_LTLIBCROCO=
-      gl_cv_INCCROCO=
-      gl_save_LIBS="$LIBS"
-      dnl Search for libcroco and define LIBCROCO_0_6, LTLIBCROCO_0_6 and
-      dnl INCCROCO_0_6 accordingly.
-      dnl Don't use croco-0.6-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([croco-0.6], [glib-2.0])
-      LIBS="$gl_save_LIBS $LIBCROCO_0_6"
-      AC_TRY_LINK([#include <libcroco-config.h>],
-        [const char *version = LIBCROCO_VERSION; return !version;],
-        [gl_cv_libcroco=yes
-         gl_cv_LIBCROCO="$LIBCROCO_0_6"
-         gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6"
-        ])
-      if test "$gl_cv_libcroco" != yes; then
-        gl_save_CPPFLAGS="$CPPFLAGS"
-        CPPFLAGS="$CPPFLAGS $INCCROCO_0_6"
+  ifelse([$1], [yes], , [
+    if test "$gl_cv_libcroco_use_included" != yes; then
+      dnl Figure out whether we can use a preinstalled libcroco-0.6, or have to
+      dnl use the included one.
+      AC_CACHE_VAL([gl_cv_libcroco], [
+        gl_cv_libcroco=no
+        gl_cv_LIBCROCO=
+        gl_cv_LTLIBCROCO=
+        gl_cv_INCCROCO=
+        gl_save_LIBS="$LIBS"
+        dnl Search for libcroco and define LIBCROCO_0_6, LTLIBCROCO_0_6 and
+        dnl INCCROCO_0_6 accordingly.
+        dnl Don't use croco-0.6-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([croco-0.6], [glib-2.0])
+        LIBS="$gl_save_LIBS $LIBCROCO_0_6"
         AC_TRY_LINK([#include <libcroco-config.h>],
           [const char *version = LIBCROCO_VERSION; return !version;],
           [gl_cv_libcroco=yes
            gl_cv_LIBCROCO="$LIBCROCO_0_6"
            gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6"
-           gl_cv_INCCROCO="$INCCROCO_0_6"
           ])
         if test "$gl_cv_libcroco" != yes; then
-          dnl Often the include files are installed in
-          dnl /usr/include/libcroco-0.6/libcroco.
-          AC_TRY_LINK([#include <libcroco-0.6/libcroco/libcroco-config.h>],
+          gl_save_CPPFLAGS="$CPPFLAGS"
+          CPPFLAGS="$CPPFLAGS $INCCROCO_0_6"
+          AC_TRY_LINK([#include <libcroco-config.h>],
             [const char *version = LIBCROCO_VERSION; return !version;],
-            [gl_ABSOLUTE_HEADER([libcroco-0.6/libcroco/libcroco-config.h])
-             libcroco_include_dir=`echo "$gl_cv_absolute_libcroco_0_6_libcroco_libcroco_config_h" | sed -e 's,.libcroco-config\.h$,,'`
-             if test -d "$libcroco_include_dir"; then
-               gl_cv_libcroco=yes
-               gl_cv_LIBCROCO="$LIBCROCO_0_6"
-               gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6"
-               gl_cv_INCCROCO="-I$libcroco_include_dir"
-             fi
+            [gl_cv_libcroco=yes
+             gl_cv_LIBCROCO="$LIBCROCO_0_6"
+             gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6"
+             gl_cv_INCCROCO="$INCCROCO_0_6"
             ])
+          if test "$gl_cv_libcroco" != yes; then
+            dnl Often the include files are installed in
+            dnl /usr/include/libcroco-0.6/libcroco.
+            AC_TRY_LINK([#include <libcroco-0.6/libcroco/libcroco-config.h>],
+              [const char *version = LIBCROCO_VERSION; return !version;],
+              [gl_ABSOLUTE_HEADER([libcroco-0.6/libcroco/libcroco-config.h])
+               libcroco_include_dir=`echo "$gl_cv_absolute_libcroco_0_6_libcroco_libcroco_config_h" | sed -e 's,.libcroco-config\.h$,,'`
+               if test -d "$libcroco_include_dir"; then
+                 gl_cv_libcroco=yes
+                 gl_cv_LIBCROCO="$LIBCROCO_0_6"
+                 gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6"
+                 gl_cv_INCCROCO="-I$libcroco_include_dir"
+               fi
+              ])
+          fi
+          CPPFLAGS="$gl_save_CPPFLAGS"
         fi
-        CPPFLAGS="$gl_save_CPPFLAGS"
+        LIBS="$gl_save_LIBS"
+      ])
+      AC_MSG_CHECKING([for libcroco])
+      AC_MSG_RESULT([$gl_cv_libcroco])
+      if test $gl_cv_libcroco = yes; then
+        LIBCROCO="$gl_cv_LIBCROCO"
+        LTLIBCROCO="$gl_cv_LTLIBCROCO"
+        INCCROCO="$gl_cv_INCCROCO"
+      else
+        gl_cv_libcroco_use_included=yes
       fi
-      LIBS="$gl_save_LIBS"
-    ])
-    AC_MSG_CHECKING([for libcroco])
-    AC_MSG_RESULT([$gl_cv_libcroco])
-    if test $gl_cv_libcroco = yes; then
-      LIBCROCO="$gl_cv_LIBCROCO"
-      LTLIBCROCO="$gl_cv_LTLIBCROCO"
-      INCCROCO="$gl_cv_INCCROCO"
-    else
-      gl_cv_libcroco_use_included=yes
     fi
-  fi
+  ])
   AC_SUBST([LIBCROCO])
   AC_SUBST([LTLIBCROCO])
   AC_SUBST([INCCROCO])
index 8f1849b147b865142aca18de5f532cf4a65ee13d..e4a86e765ab8eab0ca979f9029410e05cf01829c 100755 (executable)
@@ -88,7 +88,8 @@ if test $skip_gnulib = false; then
       xconcat-filename
     '
     $GNULIB_TOOL --lib=libtextstyle --source-base=lib --m4-base=gnulib-m4 --tests-base=tests \
-      --with-tests --makefile-name=Makefile.gnulib --libtool --local-dir=../gnulib-local \
+      --with-tests --makefile-name=Makefile.gnulib --libtool \
+      --local-dir=gnulib-local --local-dir=../gnulib-local \
       --import --avoid=hash-tests $GNULIB_MODULES
     $GNULIB_TOOL --copy-file build-aux/config.guess; chmod a+x build-aux/config.guess
     $GNULIB_TOOL --copy-file build-aux/config.sub;   chmod a+x build-aux/config.sub
diff --git a/libtextstyle/gnulib-local/modules/libcroco.diff b/libtextstyle/gnulib-local/modules/libcroco.diff
new file mode 100644 (file)
index 0000000..deea60b
--- /dev/null
@@ -0,0 +1,29 @@
+*** libcroco.orig      2019-02-14 20:54:15.681209898 +0100
+--- libcroco   2019-02-14 21:08:00.529990044 +0100
+***************
+*** 65,71 ****
+  no-c++
+  
+  configure.ac:
+! gl_LIBCROCO
+  
+  Makefile.am:
+  AM_CPPFLAGS += $(INCGLIB)
+--- 65,81 ----
+  no-c++
+  
+  configure.ac:
+! # In libtextstyle, we don't want to use an external libcroco, 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':
+! # - libcroco.so depends on libxml2.
+! #   - 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 libcroco part.
+! gl_LIBCROCO([yes])
+  
+  Makefile.am:
+  AM_CPPFLAGS += $(INCGLIB)