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