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.

138 lines
4.1 KiB

  1. dnl @synopsis XERCES_MSGLOADER_SELECTION
  2. dnl
  3. dnl Determine which msgloader to use.
  4. dnl
  5. dnl @category C
  6. dnl @author James Berry
  7. dnl @version 2005-05-23
  8. dnl @license AllPermissive
  9. dnl
  10. dnl $Id: xerces_msgloader_selection.m4 835245 2009-11-12 05:57:31Z borisk $
  11. AC_DEFUN([XERCES_MSGLOADER_SELECTION],
  12. [
  13. ######################################################
  14. # Test for availability of each msgloader on this host.
  15. # For each msgloader that's available, and hasn't been disabled, add it to our list.
  16. # If the msgloader has been explicitly "enable"d, then vote for it strongly,
  17. # in upper case.
  18. ######################################################
  19. ml_list=
  20. # Check for inmemory msgloader
  21. AC_MSG_CHECKING([whether we support the InMemory MsgLoader])
  22. list_add=
  23. AS_IF([true], [
  24. AC_ARG_ENABLE([msgloader-inmemory],
  25. AS_HELP_STRING([--enable-msgloader-inmemory],
  26. [Enable InMemory MsgLoader support]),
  27. [AS_IF([test x"$enableval" = xyes],
  28. [list_add=INMEMORY])],
  29. [list_add=inmemory])
  30. ])
  31. AS_IF([test x"$list_add" != x],
  32. [ml_list="$ml_list -$list_add-"; AC_MSG_RESULT(yes)],
  33. [AC_MSG_RESULT(no)]
  34. )
  35. # Check for ICU
  36. AC_REQUIRE([XERCES_ICU_PREFIX])
  37. AC_MSG_CHECKING([whether we support the ICU MsgLoader])
  38. list_add=
  39. AS_IF([test x"$xerces_cv_icu_present" != x"no"], [
  40. AC_ARG_ENABLE([msgloader-icu],
  41. AS_HELP_STRING([--enable-msgloader-icu],
  42. [Enable ICU-based MsgLoader support]),
  43. [AS_IF([test x"$enableval" = xyes],
  44. [list_add=ICU])],
  45. [list_add=icu])
  46. ])
  47. AS_IF([test x"$list_add" != x],
  48. [ml_list="$ml_list -$list_add-"; AC_MSG_RESULT(yes)],
  49. [AC_MSG_RESULT(no)]
  50. )
  51. # Check for iconv support
  52. no_iconv=false
  53. AC_CHECK_HEADERS([nl_types.h], [], [no_iconv=true])
  54. AC_CHECK_FUNCS([catopen catclose catgets], [], [no_iconv=true])
  55. AC_MSG_CHECKING([whether we can support the iconv MsgLoader])
  56. list_add=
  57. AS_IF([! $no_iconv], [
  58. AC_ARG_ENABLE([msgloader-iconv],
  59. AS_HELP_STRING([--enable-msgloader-iconv],
  60. [Enable Iconv-based MsgLoader support]),
  61. [AS_IF([test x"$enableval" = xyes],
  62. [list_add=ICONV])],
  63. [list_add=iconv])
  64. ])
  65. AS_IF([test x"$list_add" != x],
  66. [ml_list="$ml_list -$list_add-"; AC_MSG_RESULT(yes)],
  67. [AC_MSG_RESULT(no)]
  68. )
  69. # TODO: Add test for additional msgloaders
  70. ######################################################
  71. # Determine which msgloader to use.
  72. #
  73. # We do this in two passes. MsgLoaders that have been enabled with "yes",
  74. # and which start out in upper case, get the top priority on the first pass.
  75. # On the second pass, we consider those which are simply available, but
  76. # which were not "disable"d (these won't even be in our list).
  77. ######################################################
  78. msgloader=
  79. az_lower=abcdefghijklmnopqrstuvwxyz
  80. az_upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
  81. AC_MSG_CHECKING([for which MsgLoader to use (choices:$ml_list)])
  82. for i in 1 2; do
  83. # Swap upper/lower case in the ml_list. Cannot use tr ranges
  84. # because of the portability issues.
  85. #
  86. ml_list=`echo $ml_list | tr "$az_lower$az_upper" "$az_upper$az_lower"`
  87. # Check for each msgloader, in implicit rank order
  88. case $ml_list in
  89. *-inmemory-*)
  90. AC_DEFINE([XERCES_USE_MSGLOADER_INMEMORY], 1, [Define to use the InMemory MsgLoader])
  91. msgloader=inmemory
  92. break
  93. ;;
  94. *-icu-*)
  95. AC_DEFINE([XERCES_USE_MSGLOADER_ICU], 1, [Define to use the ICU-based MsgLoader])
  96. msgloader=icu
  97. LIBS="${LIBS} ${xerces_cv_icu_libs}"
  98. break
  99. ;;
  100. *-iconv-*)
  101. AC_DEFINE([XERCES_USE_MSGLOADER_ICONV], 1, [Define to use the iconv-based MsgLoader])
  102. msgloader=iconv
  103. break
  104. ;;
  105. *)
  106. AS_IF([test $i -eq 2], [
  107. AC_MSG_RESULT([none])
  108. AC_MSG_ERROR([Xerces cannot function without a MsgLoader])
  109. ]
  110. )
  111. ;;
  112. esac
  113. done
  114. if test x"$msgloader" != x; then
  115. AC_MSG_RESULT($msgloader)
  116. fi
  117. # Define the auto-make conditionals which determine what actually gets compiled
  118. # Note that these macros can't be executed conditionally, which is why they're here, not above.
  119. AM_CONDITIONAL([XERCES_USE_MSGLOADER_ICU], [test x"$msgloader" = xicu])
  120. AM_CONDITIONAL([XERCES_USE_MSGLOADER_ICONV], [test x"$msgloader" = xiconv])
  121. AM_CONDITIONAL([XERCES_USE_MSGLOADER_INMEMORY], [test x"$msgloader" = xinmemory])
  122. ]
  123. )