You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

167 lines
5.2 KiB

  1. From de943f313fa5c17bf9cbd560a7578796991b24b5 Mon Sep 17 00:00:00 2001
  2. From: Eneas U de Queiroz <cotequeiroz@gmail.com>
  3. Date: Sat, 10 Aug 2019 19:43:20 -0300
  4. Subject: [PATCH] Avoid libxml checks if --disable-xml is used
  5. Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
  6. ---
  7. m4/reorganization/libs/xml.m4 | 126 +++++++++++++++++-----------------
  8. 1 file changed, 62 insertions(+), 64 deletions(-)
  9. diff --git a/m4/reorganization/libs/xml.m4 b/m4/reorganization/libs/xml.m4
  10. index 77b2c13a8..0709d2914 100644
  11. --- a/m4/reorganization/libs/xml.m4
  12. +++ b/m4/reorganization/libs/xml.m4
  13. @@ -12,87 +12,85 @@ if test "X$want_xml" != "Xno"; then
  14. @<:@default=/usr/local or /usr if not found in /usr/local@:>@]),
  15. [with_xml_val=$withval]
  16. )
  17. -fi
  18. -
  19. -AS_IF([test "x$with_xml_val" = "xno"], [XML_HOME=""],
  20. - [test "x$with_xml_val" = "xyes"], [XML_HOME="/usr/local"],
  21. - [XML_HOME="$with_xml_val"])
  22. -AS_IF([test "x$XML_HOME" != "x"], [
  23. - AS_IF([test ! -x "$XML_HOME/bin/xml2-config"], [XML_HOME=""])
  24. - ])
  25. + AS_IF([test "x$with_xml_val" = "xno"], [XML_HOME=""],
  26. + [test "x$with_xml_val" = "xyes"], [XML_HOME="/usr/local"],
  27. + [XML_HOME="$with_xml_val"])
  28. -AS_IF([test "x$XML_HOME" = "x" -a "x$with_xml_val" = "xyes"], [
  29. - AS_IF([test -x "/usr/bin/xml2-config"], [XML_HOME="/usr"])
  30. - ])
  31. + AS_IF([test "x$XML_HOME" != "x"], [
  32. + AS_IF([test ! -x "$XML_HOME/bin/xml2-config"], [XML_HOME=""])
  33. + ])
  34. -if test "x$XML_HOME" != "x"; then
  35. - AC_MSG_RESULT([$XML_HOME])
  36. -else
  37. - AC_MSG_RESULT([not found])
  38. -fi
  39. + AS_IF([test "x$XML_HOME" = "x" -a "x$with_xml_val" = "xyes"], [
  40. + AS_IF([test -x "/usr/bin/xml2-config"], [XML_HOME="/usr"])
  41. + ])
  42. -found_xml="no"
  43. -XMLCONF_VERSION=""
  44. -XML_CPPFLAGS=""
  45. -XML_LIBS=""
  46. -if test "x$XML_HOME" != "x"; then
  47. - AC_MSG_CHECKING([xml2-config version])
  48. - XMLCONF_VERSION="`$XML_HOME/bin/xml2-config --version`"
  49. - if test "x%XMLCONF_VERSION" != "x"; then
  50. - AC_MSG_RESULT([$XMLCONF_VERSION])
  51. - found_xml="yes"
  52. - XML_CPPFLAGS="`$XML_HOME/bin/xml2-config --cflags`"
  53. - XML_LIBS="`$XML_HOME/bin/xml2-config --libs`"
  54. - AS_ECHO("$XML_CPPFLAGS")
  55. - AS_ECHO("$XML_LIBS")
  56. + if test "x$XML_HOME" != "x"; then
  57. + AC_MSG_RESULT([$XML_HOME])
  58. else
  59. - AC_MSG_ERROR([xml2-config failed])
  60. + AC_MSG_RESULT([not found])
  61. + fi
  62. +
  63. + found_xml="no"
  64. + XMLCONF_VERSION=""
  65. + XML_CPPFLAGS=""
  66. + XML_LIBS=""
  67. + if test "x$XML_HOME" != "x"; then
  68. + AC_MSG_CHECKING([xml2-config version])
  69. + XMLCONF_VERSION="`$XML_HOME/bin/xml2-config --version`"
  70. + if test "x%XMLCONF_VERSION" != "x"; then
  71. + AC_MSG_RESULT([$XMLCONF_VERSION])
  72. + found_xml="yes"
  73. + XML_CPPFLAGS="`$XML_HOME/bin/xml2-config --cflags`"
  74. + XML_LIBS="`$XML_HOME/bin/xml2-config --libs`"
  75. + AS_ECHO("$XML_CPPFLAGS")
  76. + AS_ECHO("$XML_LIBS")
  77. + else
  78. + AC_MSG_ERROR([xml2-config failed])
  79. + fi
  80. fi
  81. -fi
  82. -working_xml="no"
  83. -if test "X$found_xml" != "Xno"; then
  84. - AC_MSG_CHECKING([for xmlreader.h in $XML_HOME])
  85. + working_xml="no"
  86. + if test "X$found_xml" != "Xno"; then
  87. + AC_MSG_CHECKING([for xmlreader.h in $XML_HOME])
  88. - if test ! -f "$XML_HOME/include/libxml2/libxml/xmlreader.h"; then
  89. - AC_MSG_RESULT([not found])
  90. - else
  91. - AC_MSG_RESULT([found])
  92. - save_LIBS="$LIBS"
  93. - save_CPPFLAGS="$CPPFLAGS"
  94. - CPPFLAGS="$CPPFLAGS $XML_CPPFLAGS"
  95. - save_LDFLAGS="$LDFLAGS"
  96. - LDFLAGS="$LDFLAGS $XML_LIBS"
  97. + if test ! -f "$XML_HOME/include/libxml2/libxml/xmlreader.h"; then
  98. + AC_MSG_RESULT([not found])
  99. + else
  100. + AC_MSG_RESULT([found])
  101. + save_LIBS="$LIBS"
  102. + save_CPPFLAGS="$CPPFLAGS"
  103. + CPPFLAGS="$CPPFLAGS $XML_CPPFLAGS"
  104. + save_LDFLAGS="$LDFLAGS"
  105. + LDFLAGS="$LDFLAGS $XML_LIBS"
  106. - AS_ECHO("CPPFLAGS: $CPPFLAGS")
  107. - AS_ECHO("LD_FLAGS: $LDFLAGS")
  108. + AS_ECHO("CPPFLAGS: $CPPFLAGS")
  109. + AS_ECHO("LD_FLAGS: $LDFLAGS")
  110. - AC_CHECK_LIB([xml2], [xmlTextReaderRead], [working_xml="yes"], [working_xml="no"], [$XML_LIBS])
  111. + AC_CHECK_LIB([xml2], [xmlTextReaderRead], [working_xml="yes"], [working_xml="no"], [$XML_LIBS])
  112. - CPPFLAGS="$save_CPPFLAGS"
  113. - LDFLAGS="$save_LDFLAGS"
  114. - LIBS="$save_LIBS"
  115. + CPPFLAGS="$save_CPPFLAGS"
  116. + LDFLAGS="$save_LDFLAGS"
  117. + LIBS="$save_LIBS"
  118. + fi
  119. fi
  120. -fi
  121. -if test "$working_xml" = "yes"; then
  122. - AC_DEFINE([HAVE_LIBXML2],1,[Define to 1 if you have the 'libxml2' library (-lxml2).])
  123. - AC_SUBST(XML_CPPFLAGS)
  124. - AC_SUBST(XML_LIBS)
  125. - AC_MSG_NOTICE([Compiling and linking with libxml2 from $XML_HOME])
  126. -else
  127. - if test "$want_xml" = "yes"; then
  128. - AC_MSG_ERROR([****** Please install libxml2 packages!])
  129. + if test "$working_xml" = "yes"; then
  130. + AC_DEFINE([HAVE_LIBXML2],1,[Define to 1 if you have the 'libxml2' library (-lxml2).])
  131. + AC_SUBST(XML_CPPFLAGS)
  132. + AC_SUBST(XML_LIBS)
  133. + AC_MSG_NOTICE([Compiling and linking with libxml2 from $XML_HOME])
  134. else
  135. - if test "$want_xml" != "no"; then
  136. + if test "$want_xml" = "yes"; then
  137. + AC_MSG_ERROR([****** Please install libxml2 packages!])
  138. + else
  139. AC_MSG_NOTICE([****** libxml2 support unavailable])
  140. fi
  141. + XML_CPPFLAGS=""
  142. + XML_LIBS=""
  143. + AC_SUBST(XML_CPPFLAGS)
  144. + AC_SUBST(XML_LIBS)
  145. fi
  146. - XML_CPPFLAGS=""
  147. - XML_LIBS=""
  148. - AC_SUBST(XML_CPPFLAGS)
  149. - AC_SUBST(XML_LIBS)
  150. fi
  151. AM_CONDITIONAL([HAVE_LIBXML2], test "x$HAVE_LIBXML2" = "xyes")
  152. --
  153. 2.21.0