1From 15647f679834be633fb4a9aeff4671b9cb95ccb8 Mon Sep 17 00:00:00 2001 2From: Ross Burton <ross.burton@intel.com> 3Date: Tue, 23 Jan 2018 00:54:13 +0000 4Subject: [PATCH] gettext: beat library detection into shape 5 6For reasons which I just can't fathom gnulib doesn't use the expected tools to 7find libraries but badly reinvents the wheel. This will trivially lead to host 8contamination (explicit searches of /usr/lib) or incorrect RPATHs (bad 9canonicalisation resulting in relative paths). 10 11Simply delete all the crazy, and replace with a single call to pkg-config. 12 13Upstream-Status: Inappropriate [upstream still refuse to consider pkg-config] 14Signed-off-by: Ross Burton <ross.burton@intel.com> 15 16--- 17 gettext-tools/gnulib-m4/libxml.m4 | 99 +---------------- 18 .../gnulib-local/lib/term-styled-ostream.oo.c | 12 +-- 19 libtextstyle/gnulib-local/m4/libcroco.m4 | 99 +++-------------- 20 libtextstyle/gnulib-local/m4/libglib.m4 | 100 +++--------------- 21 libtextstyle/gnulib-m4/libcroco.m4 | 99 +++-------------- 22 libtextstyle/gnulib-m4/libglib.m4 | 100 +++--------------- 23 libtextstyle/lib/term-styled-ostream.c | 12 +-- 24 libtextstyle/lib/term-styled-ostream.oo.c | 12 +-- 25 8 files changed, 83 insertions(+), 450 deletions(-) 26 27diff --git a/gettext-tools/gnulib-m4/libxml.m4 b/gettext-tools/gnulib-m4/libxml.m4 28index 2f80c37..30ce58e 100644 29--- a/gettext-tools/gnulib-m4/libxml.m4 30+++ b/gettext-tools/gnulib-m4/libxml.m4 31@@ -13,6 +13,7 @@ dnl gl_LIBXML(FORCE-INCLUDED) 32 dnl forces the use of the included or an external libxml. 33 AC_DEFUN([gl_LIBXML], 34 [ 35+ AC_REQUIRE([PKG_PROG_PKG_CONFIG]) 36 AC_REQUIRE([AM_ICONV_LINK]) 37 38 ifelse([$1], , [ 39@@ -30,100 +31,10 @@ AC_DEFUN([gl_LIBXML], 40 INCXML= 41 ifelse([$1], [yes], , [ 42 if test "$gl_cv_libxml_use_included" != yes; then 43- dnl Figure out whether we can use a preinstalled libxml2, or have to use 44- dnl the included one. 45- AC_CACHE_VAL([gl_cv_libxml], [ 46- gl_cv_libxml=no 47- gl_cv_LIBXML= 48- gl_cv_LTLIBXML= 49- gl_cv_INCXML= 50- gl_save_LIBS="$LIBS" 51- LIBS="$LIBS $LIBICONV" 52- dnl Search for libxml2 and define LIBXML2, LTLIBXML2 and INCXML2 53- dnl accordingly. 54- dnl Don't use xml2-config nor pkg-config, since it doesn't work when 55- dnl cross-compiling or when the C compiler in use is different from the 56- dnl one that built the library. 57- dnl Use a test program that tries to invoke xmlFree. On Cygwin 1.7.x, 58- dnl libxml2 is built in such a way that uses of xmlFree work fine with 59- dnl -Wl,--enable-auto-import but lead to a link error with 60- dnl -Wl,--disable-auto-import. 61- AC_LIB_LINKFLAGS_BODY([xml2]) 62- LIBS="$gl_save_LIBS $LIBXML2 $LIBICONV" 63- AC_TRY_LINK([#include <libxml/xmlversion.h> 64- #include <libxml/xmlmemory.h> 65- #include <libxml/xpath.h> 66- ], 67- [xmlCheckVersion (0); 68- xmlFree ((void *) 0); 69- xmlXPathSetContextNode ((void *)0, (void *)0); 70- ], 71- [gl_cv_libxml=yes 72- gl_cv_LIBXML="$LIBXML2 $LIBICONV" 73- gl_cv_LTLIBXML="$LTLIBXML2 $LTLIBICONV" 74- ]) 75- if test "$gl_cv_libxml" != yes; then 76- gl_save_CPPFLAGS="$CPPFLAGS" 77- CPPFLAGS="$CPPFLAGS $INCXML2" 78- AC_TRY_LINK([#include <libxml/xmlversion.h> 79- #include <libxml/xmlmemory.h> 80- #include <libxml/xpath.h> 81- ], 82- [xmlCheckVersion (0); 83- xmlFree ((void *) 0); 84- xmlXPathSetContextNode ((void *)0, (void *)0); 85- ], 86- [gl_cv_libxml=yes 87- gl_cv_LIBXML="$LIBXML2 $LIBICONV" 88- gl_cv_LTLIBXML="$LTLIBXML2 $LTLIBICONV" 89- gl_cv_INCXML="$INCXML2" 90- ]) 91- if test "$gl_cv_libxml" != yes; then 92- dnl Often the include files are installed in /usr/include/libxml2. 93- dnl In libxml2-2.5, <libxml/xmlversion.h> is self-contained. 94- dnl In libxml2-2.6, it includes <libxml/xmlexports.h> which is 95- dnl self-contained. 96- libxml2_include_dir= 97- AC_TRY_CPP([#include <libxml2/libxml/xmlexports.h>], 98- [gl_ABSOLUTE_HEADER([libxml2/libxml/xmlexports.h]) 99- libxml2_include_dir=`echo "$gl_cv_absolute_libxml2_libxml_xmlexports_h" | sed -e 's,.libxml.xmlexports\.h$,,'` 100- ]) 101- if test -z "$libxml2_include_dir"; then 102- AC_TRY_CPP([#include <libxml2/libxml/xmlversion.h>], 103- [gl_ABSOLUTE_HEADER([libxml2/libxml/xmlversion.h]) 104- libxml2_include_dir=`echo "$gl_cv_absolute_libxml2_libxml_xmlversion_h" | sed -e 's,.libxml.xmlversion\.h$,,'` 105- ]) 106- fi 107- if test -n "$libxml2_include_dir" && test -d "$libxml2_include_dir"; then 108- CPPFLAGS="$gl_save_CPPFLAGS -I$libxml2_include_dir" 109- AC_TRY_LINK([#include <libxml/xmlversion.h> 110- #include <libxml/xmlmemory.h> 111- #include <libxml/xpath.h> 112- ], 113- [xmlCheckVersion (0); 114- xmlFree ((void *) 0); 115- xmlXPathSetContextNode ((void *)0, (void *)0); 116- ], 117- [gl_cv_libxml=yes 118- gl_cv_LIBXML="$LIBXML2 $LIBICONV" 119- gl_cv_LTLIBXML="$LTLIBXML2 $LTLIBICONV" 120- gl_cv_INCXML="-I$libxml2_include_dir" 121- ]) 122- fi 123- fi 124- CPPFLAGS="$gl_save_CPPFLAGS" 125- fi 126- LIBS="$gl_save_LIBS" 127- ]) 128- AC_MSG_CHECKING([for libxml]) 129- AC_MSG_RESULT([$gl_cv_libxml]) 130- if test $gl_cv_libxml = yes; then 131- LIBXML="$gl_cv_LIBXML" 132- LTLIBXML="$gl_cv_LTLIBXML" 133- INCXML="$gl_cv_INCXML" 134- else 135- gl_cv_libxml_use_included=yes 136- fi 137+ PKG_CHECK_MODULES([XML], [libxml-2.0]) 138+ LIBXML=$XML_LIBS 139+ LTLIBXML=$XML_LIBS 140+ INCXML=$XML_CFLAGS 141 fi 142 ]) 143 AC_SUBST([LIBXML]) 144diff --git a/libtextstyle/gnulib-local/lib/term-styled-ostream.oo.c b/libtextstyle/gnulib-local/lib/term-styled-ostream.oo.c 145index 2ff978f..5ffb17a 100644 146--- a/libtextstyle/gnulib-local/lib/term-styled-ostream.oo.c 147+++ b/libtextstyle/gnulib-local/lib/term-styled-ostream.oo.c 148@@ -22,15 +22,15 @@ 149 150 #include <stdlib.h> 151 152-#include <cr-om-parser.h> 153-#include <cr-sel-eng.h> 154-#include <cr-style.h> 155-#include <cr-rgb.h> 156+#include <libcroco/cr-om-parser.h> 157+#include <libcroco/cr-sel-eng.h> 158+#include <libcroco/cr-style.h> 159+#include <libcroco/cr-rgb.h> 160 /* <cr-fonts.h> has a broken double-inclusion guard in libcroco-0.6.1. */ 161 #ifndef __CR_FONTS_H__ 162-# include <cr-fonts.h> 163+# include <libcroco/cr-fonts.h> 164 #endif 165-#include <cr-string.h> 166+#include <libcroco/cr-string.h> 167 168 #include "term-ostream.h" 169 #include "mem-hash-map.h" 170diff --git a/libtextstyle/gnulib-local/m4/libcroco.m4 b/libtextstyle/gnulib-local/m4/libcroco.m4 171index bc53cc6..10b2455 100644 172--- a/libtextstyle/gnulib-local/m4/libcroco.m4 173+++ b/libtextstyle/gnulib-local/m4/libcroco.m4 174@@ -1,99 +1,34 @@ 175-# libcroco.m4 serial 3 176-dnl Copyright (C) 2006-2007, 2019 Free Software Foundation, Inc. 177+# libcroco.m4 serial 2 (gettext-0.17) 178+dnl Copyright (C) 2006, 2015-2016 Free Software Foundation, Inc. 179 dnl This file is free software; the Free Software Foundation 180 dnl gives unlimited permission to copy and/or distribute it, 181 dnl with or without modifications, as long as this notice is preserved. 182 183 dnl From Bruno Haible. 184 185-dnl gl_LIBCROCO 186-dnl gives the user the option to decide whether to use the included or 187-dnl an external libcroco. 188-dnl gl_LIBCROCO(FORCE-INCLUDED) 189-dnl forces the use of the included or an external libcroco. 190 AC_DEFUN([gl_LIBCROCO], 191 [ 192- ifelse([$1], [yes], , [ 193- dnl libcroco depends on libglib. 194- AC_REQUIRE([gl_LIBGLIB]) 195- ]) 196+ AC_REQUIRE([PKG_PROG_PKG_CONFIG]) 197+ dnl libcroco depends on libglib. 198+ AC_REQUIRE([gl_LIBGLIB]) 199 200- ifelse([$1], , [ 201- AC_MSG_CHECKING([whether included libcroco is requested]) 202- AC_ARG_WITH([included-libcroco], 203- [ --with-included-libcroco use the libcroco included here], 204- [gl_cv_libcroco_force_included=$withval], 205- [gl_cv_libcroco_force_included=no]) 206- AC_MSG_RESULT([$gl_cv_libcroco_force_included]) 207- ], [gl_cv_libcroco_force_included=$1]) 208+ AC_MSG_CHECKING([whether included libcroco is requested]) 209+ AC_ARG_WITH([included-libcroco], 210+ [ --with-included-libcroco use the libcroco included here], 211+ [gl_cv_libcroco_force_included=$withval], 212+ [gl_cv_libcroco_force_included=no]) 213+ AC_MSG_RESULT([$gl_cv_libcroco_force_included]) 214 215 gl_cv_libcroco_use_included="$gl_cv_libcroco_force_included" 216 LIBCROCO= 217 LTLIBCROCO= 218 INCCROCO= 219- ifelse([$1], [yes], , [ 220- if test "$gl_cv_libcroco_use_included" != yes; then 221- dnl Figure out whether we can use a preinstalled libcroco-0.6, or have to 222- dnl use the included one. 223- AC_CACHE_VAL([gl_cv_libcroco], [ 224- gl_cv_libcroco=no 225- gl_cv_LIBCROCO= 226- gl_cv_LTLIBCROCO= 227- gl_cv_INCCROCO= 228- gl_save_LIBS="$LIBS" 229- dnl Search for libcroco and define LIBCROCO_0_6, LTLIBCROCO_0_6 and 230- dnl INCCROCO_0_6 accordingly. 231- dnl Don't use croco-0.6-config nor pkg-config, since it doesn't work when 232- dnl cross-compiling or when the C compiler in use is different from the 233- dnl one that built the library. 234- AC_LIB_LINKFLAGS_BODY([croco-0.6], [glib-2.0]) 235- LIBS="$gl_save_LIBS $LIBCROCO_0_6" 236- AC_TRY_LINK([#include <libcroco-config.h>], 237- [const char *version = LIBCROCO_VERSION; return !version;], 238- [gl_cv_libcroco=yes 239- gl_cv_LIBCROCO="$LIBCROCO_0_6" 240- gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6" 241- ]) 242- if test "$gl_cv_libcroco" != yes; then 243- gl_save_CPPFLAGS="$CPPFLAGS" 244- CPPFLAGS="$CPPFLAGS $INCCROCO_0_6" 245- AC_TRY_LINK([#include <libcroco-config.h>], 246- [const char *version = LIBCROCO_VERSION; return !version;], 247- [gl_cv_libcroco=yes 248- gl_cv_LIBCROCO="$LIBCROCO_0_6" 249- gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6" 250- gl_cv_INCCROCO="$INCCROCO_0_6" 251- ]) 252- if test "$gl_cv_libcroco" != yes; then 253- dnl Often the include files are installed in 254- dnl /usr/include/libcroco-0.6/libcroco. 255- AC_TRY_LINK([#include <libcroco-0.6/libcroco/libcroco-config.h>], 256- [const char *version = LIBCROCO_VERSION; return !version;], 257- [gl_ABSOLUTE_HEADER([libcroco-0.6/libcroco/libcroco-config.h]) 258- libcroco_include_dir=`echo "$gl_cv_absolute_libcroco_0_6_libcroco_libcroco_config_h" | sed -e 's,.libcroco-config\.h$,,'` 259- if test -d "$libcroco_include_dir"; then 260- gl_cv_libcroco=yes 261- gl_cv_LIBCROCO="$LIBCROCO_0_6" 262- gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6" 263- gl_cv_INCCROCO="-I$libcroco_include_dir" 264- fi 265- ]) 266- fi 267- CPPFLAGS="$gl_save_CPPFLAGS" 268- fi 269- LIBS="$gl_save_LIBS" 270- ]) 271- AC_MSG_CHECKING([for libcroco]) 272- AC_MSG_RESULT([$gl_cv_libcroco]) 273- if test $gl_cv_libcroco = yes; then 274- LIBCROCO="$gl_cv_LIBCROCO" 275- LTLIBCROCO="$gl_cv_LTLIBCROCO" 276- INCCROCO="$gl_cv_INCCROCO" 277- else 278- gl_cv_libcroco_use_included=yes 279- fi 280- fi 281- ]) 282+ if test "$gl_cv_libcroco_use_included" != yes; then 283+ PKG_CHECK_MODULES([CROCO], [libcroco-0.6]) 284+ LIBCROCO=$CROCO_LIBS 285+ LTLIBCROCO=$CROCO_LIBS 286+ INCCROCO=$CROCO_CFLAGS 287+ fi 288 AC_SUBST([LIBCROCO]) 289 AC_SUBST([LTLIBCROCO]) 290 AC_SUBST([INCCROCO]) 291diff --git a/libtextstyle/gnulib-local/m4/libglib.m4 b/libtextstyle/gnulib-local/m4/libglib.m4 292index 5853772..767fba2 100644 293--- a/libtextstyle/gnulib-local/m4/libglib.m4 294+++ b/libtextstyle/gnulib-local/m4/libglib.m4 295@@ -6,100 +6,26 @@ dnl with or without modifications, as long as this notice is preserved. 296 297 dnl From Bruno Haible. 298 299-dnl gl_LIBGLIB 300-dnl gives the user the option to decide whether to use the included or 301-dnl an external libglib. 302-dnl gl_LIBGLIB(FORCE-INCLUDED) 303-dnl forces the use of the included or an external libglib. 304 AC_DEFUN([gl_LIBGLIB], 305 [ 306- ifelse([$1], , [ 307- AC_MSG_CHECKING([whether included glib is requested]) 308- AC_ARG_WITH([included-glib], 309- [ --with-included-glib use the glib2 included here], 310- [gl_cv_libglib_force_included=$withval], 311- [gl_cv_libglib_force_included=no]) 312- AC_MSG_RESULT([$gl_cv_libglib_force_included]) 313- ], [gl_cv_libglib_force_included=$1]) 314+ AC_REQUIRE([PKG_PROG_PKG_CONFIG]) 315+ AC_MSG_CHECKING([whether included glib is requested]) 316+ AC_ARG_WITH([included-glib], 317+ [ --with-included-glib use the glib2 included here], 318+ [gl_cv_libglib_force_included=$withval], 319+ [gl_cv_libglib_force_included=no]) 320+ AC_MSG_RESULT([$gl_cv_libglib_force_included]) 321 322 gl_cv_libglib_use_included="$gl_cv_libglib_force_included" 323 LIBGLIB= 324 LTLIBGLIB= 325 INCGLIB= 326- ifelse([$1], [yes], , [ 327- if test "$gl_cv_libglib_use_included" != yes; then 328- dnl Figure out whether we can use a preinstalled libglib-2.0, or have to use 329- dnl the included one. 330- AC_CACHE_VAL([gl_cv_libglib], [ 331- gl_cv_libglib=no 332- gl_cv_LIBGLIB= 333- gl_cv_LTLIBGLIB= 334- gl_cv_INCGLIB= 335- gl_save_LIBS="$LIBS" 336- dnl Search for libglib2 and define LIBGLIB_2_0, LTLIBGLIB_2_0 and 337- dnl INCGLIB_2_0 accordingly. 338- dnl Don't use glib-config nor pkg-config, since it doesn't work when 339- dnl cross-compiling or when the C compiler in use is different from the 340- dnl one that built the library. 341- AC_LIB_LINKFLAGS_BODY([glib-2.0]) 342- LIBS="$gl_save_LIBS $LIBGLIB_2_0" 343- AC_TRY_LINK([#include <glib.h> 344-#ifndef G_BEGIN_DECLS 345-error this glib.h includes a glibconfig.h from a glib version 1.x 346-#endif 347-], 348- [g_string_new ("foo");], 349- [gl_cv_libglib=yes 350- gl_cv_LIBGLIB="$LIBGLIB_2_0" 351- gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0" 352- ]) 353- if test "$gl_cv_libglib" != yes; then 354- gl_save_CPPFLAGS="$CPPFLAGS" 355- CPPFLAGS="$CPPFLAGS $INCGLIB_2_0" 356- AC_TRY_LINK([#include <glib.h> 357-#ifndef G_BEGIN_DECLS 358-error this glib.h includes a glibconfig.h from a glib version 1.x 359-#endif 360-], 361- [g_string_new ("foo");], 362- [gl_cv_libglib=yes 363- gl_cv_LIBGLIB="$LIBGLIB_2_0" 364- gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0" 365- gl_cv_INCGLIB="$INCGLIB_2_0" 366- ]) 367- if test "$gl_cv_libglib" != yes; then 368- dnl Often the include files are installed in /usr/include/glib-2.0 369- dnl and /usr/lib/glib-2.0/include. 370- if test -n "$LIBGLIB_2_0_PREFIX"; then 371- CPPFLAGS="$gl_save_CPPFLAGS -I$LIBGLIB_2_0_PREFIX/include/glib-2.0 -I$LIBGLIB_2_0_PREFIX/$acl_libdirstem/glib-2.0/include" 372- AC_TRY_LINK([#include <glib.h> 373-#ifndef G_BEGIN_DECLS 374-error this glib.h includes a glibconfig.h from a glib version 1.x 375-#endif 376-], 377- [g_string_new ("foo");], 378- [gl_cv_libglib=yes 379- gl_cv_LIBGLIB="$LIBGLIB_2_0" 380- gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0" 381- gl_cv_INCGLIB="-I$LIBGLIB_2_0_PREFIX/include/glib-2.0 -I$LIBGLIB_2_0_PREFIX/$acl_libdirstem/glib-2.0/include" 382- ]) 383- fi 384- fi 385- CPPFLAGS="$gl_save_CPPFLAGS" 386- fi 387- LIBS="$gl_save_LIBS" 388- ]) 389- AC_MSG_CHECKING([for glib]) 390- AC_MSG_RESULT([$gl_cv_libglib]) 391- if test $gl_cv_libglib = yes; then 392- LIBGLIB="$gl_cv_LIBGLIB" 393- LTLIBGLIB="$gl_cv_LTLIBGLIB" 394- INCGLIB="$gl_cv_INCGLIB" 395- else 396- gl_cv_libglib_use_included=yes 397- fi 398- fi 399- ]) 400+ if test "$gl_cv_libglib_use_included" != yes; then 401+ PKG_CHECK_MODULES([GLIB], [glib-2.0]) 402+ LIBGLIB="$GLIB_LIBS" 403+ LTLIBGLIB="$GLIB_LIBS" 404+ INCGLIB="$GLIB_CFLAGS" 405+ fi 406 AC_SUBST([LIBGLIB]) 407 AC_SUBST([LTLIBGLIB]) 408 AC_SUBST([INCGLIB]) 409diff --git a/libtextstyle/gnulib-m4/libcroco.m4 b/libtextstyle/gnulib-m4/libcroco.m4 410index bc53cc6..10b2455 100644 411--- a/libtextstyle/gnulib-m4/libcroco.m4 412+++ b/libtextstyle/gnulib-m4/libcroco.m4 413@@ -1,99 +1,34 @@ 414-# libcroco.m4 serial 3 415-dnl Copyright (C) 2006-2007, 2019 Free Software Foundation, Inc. 416+# libcroco.m4 serial 2 (gettext-0.17) 417+dnl Copyright (C) 2006, 2015-2016 Free Software Foundation, Inc. 418 dnl This file is free software; the Free Software Foundation 419 dnl gives unlimited permission to copy and/or distribute it, 420 dnl with or without modifications, as long as this notice is preserved. 421 422 dnl From Bruno Haible. 423 424-dnl gl_LIBCROCO 425-dnl gives the user the option to decide whether to use the included or 426-dnl an external libcroco. 427-dnl gl_LIBCROCO(FORCE-INCLUDED) 428-dnl forces the use of the included or an external libcroco. 429 AC_DEFUN([gl_LIBCROCO], 430 [ 431- ifelse([$1], [yes], , [ 432- dnl libcroco depends on libglib. 433- AC_REQUIRE([gl_LIBGLIB]) 434- ]) 435+ AC_REQUIRE([PKG_PROG_PKG_CONFIG]) 436+ dnl libcroco depends on libglib. 437+ AC_REQUIRE([gl_LIBGLIB]) 438 439- ifelse([$1], , [ 440- AC_MSG_CHECKING([whether included libcroco is requested]) 441- AC_ARG_WITH([included-libcroco], 442- [ --with-included-libcroco use the libcroco included here], 443- [gl_cv_libcroco_force_included=$withval], 444- [gl_cv_libcroco_force_included=no]) 445- AC_MSG_RESULT([$gl_cv_libcroco_force_included]) 446- ], [gl_cv_libcroco_force_included=$1]) 447+ AC_MSG_CHECKING([whether included libcroco is requested]) 448+ AC_ARG_WITH([included-libcroco], 449+ [ --with-included-libcroco use the libcroco included here], 450+ [gl_cv_libcroco_force_included=$withval], 451+ [gl_cv_libcroco_force_included=no]) 452+ AC_MSG_RESULT([$gl_cv_libcroco_force_included]) 453 454 gl_cv_libcroco_use_included="$gl_cv_libcroco_force_included" 455 LIBCROCO= 456 LTLIBCROCO= 457 INCCROCO= 458- ifelse([$1], [yes], , [ 459- if test "$gl_cv_libcroco_use_included" != yes; then 460- dnl Figure out whether we can use a preinstalled libcroco-0.6, or have to 461- dnl use the included one. 462- AC_CACHE_VAL([gl_cv_libcroco], [ 463- gl_cv_libcroco=no 464- gl_cv_LIBCROCO= 465- gl_cv_LTLIBCROCO= 466- gl_cv_INCCROCO= 467- gl_save_LIBS="$LIBS" 468- dnl Search for libcroco and define LIBCROCO_0_6, LTLIBCROCO_0_6 and 469- dnl INCCROCO_0_6 accordingly. 470- dnl Don't use croco-0.6-config nor pkg-config, since it doesn't work when 471- dnl cross-compiling or when the C compiler in use is different from the 472- dnl one that built the library. 473- AC_LIB_LINKFLAGS_BODY([croco-0.6], [glib-2.0]) 474- LIBS="$gl_save_LIBS $LIBCROCO_0_6" 475- AC_TRY_LINK([#include <libcroco-config.h>], 476- [const char *version = LIBCROCO_VERSION; return !version;], 477- [gl_cv_libcroco=yes 478- gl_cv_LIBCROCO="$LIBCROCO_0_6" 479- gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6" 480- ]) 481- if test "$gl_cv_libcroco" != yes; then 482- gl_save_CPPFLAGS="$CPPFLAGS" 483- CPPFLAGS="$CPPFLAGS $INCCROCO_0_6" 484- AC_TRY_LINK([#include <libcroco-config.h>], 485- [const char *version = LIBCROCO_VERSION; return !version;], 486- [gl_cv_libcroco=yes 487- gl_cv_LIBCROCO="$LIBCROCO_0_6" 488- gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6" 489- gl_cv_INCCROCO="$INCCROCO_0_6" 490- ]) 491- if test "$gl_cv_libcroco" != yes; then 492- dnl Often the include files are installed in 493- dnl /usr/include/libcroco-0.6/libcroco. 494- AC_TRY_LINK([#include <libcroco-0.6/libcroco/libcroco-config.h>], 495- [const char *version = LIBCROCO_VERSION; return !version;], 496- [gl_ABSOLUTE_HEADER([libcroco-0.6/libcroco/libcroco-config.h]) 497- libcroco_include_dir=`echo "$gl_cv_absolute_libcroco_0_6_libcroco_libcroco_config_h" | sed -e 's,.libcroco-config\.h$,,'` 498- if test -d "$libcroco_include_dir"; then 499- gl_cv_libcroco=yes 500- gl_cv_LIBCROCO="$LIBCROCO_0_6" 501- gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6" 502- gl_cv_INCCROCO="-I$libcroco_include_dir" 503- fi 504- ]) 505- fi 506- CPPFLAGS="$gl_save_CPPFLAGS" 507- fi 508- LIBS="$gl_save_LIBS" 509- ]) 510- AC_MSG_CHECKING([for libcroco]) 511- AC_MSG_RESULT([$gl_cv_libcroco]) 512- if test $gl_cv_libcroco = yes; then 513- LIBCROCO="$gl_cv_LIBCROCO" 514- LTLIBCROCO="$gl_cv_LTLIBCROCO" 515- INCCROCO="$gl_cv_INCCROCO" 516- else 517- gl_cv_libcroco_use_included=yes 518- fi 519- fi 520- ]) 521+ if test "$gl_cv_libcroco_use_included" != yes; then 522+ PKG_CHECK_MODULES([CROCO], [libcroco-0.6]) 523+ LIBCROCO=$CROCO_LIBS 524+ LTLIBCROCO=$CROCO_LIBS 525+ INCCROCO=$CROCO_CFLAGS 526+ fi 527 AC_SUBST([LIBCROCO]) 528 AC_SUBST([LTLIBCROCO]) 529 AC_SUBST([INCCROCO]) 530diff --git a/libtextstyle/gnulib-m4/libglib.m4 b/libtextstyle/gnulib-m4/libglib.m4 531index 5853772..767fba2 100644 532--- a/libtextstyle/gnulib-m4/libglib.m4 533+++ b/libtextstyle/gnulib-m4/libglib.m4 534@@ -6,100 +6,26 @@ dnl with or without modifications, as long as this notice is preserved. 535 536 dnl From Bruno Haible. 537 538-dnl gl_LIBGLIB 539-dnl gives the user the option to decide whether to use the included or 540-dnl an external libglib. 541-dnl gl_LIBGLIB(FORCE-INCLUDED) 542-dnl forces the use of the included or an external libglib. 543 AC_DEFUN([gl_LIBGLIB], 544 [ 545- ifelse([$1], , [ 546- AC_MSG_CHECKING([whether included glib is requested]) 547- AC_ARG_WITH([included-glib], 548- [ --with-included-glib use the glib2 included here], 549- [gl_cv_libglib_force_included=$withval], 550- [gl_cv_libglib_force_included=no]) 551- AC_MSG_RESULT([$gl_cv_libglib_force_included]) 552- ], [gl_cv_libglib_force_included=$1]) 553+ AC_REQUIRE([PKG_PROG_PKG_CONFIG]) 554+ AC_MSG_CHECKING([whether included glib is requested]) 555+ AC_ARG_WITH([included-glib], 556+ [ --with-included-glib use the glib2 included here], 557+ [gl_cv_libglib_force_included=$withval], 558+ [gl_cv_libglib_force_included=no]) 559+ AC_MSG_RESULT([$gl_cv_libglib_force_included]) 560 561 gl_cv_libglib_use_included="$gl_cv_libglib_force_included" 562 LIBGLIB= 563 LTLIBGLIB= 564 INCGLIB= 565- ifelse([$1], [yes], , [ 566- if test "$gl_cv_libglib_use_included" != yes; then 567- dnl Figure out whether we can use a preinstalled libglib-2.0, or have to use 568- dnl the included one. 569- AC_CACHE_VAL([gl_cv_libglib], [ 570- gl_cv_libglib=no 571- gl_cv_LIBGLIB= 572- gl_cv_LTLIBGLIB= 573- gl_cv_INCGLIB= 574- gl_save_LIBS="$LIBS" 575- dnl Search for libglib2 and define LIBGLIB_2_0, LTLIBGLIB_2_0 and 576- dnl INCGLIB_2_0 accordingly. 577- dnl Don't use glib-config nor pkg-config, since it doesn't work when 578- dnl cross-compiling or when the C compiler in use is different from the 579- dnl one that built the library. 580- AC_LIB_LINKFLAGS_BODY([glib-2.0]) 581- LIBS="$gl_save_LIBS $LIBGLIB_2_0" 582- AC_TRY_LINK([#include <glib.h> 583-#ifndef G_BEGIN_DECLS 584-error this glib.h includes a glibconfig.h from a glib version 1.x 585-#endif 586-], 587- [g_string_new ("foo");], 588- [gl_cv_libglib=yes 589- gl_cv_LIBGLIB="$LIBGLIB_2_0" 590- gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0" 591- ]) 592- if test "$gl_cv_libglib" != yes; then 593- gl_save_CPPFLAGS="$CPPFLAGS" 594- CPPFLAGS="$CPPFLAGS $INCGLIB_2_0" 595- AC_TRY_LINK([#include <glib.h> 596-#ifndef G_BEGIN_DECLS 597-error this glib.h includes a glibconfig.h from a glib version 1.x 598-#endif 599-], 600- [g_string_new ("foo");], 601- [gl_cv_libglib=yes 602- gl_cv_LIBGLIB="$LIBGLIB_2_0" 603- gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0" 604- gl_cv_INCGLIB="$INCGLIB_2_0" 605- ]) 606- if test "$gl_cv_libglib" != yes; then 607- dnl Often the include files are installed in /usr/include/glib-2.0 608- dnl and /usr/lib/glib-2.0/include. 609- if test -n "$LIBGLIB_2_0_PREFIX"; then 610- CPPFLAGS="$gl_save_CPPFLAGS -I$LIBGLIB_2_0_PREFIX/include/glib-2.0 -I$LIBGLIB_2_0_PREFIX/$acl_libdirstem/glib-2.0/include" 611- AC_TRY_LINK([#include <glib.h> 612-#ifndef G_BEGIN_DECLS 613-error this glib.h includes a glibconfig.h from a glib version 1.x 614-#endif 615-], 616- [g_string_new ("foo");], 617- [gl_cv_libglib=yes 618- gl_cv_LIBGLIB="$LIBGLIB_2_0" 619- gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0" 620- gl_cv_INCGLIB="-I$LIBGLIB_2_0_PREFIX/include/glib-2.0 -I$LIBGLIB_2_0_PREFIX/$acl_libdirstem/glib-2.0/include" 621- ]) 622- fi 623- fi 624- CPPFLAGS="$gl_save_CPPFLAGS" 625- fi 626- LIBS="$gl_save_LIBS" 627- ]) 628- AC_MSG_CHECKING([for glib]) 629- AC_MSG_RESULT([$gl_cv_libglib]) 630- if test $gl_cv_libglib = yes; then 631- LIBGLIB="$gl_cv_LIBGLIB" 632- LTLIBGLIB="$gl_cv_LTLIBGLIB" 633- INCGLIB="$gl_cv_INCGLIB" 634- else 635- gl_cv_libglib_use_included=yes 636- fi 637- fi 638- ]) 639+ if test "$gl_cv_libglib_use_included" != yes; then 640+ PKG_CHECK_MODULES([GLIB], [glib-2.0]) 641+ LIBGLIB="$GLIB_LIBS" 642+ LTLIBGLIB="$GLIB_LIBS" 643+ INCGLIB="$GLIB_CFLAGS" 644+ fi 645 AC_SUBST([LIBGLIB]) 646 AC_SUBST([LTLIBGLIB]) 647 AC_SUBST([INCGLIB]) 648diff --git a/libtextstyle/lib/term-styled-ostream.c b/libtextstyle/lib/term-styled-ostream.c 649index 5484800..16793fa 100644 650--- a/libtextstyle/lib/term-styled-ostream.c 651+++ b/libtextstyle/lib/term-styled-ostream.c 652@@ -28,15 +28,15 @@ 653 654 #include <stdlib.h> 655 656-#include <cr-om-parser.h> 657-#include <cr-sel-eng.h> 658-#include <cr-style.h> 659-#include <cr-rgb.h> 660+#include <libcroco/cr-om-parser.h> 661+#include <libcroco/cr-sel-eng.h> 662+#include <libcroco/cr-style.h> 663+#include <libcroco/cr-rgb.h> 664 /* <cr-fonts.h> has a broken double-inclusion guard in libcroco-0.6.1. */ 665 #ifndef __CR_FONTS_H__ 666-# include <cr-fonts.h> 667+# include <libcroco/cr-fonts.h> 668 #endif 669-#include <cr-string.h> 670+#include <libcroco/cr-string.h> 671 672 #include "term-ostream.h" 673 #include "mem-hash-map.h" 674diff --git a/libtextstyle/lib/term-styled-ostream.oo.c b/libtextstyle/lib/term-styled-ostream.oo.c 675index 2ff978f..5ffb17a 100644 676--- a/libtextstyle/lib/term-styled-ostream.oo.c 677+++ b/libtextstyle/lib/term-styled-ostream.oo.c 678@@ -22,15 +22,15 @@ 679 680 #include <stdlib.h> 681 682-#include <cr-om-parser.h> 683-#include <cr-sel-eng.h> 684-#include <cr-style.h> 685-#include <cr-rgb.h> 686+#include <libcroco/cr-om-parser.h> 687+#include <libcroco/cr-sel-eng.h> 688+#include <libcroco/cr-style.h> 689+#include <libcroco/cr-rgb.h> 690 /* <cr-fonts.h> has a broken double-inclusion guard in libcroco-0.6.1. */ 691 #ifndef __CR_FONTS_H__ 692-# include <cr-fonts.h> 693+# include <libcroco/cr-fonts.h> 694 #endif 695-#include <cr-string.h> 696+#include <libcroco/cr-string.h> 697 698 #include "term-ostream.h" 699 #include "mem-hash-map.h" 700