summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/gettext/gettext-0.20.1/use-pkgconfig.patch
blob: d3f3fe8e2f97ed18cd7b2122f57c1d60cd2a5032 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
From ef414b06be80c6f605731abc9e674e396b80ec9e Mon Sep 17 00:00:00 2001
From: Ross Burton <ross.burton@intel.com>
Date: Tue, 23 Jan 2018 00:54:13 +0000
Subject: [PATCH] gettext: beat library detection into shape

For reasons which I just can't fathom gnulib doesn't use the expected tools to
find libraries but badly reinvents the wheel.  This will trivially lead to host
contamination (explicit searches of /usr/lib) or incorrect RPATHs (bad
canonicalisation resulting in relative paths).

Simply delete all the crazy, and replace with a single call to pkg-config.

Upstream-Status: Inappropriate [upstream still refuse to consider pkg-config]
Signed-off-by: Ross Burton <ross.burton@intel.com>

---
 gettext-tools/gnulib-m4/libxml.m4             |  99 +----------------
 .../gnulib-local/lib/term-styled-ostream.oo.c |  12 +-
 libtextstyle/gnulib-local/m4/libcroco.m4      |  99 +++--------------
 libtextstyle/gnulib-local/m4/libglib.m4       | 104 +++---------------
 libtextstyle/gnulib-m4/libcroco.m4            |  99 +++--------------
 libtextstyle/gnulib-m4/libglib.m4             | 104 +++---------------
 libtextstyle/lib/term-styled-ostream.c        |  12 +-
 libtextstyle/lib/term-styled-ostream.oo.c     |  12 +-
 8 files changed, 87 insertions(+), 454 deletions(-)

diff --git a/gettext-tools/gnulib-m4/libxml.m4 b/gettext-tools/gnulib-m4/libxml.m4
index 05b9550..031ee65 100644
--- a/gettext-tools/gnulib-m4/libxml.m4
+++ b/gettext-tools/gnulib-m4/libxml.m4
@@ -13,6 +13,7 @@ dnl gl_LIBXML(FORCE-INCLUDED)
 dnl   forces the use of the included or an external libxml.
 AC_DEFUN([gl_LIBXML],
 [
+  AC_REQUIRE([PKG_PROG_PKG_CONFIG])
   AC_REQUIRE([AM_ICONV_LINK])
 
   ifelse([$1], , [
@@ -30,100 +31,10 @@ AC_DEFUN([gl_LIBXML],
   INCXML=
   ifelse([$1], [yes], , [
     if test "$gl_cv_libxml_use_included" != yes; then
-      dnl Figure out whether we can use a preinstalled libxml2, or have to use
-      dnl the included one.
-      AC_CACHE_VAL([gl_cv_libxml], [
-        gl_cv_libxml=no
-        gl_cv_LIBXML=
-        gl_cv_LTLIBXML=
-        gl_cv_INCXML=
-        gl_save_LIBS="$LIBS"
-        LIBS="$LIBS $LIBICONV"
-        dnl Search for libxml2 and define LIBXML2, LTLIBXML2 and INCXML2
-        dnl accordingly.
-        dnl Don't use xml2-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.
-        dnl Use a test program that tries to invoke xmlFree. On Cygwin 1.7.x,
-        dnl libxml2 is built in such a way that uses of xmlFree work fine with
-        dnl -Wl,--enable-auto-import but lead to a link error with
-        dnl -Wl,--disable-auto-import.
-        AC_LIB_LINKFLAGS_BODY([xml2])
-        LIBS="$gl_save_LIBS $LIBXML2 $LIBICONV"
-        AC_TRY_LINK([#include <libxml/xmlversion.h>
-                     #include <libxml/xmlmemory.h>
-                     #include <libxml/xpath.h>
-                    ],
-          [xmlCheckVersion (0);
-           xmlFree ((void *) 0);
-           xmlXPathSetContextNode ((void *)0, (void *)0);
-          ],
-          [gl_cv_libxml=yes
-           gl_cv_LIBXML="$LIBXML2 $LIBICONV"
-           gl_cv_LTLIBXML="$LTLIBXML2 $LTLIBICONV"
-          ])
-        if test "$gl_cv_libxml" != yes; then
-          gl_save_CPPFLAGS="$CPPFLAGS"
-          CPPFLAGS="$CPPFLAGS $INCXML2"
-          AC_TRY_LINK([#include <libxml/xmlversion.h>
-                       #include <libxml/xmlmemory.h>
-                       #include <libxml/xpath.h>
-                      ],
-            [xmlCheckVersion (0);
-             xmlFree ((void *) 0);
-             xmlXPathSetContextNode ((void *)0, (void *)0);
-            ],
-            [gl_cv_libxml=yes
-             gl_cv_LIBXML="$LIBXML2 $LIBICONV"
-             gl_cv_LTLIBXML="$LTLIBXML2 $LTLIBICONV"
-             gl_cv_INCXML="$INCXML2"
-            ])
-          if test "$gl_cv_libxml" != yes; then
-            dnl Often the include files are installed in /usr/include/libxml2.
-            dnl In libxml2-2.5, <libxml/xmlversion.h> is self-contained.
-            dnl In libxml2-2.6, it includes <libxml/xmlexports.h> which is
-            dnl self-contained.
-            libxml2_include_dir=
-            AC_TRY_CPP([#include <libxml2/libxml/xmlexports.h>],
-              [gl_ABSOLUTE_HEADER([libxml2/libxml/xmlexports.h])
-               libxml2_include_dir=`echo "$gl_cv_absolute_libxml2_libxml_xmlexports_h" | sed -e 's,.libxml.xmlexports\.h$,,'`
-              ])
-            if test -z "$libxml2_include_dir"; then
-              AC_TRY_CPP([#include <libxml2/libxml/xmlversion.h>],
-                [gl_ABSOLUTE_HEADER([libxml2/libxml/xmlversion.h])
-                 libxml2_include_dir=`echo "$gl_cv_absolute_libxml2_libxml_xmlversion_h" | sed -e 's,.libxml.xmlversion\.h$,,'`
-                ])
-            fi
-            if test -n "$libxml2_include_dir" && test -d "$libxml2_include_dir"; then
-              CPPFLAGS="$gl_save_CPPFLAGS -I$libxml2_include_dir"
-              AC_TRY_LINK([#include <libxml/xmlversion.h>
-                           #include <libxml/xmlmemory.h>
-                           #include <libxml/xpath.h>
-                          ],
-                [xmlCheckVersion (0);
-                 xmlFree ((void *) 0);
-                 xmlXPathSetContextNode ((void *)0, (void *)0);
-                ],
-                [gl_cv_libxml=yes
-                 gl_cv_LIBXML="$LIBXML2 $LIBICONV"
-                 gl_cv_LTLIBXML="$LTLIBXML2 $LTLIBICONV"
-                 gl_cv_INCXML="-I$libxml2_include_dir"
-                ])
-            fi
-          fi
-          CPPFLAGS="$gl_save_CPPFLAGS"
-        fi
-        LIBS="$gl_save_LIBS"
-      ])
-      AC_MSG_CHECKING([for libxml])
-      AC_MSG_RESULT([$gl_cv_libxml])
-      if test $gl_cv_libxml = yes; then
-        LIBXML="$gl_cv_LIBXML"
-        LTLIBXML="$gl_cv_LTLIBXML"
-        INCXML="$gl_cv_INCXML"
-      else
-        gl_cv_libxml_use_included=yes
-      fi
+      PKG_CHECK_MODULES([XML], [libxml-2.0])
+      LIBXML=$XML_LIBS
+      LTLIBXML=$XML_LIBS
+      INCXML=$XML_CFLAGS
     fi
   ])
   AC_SUBST([LIBXML])
diff --git a/libtextstyle/gnulib-local/lib/term-styled-ostream.oo.c b/libtextstyle/gnulib-local/lib/term-styled-ostream.oo.c
index 2cfd4a8..d42c8b4 100644
--- a/libtextstyle/gnulib-local/lib/term-styled-ostream.oo.c
+++ b/libtextstyle/gnulib-local/lib/term-styled-ostream.oo.c
@@ -22,15 +22,15 @@
 
 #include <stdlib.h>
 
-#include <cr-om-parser.h>
-#include <cr-sel-eng.h>
-#include <cr-style.h>
-#include <cr-rgb.h>
+#include <libcroco/cr-om-parser.h>
+#include <libcroco/cr-sel-eng.h>
+#include <libcroco/cr-style.h>
+#include <libcroco/cr-rgb.h>
 /* <cr-fonts.h> has a broken double-inclusion guard in libcroco-0.6.1.  */
 #ifndef __CR_FONTS_H__
-# include <cr-fonts.h>
+# include <libcroco/cr-fonts.h>
 #endif
-#include <cr-string.h>
+#include <libcroco/cr-string.h>
 
 #include "term-ostream.h"
 #include "hash.h"
diff --git a/libtextstyle/gnulib-local/m4/libcroco.m4 b/libtextstyle/gnulib-local/m4/libcroco.m4
index bc53cc6..10b2455 100644
--- a/libtextstyle/gnulib-local/m4/libcroco.m4
+++ b/libtextstyle/gnulib-local/m4/libcroco.m4
@@ -1,99 +1,34 @@
-# libcroco.m4 serial 3
-dnl Copyright (C) 2006-2007, 2019 Free Software Foundation, Inc.
+# libcroco.m4 serial 2 (gettext-0.17)
+dnl Copyright (C) 2006, 2015-2016 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],
 [
-  ifelse([$1], [yes], , [
-    dnl libcroco depends on libglib.
-    AC_REQUIRE([gl_LIBGLIB])
-  ])
+  AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+  dnl libcroco depends on libglib.
+  AC_REQUIRE([gl_LIBGLIB])
 
-  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])
+  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_use_included="$gl_cv_libcroco_force_included"
   LIBCROCO=
   LTLIBCROCO=
   INCCROCO=
-  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"
-          ])
-        if test "$gl_cv_libcroco" != yes; then
-          gl_save_CPPFLAGS="$CPPFLAGS"
-          CPPFLAGS="$CPPFLAGS $INCCROCO_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>],
-              [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
-        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
-  ])
+  if test "$gl_cv_libcroco_use_included" != yes; then
+    PKG_CHECK_MODULES([CROCO], [libcroco-0.6])
+    LIBCROCO=$CROCO_LIBS
+    LTLIBCROCO=$CROCO_LIBS
+    INCCROCO=$CROCO_CFLAGS
+  fi
   AC_SUBST([LIBCROCO])
   AC_SUBST([LTLIBCROCO])
   AC_SUBST([INCCROCO])
diff --git a/libtextstyle/gnulib-local/m4/libglib.m4 b/libtextstyle/gnulib-local/m4/libglib.m4
index bef6fa3..8841755 100644
--- a/libtextstyle/gnulib-local/m4/libglib.m4
+++ b/libtextstyle/gnulib-local/m4/libglib.m4
@@ -1,105 +1,31 @@
-# libglib.m4 serial 4
-dnl Copyright (C) 2006-2007, 2019 Free Software Foundation, Inc.
+# libglib.m4 serial 3 (gettext-0.17)
+dnl Copyright (C) 2006-2007, 2015-2016 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],
 [
-  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])
+  AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+  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_use_included="$gl_cv_libglib_force_included"
   LIBGLIB=
   LTLIBGLIB=
   INCGLIB=
-  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 <glib.h>
-#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"
-          AC_TRY_LINK([#include <glib.h>
-#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="$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 <glib.h>
-#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
-        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
-  ])
+  if test "$gl_cv_libglib_use_included" != yes; then
+    PKG_CHECK_MODULES([GLIB], [glib-2.0])
+    LIBGLIB="$GLIB_LIBS"
+    LTLIBGLIB="$GLIB_LIBS"
+    INCGLIB="$GLIB_CFLAGS"
+  fi
   AC_SUBST([LIBGLIB])
   AC_SUBST([LTLIBGLIB])
   AC_SUBST([INCGLIB])
diff --git a/libtextstyle/gnulib-m4/libcroco.m4 b/libtextstyle/gnulib-m4/libcroco.m4
index bc53cc6..10b2455 100644
--- a/libtextstyle/gnulib-m4/libcroco.m4
+++ b/libtextstyle/gnulib-m4/libcroco.m4
@@ -1,99 +1,34 @@
-# libcroco.m4 serial 3
-dnl Copyright (C) 2006-2007, 2019 Free Software Foundation, Inc.
+# libcroco.m4 serial 2 (gettext-0.17)
+dnl Copyright (C) 2006, 2015-2016 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],
 [
-  ifelse([$1], [yes], , [
-    dnl libcroco depends on libglib.
-    AC_REQUIRE([gl_LIBGLIB])
-  ])
+  AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+  dnl libcroco depends on libglib.
+  AC_REQUIRE([gl_LIBGLIB])
 
-  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])
+  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_use_included="$gl_cv_libcroco_force_included"
   LIBCROCO=
   LTLIBCROCO=
   INCCROCO=
-  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"
-          ])
-        if test "$gl_cv_libcroco" != yes; then
-          gl_save_CPPFLAGS="$CPPFLAGS"
-          CPPFLAGS="$CPPFLAGS $INCCROCO_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>],
-              [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
-        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
-  ])
+  if test "$gl_cv_libcroco_use_included" != yes; then
+    PKG_CHECK_MODULES([CROCO], [libcroco-0.6])
+    LIBCROCO=$CROCO_LIBS
+    LTLIBCROCO=$CROCO_LIBS
+    INCCROCO=$CROCO_CFLAGS
+  fi
   AC_SUBST([LIBCROCO])
   AC_SUBST([LTLIBCROCO])
   AC_SUBST([INCCROCO])
diff --git a/libtextstyle/gnulib-m4/libglib.m4 b/libtextstyle/gnulib-m4/libglib.m4
index bef6fa3..8841755 100644
--- a/libtextstyle/gnulib-m4/libglib.m4
+++ b/libtextstyle/gnulib-m4/libglib.m4
@@ -1,105 +1,31 @@
-# libglib.m4 serial 4
-dnl Copyright (C) 2006-2007, 2019 Free Software Foundation, Inc.
+# libglib.m4 serial 3 (gettext-0.17)
+dnl Copyright (C) 2006-2007, 2015-2016 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],
 [
-  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])
+  AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+  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_use_included="$gl_cv_libglib_force_included"
   LIBGLIB=
   LTLIBGLIB=
   INCGLIB=
-  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 <glib.h>
-#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"
-          AC_TRY_LINK([#include <glib.h>
-#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="$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 <glib.h>
-#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
-        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
-  ])
+  if test "$gl_cv_libglib_use_included" != yes; then
+    PKG_CHECK_MODULES([GLIB], [glib-2.0])
+    LIBGLIB="$GLIB_LIBS"
+    LTLIBGLIB="$GLIB_LIBS"
+    INCGLIB="$GLIB_CFLAGS"
+  fi
   AC_SUBST([LIBGLIB])
   AC_SUBST([LTLIBGLIB])
   AC_SUBST([INCGLIB])
diff --git a/libtextstyle/lib/term-styled-ostream.c b/libtextstyle/lib/term-styled-ostream.c
index 3675b5f..811e546 100644
--- a/libtextstyle/lib/term-styled-ostream.c
+++ b/libtextstyle/lib/term-styled-ostream.c
@@ -28,15 +28,15 @@
 
 #include <stdlib.h>
 
-#include <cr-om-parser.h>
-#include <cr-sel-eng.h>
-#include <cr-style.h>
-#include <cr-rgb.h>
+#include <libcroco/cr-om-parser.h>
+#include <libcroco/cr-sel-eng.h>
+#include <libcroco/cr-style.h>
+#include <libcroco/cr-rgb.h>
 /* <cr-fonts.h> has a broken double-inclusion guard in libcroco-0.6.1.  */
 #ifndef __CR_FONTS_H__
-# include <cr-fonts.h>
+# include <libcroco/cr-fonts.h>
 #endif
-#include <cr-string.h>
+#include <libcroco/cr-string.h>
 
 #include "term-ostream.h"
 #include "hash.h"
diff --git a/libtextstyle/lib/term-styled-ostream.oo.c b/libtextstyle/lib/term-styled-ostream.oo.c
index 2cfd4a8..d42c8b4 100644
--- a/libtextstyle/lib/term-styled-ostream.oo.c
+++ b/libtextstyle/lib/term-styled-ostream.oo.c
@@ -22,15 +22,15 @@
 
 #include <stdlib.h>
 
-#include <cr-om-parser.h>
-#include <cr-sel-eng.h>
-#include <cr-style.h>
-#include <cr-rgb.h>
+#include <libcroco/cr-om-parser.h>
+#include <libcroco/cr-sel-eng.h>
+#include <libcroco/cr-style.h>
+#include <libcroco/cr-rgb.h>
 /* <cr-fonts.h> has a broken double-inclusion guard in libcroco-0.6.1.  */
 #ifndef __CR_FONTS_H__
-# include <cr-fonts.h>
+# include <libcroco/cr-fonts.h>
 #endif
-#include <cr-string.h>
+#include <libcroco/cr-string.h>
 
 #include "term-ostream.h"
 #include "hash.h"