aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2011-04-22 00:33:37 -0700
committerPaul Eggert2011-04-22 00:33:37 -0700
commitaaa935591793937f354024fd094d2630d0399abc (patch)
tree42db7b1a06dd97ab8ae20bbc6a63cd18594db331
parent36009a21cb540401591a4891e05e1c4b32a8c593 (diff)
downloademacs-aaa935591793937f354024fd094d2630d0399abc.tar.gz
emacs-aaa935591793937f354024fd094d2630d0399abc.zip
Simpler version of strtoumax module.
-rw-r--r--ChangeLog9
-rw-r--r--lib/gnulib.mk171
-rw-r--r--lib/strtol.c3
-rw-r--r--lib/strtoll.c33
-rw-r--r--lib/wchar.in.h994
-rw-r--r--m4/gl-comp.m437
-rw-r--r--m4/inttypes-pri.m442
-rw-r--r--m4/inttypes.m4250
-rw-r--r--m4/strtoimax.m430
-rw-r--r--m4/strtol.m410
-rw-r--r--m4/strtoll.m425
-rw-r--r--m4/strtoul.m410
-rw-r--r--m4/strtoumax.m435
-rw-r--r--m4/wchar_h.m4232
-rw-r--r--m4/wint_t.m432
15 files changed, 40 insertions, 1873 deletions
diff --git a/ChangeLog b/ChangeLog
index 04a33ec49e5..0e800fc6d52 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,12 +4,9 @@
4 This is needed for the new integer-reading code in lread.c. 4 This is needed for the new integer-reading code in lread.c.
5 It automatically pulls in the following gnulib files, which 5 It automatically pulls in the following gnulib files, which
6 are used on old-fashioned platforms that don't have strtoumax: 6 are used on old-fashioned platforms that don't have strtoumax:
7 lib/inttypes.in.h, lib/strtoimax.c, lib/strtol.c, 7 lib/inttypes.in.h, lib/strtoimax.c, lib/strtol.c, lib/strtoul.c,
8 lib/strtoll.c, lib/strtoul.c, lib/strtoull.c, lib/strtoumax.c, 8 lib/strtoull.c, lib/strtoumax.c, lib/verify.h, m4/inttypes.m4,
9 lib/verify.h, lib/wchar.in.h, m4/inttypes-pri.m4, 9 m4/strtoull.m4, m4/strtoumax.m4.
10 m4/inttypes.m4, m4/strtoimax.m4, m4/strtol.m4, m4/strtoll.m4,
11 m4/strtoul.m4, m4/strtoull.m4, m4/strtoumax.m4, m4/wchar_h.m4,
12 m4/wint_t.m4.
13 10
142011-04-20 Ken Brown <kbrown@cornell.edu> 112011-04-20 Ken Brown <kbrown@cornell.edu>
15 12
diff --git a/lib/gnulib.mk b/lib/gnulib.mk
index e53dcba62e0..4da8bb89733 100644
--- a/lib/gnulib.mk
+++ b/lib/gnulib.mk
@@ -9,7 +9,7 @@
9# the same distribution terms as the rest of that program. 9# the same distribution terms as the rest of that program.
10# 10#
11# Generated by gnulib-tool. 11# Generated by gnulib-tool.
12# 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 12# 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
13 13
14 14
15MOSTLYCLEANFILES += core *.stackdump 15MOSTLYCLEANFILES += core *.stackdump
@@ -574,57 +574,12 @@ EXTRA_libgnu_a_SOURCES += strftime.c
574 574
575## end gnulib module strftime 575## end gnulib module strftime
576 576
577## begin gnulib module strtoimax
578
579
580EXTRA_DIST += strtoimax.c
581
582EXTRA_libgnu_a_SOURCES += strtoimax.c
583
584## end gnulib module strtoimax
585
586## begin gnulib module strtol
587
588
589EXTRA_DIST += strtol.c
590
591EXTRA_libgnu_a_SOURCES += strtol.c
592
593## end gnulib module strtol
594
595## begin gnulib module strtoll
596
597
598EXTRA_DIST += strtoll.c
599
600EXTRA_libgnu_a_SOURCES += strtoll.c
601
602## end gnulib module strtoll
603
604## begin gnulib module strtoul
605
606
607EXTRA_DIST += strtoul.c
608
609EXTRA_libgnu_a_SOURCES += strtoul.c
610
611## end gnulib module strtoul
612
613## begin gnulib module strtoull
614
615
616EXTRA_DIST += strtoull.c
617
618EXTRA_libgnu_a_SOURCES += strtoull.c
619
620## end gnulib module strtoull
621
622## begin gnulib module strtoumax 577## begin gnulib module strtoumax
623 578
624 579
625EXTRA_DIST += strtoumax.c 580EXTRA_DIST += strtoimax.c strtol.c strtoul.c strtoull.c strtoumax.c
626 581
627EXTRA_libgnu_a_SOURCES += strtoumax.c 582EXTRA_libgnu_a_SOURCES += strtoimax.c strtol.c strtoul.c strtoull.c strtoumax.c
628 583
629## end gnulib module strtoumax 584## end gnulib module strtoumax
630 585
@@ -906,126 +861,6 @@ EXTRA_DIST += $(top_srcdir)/./warn-on-use.h
906 861
907## end gnulib module warn-on-use 862## end gnulib module warn-on-use
908 863
909## begin gnulib module wchar
910
911BUILT_SOURCES += wchar.h
912
913# We need the following in order to create <wchar.h> when the system
914# version does not work standalone.
915wchar.h: wchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
916 $(AM_V_GEN)rm -f $@-t $@ && \
917 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
918 sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
919 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
920 -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
921 -e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \
922 -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \
923 -e 's|@''HAVE_WCHAR_H''@|$(HAVE_WCHAR_H)|g' \
924 -e 's|@''GNULIB_BTOWC''@|$(GNULIB_BTOWC)|g' \
925 -e 's|@''GNULIB_WCTOB''@|$(GNULIB_WCTOB)|g' \
926 -e 's|@''GNULIB_MBSINIT''@|$(GNULIB_MBSINIT)|g' \
927 -e 's|@''GNULIB_MBRTOWC''@|$(GNULIB_MBRTOWC)|g' \
928 -e 's|@''GNULIB_MBRLEN''@|$(GNULIB_MBRLEN)|g' \
929 -e 's|@''GNULIB_MBSRTOWCS''@|$(GNULIB_MBSRTOWCS)|g' \
930 -e 's|@''GNULIB_MBSNRTOWCS''@|$(GNULIB_MBSNRTOWCS)|g' \
931 -e 's|@''GNULIB_WCRTOMB''@|$(GNULIB_WCRTOMB)|g' \
932 -e 's|@''GNULIB_WCSRTOMBS''@|$(GNULIB_WCSRTOMBS)|g' \
933 -e 's|@''GNULIB_WCSNRTOMBS''@|$(GNULIB_WCSNRTOMBS)|g' \
934 -e 's|@''GNULIB_WCWIDTH''@|$(GNULIB_WCWIDTH)|g' \
935 -e 's|@''GNULIB_WMEMCHR''@|$(GNULIB_WMEMCHR)|g' \
936 -e 's|@''GNULIB_WMEMCMP''@|$(GNULIB_WMEMCMP)|g' \
937 -e 's|@''GNULIB_WMEMCPY''@|$(GNULIB_WMEMCPY)|g' \
938 -e 's|@''GNULIB_WMEMMOVE''@|$(GNULIB_WMEMMOVE)|g' \
939 -e 's|@''GNULIB_WMEMSET''@|$(GNULIB_WMEMSET)|g' \
940 -e 's|@''GNULIB_WCSLEN''@|$(GNULIB_WCSLEN)|g' \
941 -e 's|@''GNULIB_WCSNLEN''@|$(GNULIB_WCSNLEN)|g' \
942 -e 's|@''GNULIB_WCSCPY''@|$(GNULIB_WCSCPY)|g' \
943 -e 's|@''GNULIB_WCPCPY''@|$(GNULIB_WCPCPY)|g' \
944 -e 's|@''GNULIB_WCSNCPY''@|$(GNULIB_WCSNCPY)|g' \
945 -e 's|@''GNULIB_WCPNCPY''@|$(GNULIB_WCPNCPY)|g' \
946 -e 's|@''GNULIB_WCSCAT''@|$(GNULIB_WCSCAT)|g' \
947 -e 's|@''GNULIB_WCSNCAT''@|$(GNULIB_WCSNCAT)|g' \
948 -e 's|@''GNULIB_WCSCMP''@|$(GNULIB_WCSCMP)|g' \
949 -e 's|@''GNULIB_WCSNCMP''@|$(GNULIB_WCSNCMP)|g' \
950 -e 's|@''GNULIB_WCSCASECMP''@|$(GNULIB_WCSCASECMP)|g' \
951 -e 's|@''GNULIB_WCSNCASECMP''@|$(GNULIB_WCSNCASECMP)|g' \
952 -e 's|@''GNULIB_WCSCOLL''@|$(GNULIB_WCSCOLL)|g' \
953 -e 's|@''GNULIB_WCSXFRM''@|$(GNULIB_WCSXFRM)|g' \
954 -e 's|@''GNULIB_WCSDUP''@|$(GNULIB_WCSDUP)|g' \
955 -e 's|@''GNULIB_WCSCHR''@|$(GNULIB_WCSCHR)|g' \
956 -e 's|@''GNULIB_WCSRCHR''@|$(GNULIB_WCSRCHR)|g' \
957 -e 's|@''GNULIB_WCSCSPN''@|$(GNULIB_WCSCSPN)|g' \
958 -e 's|@''GNULIB_WCSSPN''@|$(GNULIB_WCSSPN)|g' \
959 -e 's|@''GNULIB_WCSPBRK''@|$(GNULIB_WCSPBRK)|g' \
960 -e 's|@''GNULIB_WCSSTR''@|$(GNULIB_WCSSTR)|g' \
961 -e 's|@''GNULIB_WCSTOK''@|$(GNULIB_WCSTOK)|g' \
962 -e 's|@''GNULIB_WCSWIDTH''@|$(GNULIB_WCSWIDTH)|g' \
963 < $(srcdir)/wchar.in.h | \
964 sed -e 's|@''HAVE_WINT_T''@|$(HAVE_WINT_T)|g' \
965 -e 's|@''HAVE_BTOWC''@|$(HAVE_BTOWC)|g' \
966 -e 's|@''HAVE_MBSINIT''@|$(HAVE_MBSINIT)|g' \
967 -e 's|@''HAVE_MBRTOWC''@|$(HAVE_MBRTOWC)|g' \
968 -e 's|@''HAVE_MBRLEN''@|$(HAVE_MBRLEN)|g' \
969 -e 's|@''HAVE_MBSRTOWCS''@|$(HAVE_MBSRTOWCS)|g' \
970 -e 's|@''HAVE_MBSNRTOWCS''@|$(HAVE_MBSNRTOWCS)|g' \
971 -e 's|@''HAVE_WCRTOMB''@|$(HAVE_WCRTOMB)|g' \
972 -e 's|@''HAVE_WCSRTOMBS''@|$(HAVE_WCSRTOMBS)|g' \
973 -e 's|@''HAVE_WCSNRTOMBS''@|$(HAVE_WCSNRTOMBS)|g' \
974 -e 's|@''HAVE_WMEMCHR''@|$(HAVE_WMEMCHR)|g' \
975 -e 's|@''HAVE_WMEMCMP''@|$(HAVE_WMEMCMP)|g' \
976 -e 's|@''HAVE_WMEMCPY''@|$(HAVE_WMEMCPY)|g' \
977 -e 's|@''HAVE_WMEMMOVE''@|$(HAVE_WMEMMOVE)|g' \
978 -e 's|@''HAVE_WMEMSET''@|$(HAVE_WMEMSET)|g' \
979 -e 's|@''HAVE_WCSLEN''@|$(HAVE_WCSLEN)|g' \
980 -e 's|@''HAVE_WCSNLEN''@|$(HAVE_WCSNLEN)|g' \
981 -e 's|@''HAVE_WCSCPY''@|$(HAVE_WCSCPY)|g' \
982 -e 's|@''HAVE_WCPCPY''@|$(HAVE_WCPCPY)|g' \
983 -e 's|@''HAVE_WCSNCPY''@|$(HAVE_WCSNCPY)|g' \
984 -e 's|@''HAVE_WCPNCPY''@|$(HAVE_WCPNCPY)|g' \
985 -e 's|@''HAVE_WCSCAT''@|$(HAVE_WCSCAT)|g' \
986 -e 's|@''HAVE_WCSNCAT''@|$(HAVE_WCSNCAT)|g' \
987 -e 's|@''HAVE_WCSCMP''@|$(HAVE_WCSCMP)|g' \
988 -e 's|@''HAVE_WCSNCMP''@|$(HAVE_WCSNCMP)|g' \
989 -e 's|@''HAVE_WCSCASECMP''@|$(HAVE_WCSCASECMP)|g' \
990 -e 's|@''HAVE_WCSNCASECMP''@|$(HAVE_WCSNCASECMP)|g' \
991 -e 's|@''HAVE_WCSCOLL''@|$(HAVE_WCSCOLL)|g' \
992 -e 's|@''HAVE_WCSXFRM''@|$(HAVE_WCSXFRM)|g' \
993 -e 's|@''HAVE_WCSDUP''@|$(HAVE_WCSDUP)|g' \
994 -e 's|@''HAVE_WCSCHR''@|$(HAVE_WCSCHR)|g' \
995 -e 's|@''HAVE_WCSRCHR''@|$(HAVE_WCSRCHR)|g' \
996 -e 's|@''HAVE_WCSCSPN''@|$(HAVE_WCSCSPN)|g' \
997 -e 's|@''HAVE_WCSSPN''@|$(HAVE_WCSSPN)|g' \
998 -e 's|@''HAVE_WCSPBRK''@|$(HAVE_WCSPBRK)|g' \
999 -e 's|@''HAVE_WCSSTR''@|$(HAVE_WCSSTR)|g' \
1000 -e 's|@''HAVE_WCSTOK''@|$(HAVE_WCSTOK)|g' \
1001 -e 's|@''HAVE_WCSWIDTH''@|$(HAVE_WCSWIDTH)|g' \
1002 -e 's|@''HAVE_DECL_WCTOB''@|$(HAVE_DECL_WCTOB)|g' \
1003 -e 's|@''HAVE_DECL_WCWIDTH''@|$(HAVE_DECL_WCWIDTH)|g' \
1004 | \
1005 sed -e 's|@''REPLACE_MBSTATE_T''@|$(REPLACE_MBSTATE_T)|g' \
1006 -e 's|@''REPLACE_BTOWC''@|$(REPLACE_BTOWC)|g' \
1007 -e 's|@''REPLACE_WCTOB''@|$(REPLACE_WCTOB)|g' \
1008 -e 's|@''REPLACE_MBSINIT''@|$(REPLACE_MBSINIT)|g' \
1009 -e 's|@''REPLACE_MBRTOWC''@|$(REPLACE_MBRTOWC)|g' \
1010 -e 's|@''REPLACE_MBRLEN''@|$(REPLACE_MBRLEN)|g' \
1011 -e 's|@''REPLACE_MBSRTOWCS''@|$(REPLACE_MBSRTOWCS)|g' \
1012 -e 's|@''REPLACE_MBSNRTOWCS''@|$(REPLACE_MBSNRTOWCS)|g' \
1013 -e 's|@''REPLACE_WCRTOMB''@|$(REPLACE_WCRTOMB)|g' \
1014 -e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|g' \
1015 -e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \
1016 -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \
1017 -e 's|@''REPLACE_WCSWIDTH''@|$(REPLACE_WCSWIDTH)|g' \
1018 -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
1019 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
1020 -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \
1021 } > $@-t && \
1022 mv $@-t $@
1023MOSTLYCLEANFILES += wchar.h wchar.h-t
1024
1025EXTRA_DIST += wchar.in.h
1026
1027## end gnulib module wchar
1028
1029 864
1030mostlyclean-local: mostlyclean-generic 865mostlyclean-local: mostlyclean-generic
1031 @for dir in '' $(MOSTLYCLEANDIRS); do \ 866 @for dir in '' $(MOSTLYCLEANDIRS); do \
diff --git a/lib/strtol.c b/lib/strtol.c
index b6a761ecb9c..6c15d11e8f8 100644
--- a/lib/strtol.c
+++ b/lib/strtol.c
@@ -186,9 +186,8 @@
186# define LOCALE_PARAM_PROTO 186# define LOCALE_PARAM_PROTO
187#endif 187#endif
188 188
189#include <wchar.h>
190
191#ifdef USE_WIDE_CHAR 189#ifdef USE_WIDE_CHAR
190# include <wchar.h>
192# include <wctype.h> 191# include <wctype.h>
193# define L_(Ch) L##Ch 192# define L_(Ch) L##Ch
194# define UCHAR_TYPE wint_t 193# define UCHAR_TYPE wint_t
diff --git a/lib/strtoll.c b/lib/strtoll.c
deleted file mode 100644
index 75afa4d9bc9..00000000000
--- a/lib/strtoll.c
+++ /dev/null
@@ -1,33 +0,0 @@
1/* Function to parse a `long long int' from text.
2 Copyright (C) 1995-1997, 1999, 2001, 2009-2011 Free Software Foundation,
3 Inc.
4 This file is part of the GNU C Library.
5
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18
19#define QUAD 1
20
21#include <strtol.c>
22
23#ifdef _LIBC
24# ifdef SHARED
25# include <shlib-compat.h>
26
27# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2)
28compat_symbol (libc, __strtoll_internal, __strtoq_internal, GLIBC_2_0);
29# endif
30
31# endif
32weak_alias (strtoll, strtoq)
33#endif
diff --git a/lib/wchar.in.h b/lib/wchar.in.h
deleted file mode 100644
index da55f6e3de9..00000000000
--- a/lib/wchar.in.h
+++ /dev/null
@@ -1,994 +0,0 @@
1/* A substitute for ISO C99 <wchar.h>, for platforms that have issues.
2
3 Copyright (C) 2007-2011 Free Software Foundation, Inc.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3, or (at your option)
8 any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation,
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
18
19/* Written by Eric Blake. */
20
21/*
22 * ISO C 99 <wchar.h> for platforms that have issues.
23 * <http://www.opengroup.org/susv3xbd/wchar.h.html>
24 *
25 * For now, this just ensures proper prerequisite inclusion order and
26 * the declaration of wcwidth().
27 */
28
29#if __GNUC__ >= 3
30@PRAGMA_SYSTEM_HEADER@
31#endif
32@PRAGMA_COLUMNS@
33
34#if defined __need_mbstate_t || defined __need_wint_t || (defined __hpux && ((defined _INTTYPES_INCLUDED && !defined strtoimax) || defined _GL_JUST_INCLUDE_SYSTEM_WCHAR_H)) || defined _GL_ALREADY_INCLUDING_WCHAR_H
35/* Special invocation convention:
36 - Inside glibc and uClibc header files.
37 - On HP-UX 11.00 we have a sequence of nested includes
38 <wchar.h> -> <stdlib.h> -> <stdint.h>, and the latter includes <wchar.h>,
39 once indirectly <stdint.h> -> <sys/types.h> -> <inttypes.h> -> <wchar.h>
40 and once directly. In both situations 'wint_t' is not yet defined,
41 therefore we cannot provide the function overrides; instead include only
42 the system's <wchar.h>.
43 - On IRIX 6.5, similarly, we have an include <wchar.h> -> <wctype.h>, and
44 the latter includes <wchar.h>. But here, we have no way to detect whether
45 <wctype.h> is completely included or is still being included. */
46
47#@INCLUDE_NEXT@ @NEXT_WCHAR_H@
48
49#else
50/* Normal invocation convention. */
51
52#ifndef _GL_WCHAR_H
53
54#define _GL_ALREADY_INCLUDING_WCHAR_H
55
56#if @HAVE_FEATURES_H@
57# include <features.h> /* for __GLIBC__ */
58#endif
59
60/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
61 <wchar.h>.
62 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
63 included before <wchar.h>.
64 In some builds of uClibc, <wchar.h> is nonexistent and wchar_t is defined
65 by <stddef.h>.
66 But avoid namespace pollution on glibc systems. */
67#if !(defined __GLIBC__ && !defined __UCLIBC__)
68# include <stddef.h>
69#endif
70#ifndef __GLIBC__
71# include <stdio.h>
72# include <time.h>
73#endif
74
75/* Include the original <wchar.h> if it exists.
76 Some builds of uClibc lack it. */
77/* The include_next requires a split double-inclusion guard. */
78#if @HAVE_WCHAR_H@
79# @INCLUDE_NEXT@ @NEXT_WCHAR_H@
80#endif
81
82#undef _GL_ALREADY_INCLUDING_WCHAR_H
83
84#ifndef _GL_WCHAR_H
85#define _GL_WCHAR_H
86
87/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
88
89/* The definition of _GL_ARG_NONNULL is copied here. */
90
91/* The definition of _GL_WARN_ON_USE is copied here. */
92
93
94/* Define wint_t and WEOF. (Also done in wctype.in.h.) */
95#if !@HAVE_WINT_T@ && !defined wint_t
96# define wint_t int
97# ifndef WEOF
98# define WEOF -1
99# endif
100#else
101# ifndef WEOF
102# define WEOF ((wint_t) -1)
103# endif
104#endif
105
106
107/* Override mbstate_t if it is too small.
108 On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for
109 implementing mbrtowc for encodings like UTF-8. */
110#if !(@HAVE_MBSINIT@ && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@
111# if !GNULIB_defined_mbstate_t
112typedef int rpl_mbstate_t;
113# undef mbstate_t
114# define mbstate_t rpl_mbstate_t
115# define GNULIB_defined_mbstate_t 1
116# endif
117#endif
118
119
120/* Convert a single-byte character to a wide character. */
121#if @GNULIB_BTOWC@
122# if @REPLACE_BTOWC@
123# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
124# undef btowc
125# define btowc rpl_btowc
126# endif
127_GL_FUNCDECL_RPL (btowc, wint_t, (int c));
128_GL_CXXALIAS_RPL (btowc, wint_t, (int c));
129# else
130# if !@HAVE_BTOWC@
131_GL_FUNCDECL_SYS (btowc, wint_t, (int c));
132# endif
133_GL_CXXALIAS_SYS (btowc, wint_t, (int c));
134# endif
135_GL_CXXALIASWARN (btowc);
136#elif defined GNULIB_POSIXCHECK
137# undef btowc
138# if HAVE_RAW_DECL_BTOWC
139_GL_WARN_ON_USE (btowc, "btowc is unportable - "
140 "use gnulib module btowc for portability");
141# endif
142#endif
143
144
145/* Convert a wide character to a single-byte character. */
146#if @GNULIB_WCTOB@
147# if @REPLACE_WCTOB@
148# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
149# undef wctob
150# define wctob rpl_wctob
151# endif
152_GL_FUNCDECL_RPL (wctob, int, (wint_t wc));
153_GL_CXXALIAS_RPL (wctob, int, (wint_t wc));
154# else
155# if !defined wctob && !@HAVE_DECL_WCTOB@
156/* wctob is provided by gnulib, or wctob exists but is not declared. */
157_GL_FUNCDECL_SYS (wctob, int, (wint_t wc));
158# endif
159_GL_CXXALIAS_SYS (wctob, int, (wint_t wc));
160# endif
161_GL_CXXALIASWARN (wctob);
162#elif defined GNULIB_POSIXCHECK
163# undef wctob
164# if HAVE_RAW_DECL_WCTOB
165_GL_WARN_ON_USE (wctob, "wctob is unportable - "
166 "use gnulib module wctob for portability");
167# endif
168#endif
169
170
171/* Test whether *PS is in the initial state. */
172#if @GNULIB_MBSINIT@
173# if @REPLACE_MBSINIT@
174# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
175# undef mbsinit
176# define mbsinit rpl_mbsinit
177# endif
178_GL_FUNCDECL_RPL (mbsinit, int, (const mbstate_t *ps));
179_GL_CXXALIAS_RPL (mbsinit, int, (const mbstate_t *ps));
180# else
181# if !@HAVE_MBSINIT@
182_GL_FUNCDECL_SYS (mbsinit, int, (const mbstate_t *ps));
183# endif
184_GL_CXXALIAS_SYS (mbsinit, int, (const mbstate_t *ps));
185# endif
186_GL_CXXALIASWARN (mbsinit);
187#elif defined GNULIB_POSIXCHECK
188# undef mbsinit
189# if HAVE_RAW_DECL_MBSINIT
190_GL_WARN_ON_USE (mbsinit, "mbsinit is unportable - "
191 "use gnulib module mbsinit for portability");
192# endif
193#endif
194
195
196/* Convert a multibyte character to a wide character. */
197#if @GNULIB_MBRTOWC@
198# if @REPLACE_MBRTOWC@
199# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
200# undef mbrtowc
201# define mbrtowc rpl_mbrtowc
202# endif
203_GL_FUNCDECL_RPL (mbrtowc, size_t,
204 (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
205_GL_CXXALIAS_RPL (mbrtowc, size_t,
206 (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
207# else
208# if !@HAVE_MBRTOWC@
209_GL_FUNCDECL_SYS (mbrtowc, size_t,
210 (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
211# endif
212_GL_CXXALIAS_SYS (mbrtowc, size_t,
213 (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps));
214# endif
215_GL_CXXALIASWARN (mbrtowc);
216#elif defined GNULIB_POSIXCHECK
217# undef mbrtowc
218# if HAVE_RAW_DECL_MBRTOWC
219_GL_WARN_ON_USE (mbrtowc, "mbrtowc is unportable - "
220 "use gnulib module mbrtowc for portability");
221# endif
222#endif
223
224
225/* Recognize a multibyte character. */
226#if @GNULIB_MBRLEN@
227# if @REPLACE_MBRLEN@
228# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
229# undef mbrlen
230# define mbrlen rpl_mbrlen
231# endif
232_GL_FUNCDECL_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
233_GL_CXXALIAS_RPL (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
234# else
235# if !@HAVE_MBRLEN@
236_GL_FUNCDECL_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
237# endif
238_GL_CXXALIAS_SYS (mbrlen, size_t, (const char *s, size_t n, mbstate_t *ps));
239# endif
240_GL_CXXALIASWARN (mbrlen);
241#elif defined GNULIB_POSIXCHECK
242# undef mbrlen
243# if HAVE_RAW_DECL_MBRLEN
244_GL_WARN_ON_USE (mbrlen, "mbrlen is unportable - "
245 "use gnulib module mbrlen for portability");
246# endif
247#endif
248
249
250/* Convert a string to a wide string. */
251#if @GNULIB_MBSRTOWCS@
252# if @REPLACE_MBSRTOWCS@
253# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
254# undef mbsrtowcs
255# define mbsrtowcs rpl_mbsrtowcs
256# endif
257_GL_FUNCDECL_RPL (mbsrtowcs, size_t,
258 (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps)
259 _GL_ARG_NONNULL ((2)));
260_GL_CXXALIAS_RPL (mbsrtowcs, size_t,
261 (wchar_t *dest, const char **srcp, size_t len,
262 mbstate_t *ps));
263# else
264# if !@HAVE_MBSRTOWCS@
265_GL_FUNCDECL_SYS (mbsrtowcs, size_t,
266 (wchar_t *dest, const char **srcp, size_t len, mbstate_t *ps)
267 _GL_ARG_NONNULL ((2)));
268# endif
269_GL_CXXALIAS_SYS (mbsrtowcs, size_t,
270 (wchar_t *dest, const char **srcp, size_t len,
271 mbstate_t *ps));
272# endif
273_GL_CXXALIASWARN (mbsrtowcs);
274#elif defined GNULIB_POSIXCHECK
275# undef mbsrtowcs
276# if HAVE_RAW_DECL_MBSRTOWCS
277_GL_WARN_ON_USE (mbsrtowcs, "mbsrtowcs is unportable - "
278 "use gnulib module mbsrtowcs for portability");
279# endif
280#endif
281
282
283/* Convert a string to a wide string. */
284#if @GNULIB_MBSNRTOWCS@
285# if @REPLACE_MBSNRTOWCS@
286# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
287# undef mbsnrtowcs
288# define mbsnrtowcs rpl_mbsnrtowcs
289# endif
290_GL_FUNCDECL_RPL (mbsnrtowcs, size_t,
291 (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
292 mbstate_t *ps)
293 _GL_ARG_NONNULL ((2)));
294_GL_CXXALIAS_RPL (mbsnrtowcs, size_t,
295 (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
296 mbstate_t *ps));
297# else
298# if !@HAVE_MBSNRTOWCS@
299_GL_FUNCDECL_SYS (mbsnrtowcs, size_t,
300 (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
301 mbstate_t *ps)
302 _GL_ARG_NONNULL ((2)));
303# endif
304_GL_CXXALIAS_SYS (mbsnrtowcs, size_t,
305 (wchar_t *dest, const char **srcp, size_t srclen, size_t len,
306 mbstate_t *ps));
307# endif
308_GL_CXXALIASWARN (mbsnrtowcs);
309#elif defined GNULIB_POSIXCHECK
310# undef mbsnrtowcs
311# if HAVE_RAW_DECL_MBSNRTOWCS
312_GL_WARN_ON_USE (mbsnrtowcs, "mbsnrtowcs is unportable - "
313 "use gnulib module mbsnrtowcs for portability");
314# endif
315#endif
316
317
318/* Convert a wide character to a multibyte character. */
319#if @GNULIB_WCRTOMB@
320# if @REPLACE_WCRTOMB@
321# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
322# undef wcrtomb
323# define wcrtomb rpl_wcrtomb
324# endif
325_GL_FUNCDECL_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
326_GL_CXXALIAS_RPL (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
327# else
328# if !@HAVE_WCRTOMB@
329_GL_FUNCDECL_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
330# endif
331_GL_CXXALIAS_SYS (wcrtomb, size_t, (char *s, wchar_t wc, mbstate_t *ps));
332# endif
333_GL_CXXALIASWARN (wcrtomb);
334#elif defined GNULIB_POSIXCHECK
335# undef wcrtomb
336# if HAVE_RAW_DECL_WCRTOMB
337_GL_WARN_ON_USE (wcrtomb, "wcrtomb is unportable - "
338 "use gnulib module wcrtomb for portability");
339# endif
340#endif
341
342
343/* Convert a wide string to a string. */
344#if @GNULIB_WCSRTOMBS@
345# if @REPLACE_WCSRTOMBS@
346# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
347# undef wcsrtombs
348# define wcsrtombs rpl_wcsrtombs
349# endif
350_GL_FUNCDECL_RPL (wcsrtombs, size_t,
351 (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps)
352 _GL_ARG_NONNULL ((2)));
353_GL_CXXALIAS_RPL (wcsrtombs, size_t,
354 (char *dest, const wchar_t **srcp, size_t len,
355 mbstate_t *ps));
356# else
357# if !@HAVE_WCSRTOMBS@
358_GL_FUNCDECL_SYS (wcsrtombs, size_t,
359 (char *dest, const wchar_t **srcp, size_t len, mbstate_t *ps)
360 _GL_ARG_NONNULL ((2)));
361# endif
362_GL_CXXALIAS_SYS (wcsrtombs, size_t,
363 (char *dest, const wchar_t **srcp, size_t len,
364 mbstate_t *ps));
365# endif
366_GL_CXXALIASWARN (wcsrtombs);
367#elif defined GNULIB_POSIXCHECK
368# undef wcsrtombs
369# if HAVE_RAW_DECL_WCSRTOMBS
370_GL_WARN_ON_USE (wcsrtombs, "wcsrtombs is unportable - "
371 "use gnulib module wcsrtombs for portability");
372# endif
373#endif
374
375
376/* Convert a wide string to a string. */
377#if @GNULIB_WCSNRTOMBS@
378# if @REPLACE_WCSNRTOMBS@
379# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
380# undef wcsnrtombs
381# define wcsnrtombs rpl_wcsnrtombs
382# endif
383_GL_FUNCDECL_RPL (wcsnrtombs, size_t,
384 (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
385 mbstate_t *ps)
386 _GL_ARG_NONNULL ((2)));
387_GL_CXXALIAS_RPL (wcsnrtombs, size_t,
388 (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
389 mbstate_t *ps));
390# else
391# if !@HAVE_WCSNRTOMBS@
392_GL_FUNCDECL_SYS (wcsnrtombs, size_t,
393 (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
394 mbstate_t *ps)
395 _GL_ARG_NONNULL ((2)));
396# endif
397_GL_CXXALIAS_SYS (wcsnrtombs, size_t,
398 (char *dest, const wchar_t **srcp, size_t srclen, size_t len,
399 mbstate_t *ps));
400# endif
401_GL_CXXALIASWARN (wcsnrtombs);
402#elif defined GNULIB_POSIXCHECK
403# undef wcsnrtombs
404# if HAVE_RAW_DECL_WCSNRTOMBS
405_GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
406 "use gnulib module wcsnrtombs for portability");
407# endif
408#endif
409
410
411/* Return the number of screen columns needed for WC. */
412#if @GNULIB_WCWIDTH@
413# if @REPLACE_WCWIDTH@
414# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
415# undef wcwidth
416# define wcwidth rpl_wcwidth
417# endif
418_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t));
419_GL_CXXALIAS_RPL (wcwidth, int, (wchar_t));
420# else
421# if !@HAVE_DECL_WCWIDTH@
422/* wcwidth exists but is not declared. */
423_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t));
424# endif
425_GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
426# endif
427_GL_CXXALIASWARN (wcwidth);
428#elif defined GNULIB_POSIXCHECK
429# undef wcwidth
430# if HAVE_RAW_DECL_WCWIDTH
431_GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
432 "use gnulib module wcwidth for portability");
433# endif
434#endif
435
436
437/* Search N wide characters of S for C. */
438#if @GNULIB_WMEMCHR@
439# if !@HAVE_WMEMCHR@
440_GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n));
441# endif
442 /* On some systems, this function is defined as an overloaded function:
443 extern "C++" {
444 const wchar_t * std::wmemchr (const wchar_t *, wchar_t, size_t);
445 wchar_t * std::wmemchr (wchar_t *, wchar_t, size_t);
446 } */
447_GL_CXXALIAS_SYS_CAST2 (wmemchr,
448 wchar_t *, (const wchar_t *, wchar_t, size_t),
449 const wchar_t *, (const wchar_t *, wchar_t, size_t));
450# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
451 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
452_GL_CXXALIASWARN1 (wmemchr, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
453_GL_CXXALIASWARN1 (wmemchr, const wchar_t *,
454 (const wchar_t *s, wchar_t c, size_t n));
455# else
456_GL_CXXALIASWARN (wmemchr);
457# endif
458#elif defined GNULIB_POSIXCHECK
459# undef wmemchr
460# if HAVE_RAW_DECL_WMEMCHR
461_GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - "
462 "use gnulib module wmemchr for portability");
463# endif
464#endif
465
466
467/* Compare N wide characters of S1 and S2. */
468#if @GNULIB_WMEMCMP@
469# if !@HAVE_WMEMCMP@
470_GL_FUNCDECL_SYS (wmemcmp, int,
471 (const wchar_t *s1, const wchar_t *s2, size_t n));
472# endif
473_GL_CXXALIAS_SYS (wmemcmp, int,
474 (const wchar_t *s1, const wchar_t *s2, size_t n));
475_GL_CXXALIASWARN (wmemcmp);
476#elif defined GNULIB_POSIXCHECK
477# undef wmemcmp
478# if HAVE_RAW_DECL_WMEMCMP
479_GL_WARN_ON_USE (wmemcmp, "wmemcmp is unportable - "
480 "use gnulib module wmemcmp for portability");
481# endif
482#endif
483
484
485/* Copy N wide characters of SRC to DEST. */
486#if @GNULIB_WMEMCPY@
487# if !@HAVE_WMEMCPY@
488_GL_FUNCDECL_SYS (wmemcpy, wchar_t *,
489 (wchar_t *dest, const wchar_t *src, size_t n));
490# endif
491_GL_CXXALIAS_SYS (wmemcpy, wchar_t *,
492 (wchar_t *dest, const wchar_t *src, size_t n));
493_GL_CXXALIASWARN (wmemcpy);
494#elif defined GNULIB_POSIXCHECK
495# undef wmemcpy
496# if HAVE_RAW_DECL_WMEMCPY
497_GL_WARN_ON_USE (wmemcpy, "wmemcpy is unportable - "
498 "use gnulib module wmemcpy for portability");
499# endif
500#endif
501
502
503/* Copy N wide characters of SRC to DEST, guaranteeing correct behavior for
504 overlapping memory areas. */
505#if @GNULIB_WMEMMOVE@
506# if !@HAVE_WMEMMOVE@
507_GL_FUNCDECL_SYS (wmemmove, wchar_t *,
508 (wchar_t *dest, const wchar_t *src, size_t n));
509# endif
510_GL_CXXALIAS_SYS (wmemmove, wchar_t *,
511 (wchar_t *dest, const wchar_t *src, size_t n));
512_GL_CXXALIASWARN (wmemmove);
513#elif defined GNULIB_POSIXCHECK
514# undef wmemmove
515# if HAVE_RAW_DECL_WMEMMOVE
516_GL_WARN_ON_USE (wmemmove, "wmemmove is unportable - "
517 "use gnulib module wmemmove for portability");
518# endif
519#endif
520
521
522/* Set N wide characters of S to C. */
523#if @GNULIB_WMEMSET@
524# if !@HAVE_WMEMSET@
525_GL_FUNCDECL_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
526# endif
527_GL_CXXALIAS_SYS (wmemset, wchar_t *, (wchar_t *s, wchar_t c, size_t n));
528_GL_CXXALIASWARN (wmemset);
529#elif defined GNULIB_POSIXCHECK
530# undef wmemset
531# if HAVE_RAW_DECL_WMEMSET
532_GL_WARN_ON_USE (wmemset, "wmemset is unportable - "
533 "use gnulib module wmemset for portability");
534# endif
535#endif
536
537
538/* Return the number of wide characters in S. */
539#if @GNULIB_WCSLEN@
540# if !@HAVE_WCSLEN@
541_GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s));
542# endif
543_GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s));
544_GL_CXXALIASWARN (wcslen);
545#elif defined GNULIB_POSIXCHECK
546# undef wcslen
547# if HAVE_RAW_DECL_WCSLEN
548_GL_WARN_ON_USE (wcslen, "wcslen is unportable - "
549 "use gnulib module wcslen for portability");
550# endif
551#endif
552
553
554/* Return the number of wide characters in S, but at most MAXLEN. */
555#if @GNULIB_WCSNLEN@
556# if !@HAVE_WCSNLEN@
557_GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
558# endif
559_GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
560_GL_CXXALIASWARN (wcsnlen);
561#elif defined GNULIB_POSIXCHECK
562# undef wcsnlen
563# if HAVE_RAW_DECL_WCSNLEN
564_GL_WARN_ON_USE (wcsnlen, "wcsnlen is unportable - "
565 "use gnulib module wcsnlen for portability");
566# endif
567#endif
568
569
570/* Copy SRC to DEST. */
571#if @GNULIB_WCSCPY@
572# if !@HAVE_WCSCPY@
573_GL_FUNCDECL_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
574# endif
575_GL_CXXALIAS_SYS (wcscpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
576_GL_CXXALIASWARN (wcscpy);
577#elif defined GNULIB_POSIXCHECK
578# undef wcscpy
579# if HAVE_RAW_DECL_WCSCPY
580_GL_WARN_ON_USE (wcscpy, "wcscpy is unportable - "
581 "use gnulib module wcscpy for portability");
582# endif
583#endif
584
585
586/* Copy SRC to DEST, returning the address of the terminating L'\0' in DEST. */
587#if @GNULIB_WCPCPY@
588# if !@HAVE_WCPCPY@
589_GL_FUNCDECL_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
590# endif
591_GL_CXXALIAS_SYS (wcpcpy, wchar_t *, (wchar_t *dest, const wchar_t *src));
592_GL_CXXALIASWARN (wcpcpy);
593#elif defined GNULIB_POSIXCHECK
594# undef wcpcpy
595# if HAVE_RAW_DECL_WCPCPY
596_GL_WARN_ON_USE (wcpcpy, "wcpcpy is unportable - "
597 "use gnulib module wcpcpy for portability");
598# endif
599#endif
600
601
602/* Copy no more than N wide characters of SRC to DEST. */
603#if @GNULIB_WCSNCPY@
604# if !@HAVE_WCSNCPY@
605_GL_FUNCDECL_SYS (wcsncpy, wchar_t *,
606 (wchar_t *dest, const wchar_t *src, size_t n));
607# endif
608_GL_CXXALIAS_SYS (wcsncpy, wchar_t *,
609 (wchar_t *dest, const wchar_t *src, size_t n));
610_GL_CXXALIASWARN (wcsncpy);
611#elif defined GNULIB_POSIXCHECK
612# undef wcsncpy
613# if HAVE_RAW_DECL_WCSNCPY
614_GL_WARN_ON_USE (wcsncpy, "wcsncpy is unportable - "
615 "use gnulib module wcsncpy for portability");
616# endif
617#endif
618
619
620/* Copy no more than N characters of SRC to DEST, returning the address of
621 the last character written into DEST. */
622#if @GNULIB_WCPNCPY@
623# if !@HAVE_WCPNCPY@
624_GL_FUNCDECL_SYS (wcpncpy, wchar_t *,
625 (wchar_t *dest, const wchar_t *src, size_t n));
626# endif
627_GL_CXXALIAS_SYS (wcpncpy, wchar_t *,
628 (wchar_t *dest, const wchar_t *src, size_t n));
629_GL_CXXALIASWARN (wcpncpy);
630#elif defined GNULIB_POSIXCHECK
631# undef wcpncpy
632# if HAVE_RAW_DECL_WCPNCPY
633_GL_WARN_ON_USE (wcpncpy, "wcpncpy is unportable - "
634 "use gnulib module wcpncpy for portability");
635# endif
636#endif
637
638
639/* Append SRC onto DEST. */
640#if @GNULIB_WCSCAT@
641# if !@HAVE_WCSCAT@
642_GL_FUNCDECL_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src));
643# endif
644_GL_CXXALIAS_SYS (wcscat, wchar_t *, (wchar_t *dest, const wchar_t *src));
645_GL_CXXALIASWARN (wcscat);
646#elif defined GNULIB_POSIXCHECK
647# undef wcscat
648# if HAVE_RAW_DECL_WCSCAT
649_GL_WARN_ON_USE (wcscat, "wcscat is unportable - "
650 "use gnulib module wcscat for portability");
651# endif
652#endif
653
654
655/* Append no more than N wide characters of SRC onto DEST. */
656#if @GNULIB_WCSNCAT@
657# if !@HAVE_WCSNCAT@
658_GL_FUNCDECL_SYS (wcsncat, wchar_t *,
659 (wchar_t *dest, const wchar_t *src, size_t n));
660# endif
661_GL_CXXALIAS_SYS (wcsncat, wchar_t *,
662 (wchar_t *dest, const wchar_t *src, size_t n));
663_GL_CXXALIASWARN (wcsncat);
664#elif defined GNULIB_POSIXCHECK
665# undef wcsncat
666# if HAVE_RAW_DECL_WCSNCAT
667_GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - "
668 "use gnulib module wcsncat for portability");
669# endif
670#endif
671
672
673/* Compare S1 and S2. */
674#if @GNULIB_WCSCMP@
675# if !@HAVE_WCSCMP@
676_GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
677# endif
678_GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
679_GL_CXXALIASWARN (wcscmp);
680#elif defined GNULIB_POSIXCHECK
681# undef wcscmp
682# if HAVE_RAW_DECL_WCSCMP
683_GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - "
684 "use gnulib module wcscmp for portability");
685# endif
686#endif
687
688
689/* Compare no more than N wide characters of S1 and S2. */
690#if @GNULIB_WCSNCMP@
691# if !@HAVE_WCSNCMP@
692_GL_FUNCDECL_SYS (wcsncmp, int,
693 (const wchar_t *s1, const wchar_t *s2, size_t n));
694# endif
695_GL_CXXALIAS_SYS (wcsncmp, int,
696 (const wchar_t *s1, const wchar_t *s2, size_t n));
697_GL_CXXALIASWARN (wcsncmp);
698#elif defined GNULIB_POSIXCHECK
699# undef wcsncmp
700# if HAVE_RAW_DECL_WCSNCMP
701_GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - "
702 "use gnulib module wcsncmp for portability");
703# endif
704#endif
705
706
707/* Compare S1 and S2, ignoring case. */
708#if @GNULIB_WCSCASECMP@
709# if !@HAVE_WCSCASECMP@
710_GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2));
711# endif
712_GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2));
713_GL_CXXALIASWARN (wcscasecmp);
714#elif defined GNULIB_POSIXCHECK
715# undef wcscasecmp
716# if HAVE_RAW_DECL_WCSCASECMP
717_GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - "
718 "use gnulib module wcscasecmp for portability");
719# endif
720#endif
721
722
723/* Compare no more than N chars of S1 and S2, ignoring case. */
724#if @GNULIB_WCSNCASECMP@
725# if !@HAVE_WCSNCASECMP@
726_GL_FUNCDECL_SYS (wcsncasecmp, int,
727 (const wchar_t *s1, const wchar_t *s2, size_t n));
728# endif
729_GL_CXXALIAS_SYS (wcsncasecmp, int,
730 (const wchar_t *s1, const wchar_t *s2, size_t n));
731_GL_CXXALIASWARN (wcsncasecmp);
732#elif defined GNULIB_POSIXCHECK
733# undef wcsncasecmp
734# if HAVE_RAW_DECL_WCSNCASECMP
735_GL_WARN_ON_USE (wcsncasecmp, "wcsncasecmp is unportable - "
736 "use gnulib module wcsncasecmp for portability");
737# endif
738#endif
739
740
741/* Compare S1 and S2, both interpreted as appropriate to the LC_COLLATE
742 category of the current locale. */
743#if @GNULIB_WCSCOLL@
744# if !@HAVE_WCSCOLL@
745_GL_FUNCDECL_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
746# endif
747_GL_CXXALIAS_SYS (wcscoll, int, (const wchar_t *s1, const wchar_t *s2));
748_GL_CXXALIASWARN (wcscoll);
749#elif defined GNULIB_POSIXCHECK
750# undef wcscoll
751# if HAVE_RAW_DECL_WCSCOLL
752_GL_WARN_ON_USE (wcscoll, "wcscoll is unportable - "
753 "use gnulib module wcscoll for portability");
754# endif
755#endif
756
757
758/* Transform S2 into array pointed to by S1 such that if wcscmp is applied
759 to two transformed strings the result is the as applying 'wcscoll' to the
760 original strings. */
761#if @GNULIB_WCSXFRM@
762# if !@HAVE_WCSXFRM@
763_GL_FUNCDECL_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n));
764# endif
765_GL_CXXALIAS_SYS (wcsxfrm, size_t, (wchar_t *s1, const wchar_t *s2, size_t n));
766_GL_CXXALIASWARN (wcsxfrm);
767#elif defined GNULIB_POSIXCHECK
768# undef wcsxfrm
769# if HAVE_RAW_DECL_WCSXFRM
770_GL_WARN_ON_USE (wcsxfrm, "wcsxfrm is unportable - "
771 "use gnulib module wcsxfrm for portability");
772# endif
773#endif
774
775
776/* Duplicate S, returning an identical malloc'd string. */
777#if @GNULIB_WCSDUP@
778# if !@HAVE_WCSDUP@
779_GL_FUNCDECL_SYS (wcsdup, wchar_t *, (const wchar_t *s));
780# endif
781_GL_CXXALIAS_SYS (wcsdup, wchar_t *, (const wchar_t *s));
782_GL_CXXALIASWARN (wcsdup);
783#elif defined GNULIB_POSIXCHECK
784# undef wcsdup
785# if HAVE_RAW_DECL_WCSDUP
786_GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - "
787 "use gnulib module wcsdup for portability");
788# endif
789#endif
790
791
792/* Find the first occurrence of WC in WCS. */
793#if @GNULIB_WCSCHR@
794# if !@HAVE_WCSCHR@
795_GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc));
796# endif
797 /* On some systems, this function is defined as an overloaded function:
798 extern "C++" {
799 const wchar_t * std::wcschr (const wchar_t *, wchar_t);
800 wchar_t * std::wcschr (wchar_t *, wchar_t);
801 } */
802_GL_CXXALIAS_SYS_CAST2 (wcschr,
803 wchar_t *, (const wchar_t *, wchar_t),
804 const wchar_t *, (const wchar_t *, wchar_t));
805# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
806 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
807_GL_CXXALIASWARN1 (wcschr, wchar_t *, (wchar_t *wcs, wchar_t wc));
808_GL_CXXALIASWARN1 (wcschr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
809# else
810_GL_CXXALIASWARN (wcschr);
811# endif
812#elif defined GNULIB_POSIXCHECK
813# undef wcschr
814# if HAVE_RAW_DECL_WCSCHR
815_GL_WARN_ON_USE (wcschr, "wcschr is unportable - "
816 "use gnulib module wcschr for portability");
817# endif
818#endif
819
820
821/* Find the last occurrence of WC in WCS. */
822#if @GNULIB_WCSRCHR@
823# if !@HAVE_WCSRCHR@
824_GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc));
825# endif
826 /* On some systems, this function is defined as an overloaded function:
827 extern "C++" {
828 const wchar_t * std::wcsrchr (const wchar_t *, wchar_t);
829 wchar_t * std::wcsrchr (wchar_t *, wchar_t);
830 } */
831_GL_CXXALIAS_SYS_CAST2 (wcsrchr,
832 wchar_t *, (const wchar_t *, wchar_t),
833 const wchar_t *, (const wchar_t *, wchar_t));
834# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
835 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
836_GL_CXXALIASWARN1 (wcsrchr, wchar_t *, (wchar_t *wcs, wchar_t wc));
837_GL_CXXALIASWARN1 (wcsrchr, const wchar_t *, (const wchar_t *wcs, wchar_t wc));
838# else
839_GL_CXXALIASWARN (wcsrchr);
840# endif
841#elif defined GNULIB_POSIXCHECK
842# undef wcsrchr
843# if HAVE_RAW_DECL_WCSRCHR
844_GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - "
845 "use gnulib module wcsrchr for portability");
846# endif
847#endif
848
849
850/* Return the length of the initial segmet of WCS which consists entirely
851 of wide characters not in REJECT. */
852#if @GNULIB_WCSCSPN@
853# if !@HAVE_WCSCSPN@
854_GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
855# endif
856_GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
857_GL_CXXALIASWARN (wcscspn);
858#elif defined GNULIB_POSIXCHECK
859# undef wcscspn
860# if HAVE_RAW_DECL_WCSCSPN
861_GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - "
862 "use gnulib module wcscspn for portability");
863# endif
864#endif
865
866
867/* Return the length of the initial segmet of WCS which consists entirely
868 of wide characters in ACCEPT. */
869#if @GNULIB_WCSSPN@
870# if !@HAVE_WCSSPN@
871_GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
872# endif
873_GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
874_GL_CXXALIASWARN (wcsspn);
875#elif defined GNULIB_POSIXCHECK
876# undef wcsspn
877# if HAVE_RAW_DECL_WCSSPN
878_GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - "
879 "use gnulib module wcsspn for portability");
880# endif
881#endif
882
883
884/* Find the first occurrence in WCS of any character in ACCEPT. */
885#if @GNULIB_WCSPBRK@
886# if !@HAVE_WCSPBRK@
887_GL_FUNCDECL_SYS (wcspbrk, wchar_t *,
888 (const wchar_t *wcs, const wchar_t *accept));
889# endif
890 /* On some systems, this function is defined as an overloaded function:
891 extern "C++" {
892 const wchar_t * std::wcspbrk (const wchar_t *, const wchar_t *);
893 wchar_t * std::wcspbrk (wchar_t *, const wchar_t *);
894 } */
895_GL_CXXALIAS_SYS_CAST2 (wcspbrk,
896 wchar_t *, (const wchar_t *, const wchar_t *),
897 const wchar_t *, (const wchar_t *, const wchar_t *));
898# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
899 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
900_GL_CXXALIASWARN1 (wcspbrk, wchar_t *,
901 (wchar_t *wcs, const wchar_t *accept));
902_GL_CXXALIASWARN1 (wcspbrk, const wchar_t *,
903 (const wchar_t *wcs, const wchar_t *accept));
904# else
905_GL_CXXALIASWARN (wcspbrk);
906# endif
907#elif defined GNULIB_POSIXCHECK
908# undef wcspbrk
909# if HAVE_RAW_DECL_WCSPBRK
910_GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - "
911 "use gnulib module wcspbrk for portability");
912# endif
913#endif
914
915
916/* Find the first occurrence of NEEDLE in HAYSTACK. */
917#if @GNULIB_WCSSTR@
918# if !@HAVE_WCSSTR@
919_GL_FUNCDECL_SYS (wcsstr, wchar_t *,
920 (const wchar_t *haystack, const wchar_t *needle));
921# endif
922 /* On some systems, this function is defined as an overloaded function:
923 extern "C++" {
924 const wchar_t * std::wcsstr (const wchar_t *, const wchar_t *);
925 wchar_t * std::wcsstr (wchar_t *, const wchar_t *);
926 } */
927_GL_CXXALIAS_SYS_CAST2 (wcsstr,
928 wchar_t *, (const wchar_t *, const wchar_t *),
929 const wchar_t *, (const wchar_t *, const wchar_t *));
930# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \
931 && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
932_GL_CXXALIASWARN1 (wcsstr, wchar_t *,
933 (wchar_t *haystack, const wchar_t *needle));
934_GL_CXXALIASWARN1 (wcsstr, const wchar_t *,
935 (const wchar_t *haystack, const wchar_t *needle));
936# else
937_GL_CXXALIASWARN (wcsstr);
938# endif
939#elif defined GNULIB_POSIXCHECK
940# undef wcsstr
941# if HAVE_RAW_DECL_WCSSTR
942_GL_WARN_ON_USE (wcsstr, "wcsstr is unportable - "
943 "use gnulib module wcsstr for portability");
944# endif
945#endif
946
947
948/* Divide WCS into tokens separated by characters in DELIM. */
949#if @GNULIB_WCSTOK@
950# if !@HAVE_WCSTOK@
951_GL_FUNCDECL_SYS (wcstok, wchar_t *,
952 (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr));
953# endif
954_GL_CXXALIAS_SYS (wcstok, wchar_t *,
955 (wchar_t *wcs, const wchar_t *delim, wchar_t **ptr));
956_GL_CXXALIASWARN (wcstok);
957#elif defined GNULIB_POSIXCHECK
958# undef wcstok
959# if HAVE_RAW_DECL_WCSTOK
960_GL_WARN_ON_USE (wcstok, "wcstok is unportable - "
961 "use gnulib module wcstok for portability");
962# endif
963#endif
964
965
966/* Determine number of column positions required for first N wide
967 characters (or fewer if S ends before this) in S. */
968#if @GNULIB_WCSWIDTH@
969# if @REPLACE_WCSWIDTH@
970# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
971# undef wcswidth
972# define wcswidth rpl_wcswidth
973# endif
974_GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n));
975_GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n));
976# else
977# if !@HAVE_WCSWIDTH@
978_GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n));
979# endif
980_GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n));
981# endif
982_GL_CXXALIASWARN (wcswidth);
983#elif defined GNULIB_POSIXCHECK
984# undef wcswidth
985# if HAVE_RAW_DECL_WCSWIDTH
986_GL_WARN_ON_USE (wcswidth, "wcswidth is unportable - "
987 "use gnulib module wcswidth for portability");
988# endif
989#endif
990
991
992#endif /* _GL_WCHAR_H */
993#endif /* _GL_WCHAR_H */
994#endif
diff --git a/m4/gl-comp.m4 b/m4/gl-comp.m4
index 5318a3fb61c..4ab10b54e8a 100644
--- a/m4/gl-comp.m4
+++ b/m4/gl-comp.m4
@@ -45,6 +45,7 @@ AC_DEFUN([gl_EARLY],
45 # Code from module intprops: 45 # Code from module intprops:
46 # Code from module inttypes: 46 # Code from module inttypes:
47 # Code from module lstat: 47 # Code from module lstat:
48 # Code from module manywarnings:
48 # Code from module mktime: 49 # Code from module mktime:
49 # Code from module multiarch: 50 # Code from module multiarch:
50 # Code from module readlink: 51 # Code from module readlink:
@@ -57,11 +58,6 @@ AC_DEFUN([gl_EARLY],
57 # Code from module stdio: 58 # Code from module stdio:
58 # Code from module stdlib: 59 # Code from module stdlib:
59 # Code from module strftime: 60 # Code from module strftime:
60 # Code from module strtoimax:
61 # Code from module strtol:
62 # Code from module strtoll:
63 # Code from module strtoul:
64 # Code from module strtoull:
65 # Code from module strtoumax: 61 # Code from module strtoumax:
66 # Code from module symlink: 62 # Code from module symlink:
67 # Code from module sys_stat: 63 # Code from module sys_stat:
@@ -70,7 +66,7 @@ AC_DEFUN([gl_EARLY],
70 # Code from module unistd: 66 # Code from module unistd:
71 # Code from module verify: 67 # Code from module verify:
72 # Code from module warn-on-use: 68 # Code from module warn-on-use:
73 # Code from module wchar: 69 # Code from module warnings:
74]) 70])
75 71
76# This macro should be invoked from ./configure.in, in the section 72# This macro should be invoked from ./configure.in, in the section
@@ -122,6 +118,7 @@ AC_DEFUN([gl_INIT],
122 # Code from module lstat: 118 # Code from module lstat:
123 gl_FUNC_LSTAT 119 gl_FUNC_LSTAT
124 gl_SYS_STAT_MODULE_INDICATOR([lstat]) 120 gl_SYS_STAT_MODULE_INDICATOR([lstat])
121 # Code from module manywarnings:
125 # Code from module mktime: 122 # Code from module mktime:
126 gl_FUNC_MKTIME 123 gl_FUNC_MKTIME
127 gl_TIME_MODULE_INDICATOR([mktime]) 124 gl_TIME_MODULE_INDICATOR([mktime])
@@ -149,19 +146,6 @@ AC_DEFUN([gl_INIT],
149 gl_STDLIB_H 146 gl_STDLIB_H
150 # Code from module strftime: 147 # Code from module strftime:
151 gl_FUNC_GNU_STRFTIME 148 gl_FUNC_GNU_STRFTIME
152 # Code from module strtoimax:
153 gl_FUNC_STRTOIMAX
154 gl_INTTYPES_MODULE_INDICATOR([strtoimax])
155 # Code from module strtol:
156 gl_FUNC_STRTOL
157 # Code from module strtoll:
158 gl_FUNC_STRTOLL
159 gl_STDLIB_MODULE_INDICATOR([strtoll])
160 # Code from module strtoul:
161 gl_FUNC_STRTOUL
162 # Code from module strtoull:
163 gl_FUNC_STRTOULL
164 gl_STDLIB_MODULE_INDICATOR([strtoull])
165 # Code from module strtoumax: 149 # Code from module strtoumax:
166 gl_FUNC_STRTOUMAX 150 gl_FUNC_STRTOUMAX
167 gl_INTTYPES_MODULE_INDICATOR([strtoumax]) 151 gl_INTTYPES_MODULE_INDICATOR([strtoumax])
@@ -180,8 +164,8 @@ AC_DEFUN([gl_INIT],
180 gl_UNISTD_H 164 gl_UNISTD_H
181 # Code from module verify: 165 # Code from module verify:
182 # Code from module warn-on-use: 166 # Code from module warn-on-use:
183 # Code from module wchar: 167 # Code from module warnings:
184 gl_WCHAR_H 168 AC_SUBST([WARN_CFLAGS])
185 # End of code from modules 169 # End of code from modules
186 m4_ifval(gl_LIBSOURCES_LIST, [ 170 m4_ifval(gl_LIBSOURCES_LIST, [
187 m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ || 171 m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ ||
@@ -360,7 +344,6 @@ AC_DEFUN([gl_FILE_LIST], [
360 lib/strftime.h 344 lib/strftime.h
361 lib/strtoimax.c 345 lib/strtoimax.c
362 lib/strtol.c 346 lib/strtol.c
363 lib/strtoll.c
364 lib/strtoul.c 347 lib/strtoul.c
365 lib/strtoull.c 348 lib/strtoull.c
366 lib/strtoumax.c 349 lib/strtoumax.c
@@ -370,7 +353,6 @@ AC_DEFUN([gl_FILE_LIST], [
370 lib/time_r.c 353 lib/time_r.c
371 lib/unistd.in.h 354 lib/unistd.in.h
372 lib/verify.h 355 lib/verify.h
373 lib/wchar.in.h
374 m4/00gnulib.m4 356 m4/00gnulib.m4
375 m4/c-strtod.m4 357 m4/c-strtod.m4
376 m4/extensions.m4 358 m4/extensions.m4
@@ -379,10 +361,10 @@ AC_DEFUN([gl_FILE_LIST], [
379 m4/getopt.m4 361 m4/getopt.m4
380 m4/gnulib-common.m4 362 m4/gnulib-common.m4
381 m4/include_next.m4 363 m4/include_next.m4
382 m4/inttypes-pri.m4
383 m4/inttypes.m4 364 m4/inttypes.m4
384 m4/longlong.m4 365 m4/longlong.m4
385 m4/lstat.m4 366 m4/lstat.m4
367 m4/manywarnings.m4
386 m4/md5.m4 368 m4/md5.m4
387 m4/mktime.m4 369 m4/mktime.m4
388 m4/multiarch.m4 370 m4/multiarch.m4
@@ -397,10 +379,6 @@ AC_DEFUN([gl_FILE_LIST], [
397 m4/stdio_h.m4 379 m4/stdio_h.m4
398 m4/stdlib_h.m4 380 m4/stdlib_h.m4
399 m4/strftime.m4 381 m4/strftime.m4
400 m4/strtoimax.m4
401 m4/strtol.m4
402 m4/strtoll.m4
403 m4/strtoul.m4
404 m4/strtoull.m4 382 m4/strtoull.m4
405 m4/strtoumax.m4 383 m4/strtoumax.m4
406 m4/symlink.m4 384 m4/symlink.m4
@@ -410,7 +388,6 @@ AC_DEFUN([gl_FILE_LIST], [
410 m4/tm_gmtoff.m4 388 m4/tm_gmtoff.m4
411 m4/unistd_h.m4 389 m4/unistd_h.m4
412 m4/warn-on-use.m4 390 m4/warn-on-use.m4
413 m4/wchar_h.m4 391 m4/warnings.m4
414 m4/wchar_t.m4 392 m4/wchar_t.m4
415 m4/wint_t.m4
416]) 393])
diff --git a/m4/inttypes-pri.m4 b/m4/inttypes-pri.m4
deleted file mode 100644
index e252b27e8cb..00000000000
--- a/m4/inttypes-pri.m4
+++ /dev/null
@@ -1,42 +0,0 @@
1# inttypes-pri.m4 serial 7 (gettext-0.18.2)
2dnl Copyright (C) 1997-2002, 2006, 2008-2011 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7dnl From Bruno Haible.
8
9AC_PREREQ([2.53])
10
11# Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI*
12# macros to non-string values. This is the case on AIX 4.3.3.
13
14AC_DEFUN([gt_INTTYPES_PRI],
15[
16 AC_CHECK_HEADERS([inttypes.h])
17 if test $ac_cv_header_inttypes_h = yes; then
18 AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken],
19 [gt_cv_inttypes_pri_broken],
20 [
21 AC_COMPILE_IFELSE(
22 [AC_LANG_PROGRAM(
23 [[
24#include <inttypes.h>
25#ifdef PRId32
26char *p = PRId32;
27#endif
28 ]],
29 [[]])],
30 [gt_cv_inttypes_pri_broken=no],
31 [gt_cv_inttypes_pri_broken=yes])
32 ])
33 fi
34 if test "$gt_cv_inttypes_pri_broken" = yes; then
35 AC_DEFINE_UNQUOTED([PRI_MACROS_BROKEN], [1],
36 [Define if <inttypes.h> exists and defines unusable PRI* macros.])
37 PRI_MACROS_BROKEN=1
38 else
39 PRI_MACROS_BROKEN=0
40 fi
41 AC_SUBST([PRI_MACROS_BROKEN])
42])
diff --git a/m4/inttypes.m4 b/m4/inttypes.m4
index 92a4ac019f5..46a00c6d7aa 100644
--- a/m4/inttypes.m4
+++ b/m4/inttypes.m4
@@ -1,4 +1,4 @@
1# inttypes.m4 serial 18 1# inttypes.m4 serial 19
2dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. 2dnl Copyright (C) 2006-2011 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -10,138 +10,11 @@ dnl Test whether <inttypes.h> is supported or must be substituted.
10AC_DEFUN([gl_INTTYPES_H], 10AC_DEFUN([gl_INTTYPES_H],
11[ 11[
12 AC_REQUIRE([gl_STDINT_H]) 12 AC_REQUIRE([gl_STDINT_H])
13 AC_REQUIRE([gt_INTTYPES_PRI])
14 AC_CHECK_HEADERS_ONCE([inttypes.h])
15 AC_CHECK_DECLS_ONCE([imaxabs])
16 AC_CHECK_DECLS_ONCE([imaxdiv])
17 AC_CHECK_DECLS_ONCE([strtoimax])
18 AC_CHECK_DECLS_ONCE([strtoumax])
19
20 dnl Now see if we need a substitute <inttypes.h>.
21 dnl A complete <inttypes.h> requires
22 dnl - a complete <stdint.h>,
23 dnl - the existence of an <inttypes.h>,
24 dnl - that imaxabs, imaxdiv, strtoimax, strtoumax are declared,
25 dnl - some additional tests.
26 AC_CACHE_CHECK([whether inttypes.h conforms to C99],
27 [gl_cv_header_working_inttypes_h],
28 [gl_cv_header_working_inttypes_h=no
29 if test "$gl_cv_header_working_stdint_h" = yes \
30 && test $ac_cv_header_inttypes_h = yes \
31 && test "$ac_cv_have_decl_imaxabs" = yes \
32 && test "$ac_cv_have_decl_imaxdiv" = yes \
33 && test "$ac_cv_have_decl_strtoimax" = yes \
34 && test "$ac_cv_have_decl_strtoumax" = yes; then
35 AC_COMPILE_IFELSE([
36 AC_LANG_PROGRAM([[
37#include <stddef.h>
38#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
39#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */
40#define __STDC_FORMAT_MACROS 1 /* to make it work also in C++ mode */
41#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H /* work if build isn't clean */
42#include <inttypes.h>
43
44/* No need to duplicate the tests of stdint.m4; they are subsumed by
45 $gl_cv_header_working_stdint_h = yes. */
46
47/* Tests for macros supposed to be defined in inttypes.h. */
48
49const char *k = /* implicit string concatenation */
50#ifdef INT8_MAX
51 PRId8 PRIi8
52#endif
53#ifdef UINT8_MAX
54 PRIo8 PRIu8 PRIx8 PRIX8
55#endif
56#ifdef INT16_MAX
57 PRId16 PRIi16
58#endif
59#ifdef UINT16_MAX
60 PRIo16 PRIu16 PRIx16 PRIX16
61#endif
62#ifdef INT32_MAX
63 PRId32 PRIi32
64#endif
65#ifdef UINT32_MAX
66 PRIo32 PRIu32 PRIx32 PRIX32
67#endif
68#ifdef INT64_MAX
69 PRId64 PRIi64
70#endif
71#ifdef UINT64_MAX
72 PRIo64 PRIu64 PRIx64 PRIX64
73#endif
74 PRIdLEAST8 PRIiLEAST8 PRIoLEAST8 PRIuLEAST8 PRIxLEAST8 PRIXLEAST8
75 PRIdLEAST16 PRIiLEAST16 PRIoLEAST16 PRIuLEAST16 PRIxLEAST16 PRIXLEAST16
76 PRIdLEAST32 PRIiLEAST32 PRIoLEAST32 PRIuLEAST32 PRIxLEAST32 PRIXLEAST32
77 PRIdLEAST64 PRIiLEAST64
78 PRIoLEAST64 PRIuLEAST64 PRIxLEAST64 PRIXLEAST64
79 PRIdFAST8 PRIiFAST8 PRIoFAST8 PRIuFAST8 PRIxFAST8 PRIXFAST8
80 PRIdFAST16 PRIiFAST16 PRIoFAST16 PRIuFAST16 PRIxFAST16 PRIXFAST16
81 PRIdFAST32 PRIiFAST32 PRIoFAST32 PRIuFAST32 PRIxFAST32 PRIXFAST32
82 PRIdFAST64 PRIiFAST64
83 PRIoFAST64 PRIuFAST64 PRIxFAST64 PRIXFAST64
84 PRIdMAX PRIiMAX PRIoMAX PRIuMAX PRIxMAX PRIXMAX
85#ifdef INTPTR_MAX
86 PRIdPTR PRIiPTR
87#endif
88#ifdef UINTPTR_MAX
89 PRIoPTR PRIuPTR PRIxPTR PRIXPTR
90#endif
91 ;
92const char *l = /* implicit string concatenation */
93#ifdef INT8_MAX
94 SCNd8 SCNi8
95#endif
96#ifdef UINT8_MAX
97 SCNo8 SCNu8 SCNx8
98#endif
99#ifdef INT16_MAX
100 SCNd16 SCNi16
101#endif
102#ifdef UINT16_MAX
103 SCNo16 SCNu16 SCNx16
104#endif
105#ifdef INT32_MAX
106 SCNd32 SCNi32
107#endif
108#ifdef UINT32_MAX
109 SCNo32 SCNu32 SCNx32
110#endif
111#ifdef INT64_MAX
112 SCNd64 SCNi64
113#endif
114#ifdef UINT64_MAX
115 SCNo64 SCNu64 SCNx64
116#endif
117 SCNdLEAST8 SCNiLEAST8 SCNoLEAST8 SCNuLEAST8 SCNxLEAST8
118 SCNdLEAST16 SCNiLEAST16 SCNoLEAST16 SCNuLEAST16 SCNxLEAST16
119 SCNdLEAST32 SCNiLEAST32 SCNoLEAST32 SCNuLEAST32 SCNxLEAST32
120 SCNdLEAST64 SCNiLEAST64
121 SCNoLEAST64 SCNuLEAST64 SCNxLEAST64
122 SCNdFAST8 SCNiFAST8 SCNoFAST8 SCNuFAST8 SCNxFAST8
123 SCNdFAST16 SCNiFAST16 SCNoFAST16 SCNuFAST16 SCNxFAST16
124 SCNdFAST32 SCNiFAST32 SCNoFAST32 SCNuFAST32 SCNxFAST32
125 SCNdFAST64 SCNiFAST64
126 SCNoFAST64 SCNuFAST64 SCNxFAST64
127 SCNdMAX SCNiMAX SCNoMAX SCNuMAX SCNxMAX
128#ifdef INTPTR_MAX
129 SCNdPTR SCNiPTR
130#endif
131#ifdef UINTPTR_MAX
132 SCNoPTR SCNuPTR SCNxPTR
133#endif
134 ;
135 ]])],
136 [gl_cv_header_working_inttypes_h=yes])
137 fi])
138 13
139 dnl Override <inttypes.h> always, so that the portability warnings work. 14 dnl Override <inttypes.h> always, so that the portability warnings work.
140 AC_REQUIRE([gl_INTTYPES_H_DEFAULTS]) 15 AC_REQUIRE([gl_INTTYPES_H_DEFAULTS])
141 gl_CHECK_NEXT_HEADERS([inttypes.h]) 16 gl_CHECK_NEXT_HEADERS([inttypes.h])
142 17
143 AC_REQUIRE([gl_MULTIARCH])
144
145 dnl Ensure that <stdint.h> defines the limit macros, since gnulib's 18 dnl Ensure that <stdint.h> defines the limit macros, since gnulib's
146 dnl <inttypes.h> relies on them. This macro is only needed when a 19 dnl <inttypes.h> relies on them. This macro is only needed when a
147 dnl C++ compiler is in use; it has no effect for a C compiler. 20 dnl C++ compiler is in use; it has no effect for a C compiler.
@@ -158,129 +31,12 @@ const char *l = /* implicit string concatenation */
158#endif 31#endif
159]) 32])
160 33
161 PRIPTR_PREFIX=
162 if test -n "$STDINT_H"; then
163 dnl Using the gnulib <stdint.h>. It always defines intptr_t to 'long'.
164 PRIPTR_PREFIX='"l"'
165 else
166 dnl Using the system's <stdint.h>.
167 for glpfx in '' l ll I64; do
168 case $glpfx in
169 '') gltype1='int';;
170 l) gltype1='long int';;
171 ll) gltype1='long long int';;
172 I64) gltype1='__int64';;
173 esac
174 AC_COMPILE_IFELSE(
175 [AC_LANG_PROGRAM([[#include <stdint.h>
176 extern intptr_t foo;
177 extern $gltype1 foo;]])],
178 [PRIPTR_PREFIX='"'$glpfx'"'])
179 test -n "$PRIPTR_PREFIX" && break
180 done
181 fi
182 AC_SUBST([PRIPTR_PREFIX])
183
184 if test "$ac_cv_have_decl_imaxabs" = yes; then
185 HAVE_DECL_IMAXABS=1
186 else
187 HAVE_DECL_IMAXABS=0
188 fi
189
190 if test "$ac_cv_have_decl_imaxdiv" = yes; then
191 HAVE_DECL_IMAXDIV=1
192 else
193 HAVE_DECL_IMAXDIV=0
194 fi
195
196 if test "$ac_cv_have_decl_strtoimax" = yes; then
197 HAVE_DECL_STRTOIMAX=1
198 else
199 HAVE_DECL_STRTOIMAX=0
200 fi
201
202 if test "$ac_cv_have_decl_strtoumax" = yes; then
203 HAVE_DECL_STRTOUMAX=1
204 else
205 HAVE_DECL_STRTOUMAX=0
206 fi
207
208 gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION(
209 [INT32_MAX_LT_INTMAX_MAX],
210 [defined INT32_MAX && defined INTMAX_MAX],
211 [INT32_MAX < INTMAX_MAX],
212 [sizeof (int) < sizeof (long long int)])
213 if test $APPLE_UNIVERSAL_BUILD = 0; then
214 gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION(
215 [INT64_MAX_EQ_LONG_MAX],
216 [defined INT64_MAX],
217 [INT64_MAX == LONG_MAX],
218 [sizeof (long long int) == sizeof (long int)])
219 else
220 INT64_MAX_EQ_LONG_MAX=-1
221 fi
222 gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION(
223 [UINT32_MAX_LT_UINTMAX_MAX],
224 [defined UINT32_MAX && defined UINTMAX_MAX],
225 [UINT32_MAX < UINTMAX_MAX],
226 [sizeof (unsigned int) < sizeof (unsigned long long int)])
227 if test $APPLE_UNIVERSAL_BUILD = 0; then
228 gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION(
229 [UINT64_MAX_EQ_ULONG_MAX],
230 [defined UINT64_MAX],
231 [UINT64_MAX == ULONG_MAX],
232 [sizeof (unsigned long long int) == sizeof (unsigned long int)])
233 else
234 UINT64_MAX_EQ_ULONG_MAX=-1
235 fi
236
237 dnl Check for declarations of anything we want to poison if the 34 dnl Check for declarations of anything we want to poison if the
238 dnl corresponding gnulib module is not in use. 35 dnl corresponding gnulib module is not in use.
239 gl_WARN_ON_USE_PREPARE([[#include <inttypes.h> 36 gl_WARN_ON_USE_PREPARE([[#include <inttypes.h>
240 ]], [imaxabs imaxdiv strtoimax strtoumax]) 37 ]], [imaxabs imaxdiv strtoimax strtoumax])
241]) 38])
242 39
243# Define the symbol $1 to be 1 if the condition is true, 0 otherwise.
244# If $2 is true, the condition is $3; otherwise if long long int is supported
245# approximate the condition with $4; otherwise, assume the condition is false.
246# The condition should work on all C99 platforms; the approximations should be
247# good enough to work on all practical pre-C99 platforms.
248# $2 is evaluated by the C preprocessor, $3 and $4 as compile-time constants.
249AC_DEFUN([gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION],
250[
251 AC_CACHE_CHECK([whether $3],
252 [gl_cv_test_$1],
253 [AC_COMPILE_IFELSE(
254 [AC_LANG_PROGRAM(
255 [[/* Work also in C++ mode. */
256 #define __STDC_LIMIT_MACROS 1
257
258 /* Work if build is not clean. */
259 #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H
260
261 #include <limits.h>
262 #if HAVE_STDINT_H
263 #include <stdint.h>
264 #endif
265
266 #if $2
267 #define CONDITION ($3)
268 #elif HAVE_LONG_LONG_INT
269 #define CONDITION ($4)
270 #else
271 #define CONDITION 0
272 #endif
273 int test[CONDITION ? 1 : -1];]])],
274 [gl_cv_test_$1=yes],
275 [gl_cv_test_$1=no])])
276 if test $gl_cv_test_$1 = yes; then
277 $1=1;
278 else
279 $1=0;
280 fi
281 AC_SUBST([$1])
282])
283
284AC_DEFUN([gl_INTTYPES_MODULE_INDICATOR], 40AC_DEFUN([gl_INTTYPES_MODULE_INDICATOR],
285[ 41[
286 dnl Use AC_REQUIRE here, so that the default settings are expanded once only. 42 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
@@ -299,4 +55,8 @@ AC_DEFUN([gl_INTTYPES_H_DEFAULTS],
299 HAVE_DECL_IMAXDIV=1; AC_SUBST([HAVE_DECL_IMAXDIV]) 55 HAVE_DECL_IMAXDIV=1; AC_SUBST([HAVE_DECL_IMAXDIV])
300 HAVE_DECL_STRTOIMAX=1; AC_SUBST([HAVE_DECL_STRTOIMAX]) 56 HAVE_DECL_STRTOIMAX=1; AC_SUBST([HAVE_DECL_STRTOIMAX])
301 HAVE_DECL_STRTOUMAX=1; AC_SUBST([HAVE_DECL_STRTOUMAX]) 57 HAVE_DECL_STRTOUMAX=1; AC_SUBST([HAVE_DECL_STRTOUMAX])
58 INT64_MAX_EQ_LONG_MAX='defined _LP64'; AC_SUBST([INT64_MAX_EQ_LONG_MAX])
59 PRI_MACROS_BROKEN=0; AC_SUBST([PRI_MACROS_BROKEN])
60 PRIPTR_PREFIX=__PRIPTR_PREFIX; AC_SUBST([PRIPTR_PREFIX])
61 UINT64_MAX_EQ_ULONG_MAX='defined _LP64'; AC_SUBST([UINT64_MAX_EQ_ULONG_MAX])
302]) 62])
diff --git a/m4/strtoimax.m4 b/m4/strtoimax.m4
deleted file mode 100644
index e82e7cd08f8..00000000000
--- a/m4/strtoimax.m4
+++ /dev/null
@@ -1,30 +0,0 @@
1# strtoimax.m4 serial 8
2dnl Copyright (C) 2002-2004, 2006, 2009-2011 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7AC_DEFUN([gl_FUNC_STRTOIMAX],
8[
9 AC_CACHE_CHECK([whether <inttypes.h> defines strtoimax as a macro],
10 gl_cv_func_strtoimax_macro,
11 [AC_EGREP_CPP([inttypes_h_defines_strtoimax], [#include <inttypes.h>
12#ifdef strtoimax
13 inttypes_h_defines_strtoimax
14#endif],
15 gl_cv_func_strtoimax_macro=yes,
16 gl_cv_func_strtoimax_macro=no)])
17
18 if test "$gl_cv_func_strtoimax_macro" != yes; then
19 AC_REPLACE_FUNCS([strtoimax])
20 if test $ac_cv_func_strtoimax = no; then
21 gl_PREREQ_STRTOIMAX
22 fi
23 fi
24])
25
26# Prerequisites of lib/strtoimax.c.
27AC_DEFUN([gl_PREREQ_STRTOIMAX], [
28 AC_CHECK_DECLS([strtoll])
29 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
30])
diff --git a/m4/strtol.m4 b/m4/strtol.m4
deleted file mode 100644
index 10f0284bec5..00000000000
--- a/m4/strtol.m4
+++ /dev/null
@@ -1,10 +0,0 @@
1# strtol.m4 serial 5
2dnl Copyright (C) 2002-2003, 2006, 2009-2011 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7AC_DEFUN([gl_FUNC_STRTOL],
8[
9 AC_REPLACE_FUNCS([strtol])
10])
diff --git a/m4/strtoll.m4 b/m4/strtoll.m4
deleted file mode 100644
index fd0a13db1bb..00000000000
--- a/m4/strtoll.m4
+++ /dev/null
@@ -1,25 +0,0 @@
1# strtoll.m4 serial 6
2dnl Copyright (C) 2002, 2004, 2006, 2008-2011 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7AC_DEFUN([gl_FUNC_STRTOLL],
8[
9 AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
10 dnl We don't need (and can't compile) the replacement strtoll
11 dnl unless the type 'long long int' exists.
12 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
13 if test "$ac_cv_type_long_long_int" = yes; then
14 AC_REPLACE_FUNCS([strtoll])
15 if test $ac_cv_func_strtoll = no; then
16 HAVE_STRTOLL=0
17 gl_PREREQ_STRTOLL
18 fi
19 fi
20])
21
22# Prerequisites of lib/strtoll.c.
23AC_DEFUN([gl_PREREQ_STRTOLL], [
24 :
25])
diff --git a/m4/strtoul.m4 b/m4/strtoul.m4
deleted file mode 100644
index 06979d16cd5..00000000000
--- a/m4/strtoul.m4
+++ /dev/null
@@ -1,10 +0,0 @@
1# strtoul.m4 serial 4
2dnl Copyright (C) 2002, 2006, 2009-2011 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7AC_DEFUN([gl_FUNC_STRTOUL],
8[
9 AC_REPLACE_FUNCS([strtoul])
10])
diff --git a/m4/strtoumax.m4 b/m4/strtoumax.m4
index 448c4d9b777..d69c1f79c79 100644
--- a/m4/strtoumax.m4
+++ b/m4/strtoumax.m4
@@ -1,4 +1,4 @@
1# strtoumax.m4 serial 8 1# strtoumax.m4 serial 9
2dnl Copyright (C) 2002-2004, 2006, 2009-2011 Free Software Foundation, Inc. 2dnl Copyright (C) 2002-2004, 2006, 2009-2011 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -6,25 +6,32 @@ dnl with or without modifications, as long as this notice is preserved.
6 6
7AC_DEFUN([gl_FUNC_STRTOUMAX], 7AC_DEFUN([gl_FUNC_STRTOUMAX],
8[ 8[
9 AC_CACHE_CHECK([whether <inttypes.h> defines strtoumax as a macro], 9 AC_REQUIRE([gl_INTTYPES_H_DEFAULTS])
10 gl_cv_func_strtoumax_macro,
11 [AC_EGREP_CPP([inttypes_h_defines_strtoumax], [#include <inttypes.h>
12#ifdef strtoumax
13 inttypes_h_defines_strtoumax
14#endif],
15 gl_cv_func_strtoumax_macro=yes,
16 gl_cv_func_strtoumax_macro=no)])
17 10
18 if test "$gl_cv_func_strtoumax_macro" != yes; then 11 AC_CHECK_DECLS_ONCE([strtoumax])
19 AC_REPLACE_FUNCS([strtoumax]) 12 if test "$ac_cv_have_decl_strtoumax" != yes; then
20 if test $ac_cv_func_strtoumax = no; then 13 HAVE_DECL_STRTOUMAX=0
21 gl_PREREQ_STRTOUMAX 14
15 AC_CACHE_CHECK([whether <inttypes.h> defines strtoumax as a macro],
16 gl_cv_func_strtoumax_macro,
17 [AC_EGREP_CPP([inttypes_h_defines_strtoumax], [#include <inttypes.h>
18 #ifdef strtoumax
19 inttypes_h_defines_strtoumax
20 #endif],
21 gl_cv_func_strtoumax_macro=yes,
22 gl_cv_func_strtoumax_macro=no)])
23
24 if test "$gl_cv_func_strtoumax_macro" != yes; then
25 AC_REPLACE_FUNCS([strtoumax])
26 if test $ac_cv_func_strtoumax = no; then
27 gl_PREREQ_STRTOUMAX
28 fi
22 fi 29 fi
23 fi 30 fi
24]) 31])
25 32
26# Prerequisites of lib/strtoumax.c. 33# Prerequisites of lib/strtoumax.c.
27AC_DEFUN([gl_PREREQ_STRTOUMAX], [ 34AC_DEFUN([gl_PREREQ_STRTOUMAX], [
28 AC_CHECK_DECLS([strtoull])
29 AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) 35 AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
36 gl_FUNC_STRTOULL
30]) 37])
diff --git a/m4/wchar_h.m4 b/m4/wchar_h.m4
deleted file mode 100644
index 6255ff352de..00000000000
--- a/m4/wchar_h.m4
+++ /dev/null
@@ -1,232 +0,0 @@
1dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues.
2
3dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8dnl Written by Eric Blake.
9
10# wchar_h.m4 serial 38
11
12AC_DEFUN([gl_WCHAR_H],
13[
14 AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
15 AC_REQUIRE([gl_WCHAR_H_INLINE_OK])
16 dnl Prepare for creating substitute <wchar.h>.
17 dnl Check for <wchar.h> (missing in Linux uClibc when built without wide
18 dnl character support).
19 dnl <wchar.h> is always overridden, because of GNULIB_POSIXCHECK.
20 gl_CHECK_NEXT_HEADERS([wchar.h])
21 if test $ac_cv_header_wchar_h = yes; then
22 HAVE_WCHAR_H=1
23 else
24 HAVE_WCHAR_H=0
25 fi
26 AC_SUBST([HAVE_WCHAR_H])
27
28 AC_REQUIRE([gl_FEATURES_H])
29
30 AC_REQUIRE([gt_TYPE_WINT_T])
31 if test $gt_cv_c_wint_t = yes; then
32 HAVE_WINT_T=1
33 else
34 HAVE_WINT_T=0
35 fi
36 AC_SUBST([HAVE_WINT_T])
37
38 dnl Check for declarations of anything we want to poison if the
39 dnl corresponding gnulib module is not in use.
40 gl_WARN_ON_USE_PREPARE([[
41/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
42 <wchar.h>.
43 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
44 included before <wchar.h>. */
45#if !(defined __GLIBC__ && !defined __UCLIBC__)
46# include <stddef.h>
47# include <stdio.h>
48# include <time.h>
49#endif
50#include <wchar.h>
51 ]],
52 [btowc wctob mbsinit mbrtowc mbrlen mbsrtowcs mbsnrtowcs wcrtomb
53 wcsrtombs wcsnrtombs wcwidth wmemchr wmemcmp wmemcpy wmemmove wmemset
54 wcslen wcsnlen wcscpy wcpcpy wcsncpy wcpncpy wcscat wcsncat wcscmp
55 wcsncmp wcscasecmp wcsncasecmp wcscoll wcsxfrm wcsdup wcschr wcsrchr
56 wcscspn wcsspn wcspbrk wcsstr wcstok wcswidth
57 ])
58])
59
60dnl Check whether <wchar.h> is usable at all.
61AC_DEFUN([gl_WCHAR_H_INLINE_OK],
62[
63 dnl Test whether <wchar.h> suffers due to the transition from '__inline' to
64 dnl 'gnu_inline'. See <http://sourceware.org/bugzilla/show_bug.cgi?id=4022>
65 dnl and <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42440>. In summary,
66 dnl glibc version 2.5 or older, together with gcc version 4.3 or newer and
67 dnl the option -std=c99 or -std=gnu99, leads to a broken <wchar.h>.
68 AC_CACHE_CHECK([whether <wchar.h> uses 'inline' correctly],
69 [gl_cv_header_wchar_h_correct_inline],
70 [gl_cv_header_wchar_h_correct_inline=yes
71 AC_LANG_CONFTEST([
72 AC_LANG_SOURCE([[#define wcstod renamed_wcstod
73/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
74 <wchar.h>.
75 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
76 included before <wchar.h>. */
77#include <stddef.h>
78#include <stdio.h>
79#include <time.h>
80#include <wchar.h>
81extern int zero (void);
82int main () { return zero(); }
83]])])
84 if AC_TRY_EVAL([ac_compile]); then
85 mv conftest.$ac_objext conftest1.$ac_objext
86 AC_LANG_CONFTEST([
87 AC_LANG_SOURCE([[#define wcstod renamed_wcstod
88/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
89 <wchar.h>.
90 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
91 included before <wchar.h>. */
92#include <stddef.h>
93#include <stdio.h>
94#include <time.h>
95#include <wchar.h>
96int zero (void) { return 0; }
97]])])
98 if AC_TRY_EVAL([ac_compile]); then
99 mv conftest.$ac_objext conftest2.$ac_objext
100 if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD 2>&1; then
101 :
102 else
103 gl_cv_header_wchar_h_correct_inline=no
104 fi
105 fi
106 fi
107 rm -f conftest1.$ac_objext conftest2.$ac_objext conftest$ac_exeext
108 ])
109 if test $gl_cv_header_wchar_h_correct_inline = no; then
110 AC_MSG_ERROR([<wchar.h> cannot be used with this compiler ($CC $CFLAGS $CPPFLAGS).
111This is a known interoperability problem of glibc <= 2.5 with gcc >= 4.3 in
112C99 mode. You have four options:
113 - Add the flag -fgnu89-inline to CC and reconfigure, or
114 - Fix your include files, using parts of
115 <http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=b037a293a48718af30d706c2e18c929d0e69a621>, or
116 - Use a gcc version older than 4.3, or
117 - Don't use the flags -std=c99 or -std=gnu99.
118Configuration aborted.])
119 fi
120])
121
122dnl Unconditionally enables the replacement of <wchar.h>.
123AC_DEFUN([gl_REPLACE_WCHAR_H],
124[
125 dnl This is a no-op, because <wchar.h> is always overridden.
126 :
127])
128
129AC_DEFUN([gl_WCHAR_MODULE_INDICATOR],
130[
131 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
132 AC_REQUIRE([gl_WCHAR_H_DEFAULTS])
133 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
134 dnl Define it also as a C macro, for the benefit of the unit tests.
135 gl_MODULE_INDICATOR_FOR_TESTS([$1])
136])
137
138AC_DEFUN([gl_WCHAR_H_DEFAULTS],
139[
140 GNULIB_BTOWC=0; AC_SUBST([GNULIB_BTOWC])
141 GNULIB_WCTOB=0; AC_SUBST([GNULIB_WCTOB])
142 GNULIB_MBSINIT=0; AC_SUBST([GNULIB_MBSINIT])
143 GNULIB_MBRTOWC=0; AC_SUBST([GNULIB_MBRTOWC])
144 GNULIB_MBRLEN=0; AC_SUBST([GNULIB_MBRLEN])
145 GNULIB_MBSRTOWCS=0; AC_SUBST([GNULIB_MBSRTOWCS])
146 GNULIB_MBSNRTOWCS=0; AC_SUBST([GNULIB_MBSNRTOWCS])
147 GNULIB_WCRTOMB=0; AC_SUBST([GNULIB_WCRTOMB])
148 GNULIB_WCSRTOMBS=0; AC_SUBST([GNULIB_WCSRTOMBS])
149 GNULIB_WCSNRTOMBS=0; AC_SUBST([GNULIB_WCSNRTOMBS])
150 GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH])
151 GNULIB_WMEMCHR=0; AC_SUBST([GNULIB_WMEMCHR])
152 GNULIB_WMEMCMP=0; AC_SUBST([GNULIB_WMEMCMP])
153 GNULIB_WMEMCPY=0; AC_SUBST([GNULIB_WMEMCPY])
154 GNULIB_WMEMMOVE=0; AC_SUBST([GNULIB_WMEMMOVE])
155 GNULIB_WMEMSET=0; AC_SUBST([GNULIB_WMEMSET])
156 GNULIB_WCSLEN=0; AC_SUBST([GNULIB_WCSLEN])
157 GNULIB_WCSNLEN=0; AC_SUBST([GNULIB_WCSNLEN])
158 GNULIB_WCSCPY=0; AC_SUBST([GNULIB_WCSCPY])
159 GNULIB_WCPCPY=0; AC_SUBST([GNULIB_WCPCPY])
160 GNULIB_WCSNCPY=0; AC_SUBST([GNULIB_WCSNCPY])
161 GNULIB_WCPNCPY=0; AC_SUBST([GNULIB_WCPNCPY])
162 GNULIB_WCSCAT=0; AC_SUBST([GNULIB_WCSCAT])
163 GNULIB_WCSNCAT=0; AC_SUBST([GNULIB_WCSNCAT])
164 GNULIB_WCSCMP=0; AC_SUBST([GNULIB_WCSCMP])
165 GNULIB_WCSNCMP=0; AC_SUBST([GNULIB_WCSNCMP])
166 GNULIB_WCSCASECMP=0; AC_SUBST([GNULIB_WCSCASECMP])
167 GNULIB_WCSNCASECMP=0; AC_SUBST([GNULIB_WCSNCASECMP])
168 GNULIB_WCSCOLL=0; AC_SUBST([GNULIB_WCSCOLL])
169 GNULIB_WCSXFRM=0; AC_SUBST([GNULIB_WCSXFRM])
170 GNULIB_WCSDUP=0; AC_SUBST([GNULIB_WCSDUP])
171 GNULIB_WCSCHR=0; AC_SUBST([GNULIB_WCSCHR])
172 GNULIB_WCSRCHR=0; AC_SUBST([GNULIB_WCSRCHR])
173 GNULIB_WCSCSPN=0; AC_SUBST([GNULIB_WCSCSPN])
174 GNULIB_WCSSPN=0; AC_SUBST([GNULIB_WCSSPN])
175 GNULIB_WCSPBRK=0; AC_SUBST([GNULIB_WCSPBRK])
176 GNULIB_WCSSTR=0; AC_SUBST([GNULIB_WCSSTR])
177 GNULIB_WCSTOK=0; AC_SUBST([GNULIB_WCSTOK])
178 GNULIB_WCSWIDTH=0; AC_SUBST([GNULIB_WCSWIDTH])
179 dnl Assume proper GNU behavior unless another module says otherwise.
180 HAVE_BTOWC=1; AC_SUBST([HAVE_BTOWC])
181 HAVE_MBSINIT=1; AC_SUBST([HAVE_MBSINIT])
182 HAVE_MBRTOWC=1; AC_SUBST([HAVE_MBRTOWC])
183 HAVE_MBRLEN=1; AC_SUBST([HAVE_MBRLEN])
184 HAVE_MBSRTOWCS=1; AC_SUBST([HAVE_MBSRTOWCS])
185 HAVE_MBSNRTOWCS=1; AC_SUBST([HAVE_MBSNRTOWCS])
186 HAVE_WCRTOMB=1; AC_SUBST([HAVE_WCRTOMB])
187 HAVE_WCSRTOMBS=1; AC_SUBST([HAVE_WCSRTOMBS])
188 HAVE_WCSNRTOMBS=1; AC_SUBST([HAVE_WCSNRTOMBS])
189 HAVE_WMEMCHR=1; AC_SUBST([HAVE_WMEMCHR])
190 HAVE_WMEMCMP=1; AC_SUBST([HAVE_WMEMCMP])
191 HAVE_WMEMCPY=1; AC_SUBST([HAVE_WMEMCPY])
192 HAVE_WMEMMOVE=1; AC_SUBST([HAVE_WMEMMOVE])
193 HAVE_WMEMSET=1; AC_SUBST([HAVE_WMEMSET])
194 HAVE_WCSLEN=1; AC_SUBST([HAVE_WCSLEN])
195 HAVE_WCSNLEN=1; AC_SUBST([HAVE_WCSNLEN])
196 HAVE_WCSCPY=1; AC_SUBST([HAVE_WCSCPY])
197 HAVE_WCPCPY=1; AC_SUBST([HAVE_WCPCPY])
198 HAVE_WCSNCPY=1; AC_SUBST([HAVE_WCSNCPY])
199 HAVE_WCPNCPY=1; AC_SUBST([HAVE_WCPNCPY])
200 HAVE_WCSCAT=1; AC_SUBST([HAVE_WCSCAT])
201 HAVE_WCSNCAT=1; AC_SUBST([HAVE_WCSNCAT])
202 HAVE_WCSCMP=1; AC_SUBST([HAVE_WCSCMP])
203 HAVE_WCSNCMP=1; AC_SUBST([HAVE_WCSNCMP])
204 HAVE_WCSCASECMP=1; AC_SUBST([HAVE_WCSCASECMP])
205 HAVE_WCSNCASECMP=1; AC_SUBST([HAVE_WCSNCASECMP])
206 HAVE_WCSCOLL=1; AC_SUBST([HAVE_WCSCOLL])
207 HAVE_WCSXFRM=1; AC_SUBST([HAVE_WCSXFRM])
208 HAVE_WCSDUP=1; AC_SUBST([HAVE_WCSDUP])
209 HAVE_WCSCHR=1; AC_SUBST([HAVE_WCSCHR])
210 HAVE_WCSRCHR=1; AC_SUBST([HAVE_WCSRCHR])
211 HAVE_WCSCSPN=1; AC_SUBST([HAVE_WCSCSPN])
212 HAVE_WCSSPN=1; AC_SUBST([HAVE_WCSSPN])
213 HAVE_WCSPBRK=1; AC_SUBST([HAVE_WCSPBRK])
214 HAVE_WCSSTR=1; AC_SUBST([HAVE_WCSSTR])
215 HAVE_WCSTOK=1; AC_SUBST([HAVE_WCSTOK])
216 HAVE_WCSWIDTH=1; AC_SUBST([HAVE_WCSWIDTH])
217 HAVE_DECL_WCTOB=1; AC_SUBST([HAVE_DECL_WCTOB])
218 HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH])
219 REPLACE_MBSTATE_T=0; AC_SUBST([REPLACE_MBSTATE_T])
220 REPLACE_BTOWC=0; AC_SUBST([REPLACE_BTOWC])
221 REPLACE_WCTOB=0; AC_SUBST([REPLACE_WCTOB])
222 REPLACE_MBSINIT=0; AC_SUBST([REPLACE_MBSINIT])
223 REPLACE_MBRTOWC=0; AC_SUBST([REPLACE_MBRTOWC])
224 REPLACE_MBRLEN=0; AC_SUBST([REPLACE_MBRLEN])
225 REPLACE_MBSRTOWCS=0; AC_SUBST([REPLACE_MBSRTOWCS])
226 REPLACE_MBSNRTOWCS=0; AC_SUBST([REPLACE_MBSNRTOWCS])
227 REPLACE_WCRTOMB=0; AC_SUBST([REPLACE_WCRTOMB])
228 REPLACE_WCSRTOMBS=0; AC_SUBST([REPLACE_WCSRTOMBS])
229 REPLACE_WCSNRTOMBS=0; AC_SUBST([REPLACE_WCSNRTOMBS])
230 REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH])
231 REPLACE_WCSWIDTH=0; AC_SUBST([REPLACE_WCSWIDTH])
232])
diff --git a/m4/wint_t.m4 b/m4/wint_t.m4
deleted file mode 100644
index da1ce3df601..00000000000
--- a/m4/wint_t.m4
+++ /dev/null
@@ -1,32 +0,0 @@
1# wint_t.m4 serial 5 (gettext-0.18.2)
2dnl Copyright (C) 2003, 2007-2011 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7dnl From Bruno Haible.
8dnl Test whether <wchar.h> has the 'wint_t' type.
9dnl Prerequisite: AC_PROG_CC
10
11AC_DEFUN([gt_TYPE_WINT_T],
12[
13 AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t],
14 [AC_COMPILE_IFELSE(
15 [AC_LANG_PROGRAM(
16 [[
17/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
18 <wchar.h>.
19 BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included
20 before <wchar.h>. */
21#include <stddef.h>
22#include <stdio.h>
23#include <time.h>
24#include <wchar.h>
25 wint_t foo = (wchar_t)'\0';]],
26 [[]])],
27 [gt_cv_c_wint_t=yes],
28 [gt_cv_c_wint_t=no])])
29 if test $gt_cv_c_wint_t = yes; then
30 AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.])
31 fi
32])