1 # nl_langinfo.m4 serial 7
2 dnl Copyright (C) 2009-2020 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.
7 AC_DEFUN([gl_FUNC_NL_LANGINFO],
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 AC_REQUIRE([gl_FUNC_SETLOCALE_NULL])
14 if test $ac_cv_func_nl_langinfo = yes; then
15 # On Irix 6.5, YESEXPR is defined, but nl_langinfo(YESEXPR) is broken.
16 AC_CACHE_CHECK([whether YESEXPR works],
17 [gl_cv_func_nl_langinfo_yesexpr_works],
19 [AC_LANG_PROGRAM([[#include <langinfo.h>
20 ]], [[return !*nl_langinfo(YESEXPR);
22 [gl_cv_func_nl_langinfo_yesexpr_works=yes],
23 [gl_cv_func_nl_langinfo_yesexpr_works=no],
26 # Guess no on irix systems.
27 irix*) gl_cv_func_nl_langinfo_yesexpr_works="guessing no";;
28 # Guess yes elsewhere.
29 *) gl_cv_func_nl_langinfo_yesexpr_works="guessing yes";;
33 case $gl_cv_func_nl_langinfo_yesexpr_works in
34 *yes) FUNC_NL_LANGINFO_YESEXPR_WORKS=1 ;;
35 *) FUNC_NL_LANGINFO_YESEXPR_WORKS=0 ;;
37 AC_DEFINE_UNQUOTED([FUNC_NL_LANGINFO_YESEXPR_WORKS],
38 [$FUNC_NL_LANGINFO_YESEXPR_WORKS],
39 [Define to 1 if nl_langinfo (YESEXPR) returns a non-empty string.])
40 if test $HAVE_LANGINFO_CODESET = 1 \
41 && test $HAVE_LANGINFO_T_FMT_AMPM = 1 \
42 && test $HAVE_LANGINFO_ALTMON = 1 \
43 && test $HAVE_LANGINFO_ERA = 1 \
44 && test $FUNC_NL_LANGINFO_YESEXPR_WORKS = 1; then
48 AC_DEFINE([REPLACE_NL_LANGINFO], [1],
49 [Define if nl_langinfo exists but is overridden by gnulib.])
54 if test $HAVE_NL_LANGINFO = 0 || test $HAVE_LANGINFO_CODESET = 0; then
55 LIB_NL_LANGINFO="$LIB_SETLOCALE_NULL"
59 dnl LIB_NL_LANGINFO is expected to be empty everywhere.
60 AC_SUBST([LIB_NL_LANGINFO])