1 # nl_langinfo.m4 serial 6
2 dnl Copyright (C) 2009-2018 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 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],
18 [AC_LANG_PROGRAM([[#include <langinfo.h>
19 ]], [[return !*nl_langinfo(YESEXPR);
21 [gl_cv_func_nl_langinfo_yesexpr_works=yes],
22 [gl_cv_func_nl_langinfo_yesexpr_works=no],
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";;
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 ;;
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 \
40 && test $HAVE_LANGINFO_T_FMT_AMPM = 1 \
41 && test $HAVE_LANGINFO_ALTMON = 1 \
42 && test $HAVE_LANGINFO_ERA = 1 \
43 && test $FUNC_NL_LANGINFO_YESEXPR_WORKS = 1; then
47 AC_DEFINE([REPLACE_NL_LANGINFO], [1],
48 [Define if nl_langinfo exists but is overridden by gnulib.])