summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/gettext/gettext/use-pkgconfig.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/gettext/gettext/use-pkgconfig.patch')
-rw-r--r--meta/recipes-core/gettext/gettext/use-pkgconfig.patch391
1 files changed, 391 insertions, 0 deletions
diff --git a/meta/recipes-core/gettext/gettext/use-pkgconfig.patch b/meta/recipes-core/gettext/gettext/use-pkgconfig.patch
new file mode 100644
index 0000000000..ceb1856118
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext/use-pkgconfig.patch
@@ -0,0 +1,391 @@
1From 6aa1338b916fe72c200b6f160b934be15b6ff590 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 gettext-tools/gnulib-m4/libxml.m4 | 105 ++---------------------
17 libtextstyle/gnulib-local/m4/libglib.m4 | 106 +++---------------------
18 libtextstyle/gnulib-m4/libglib.m4 | 106 +++---------------------
19 3 files changed, 31 insertions(+), 286 deletions(-)
20
21diff --git a/gettext-tools/gnulib-m4/libxml.m4 b/gettext-tools/gnulib-m4/libxml.m4
22index 0340490..0355388 100644
23--- a/gettext-tools/gnulib-m4/libxml.m4
24+++ b/gettext-tools/gnulib-m4/libxml.m4
25@@ -13,6 +13,7 @@ dnl gl_LIBXML(FORCE-INCLUDED)
26 dnl forces the use of the included or an external libxml.
27 AC_DEFUN([gl_LIBXML],
28 [
29+ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
30 AC_REQUIRE([AM_ICONV_LINK])
31
32 ifelse([$1], , [
33@@ -30,106 +31,10 @@ AC_DEFUN([gl_LIBXML],
34 INCXML=
35 ifelse([$1], [yes], , [
36 if test "$gl_cv_libxml_use_included" != yes; then
37- dnl Figure out whether we can use a preinstalled libxml2, or have to use
38- dnl the included one.
39- AC_CACHE_VAL([gl_cv_libxml], [
40- gl_cv_libxml=no
41- gl_cv_LIBXML=
42- gl_cv_LTLIBXML=
43- gl_cv_INCXML=
44- gl_save_LIBS="$LIBS"
45- LIBS="$LIBS $LIBICONV"
46- dnl Search for libxml2 and define LIBXML2, LTLIBXML2 and INCXML2
47- dnl accordingly.
48- dnl Don't use xml2-config nor pkg-config, since it doesn't work when
49- dnl cross-compiling or when the C compiler in use is different from the
50- dnl one that built the library.
51- dnl Use a test program that tries to invoke xmlFree. On Cygwin 1.7.x,
52- dnl libxml2 is built in such a way that uses of xmlFree work fine with
53- dnl -Wl,--enable-auto-import but lead to a link error with
54- dnl -Wl,--disable-auto-import.
55- AC_LIB_LINKFLAGS_BODY([xml2])
56- LIBS="$gl_save_LIBS $LIBXML2 $LIBICONV"
57- AC_LINK_IFELSE(
58- [AC_LANG_PROGRAM(
59- [[#include <libxml/xmlversion.h>
60- #include <libxml/xmlmemory.h>
61- #include <libxml/xpath.h>
62- ]],
63- [[xmlCheckVersion (0);
64- xmlFree ((void *) 0);
65- xmlXPathSetContextNode ((void *)0, (void *)0);
66- ]])],
67- [gl_cv_libxml=yes
68- gl_cv_LIBXML="$LIBXML2 $LIBICONV"
69- gl_cv_LTLIBXML="$LTLIBXML2 $LTLIBICONV"
70- ])
71- if test "$gl_cv_libxml" != yes; then
72- gl_save_CPPFLAGS="$CPPFLAGS"
73- CPPFLAGS="$CPPFLAGS $INCXML2"
74- AC_LINK_IFELSE(
75- [AC_LANG_PROGRAM(
76- [[#include <libxml/xmlversion.h>
77- #include <libxml/xmlmemory.h>
78- #include <libxml/xpath.h>
79- ]],
80- [[xmlCheckVersion (0);
81- xmlFree ((void *) 0);
82- xmlXPathSetContextNode ((void *)0, (void *)0);
83- ]])],
84- [gl_cv_libxml=yes
85- gl_cv_LIBXML="$LIBXML2 $LIBICONV"
86- gl_cv_LTLIBXML="$LTLIBXML2 $LTLIBICONV"
87- gl_cv_INCXML="$INCXML2"
88- ])
89- if test "$gl_cv_libxml" != yes; then
90- dnl Often the include files are installed in /usr/include/libxml2.
91- dnl In libxml2-2.5, <libxml/xmlversion.h> is self-contained.
92- dnl In libxml2-2.6, it includes <libxml/xmlexports.h> which is
93- dnl self-contained.
94- libxml2_include_dir=
95- AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <libxml2/libxml/xmlexports.h>]])],
96- [gl_ABSOLUTE_HEADER([libxml2/libxml/xmlexports.h])
97- libxml2_include_dir=`echo "$gl_cv_absolute_libxml2_libxml_xmlexports_h" | sed -e 's,.libxml.xmlexports\.h$,,'`
98- ])
99- if test -z "$libxml2_include_dir"; then
100- AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <libxml2/libxml/xmlversion.h>]])],
101- [gl_ABSOLUTE_HEADER([libxml2/libxml/xmlversion.h])
102- libxml2_include_dir=`echo "$gl_cv_absolute_libxml2_libxml_xmlversion_h" | sed -e 's,.libxml.xmlversion\.h$,,'`
103- ])
104- fi
105- if test -n "$libxml2_include_dir" && test -d "$libxml2_include_dir"; then
106- CPPFLAGS="$gl_save_CPPFLAGS -I$libxml2_include_dir"
107- AC_LINK_IFELSE(
108- [AC_LANG_PROGRAM(
109- [[#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/m4/libglib.m4 b/libtextstyle/gnulib-local/m4/libglib.m4
145index dbc9eb8..136e512 100644
146--- a/libtextstyle/gnulib-local/m4/libglib.m4
147+++ b/libtextstyle/gnulib-local/m4/libglib.m4
148@@ -6,106 +6,26 @@ dnl with or without modifications, as long as this notice is preserved.
149
150 dnl From Bruno Haible.
151
152-dnl gl_LIBGLIB
153-dnl gives the user the option to decide whether to use the included or
154-dnl an external libglib.
155-dnl gl_LIBGLIB(FORCE-INCLUDED)
156-dnl forces the use of the included or an external libglib.
157 AC_DEFUN([gl_LIBGLIB],
158 [
159- ifelse([$1], , [
160- AC_MSG_CHECKING([whether included glib is requested])
161- AC_ARG_WITH([included-glib],
162- [ --with-included-glib use the glib2 included here],
163- [gl_cv_libglib_force_included=$withval],
164- [gl_cv_libglib_force_included=no])
165- AC_MSG_RESULT([$gl_cv_libglib_force_included])
166- ], [gl_cv_libglib_force_included=$1])
167+ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
168+ AC_MSG_CHECKING([whether included glib is requested])
169+ AC_ARG_WITH([included-glib],
170+ [ --with-included-glib use the glib2 included here],
171+ [gl_cv_libglib_force_included=$withval],
172+ [gl_cv_libglib_force_included=no])
173+ AC_MSG_RESULT([$gl_cv_libglib_force_included])
174
175 gl_cv_libglib_use_included="$gl_cv_libglib_force_included"
176 LIBGLIB=
177 LTLIBGLIB=
178 INCGLIB=
179- ifelse([$1], [yes], , [
180- if test "$gl_cv_libglib_use_included" != yes; then
181- dnl Figure out whether we can use a preinstalled libglib-2.0, or have to use
182- dnl the included one.
183- AC_CACHE_VAL([gl_cv_libglib], [
184- gl_cv_libglib=no
185- gl_cv_LIBGLIB=
186- gl_cv_LTLIBGLIB=
187- gl_cv_INCGLIB=
188- gl_save_LIBS="$LIBS"
189- dnl Search for libglib2 and define LIBGLIB_2_0, LTLIBGLIB_2_0 and
190- dnl INCGLIB_2_0 accordingly.
191- dnl Don't use glib-config nor pkg-config, since it doesn't work when
192- dnl cross-compiling or when the C compiler in use is different from the
193- dnl one that built the library.
194- AC_LIB_LINKFLAGS_BODY([glib-2.0])
195- LIBS="$gl_save_LIBS $LIBGLIB_2_0"
196- AC_LINK_IFELSE(
197- [AC_LANG_PROGRAM(
198- [[#include <glib.h>
199- #ifndef G_BEGIN_DECLS
200- error this glib.h includes a glibconfig.h from a glib version 1.x
201- #endif
202- ]],
203- [[g_string_new ("foo");]])],
204- [gl_cv_libglib=yes
205- gl_cv_LIBGLIB="$LIBGLIB_2_0"
206- gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0"
207- ])
208- if test "$gl_cv_libglib" != yes; then
209- gl_save_CPPFLAGS="$CPPFLAGS"
210- CPPFLAGS="$CPPFLAGS $INCGLIB_2_0"
211- AC_LINK_IFELSE(
212- [AC_LANG_PROGRAM(
213- [[#include <glib.h>
214- #ifndef G_BEGIN_DECLS
215- error this glib.h includes a glibconfig.h from a glib version 1.x
216- #endif
217- ]],
218- [[g_string_new ("foo");]])],
219- [gl_cv_libglib=yes
220- gl_cv_LIBGLIB="$LIBGLIB_2_0"
221- gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0"
222- gl_cv_INCGLIB="$INCGLIB_2_0"
223- ])
224- if test "$gl_cv_libglib" != yes; then
225- dnl Often the include files are installed in /usr/include/glib-2.0
226- dnl and /usr/lib/glib-2.0/include.
227- if test -n "$LIBGLIB_2_0_PREFIX"; then
228- CPPFLAGS="$gl_save_CPPFLAGS -I$LIBGLIB_2_0_PREFIX/include/glib-2.0 -I$LIBGLIB_2_0_PREFIX/$acl_libdirstem/glib-2.0/include"
229- AC_LINK_IFELSE(
230- [AC_LANG_PROGRAM(
231- [[#include <glib.h>
232- #ifndef G_BEGIN_DECLS
233- error this glib.h includes a glibconfig.h from a glib version 1.x
234- #endif
235- ]],
236- [[g_string_new ("foo");]])],
237- [gl_cv_libglib=yes
238- gl_cv_LIBGLIB="$LIBGLIB_2_0"
239- gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0"
240- gl_cv_INCGLIB="-I$LIBGLIB_2_0_PREFIX/include/glib-2.0 -I$LIBGLIB_2_0_PREFIX/$acl_libdirstem/glib-2.0/include"
241- ])
242- fi
243- fi
244- CPPFLAGS="$gl_save_CPPFLAGS"
245- fi
246- LIBS="$gl_save_LIBS"
247- ])
248- AC_MSG_CHECKING([for glib])
249- AC_MSG_RESULT([$gl_cv_libglib])
250- if test $gl_cv_libglib = yes; then
251- LIBGLIB="$gl_cv_LIBGLIB"
252- LTLIBGLIB="$gl_cv_LTLIBGLIB"
253- INCGLIB="$gl_cv_INCGLIB"
254- else
255- gl_cv_libglib_use_included=yes
256- fi
257- fi
258- ])
259+ if test "$gl_cv_libglib_use_included" != yes; then
260+ PKG_CHECK_MODULES([GLIB], [glib-2.0])
261+ LIBGLIB="$GLIB_LIBS"
262+ LTLIBGLIB="$GLIB_LIBS"
263+ INCGLIB="$GLIB_CFLAGS"
264+ fi
265 AC_SUBST([LIBGLIB])
266 AC_SUBST([LTLIBGLIB])
267 AC_SUBST([INCGLIB])
268diff --git a/libtextstyle/gnulib-m4/libglib.m4 b/libtextstyle/gnulib-m4/libglib.m4
269index dbc9eb8..136e512 100644
270--- a/libtextstyle/gnulib-m4/libglib.m4
271+++ b/libtextstyle/gnulib-m4/libglib.m4
272@@ -6,106 +6,26 @@ dnl with or without modifications, as long as this notice is preserved.
273
274 dnl From Bruno Haible.
275
276-dnl gl_LIBGLIB
277-dnl gives the user the option to decide whether to use the included or
278-dnl an external libglib.
279-dnl gl_LIBGLIB(FORCE-INCLUDED)
280-dnl forces the use of the included or an external libglib.
281 AC_DEFUN([gl_LIBGLIB],
282 [
283- ifelse([$1], , [
284- AC_MSG_CHECKING([whether included glib is requested])
285- AC_ARG_WITH([included-glib],
286- [ --with-included-glib use the glib2 included here],
287- [gl_cv_libglib_force_included=$withval],
288- [gl_cv_libglib_force_included=no])
289- AC_MSG_RESULT([$gl_cv_libglib_force_included])
290- ], [gl_cv_libglib_force_included=$1])
291+ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
292+ AC_MSG_CHECKING([whether included glib is requested])
293+ AC_ARG_WITH([included-glib],
294+ [ --with-included-glib use the glib2 included here],
295+ [gl_cv_libglib_force_included=$withval],
296+ [gl_cv_libglib_force_included=no])
297+ AC_MSG_RESULT([$gl_cv_libglib_force_included])
298
299 gl_cv_libglib_use_included="$gl_cv_libglib_force_included"
300 LIBGLIB=
301 LTLIBGLIB=
302 INCGLIB=
303- ifelse([$1], [yes], , [
304- if test "$gl_cv_libglib_use_included" != yes; then
305- dnl Figure out whether we can use a preinstalled libglib-2.0, or have to use
306- dnl the included one.
307- AC_CACHE_VAL([gl_cv_libglib], [
308- gl_cv_libglib=no
309- gl_cv_LIBGLIB=
310- gl_cv_LTLIBGLIB=
311- gl_cv_INCGLIB=
312- gl_save_LIBS="$LIBS"
313- dnl Search for libglib2 and define LIBGLIB_2_0, LTLIBGLIB_2_0 and
314- dnl INCGLIB_2_0 accordingly.
315- dnl Don't use glib-config nor pkg-config, since it doesn't work when
316- dnl cross-compiling or when the C compiler in use is different from the
317- dnl one that built the library.
318- AC_LIB_LINKFLAGS_BODY([glib-2.0])
319- LIBS="$gl_save_LIBS $LIBGLIB_2_0"
320- AC_LINK_IFELSE(
321- [AC_LANG_PROGRAM(
322- [[#include <glib.h>
323- #ifndef G_BEGIN_DECLS
324- error this glib.h includes a glibconfig.h from a glib version 1.x
325- #endif
326- ]],
327- [[g_string_new ("foo");]])],
328- [gl_cv_libglib=yes
329- gl_cv_LIBGLIB="$LIBGLIB_2_0"
330- gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0"
331- ])
332- if test "$gl_cv_libglib" != yes; then
333- gl_save_CPPFLAGS="$CPPFLAGS"
334- CPPFLAGS="$CPPFLAGS $INCGLIB_2_0"
335- AC_LINK_IFELSE(
336- [AC_LANG_PROGRAM(
337- [[#include <glib.h>
338- #ifndef G_BEGIN_DECLS
339- error this glib.h includes a glibconfig.h from a glib version 1.x
340- #endif
341- ]],
342- [[g_string_new ("foo");]])],
343- [gl_cv_libglib=yes
344- gl_cv_LIBGLIB="$LIBGLIB_2_0"
345- gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0"
346- gl_cv_INCGLIB="$INCGLIB_2_0"
347- ])
348- if test "$gl_cv_libglib" != yes; then
349- dnl Often the include files are installed in /usr/include/glib-2.0
350- dnl and /usr/lib/glib-2.0/include.
351- if test -n "$LIBGLIB_2_0_PREFIX"; then
352- CPPFLAGS="$gl_save_CPPFLAGS -I$LIBGLIB_2_0_PREFIX/include/glib-2.0 -I$LIBGLIB_2_0_PREFIX/$acl_libdirstem/glib-2.0/include"
353- AC_LINK_IFELSE(
354- [AC_LANG_PROGRAM(
355- [[#include <glib.h>
356- #ifndef G_BEGIN_DECLS
357- error this glib.h includes a glibconfig.h from a glib version 1.x
358- #endif
359- ]],
360- [[g_string_new ("foo");]])],
361- [gl_cv_libglib=yes
362- gl_cv_LIBGLIB="$LIBGLIB_2_0"
363- gl_cv_LTLIBGLIB="$LTLIBGLIB_2_0"
364- gl_cv_INCGLIB="-I$LIBGLIB_2_0_PREFIX/include/glib-2.0 -I$LIBGLIB_2_0_PREFIX/$acl_libdirstem/glib-2.0/include"
365- ])
366- fi
367- fi
368- CPPFLAGS="$gl_save_CPPFLAGS"
369- fi
370- LIBS="$gl_save_LIBS"
371- ])
372- AC_MSG_CHECKING([for glib])
373- AC_MSG_RESULT([$gl_cv_libglib])
374- if test $gl_cv_libglib = yes; then
375- LIBGLIB="$gl_cv_LIBGLIB"
376- LTLIBGLIB="$gl_cv_LTLIBGLIB"
377- INCGLIB="$gl_cv_INCGLIB"
378- else
379- gl_cv_libglib_use_included=yes
380- fi
381- fi
382- ])
383+ if test "$gl_cv_libglib_use_included" != yes; then
384+ PKG_CHECK_MODULES([GLIB], [glib-2.0])
385+ LIBGLIB="$GLIB_LIBS"
386+ LTLIBGLIB="$GLIB_LIBS"
387+ INCGLIB="$GLIB_CFLAGS"
388+ fi
389 AC_SUBST([LIBGLIB])
390 AC_SUBST([LTLIBGLIB])
391 AC_SUBST([INCGLIB])