# count-trailing-zeros.m4
dnl Copyright (C) 2013-2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_COUNT_TRAILING_ZEROS],
[
dnl We don't need (and can't compile) count_trailing_zeros_ll
dnl unless the type 'unsigned long long int' exists.
AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
])
# duplocale.m4 serial 11
# duplocale.m4 serial 12
dnl Copyright (C) 2009-2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
......@@ -8,6 +8,7 @@ AC_DEFUN([gl_FUNC_DUPLOCALE],
[
AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([gl_FUNC_SETLOCALE_NULL])
AC_CHECK_FUNCS_ONCE([duplocale])
if test $ac_cv_func_duplocale = yes; then
dnl Check against glibc bug where duplocale crashes.
......@@ -109,6 +110,14 @@ int main ()
else
HAVE_DUPLOCALE=0
fi
if test $REPLACE_DUPLOCALE = 1; then
LIB_DUPLOCALE="$LIB_SETLOCALE_NULL"
else
LIB_DUPLOCALE=
fi
dnl LIB_DUPLOCALE is expected to be '-pthread' or '-lpthread' on AIX
dnl with gcc or xlc, and empty otherwise.
AC_SUBST([LIB_DUPLOCALE])
])
# Prerequisites of lib/duplocale.c.
......
# gethrxtime.m4 serial 12
# gethrxtime.m4 serial 13
dnl Copyright (C) 2005-2006, 2008-2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
......@@ -62,6 +62,5 @@ AC_DEFUN([gl_ARITHMETIC_HRTIME_T],
# Prerequisites of lib/xtime.h.
AC_DEFUN([gl_XTIME],
[
AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
:
])
......@@ -415,12 +415,13 @@ AC_DEFUN([AC_C_RESTRICT],
nothing if this is not supported. Do not define if restrict is
supported directly. */
#undef restrict
/* Work around a bug in Sun C++: it does not support _Restrict or
__restrict__, even though the corresponding Sun C compiler ends up with
"#define restrict _Restrict" or "#define restrict __restrict__" in the
previous line. Perhaps some future version of Sun C++ will work with
restrict; if so, hopefully it defines __RESTRICT like Sun C does. */
#if defined __SUNPRO_CC && !defined __RESTRICT
/* Work around a bug in older versions of Sun C++, which did not
#define __restrict__ or support _Restrict or __restrict__
even though the corresponding Sun C compiler ended up with
"#define restrict _Restrict" or "#define restrict __restrict__"
in the previous line. This workaround can be removed once
we assume Oracle Developer Studio 12.5 (2016) or later. */
#if defined __SUNPRO_CC && !defined __RESTRICT && !defined __restrict__
# define _Restrict
# define __restrict__
#endif])
......
# iconv_open.m4 serial 15
# iconv_open.m4 serial 16
dnl Copyright (C) 2007-2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
......@@ -23,11 +23,12 @@ AC_DEFUN([gl_FUNC_ICONV_OPEN],
if test $gl_func_iconv_gnu = no; then
iconv_flavor=
case "$host_os" in
aix*) iconv_flavor=ICONV_FLAVOR_AIX ;;
irix*) iconv_flavor=ICONV_FLAVOR_IRIX ;;
hpux*) iconv_flavor=ICONV_FLAVOR_HPUX ;;
osf*) iconv_flavor=ICONV_FLAVOR_OSF ;;
solaris*) iconv_flavor=ICONV_FLAVOR_SOLARIS ;;
aix*) iconv_flavor=ICONV_FLAVOR_AIX ;;
irix*) iconv_flavor=ICONV_FLAVOR_IRIX ;;
hpux*) iconv_flavor=ICONV_FLAVOR_HPUX ;;
osf*) iconv_flavor=ICONV_FLAVOR_OSF ;;
solaris*) iconv_flavor=ICONV_FLAVOR_SOLARIS ;;
openedition*) iconv_flavor=ICONV_FLAVOR_ZOS ;;
esac
if test -n "$iconv_flavor"; then
AC_DEFINE_UNQUOTED([ICONV_FLAVOR], [$iconv_flavor],
......
# intl-thread-locale.m4 serial 5
# intl-thread-locale.m4 serial 7
dnl Copyright (C) 2015-2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
......@@ -17,7 +17,7 @@ dnl Check how to retrieve the name of a per-thread locale (POSIX locale_t).
dnl Sets gt_nameless_locales.
AC_DEFUN([gt_INTL_THREAD_LOCALE_NAME],
[
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
AC_REQUIRE([AC_CANONICAL_HOST])
dnl Persuade Solaris <locale.h> to define 'locale_t'.
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
......@@ -119,18 +119,20 @@ int main ()
;;
esac
dnl This code is for future use, in case we some day have to port to a
dnl platform where the locale_t type does not provide access to the name of
dnl each locale category. This code has the drawback that it requires the
dnl gnulib overrides of 'newlocale', 'duplocale', 'freelocale', which is a
dnl problem for GNU libunistring. Therefore try hard to avoid enabling this
dnl code!
dnl This code is for platforms where the locale_t type does not provide access
dnl to the name of each locale category. This code has the drawback that it
dnl requires the gnulib overrides of 'newlocale', 'duplocale', 'freelocale',
dnl which is a problem for GNU libunistring. Therefore try hard to avoid
dnl enabling this code!
gt_nameless_locales=no
if false; then
gt_nameless_locales=yes
AC_DEFINE([HAVE_NAMELESS_LOCALES], [1],
[Define if the locale_t type does not contain the name of each locale category.])
fi
case "$host_os" in
dnl It's needed on AIX 7.2.
aix*)
gt_nameless_locales=yes
AC_DEFINE([HAVE_NAMELESS_LOCALES], [1],
[Define if the locale_t type does not contain the name of each locale category.])
;;
esac
])
dnl Tests whether uselocale() exists and is usable.
......@@ -169,8 +171,8 @@ int main ()
[gt_cv_func_uselocale_works=no],
[# Guess no on AIX and z/OS, yes otherwise.
case "$host_os" in
aix* | mvs*) gt_cv_func_uselocale_works="guessing no" ;;
*) gt_cv_func_uselocale_works="guessing yes" ;;
aix* | openedition*) gt_cv_func_uselocale_works="guessing no" ;;
*) gt_cv_func_uselocale_works="guessing yes" ;;
esac
])
])
......
# intmax_t.m4 serial 8
# intmax_t.m4 serial 9
dnl Copyright (C) 1997-2004, 2006-2007, 2009-2019 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
......@@ -19,11 +19,7 @@ AC_DEFUN([gl_AC_TYPE_INTMAX_T],
AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
AC_REQUIRE([gl_AC_HEADER_STDINT_H])
if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then
AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
test $ac_cv_type_long_long_int = yes \
&& ac_type='long long' \
|| ac_type='long'
AC_DEFINE_UNQUOTED([intmax_t], [$ac_type],
AC_DEFINE_UNQUOTED([intmax_t], [long long],
[Define to long or long long if <inttypes.h> and <stdint.h> don't define.])
else
AC_DEFINE([HAVE_INTMAX_T], [1],
......@@ -57,11 +53,7 @@ AC_DEFUN([gt_AC_TYPE_INTMAX_T],
AC_DEFINE([HAVE_INTMAX_T], [1],
[Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
else
AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
test $ac_cv_type_long_long_int = yes \
&& ac_type='long long' \
|| ac_type='long'
AC_DEFINE_UNQUOTED([intmax_t], [$ac_type],
AC_DEFINE_UNQUOTED([intmax_t], [long long],
[Define to long or long long if <stdint.h> and <inttypes.h> don't define.])
fi
])
# inttypes.m4 serial 27
# inttypes.m4 serial 28
dnl Copyright (C) 2006-2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
......@@ -113,10 +113,8 @@ AC_DEFUN([gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION],
#if $2
#define CONDITION ($3)
#elif HAVE_LONG_LONG_INT
#define CONDITION ($4)
#else
#define CONDITION 0
#define CONDITION ($4)
#endif
int test[CONDITION ? 1 : -1];]])],
[gl_cv_test_$1=yes],
......
# locale_h.m4 serial 23
# locale_h.m4 serial 24
dnl Copyright (C) 2007, 2009-2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
......@@ -140,10 +140,11 @@ AC_DEFUN([gl_LOCALE_MODULE_INDICATOR],
AC_DEFUN([gl_LOCALE_H_DEFAULTS],
[
GNULIB_LOCALECONV=0; AC_SUBST([GNULIB_LOCALECONV])
GNULIB_SETLOCALE=0; AC_SUBST([GNULIB_SETLOCALE])
GNULIB_DUPLOCALE=0; AC_SUBST([GNULIB_DUPLOCALE])
GNULIB_LOCALENAME=0; AC_SUBST([GNULIB_LOCALENAME])
GNULIB_LOCALECONV=0; AC_SUBST([GNULIB_LOCALECONV])
GNULIB_SETLOCALE=0; AC_SUBST([GNULIB_SETLOCALE])
GNULIB_SETLOCALE_NULL=0; AC_SUBST([GNULIB_SETLOCALE_NULL])
GNULIB_DUPLOCALE=0; AC_SUBST([GNULIB_DUPLOCALE])
GNULIB_LOCALENAME=0; AC_SUBST([GNULIB_LOCALENAME])
dnl Assume proper GNU behavior unless another module says otherwise.
HAVE_NEWLOCALE=1; AC_SUBST([HAVE_NEWLOCALE])
HAVE_DUPLOCALE=1; AC_SUBST([HAVE_DUPLOCALE])
......
# malloca.m4 serial 1
# malloca.m4 serial 2
dnl Copyright (C) 2003-2004, 2006-2007, 2009-2019 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
......@@ -11,5 +11,4 @@ AC_DEFUN([gl_MALLOCA],
dnl @ALLOCA@ and @LTALLOCA@.
dnl gl_FUNC_ALLOCA dnl Already brought in by the module dependencies.
AC_REQUIRE([gl_EEMALLOC])
AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
])
# nl_langinfo.m4 serial 6
# nl_langinfo.m4 serial 7
dnl Copyright (C) 2009-2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
......@@ -10,6 +10,7 @@ AC_DEFUN([gl_FUNC_NL_LANGINFO],
AC_REQUIRE([gl_LANGINFO_H])
AC_CHECK_FUNCS_ONCE([nl_langinfo])
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
AC_REQUIRE([gl_FUNC_SETLOCALE_NULL])
if test $ac_cv_func_nl_langinfo = yes; then
# On Irix 6.5, YESEXPR is defined, but nl_langinfo(YESEXPR) is broken.
AC_CACHE_CHECK([whether YESEXPR works],
......@@ -50,4 +51,11 @@ AC_DEFUN([gl_FUNC_NL_LANGINFO],
else
HAVE_NL_LANGINFO=0
fi
if test $HAVE_NL_LANGINFO = 0 || test $HAVE_LANGINFO_CODESET = 0; then
LIB_NL_LANGINFO="$LIB_SETLOCALE_NULL"
else
LIB_NL_LANGINFO=
fi
dnl LIB_NL_LANGINFO is expected to be empty everywhere.
AC_SUBST([LIB_NL_LANGINFO])
])
# sched_yield.m4 serial 1
# sched_yield.m4 serial 2
dnl Copyright (C) 2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
......@@ -7,9 +7,8 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_SCHED_YIELD],
[
AC_REQUIRE([gl_SCHED_H_DEFAULTS])
AC_REQUIRE([gl_THREADLIB])
AC_REQUIRE([gl_PTHREADLIB])
AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([gl_YIELD])
if { case "$host_os" in mingw*) true;; *) false;; esac; } \
&& test $gl_threads_api = windows; then
......
# semaphore.m4 serial 1
dnl Copyright (C) 2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
# Sets LIB_SEMAPHORE to the library needed, in addition to $(LIBMULTITHREAD),
# for getting the <semaphore.h> functions.
AC_DEFUN([gl_SEMAPHORE],
[
AC_REQUIRE([gl_THREADLIB])
dnl sem_post is
dnl - in libc on macOS, FreeBSD, AIX, IRIX, Solaris 11, Haiku, Cygwin,
dnl - in libpthread on glibc systems, OpenBSD,
dnl - in libpthread or librt on NetBSD,
dnl - in librt on HP-UX 11, OSF/1, Solaris 10.
dnl On the platforms where -lpthread is needed, it is contained in
dnl $LIBMULTITHREAD. Therefore, the only library we need to test for is -lrt.
AC_CACHE_CHECK([for library needed for semaphore functions],
[gl_cv_semaphore_lib],
[save_LIBS="$LIBS"
LIBS="$LIBS $LIBMULTITHREAD"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <semaphore.h>]],
[[sem_post ((sem_t *)0);]])],
[gl_cv_semaphore_lib=none],
[LIBS="$LIBS -lrt"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <semaphore.h>]],
[[sem_post ((sem_t *)0);]])],
[gl_cv_semaphore_lib='-lrt'],
[gl_cv_semaphore_lib=none])
])
LIBS="$save_LIBS"
])
if test "x$gl_cv_semaphore_lib" = xnone; then
LIB_SEMAPHORE=
else
LIB_SEMAPHORE="$gl_cv_semaphore_lib"
fi
AC_SUBST([LIB_SEMAPHORE])
])
# setlocale.m4 serial 6
# setlocale.m4 serial 7
dnl Copyright (C) 2011-2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
......@@ -7,16 +7,20 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_SETLOCALE],
[
AC_REQUIRE([gl_LOCALE_H_DEFAULTS])
AC_REQUIRE([gl_FUNC_SETLOCALE_NULL])
AC_REQUIRE([AC_CANONICAL_HOST])
dnl Test whether we need to improve on the general working of setlocale.
NEED_SETLOCALE_IMPROVED=0
case "$host_os" in
dnl On native Windows systems, setlocale(category,NULL) does not look at
dnl the environment variables LC_ALL, category, and LANG.
mingw*) REPLACE_SETLOCALE=1 ;;
mingw*) NEED_SETLOCALE_IMPROVED=1 ;;
dnl On Cygwin 1.5.x, setlocale always succeeds but setlocale(LC_CTYPE,NULL)
dnl is then still "C".
cygwin*)
case `uname -r` in
1.5.*) REPLACE_SETLOCALE=1 ;;
1.5.*) NEED_SETLOCALE_IMPROVED=1 ;;
esac
;;
dnl On Android 4.3, setlocale(category,"C") always fails.
......@@ -42,10 +46,33 @@ int main ()
])
case "$gl_cv_func_setlocale_works" in
*yes) ;;
*) REPLACE_SETLOCALE=1 ;;
*) NEED_SETLOCALE_IMPROVED=1 ;;
esac
;;
esac
AC_DEFINE_UNQUOTED([NEED_SETLOCALE_IMPROVED], [$NEED_SETLOCALE_IMPROVED],
[Define to 1 to enable general improvements of setlocale.])
dnl Test whether we need a multithread-safe setlocale(category,NULL).
NEED_SETLOCALE_MTSAFE=0
if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then
NEED_SETLOCALE_MTSAFE=1
fi
AC_DEFINE_UNQUOTED([NEED_SETLOCALE_MTSAFE], [$NEED_SETLOCALE_MTSAFE],
[Define to 1 to enable a multithread-safety fix of setlocale.])
if test $NEED_SETLOCALE_IMPROVED = 1 || test $NEED_SETLOCALE_MTSAFE = 1; then
REPLACE_SETLOCALE=1
fi
if test $NEED_SETLOCALE_MTSAFE = 1; then
LIB_SETLOCALE="$LIB_SETLOCALE_NULL"
else
LIB_SETLOCALE=
fi
dnl LIB_SETLOCALE is expected to be '-pthread' or '-lpthread' on AIX with gcc
dnl or xlc, and empty otherwise.
AC_SUBST([LIB_SETLOCALE])
])
# Prerequisites of lib/setlocale.c.
......
# setlocale_null.m4 serial 2
dnl Copyright (C) 2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_SETLOCALE_NULL],
[
AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([gl_PTHREADLIB])
AC_CHECK_HEADERS_ONCE([threads.h])
AC_CACHE_CHECK([whether setlocale (LC_ALL, NULL) is multithread-safe],
[gl_cv_func_setlocale_null_all_mtsafe],
[case "$host_os" in
# Guess no on musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin.
*-musl* | darwin* | freebsd* | netbsd* | openbsd* | aix* | haiku* | cygwin*)
gl_cv_func_setlocale_null_all_mtsafe=no ;;
# Guess yes on glibc, HP-UX, IRIX, Solaris, native Windows.
*-gnu* | gnu* | hpux* | irix* | solaris* | mingw*)
gl_cv_func_setlocale_null_all_mtsafe=yes ;;
# If we don't know, obey --enable-cross-guesses.
*)
gl_cv_func_setlocale_null_all_mtsafe="$gl_cross_guess_normal" ;;
esac
])
dnl On platforms without multithreading, there is no issue.
case "$host_os" in
mingw*) ;;
*)
if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then
gl_cv_func_setlocale_null_all_mtsafe="trivially yes"
fi
;;
esac
case "$gl_cv_func_setlocale_null_all_mtsafe" in
*yes) SETLOCALE_NULL_ALL_MTSAFE=1 ;;
*) SETLOCALE_NULL_ALL_MTSAFE=0 ;;
esac
AC_DEFINE_UNQUOTED([SETLOCALE_NULL_ALL_MTSAFE], [$SETLOCALE_NULL_ALL_MTSAFE],
[Define to 1 if setlocale (LC_ALL, NULL) is multithread-safe.])
dnl This is about a single category (not LC_ALL).
AC_CACHE_CHECK([whether setlocale (category, NULL) is multithread-safe],
[gl_cv_func_setlocale_null_one_mtsafe],
[case "$host_os" in
# Guess no on OpenBSD, AIX.
openbsd* | aix*)
gl_cv_func_setlocale_null_one_mtsafe=no ;;
# Guess yes on glibc, musl libc, macOS, FreeBSD, NetBSD, HP-UX, IRIX, Solaris, Haiku, Cygwin, native Windows.
*-gnu* | gnu* | *-musl* | darwin* | freebsd* | netbsd* | hpux* | irix* | solaris* | haiku* | cygwin* | mingw*)
gl_cv_func_setlocale_null_one_mtsafe=yes ;;
# If we don't know, obey --enable-cross-guesses.
*)
gl_cv_func_setlocale_null_one_mtsafe="$gl_cross_guess_normal" ;;
esac
])
dnl On platforms without multithreading, there is no issue.
case "$host_os" in
mingw*) ;;
*)
if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then
gl_cv_func_setlocale_null_one_mtsafe="trivially yes"
fi
;;
esac
case "$gl_cv_func_setlocale_null_one_mtsafe" in
*yes) SETLOCALE_NULL_ONE_MTSAFE=1 ;;
*) SETLOCALE_NULL_ONE_MTSAFE=0 ;;
esac
AC_DEFINE_UNQUOTED([SETLOCALE_NULL_ONE_MTSAFE], [$SETLOCALE_NULL_ONE_MTSAFE],
[Define to 1 if setlocale (category, NULL) is multithread-safe.])
dnl Determine link dependencies of lib/setlocale_null.c and lib/setlocale-lock.c.
if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then
case "$host_os" in
mingw*) LIB_SETLOCALE_NULL= ;;
*)
gl_WEAK_SYMBOLS
case "$gl_cv_have_weak" in
*yes) LIB_SETLOCALE_NULL= ;;
*) LIB_SETLOCALE_NULL="$LIBPTHREAD" ;;
esac
;;
esac
else
LIB_SETLOCALE_NULL=
fi
dnl LIB_SETLOCALE_NULL is expected to be '-pthread' or '-lpthread' on AIX
dnl with gcc or xlc, and empty otherwise.
AC_SUBST([LIB_SETLOCALE_NULL])
])
# Prerequisites of lib/setlocale-lock.c.
AC_DEFUN([gl_PREREQ_SETLOCALE_LOCK],
[
gl_VISIBILITY
])
# stdint.m4 serial 53
# stdint.m4 serial 54
dnl Copyright (C) 2001-2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
......@@ -17,21 +17,12 @@ AC_DEFUN_ONCE([gl_STDINT_H],
AC_REQUIRE([gl_LIMITS_H])
AC_REQUIRE([gt_TYPE_WINT_T])
dnl Check for long long int and unsigned long long int.
AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
if test $ac_cv_type_long_long_int = yes; then
HAVE_LONG_LONG_INT=1
else
HAVE_LONG_LONG_INT=0
fi
AC_SUBST([HAVE_LONG_LONG_INT])
AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
if test $ac_cv_type_unsigned_long_long_int = yes; then
HAVE_UNSIGNED_LONG_LONG_INT=1
else
HAVE_UNSIGNED_LONG_LONG_INT=0
fi
AC_SUBST([HAVE_UNSIGNED_LONG_LONG_INT])
dnl For backward compatibility. Some packages may still be testing these
dnl macros.
AC_DEFINE([HAVE_LONG_LONG_INT], [1],
[Define to 1 if the system has the type 'long long int'.])
AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1],
[Define to 1 if the system has the type 'unsigned long long int'.])
dnl Check for <wchar.h>, in the same way as gl_WCHAR_H does.
AC_CHECK_HEADERS_ONCE([wchar.h])
......
# strfmon_l.m4 serial 1
# strfmon_l.m4 serial 2
dnl Copyright (C) 2017-2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
......@@ -7,6 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_STRFMON_L],
[
AC_REQUIRE([gl_MONETARY_H_DEFAULTS])
AC_REQUIRE([gt_LOCALE_FR_UTF8])
dnl Persuade glibc <monetary.h> to declare strfmon_l().
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
......@@ -20,17 +21,65 @@ AC_DEFUN([gl_FUNC_STRFMON_L],
dnl which was fixed in glibc-2.24.
AC_CACHE_CHECK([whether strfmon_l works],
[gl_cv_strfmon_l_works],
[AC_EGREP_CPP([Unlucky],
[
[
dnl Initial guess, used when cross-compiling or when no suitable locale
dnl is present.
case "$host_os" in
# Guess no on glibc versions < 2.24.
*-gnu* | gnu*)
AC_EGREP_CPP([Unlucky],
[
#include <features.h>
#ifdef __GNU_LIBRARY__
#if (__GLIBC__ == 2 && __GLIBC_MINOR__ < 24)
Unlucky GNU user
#endif
#endif
],
[gl_cv_strfmon_l_works=no],
[gl_cv_strfmon_l_works="guessing yes"])
],
[gl_cv_strfmon_l_works="guessing no"],
[gl_cv_strfmon_l_works="guessing yes"])
;;
# Guess no on FreeBSD and Cygwin.
freebsd* | cygwin*) gl_cv_strfmon_l_works="guessing no" ;;
# Guess yes otherwise.
*) gl_cv_strfmon_l_works="guessing yes" ;;
esac
if test $LOCALE_FR_UTF8 != none; then
AC_CHECK_HEADERS_ONCE([xlocale.h])
AC_RUN_IFELSE(
[AC_LANG_SOURCE([[
#include <monetary.h>
#include <locale.h>
#if HAVE_XLOCALE_H
# include <xlocale.h>
#endif
#include <string.h>
int main ()
{
/* On older glibc systems: expected_buf="$123.50" buf="$123,50"
On FreeBSD 12.0, Cygwin 2.9: expected_buf="$123.50" buf="123,50 $"
*/
if (setlocale (LC_ALL, "en_US.UTF-8") != NULL)
{
char expected_buf[80];
if (strfmon (expected_buf, sizeof (expected_buf), "%.2n", 123.5) >= 0)
if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
{
locale_t loc = newlocale (LC_ALL_MASK, "en_US.UTF-8", NULL);
if (loc != (locale_t) 0)
{
char buf[80];
if (strfmon_l (buf, sizeof (buf), loc, "%.2n", 123.5) >= 0)
return strcmp (buf, expected_buf) != 0;
}
}
}
return 0;
}]])],
[gl_cv_strfmon_l_works=yes],
[gl_cv_strfmon_l_works=no],
[:])
fi
])
if test "$gl_cv_strfmon_l_works" = no; then
REPLACE_STRFMON_L=1
......
# strtoimax.m4 serial 15
# strtoimax.m4 serial 16
dnl Copyright (C) 2002-2004, 2006, 2009-2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
......@@ -85,5 +85,4 @@ int main ()
# Prerequisites of lib/strtoimax.c.
AC_DEFUN([gl_PREREQ_STRTOIMAX], [
AC_CHECK_DECLS([strtoll])
AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
])
# strtoll.m4 serial 7
# strtoll.m4 serial 8
dnl Copyright (C) 2002, 2004, 2006, 2008-2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
......@@ -7,14 +7,9 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_STRTOLL],
[
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
dnl We don't need (and can't compile) the replacement strtoll
dnl unless the type 'long long int' exists.
AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
if test "$ac_cv_type_long_long_int" = yes; then
AC_CHECK_FUNCS([strtoll])
if test $ac_cv_func_strtoll = no; then
HAVE_STRTOLL=0
fi
AC_CHECK_FUNCS([strtoll])
if test $ac_cv_func_strtoll = no; then
HAVE_STRTOLL=0
fi
])
......
# strtoull.m4 serial 7
# strtoull.m4 serial 8
dnl Copyright (C) 2002, 2004, 2006, 2008-2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
......@@ -7,14 +7,9 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_STRTOULL],
[
AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
dnl We don't need (and can't compile) the replacement strtoull
dnl unless the type 'unsigned long long int' exists.
AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
if test "$ac_cv_type_unsigned_long_long_int" = yes; then
AC_CHECK_FUNCS([strtoull])
if test $ac_cv_func_strtoull = no; then
HAVE_STRTOULL=0
fi
AC_CHECK_FUNCS([strtoull])
if test $ac_cv_func_strtoull = no; then
HAVE_STRTOULL=0
fi
])
......