blob: a5c112db7b3c6a95859e0ad5ff19ec09bb9abffc [file] [log] [blame]
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001From f57da62218cf72c1342da82abafdac6b0a2e4997 Mon Sep 17 00:00:00 2001
2From: Tony Tascioglu <tony.tascioglu@windriver.com>
3Date: Fri, 14 May 2021 11:50:35 -0400
Brad Bishopc342db32019-05-15 21:57:59 -04004Subject: [PATCH] AM_PATH_XML2 uses xml-config which we disable through
William A. Kennington IIIac69b482021-06-02 12:28:27 -07005
Patrick Williamsc124f4f2015-09-15 14:41:29 -05006binconfig-disabled.bbclass, so port it to use pkg-config instead.
7
Andrew Geissler595f6302022-01-24 19:11:47 +00008This cannot be upstreamed, as the original macro supports various
9optional arguments which cannot be supported with a direct call
10to pkg-config.
11
12Upstream-Status: Inappropriate [oe-core specific; see above]
Patrick Williamsc124f4f2015-09-15 14:41:29 -050013Signed-off-by: Ross Burton <ross.burton@intel.com>
14
Brad Bishopc342db32019-05-15 21:57:59 -040015Rebase to 2.9.9
16Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
William A. Kennington IIIac69b482021-06-02 12:28:27 -070017
18Updated to apply cleanly to v2.9.12
19
20Signed-off-by: Tony Tascioglu <tony.tascioglu@windriver.com>
Brad Bishopc342db32019-05-15 21:57:59 -040021---
William A. Kennington IIIac69b482021-06-02 12:28:27 -070022 libxml.m4 | 190 ++----------------------------------------------------
23 1 file changed, 5 insertions(+), 185 deletions(-)
Brad Bishopc342db32019-05-15 21:57:59 -040024
Patrick Williamsc124f4f2015-09-15 14:41:29 -050025diff --git a/libxml.m4 b/libxml.m4
William A. Kennington IIIac69b482021-06-02 12:28:27 -070026index 09de9fe2..1c535853 100644
Patrick Williamsc124f4f2015-09-15 14:41:29 -050027--- a/libxml.m4
28+++ b/libxml.m4
William A. Kennington IIIac69b482021-06-02 12:28:27 -070029@@ -1,192 +1,12 @@
Patrick Williamsc124f4f2015-09-15 14:41:29 -050030-# Configure paths for LIBXML2
William A. Kennington IIIac69b482021-06-02 12:28:27 -070031-# Simon Josefsson 2020-02-12
32-# Fix autoconf 2.70+ warnings
Patrick Williamsc124f4f2015-09-15 14:41:29 -050033-# Mike Hommey 2004-06-19
34-# use CPPFLAGS instead of CFLAGS
35-# Toshio Kuratomi 2001-04-21
36-# Adapted from:
37-# Configure paths for GLIB
38-# Owen Taylor 97-11-3
39-
40 dnl AM_PATH_XML2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
41 dnl Test for XML, and define XML_CPPFLAGS and XML_LIBS
42 dnl
43-AC_DEFUN([AM_PATH_XML2],[
44-AC_ARG_WITH(xml-prefix,
45- [ --with-xml-prefix=PFX Prefix where libxml is installed (optional)],
46- xml_config_prefix="$withval", xml_config_prefix="")
47-AC_ARG_WITH(xml-exec-prefix,
48- [ --with-xml-exec-prefix=PFX Exec prefix where libxml is installed (optional)],
49- xml_config_exec_prefix="$withval", xml_config_exec_prefix="")
50-AC_ARG_ENABLE(xmltest,
51- [ --disable-xmltest Do not try to compile and run a test LIBXML program],,
52- enable_xmltest=yes)
53-
54- if test x$xml_config_exec_prefix != x ; then
55- xml_config_args="$xml_config_args"
56- if test x${XML2_CONFIG+set} != xset ; then
57- XML2_CONFIG=$xml_config_exec_prefix/bin/xml2-config
58- fi
59- fi
60- if test x$xml_config_prefix != x ; then
61- xml_config_args="$xml_config_args --prefix=$xml_config_prefix"
62- if test x${XML2_CONFIG+set} != xset ; then
63- XML2_CONFIG=$xml_config_prefix/bin/xml2-config
64- fi
65- fi
66-
67- AC_PATH_PROG(XML2_CONFIG, xml2-config, no)
68- min_xml_version=ifelse([$1], ,2.0.0,[$1])
69- AC_MSG_CHECKING(for libxml - version >= $min_xml_version)
70- no_xml=""
71- if test "$XML2_CONFIG" = "no" ; then
72- no_xml=yes
73- else
74- XML_CPPFLAGS=`$XML2_CONFIG $xml_config_args --cflags`
75- XML_LIBS=`$XML2_CONFIG $xml_config_args --libs`
76- xml_config_major_version=`$XML2_CONFIG $xml_config_args --version | \
77- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
78- xml_config_minor_version=`$XML2_CONFIG $xml_config_args --version | \
79- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
80- xml_config_micro_version=`$XML2_CONFIG $xml_config_args --version | \
81- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
82- if test "x$enable_xmltest" = "xyes" ; then
83- ac_save_CPPFLAGS="$CPPFLAGS"
84- ac_save_LIBS="$LIBS"
85- CPPFLAGS="$CPPFLAGS $XML_CPPFLAGS"
86- LIBS="$XML_LIBS $LIBS"
87-dnl
88-dnl Now check if the installed libxml is sufficiently new.
89-dnl (Also sanity checks the results of xml2-config to some extent)
90-dnl
91- rm -f conf.xmltest
William A. Kennington IIIac69b482021-06-02 12:28:27 -070092- AC_RUN_IFELSE(
93- [AC_LANG_SOURCE([[
Patrick Williamsc124f4f2015-09-15 14:41:29 -050094-#include <stdlib.h>
95-#include <stdio.h>
96-#include <string.h>
97-#include <libxml/xmlversion.h>
98-
99-int
100-main()
101-{
102- int xml_major_version, xml_minor_version, xml_micro_version;
103- int major, minor, micro;
104- char *tmp_version;
105-
106- system("touch conf.xmltest");
107-
108- /* Capture xml2-config output via autoconf/configure variables */
109- /* HP/UX 9 (%@#!) writes to sscanf strings */
110- tmp_version = (char *)strdup("$min_xml_version");
111- if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
112- printf("%s, bad version string from xml2-config\n", "$min_xml_version");
113- exit(1);
114- }
115- free(tmp_version);
116-
117- /* Capture the version information from the header files */
118- tmp_version = (char *)strdup(LIBXML_DOTTED_VERSION);
119- if (sscanf(tmp_version, "%d.%d.%d", &xml_major_version, &xml_minor_version, &xml_micro_version) != 3) {
120- printf("%s, bad version string from libxml includes\n", "LIBXML_DOTTED_VERSION");
121- exit(1);
122- }
123- free(tmp_version);
124-
125- /* Compare xml2-config output to the libxml headers */
126- if ((xml_major_version != $xml_config_major_version) ||
127- (xml_minor_version != $xml_config_minor_version) ||
128- (xml_micro_version != $xml_config_micro_version))
129- {
130- printf("*** libxml header files (version %d.%d.%d) do not match\n",
131- xml_major_version, xml_minor_version, xml_micro_version);
132- printf("*** xml2-config (version %d.%d.%d)\n",
133- $xml_config_major_version, $xml_config_minor_version, $xml_config_micro_version);
134- return 1;
135- }
136-/* Compare the headers to the library to make sure we match */
137- /* Less than ideal -- doesn't provide us with return value feedback,
138- * only exits if there's a serious mismatch between header and library.
139- */
140- LIBXML_TEST_VERSION;
141-
142- /* Test that the library is greater than our minimum version */
143- if ((xml_major_version > major) ||
144- ((xml_major_version == major) && (xml_minor_version > minor)) ||
145- ((xml_major_version == major) && (xml_minor_version == minor) &&
146- (xml_micro_version >= micro)))
147- {
148- return 0;
149- }
150- else
151- {
152- printf("\n*** An old version of libxml (%d.%d.%d) was found.\n",
153- xml_major_version, xml_minor_version, xml_micro_version);
154- printf("*** You need a version of libxml newer than %d.%d.%d. The latest version of\n",
155- major, minor, micro);
156- printf("*** libxml is always available from ftp://ftp.xmlsoft.org.\n");
157- printf("***\n");
158- printf("*** If you have already installed a sufficiently new version, this error\n");
159- printf("*** probably means that the wrong copy of the xml2-config shell script is\n");
160- printf("*** being found. The easiest way to fix this is to remove the old version\n");
161- printf("*** of LIBXML, but you can also set the XML2_CONFIG environment to point to the\n");
162- printf("*** correct copy of xml2-config. (In this case, you will have to\n");
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700163- printf("*** modify your LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf\n");
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500164- printf("*** so that the correct libraries are found at run-time))\n");
165- }
166- return 1;
167-}
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700168-]])],, no_xml=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500169- CPPFLAGS="$ac_save_CPPFLAGS"
170- LIBS="$ac_save_LIBS"
171- fi
172- fi
173+AC_DEFUN([AM_PATH_XML2],[
174+ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
175
176- if test "x$no_xml" = x ; then
177- AC_MSG_RESULT(yes (version $xml_config_major_version.$xml_config_minor_version.$xml_config_micro_version))
178- ifelse([$2], , :, [$2])
179- else
180- AC_MSG_RESULT(no)
181- if test "$XML2_CONFIG" = "no" ; then
182- echo "*** The xml2-config script installed by LIBXML could not be found"
183- echo "*** If libxml was installed in PREFIX, make sure PREFIX/bin is in"
184- echo "*** your path, or set the XML2_CONFIG environment variable to the"
185- echo "*** full path to xml2-config."
186- else
187- if test -f conf.xmltest ; then
188- :
189- else
190- echo "*** Could not run libxml test program, checking why..."
191- CPPFLAGS="$CPPFLAGS $XML_CPPFLAGS"
192- LIBS="$LIBS $XML_LIBS"
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700193- AC_LINK_IFELSE(
194- [AC_LANG_PROGRAM([[
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500195-#include <libxml/xmlversion.h>
196-#include <stdio.h>
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700197-]], [[ LIBXML_TEST_VERSION; return 0;]])],
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500198- [ echo "*** The test program compiled, but did not run. This usually means"
199- echo "*** that the run-time linker is not finding LIBXML or finding the wrong"
200- echo "*** version of LIBXML. If it is not finding LIBXML, you'll need to set your"
201- echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
202- echo "*** to the installed location Also, make sure you have run ldconfig if that"
203- echo "*** is required on your system"
204- echo "***"
205- echo "*** If you have an old version installed, it is best to remove it, although"
206- echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
207- [ echo "*** The test program failed to compile or link. See the file config.log for the"
Brad Bishop316dfdd2018-06-25 12:45:53 -0400208- echo "*** exact error that occurred. This usually means LIBXML was incorrectly installed"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500209- echo "*** or that you have moved LIBXML since it was installed. In the latter case, you"
210- echo "*** may want to edit the xml2-config script: $XML2_CONFIG" ])
211- CPPFLAGS="$ac_save_CPPFLAGS"
212- LIBS="$ac_save_LIBS"
213- fi
214- fi
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500215+ verdep=ifelse([$1], [], [], [">= $1"])
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500216+ PKG_CHECK_MODULES(XML, [libxml-2.0 $verdep], [$2], [$3])
217
218- XML_CPPFLAGS=""
219- XML_LIBS=""
220- ifelse([$3], , :, [$3])
221- fi
222+ XML_CPPFLAGS=$XML_CFLAGS
223 AC_SUBST(XML_CPPFLAGS)
224- AC_SUBST(XML_LIBS)
225- rm -f conf.xmltest
226 ])
Brad Bishopc342db32019-05-15 21:57:59 -0400227--
2282.7.4
229