blob: d211f65da3e857b503f9692e737687df8c9bf388 [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
Andrew Geissler9aee5002022-03-30 16:27:02 +000025Index: libxml2-2.9.13/libxml.m4
26===================================================================
27--- libxml2-2.9.13.orig/libxml.m4
28+++ libxml2-2.9.13/libxml.m4
29@@ -1,191 +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);
Andrew Geissler9aee5002022-03-30 16:27:02 +0000154- printf("*** You need a version of libxml newer than %d.%d.%d.\n",
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500155- major, minor, micro);
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500156- printf("***\n");
157- printf("*** If you have already installed a sufficiently new version, this error\n");
158- printf("*** probably means that the wrong copy of the xml2-config shell script is\n");
159- printf("*** being found. The easiest way to fix this is to remove the old version\n");
160- printf("*** of LIBXML, but you can also set the XML2_CONFIG environment to point to the\n");
161- printf("*** correct copy of xml2-config. (In this case, you will have to\n");
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700162- printf("*** modify your LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf\n");
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500163- printf("*** so that the correct libraries are found at run-time))\n");
164- }
165- return 1;
166-}
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700167-]])],, no_xml=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500168- CPPFLAGS="$ac_save_CPPFLAGS"
169- LIBS="$ac_save_LIBS"
170- fi
171- fi
172+AC_DEFUN([AM_PATH_XML2],[
173+ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
174
175- if test "x$no_xml" = x ; then
176- AC_MSG_RESULT(yes (version $xml_config_major_version.$xml_config_minor_version.$xml_config_micro_version))
177- ifelse([$2], , :, [$2])
178- else
179- AC_MSG_RESULT(no)
180- if test "$XML2_CONFIG" = "no" ; then
181- echo "*** The xml2-config script installed by LIBXML could not be found"
182- echo "*** If libxml was installed in PREFIX, make sure PREFIX/bin is in"
183- echo "*** your path, or set the XML2_CONFIG environment variable to the"
184- echo "*** full path to xml2-config."
185- else
186- if test -f conf.xmltest ; then
187- :
188- else
189- echo "*** Could not run libxml test program, checking why..."
190- CPPFLAGS="$CPPFLAGS $XML_CPPFLAGS"
191- LIBS="$LIBS $XML_LIBS"
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700192- AC_LINK_IFELSE(
193- [AC_LANG_PROGRAM([[
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500194-#include <libxml/xmlversion.h>
195-#include <stdio.h>
William A. Kennington IIIac69b482021-06-02 12:28:27 -0700196-]], [[ LIBXML_TEST_VERSION; return 0;]])],
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500197- [ echo "*** The test program compiled, but did not run. This usually means"
198- echo "*** that the run-time linker is not finding LIBXML or finding the wrong"
199- echo "*** version of LIBXML. If it is not finding LIBXML, you'll need to set your"
200- echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
201- echo "*** to the installed location Also, make sure you have run ldconfig if that"
202- echo "*** is required on your system"
203- echo "***"
204- echo "*** If you have an old version installed, it is best to remove it, although"
205- echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
206- [ echo "*** The test program failed to compile or link. See the file config.log for the"
Brad Bishop316dfdd2018-06-25 12:45:53 -0400207- echo "*** exact error that occurred. This usually means LIBXML was incorrectly installed"
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500208- echo "*** or that you have moved LIBXML since it was installed. In the latter case, you"
209- echo "*** may want to edit the xml2-config script: $XML2_CONFIG" ])
210- CPPFLAGS="$ac_save_CPPFLAGS"
211- LIBS="$ac_save_LIBS"
212- fi
213- fi
Patrick Williamsd8c66bc2016-06-20 12:57:21 -0500214+ verdep=ifelse([$1], [], [], [">= $1"])
Patrick Williamsc124f4f2015-09-15 14:41:29 -0500215+ PKG_CHECK_MODULES(XML, [libxml-2.0 $verdep], [$2], [$3])
216
217- XML_CPPFLAGS=""
218- XML_LIBS=""
219- ifelse([$3], , :, [$3])
220- fi
221+ XML_CPPFLAGS=$XML_CFLAGS
222 AC_SUBST(XML_CPPFLAGS)
223- AC_SUBST(XML_LIBS)
224- rm -f conf.xmltest
225 ])