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