nl_langinfo.m4 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # nl_langinfo.m4 serial 9
  2. dnl Copyright (C) 2009-2023 Free Software Foundation, Inc.
  3. dnl This file is free software; the Free Software Foundation
  4. dnl gives unlimited permission to copy and/or distribute it,
  5. dnl with or without modifications, as long as this notice is preserved.
  6. AC_DEFUN([gl_FUNC_NL_LANGINFO],
  7. [
  8. AC_REQUIRE([gl_LANGINFO_H_DEFAULTS])
  9. AC_REQUIRE([gl_LANGINFO_H])
  10. AC_CHECK_FUNCS_ONCE([nl_langinfo])
  11. AC_REQUIRE([AC_CANONICAL_HOST])
  12. AC_REQUIRE([gl_FUNC_SETLOCALE_NULL])
  13. AC_REQUIRE([gl_PTHREADLIB])
  14. AC_CHECK_HEADERS_ONCE([threads.h])
  15. if test $ac_cv_func_nl_langinfo = yes; then
  16. # On Irix 6.5, YESEXPR is defined, but nl_langinfo(YESEXPR) is broken.
  17. AC_CACHE_CHECK([whether YESEXPR works],
  18. [gl_cv_func_nl_langinfo_yesexpr_works],
  19. [AC_RUN_IFELSE(
  20. [AC_LANG_PROGRAM([[#include <langinfo.h>
  21. ]], [[return !*nl_langinfo(YESEXPR);
  22. ]])],
  23. [gl_cv_func_nl_langinfo_yesexpr_works=yes],
  24. [gl_cv_func_nl_langinfo_yesexpr_works=no],
  25. [
  26. case "$host_os" in
  27. # Guess no on irix systems.
  28. irix*) gl_cv_func_nl_langinfo_yesexpr_works="guessing no";;
  29. # Guess yes elsewhere.
  30. *) gl_cv_func_nl_langinfo_yesexpr_works="guessing yes";;
  31. esac
  32. ])
  33. ])
  34. case $gl_cv_func_nl_langinfo_yesexpr_works in
  35. *yes) FUNC_NL_LANGINFO_YESEXPR_WORKS=1 ;;
  36. *) FUNC_NL_LANGINFO_YESEXPR_WORKS=0 ;;
  37. esac
  38. AC_DEFINE_UNQUOTED([FUNC_NL_LANGINFO_YESEXPR_WORKS],
  39. [$FUNC_NL_LANGINFO_YESEXPR_WORKS],
  40. [Define to 1 if nl_langinfo (YESEXPR) returns a non-empty string.])
  41. # On Solaris 10 and Solaris 11.3, nl_langinfo is not multithread-safe.
  42. case "$host_os" in
  43. solaris*) NL_LANGINFO_MTSAFE=0 ;;
  44. *) NL_LANGINFO_MTSAFE=1 ;;
  45. esac
  46. AC_DEFINE_UNQUOTED([NL_LANGINFO_MTSAFE], [$NL_LANGINFO_MTSAFE],
  47. [Define to 1 if nl_langinfo is multithread-safe.])
  48. if test $HAVE_LANGINFO_CODESET = 1 \
  49. && test $HAVE_LANGINFO_T_FMT_AMPM = 1 \
  50. && test $HAVE_LANGINFO_ALTMON = 1 \
  51. && test $HAVE_LANGINFO_ERA = 1 \
  52. && test $FUNC_NL_LANGINFO_YESEXPR_WORKS = 1 \
  53. && test $NL_LANGINFO_MTSAFE = 1; then
  54. :
  55. else
  56. REPLACE_NL_LANGINFO=1
  57. AC_DEFINE([REPLACE_NL_LANGINFO], [1],
  58. [Define if nl_langinfo exists but is overridden by gnulib.])
  59. fi
  60. else
  61. HAVE_NL_LANGINFO=0
  62. fi
  63. if test $HAVE_NL_LANGINFO = 0 || test $HAVE_LANGINFO_CODESET = 0; then
  64. LIB_NL_LANGINFO="$SETLOCALE_NULL_LIB"
  65. else
  66. LIB_NL_LANGINFO=
  67. fi
  68. dnl LIB_NL_LANGINFO is expected to be empty everywhere.
  69. AC_SUBST([LIB_NL_LANGINFO])
  70. ])
  71. # Prerequisites of lib/nl_langinfo-lock.c.
  72. AC_DEFUN([gl_PREREQ_NL_LANGINFO_LOCK],
  73. [
  74. gl_VISIBILITY
  75. ])