langinfo_h.m4 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. # langinfo_h.m4 serial 6
  2. dnl Copyright (C) 2009-2010 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_LANGINFO_H],
  7. [
  8. AC_REQUIRE([gl_LANGINFO_H_DEFAULTS])
  9. dnl Persuade glibc-2.0.6 <langinfo.h> to define CODESET.
  10. AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
  11. dnl <langinfo.h> is always overridden, because of GNULIB_POSIXCHECK.
  12. gl_CHECK_NEXT_HEADERS([langinfo.h])
  13. dnl Determine whether <langinfo.h> exists. It is missing on mingw and BeOS.
  14. HAVE_LANGINFO_CODESET=0
  15. HAVE_LANGINFO_ERA=0
  16. AC_CHECK_HEADERS_ONCE([langinfo.h])
  17. if test $ac_cv_header_langinfo_h = yes; then
  18. HAVE_LANGINFO_H=1
  19. dnl Determine what <langinfo.h> defines. CODESET and ERA etc. are missing
  20. dnl on OpenBSD 3.8.
  21. AC_CACHE_CHECK([whether langinfo.h defines CODESET],
  22. [gl_cv_header_langinfo_codeset],
  23. [AC_COMPILE_IFELSE(
  24. [AC_LANG_PROGRAM([[#include <langinfo.h>
  25. int a = CODESET;
  26. ]])],
  27. [gl_cv_header_langinfo_codeset=yes],
  28. [gl_cv_header_langinfo_codeset=no])
  29. ])
  30. if test $gl_cv_header_langinfo_codeset = yes; then
  31. HAVE_LANGINFO_CODESET=1
  32. fi
  33. AC_CACHE_CHECK([whether langinfo.h defines ERA],
  34. [gl_cv_header_langinfo_era],
  35. [AC_COMPILE_IFELSE(
  36. [AC_LANG_PROGRAM([[#include <langinfo.h>
  37. int a = ERA;
  38. ]])],
  39. [gl_cv_header_langinfo_era=yes],
  40. [gl_cv_header_langinfo_era=no])
  41. ])
  42. if test $gl_cv_header_langinfo_era = yes; then
  43. HAVE_LANGINFO_ERA=1
  44. fi
  45. else
  46. HAVE_LANGINFO_H=0
  47. fi
  48. AC_SUBST([HAVE_LANGINFO_H])
  49. AC_SUBST([HAVE_LANGINFO_CODESET])
  50. AC_SUBST([HAVE_LANGINFO_ERA])
  51. dnl Check for declarations of anything we want to poison if the
  52. dnl corresponding gnulib module is not in use.
  53. gl_WARN_ON_USE_PREPARE([[#include <langinfo.h>
  54. ]], [nl_langinfo])
  55. ])
  56. AC_DEFUN([gl_LANGINFO_MODULE_INDICATOR],
  57. [
  58. dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
  59. AC_REQUIRE([gl_LANGINFO_H_DEFAULTS])
  60. gl_MODULE_INDICATOR_SET_VARIABLE([$1])
  61. dnl Define it also as a C macro, for the benefit of the unit tests.
  62. gl_MODULE_INDICATOR_FOR_TESTS([$1])
  63. ])
  64. AC_DEFUN([gl_LANGINFO_H_DEFAULTS],
  65. [
  66. GNULIB_NL_LANGINFO=0; AC_SUBST([GNULIB_NL_LANGINFO])
  67. dnl Assume proper GNU behavior unless another module says otherwise.
  68. HAVE_NL_LANGINFO=1; AC_SUBST([HAVE_NL_LANGINFO])
  69. REPLACE_NL_LANGINFO=0; AC_SUBST([REPLACE_NL_LANGINFO])
  70. ])