Update from gnulib
This incorporates:
2019-12-23 mktime, nstrftime: tweak division performance
2019-12-22 count-leading-zeros: assume 'long long'
2019-12-22 count-one-bits: assume 'long long'
2019-12-22 count-trailing-zeros: assume 'long long'
2019-12-12 inttypes-incomplete: assume 'long long'
2019-12-22 malloca: assume 'long long'
2019-12-22 stdint: assume 'long long'
2019-12-22 strtoll, strtoimax, strtoumax: assume 'long long'
2019-12-22 prefer lib_SOURCES to unconditional AC_LIBOBJ
2019-12-19 nstrftime: avoid a shadowing warning
2019-12-18 improve port of AC_C_RESTRICT to Oracle C++
2019-12-12 stdalign: port to xlclang 16.01
2019-12-11 stddef, unistd: fix compilation error in C++ mode on MSVC
2019-12-08 fix compilation errors in C++ mode on Haiku
2019-12-08 fix compilation errors in 32-bit C++ mode on HP-UX 11/ia64
2019-12-08 fix compilation error in C++ mode on OpenBSD
* build-aux/config.guess, doc/misc/texinfo.tex:
* lib/count-leading-zeros.h, lib/count-one-bits.h:
* lib/count-trailing-zeros.h, lib/inttypes.in.h, lib/malloca.h:
* lib/mktime.c, lib/nstrftime.c, lib/signal.in.h, lib/stdalign.in.h:
* lib/stddef.in.h, lib/stdint.in.h, lib/stdio.in.h, lib/stdlib.in.h:
* lib/strtoimax.c, lib/unistd.in.h, m4/gnulib-common.m4:
* m4/inttypes.m4, m4/largefile.m4, m4/malloca.m4, m4/strtoimax.m4:
* m4/strtoll.m4:
Copy from Gnulib. Also, change copyright notices in some other
Gnulib-copied files to exactly match Gnulib, as Gnulib updated
them in a trivially different way.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
2020-01-01 03:11:22 +00:00
|
|
|
# strtoimax.m4 serial 16
|
2022-01-01 07:45:51 +00:00
|
|
|
dnl Copyright (C) 2002-2004, 2006, 2009-2022 Free Software Foundation,
|
|
|
|
dnl Inc.
|
2011-07-09 00:18:49 +00:00
|
|
|
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_STRTOIMAX],
|
|
|
|
[
|
|
|
|
AC_REQUIRE([gl_INTTYPES_H_DEFAULTS])
|
|
|
|
|
2011-09-03 23:08:32 +00:00
|
|
|
dnl On OSF/1 5.1 with cc, this function is declared but not defined.
|
|
|
|
AC_CHECK_FUNCS_ONCE([strtoimax])
|
2011-07-09 00:18:49 +00:00
|
|
|
AC_CHECK_DECLS_ONCE([strtoimax])
|
|
|
|
if test "$ac_cv_have_decl_strtoimax" != yes; then
|
|
|
|
HAVE_DECL_STRTOIMAX=0
|
|
|
|
fi
|
2012-05-26 23:14:36 +00:00
|
|
|
|
2013-10-12 20:00:38 +00:00
|
|
|
if test "$ac_cv_func_strtoimax" = yes; then
|
2012-05-26 23:14:36 +00:00
|
|
|
HAVE_STRTOIMAX=1
|
|
|
|
dnl On AIX 5.1, strtoimax() fails for values outside the 'int' range.
|
|
|
|
AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
|
|
|
|
AC_CACHE_CHECK([whether strtoimax works], [gl_cv_func_strtoimax],
|
|
|
|
[AC_RUN_IFELSE(
|
|
|
|
[AC_LANG_SOURCE([[
|
|
|
|
#include <errno.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <inttypes.h>
|
|
|
|
int main ()
|
|
|
|
{
|
|
|
|
if (sizeof (intmax_t) > sizeof (int))
|
|
|
|
{
|
|
|
|
const char *s = "4294967295";
|
|
|
|
char *p;
|
|
|
|
intmax_t res;
|
|
|
|
errno = 0;
|
|
|
|
res = strtoimax (s, &p, 10);
|
|
|
|
if (p != s + strlen (s))
|
|
|
|
return 1;
|
|
|
|
if (errno != 0)
|
|
|
|
return 2;
|
|
|
|
if (res != (intmax_t) 65535 * (intmax_t) 65537)
|
|
|
|
return 3;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const char *s = "2147483647";
|
|
|
|
char *p;
|
|
|
|
intmax_t res;
|
|
|
|
errno = 0;
|
|
|
|
res = strtoimax (s, &p, 10);
|
|
|
|
if (p != s + strlen (s))
|
|
|
|
return 1;
|
|
|
|
if (errno != 0)
|
|
|
|
return 2;
|
|
|
|
if (res != 2147483647)
|
|
|
|
return 3;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
]])],
|
|
|
|
[gl_cv_func_strtoimax=yes],
|
|
|
|
[gl_cv_func_strtoimax=no],
|
|
|
|
[case "$host_os" in
|
2017-07-14 02:24:06 +00:00
|
|
|
# Guess no on AIX 5.
|
|
|
|
aix5*) gl_cv_func_strtoimax="guessing no" ;;
|
|
|
|
# Guess yes on native Windows.
|
|
|
|
mingw*) gl_cv_func_strtoimax="guessing yes" ;;
|
|
|
|
# Guess yes otherwise.
|
|
|
|
*) gl_cv_func_strtoimax="guessing yes" ;;
|
2012-05-26 23:14:36 +00:00
|
|
|
esac
|
|
|
|
])
|
|
|
|
])
|
|
|
|
case "$gl_cv_func_strtoimax" in
|
|
|
|
*no) REPLACE_STRTOIMAX=1 ;;
|
|
|
|
esac
|
|
|
|
else
|
2013-10-12 20:00:38 +00:00
|
|
|
if test "$ac_cv_have_decl_strtoimax" = yes; then
|
|
|
|
# HP-UX 11.11 has "#define strtoimax(...) ..." but no function.
|
|
|
|
REPLACE_STRTOIMAX=1
|
|
|
|
fi
|
2012-05-26 23:14:36 +00:00
|
|
|
HAVE_STRTOIMAX=0
|
|
|
|
fi
|
2011-07-09 00:18:49 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
# Prerequisites of lib/strtoimax.c.
|
|
|
|
AC_DEFUN([gl_PREREQ_STRTOIMAX], [
|
|
|
|
AC_CHECK_DECLS([strtoll])
|
|
|
|
])
|