summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/gettext/gettext
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/gettext/gettext')
-rw-r--r--meta/recipes-core/gettext/gettext/0001-init-env.in-do-not-add-C-CXX-parameters.patch29
-rw-r--r--meta/recipes-core/gettext/gettext/0001-tests-autopoint-3-unset-MAKEFLAGS.patch26
-rw-r--r--meta/recipes-core/gettext/gettext/parallel.patch31
-rw-r--r--meta/recipes-core/gettext/gettext/run-ptest6
-rw-r--r--meta/recipes-core/gettext/gettext/serial-tests-config.patch55
-rw-r--r--meta/recipes-core/gettext/gettext/use-pkgconfig.patch391
6 files changed, 538 insertions, 0 deletions
diff --git a/meta/recipes-core/gettext/gettext/0001-init-env.in-do-not-add-C-CXX-parameters.patch b/meta/recipes-core/gettext/gettext/0001-init-env.in-do-not-add-C-CXX-parameters.patch
new file mode 100644
index 0000000000..33d45a038c
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext/0001-init-env.in-do-not-add-C-CXX-parameters.patch
@@ -0,0 +1,29 @@
1From c58c503c532d20883a93ef778327c86dd6de24f6 Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Fri, 6 Mar 2020 21:04:05 +0000
4Subject: [PATCH] init-env.in: do not add C/CXX parameters
5
6These are taken from the cross environment and include
7sysroot paths, so are not reproducible.
8
9Upstream-Status: Inappropriate [oe-core specific]
10Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
11---
12 gettext-tools/tests/init-env.in | 4 ----
13 1 file changed, 4 deletions(-)
14
15diff --git a/gettext-tools/tests/init-env.in b/gettext-tools/tests/init-env.in
16index cc84ffd..b69c990 100644
17--- a/gettext-tools/tests/init-env.in
18+++ b/gettext-tools/tests/init-env.in
19@@ -3,10 +3,6 @@ top_builddir=../..
20
21 OBJEXT="@OBJEXT@"
22 EXEEXT="@EXEEXT@"
23-CC="@CC@"
24-CFLAGS="@CFLAGS@"
25-CXX="@CXX@"
26-CXXFLAGS="@CXXFLAGS@"
27 CPPFLAGS="@CPPFLAGS@"
28 LDFLAGS="@LDFLAGS@"
29 LTLIBINTL="@LTLIBINTL@"
diff --git a/meta/recipes-core/gettext/gettext/0001-tests-autopoint-3-unset-MAKEFLAGS.patch b/meta/recipes-core/gettext/gettext/0001-tests-autopoint-3-unset-MAKEFLAGS.patch
new file mode 100644
index 0000000000..94afb255c3
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext/0001-tests-autopoint-3-unset-MAKEFLAGS.patch
@@ -0,0 +1,26 @@
1From 7006142d199af13628edc687847a9a5bac48b45d Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Tue, 7 Jan 2020 16:44:38 +0100
4Subject: [PATCH] tests/autopoint-3: unset MAKEFLAGS
5
6This is needed when running ptests, as the MAKEFLAGS value (set up by run-ptest)
7is messing up the test.
8
9Upstream-Status: Inappropriate [oe-core specific]
10Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
11---
12 gettext-tools/tests/autopoint-3 | 1 +
13 1 file changed, 1 insertion(+)
14
15diff --git a/gettext-tools/tests/autopoint-3 b/gettext-tools/tests/autopoint-3
16index bd3fbf3..380eaac 100755
17--- a/gettext-tools/tests/autopoint-3
18+++ b/gettext-tools/tests/autopoint-3
19@@ -131,6 +131,7 @@ test $? = 0 || { cat autopoint.err; Exit 1; }
20 ${CONFIG_SHELL} ./configure >/dev/null 2>autpoint.err
21 test $? = 0 || { cat autopoint.err; Exit 1; }
22
23+unset MAKEFLAGS
24 ${MAKE} >/dev/null 2>autopoint.err
25 test $? = 0 || { cat autopoint.err; Exit 1; }
26
diff --git a/meta/recipes-core/gettext/gettext/parallel.patch b/meta/recipes-core/gettext/gettext/parallel.patch
new file mode 100644
index 0000000000..8ecba46fd0
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext/parallel.patch
@@ -0,0 +1,31 @@
1From 83333bc873c2655ff1de161f6b7db930f22f1cea Mon Sep 17 00:00:00 2001
2From: Joe Slater <jslater@windriver.com>
3Date: Thu, 7 Jun 2012 16:37:01 -0700
4Subject: [PATCH] instal libgettextlib.a before removing it
5
6In a multiple job build, Makefile can simultaneously
7be installing and removing libgettextlib.a. We serialize
8the operations.
9
10Upstream-Status: Pending
11
12Signed-off-by: Joe Slater <jslater@windriver.com>
13---
14 gettext-tools/gnulib-lib/Makefile.am | 4 ++++
15 1 file changed, 4 insertions(+)
16
17diff --git a/gettext-tools/gnulib-lib/Makefile.am b/gettext-tools/gnulib-lib/Makefile.am
18index ab729cd..a0d713e 100644
19--- a/gettext-tools/gnulib-lib/Makefile.am
20+++ b/gettext-tools/gnulib-lib/Makefile.am
21@@ -58,6 +58,10 @@ AM_CFLAGS = @WARN_CFLAGS@
22 # Rules generated and collected by gnulib-tool.
23 include Makefile.gnulib
24
25+# defined in Makefile.gnulib but missing this dependency
26+#
27+install-exec-clean: install-libLTLIBRARIES
28+
29 # OS/2 does not support a DLL name longer than 8 characters.
30 if OS2
31 libgettextlib_la_LDFLAGS += -os2dllname gtlib
diff --git a/meta/recipes-core/gettext/gettext/run-ptest b/meta/recipes-core/gettext/gettext/run-ptest
new file mode 100644
index 0000000000..f17f3c87a7
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext/run-ptest
@@ -0,0 +1,6 @@
1#!/bin/sh
2#
3#This script is used to run gettext test suites
4cd tests
5
6make -k runtest-TESTS top_srcdir=.. srcdir=. abs_srcdir=$PWD top_builddir=$PWD/../ abs_top_srcdir=$PWD/../ | cat
diff --git a/meta/recipes-core/gettext/gettext/serial-tests-config.patch b/meta/recipes-core/gettext/gettext/serial-tests-config.patch
new file mode 100644
index 0000000000..7d39d6086a
--- /dev/null
+++ b/meta/recipes-core/gettext/gettext/serial-tests-config.patch
@@ -0,0 +1,55 @@
1From aa8dfe0aafd0b53a6c5bac61b356ca92e1430a36 Mon Sep 17 00:00:00 2001
2From: "Hongjun.Yang" <hongjun.yang@windriver.com>
3Date: Thu, 28 Jul 2016 12:36:15 +0800
4Subject: [PATCH] fix for ptest
5
6Add serial-tests support, ptest need it
7
8Upstream-Status: Inappropriate [oe specific]
9
10Signed-off-by: Changqing Li <changqing.li@windriver.com>
11---
12 configure.ac | 2 +-
13 gettext-runtime/configure.ac | 2 +-
14 gettext-tools/configure.ac | 2 +-
15 3 files changed, 3 insertions(+), 3 deletions(-)
16
17diff --git a/configure.ac b/configure.ac
18index f4e54ea..a47ff14 100644
19--- a/configure.ac
20+++ b/configure.ac
21@@ -22,7 +22,7 @@ AC_INIT([gettext],
22 [bug-gettext@gnu.org])
23 AC_CONFIG_SRCDIR([gettext-tools/src/msgfmt.c])
24 AC_CONFIG_AUX_DIR([build-aux])
25-AM_INIT_AUTOMAKE([1.13 silent-rules parallel-tests tar-ustar])
26+AM_INIT_AUTOMAKE([1.13 silent-rules serial-tests tar-ustar])
27
28 dnl Override automake's tar command used for creating distributions.
29 am__tar='${AMTAR} chf - --format=ustar --owner=root --group=root "$$tardir"'
30diff --git a/gettext-runtime/configure.ac b/gettext-runtime/configure.ac
31index 126d069..aa23232 100644
32--- a/gettext-runtime/configure.ac
33+++ b/gettext-runtime/configure.ac
34@@ -22,7 +22,7 @@ AC_INIT([gettext-runtime],
35 [bug-gettext@gnu.org])
36 AC_CONFIG_SRCDIR([intl/dcigettext.c])
37 AC_CONFIG_AUX_DIR([../build-aux])
38-AM_INIT_AUTOMAKE([1.11.1 silent-rules parallel-tests])
39+AM_INIT_AUTOMAKE([1.11.1 silent-rules serial-tests])
40 AC_CONFIG_HEADERS([config.h])
41
42 dnl Installation directories.
43diff --git a/gettext-tools/configure.ac b/gettext-tools/configure.ac
44index 3610ee3..6f56a23 100644
45--- a/gettext-tools/configure.ac
46+++ b/gettext-tools/configure.ac
47@@ -22,7 +22,7 @@ AC_INIT([gettext-tools],
48 [bug-gettext@gnu.org])
49 AC_CONFIG_SRCDIR([src/msgfmt.c])
50 AC_CONFIG_AUX_DIR([../build-aux])
51-AM_INIT_AUTOMAKE([1.11.1 silent-rules parallel-tests])
52+AM_INIT_AUTOMAKE([1.11.1 silent-rules serial-tests])
53 AC_CONFIG_HEADERS([config.h])
54
55 dnl Installation directories.
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])