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