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.

124 lines
4.1 KiB

  1. dnl @synopsis XERCES_ICU_PREFIX
  2. dnl
  3. dnl Determines the prefix for icu
  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_icu_prefix.m4 1662872 2015-02-28 01:05:58Z scantor $
  11. AC_DEFUN([XERCES_ICU_PREFIX],
  12. [
  13. AC_ARG_WITH([icu],
  14. [AS_HELP_STRING([--with-icu[[[[=DIR]]]]],[Specify location of icu])],
  15. [
  16. if test x"$with_icu" = x"yes"; then
  17. with_icu=
  18. fi
  19. ],
  20. [with_icu=])
  21. # Determine if icu is available
  22. AC_CACHE_VAL([xerces_cv_icu_present],
  23. [
  24. xerces_cv_icu_present=no
  25. if test x"$with_icu" != x"no"; then
  26. # See if we were given a prefix.
  27. #
  28. if test -n "$with_icu"; then
  29. AC_PATH_PROG([icu_config], [icu-config],[],[$with_icu/bin])
  30. else
  31. AC_PATH_PROG([icu_config], [icu-config],[])
  32. fi
  33. # Add trailing slash to bin and sbin vars so that we
  34. # can use them uniformly whether they are empty or not.
  35. #
  36. if test -n "$icu_config"; then
  37. icu_flags=`$icu_config --cppflags-searchpath`
  38. icu_libs=`$icu_config --ldflags`
  39. icu_bin=`$icu_config --bindir`
  40. icu_sbin=`$icu_config --sbindir`
  41. if test -n "$icu_bin"; then
  42. icu_bin="$icu_bin/"
  43. fi
  44. if test -n "$icu_sbin"; then
  45. icu_sbin="$icu_sbin/"
  46. fi
  47. else
  48. if test -n "$with_icu"; then
  49. icu_flags="-I$with_icu/include"
  50. icu_libs="-L$with_icu/lib -licuuc -licudata"
  51. icu_bin="$with_icu/bin/"
  52. icu_sbin="$with_icu/sbin/"
  53. else
  54. # Default compiler paths.
  55. #
  56. icu_flags=
  57. icu_libs="-licuuc -licudata"
  58. icu_bin=
  59. icu_sbin=
  60. fi
  61. fi
  62. # Check that the headers exist and can be compiled.
  63. #
  64. orig_cppflags=$CPPFLAGS
  65. if test -n "$icu_flags"; then
  66. CPPFLAGS="$icu_flags $CPPFLAGS"
  67. fi
  68. AC_CHECK_HEADER([unicode/ucnv.h], [xerces_cv_icu_present=yes])
  69. if test x"$xerces_cv_icu_present" != x"no"; then
  70. # Check that the library can be linked.
  71. #
  72. AC_MSG_CHECKING([for ucnv_open in -licuuc])
  73. orig_libs=$LIBS
  74. LIBS="$icu_libs $LIBS"
  75. AC_LINK_IFELSE(
  76. AC_LANG_SOURCE[[
  77. #include <unicode/ucnv.h>
  78. int main ()
  79. {
  80. ucnv_open (0, 0);
  81. return 0;
  82. }
  83. ]],
  84. [], [xerces_cv_icu_present=no])
  85. LIBS=$orig_libs
  86. if test x"$xerces_cv_icu_present" != x"no"; then
  87. AC_MSG_RESULT([yes])
  88. else
  89. AC_MSG_RESULT([no])
  90. fi
  91. fi
  92. CPPFLAGS=$orig_cppflags
  93. fi
  94. ])
  95. AC_CACHE_VAL([xerces_cv_icu_flags], [xerces_cv_icu_flags=$icu_flags])
  96. AC_CACHE_VAL([xerces_cv_icu_libs], [xerces_cv_icu_libs=$icu_libs])
  97. AC_CACHE_VAL([xerces_cv_icu_bin], [xerces_cv_icu_bin=$icu_bin])
  98. AC_CACHE_VAL([xerces_cv_icu_sbin], [xerces_cv_icu_sbin=$icu_sbin])
  99. AC_SUBST([ICU_PRESENT], [$xerces_cv_icu_present])
  100. AC_SUBST([ICU_FLAGS], [$xerces_cv_icu_flags])
  101. AC_SUBST([ICU_LIBS], [$xerces_cv_icu_libs])
  102. AC_SUBST([ICU_BIN], [$xerces_cv_icu_bin])
  103. AC_SUBST([ICU_SBIN], [$xerces_cv_icu_sbin])
  104. ]
  105. )