Commit aaa93559 authored by Paul Eggert's avatar Paul Eggert

Simpler version of strtoumax module.

parent 36009a21
......@@ -4,12 +4,9 @@
This is needed for the new integer-reading code in lread.c.
It automatically pulls in the following gnulib files, which
are used on old-fashioned platforms that don't have strtoumax:
lib/inttypes.in.h, lib/strtoimax.c, lib/strtol.c,
lib/strtoll.c, lib/strtoul.c, lib/strtoull.c, lib/strtoumax.c,
lib/verify.h, lib/wchar.in.h, m4/inttypes-pri.m4,
m4/inttypes.m4, m4/strtoimax.m4, m4/strtol.m4, m4/strtoll.m4,
m4/strtoul.m4, m4/strtoull.m4, m4/strtoumax.m4, m4/wchar_h.m4,
m4/wint_t.m4.
lib/inttypes.in.h, lib/strtoimax.c, lib/strtol.c, lib/strtoul.c,
lib/strtoull.c, lib/strtoumax.c, lib/verify.h, m4/inttypes.m4,
m4/strtoull.m4, m4/strtoumax.m4.
2011-04-20 Ken Brown <kbrown@cornell.edu>
......
......@@ -9,7 +9,7 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files careadlinkat crypto/md5 dtoastr filemode getloadavg getopt-gnu ignore-value intprops lstat mktime readlink socklen stdio strftime strtoumax symlink sys_stat
# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files careadlinkat crypto/md5 dtoastr filemode getloadavg getopt-gnu ignore-value intprops lstat manywarnings mktime readlink socklen stdio strftime strtoumax symlink sys_stat warnings
MOSTLYCLEANFILES += core *.stackdump
......@@ -574,57 +574,12 @@ EXTRA_libgnu_a_SOURCES += strftime.c
## end gnulib module strftime
## begin gnulib module strtoimax
EXTRA_DIST += strtoimax.c
EXTRA_libgnu_a_SOURCES += strtoimax.c
## end gnulib module strtoimax
## begin gnulib module strtol
EXTRA_DIST += strtol.c
EXTRA_libgnu_a_SOURCES += strtol.c
## end gnulib module strtol
## begin gnulib module strtoll
EXTRA_DIST += strtoll.c
EXTRA_libgnu_a_SOURCES += strtoll.c
## end gnulib module strtoll
## begin gnulib module strtoul
EXTRA_DIST += strtoul.c
EXTRA_libgnu_a_SOURCES += strtoul.c
## end gnulib module strtoul
## begin gnulib module strtoull
EXTRA_DIST += strtoull.c
EXTRA_libgnu_a_SOURCES += strtoull.c
## end gnulib module strtoull
## begin gnulib module strtoumax
EXTRA_DIST += strtoumax.c
EXTRA_DIST += strtoimax.c strtol.c strtoul.c strtoull.c strtoumax.c
EXTRA_libgnu_a_SOURCES += strtoumax.c
EXTRA_libgnu_a_SOURCES += strtoimax.c strtol.c strtoul.c strtoull.c strtoumax.c
## end gnulib module strtoumax
......@@ -906,126 +861,6 @@ EXTRA_DIST += $(top_srcdir)/./warn-on-use.h
## end gnulib module warn-on-use
## begin gnulib module wchar
BUILT_SOURCES += wchar.h
# We need the following in order to create <wchar.h> when the system
# version does not work standalone.
wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \
-e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \
-e 's|@''HAVE_WCHAR_H''@|$(HAVE_WCHAR_H)|g' \
-e 's|@''GNULIB_BTOWC''@|$(GNULIB_BTOWC)|g' \
-e 's|@''GNULIB_WCTOB''@|$(GNULIB_WCTOB)|g' \
-e 's|@''GNULIB_MBSINIT''@|$(GNULIB_MBSINIT)|g' \
-e 's|@''GNULIB_MBRTOWC''@|$(GNULIB_MBRTOWC)|g' \
-e 's|@''GNULIB_MBRLEN''@|$(GNULIB_MBRLEN)|g' \
-e 's|@''GNULIB_MBSRTOWCS''@|$(GNULIB_MBSRTOWCS)|g' \
-e 's|@''GNULIB_MBSNRTOWCS''@|$(GNULIB_MBSNRTOWCS)|g' \
-e 's|@''GNULIB_WCRTOMB''@|$(GNULIB_WCRTOMB)|g' \
-e 's|@''GNULIB_WCSRTOMBS''@|$(GNULIB_WCSRTOMBS)|g' \
-e 's|@''GNULIB_WCSNRTOMBS''@|$(GNULIB_WCSNRTOMBS)|g' \
-e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \
-e 's|@''GNULIB_WMEMCHR''@|$(GNULIB_WMEMCHR)|g' \
-e 's|@''GNULIB_WMEMCMP''@|$(GNULIB_WMEMCMP)|g' \
-e 's|@''GNULIB_WMEMCPY''@|$(GNULIB_WMEMCPY)|g' \
-e 's|@''GNULIB_WMEMMOVE''@|$(GNULIB_WMEMMOVE)|g' \
-e 's|@''GNULIB_WMEMSET''@|$(GNULIB_WMEMSET)|g' \
-e 's|@''GNULIB_WCSLEN''@|$(GNULIB_WCSLEN)|g' \
-e 's|@''GNULIB_WCSNLEN''@|$(GNULIB_WCSNLEN)|g' \
-e 's|@''GNULIB_WCSCPY''@|$(GNULIB_WCSCPY)|g' \
-e 's|@''GNULIB_WCPCPY''@|$(GNULIB_WCPCPY)|g' \
-e 's|@''GNULIB_WCSNCPY''@|$(GNULIB_WCSNCPY)|g' \
-e 's|@''GNULIB_WCPNCPY''@|$(GNULIB_WCPNCPY)|g' \
-e 's|@''GNULIB_WCSCAT''@|$(GNULIB_WCSCAT)|g' \
-e 's|@''GNULIB_WCSNCAT''@|$(GNULIB_WCSNCAT)|g' \
-e 's|@''GNULIB_WCSCMP''@|$(GNULIB_WCSCMP)|g' \
-e 's|@''GNULIB_WCSNCMP''@|$(GNULIB_WCSNCMP)|g' \
-e 's|@''GNULIB_WCSCASECMP''@|$(GNULIB_WCSCASECMP)|g' \
-e 's|@''GNULIB_WCSNCASECMP''@|$(GNULIB_WCSNCASECMP)|g' \
-e 's|@''GNULIB_WCSCOLL''@|$(GNULIB_WCSCOLL)|g' \
-e 's|@''GNULIB_WCSXFRM''@|$(GNULIB_WCSXFRM)|g' \
-e 's|@''GNULIB_WCSDUP''@|$(GNULIB_WCSDUP)|g' \
-e 's|@''GNULIB_WCSCHR''@|$(GNULIB_WCSCHR)|g' \
-e 's|@''GNULIB_WCSRCHR''@|$(GNULIB_WCSRCHR)|g' \
-e 's|@''GNULIB_WCSCSPN''@|$(GNULIB_WCSCSPN)|g' \
-e 's|@''GNULIB_WCSSPN''@|$(GNULIB_WCSSPN)|g' \
-e 's|@''GNULIB_WCSPBRK''@|$(GNULIB_WCSPBRK)|g' \
-e 's|@''GNULIB_WCSSTR''@|$(GNULIB_WCSSTR)|g' \
-e 's|@''GNULIB_WCSTOK''@|$(GNULIB_WCSTOK)|g' \
-e 's|@''GNULIB_WCSWIDTH''@|$(GNULIB_WCSWIDTH)|g' \
< $(srcdir)/wchar.in.h | \
sed -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \
-e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \
-e 's|@''HAVE_MBSINIT''@|$(HAVE_MBSINIT)|g' \
-e 's|@''HAVE_MBRTOWC''@|$(HAVE_MBRTOWC)|g' \
-e 's|@''HAVE_MBRLEN''@|$(HAVE_MBRLEN)|g' \
-e 's|@''HAVE_MBSRTOWCS''@|$(HAVE_MBSRTOWCS)|g' \
-e 's|@''HAVE_MBSNRTOWCS''@|$(HAVE_MBSNRTOWCS)|g' \
-e 's|@''HAVE_WCRTOMB''@|$(HAVE_WCRTOMB)|g' \
-e 's|@''HAVE_WCSRTOMBS''@|$(HAVE_WCSRTOMBS)|g' \
-e 's|@''HAVE_WCSNRTOMBS''@|$(HAVE_WCSNRTOMBS)|g' \
-e 's|@''HAVE_WMEMCHR''@|$(HAVE_WMEMCHR)|g' \
-e 's|@''HAVE_WMEMCMP''@|$(HAVE_WMEMCMP)|g' \
-e 's|@''HAVE_WMEMCPY''@|$(HAVE_WMEMCPY)|g' \
-e 's|@''HAVE_WMEMMOVE''@|$(HAVE_WMEMMOVE)|g' \
-e 's|@''HAVE_WMEMSET''@|$(HAVE_WMEMSET)|g' \
-e 's|@''HAVE_WCSLEN''@|$(HAVE_WCSLEN)|g' \
-e 's|@''HAVE_WCSNLEN''@|$(HAVE_WCSNLEN)|g' \
-e 's|@''HAVE_WCSCPY''@|$(HAVE_WCSCPY)|g' \
-e 's|@''HAVE_WCPCPY''@|$(HAVE_WCPCPY)|g' \
-e 's|@''HAVE_WCSNCPY''@|$(HAVE_WCSNCPY)|g' \
-e 's|@''HAVE_WCPNCPY''@|$(HAVE_WCPNCPY)|g' \
-e 's|@''HAVE_WCSCAT''@|$(HAVE_WCSCAT)|g' \
-e 's|@''HAVE_WCSNCAT''@|$(HAVE_WCSNCAT)|g' \
-e 's|@''HAVE_WCSCMP''@|$(HAVE_WCSCMP)|g' \
-e 's|@''HAVE_WCSNCMP''@|$(HAVE_WCSNCMP)|g' \
-e 's|@''HAVE_WCSCASECMP''@|$(HAVE_WCSCASECMP)|g' \
-e 's|@''HAVE_WCSNCASECMP''@|$(HAVE_WCSNCASECMP)|g' \
-e 's|@''HAVE_WCSCOLL''@|$(HAVE_WCSCOLL)|g' \
-e 's|@''HAVE_WCSXFRM''@|$(HAVE_WCSXFRM)|g' \
-e 's|@''HAVE_WCSDUP''@|$(HAVE_WCSDUP)|g' \
-e 's|@''HAVE_WCSCHR''@|$(HAVE_WCSCHR)|g' \
-e 's|@''HAVE_WCSRCHR''@|$(HAVE_WCSRCHR)|g' \
-e 's|@''HAVE_WCSCSPN''@|$(HAVE_WCSCSPN)|g' \
-e 's|@''HAVE_WCSSPN''@|$(HAVE_WCSSPN)|g' \
-e 's|@''HAVE_WCSPBRK''@|$(HAVE_WCSPBRK)|g' \
-e 's|@''HAVE_WCSSTR''@|$(HAVE_WCSSTR)|g' \
-e 's|@''HAVE_WCSTOK''@|$(HAVE_WCSTOK)|g' \
-e 's|@''HAVE_WCSWIDTH''@|$(HAVE_WCSWIDTH)|g' \
-e 's|@''HAVE_DECL_WCTOB''@|$(HAVE_DECL_WCTOB)|g' \
-e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \
| \
sed -e 's|@''REPLACE_MBSTATE_T''@|$(REPLACE_MBSTATE_T)|g' \
-e 's|@''REPLACE_BTOWC''@|$(REPLACE_BTOWC)|g' \
-e 's|@''REPLACE_WCTOB''@|$(REPLACE_WCTOB)|g' \
-e 's|@''REPLACE_MBSINIT''@|$(REPLACE_MBSINIT)|g' \
-e 's|@''REPLACE_MBRTOWC''@|$(REPLACE_MBRTOWC)|g' \
-e 's|@''REPLACE_MBRLEN''@|$(REPLACE_MBRLEN)|g' \
-e 's|@''REPLACE_MBSRTOWCS''@|$(REPLACE_MBSRTOWCS)|g' \
-e 's|@''REPLACE_MBSNRTOWCS''@|$(REPLACE_MBSNRTOWCS)|g' \
-e 's|@''REPLACE_WCRTOMB''@|$(REPLACE_WCRTOMB)|g' \
-e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|g' \
-e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \
-e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
-e 's|@''REPLACE_WCSWIDTH''@|$(REPLACE_WCSWIDTH)|g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
} > $@-t && \
mv $@-t $@
MOSTLYCLEANFILES += wchar.h wchar.h-t
EXTRA_DIST += wchar.in.h
## end gnulib module wchar
mostlyclean-local: mostlyclean-generic
@for dir in '' $(MOSTLYCLEANDIRS); do \
......
......@@ -186,9 +186,8 @@
# define LOCALE_PARAM_PROTO
#endif
#include <wchar.h>
#ifdef USE_WIDE_CHAR
# include <wchar.h>
# include <wctype.h>
# define L_(Ch) L##Ch
# define UCHAR_TYPE wint_t
......
/* Function to parse a `long long int' from text.
Copyright (C) 1995-1997, 1999, 2001, 2009-2011 Free Software Foundation,
Inc.
This file is part of the GNU C Library.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#define QUAD 1
#include <strtol.c>
#ifdef _LIBC
# ifdef SHARED
# include <shlib-compat.h>
# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
compat_symbol (libc, __strtoll_internal, __strtoq_internal, GLIBC_2_0);
# endif
# endif
weak_alias (strtoll, strtoq)
#endif
This diff is collapsed.
......@@ -45,6 +45,7 @@ AC_DEFUN([gl_EARLY],
# Code from module intprops:
# Code from module inttypes:
# Code from module lstat:
# Code from module manywarnings:
# Code from module mktime:
# Code from module multiarch:
# Code from module readlink:
......@@ -57,11 +58,6 @@ AC_DEFUN([gl_EARLY],
# Code from module stdio:
# Code from module stdlib:
# Code from module strftime:
# Code from module strtoimax:
# Code from module strtol:
# Code from module strtoll:
# Code from module strtoul:
# Code from module strtoull:
# Code from module strtoumax:
# Code from module symlink:
# Code from module sys_stat:
......@@ -70,7 +66,7 @@ AC_DEFUN([gl_EARLY],
# Code from module unistd:
# Code from module verify:
# Code from module warn-on-use:
# Code from module wchar:
# Code from module warnings:
])
# This macro should be invoked from ./configure.in, in the section
......@@ -122,6 +118,7 @@ AC_DEFUN([gl_INIT],
# Code from module lstat:
gl_FUNC_LSTAT
gl_SYS_STAT_MODULE_INDICATOR([lstat])
# Code from module manywarnings:
# Code from module mktime:
gl_FUNC_MKTIME
gl_TIME_MODULE_INDICATOR([mktime])
......@@ -149,19 +146,6 @@ AC_DEFUN([gl_INIT],
gl_STDLIB_H
# Code from module strftime:
gl_FUNC_GNU_STRFTIME
# Code from module strtoimax:
gl_FUNC_STRTOIMAX
gl_INTTYPES_MODULE_INDICATOR([strtoimax])
# Code from module strtol:
gl_FUNC_STRTOL
# Code from module strtoll:
gl_FUNC_STRTOLL
gl_STDLIB_MODULE_INDICATOR([strtoll])
# Code from module strtoul:
gl_FUNC_STRTOUL
# Code from module strtoull:
gl_FUNC_STRTOULL
gl_STDLIB_MODULE_INDICATOR([strtoull])
# Code from module strtoumax:
gl_FUNC_STRTOUMAX
gl_INTTYPES_MODULE_INDICATOR([strtoumax])
......@@ -180,8 +164,8 @@ AC_DEFUN([gl_INIT],
gl_UNISTD_H
# Code from module verify:
# Code from module warn-on-use:
# Code from module wchar:
gl_WCHAR_H
# Code from module warnings:
AC_SUBST([WARN_CFLAGS])
# End of code from modules
m4_ifval(gl_LIBSOURCES_LIST, [
m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ ||
......@@ -360,7 +344,6 @@ AC_DEFUN([gl_FILE_LIST], [
lib/strftime.h
lib/strtoimax.c
lib/strtol.c
lib/strtoll.c
lib/strtoul.c
lib/strtoull.c
lib/strtoumax.c
......@@ -370,7 +353,6 @@ AC_DEFUN([gl_FILE_LIST], [
lib/time_r.c
lib/unistd.in.h
lib/verify.h
lib/wchar.in.h
m4/00gnulib.m4
m4/c-strtod.m4
m4/extensions.m4
......@@ -379,10 +361,10 @@ AC_DEFUN([gl_FILE_LIST], [
m4/getopt.m4
m4/gnulib-common.m4
m4/include_next.m4
m4/inttypes-pri.m4
m4/inttypes.m4
m4/longlong.m4
m4/lstat.m4
m4/manywarnings.m4
m4/md5.m4
m4/mktime.m4
m4/multiarch.m4
......@@ -397,10 +379,6 @@ AC_DEFUN([gl_FILE_LIST], [
m4/stdio_h.m4
m4/stdlib_h.m4
m4/strftime.m4
m4/strtoimax.m4
m4/strtol.m4
m4/strtoll.m4
m4/strtoul.m4
m4/strtoull.m4
m4/strtoumax.m4
m4/symlink.m4
......@@ -410,7 +388,6 @@ AC_DEFUN([gl_FILE_LIST], [
m4/tm_gmtoff.m4
m4/unistd_h.m4
m4/warn-on-use.m4
m4/wchar_h.m4
m4/warnings.m4
m4/wchar_t.m4
m4/wint_t.m4
])
# inttypes-pri.m4 serial 7 (gettext-0.18.2)
dnl Copyright (C) 1997-2002, 2006, 2008-2011 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.
dnl From Bruno Haible.
AC_PREREQ([2.53])
# Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI*
# macros to non-string values. This is the case on AIX 4.3.3.
AC_DEFUN([gt_INTTYPES_PRI],
[
AC_CHECK_HEADERS([inttypes.h])
if test $ac_cv_header_inttypes_h = yes; then
AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken],
[gt_cv_inttypes_pri_broken],
[
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[
#include <inttypes.h>
#ifdef PRId32
char *p = PRId32;
#endif
]],
[[]])],
[gt_cv_inttypes_pri_broken=no],
[gt_cv_inttypes_pri_broken=yes])
])
fi
if test "$gt_cv_inttypes_pri_broken" = yes; then
AC_DEFINE_UNQUOTED([PRI_MACROS_BROKEN], [1],
[Define if <inttypes.h> exists and defines unusable PRI* macros.])
PRI_MACROS_BROKEN=1
else
PRI_MACROS_BROKEN=0
fi
AC_SUBST([PRI_MACROS_BROKEN])
])
# inttypes.m4 serial 18
# inttypes.m4 serial 19
dnl Copyright (C) 2006-2011 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,138 +10,11 @@ dnl Test whether <inttypes.h> is supported or must be substituted.
AC_DEFUN([gl_INTTYPES_H],
[
AC_REQUIRE([gl_STDINT_H])
AC_REQUIRE([gt_INTTYPES_PRI])
AC_CHECK_HEADERS_ONCE([inttypes.h])
AC_CHECK_DECLS_ONCE([imaxabs])
AC_CHECK_DECLS_ONCE([imaxdiv])
AC_CHECK_DECLS_ONCE([strtoimax])
AC_CHECK_DECLS_ONCE([strtoumax])
dnl Now see if we need a substitute <inttypes.h>.
dnl A complete <inttypes.h> requires
dnl - a complete <stdint.h>,
dnl - the existence of an <inttypes.h>,
dnl - that imaxabs, imaxdiv, strtoimax, strtoumax are declared,
dnl - some additional tests.
AC_CACHE_CHECK([whether inttypes.h conforms to C99],
[gl_cv_header_working_inttypes_h],
[gl_cv_header_working_inttypes_h=no
if test "$gl_cv_header_working_stdint_h" = yes \
&& test $ac_cv_header_inttypes_h = yes \
&& test "$ac_cv_have_decl_imaxabs" = yes \
&& test "$ac_cv_have_decl_imaxdiv" = yes \
&& test "$ac_cv_have_decl_strtoimax" = yes \
&& test "$ac_cv_have_decl_strtoumax" = yes; then
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#include <stddef.h>
#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */
#define __STDC_FORMAT_MACROS 1 /* to make it work also in C++ mode */
#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H /* work if build isn't clean */
#include <inttypes.h>
/* No need to duplicate the tests of stdint.m4; they are subsumed by
$gl_cv_header_working_stdint_h = yes. */
/* Tests for macros supposed to be defined in inttypes.h. */
const char *k = /* implicit string concatenation */
#ifdef INT8_MAX
PRId8 PRIi8
#endif
#ifdef UINT8_MAX
PRIo8 PRIu8 PRIx8 PRIX8
#endif
#ifdef INT16_MAX
PRId16 PRIi16
#endif
#ifdef UINT16_MAX
PRIo16 PRIu16 PRIx16 PRIX16
#endif
#ifdef INT32_MAX
PRId32 PRIi32
#endif
#ifdef UINT32_MAX
PRIo32 PRIu32 PRIx32 PRIX32
#endif
#ifdef INT64_MAX
PRId64 PRIi64
#endif
#ifdef UINT64_MAX
PRIo64 PRIu64 PRIx64 PRIX64
#endif
PRIdLEAST8 PRIiLEAST8 PRIoLEAST8 PRIuLEAST8 PRIxLEAST8 PRIXLEAST8
PRIdLEAST16 PRIiLEAST16 PRIoLEAST16 PRIuLEAST16 PRIxLEAST16 PRIXLEAST16
PRIdLEAST32 PRIiLEAST32 PRIoLEAST32 PRIuLEAST32 PRIxLEAST32 PRIXLEAST32
PRIdLEAST64 PRIiLEAST64
PRIoLEAST64 PRIuLEAST64 PRIxLEAST64 PRIXLEAST64
PRIdFAST8 PRIiFAST8 PRIoFAST8 PRIuFAST8 PRIxFAST8 PRIXFAST8
PRIdFAST16 PRIiFAST16 PRIoFAST16 PRIuFAST16 PRIxFAST16 PRIXFAST16
PRIdFAST32 PRIiFAST32 PRIoFAST32 PRIuFAST32 PRIxFAST32 PRIXFAST32
PRIdFAST64 PRIiFAST64
PRIoFAST64 PRIuFAST64 PRIxFAST64 PRIXFAST64
PRIdMAX PRIiMAX PRIoMAX PRIuMAX PRIxMAX PRIXMAX
#ifdef INTPTR_MAX
PRIdPTR PRIiPTR
#endif
#ifdef UINTPTR_MAX
PRIoPTR PRIuPTR PRIxPTR PRIXPTR
#endif
;
const char *l = /* implicit string concatenation */
#ifdef INT8_MAX
SCNd8 SCNi8
#endif
#ifdef UINT8_MAX
SCNo8 SCNu8 SCNx8
#endif
#ifdef INT16_MAX
SCNd16 SCNi16
#endif
#ifdef UINT16_MAX
SCNo16 SCNu16 SCNx16
#endif
#ifdef INT32_MAX
SCNd32 SCNi32
#endif
#ifdef UINT32_MAX
SCNo32 SCNu32 SCNx32
#endif
#ifdef INT64_MAX
SCNd64 SCNi64
#endif
#ifdef UINT64_MAX
SCNo64 SCNu64 SCNx64
#endif
SCNdLEAST8 SCNiLEAST8 SCNoLEAST8 SCNuLEAST8 SCNxLEAST8
SCNdLEAST16 SCNiLEAST16 SCNoLEAST16 SCNuLEAST16 SCNxLEAST16
SCNdLEAST32 SCNiLEAST32 SCNoLEAST32 SCNuLEAST32 SCNxLEAST32
SCNdLEAST64 SCNiLEAST64
SCNoLEAST64 SCNuLEAST64 SCNxLEAST64
SCNdFAST8 SCNiFAST8 SCNoFAST8 SCNuFAST8 SCNxFAST8
SCNdFAST16 SCNiFAST16 SCNoFAST16 SCNuFAST16 SCNxFAST16
SCNdFAST32 SCNiFAST32 SCNoFAST32 SCNuFAST32 SCNxFAST32
SCNdFAST64 SCNiFAST64
SCNoFAST64 SCNuFAST64 SCNxFAST64
SCNdMAX SCNiMAX SCNoMAX SCNuMAX SCNxMAX
#ifdef INTPTR_MAX
SCNdPTR SCNiPTR
#endif
#ifdef UINTPTR_MAX
SCNoPTR SCNuPTR SCNxPTR
#endif
;
]])],
[gl_cv_header_working_inttypes_h=yes])
fi])
dnl Override <inttypes.h> always, so that the portability warnings work.
AC_REQUIRE([gl_INTTYPES_H_DEFAULTS])
gl_CHECK_NEXT_HEADERS([inttypes.h])
AC_REQUIRE([gl_MULTIARCH])
dnl Ensure that <stdint.h> defines the limit macros, since gnulib's
dnl <inttypes.h> relies on them. This macro is only needed when a
dnl C++ compiler is in use; it has no effect for a C compiler.
......@@ -158,129 +31,12 @@ const char *l = /* implicit string concatenation */
#endif
])
PRIPTR_PREFIX=
if test -n "$STDINT_H"; then
dnl Using the gnulib <stdint.h>. It always defines intptr_t to 'long'.
PRIPTR_PREFIX='"l"'
else
dnl Using the system's <stdint.h>.
for glpfx in '' l ll I64; do
case $glpfx in
'') gltype1='int';;
l) gltype1='long int';;
ll) gltype1='long long int';;
I64) gltype1='__int64';;
esac
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <stdint.h>
extern intptr_t foo;
extern $gltype1 foo;]])],
[PRIPTR_PREFIX='"'$glpfx'"'])
test -n "$PRIPTR_PREFIX" && break
done
fi
AC_SUBST([PRIPTR_PREFIX])
if test "$ac_cv_have_decl_imaxabs" = yes; then
HAVE_DECL_IMAXABS=1
else
HAVE_DECL_IMAXABS=0
fi
if test "$ac_cv_have_decl_imaxdiv" = yes; then
HAVE_DECL_IMAXDIV=1
else
HAVE_DECL_IMAXDIV=0
fi
if test "$ac_cv_have_decl_strtoimax" = yes; then
HAVE_DECL_STRTOIMAX=1
else
HAVE_DECL_STRTOIMAX=0
fi
if test "$ac_cv_have_decl_strtoumax" = yes; then
HAVE_DECL_STRTOUMAX=1
else
HAVE_DECL_STRTOUMAX=0
fi
gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION(
[INT32_MAX_LT_INTMAX_MAX],
[defined INT32_MAX && defined INTMAX_MAX],
[INT32_MAX < INTMAX_MAX],
[sizeof (int) < sizeof (long long int)])
if test $APPLE_UNIVERSAL_BUILD = 0; then
gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION(
[INT64_MAX_EQ_LONG_MAX],
[defined INT64_MAX],
[INT64_MAX == LONG_MAX],
[sizeof (long long int) == sizeof (long int)])
else
INT64_MAX_EQ_LONG_MAX=-1
fi
gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION(
[UINT32_MAX_LT_UINTMAX_MAX],
[defined UINT32_MAX && defined UINTMAX_MAX],
[UINT32_MAX < UINTMAX_MAX],
[sizeof (unsigned int) < sizeof (unsigned long long int)])
if test $APPLE_UNIVERSAL_BUILD = 0; then
gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION(
[UINT64_MAX_EQ_ULONG_MAX],
[defined UINT64_MAX],
[UINT64_MAX == ULONG_MAX],
[sizeof (unsigned long long int) == sizeof (unsigned long int)])
else
UINT64_MAX_EQ_ULONG_MAX=-1
fi
dnl Check for declarations of anything we want to poison if the
dnl corresponding gnulib module is not in use.
gl_WARN_ON_USE_PREPARE([[#include <inttypes.h>
]], [imaxabs imaxdiv strtoimax strtoumax])
])
# Define the symbol $1 to be 1 if the condition is true, 0 otherwise.
# If $2 is true, the condition is $3; otherwise if long long int is supported
# approximate the condition with $4; otherwise, assume the condition is false.
# The condition should work on all C99 platforms; the approximations should be
# good enough to work on all practical pre-C99 platforms.
# $2 is evaluated by the C preprocessor, $3 and $4 as compile-time constants.
AC_DEFUN([gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION],
[
AC_CACHE_CHECK([whether $3],
[gl_cv_test_$1],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[/* Work also in C++ mode. */
#define __STDC_LIMIT_MACROS 1
/* Work if build is not clean. */
#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H
#include <limits.h>
#if HAVE_STDINT_H
#include <stdint.h>
#endif
#if $2
#define CONDITION ($3)
#elif HAVE_LONG_LONG_INT
#define CONDITION ($4)
#else
#define CONDITION 0
#endif
int test[CONDITION ? 1 : -1];]])],
[gl_cv_test_$1=yes],
[gl_cv_test_$1=no])])
if test $gl_cv_test_$1 = yes; then
$1=1;
else
$1=0;
fi
AC_SUBST([$1])
])
AC_DEFUN([gl_INTTYPES_MODULE_INDICATOR],
[
dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
......@@ -299,4 +55,8 @@ AC_DEFUN([gl_INTTYPES_H_DEFAULTS],
HAVE_DECL_IMAXDIV=1; AC_SUBST([HAVE_DECL_IMAXDIV])
HAVE_DECL_STRTOIMAX=1; AC_SUBST([HAVE_DECL_STRTOIMAX])
HAVE_DECL_STRTOUMAX=1; AC_SUBST([HAVE_DECL_STRTOUMAX])
INT64_MAX_EQ_LONG_MAX='defined _LP64'; AC_SUBST([INT64_MAX_EQ_LONG_MAX])
PRI_MACROS_BROKEN=0; AC_SUBST([PRI_MACROS_BROKEN])
PRIPTR_PREFIX=__PRIPTR_PREFIX; AC_SUBST([PRIPTR_PREFIX])
UINT64_MAX_EQ_ULONG_MAX='defined _LP64'; AC_SUBST([UINT64_MAX_EQ_ULONG_MAX])
])
# strtoimax.m4 serial 8
dnl Copyright (C) 2002-2004, 2006, 2009-2011 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_STRTOIMAX],
[
AC_CACHE_CHECK([whether <inttypes.h> defines strtoimax as a macro],
gl_cv_func_strtoimax_macro,
[AC_EGREP_CPP([inttypes_h_defines_strtoimax], [#include <inttypes.h>
#ifdef strtoimax
inttypes_h_defines_strtoimax
#endif],
gl_cv_func_strtoimax_macro=yes,
gl_cv_func_strtoimax_macro=no)])
if test "$gl_cv_func_strtoimax_macro" != yes; then
AC_REPLACE_FUNCS([strtoimax])
if test $ac_cv_func_strtoimax = no; then
gl_PREREQ_STRTOIMAX
fi
fi
])
# Prerequisites of lib/strtoimax.c.
AC_DEFUN([gl_PREREQ_STRTOIMAX], [
AC_CHECK_DECLS([strtoll])
AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
])
# strtol.m4 serial 5
dnl Copyright (C) 2002-2003, 2006, 2009-2011 Free Software Foundation, Inc.