blob: d3f3fe8e2f97ed18cd7b2122f57c1d60cd2a5032 [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001From ef414b06be80c6f605731abc9e674e396b80ec9e 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 | 104 +++---------------
21 libtextstyle/gnulib-m4/libcroco.m4 | 99 +++--------------
22 libtextstyle/gnulib-m4/libglib.m4 | 104 +++---------------
23 libtextstyle/lib/term-styled-ostream.c | 12 +-
24 libtextstyle/lib/term-styled-ostream.oo.c | 12 +-
25 8 files changed, 87 insertions(+), 454 deletions(-)
26
27diff --git a/gettext-tools/gnulib-m4/libxml.m4 b/gettext-tools/gnulib-m4/libxml.m4
28index 05b9550..031ee65 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 2cfd4a8..d42c8b4 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 "hash.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 bef6fa3..8841755 100644
293--- a/libtextstyle/gnulib-local/m4/libglib.m4
294+++ b/libtextstyle/gnulib-local/m4/libglib.m4
295@@ -1,105 +1,31 @@
296-# libglib.m4 serial 4
297-dnl Copyright (C) 2006-2007, 2019 Free Software Foundation, Inc.
298+# libglib.m4 serial 3 (gettext-0.17)
299+dnl Copyright (C) 2006-2007, 2015-2016 Free Software Foundation, Inc.
300 dnl This file is free software; the Free Software Foundation
301 dnl gives unlimited permission to copy and/or distribute it,
302 dnl with or without modifications, as long as this notice is preserved.
303
304 dnl From Bruno Haible.
305
306-dnl gl_LIBGLIB
307-dnl gives the user the option to decide whether to use the included or
308-dnl an external libglib.
309-dnl gl_LIBGLIB(FORCE-INCLUDED)
310-dnl forces the use of the included or an external libglib.
311 AC_DEFUN([gl_LIBGLIB],
312 [
313- ifelse([$1], , [
314- AC_MSG_CHECKING([whether included glib is requested])
315- AC_ARG_WITH([included-glib],
316- [ --with-included-glib use the glib2 included here],
317- [gl_cv_libglib_force_included=$withval],
318- [gl_cv_libglib_force_included=no])
319- AC_MSG_RESULT([$gl_cv_libglib_force_included])
320- ], [gl_cv_libglib_force_included=$1])
321+ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
322+ AC_MSG_CHECKING([whether included glib is requested])
323+ AC_ARG_WITH([included-glib],
324+ [ --with-included-glib use the glib2 included here],
325+ [gl_cv_libglib_force_included=$withval],
326+ [gl_cv_libglib_force_included=no])
327+ AC_MSG_RESULT([$gl_cv_libglib_force_included])
328
329 gl_cv_libglib_use_included="$gl_cv_libglib_force_included"
330 LIBGLIB=
331 LTLIBGLIB=
332 INCGLIB=
333- ifelse([$1], [yes], , [
334- if test "$gl_cv_libglib_use_included" != yes; then
335- dnl Figure out whether we can use a preinstalled libglib-2.0, or have to use
336- dnl the included one.
337- AC_CACHE_VAL([gl_cv_libglib], [
338- gl_cv_libglib=no
339- gl_cv_LIBGLIB=
340- gl_cv_LTLIBGLIB=
341- gl_cv_INCGLIB=
342- gl_save_LIBS="$LIBS"
343- dnl Search for libglib2 and define LIBGLIB_2_0, LTLIBGLIB_2_0 and
344- dnl INCGLIB_2_0 accordingly.
345- dnl Don't use glib-config nor pkg-config, since it doesn't work when
346- dnl cross-compiling or when the C compiler in use is different from the
347- dnl one that built the library.
348- AC_LIB_LINKFLAGS_BODY([glib-2.0])
349- LIBS="$gl_save_LIBS $LIBGLIB_2_0"
350- AC_TRY_LINK([#include <glib.h>
351-#ifndef G_BEGIN_DECLS
352-error this glib.h includes a glibconfig.h from a glib version 1.x
353-#endif
354-],
355- [g_string_new ("foo");],
356- [gl_cv_libglib=yes
357- gl_cv_LIBGLIB="$LIBGLIB_2_0"
358- gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0"
359- ])
360- if test "$gl_cv_libglib" != yes; then
361- gl_save_CPPFLAGS="$CPPFLAGS"
362- CPPFLAGS="$CPPFLAGS $INCGLIB_2_0"
363- AC_TRY_LINK([#include <glib.h>
364-#ifndef G_BEGIN_DECLS
365-error this glib.h includes a glibconfig.h from a glib version 1.x
366-#endif
367-],
368- [g_string_new ("foo");],
369- [gl_cv_libglib=yes
370- gl_cv_LIBGLIB="$LIBGLIB_2_0"
371- gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0"
372- gl_cv_INCGLIB="$INCGLIB_2_0"
373- ])
374- if test "$gl_cv_libglib" != yes; then
375- dnl Often the include files are installed in /usr/include/glib-2.0
376- dnl and /usr/lib/glib-2.0/include.
377- if test -n "$LIBGLIB_2_0_PREFIX"; then
378- CPPFLAGS="$gl_save_CPPFLAGS -I$LIBGLIB_2_0_PREFIX/include/glib-2.0 -I$LIBGLIB_2_0_PREFIX/$acl_libdirstem/glib-2.0/include"
379- AC_TRY_LINK([#include <glib.h>
380-#ifndef G_BEGIN_DECLS
381-error this glib.h includes a glibconfig.h from a glib version 1.x
382-#endif
383-],
384- [g_string_new ("foo");],
385- [gl_cv_libglib=yes
386- gl_cv_LIBGLIB="$LIBGLIB_2_0"
387- gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0"
388- gl_cv_INCGLIB="-I$LIBGLIB_2_0_PREFIX/include/glib-2.0 -I$LIBGLIB_2_0_PREFIX/$acl_libdirstem/glib-2.0/include"
389- ])
390- fi
391- fi
392- CPPFLAGS="$gl_save_CPPFLAGS"
393- fi
394- LIBS="$gl_save_LIBS"
395- ])
396- AC_MSG_CHECKING([for glib])
397- AC_MSG_RESULT([$gl_cv_libglib])
398- if test $gl_cv_libglib = yes; then
399- LIBGLIB="$gl_cv_LIBGLIB"
400- LTLIBGLIB="$gl_cv_LTLIBGLIB"
401- INCGLIB="$gl_cv_INCGLIB"
402- else
403- gl_cv_libglib_use_included=yes
404- fi
405- fi
406- ])
407+ if test "$gl_cv_libglib_use_included" != yes; then
408+ PKG_CHECK_MODULES([GLIB], [glib-2.0])
409+ LIBGLIB="$GLIB_LIBS"
410+ LTLIBGLIB="$GLIB_LIBS"
411+ INCGLIB="$GLIB_CFLAGS"
412+ fi
413 AC_SUBST([LIBGLIB])
414 AC_SUBST([LTLIBGLIB])
415 AC_SUBST([INCGLIB])
416diff --git a/libtextstyle/gnulib-m4/libcroco.m4 b/libtextstyle/gnulib-m4/libcroco.m4
417index bc53cc6..10b2455 100644
418--- a/libtextstyle/gnulib-m4/libcroco.m4
419+++ b/libtextstyle/gnulib-m4/libcroco.m4
420@@ -1,99 +1,34 @@
421-# libcroco.m4 serial 3
422-dnl Copyright (C) 2006-2007, 2019 Free Software Foundation, Inc.
423+# libcroco.m4 serial 2 (gettext-0.17)
424+dnl Copyright (C) 2006, 2015-2016 Free Software Foundation, Inc.
425 dnl This file is free software; the Free Software Foundation
426 dnl gives unlimited permission to copy and/or distribute it,
427 dnl with or without modifications, as long as this notice is preserved.
428
429 dnl From Bruno Haible.
430
431-dnl gl_LIBCROCO
432-dnl gives the user the option to decide whether to use the included or
433-dnl an external libcroco.
434-dnl gl_LIBCROCO(FORCE-INCLUDED)
435-dnl forces the use of the included or an external libcroco.
436 AC_DEFUN([gl_LIBCROCO],
437 [
438- ifelse([$1], [yes], , [
439- dnl libcroco depends on libglib.
440- AC_REQUIRE([gl_LIBGLIB])
441- ])
442+ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
443+ dnl libcroco depends on libglib.
444+ AC_REQUIRE([gl_LIBGLIB])
445
446- ifelse([$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- ], [gl_cv_libcroco_force_included=$1])
454+ AC_MSG_CHECKING([whether included libcroco is requested])
455+ AC_ARG_WITH([included-libcroco],
456+ [ --with-included-libcroco use the libcroco included here],
457+ [gl_cv_libcroco_force_included=$withval],
458+ [gl_cv_libcroco_force_included=no])
459+ AC_MSG_RESULT([$gl_cv_libcroco_force_included])
460
461 gl_cv_libcroco_use_included="$gl_cv_libcroco_force_included"
462 LIBCROCO=
463 LTLIBCROCO=
464 INCCROCO=
465- ifelse([$1], [yes], , [
466- if test "$gl_cv_libcroco_use_included" != yes; then
467- dnl Figure out whether we can use a preinstalled libcroco-0.6, or have to
468- dnl use the included one.
469- AC_CACHE_VAL([gl_cv_libcroco], [
470- gl_cv_libcroco=no
471- gl_cv_LIBCROCO=
472- gl_cv_LTLIBCROCO=
473- gl_cv_INCCROCO=
474- gl_save_LIBS="$LIBS"
475- dnl Search for libcroco and define LIBCROCO_0_6, LTLIBCROCO_0_6 and
476- dnl INCCROCO_0_6 accordingly.
477- dnl Don't use croco-0.6-config nor pkg-config, since it doesn't work when
478- dnl cross-compiling or when the C compiler in use is different from the
479- dnl one that built the library.
480- AC_LIB_LINKFLAGS_BODY([croco-0.6], [glib-2.0])
481- LIBS="$gl_save_LIBS $LIBCROCO_0_6"
482- AC_TRY_LINK([#include <libcroco-config.h>],
483- [const char *version = LIBCROCO_VERSION; return !version;],
484- [gl_cv_libcroco=yes
485- gl_cv_LIBCROCO="$LIBCROCO_0_6"
486- gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6"
487- ])
488- if test "$gl_cv_libcroco" != yes; then
489- gl_save_CPPFLAGS="$CPPFLAGS"
490- CPPFLAGS="$CPPFLAGS $INCCROCO_0_6"
491- AC_TRY_LINK([#include <libcroco-config.h>],
492- [const char *version = LIBCROCO_VERSION; return !version;],
493- [gl_cv_libcroco=yes
494- gl_cv_LIBCROCO="$LIBCROCO_0_6"
495- gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6"
496- gl_cv_INCCROCO="$INCCROCO_0_6"
497- ])
498- if test "$gl_cv_libcroco" != yes; then
499- dnl Often the include files are installed in
500- dnl /usr/include/libcroco-0.6/libcroco.
501- AC_TRY_LINK([#include <libcroco-0.6/libcroco/libcroco-config.h>],
502- [const char *version = LIBCROCO_VERSION; return !version;],
503- [gl_ABSOLUTE_HEADER([libcroco-0.6/libcroco/libcroco-config.h])
504- libcroco_include_dir=`echo "$gl_cv_absolute_libcroco_0_6_libcroco_libcroco_config_h" | sed -e 's,.libcroco-config\.h$,,'`
505- if test -d "$libcroco_include_dir"; then
506- gl_cv_libcroco=yes
507- gl_cv_LIBCROCO="$LIBCROCO_0_6"
508- gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6"
509- gl_cv_INCCROCO="-I$libcroco_include_dir"
510- fi
511- ])
512- fi
513- CPPFLAGS="$gl_save_CPPFLAGS"
514- fi
515- LIBS="$gl_save_LIBS"
516- ])
517- AC_MSG_CHECKING([for libcroco])
518- AC_MSG_RESULT([$gl_cv_libcroco])
519- if test $gl_cv_libcroco = yes; then
520- LIBCROCO="$gl_cv_LIBCROCO"
521- LTLIBCROCO="$gl_cv_LTLIBCROCO"
522- INCCROCO="$gl_cv_INCCROCO"
523- else
524- gl_cv_libcroco_use_included=yes
525- fi
526- fi
527- ])
528+ if test "$gl_cv_libcroco_use_included" != yes; then
529+ PKG_CHECK_MODULES([CROCO], [libcroco-0.6])
530+ LIBCROCO=$CROCO_LIBS
531+ LTLIBCROCO=$CROCO_LIBS
532+ INCCROCO=$CROCO_CFLAGS
533+ fi
534 AC_SUBST([LIBCROCO])
535 AC_SUBST([LTLIBCROCO])
536 AC_SUBST([INCCROCO])
537diff --git a/libtextstyle/gnulib-m4/libglib.m4 b/libtextstyle/gnulib-m4/libglib.m4
538index bef6fa3..8841755 100644
539--- a/libtextstyle/gnulib-m4/libglib.m4
540+++ b/libtextstyle/gnulib-m4/libglib.m4
541@@ -1,105 +1,31 @@
542-# libglib.m4 serial 4
543-dnl Copyright (C) 2006-2007, 2019 Free Software Foundation, Inc.
544+# libglib.m4 serial 3 (gettext-0.17)
545+dnl Copyright (C) 2006-2007, 2015-2016 Free Software Foundation, Inc.
546 dnl This file is free software; the Free Software Foundation
547 dnl gives unlimited permission to copy and/or distribute it,
548 dnl with or without modifications, as long as this notice is preserved.
549
550 dnl From Bruno Haible.
551
552-dnl gl_LIBGLIB
553-dnl gives the user the option to decide whether to use the included or
554-dnl an external libglib.
555-dnl gl_LIBGLIB(FORCE-INCLUDED)
556-dnl forces the use of the included or an external libglib.
557 AC_DEFUN([gl_LIBGLIB],
558 [
559- ifelse([$1], , [
560- AC_MSG_CHECKING([whether included glib is requested])
561- AC_ARG_WITH([included-glib],
562- [ --with-included-glib use the glib2 included here],
563- [gl_cv_libglib_force_included=$withval],
564- [gl_cv_libglib_force_included=no])
565- AC_MSG_RESULT([$gl_cv_libglib_force_included])
566- ], [gl_cv_libglib_force_included=$1])
567+ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
568+ AC_MSG_CHECKING([whether included glib is requested])
569+ AC_ARG_WITH([included-glib],
570+ [ --with-included-glib use the glib2 included here],
571+ [gl_cv_libglib_force_included=$withval],
572+ [gl_cv_libglib_force_included=no])
573+ AC_MSG_RESULT([$gl_cv_libglib_force_included])
574
575 gl_cv_libglib_use_included="$gl_cv_libglib_force_included"
576 LIBGLIB=
577 LTLIBGLIB=
578 INCGLIB=
579- ifelse([$1], [yes], , [
580- if test "$gl_cv_libglib_use_included" != yes; then
581- dnl Figure out whether we can use a preinstalled libglib-2.0, or have to use
582- dnl the included one.
583- AC_CACHE_VAL([gl_cv_libglib], [
584- gl_cv_libglib=no
585- gl_cv_LIBGLIB=
586- gl_cv_LTLIBGLIB=
587- gl_cv_INCGLIB=
588- gl_save_LIBS="$LIBS"
589- dnl Search for libglib2 and define LIBGLIB_2_0, LTLIBGLIB_2_0 and
590- dnl INCGLIB_2_0 accordingly.
591- dnl Don't use glib-config nor pkg-config, since it doesn't work when
592- dnl cross-compiling or when the C compiler in use is different from the
593- dnl one that built the library.
594- AC_LIB_LINKFLAGS_BODY([glib-2.0])
595- LIBS="$gl_save_LIBS $LIBGLIB_2_0"
596- AC_TRY_LINK([#include <glib.h>
597-#ifndef G_BEGIN_DECLS
598-error this glib.h includes a glibconfig.h from a glib version 1.x
599-#endif
600-],
601- [g_string_new ("foo");],
602- [gl_cv_libglib=yes
603- gl_cv_LIBGLIB="$LIBGLIB_2_0"
604- gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0"
605- ])
606- if test "$gl_cv_libglib" != yes; then
607- gl_save_CPPFLAGS="$CPPFLAGS"
608- CPPFLAGS="$CPPFLAGS $INCGLIB_2_0"
609- AC_TRY_LINK([#include <glib.h>
610-#ifndef G_BEGIN_DECLS
611-error this glib.h includes a glibconfig.h from a glib version 1.x
612-#endif
613-],
614- [g_string_new ("foo");],
615- [gl_cv_libglib=yes
616- gl_cv_LIBGLIB="$LIBGLIB_2_0"
617- gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0"
618- gl_cv_INCGLIB="$INCGLIB_2_0"
619- ])
620- if test "$gl_cv_libglib" != yes; then
621- dnl Often the include files are installed in /usr/include/glib-2.0
622- dnl and /usr/lib/glib-2.0/include.
623- if test -n "$LIBGLIB_2_0_PREFIX"; then
624- CPPFLAGS="$gl_save_CPPFLAGS -I$LIBGLIB_2_0_PREFIX/include/glib-2.0 -I$LIBGLIB_2_0_PREFIX/$acl_libdirstem/glib-2.0/include"
625- AC_TRY_LINK([#include <glib.h>
626-#ifndef G_BEGIN_DECLS
627-error this glib.h includes a glibconfig.h from a glib version 1.x
628-#endif
629-],
630- [g_string_new ("foo");],
631- [gl_cv_libglib=yes
632- gl_cv_LIBGLIB="$LIBGLIB_2_0"
633- gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0"
634- gl_cv_INCGLIB="-I$LIBGLIB_2_0_PREFIX/include/glib-2.0 -I$LIBGLIB_2_0_PREFIX/$acl_libdirstem/glib-2.0/include"
635- ])
636- fi
637- fi
638- CPPFLAGS="$gl_save_CPPFLAGS"
639- fi
640- LIBS="$gl_save_LIBS"
641- ])
642- AC_MSG_CHECKING([for glib])
643- AC_MSG_RESULT([$gl_cv_libglib])
644- if test $gl_cv_libglib = yes; then
645- LIBGLIB="$gl_cv_LIBGLIB"
646- LTLIBGLIB="$gl_cv_LTLIBGLIB"
647- INCGLIB="$gl_cv_INCGLIB"
648- else
649- gl_cv_libglib_use_included=yes
650- fi
651- fi
652- ])
653+ if test "$gl_cv_libglib_use_included" != yes; then
654+ PKG_CHECK_MODULES([GLIB], [glib-2.0])
655+ LIBGLIB="$GLIB_LIBS"
656+ LTLIBGLIB="$GLIB_LIBS"
657+ INCGLIB="$GLIB_CFLAGS"
658+ fi
659 AC_SUBST([LIBGLIB])
660 AC_SUBST([LTLIBGLIB])
661 AC_SUBST([INCGLIB])
662diff --git a/libtextstyle/lib/term-styled-ostream.c b/libtextstyle/lib/term-styled-ostream.c
663index 3675b5f..811e546 100644
664--- a/libtextstyle/lib/term-styled-ostream.c
665+++ b/libtextstyle/lib/term-styled-ostream.c
666@@ -28,15 +28,15 @@
667
668 #include <stdlib.h>
669
670-#include <cr-om-parser.h>
671-#include <cr-sel-eng.h>
672-#include <cr-style.h>
673-#include <cr-rgb.h>
674+#include <libcroco/cr-om-parser.h>
675+#include <libcroco/cr-sel-eng.h>
676+#include <libcroco/cr-style.h>
677+#include <libcroco/cr-rgb.h>
678 /* <cr-fonts.h> has a broken double-inclusion guard in libcroco-0.6.1. */
679 #ifndef __CR_FONTS_H__
680-# include <cr-fonts.h>
681+# include <libcroco/cr-fonts.h>
682 #endif
683-#include <cr-string.h>
684+#include <libcroco/cr-string.h>
685
686 #include "term-ostream.h"
687 #include "hash.h"
688diff --git a/libtextstyle/lib/term-styled-ostream.oo.c b/libtextstyle/lib/term-styled-ostream.oo.c
689index 2cfd4a8..d42c8b4 100644
690--- a/libtextstyle/lib/term-styled-ostream.oo.c
691+++ b/libtextstyle/lib/term-styled-ostream.oo.c
692@@ -22,15 +22,15 @@
693
694 #include <stdlib.h>
695
696-#include <cr-om-parser.h>
697-#include <cr-sel-eng.h>
698-#include <cr-style.h>
699-#include <cr-rgb.h>
700+#include <libcroco/cr-om-parser.h>
701+#include <libcroco/cr-sel-eng.h>
702+#include <libcroco/cr-style.h>
703+#include <libcroco/cr-rgb.h>
704 /* <cr-fonts.h> has a broken double-inclusion guard in libcroco-0.6.1. */
705 #ifndef __CR_FONTS_H__
706-# include <cr-fonts.h>
707+# include <libcroco/cr-fonts.h>
708 #endif
709-#include <cr-string.h>
710+#include <libcroco/cr-string.h>
711
712 #include "term-ostream.h"
713 #include "hash.h"