Collection of DPF-based plugins for packaging
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.

294 lines
9.6KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_lib_xalan.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_LIB_XALAN([MINIMUM-VERSION])
  8. #
  9. # DESCRIPTION
  10. #
  11. # This macro provides tests of availability of Apache Xalan C++ XSLT
  12. # processor of a particular version or newer. This macros checks for
  13. # Apache Xalan C++ XSLT processor headers and libraries and defines
  14. # compilation flags
  15. #
  16. # Macro supports following options and their values:
  17. #
  18. # 1) Single-option usage:
  19. #
  20. # --with-xalan - yes, no or path to Xalan installation prefix
  21. #
  22. # 2) Three-options usage (all options are required):
  23. #
  24. # --with-xalan=yes
  25. # --with-xalan-inc - path to base directory with Xalan headers
  26. # --with-xalan-lib - linker flags for Xalan
  27. #
  28. # This macro calls:
  29. #
  30. # AC_SUBST(XALAN_CPPFLAGS)
  31. # AC_SUBST(XALAN_LDFLAGS)
  32. # AC_SUBST(XALAN_VERSION) - only if version requirement is used
  33. #
  34. # And sets:
  35. #
  36. # HAVE_XALAN
  37. #
  38. # LICENSE
  39. #
  40. # Copyright (c) 2009 Mateusz Loskot <mateusz@loskot.net>
  41. # Copyright (c) 2009 Bill Blough <bblough@gmail.com>
  42. #
  43. # Copying and distribution of this file, with or without modification, are
  44. # permitted in any medium without royalty provided the copyright notice
  45. # and this notice are preserved. This file is offered as-is, without any
  46. # warranty.
  47. #serial 6
  48. AC_DEFUN([AX_LIB_XALAN],
  49. [
  50. AC_REQUIRE([AX_LIB_XERCES])
  51. AC_ARG_WITH([xalan],
  52. AS_HELP_STRING([--with-xalan=@<:@ARG@:>@],
  53. [use Xalan C++ XSLT processor from given prefix (ARG=path); check standard prefixes (ARG=yes); disable (ARG=no)]
  54. ),
  55. [
  56. if test "$withval" = "yes"; then
  57. if test -d /usr/local/include/xalanc ; then
  58. xalan_prefix=/usr/local
  59. elif test -d /usr/include/xalanc ; then
  60. xalan_prefix=/usr
  61. else
  62. xalan_prefix=""
  63. fi
  64. xalan_requested="yes"
  65. elif test -d "$withval"; then
  66. xalan_prefix="$withval"
  67. xalan_requested="yes"
  68. else
  69. xalan_prefix=""
  70. xalan_requested="no"
  71. fi
  72. ],
  73. [
  74. dnl Default behavior is implicit yes
  75. if test -d /usr/local/include/xalanc ; then
  76. xalan_prefix=/usr/local
  77. elif test -d /usr/include/xalanc ; then
  78. xalan_prefix=/usr
  79. else
  80. xalan_prefix=""
  81. fi
  82. ]
  83. )
  84. AC_ARG_WITH([xalan-inc],
  85. AS_HELP_STRING([--with-xalan-inc=@<:@DIR@:>@],
  86. [path to Xalan C++ XSLT processor headers]
  87. ),
  88. [xalan_include_dir="$withval"],
  89. [xalan_include_dir=""]
  90. )
  91. AC_ARG_WITH([xalan-lib],
  92. AS_HELP_STRING([--with-xalan-lib=@<:@ARG@:>@],
  93. [link options for Xalan C++ XSLT processor libraries]
  94. ),
  95. [xalan_ldflags="$withval"],
  96. [xalan_ldflags=""]
  97. )
  98. XALAN_CPPFLAGS=""
  99. XALAN_LDFLAGS=""
  100. XALAN_VERSION=""
  101. dnl
  102. dnl Collect include/lib paths and flags
  103. dnl
  104. run_xalan_test="no"
  105. if test -n "$xalan_prefix"; then
  106. xalan_include_dir="$xalan_prefix/include"
  107. xalan_include_dir2="$xalan_prefix/include/xalanc"
  108. xalan_ldflags="-L$xalan_prefix/lib"
  109. run_xalan_test="yes"
  110. elif test "$xalan_requested" = "yes"; then
  111. if test -n "$xalan_include_dir" -a -n "$xalan_lib_flags"; then
  112. xalan_include_dir2="$xalan_include_dir/xalanc"
  113. run_xalan_test="yes"
  114. fi
  115. else
  116. run_xalan_test="no"
  117. fi
  118. xalan_libs="-lxalan-c"
  119. dnl
  120. dnl Check Xalan C++ XSLT processor files
  121. dnl
  122. if test "$run_xalan_test" = "yes"; then
  123. saved_CPPFLAGS="$CPPFLAGS"
  124. CPPFLAGS="$CPPFLAGS -I$xalan_include_dir -I$xalan_include_dir2"
  125. saved_LDFLAGS="$LDFLAGS"
  126. LDFLAGS="$LDFLAGS $xalan_ldflags $XERCES_LDFLAGS"
  127. saved_LIBS="$LIBS"
  128. LIBS="$xalan_libs $XERCES_LIBS $LIBS"
  129. dnl
  130. dnl Check Xalan headers
  131. dnl
  132. AC_MSG_CHECKING([for Xalan C++ XSLT processor headers in $xalan_include_dir and $xalan_include_dir2])
  133. AC_LANG_PUSH([C++])
  134. AC_COMPILE_IFELSE([
  135. AC_LANG_PROGRAM(
  136. [[
  137. @%:@include <xalanc/Include/XalanVersion.hpp>
  138. @%:@include <xalanc/PlatformSupport/PlatformSupportInit.hpp>
  139. ]],
  140. [[]]
  141. )],
  142. [
  143. XALAN_CPPFLAGS="-I$xalan_include_dir -I$xalan_include_dir2"
  144. xalan_header_found="yes"
  145. AC_MSG_RESULT([found])
  146. ],
  147. [
  148. xalan_header_found="no"
  149. AC_MSG_RESULT([not found])
  150. ]
  151. )
  152. AC_LANG_POP([C++])
  153. dnl
  154. dnl Check Xalan libraries
  155. dnl
  156. if test "$xalan_header_found" = "yes"; then
  157. AC_MSG_CHECKING([for Xalan C++ XSLT processor libraries])
  158. AC_LANG_PUSH([C++])
  159. AC_LINK_IFELSE([
  160. AC_LANG_PROGRAM(
  161. [[
  162. @%:@include <xalanc/PlatformSupport/PlatformSupportInit.hpp>
  163. @%:@include <xercesc/util/PlatformUtils.hpp>
  164. @%:@include <xalanc/XalanTransformer/XalanTransformer.hpp>
  165. XALAN_USING_XERCES(XMLPlatformUtils)
  166. XALAN_USING_XALAN(XalanTransformer)
  167. ]],
  168. [[
  169. XMLPlatformUtils::Initialize();
  170. XalanTransformer::initialize();
  171. ]]
  172. )],
  173. [
  174. XALAN_LDFLAGS="$xalan_ldflags $XERCES_LDFLAGS"
  175. XALAN_LIBS="$xalan_libs $XERCES_LIBS"
  176. xalan_lib_found="yes"
  177. AC_MSG_RESULT([found])
  178. ],
  179. [
  180. xalan_lib_found="no"
  181. AC_MSG_RESULT([not found])
  182. ]
  183. )
  184. AC_LANG_POP([C++])
  185. fi
  186. CPPFLAGS="$saved_CPPFLAGS"
  187. LDFLAGS="$saved_LDFLAGS"
  188. LIBS="$saved_LIBS"
  189. fi
  190. AC_MSG_CHECKING([for Xalan C++ XSLT processor])
  191. if test "$run_xalan_test" = "yes"; then
  192. if test "$xalan_header_found" = "yes" -a "$xalan_lib_found" = "yes"; then
  193. AC_SUBST([XALAN_CPPFLAGS])
  194. AC_SUBST([XALAN_LDFLAGS])
  195. AC_SUBST([XALAN_LIBS])
  196. HAVE_XALAN="yes"
  197. else
  198. HAVE_XALAN="no"
  199. fi
  200. AC_MSG_RESULT([$HAVE_XALAN])
  201. dnl
  202. dnl Check Xalan version
  203. dnl
  204. if test "$HAVE_XALAN" = "yes"; then
  205. xalan_version_req=ifelse([$1], [], [], [$1])
  206. if test -n "$xalan_version_req"; then
  207. AC_MSG_CHECKING([if Xalan C++ XSLT processor version is >= $xalan_version_req])
  208. if test -f "$xalan_include_dir2/Include/XalanVersion.hpp"; then
  209. xalan_major=`cat $xalan_include_dir2/Include/XalanVersion.hpp | \
  210. grep '^#define.*XALAN_VERSION_MAJOR.*[0-9]$' | \
  211. sed -e 's/#define XALAN_VERSION_MAJOR.//'`
  212. xalan_minor=`cat $xalan_include_dir2/Include/XalanVersion.hpp | \
  213. grep '^#define.*XALAN_VERSION_MINOR.*[0-9]$' | \
  214. sed -e 's/#define XALAN_VERSION_MINOR.//'`
  215. xalan_revision=`cat $xalan_include_dir2/Include/XalanVersion.hpp | \
  216. grep '^#define.*XALAN_VERSION_REVISION.*[0-9]$' | \
  217. sed -e 's/#define XALAN_VERSION_REVISION.//'`
  218. XALAN_VERSION="$xalan_major.$xalan_minor.$xalan_revision"
  219. AC_SUBST([XALAN_VERSION])
  220. dnl Decompose required version string and calculate numerical representation
  221. xalan_version_req_major=`expr $xalan_version_req : '\([[0-9]]*\)'`
  222. xalan_version_req_minor=`expr $xalan_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
  223. xalan_version_req_revision=`expr $xalan_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
  224. if test "x$xalan_version_req_revision" = "x"; then
  225. xalan_version_req_revision="0"
  226. fi
  227. xalan_version_req_number=`expr $xalan_version_req_major \* 10000 \
  228. \+ $xalan_version_req_minor \* 100 \
  229. \+ $xalan_version_req_revision`
  230. dnl Calculate numerical representation of detected version
  231. xalan_version_number=`expr $xalan_major \* 10000 \
  232. \+ $xalan_minor \* 100 \
  233. \+ $xalan_revision`
  234. xalan_version_check=`expr $xalan_version_number \>\= $xalan_version_req_number`
  235. if test "$xalan_version_check" = "1"; then
  236. AC_MSG_RESULT([yes])
  237. else
  238. AC_MSG_RESULT([no])
  239. AC_MSG_WARN([Found Xalan C++ XSLT processor $XALAN_VERSION, which is older than required. Possible compilation failure.])
  240. fi
  241. else
  242. AC_MSG_RESULT([no])
  243. AC_MSG_WARN([Missing header XalanVersion.hpp. Unable to determine Xalan version.])
  244. fi
  245. fi
  246. fi
  247. else
  248. HAVE_XALAN="no"
  249. AC_MSG_RESULT([$HAVE_XALAN])
  250. if test "$xalan_requested" = "yes"; then
  251. AC_MSG_WARN([Xalan C++ XSLT processor support requested but headers or library not found. Specify valid prefix of Xalan C++ using --with-xalan=@<:@DIR@:>@ or provide include directory and linker flags using --with-xalan-inc and --with-xalan-lib])
  252. fi
  253. fi
  254. ])