1# nl_langinfo.m4 serial 5
2dnl Copyright (C) 2009-2014 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7AC_DEFUN([gl_FUNC_NL_LANGINFO],
8[
9  AC_REQUIRE([gl_LANGINFO_H_DEFAULTS])
10  AC_REQUIRE([gl_LANGINFO_H])
11  AC_CHECK_FUNCS_ONCE([nl_langinfo])
12  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
13  if test $ac_cv_func_nl_langinfo = yes; then
14    # On Irix 6.5, YESEXPR is defined, but nl_langinfo(YESEXPR) is broken.
15    AC_CACHE_CHECK([whether YESEXPR works],
16      [gl_cv_func_nl_langinfo_yesexpr_works],
17      [AC_RUN_IFELSE(
18         [AC_LANG_PROGRAM([[#include <langinfo.h>
19]], [[return !*nl_langinfo(YESEXPR);
20]])],
21         [gl_cv_func_nl_langinfo_yesexpr_works=yes],
22         [gl_cv_func_nl_langinfo_yesexpr_works=no],
23         [
24         case "$host_os" in
25                   # Guess no on irix systems.
26           irix*)  gl_cv_func_nl_langinfo_yesexpr_works="guessing no";;
27                   # Guess yes elsewhere.
28           *)      gl_cv_func_nl_langinfo_yesexpr_works="guessing yes";;
29         esac
30         ])
31      ])
32    case $gl_cv_func_nl_langinfo_yesexpr_works in
33      *yes) FUNC_NL_LANGINFO_YESEXPR_WORKS=1 ;;
34      *)    FUNC_NL_LANGINFO_YESEXPR_WORKS=0 ;;
35    esac
36    AC_DEFINE_UNQUOTED([FUNC_NL_LANGINFO_YESEXPR_WORKS],
37      [$FUNC_NL_LANGINFO_YESEXPR_WORKS],
38      [Define to 1 if nl_langinfo (YESEXPR) returns a non-empty string.])
39    if test $HAVE_LANGINFO_CODESET = 1 && test $HAVE_LANGINFO_ERA = 1 \
40        && test $FUNC_NL_LANGINFO_YESEXPR_WORKS = 1; then
41      :
42    else
43      REPLACE_NL_LANGINFO=1
44      AC_DEFINE([REPLACE_NL_LANGINFO], [1],
45        [Define if nl_langinfo exists but is overridden by gnulib.])
46    fi
47  else
48    HAVE_NL_LANGINFO=0
49  fi
50])
51