diff options
58 files changed, 1963 insertions, 549 deletions
diff --git a/gl/Makefile.am b/gl/Makefile.am index cae814f..87fe031 100644 --- a/gl/Makefile.am +++ b/gl/Makefile.am | |||
@@ -28,6 +28,7 @@ MAINTAINERCLEANFILES = | |||
28 | EXTRA_DIST += m4/gnulib-cache.m4 | 28 | EXTRA_DIST += m4/gnulib-cache.m4 |
29 | 29 | ||
30 | AM_CPPFLAGS = | 30 | AM_CPPFLAGS = |
31 | AM_CFLAGS = | ||
31 | 32 | ||
32 | noinst_LIBRARIES += libgnu.a | 33 | noinst_LIBRARIES += libgnu.a |
33 | 34 | ||
@@ -36,6 +37,13 @@ libgnu_a_LIBADD = $(gl_LIBOBJS) | |||
36 | libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) | 37 | libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) |
37 | EXTRA_libgnu_a_SOURCES = | 38 | EXTRA_libgnu_a_SOURCES = |
38 | 39 | ||
40 | ## begin gnulib module alignof | ||
41 | |||
42 | |||
43 | EXTRA_DIST += alignof.h | ||
44 | |||
45 | ## end gnulib module alignof | ||
46 | |||
39 | ## begin gnulib module alloca | 47 | ## begin gnulib module alloca |
40 | 48 | ||
41 | 49 | ||
@@ -70,7 +78,7 @@ BUILT_SOURCES += $(ARPA_INET_H) | |||
70 | 78 | ||
71 | # We need the following in order to create <arpa/inet.h> when the system | 79 | # We need the following in order to create <arpa/inet.h> when the system |
72 | # doesn't have one. | 80 | # doesn't have one. |
73 | arpa/inet.h: | 81 | arpa/inet.h: arpa_inet.in.h |
74 | @MKDIR_P@ arpa | 82 | @MKDIR_P@ arpa |
75 | rm -f $@-t $@ | 83 | rm -f $@-t $@ |
76 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ | 84 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ |
@@ -146,7 +154,7 @@ EXTRA_libgnu_a_SOURCES += cloexec.c | |||
146 | # The Automake-defined pkg* macros are appended, in the order | 154 | # The Automake-defined pkg* macros are appended, in the order |
147 | # listed in the Automake 1.10a+ documentation. | 155 | # listed in the Automake 1.10a+ documentation. |
148 | configmake.h: Makefile | 156 | configmake.h: Makefile |
149 | rm -f $@-t $@ | 157 | rm -f $@-t |
150 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ | 158 | { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ |
151 | echo '#define PREFIX "$(prefix)"'; \ | 159 | echo '#define PREFIX "$(prefix)"'; \ |
152 | echo '#define EXEC_PREFIX "$(exec_prefix)"'; \ | 160 | echo '#define EXEC_PREFIX "$(exec_prefix)"'; \ |
@@ -176,7 +184,12 @@ configmake.h: Makefile | |||
176 | echo '#define PKGLIBDIR "$(pkglibdir)"'; \ | 184 | echo '#define PKGLIBDIR "$(pkglibdir)"'; \ |
177 | echo '#define PKGLIBEXECDIR "$(pkglibexecdir)"'; \ | 185 | echo '#define PKGLIBEXECDIR "$(pkglibexecdir)"'; \ |
178 | } | sed '/""/d' > $@-t | 186 | } | sed '/""/d' > $@-t |
179 | mv $@-t $@ | 187 | if test -f $@ && cmp $@-t $@ > /dev/null; then \ |
188 | rm -f $@-t; \ | ||
189 | else \ | ||
190 | rm -f $@; mv $@-t $@; \ | ||
191 | fi | ||
192 | |||
180 | BUILT_SOURCES += configmake.h | 193 | BUILT_SOURCES += configmake.h |
181 | CLEANFILES += configmake.h configmake.h-t | 194 | CLEANFILES += configmake.h configmake.h-t |
182 | 195 | ||
@@ -433,21 +446,37 @@ all-local: charset.alias ref-add.sed ref-del.sed | |||
433 | 446 | ||
434 | charset_alias = $(DESTDIR)$(libdir)/charset.alias | 447 | charset_alias = $(DESTDIR)$(libdir)/charset.alias |
435 | charset_tmp = $(DESTDIR)$(libdir)/charset.tmp | 448 | charset_tmp = $(DESTDIR)$(libdir)/charset.tmp |
436 | install-exec-local: all-local | 449 | install-exec-local: install-exec-localcharset |
437 | test $(GLIBC21) != no || $(mkinstalldirs) $(DESTDIR)$(libdir) | 450 | install-exec-localcharset: all-local |
451 | if test $(GLIBC21) = no; then \ | ||
452 | case '$(host_os)' in \ | ||
453 | darwin[56]*) \ | ||
454 | need_charset_alias=true ;; \ | ||
455 | darwin* | cygwin* | mingw* | pw32* | cegcc*) \ | ||
456 | need_charset_alias=false ;; \ | ||
457 | *) \ | ||
458 | need_charset_alias=true ;; \ | ||
459 | esac ; \ | ||
460 | else \ | ||
461 | need_charset_alias=false ; \ | ||
462 | fi ; \ | ||
463 | if $$need_charset_alias; then \ | ||
464 | $(mkinstalldirs) $(DESTDIR)$(libdir) ; \ | ||
465 | fi ; \ | ||
438 | if test -f $(charset_alias); then \ | 466 | if test -f $(charset_alias); then \ |
439 | sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \ | 467 | sed -f ref-add.sed $(charset_alias) > $(charset_tmp) ; \ |
440 | $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \ | 468 | $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \ |
441 | rm -f $(charset_tmp) ; \ | 469 | rm -f $(charset_tmp) ; \ |
442 | else \ | 470 | else \ |
443 | if test $(GLIBC21) = no; then \ | 471 | if $$need_charset_alias; then \ |
444 | sed -f ref-add.sed charset.alias > $(charset_tmp) ; \ | 472 | sed -f ref-add.sed charset.alias > $(charset_tmp) ; \ |
445 | $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \ | 473 | $(INSTALL_DATA) $(charset_tmp) $(charset_alias) ; \ |
446 | rm -f $(charset_tmp) ; \ | 474 | rm -f $(charset_tmp) ; \ |
447 | fi ; \ | 475 | fi ; \ |
448 | fi | 476 | fi |
449 | 477 | ||
450 | uninstall-local: all-local | 478 | uninstall-local: uninstall-localcharset |
479 | uninstall-localcharset: all-local | ||
451 | if test -f $(charset_alias); then \ | 480 | if test -f $(charset_alias); then \ |
452 | sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \ | 481 | sed -f ref-del.sed $(charset_alias) > $(charset_tmp); \ |
453 | if grep '^# Packages using this file: $$' $(charset_tmp) \ | 482 | if grep '^# Packages using this file: $$' $(charset_tmp) \ |
@@ -794,6 +823,8 @@ stdio.h: stdio.in.h | |||
794 | -e 's|@''GNULIB_VPRINTF_POSIX''@|$(GNULIB_VPRINTF_POSIX)|g' \ | 823 | -e 's|@''GNULIB_VPRINTF_POSIX''@|$(GNULIB_VPRINTF_POSIX)|g' \ |
795 | -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \ | 824 | -e 's|@''GNULIB_VSNPRINTF''@|$(GNULIB_VSNPRINTF)|g' \ |
796 | -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \ | 825 | -e 's|@''GNULIB_VSPRINTF_POSIX''@|$(GNULIB_VSPRINTF_POSIX)|g' \ |
826 | -e 's|@''GNULIB_DPRINTF''@|$(GNULIB_DPRINTF)|g' \ | ||
827 | -e 's|@''GNULIB_VDPRINTF''@|$(GNULIB_VDPRINTF)|g' \ | ||
797 | -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \ | 828 | -e 's|@''GNULIB_VASPRINTF''@|$(GNULIB_VASPRINTF)|g' \ |
798 | -e 's|@''GNULIB_OBSTACK_PRINTF''@|$(GNULIB_OBSTACK_PRINTF)|g' \ | 829 | -e 's|@''GNULIB_OBSTACK_PRINTF''@|$(GNULIB_OBSTACK_PRINTF)|g' \ |
799 | -e 's|@''GNULIB_OBSTACK_PRINTF_POSIX''@|$(GNULIB_OBSTACK_PRINTF_POSIX)|g' \ | 830 | -e 's|@''GNULIB_OBSTACK_PRINTF_POSIX''@|$(GNULIB_OBSTACK_PRINTF_POSIX)|g' \ |
@@ -826,6 +857,10 @@ stdio.h: stdio.in.h | |||
826 | -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \ | 857 | -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \ |
827 | -e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \ | 858 | -e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \ |
828 | -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \ | 859 | -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \ |
860 | -e 's|@''HAVE_DPRINTF''@|$(HAVE_DPRINTF)|g' \ | ||
861 | -e 's|@''REPLACE_DPRINTF''@|$(REPLACE_DPRINTF)|g' \ | ||
862 | -e 's|@''HAVE_VDPRINTF''@|$(HAVE_VDPRINTF)|g' \ | ||
863 | -e 's|@''REPLACE_VDPRINTF''@|$(REPLACE_VDPRINTF)|g' \ | ||
829 | -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \ | 864 | -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \ |
830 | -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \ | 865 | -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \ |
831 | -e 's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \ | 866 | -e 's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \ |
@@ -866,6 +901,7 @@ stdlib.h: stdlib.in.h | |||
866 | sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ | 901 | sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ |
867 | -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ | 902 | -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ |
868 | -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \ | 903 | -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \ |
904 | -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \ | ||
869 | -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \ | 905 | -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \ |
870 | -e 's|@''GNULIB_REALLOC_POSIX''@|$(GNULIB_REALLOC_POSIX)|g' \ | 906 | -e 's|@''GNULIB_REALLOC_POSIX''@|$(GNULIB_REALLOC_POSIX)|g' \ |
871 | -e 's|@''GNULIB_CALLOC_POSIX''@|$(GNULIB_CALLOC_POSIX)|g' \ | 907 | -e 's|@''GNULIB_CALLOC_POSIX''@|$(GNULIB_CALLOC_POSIX)|g' \ |
@@ -912,6 +948,15 @@ EXTRA_DIST += stdlib.in.h | |||
912 | 948 | ||
913 | ## end gnulib module stdlib | 949 | ## end gnulib module stdlib |
914 | 950 | ||
951 | ## begin gnulib module strdup-posix | ||
952 | |||
953 | |||
954 | EXTRA_DIST += strdup.c | ||
955 | |||
956 | EXTRA_libgnu_a_SOURCES += strdup.c | ||
957 | |||
958 | ## end gnulib module strdup-posix | ||
959 | |||
915 | ## begin gnulib module streq | 960 | ## begin gnulib module streq |
916 | 961 | ||
917 | 962 | ||
@@ -1054,6 +1099,7 @@ sys/socket.h: sys_socket.in.h | |||
1054 | -e 's|@''GNULIB_SHUTDOWN''@|$(GNULIB_SHUTDOWN)|g' \ | 1099 | -e 's|@''GNULIB_SHUTDOWN''@|$(GNULIB_SHUTDOWN)|g' \ |
1055 | -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \ | 1100 | -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \ |
1056 | -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \ | 1101 | -e 's|@''HAVE_WS2TCPIP_H''@|$(HAVE_WS2TCPIP_H)|g' \ |
1102 | -e 's|@''HAVE_STRUCT_SOCKADDR_STORAGE''@|$(HAVE_STRUCT_SOCKADDR_STORAGE)|g' \ | ||
1057 | -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ | 1103 | -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ |
1058 | < $(srcdir)/sys_socket.in.h; \ | 1104 | < $(srcdir)/sys_socket.in.h; \ |
1059 | } > $@-t | 1105 | } > $@-t |
@@ -1139,6 +1185,7 @@ unistd.h: unistd.in.h | |||
1139 | -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \ | 1185 | -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \ |
1140 | -e 's|@''GNULIB_GETUSERSHELL''@|$(GNULIB_GETUSERSHELL)|g' \ | 1186 | -e 's|@''GNULIB_GETUSERSHELL''@|$(GNULIB_GETUSERSHELL)|g' \ |
1141 | -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \ | 1187 | -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \ |
1188 | -e 's|@''GNULIB_LINK''@|$(GNULIB_LINK)|g' \ | ||
1142 | -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \ | 1189 | -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \ |
1143 | -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \ | 1190 | -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \ |
1144 | -e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \ | 1191 | -e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \ |
@@ -1153,6 +1200,7 @@ unistd.h: unistd.in.h | |||
1153 | -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \ | 1200 | -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \ |
1154 | -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \ | 1201 | -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \ |
1155 | -e 's|@''HAVE_GETUSERSHELL''@|$(HAVE_GETUSERSHELL)|g' \ | 1202 | -e 's|@''HAVE_GETUSERSHELL''@|$(HAVE_GETUSERSHELL)|g' \ |
1203 | -e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \ | ||
1156 | -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \ | 1204 | -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \ |
1157 | -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \ | 1205 | -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \ |
1158 | -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \ | 1206 | -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \ |
@@ -1266,6 +1314,7 @@ wchar.h: wchar.in.h | |||
1266 | -e 's|@''REPLACE_MBSNRTOWCS''@|$(REPLACE_MBSNRTOWCS)|g' \ | 1314 | -e 's|@''REPLACE_MBSNRTOWCS''@|$(REPLACE_MBSNRTOWCS)|g' \ |
1267 | -e 's|@''REPLACE_WCRTOMB''@|$(REPLACE_WCRTOMB)|g' \ | 1315 | -e 's|@''REPLACE_WCRTOMB''@|$(REPLACE_WCRTOMB)|g' \ |
1268 | -e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|g' \ | 1316 | -e 's|@''REPLACE_WCSRTOMBS''@|$(REPLACE_WCSRTOMBS)|g' \ |
1317 | -e 's|@''REPLACE_WCSNRTOMBS''@|$(REPLACE_WCSNRTOMBS)|g' \ | ||
1269 | -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \ | 1318 | -e 's|@''REPLACE_WCWIDTH''@|$(REPLACE_WCWIDTH)|g' \ |
1270 | -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ | 1319 | -e '/definition of GL_LINK_WARNING/r $(LINK_WARNING_H)' \ |
1271 | < $(srcdir)/wchar.in.h; \ | 1320 | < $(srcdir)/wchar.in.h; \ |
diff --git a/gl/alignof.h b/gl/alignof.h new file mode 100644 index 0000000..896382b --- /dev/null +++ b/gl/alignof.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* Determine alignment of types. | ||
2 | Copyright (C) 2003-2004, 2006, 2009 Free Software Foundation, Inc. | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation; either version 3, or (at your option) | ||
7 | any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program; if not, write to the Free Software Foundation, | ||
16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | ||
17 | |||
18 | #ifndef _ALIGNOF_H | ||
19 | #define _ALIGNOF_H | ||
20 | |||
21 | #include <stddef.h> | ||
22 | |||
23 | /* Determine the alignment of a type at compile time. */ | ||
24 | #if defined __GNUC__ | ||
25 | # define alignof __alignof__ | ||
26 | #elif defined __cplusplus | ||
27 | template <class type> struct alignof_helper { char __slot1; type __slot2; }; | ||
28 | # define alignof(type) offsetof (alignof_helper<type>, __slot2) | ||
29 | #else | ||
30 | # define alignof(type) offsetof (struct { char __slot1; type __slot2; }, __slot2) | ||
31 | #endif | ||
32 | |||
33 | #endif /* _ALIGNOF_H */ | ||
diff --git a/gl/arpa_inet.in.h b/gl/arpa_inet.in.h index 4b95b94..ac93399 100644 --- a/gl/arpa_inet.in.h +++ b/gl/arpa_inet.in.h | |||
@@ -38,6 +38,10 @@ | |||
38 | 38 | ||
39 | /* The definition of GL_LINK_WARNING is copied here. */ | 39 | /* The definition of GL_LINK_WARNING is copied here. */ |
40 | 40 | ||
41 | #ifdef __cplusplus | ||
42 | extern "C" { | ||
43 | #endif | ||
44 | |||
41 | #if @GNULIB_INET_NTOP@ | 45 | #if @GNULIB_INET_NTOP@ |
42 | # if !@HAVE_DECL_INET_NTOP@ | 46 | # if !@HAVE_DECL_INET_NTOP@ |
43 | /* Converts an internet address from internal format to a printable, | 47 | /* Converts an internet address from internal format to a printable, |
@@ -78,5 +82,9 @@ extern int inet_pton (int af, const char *restrict src, void *restrict dst); | |||
78 | inet_pton (af, src, dst)) | 82 | inet_pton (af, src, dst)) |
79 | #endif | 83 | #endif |
80 | 84 | ||
85 | #ifdef __cplusplus | ||
86 | } | ||
87 | #endif | ||
88 | |||
81 | #endif /* _GL_ARPA_INET_H */ | 89 | #endif /* _GL_ARPA_INET_H */ |
82 | #endif /* _GL_ARPA_INET_H */ | 90 | #endif /* _GL_ARPA_INET_H */ |
diff --git a/gl/c-strtod.c b/gl/c-strtod.c index 95624cc..51e996e 100644 --- a/gl/c-strtod.c +++ b/gl/c-strtod.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Convert string to double, using the C locale. | 1 | /* Convert string to double, using the C locale. |
2 | 2 | ||
3 | Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc. | 3 | Copyright (C) 2003, 2004, 2006, 2009 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This program is free software: you can redistribute it and/or modify | 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 | 6 | it under the terms of the GNU General Public License as published by |
@@ -21,10 +21,10 @@ | |||
21 | 21 | ||
22 | #include "c-strtod.h" | 22 | #include "c-strtod.h" |
23 | 23 | ||
24 | #include <errno.h> | ||
24 | #include <locale.h> | 25 | #include <locale.h> |
25 | #include <stdlib.h> | 26 | #include <stdlib.h> |
26 | 27 | #include <string.h> | |
27 | #include "xalloc.h" | ||
28 | 28 | ||
29 | #if LONG | 29 | #if LONG |
30 | # define C_STRTOD c_strtold | 30 | # define C_STRTOD c_strtold |
@@ -43,6 +43,25 @@ | |||
43 | # define STRTOD strtod | 43 | # define STRTOD strtod |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | #ifdef LC_ALL_MASK | ||
47 | |||
48 | /* Cache for the C locale object. | ||
49 | Marked volatile so that different threads see the same value | ||
50 | (avoids locking). */ | ||
51 | static volatile locale_t c_locale_cache; | ||
52 | |||
53 | /* Return the C locale object, or (locale_t) 0 with errno set | ||
54 | if it cannot be created. */ | ||
55 | static inline locale_t | ||
56 | c_locale (void) | ||
57 | { | ||
58 | if (!c_locale_cache) | ||
59 | c_locale_cache = newlocale (LC_ALL_MASK, "C", (locale_t) 0); | ||
60 | return c_locale_cache; | ||
61 | } | ||
62 | |||
63 | #endif | ||
64 | |||
46 | DOUBLE | 65 | DOUBLE |
47 | C_STRTOD (char const *nptr, char **endptr) | 66 | C_STRTOD (char const *nptr, char **endptr) |
48 | { | 67 | { |
@@ -50,9 +69,15 @@ C_STRTOD (char const *nptr, char **endptr) | |||
50 | 69 | ||
51 | #ifdef LC_ALL_MASK | 70 | #ifdef LC_ALL_MASK |
52 | 71 | ||
53 | locale_t c_locale = newlocale (LC_ALL_MASK, "C", 0); | 72 | locale_t locale = c_locale (); |
54 | r = STRTOD_L (nptr, endptr, c_locale); | 73 | if (!locale) |
55 | freelocale (c_locale); | 74 | { |
75 | if (endptr) | ||
76 | *endptr = (char *) nptr; | ||
77 | return 0; /* errno is set here */ | ||
78 | } | ||
79 | |||
80 | r = STRTOD_L (nptr, endptr, locale); | ||
56 | 81 | ||
57 | #else | 82 | #else |
58 | 83 | ||
@@ -60,7 +85,13 @@ C_STRTOD (char const *nptr, char **endptr) | |||
60 | 85 | ||
61 | if (saved_locale) | 86 | if (saved_locale) |
62 | { | 87 | { |
63 | saved_locale = xstrdup (saved_locale); | 88 | saved_locale = strdup (saved_locale); |
89 | if (saved_locale == NULL) | ||
90 | { | ||
91 | if (endptr) | ||
92 | *endptr = (char *) nptr; | ||
93 | return 0; /* errno is set here */ | ||
94 | } | ||
64 | setlocale (LC_NUMERIC, "C"); | 95 | setlocale (LC_NUMERIC, "C"); |
65 | } | 96 | } |
66 | 97 | ||
@@ -68,8 +99,11 @@ C_STRTOD (char const *nptr, char **endptr) | |||
68 | 99 | ||
69 | if (saved_locale) | 100 | if (saved_locale) |
70 | { | 101 | { |
102 | int saved_errno = errno; | ||
103 | |||
71 | setlocale (LC_NUMERIC, saved_locale); | 104 | setlocale (LC_NUMERIC, saved_locale); |
72 | free (saved_locale); | 105 | free (saved_locale); |
106 | errno = saved_errno; | ||
73 | } | 107 | } |
74 | 108 | ||
75 | #endif | 109 | #endif |
diff --git a/gl/c-strtod.h b/gl/c-strtod.h index ca9a9e7..2b3f847 100644 --- a/gl/c-strtod.h +++ b/gl/c-strtod.h | |||
@@ -1,2 +1,37 @@ | |||
1 | double c_strtod (char const *, char **); | 1 | /* Convert string to double, using the C locale. |
2 | long double c_strtold (char const *, char **); | 2 | |
3 | Copyright (C) 2003-2004, 2009 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 of the License, or | ||
8 | (at your option) 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, see <http://www.gnu.org/licenses/>. */ | ||
17 | |||
18 | /* Parse the initial portion of the string pointed to by NPTR as a floating- | ||
19 | point number (in decimal or hexadecimal notation), like in the C locale: | ||
20 | accepting only the ASCII digits '0'..'9', and only '.' as decimal point | ||
21 | character. | ||
22 | If ENDPTR is not NULL, set *ENDPTR to point to the first byte beyond the | ||
23 | parsed number or to NPTR if the string does not start with a parseable | ||
24 | number. | ||
25 | Return value: | ||
26 | - If successful, return the value as a double or 'long double', | ||
27 | respectively, and don't modify errno. | ||
28 | - In case of overflow, return ±HUGE_VAL or ±HUGE_VALL, respectively, and | ||
29 | set errno to ERANGE. | ||
30 | - In case of underflow, return a value very near to 0 and set errno to | ||
31 | ERANGE. | ||
32 | - If the string does not start with a number at all, return 0 (and recall | ||
33 | that if ENDPTR != NULL, *ENDPTR is set to NPTR), and maybe set errno to | ||
34 | EINVAL. | ||
35 | - In case of other error, return 0 and set errno, for example to ENOMEM. */ | ||
36 | extern double c_strtod (char const *nptr, char **endptr); | ||
37 | extern long double c_strtold (char const *nptr, char **endptr); | ||
diff --git a/gl/config.charset b/gl/config.charset index 36ba683..7f91212 100755 --- a/gl/config.charset +++ b/gl/config.charset | |||
@@ -1,7 +1,7 @@ | |||
1 | #! /bin/sh | 1 | #! /bin/sh |
2 | # Output a system dependent table of character encoding aliases. | 2 | # Output a system dependent table of character encoding aliases. |
3 | # | 3 | # |
4 | # Copyright (C) 2000-2004, 2006-2008 Free Software Foundation, Inc. | 4 | # Copyright (C) 2000-2004, 2006-2009 Free Software Foundation, Inc. |
5 | # | 5 | # |
6 | # This program is free software; you can redistribute it and/or modify | 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 | 7 | # it under the terms of the GNU General Public License as published by |
@@ -63,12 +63,13 @@ | |||
63 | # CP922 aix | 63 | # CP922 aix |
64 | # CP932 aix woe32 dos | 64 | # CP932 aix woe32 dos |
65 | # CP943 aix | 65 | # CP943 aix |
66 | # CP949 osf woe32 dos | 66 | # CP949 osf darwin woe32 dos |
67 | # CP950 woe32 dos | 67 | # CP950 woe32 dos |
68 | # CP1046 aix | 68 | # CP1046 aix |
69 | # CP1124 aix | 69 | # CP1124 aix |
70 | # CP1125 dos | 70 | # CP1125 dos |
71 | # CP1129 aix | 71 | # CP1129 aix |
72 | # CP1131 darwin | ||
72 | # CP1250 woe32 | 73 | # CP1250 woe32 |
73 | # CP1251 glibc solaris netbsd openbsd darwin woe32 | 74 | # CP1251 glibc solaris netbsd openbsd darwin woe32 |
74 | # CP1252 aix woe32 | 75 | # CP1252 aix woe32 |
@@ -82,15 +83,17 @@ | |||
82 | # EUC-KR Y glibc aix hpux irix osf solaris freebsd netbsd darwin | 83 | # EUC-KR Y glibc aix hpux irix osf solaris freebsd netbsd darwin |
83 | # EUC-TW glibc aix hpux irix osf solaris netbsd | 84 | # EUC-TW glibc aix hpux irix osf solaris netbsd |
84 | # BIG5 Y glibc aix hpux osf solaris freebsd netbsd darwin | 85 | # BIG5 Y glibc aix hpux osf solaris freebsd netbsd darwin |
85 | # BIG5-HKSCS glibc solaris | 86 | # BIG5-HKSCS glibc solaris darwin |
86 | # GBK glibc aix osf solaris woe32 dos | 87 | # GBK glibc aix osf solaris darwin woe32 dos |
87 | # GB18030 glibc solaris netbsd | 88 | # GB18030 glibc solaris netbsd darwin |
88 | # SHIFT_JIS Y hpux osf solaris freebsd netbsd darwin | 89 | # SHIFT_JIS Y hpux osf solaris freebsd netbsd darwin |
89 | # JOHAB glibc solaris woe32 | 90 | # JOHAB glibc solaris woe32 |
90 | # TIS-620 glibc aix hpux osf solaris | 91 | # TIS-620 glibc aix hpux osf solaris |
91 | # VISCII Y glibc | 92 | # VISCII Y glibc |
92 | # TCVN5712-1 glibc | 93 | # TCVN5712-1 glibc |
94 | # ARMSCII-8 glibc darwin | ||
93 | # GEORGIAN-PS glibc | 95 | # GEORGIAN-PS glibc |
96 | # PT154 glibc | ||
94 | # HP-ROMAN8 hpux | 97 | # HP-ROMAN8 hpux |
95 | # HP-ARABIC8 hpux | 98 | # HP-ARABIC8 hpux |
96 | # HP-GREEK8 hpux | 99 | # HP-GREEK8 hpux |
@@ -449,7 +452,8 @@ case "$os" in | |||
449 | echo "ko_KR.EUC EUC-KR" | 452 | echo "ko_KR.EUC EUC-KR" |
450 | ;; | 453 | ;; |
451 | darwin*) | 454 | darwin*) |
452 | # Darwin 7.5 has nl_langinfo(CODESET), but it is useless: | 455 | # Darwin 7.5 has nl_langinfo(CODESET), but sometimes its value is |
456 | # useless: | ||
453 | # - It returns the empty string when LANG is set to a locale of the | 457 | # - It returns the empty string when LANG is set to a locale of the |
454 | # form ll_CC, although ll_CC/LC_CTYPE is a symlink to an UTF-8 | 458 | # form ll_CC, although ll_CC/LC_CTYPE is a symlink to an UTF-8 |
455 | # LC_CTYPE file. | 459 | # LC_CTYPE file. |
@@ -476,6 +480,36 @@ case "$os" in | |||
476 | # minimize the use of decomposed Unicode. Unfortunately, through the | 480 | # minimize the use of decomposed Unicode. Unfortunately, through the |
477 | # Darwin file system, decomposed UTF-8 strings are leaked into user | 481 | # Darwin file system, decomposed UTF-8 strings are leaked into user |
478 | # space nevertheless. | 482 | # space nevertheless. |
483 | # Then there are also the locales with encodings other than US-ASCII | ||
484 | # and UTF-8. These locales can be occasionally useful to users (e.g. | ||
485 | # when grepping through ISO-8859-1 encoded text files), when all their | ||
486 | # file names are in US-ASCII. | ||
487 | echo "ISO8859-1 ISO-8859-1" | ||
488 | echo "ISO8859-2 ISO-8859-2" | ||
489 | echo "ISO8859-4 ISO-8859-4" | ||
490 | echo "ISO8859-5 ISO-8859-5" | ||
491 | echo "ISO8859-7 ISO-8859-7" | ||
492 | echo "ISO8859-9 ISO-8859-9" | ||
493 | echo "ISO8859-13 ISO-8859-13" | ||
494 | echo "ISO8859-15 ISO-8859-15" | ||
495 | echo "KOI8-R KOI8-R" | ||
496 | echo "KOI8-U KOI8-U" | ||
497 | echo "CP866 CP866" | ||
498 | echo "CP949 CP949" | ||
499 | echo "CP1131 CP1131" | ||
500 | echo "CP1251 CP1251" | ||
501 | echo "eucCN GB2312" | ||
502 | echo "GB2312 GB2312" | ||
503 | echo "eucJP EUC-JP" | ||
504 | echo "eucKR EUC-KR" | ||
505 | echo "Big5 BIG5" | ||
506 | echo "Big5HKSCS BIG5-HKSCS" | ||
507 | echo "GBK GBK" | ||
508 | echo "GB18030 GB18030" | ||
509 | echo "SJIS SHIFT_JIS" | ||
510 | echo "ARMSCII-8 ARMSCII-8" | ||
511 | echo "PT154 PT154" | ||
512 | #echo "ISCII-DEV ?" | ||
479 | echo "* UTF-8" | 513 | echo "* UTF-8" |
480 | ;; | 514 | ;; |
481 | beos* | haiku*) | 515 | beos* | haiku*) |
diff --git a/gl/dup-safer.c b/gl/dup-safer.c index a690851..7d9b2be 100644 --- a/gl/dup-safer.c +++ b/gl/dup-safer.c | |||
@@ -1,6 +1,7 @@ | |||
1 | /* Invoke dup, but avoid some glitches. | 1 | /* Invoke dup, but avoid some glitches. |
2 | 2 | ||
3 | Copyright (C) 2001, 2004, 2005, 2006 Free Software Foundation, Inc. | 3 | Copyright (C) 2001, 2004, 2005, 2006, 2009 Free Software |
4 | Foundation, Inc. | ||
4 | 5 | ||
5 | This program is free software: you can redistribute it and/or modify | 6 | 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 | it under the terms of the GNU General Public License as published by |
@@ -24,9 +25,6 @@ | |||
24 | #include <fcntl.h> | 25 | #include <fcntl.h> |
25 | 26 | ||
26 | #include <unistd.h> | 27 | #include <unistd.h> |
27 | #ifndef STDERR_FILENO | ||
28 | # define STDERR_FILENO 2 | ||
29 | #endif | ||
30 | 28 | ||
31 | /* Like dup, but do not return STDIN_FILENO, STDOUT_FILENO, or | 29 | /* Like dup, but do not return STDIN_FILENO, STDOUT_FILENO, or |
32 | STDERR_FILENO. */ | 30 | STDERR_FILENO. */ |
diff --git a/gl/fd-safer.c b/gl/fd-safer.c index df38c8f..fb99001 100644 --- a/gl/fd-safer.c +++ b/gl/fd-safer.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Return a safer copy of a file descriptor. | 1 | /* Return a safer copy of a file descriptor. |
2 | 2 | ||
3 | Copyright (C) 2005, 2006 Free Software Foundation, Inc. | 3 | Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This program is free software: you can redistribute it and/or modify | 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 | 6 | it under the terms of the GNU General Public License as published by |
@@ -24,12 +24,6 @@ | |||
24 | #include <errno.h> | 24 | #include <errno.h> |
25 | 25 | ||
26 | #include <unistd.h> | 26 | #include <unistd.h> |
27 | #ifndef STDIN_FILENO | ||
28 | # define STDIN_FILENO 0 | ||
29 | #endif | ||
30 | #ifndef STDERR_FILENO | ||
31 | # define STDERR_FILENO 2 | ||
32 | #endif | ||
33 | 27 | ||
34 | /* Return FD, unless FD would be a copy of standard input, output, or | 28 | /* Return FD, unless FD would be a copy of standard input, output, or |
35 | error; in that case, return a duplicate of FD, closing FD. On | 29 | error; in that case, return a duplicate of FD, closing FD. On |
diff --git a/gl/fsusage.c b/gl/fsusage.c index 23d40ea..db0d3bc 100644 --- a/gl/fsusage.c +++ b/gl/fsusage.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* fsusage.c -- return space usage of mounted file systems | 1 | /* fsusage.c -- return space usage of mounted file systems |
2 | 2 | ||
3 | Copyright (C) 1991, 1992, 1996, 1998, 1999, 2002, 2003, 2004, 2005, 2006 | 3 | Copyright (C) 1991-1992, 1996, 1998-1999, 2002-2006, 2009 |
4 | Free Software Foundation, Inc. | 4 | Free Software Foundation, Inc. |
5 | 5 | ||
6 | This program is free software: you can redistribute it and/or modify | 6 | This program is free software: you can redistribute it and/or modify |
@@ -232,6 +232,7 @@ get_fs_usage (char const *file, char const *disk, struct fs_usage *fsp) | |||
232 | 232 | ||
233 | #endif | 233 | #endif |
234 | 234 | ||
235 | (void) disk; /* avoid argument-unused warning */ | ||
235 | return 0; | 236 | return 0; |
236 | } | 237 | } |
237 | 238 | ||
diff --git a/gl/gai_strerror.c b/gl/gai_strerror.c index 78a8edf..afbcdbb 100644 --- a/gl/gai_strerror.c +++ b/gl/gai_strerror.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006, 2008 Free Software Foundation, Inc. | 1 | /* Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006, 2008, 2009 Free Software Foundation, Inc. |
2 | This file is part of the GNU C Library. | 2 | This file is part of the GNU C Library. |
3 | Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997. | 3 | Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997. |
4 | 4 | ||
@@ -50,7 +50,7 @@ values[] = | |||
50 | { EAI_SOCKTYPE, N_("ai_socktype not supported") }, | 50 | { EAI_SOCKTYPE, N_("ai_socktype not supported") }, |
51 | { EAI_SYSTEM, N_("System error") }, | 51 | { EAI_SYSTEM, N_("System error") }, |
52 | { EAI_OVERFLOW, N_("Argument buffer too small") }, | 52 | { EAI_OVERFLOW, N_("Argument buffer too small") }, |
53 | #ifdef __USE_GNU | 53 | #ifdef EAI_INPROGRESS |
54 | { EAI_INPROGRESS, N_("Processing request in progress") }, | 54 | { EAI_INPROGRESS, N_("Processing request in progress") }, |
55 | { EAI_CANCELED, N_("Request canceled") }, | 55 | { EAI_CANCELED, N_("Request canceled") }, |
56 | { EAI_NOTCANCELED, N_("Request not canceled") }, | 56 | { EAI_NOTCANCELED, N_("Request not canceled") }, |
diff --git a/gl/getloadavg.c b/gl/getloadavg.c index 5c32f9f..5a4005c 100644 --- a/gl/getloadavg.c +++ b/gl/getloadavg.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* Get the system load averages. | 1 | /* Get the system load averages. |
2 | 2 | ||
3 | Copyright (C) 1985, 1986, 1987, 1988, 1989, 1991, 1992, 1993, 1994, | 3 | Copyright (C) 1985, 1986, 1987, 1988, 1989, 1991, 1992, 1993, 1994, |
4 | 1995, 1997, 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2008 Free Software | 4 | 1995, 1997, 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free |
5 | Foundation, Inc. | 5 | Software Foundation, Inc. |
6 | 6 | ||
7 | NOTE: The canonical source of this file is maintained with gnulib. | 7 | NOTE: The canonical source of this file is maintained with gnulib. |
8 | Bugs can be reported to bug-gnulib@gnu.org. | 8 | Bugs can be reported to bug-gnulib@gnu.org. |
@@ -621,8 +621,11 @@ getloadavg (double loadavg[], int nelem) | |||
621 | for (elem = 0; elem < nelem; elem++) | 621 | for (elem = 0; elem < nelem; elem++) |
622 | { | 622 | { |
623 | char *endptr; | 623 | char *endptr; |
624 | double d = c_strtod (ptr, &endptr); | 624 | double d; |
625 | if (ptr == endptr) | 625 | |
626 | errno = 0; | ||
627 | d = c_strtod (ptr, &endptr); | ||
628 | if (ptr == endptr || (d == 0 && errno != 0)) | ||
626 | { | 629 | { |
627 | if (elem == 0) | 630 | if (elem == 0) |
628 | return -1; | 631 | return -1; |
diff --git a/gl/getopt1.c b/gl/getopt1.c index d6a3ecf..ba115c4 100644 --- a/gl/getopt1.c +++ b/gl/getopt1.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* getopt_long and getopt_long_only entry points for GNU getopt. | 1 | /* getopt_long and getopt_long_only entry points for GNU getopt. |
2 | Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98,2004,2006 | 2 | Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98,2004,2006,2009 |
3 | Free Software Foundation, Inc. | 3 | Free Software Foundation, Inc. |
4 | This file is part of the GNU C Library. | 4 | This file is part of the GNU C Library. |
5 | 5 | ||
@@ -91,7 +91,7 @@ main (int argc, char **argv) | |||
91 | { | 91 | { |
92 | int this_option_optind = optind ? optind : 1; | 92 | int this_option_optind = optind ? optind : 1; |
93 | int option_index = 0; | 93 | int option_index = 0; |
94 | static struct option long_options[] = | 94 | static const struct option long_options[] = |
95 | { | 95 | { |
96 | {"add", 1, 0, 0}, | 96 | {"add", 1, 0, 0}, |
97 | {"append", 0, 0, 0}, | 97 | {"append", 0, 0, 0}, |
diff --git a/gl/gettext.h b/gl/gettext.h index 763dd3c..8cf2dca 100644 --- a/gl/gettext.h +++ b/gl/gettext.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Convenience header for conditional use of GNU <libintl.h>. | 1 | /* Convenience header for conditional use of GNU <libintl.h>. |
2 | Copyright (C) 1995-1998, 2000-2002, 2004-2006 Free Software Foundation, Inc. | 2 | Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This program is free software; you can redistribute it and/or modify | 4 | This program is free software; you can redistribute it and/or modify |
5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
@@ -63,21 +63,30 @@ | |||
63 | for invalid uses of the value returned from these functions. | 63 | for invalid uses of the value returned from these functions. |
64 | On pre-ANSI systems without 'const', the config.h file is supposed to | 64 | On pre-ANSI systems without 'const', the config.h file is supposed to |
65 | contain "#define const". */ | 65 | contain "#define const". */ |
66 | # undef gettext | ||
66 | # define gettext(Msgid) ((const char *) (Msgid)) | 67 | # define gettext(Msgid) ((const char *) (Msgid)) |
68 | # undef dgettext | ||
67 | # define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid)) | 69 | # define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid)) |
70 | # undef dcgettext | ||
68 | # define dcgettext(Domainname, Msgid, Category) \ | 71 | # define dcgettext(Domainname, Msgid, Category) \ |
69 | ((void) (Category), dgettext (Domainname, Msgid)) | 72 | ((void) (Category), dgettext (Domainname, Msgid)) |
73 | # undef ngettext | ||
70 | # define ngettext(Msgid1, Msgid2, N) \ | 74 | # define ngettext(Msgid1, Msgid2, N) \ |
71 | ((N) == 1 \ | 75 | ((N) == 1 \ |
72 | ? ((void) (Msgid2), (const char *) (Msgid1)) \ | 76 | ? ((void) (Msgid2), (const char *) (Msgid1)) \ |
73 | : ((void) (Msgid1), (const char *) (Msgid2))) | 77 | : ((void) (Msgid1), (const char *) (Msgid2))) |
78 | # undef dngettext | ||
74 | # define dngettext(Domainname, Msgid1, Msgid2, N) \ | 79 | # define dngettext(Domainname, Msgid1, Msgid2, N) \ |
75 | ((void) (Domainname), ngettext (Msgid1, Msgid2, N)) | 80 | ((void) (Domainname), ngettext (Msgid1, Msgid2, N)) |
81 | # undef dcngettext | ||
76 | # define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ | 82 | # define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ |
77 | ((void) (Category), dngettext(Domainname, Msgid1, Msgid2, N)) | 83 | ((void) (Category), dngettext(Domainname, Msgid1, Msgid2, N)) |
84 | # undef textdomain | ||
78 | # define textdomain(Domainname) ((const char *) (Domainname)) | 85 | # define textdomain(Domainname) ((const char *) (Domainname)) |
86 | # undef bindtextdomain | ||
79 | # define bindtextdomain(Domainname, Dirname) \ | 87 | # define bindtextdomain(Domainname, Dirname) \ |
80 | ((void) (Domainname), (const char *) (Dirname)) | 88 | ((void) (Domainname), (const char *) (Dirname)) |
89 | # undef bind_textdomain_codeset | ||
81 | # define bind_textdomain_codeset(Domainname, Codeset) \ | 90 | # define bind_textdomain_codeset(Domainname, Codeset) \ |
82 | ((void) (Domainname), (const char *) (Codeset)) | 91 | ((void) (Domainname), (const char *) (Codeset)) |
83 | 92 | ||
diff --git a/gl/localcharset.c b/gl/localcharset.c index 68679cf..a7ca94c 100644 --- a/gl/localcharset.c +++ b/gl/localcharset.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Determine a canonical name for the current locale's character encoding. | 1 | /* Determine a canonical name for the current locale's character encoding. |
2 | 2 | ||
3 | Copyright (C) 2000-2006, 2008 Free Software Foundation, Inc. | 3 | Copyright (C) 2000-2006, 2008-2009 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 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 | 6 | it under the terms of the GNU General Public License as published by |
@@ -28,6 +28,10 @@ | |||
28 | #include <string.h> | 28 | #include <string.h> |
29 | #include <stdlib.h> | 29 | #include <stdlib.h> |
30 | 30 | ||
31 | #if defined __APPLE__ && defined __MACH__ && HAVE_LANGINFO_CODESET | ||
32 | # define DARWIN7 /* Darwin 7 or newer, i.e. MacOS X 10.3 or newer */ | ||
33 | #endif | ||
34 | |||
31 | #if defined _WIN32 || defined __WIN32__ | 35 | #if defined _WIN32 || defined __WIN32__ |
32 | # define WIN32_NATIVE | 36 | # define WIN32_NATIVE |
33 | #endif | 37 | #endif |
@@ -112,7 +116,7 @@ get_charset_aliases (void) | |||
112 | cp = charset_aliases; | 116 | cp = charset_aliases; |
113 | if (cp == NULL) | 117 | if (cp == NULL) |
114 | { | 118 | { |
115 | #if !(defined VMS || defined WIN32_NATIVE || defined __CYGWIN__) | 119 | #if !(defined DARWIN7 || defined VMS || defined WIN32_NATIVE || defined __CYGWIN__) |
116 | FILE *fp; | 120 | FILE *fp; |
117 | const char *dir; | 121 | const char *dir; |
118 | const char *base = "charset.alias"; | 122 | const char *base = "charset.alias"; |
@@ -213,6 +217,39 @@ get_charset_aliases (void) | |||
213 | 217 | ||
214 | #else | 218 | #else |
215 | 219 | ||
220 | # if defined DARWIN7 | ||
221 | /* To avoid the trouble of installing a file that is shared by many | ||
222 | GNU packages -- many packaging systems have problems with this --, | ||
223 | simply inline the aliases here. */ | ||
224 | cp = "ISO8859-1" "\0" "ISO-8859-1" "\0" | ||
225 | "ISO8859-2" "\0" "ISO-8859-2" "\0" | ||
226 | "ISO8859-4" "\0" "ISO-8859-4" "\0" | ||
227 | "ISO8859-5" "\0" "ISO-8859-5" "\0" | ||
228 | "ISO8859-7" "\0" "ISO-8859-7" "\0" | ||
229 | "ISO8859-9" "\0" "ISO-8859-9" "\0" | ||
230 | "ISO8859-13" "\0" "ISO-8859-13" "\0" | ||
231 | "ISO8859-15" "\0" "ISO-8859-15" "\0" | ||
232 | "KOI8-R" "\0" "KOI8-R" "\0" | ||
233 | "KOI8-U" "\0" "KOI8-U" "\0" | ||
234 | "CP866" "\0" "CP866" "\0" | ||
235 | "CP949" "\0" "CP949" "\0" | ||
236 | "CP1131" "\0" "CP1131" "\0" | ||
237 | "CP1251" "\0" "CP1251" "\0" | ||
238 | "eucCN" "\0" "GB2312" "\0" | ||
239 | "GB2312" "\0" "GB2312" "\0" | ||
240 | "eucJP" "\0" "EUC-JP" "\0" | ||
241 | "eucKR" "\0" "EUC-KR" "\0" | ||
242 | "Big5" "\0" "BIG5" "\0" | ||
243 | "Big5HKSCS" "\0" "BIG5-HKSCS" "\0" | ||
244 | "GBK" "\0" "GBK" "\0" | ||
245 | "GB18030" "\0" "GB18030" "\0" | ||
246 | "SJIS" "\0" "SHIFT_JIS" "\0" | ||
247 | "ARMSCII-8" "\0" "ARMSCII-8" "\0" | ||
248 | "PT154" "\0" "PT154" "\0" | ||
249 | /*"ISCII-DEV" "\0" "?" "\0"*/ | ||
250 | "*" "\0" "UTF-8" "\0"; | ||
251 | # endif | ||
252 | |||
216 | # if defined VMS | 253 | # if defined VMS |
217 | /* To avoid the troubles of an extra file charset.alias_vms in the | 254 | /* To avoid the troubles of an extra file charset.alias_vms in the |
218 | sources of many GNU packages, simply inline the aliases here. */ | 255 | sources of many GNU packages, simply inline the aliases here. */ |
diff --git a/gl/m4/00gnulib.m4 b/gl/m4/00gnulib.m4 new file mode 100644 index 0000000..d4d04d1 --- /dev/null +++ b/gl/m4/00gnulib.m4 | |||
@@ -0,0 +1,30 @@ | |||
1 | # 00gnulib.m4 serial 2 | ||
2 | dnl Copyright (C) 2009 Free Software Foundation, Inc. | ||
3 | dnl This file is free software; the Free Software Foundation | ||
4 | dnl gives unlimited permission to copy and/or distribute it, | ||
5 | dnl with or without modifications, as long as this notice is preserved. | ||
6 | |||
7 | dnl This file must be named something that sorts before all other | ||
8 | dnl gnulib-provided .m4 files. It is needed until such time as we can | ||
9 | dnl assume Autoconf 2.64, with its improved AC_DEFUN_ONCE semantics. | ||
10 | |||
11 | # AC_DEFUN_ONCE([NAME], VALUE) | ||
12 | # ---------------------------- | ||
13 | # Define NAME to expand to VALUE on the first use (whether by direct | ||
14 | # expansion, or by AC_REQUIRE), and to nothing on all subsequent uses. | ||
15 | # Avoid bugs in AC_REQUIRE in Autoconf 2.63 and earlier. This | ||
16 | # definition is slower than the version in Autoconf 2.64, because it | ||
17 | # can only use interfaces that existed since 2.59; but it achieves the | ||
18 | # same effect. Quoting is necessary to avoid confusing Automake. | ||
19 | m4_version_prereq([2.63.263], [], | ||
20 | [m4_define([AC][_DEFUN_ONCE], | ||
21 | [AC][_DEFUN([$1], | ||
22 | [AC_REQUIRE([_gl_DEFUN_ONCE([$1])], | ||
23 | [m4_indir([_gl_DEFUN_ONCE([$1])])])])]dnl | ||
24 | [AC][_DEFUN([_gl_DEFUN_ONCE([$1])], [$2])])]) | ||
25 | |||
26 | # gl_00GNULIB | ||
27 | # ----------- | ||
28 | # Witness macro that this file has been included. Needed to force | ||
29 | # Automake to include this file prior to all other gnulib .m4 files. | ||
30 | AC_DEFUN([gl_00GNULIB]) | ||
diff --git a/gl/m4/btowc.m4 b/gl/m4/btowc.m4 index 64ff829..b46f74f 100644 --- a/gl/m4/btowc.m4 +++ b/gl/m4/btowc.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # btowc.m4 serial 3 | 1 | # btowc.m4 serial 4 |
2 | dnl Copyright (C) 2008 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2008-2009 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -47,7 +47,7 @@ int main () | |||
47 | }], | 47 | }], |
48 | [gl_cv_func_btowc_eof=yes], | 48 | [gl_cv_func_btowc_eof=yes], |
49 | [gl_cv_func_btowc_eof=no], | 49 | [gl_cv_func_btowc_eof=no], |
50 | []) | 50 | [:]) |
51 | fi | 51 | fi |
52 | ]) | 52 | ]) |
53 | case "$gl_cv_func_btowc_eof" in | 53 | case "$gl_cv_func_btowc_eof" in |
diff --git a/gl/m4/c-strtod.m4 b/gl/m4/c-strtod.m4 index 0514f2d..ba95435 100644 --- a/gl/m4/c-strtod.m4 +++ b/gl/m4/c-strtod.m4 | |||
@@ -1,4 +1,4 @@ | |||
1 | # c-strtod.m4 serial 10 | 1 | # c-strtod.m4 serial 11 |
2 | 2 | ||
3 | # Copyright (C) 2004, 2005, 2006, 2009 Free Software Foundation, Inc. | 3 | # Copyright (C) 2004, 2005, 2006, 2009 Free Software Foundation, Inc. |
4 | # This file is free software; the Free Software Foundation | 4 | # This file is free software; the Free Software Foundation |
@@ -39,6 +39,8 @@ AC_DEFUN([gl_C_STRTOD], | |||
39 | 39 | ||
40 | dnl Prerequisites of lib/c-strtod.c. | 40 | dnl Prerequisites of lib/c-strtod.c. |
41 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | 41 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) |
42 | |||
43 | AC_REQUIRE([AC_C_INLINE]) | ||
42 | : | 44 | : |
43 | ]) | 45 | ]) |
44 | 46 | ||
@@ -49,5 +51,7 @@ AC_DEFUN([gl_C_STRTOLD], | |||
49 | dnl Prerequisites of lib/c-strtold.c. | 51 | dnl Prerequisites of lib/c-strtold.c. |
50 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | 52 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) |
51 | AC_REQUIRE([gl_C99_STRTOLD]) | 53 | AC_REQUIRE([gl_C99_STRTOLD]) |
54 | |||
55 | AC_REQUIRE([AC_C_INLINE]) | ||
52 | : | 56 | : |
53 | ]) | 57 | ]) |
diff --git a/gl/m4/errno_h.m4 b/gl/m4/errno_h.m4 index 0682d1a..16188d9 100644 --- a/gl/m4/errno_h.m4 +++ b/gl/m4/errno_h.m4 | |||
@@ -1,17 +1,10 @@ | |||
1 | # errno_h.m4 serial 3 | 1 | # errno_h.m4 serial 5 |
2 | dnl Copyright (C) 2004, 2006, 2008, 2009 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2004, 2006, 2008, 2009 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | 6 | ||
7 | AC_DEFUN([gl_HEADER_ERRNO_H], | 7 | AC_DEFUN_ONCE([gl_HEADER_ERRNO_H], |
8 | [ | ||
9 | dnl Use AC_REQUIRE here, so that the default behavior below is expanded | ||
10 | dnl once only, before all statements that occur in other macros. | ||
11 | AC_REQUIRE([gl_HEADER_ERRNO_H_BODY]) | ||
12 | ]) | ||
13 | |||
14 | AC_DEFUN([gl_HEADER_ERRNO_H_BODY], | ||
15 | [ | 8 | [ |
16 | AC_REQUIRE([AC_PROG_CC]) | 9 | AC_REQUIRE([AC_PROG_CC]) |
17 | AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [ | 10 | AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [ |
diff --git a/gl/m4/extensions.m4 b/gl/m4/extensions.m4 index 611fcfd..ba6d5e1 100644 --- a/gl/m4/extensions.m4 +++ b/gl/m4/extensions.m4 | |||
@@ -1,7 +1,7 @@ | |||
1 | # serial 6 -*- Autoconf -*- | 1 | # serial 8 -*- Autoconf -*- |
2 | # Enable extensions on systems that normally disable them. | 2 | # Enable extensions on systems that normally disable them. |
3 | 3 | ||
4 | # Copyright (C) 2003, 2006-2008 Free Software Foundation, Inc. | 4 | # Copyright (C) 2003, 2006-2009 Free Software Foundation, Inc. |
5 | # This file is free software; the Free Software Foundation | 5 | # This file is free software; the Free Software Foundation |
6 | # gives unlimited permission to copy and/or distribute it, | 6 | # gives unlimited permission to copy and/or distribute it, |
7 | # with or without modifications, as long as this notice is preserved. | 7 | # with or without modifications, as long as this notice is preserved. |
@@ -20,7 +20,7 @@ | |||
20 | # AC_DEFINE. The goal here is to define all known feature-enabling | 20 | # AC_DEFINE. The goal here is to define all known feature-enabling |
21 | # macros, then, if reports of conflicts are made, disable macros that | 21 | # macros, then, if reports of conflicts are made, disable macros that |
22 | # cause problems on some platforms (such as __EXTENSIONS__). | 22 | # cause problems on some platforms (such as __EXTENSIONS__). |
23 | AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS], | 23 | AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS], |
24 | [AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl | 24 | [AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl |
25 | AC_BEFORE([$0], [AC_RUN_IFELSE])dnl | 25 | AC_BEFORE([$0], [AC_RUN_IFELSE])dnl |
26 | 26 | ||
@@ -90,5 +90,15 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl | |||
90 | # ------------------------ | 90 | # ------------------------ |
91 | # Enable extensions on systems that normally disable them, | 91 | # Enable extensions on systems that normally disable them, |
92 | # typically due to standards-conformance issues. | 92 | # typically due to standards-conformance issues. |
93 | AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS], | 93 | AC_DEFUN_ONCE([gl_USE_SYSTEM_EXTENSIONS], |
94 | [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])]) | 94 | [ |
95 | dnl Require this macro before AC_USE_SYSTEM_EXTENSIONS. | ||
96 | dnl gnulib does not need it. But if it gets required by third-party macros | ||
97 | dnl after AC_USE_SYSTEM_EXTENSIONS is required, autoconf 2.62..2.63 emit a | ||
98 | dnl warning: "AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS". | ||
99 | dnl Note: We can do this only for one of the macros AC_AIX, AC_GNU_SOURCE, | ||
100 | dnl AC_MINIX. If people still use AC_AIX or AC_MINIX, they are out of luck. | ||
101 | AC_REQUIRE([AC_GNU_SOURCE]) | ||
102 | |||
103 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) | ||
104 | ]) | ||
diff --git a/gl/m4/fcntl_h.m4 b/gl/m4/fcntl_h.m4 index 4a7fc42..1ae0b15 100644 --- a/gl/m4/fcntl_h.m4 +++ b/gl/m4/fcntl_h.m4 | |||
@@ -9,6 +9,8 @@ dnl Written by Paul Eggert. | |||
9 | AC_DEFUN([gl_FCNTL_H], | 9 | AC_DEFUN([gl_FCNTL_H], |
10 | [ | 10 | [ |
11 | AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) | 11 | AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) |
12 | dnl Persuade glibc <fcntl.h> to define O_NOATIME and O_NOFOLLOW. | ||
13 | AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) | ||
12 | AC_CACHE_CHECK([for working fcntl.h], [gl_cv_header_working_fcntl_h], | 14 | AC_CACHE_CHECK([for working fcntl.h], [gl_cv_header_working_fcntl_h], |
13 | [AC_RUN_IFELSE( | 15 | [AC_RUN_IFELSE( |
14 | [AC_LANG_PROGRAM( | 16 | [AC_LANG_PROGRAM( |
diff --git a/gl/m4/floorf.m4 b/gl/m4/floorf.m4 index 8cdaa94..915e566 100644 --- a/gl/m4/floorf.m4 +++ b/gl/m4/floorf.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # floorf.m4 serial 3 | 1 | # floorf.m4 serial 4 |
2 | dnl Copyright (C) 2007 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2007, 2009 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -34,7 +34,7 @@ AC_DEFUN([gl_FUNC_FLOORF], | |||
34 | # Sets FLOORF_LIBM. | 34 | # Sets FLOORF_LIBM. |
35 | AC_DEFUN([gl_FUNC_FLOORF_LIBS], | 35 | AC_DEFUN([gl_FUNC_FLOORF_LIBS], |
36 | [ | 36 | [ |
37 | AC_CACHE_VAL([gl_cv_func_floorf_libm], [ | 37 | gl_CACHE_VAL_SILENT([gl_cv_func_floorf_libm], [ |
38 | gl_cv_func_floorf_libm=? | 38 | gl_cv_func_floorf_libm=? |
39 | AC_TRY_LINK([ | 39 | AC_TRY_LINK([ |
40 | #ifndef __NO_MATH_INLINES | 40 | #ifndef __NO_MATH_INLINES |
diff --git a/gl/m4/gnulib-common.m4 b/gl/m4/gnulib-common.m4 index 5804eb9..c8fda20 100644 --- a/gl/m4/gnulib-common.m4 +++ b/gl/m4/gnulib-common.m4 | |||
@@ -1,4 +1,4 @@ | |||
1 | # gnulib-common.m4 serial 7 | 1 | # gnulib-common.m4 serial 11 |
2 | dnl Copyright (C) 2007-2009 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2007-2009 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
@@ -8,6 +8,7 @@ dnl with or without modifications, as long as this notice is preserved. | |||
8 | # is expanded unconditionally through gnulib-tool magic. | 8 | # is expanded unconditionally through gnulib-tool magic. |
9 | AC_DEFUN([gl_COMMON], [ | 9 | AC_DEFUN([gl_COMMON], [ |
10 | dnl Use AC_REQUIRE here, so that the code is expanded once only. | 10 | dnl Use AC_REQUIRE here, so that the code is expanded once only. |
11 | AC_REQUIRE([gl_00GNULIB]) | ||
11 | AC_REQUIRE([gl_COMMON_BODY]) | 12 | AC_REQUIRE([gl_COMMON_BODY]) |
12 | ]) | 13 | ]) |
13 | AC_DEFUN([gl_COMMON_BODY], [ | 14 | AC_DEFUN([gl_COMMON_BODY], [ |
@@ -52,7 +53,7 @@ m4_ifndef([m4_foreach_w], | |||
52 | # is a backport of autoconf-2.60's AC_PROG_MKDIR_P. | 53 | # is a backport of autoconf-2.60's AC_PROG_MKDIR_P. |
53 | # Remove this macro when we can assume autoconf >= 2.60. | 54 | # Remove this macro when we can assume autoconf >= 2.60. |
54 | m4_ifdef([AC_PROG_MKDIR_P], [], [ | 55 | m4_ifdef([AC_PROG_MKDIR_P], [], [ |
55 | AC_DEFUN([AC_PROG_MKDIR_P], | 56 | AC_DEFUN_ONCE([AC_PROG_MKDIR_P], |
56 | [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake | 57 | [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake |
57 | MKDIR_P='$(mkdir_p)' | 58 | MKDIR_P='$(mkdir_p)' |
58 | AC_SUBST([MKDIR_P])])]) | 59 | AC_SUBST([MKDIR_P])])]) |
@@ -99,3 +100,25 @@ AC_DEFUN([AC_C_RESTRICT], | |||
99 | *) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;; | 100 | *) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;; |
100 | esac | 101 | esac |
101 | ]) | 102 | ]) |
103 | |||
104 | # gl_BIGENDIAN | ||
105 | # is like AC_C_BIGENDIAN, except that it can be AC_REQUIREd. | ||
106 | # Note that AC_REQUIRE([AC_C_BIGENDIAN]) does not work reliably because some | ||
107 | # macros invoke AC_C_BIGENDIAN with arguments. | ||
108 | AC_DEFUN([gl_BIGENDIAN], | ||
109 | [ | ||
110 | AC_C_BIGENDIAN | ||
111 | ]) | ||
112 | |||
113 | # gl_CACHE_VAL_SILENT(cache-id, command-to-set-it) | ||
114 | # is like AC_CACHE_VAL(cache-id, command-to-set-it), except that it does not | ||
115 | # output a spurious "(cached)" mark in the midst of other configure output. | ||
116 | # This macro should be used instead of AC_CACHE_VAL when it is not surrounded | ||
117 | # by an AC_MSG_CHECKING/AC_MSG_RESULT pair. | ||
118 | AC_DEFUN([gl_CACHE_VAL_SILENT], | ||
119 | [ | ||
120 | saved_as_echo_n="$as_echo_n" | ||
121 | as_echo_n=':' | ||
122 | AC_CACHE_VAL([$1], [$2]) | ||
123 | as_echo_n="$saved_as_echo_n" | ||
124 | ]) | ||
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4 index c6171de..005cc4e 100644 --- a/gl/m4/gnulib-comp.m4 +++ b/gl/m4/gnulib-comp.m4 | |||
@@ -25,7 +25,6 @@ AC_DEFUN([gl_EARLY], | |||
25 | m4_pattern_allow([^gl_LIBOBJS$])dnl a variable | 25 | m4_pattern_allow([^gl_LIBOBJS$])dnl a variable |
26 | m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable | 26 | m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable |
27 | AC_REQUIRE([AC_PROG_RANLIB]) | 27 | AC_REQUIRE([AC_PROG_RANLIB]) |
28 | AC_REQUIRE([AC_GNU_SOURCE]) | ||
29 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) | 28 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) |
30 | ]) | 29 | ]) |
31 | 30 | ||
@@ -116,6 +115,8 @@ AC_DEFUN([gl_INIT], | |||
116 | gl_STDINT_H | 115 | gl_STDINT_H |
117 | gl_STDIO_H | 116 | gl_STDIO_H |
118 | gl_STDLIB_H | 117 | gl_STDLIB_H |
118 | gl_FUNC_STRDUP_POSIX | ||
119 | gl_STRING_MODULE_INDICATOR([strdup]) | ||
119 | gl_FUNC_STRERROR | 120 | gl_FUNC_STRERROR |
120 | gl_STRING_MODULE_INDICATOR([strerror]) | 121 | gl_STRING_MODULE_INDICATOR([strerror]) |
121 | gl_HEADER_STRING_H | 122 | gl_HEADER_STRING_H |
@@ -124,7 +125,6 @@ AC_DEFUN([gl_INIT], | |||
124 | gl_FUNC_STRNLEN | 125 | gl_FUNC_STRNLEN |
125 | gl_STRING_MODULE_INDICATOR([strnlen]) | 126 | gl_STRING_MODULE_INDICATOR([strnlen]) |
126 | gl_HEADER_SYS_SOCKET | 127 | gl_HEADER_SYS_SOCKET |
127 | gl_MODULE_INDICATOR([sys_socket]) | ||
128 | AC_PROG_MKDIR_P | 128 | AC_PROG_MKDIR_P |
129 | gl_HEADER_TIME_H | 129 | gl_HEADER_TIME_H |
130 | gl_TIME_R | 130 | gl_TIME_R |
@@ -282,6 +282,7 @@ AC_DEFUN([gltests_LIBSOURCES], [ | |||
282 | AC_DEFUN([gl_FILE_LIST], [ | 282 | AC_DEFUN([gl_FILE_LIST], [ |
283 | build-aux/config.rpath | 283 | build-aux/config.rpath |
284 | build-aux/link-warning.h | 284 | build-aux/link-warning.h |
285 | lib/alignof.h | ||
285 | lib/alloca.c | 286 | lib/alloca.c |
286 | lib/alloca.in.h | 287 | lib/alloca.in.h |
287 | lib/arpa_inet.in.h | 288 | lib/arpa_inet.in.h |
@@ -367,6 +368,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
367 | lib/stdio-write.c | 368 | lib/stdio-write.c |
368 | lib/stdio.in.h | 369 | lib/stdio.in.h |
369 | lib/stdlib.in.h | 370 | lib/stdlib.in.h |
371 | lib/strdup.c | ||
370 | lib/streq.h | 372 | lib/streq.h |
371 | lib/strerror.c | 373 | lib/strerror.c |
372 | lib/string.in.h | 374 | lib/string.in.h |
@@ -395,6 +397,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
395 | lib/xsize.h | 397 | lib/xsize.h |
396 | lib/xstrndup.c | 398 | lib/xstrndup.c |
397 | lib/xstrndup.h | 399 | lib/xstrndup.h |
400 | m4/00gnulib.m4 | ||
398 | m4/alloca.m4 | 401 | m4/alloca.m4 |
399 | m4/arpa_inet_h.m4 | 402 | m4/arpa_inet_h.m4 |
400 | m4/base64.m4 | 403 | m4/base64.m4 |
@@ -478,6 +481,7 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
478 | m4/stdint_h.m4 | 481 | m4/stdint_h.m4 |
479 | m4/stdio_h.m4 | 482 | m4/stdio_h.m4 |
480 | m4/stdlib_h.m4 | 483 | m4/stdlib_h.m4 |
484 | m4/strdup.m4 | ||
481 | m4/strerror.m4 | 485 | m4/strerror.m4 |
482 | m4/string_h.m4 | 486 | m4/string_h.m4 |
483 | m4/strndup.m4 | 487 | m4/strndup.m4 |
diff --git a/gl/m4/include_next.m4 b/gl/m4/include_next.m4 index 062753c..d6101fe 100644 --- a/gl/m4/include_next.m4 +++ b/gl/m4/include_next.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # include_next.m4 serial 10 | 1 | # include_next.m4 serial 12 |
2 | dnl Copyright (C) 2006-2008 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2006-2009 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -32,14 +32,15 @@ AC_DEFUN([gl_INCLUDE_NEXT], | |||
32 | [gl_cv_have_include_next], | 32 | [gl_cv_have_include_next], |
33 | [rm -rf conftestd1a conftestd1b conftestd2 | 33 | [rm -rf conftestd1a conftestd1b conftestd2 |
34 | mkdir conftestd1a conftestd1b conftestd2 | 34 | mkdir conftestd1a conftestd1b conftestd2 |
35 | dnl The include of <stdio.h> is because IBM C 9.0 on AIX 6.1 supports | 35 | dnl IBM C 9.0, 10.1 (original versions, prior to the 2009-01 updates) on |
36 | dnl include_next when used as first preprocessor directive in a file, | 36 | dnl AIX 6.1 support include_next when used as first preprocessor directive |
37 | dnl but not when preceded by another include directive. Additionally, | 37 | dnl in a file, but not when preceded by another include directive. Check |
38 | dnl with this same compiler, include_next is a no-op when used in a | 38 | dnl for this bug by including <stdio.h>. |
39 | dnl header file that was included by specifying its absolute file name. | 39 | dnl Additionally, with this same compiler, include_next is a no-op when |
40 | dnl Despite these two bugs, include_next is used in the compiler's | 40 | dnl used in a header file that was included by specifying its absolute |
41 | dnl <math.h>. By virtue of the second bug, we need to use include_next | 41 | dnl file name. Despite these two bugs, include_next is used in the |
42 | dnl as well in this case. | 42 | dnl compiler's <math.h>. By virtue of the second bug, we need to use |
43 | dnl include_next as well in this case. | ||
43 | cat <<EOF > conftestd1a/conftest.h | 44 | cat <<EOF > conftestd1a/conftest.h |
44 | #define DEFINED_IN_CONFTESTD1 | 45 | #define DEFINED_IN_CONFTESTD1 |
45 | #include_next <conftest.h> | 46 | #include_next <conftest.h> |
diff --git a/gl/m4/inet_ntop.m4 b/gl/m4/inet_ntop.m4 index 42bfc5e..2bbdca1 100644 --- a/gl/m4/inet_ntop.m4 +++ b/gl/m4/inet_ntop.m4 | |||
@@ -1,4 +1,4 @@ | |||
1 | # inet_ntop.m4 serial 8 | 1 | # inet_ntop.m4 serial 9 |
2 | dnl Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
@@ -11,7 +11,18 @@ AC_DEFUN([gl_INET_NTOP], | |||
11 | 11 | ||
12 | gl_REPLACE_ARPA_INET_H | 12 | gl_REPLACE_ARPA_INET_H |
13 | 13 | ||
14 | AC_REPLACE_FUNCS([inet_ntop]) | 14 | dnl The AC_SEARCH_LIBS call is a hack to persuade the Solaris 8 linker to |
15 | dnl find inet_ntop. | ||
16 | dnl | ||
17 | dnl It is the responsibility of gl_INET_NTOP's caller to arrange for | ||
18 | dnl -lnsl if it is needed. Normally -lnsl is not needed on Solaris 8, | ||
19 | dnl since inet_ntop is needed only by getaddrinfo, and getaddrinfo | ||
20 | dnl isn't built on Solaris 8. | ||
21 | gl_save_LIBS=$LIBS | ||
22 | AC_SEARCH_LIBS([inet_ntop], [nsl], [], | ||
23 | [AC_REPLACE_FUNCS([inet_ntop])]) | ||
24 | LIBS=$gl_save_LIBS | ||
25 | |||
15 | gl_PREREQ_INET_NTOP | 26 | gl_PREREQ_INET_NTOP |
16 | ]) | 27 | ]) |
17 | 28 | ||
diff --git a/gl/m4/lib-link.m4 b/gl/m4/lib-link.m4 index fcd3391..2144203 100644 --- a/gl/m4/lib-link.m4 +++ b/gl/m4/lib-link.m4 | |||
@@ -1,4 +1,4 @@ | |||
1 | # lib-link.m4 serial 18 (gettext-0.18) | 1 | # lib-link.m4 serial 19 (gettext-0.18) |
2 | dnl Copyright (C) 2001-2009 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2001-2009 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
@@ -43,12 +43,13 @@ AC_DEFUN([AC_LIB_LINKFLAGS], | |||
43 | popdef([Name]) | 43 | popdef([Name]) |
44 | ]) | 44 | ]) |
45 | 45 | ||
46 | dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) | 46 | dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message]) |
47 | dnl searches for libname and the libraries corresponding to explicit and | 47 | dnl searches for libname and the libraries corresponding to explicit and |
48 | dnl implicit dependencies, together with the specified include files and | 48 | dnl implicit dependencies, together with the specified include files and |
49 | dnl the ability to compile and link the specified testcode. If found, it | 49 | dnl the ability to compile and link the specified testcode. The missing-message |
50 | dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and | 50 | dnl defaults to 'no' and may contain additional hints for the user. |
51 | dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and | 51 | dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} |
52 | dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and | ||
52 | dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs | 53 | dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs |
53 | dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. | 54 | dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. |
54 | dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname | 55 | dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname |
@@ -74,12 +75,14 @@ AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], | |||
74 | AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ | 75 | AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ |
75 | ac_save_LIBS="$LIBS" | 76 | ac_save_LIBS="$LIBS" |
76 | LIBS="$LIBS $LIB[]NAME" | 77 | LIBS="$LIBS $LIB[]NAME" |
77 | AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) | 78 | AC_TRY_LINK([$3], [$4], |
79 | [ac_cv_lib[]Name=yes], | ||
80 | [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])']) | ||
78 | LIBS="$ac_save_LIBS" | 81 | LIBS="$ac_save_LIBS" |
79 | ]) | 82 | ]) |
80 | if test "$ac_cv_lib[]Name" = yes; then | 83 | if test "$ac_cv_lib[]Name" = yes; then |
81 | HAVE_LIB[]NAME=yes | 84 | HAVE_LIB[]NAME=yes |
82 | AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) | 85 | AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib[]$1 library.]) |
83 | AC_MSG_CHECKING([how to link with lib[]$1]) | 86 | AC_MSG_CHECKING([how to link with lib[]$1]) |
84 | AC_MSG_RESULT([$LIB[]NAME]) | 87 | AC_MSG_RESULT([$LIB[]NAME]) |
85 | else | 88 | else |
diff --git a/gl/m4/lib-prefix.m4 b/gl/m4/lib-prefix.m4 index 3bdc0fc..4b7ee33 100644 --- a/gl/m4/lib-prefix.m4 +++ b/gl/m4/lib-prefix.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # lib-prefix.m4 serial 6 (gettext-0.18) | 1 | # lib-prefix.m4 serial 7 (gettext-0.18) |
2 | dnl Copyright (C) 2001-2005, 2008 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2001-2005, 2008-2009 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -206,6 +206,9 @@ sixtyfour bits | |||
206 | if test -d "$searchdir"; then | 206 | if test -d "$searchdir"; then |
207 | case "$searchdir" in | 207 | case "$searchdir" in |
208 | */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; | 208 | */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; |
209 | */../ | */.. ) | ||
210 | # Better ignore directories of this form. They are misleading. | ||
211 | ;; | ||
209 | *) searchdir=`cd "$searchdir" && pwd` | 212 | *) searchdir=`cd "$searchdir" && pwd` |
210 | case "$searchdir" in | 213 | case "$searchdir" in |
211 | */lib64 ) acl_libdirstem=lib64 ;; | 214 | */lib64 ) acl_libdirstem=lib64 ;; |
diff --git a/gl/m4/locale-fr.m4 b/gl/m4/locale-fr.m4 index e471839..653a5bc 100644 --- a/gl/m4/locale-fr.m4 +++ b/gl/m4/locale-fr.m4 | |||
@@ -1,4 +1,4 @@ | |||
1 | # locale-fr.m4 serial 10 | 1 | # locale-fr.m4 serial 11 |
2 | dnl Copyright (C) 2003, 2005-2009 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2003, 2005-2009 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
@@ -12,25 +12,7 @@ AC_DEFUN([gt_LOCALE_FR], | |||
12 | AC_REQUIRE([AC_CANONICAL_HOST]) | 12 | AC_REQUIRE([AC_CANONICAL_HOST]) |
13 | AC_REQUIRE([AM_LANGINFO_CODESET]) | 13 | AC_REQUIRE([AM_LANGINFO_CODESET]) |
14 | AC_CACHE_CHECK([for a traditional french locale], [gt_cv_locale_fr], [ | 14 | AC_CACHE_CHECK([for a traditional french locale], [gt_cv_locale_fr], [ |
15 | macosx= | 15 | AC_LANG_CONFTEST([AC_LANG_SOURCE([ |
16 | changequote(,)dnl | ||
17 | case "$host_os" in | ||
18 | darwin[56]*) ;; | ||
19 | darwin*) macosx=yes;; | ||
20 | esac | ||
21 | changequote([,])dnl | ||
22 | if test -n "$macosx"; then | ||
23 | # On Darwin 7 (MacOS X), the libc supports some locales in non-UTF-8 | ||
24 | # encodings, but the kernel does not support them. The documentation | ||
25 | # says: | ||
26 | # "... all code that calls BSD system routines should ensure | ||
27 | # that the const *char parameters of these routines are in UTF-8 | ||
28 | # encoding. All BSD system functions expect their string | ||
29 | # parameters to be in UTF-8 encoding and nothing else." | ||
30 | # See the comments in config.charset. Therefore we bypass the test. | ||
31 | gt_cv_locale_fr=none | ||
32 | else | ||
33 | AC_LANG_CONFTEST([AC_LANG_SOURCE([ | ||
34 | changequote(,)dnl | 16 | changequote(,)dnl |
35 | #include <locale.h> | 17 | #include <locale.h> |
36 | #include <time.h> | 18 | #include <time.h> |
@@ -75,42 +57,41 @@ int main () { | |||
75 | return 0; | 57 | return 0; |
76 | } | 58 | } |
77 | changequote([,])dnl | 59 | changequote([,])dnl |
78 | ])]) | 60 | ])]) |
79 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then | 61 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then |
80 | # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because | 62 | # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because |
81 | # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the | 63 | # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the |
82 | # configure script would override the LC_ALL setting. Likewise for | 64 | # configure script would override the LC_ALL setting. Likewise for |
83 | # LC_CTYPE, which is also set at the beginning of the configure script. | 65 | # LC_CTYPE, which is also set at the beginning of the configure script. |
84 | # Test for the usual locale name. | 66 | # Test for the usual locale name. |
85 | if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | 67 | if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then |
86 | gt_cv_locale_fr=fr_FR | 68 | gt_cv_locale_fr=fr_FR |
69 | else | ||
70 | # Test for the locale name with explicit encoding suffix. | ||
71 | if (LC_ALL=fr_FR.ISO-8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | ||
72 | gt_cv_locale_fr=fr_FR.ISO-8859-1 | ||
87 | else | 73 | else |
88 | # Test for the locale name with explicit encoding suffix. | 74 | # Test for the AIX, OSF/1, FreeBSD, NetBSD, OpenBSD locale name. |
89 | if (LC_ALL=fr_FR.ISO-8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | 75 | if (LC_ALL=fr_FR.ISO8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then |
90 | gt_cv_locale_fr=fr_FR.ISO-8859-1 | 76 | gt_cv_locale_fr=fr_FR.ISO8859-1 |
91 | else | 77 | else |
92 | # Test for the AIX, OSF/1, FreeBSD, NetBSD, OpenBSD locale name. | 78 | # Test for the HP-UX locale name. |
93 | if (LC_ALL=fr_FR.ISO8859-1 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | 79 | if (LC_ALL=fr_FR.iso88591 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then |
94 | gt_cv_locale_fr=fr_FR.ISO8859-1 | 80 | gt_cv_locale_fr=fr_FR.iso88591 |
95 | else | 81 | else |
96 | # Test for the HP-UX locale name. | 82 | # Test for the Solaris 7 locale name. |
97 | if (LC_ALL=fr_FR.iso88591 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | 83 | if (LC_ALL=fr LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then |
98 | gt_cv_locale_fr=fr_FR.iso88591 | 84 | gt_cv_locale_fr=fr |
99 | else | 85 | else |
100 | # Test for the Solaris 7 locale name. | 86 | # None found. |
101 | if (LC_ALL=fr LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | 87 | gt_cv_locale_fr=none |
102 | gt_cv_locale_fr=fr | ||
103 | else | ||
104 | # None found. | ||
105 | gt_cv_locale_fr=none | ||
106 | fi | ||
107 | fi | 88 | fi |
108 | fi | 89 | fi |
109 | fi | 90 | fi |
110 | fi | 91 | fi |
111 | fi | 92 | fi |
112 | rm -fr conftest* | ||
113 | fi | 93 | fi |
94 | rm -fr conftest* | ||
114 | ]) | 95 | ]) |
115 | LOCALE_FR=$gt_cv_locale_fr | 96 | LOCALE_FR=$gt_cv_locale_fr |
116 | AC_SUBST([LOCALE_FR]) | 97 | AC_SUBST([LOCALE_FR]) |
diff --git a/gl/m4/locale-ja.m4 b/gl/m4/locale-ja.m4 index c80c5af..9360576 100644 --- a/gl/m4/locale-ja.m4 +++ b/gl/m4/locale-ja.m4 | |||
@@ -1,4 +1,4 @@ | |||
1 | # locale-ja.m4 serial 6 | 1 | # locale-ja.m4 serial 7 |
2 | dnl Copyright (C) 2003, 2005-2009 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2003, 2005-2009 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
@@ -12,25 +12,7 @@ AC_DEFUN([gt_LOCALE_JA], | |||
12 | AC_REQUIRE([AC_CANONICAL_HOST]) | 12 | AC_REQUIRE([AC_CANONICAL_HOST]) |
13 | AC_REQUIRE([AM_LANGINFO_CODESET]) | 13 | AC_REQUIRE([AM_LANGINFO_CODESET]) |
14 | AC_CACHE_CHECK([for a traditional japanese locale], [gt_cv_locale_ja], [ | 14 | AC_CACHE_CHECK([for a traditional japanese locale], [gt_cv_locale_ja], [ |
15 | macosx= | 15 | AC_LANG_CONFTEST([AC_LANG_SOURCE([ |
16 | changequote(,)dnl | ||
17 | case "$host_os" in | ||
18 | darwin[56]*) ;; | ||
19 | darwin*) macosx=yes;; | ||
20 | esac | ||
21 | changequote([,])dnl | ||
22 | if test -n "$macosx"; then | ||
23 | # On Darwin 7 (MacOS X), the libc supports some locales in non-UTF-8 | ||
24 | # encodings, but the kernel does not support them. The documentation | ||
25 | # says: | ||
26 | # "... all code that calls BSD system routines should ensure | ||
27 | # that the const *char parameters of these routines are in UTF-8 | ||
28 | # encoding. All BSD system functions expect their string | ||
29 | # parameters to be in UTF-8 encoding and nothing else." | ||
30 | # See the comments in config.charset. Therefore we bypass the test. | ||
31 | gt_cv_locale_ja=none | ||
32 | else | ||
33 | AC_LANG_CONFTEST([AC_LANG_SOURCE([ | ||
34 | changequote(,)dnl | 16 | changequote(,)dnl |
35 | #include <locale.h> | 17 | #include <locale.h> |
36 | #include <time.h> | 18 | #include <time.h> |
@@ -79,47 +61,46 @@ int main () | |||
79 | return 0; | 61 | return 0; |
80 | } | 62 | } |
81 | changequote([,])dnl | 63 | changequote([,])dnl |
82 | ])]) | 64 | ])]) |
83 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then | 65 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then |
84 | # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because | 66 | # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because |
85 | # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the | 67 | # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the |
86 | # configure script would override the LC_ALL setting. Likewise for | 68 | # configure script would override the LC_ALL setting. Likewise for |
87 | # LC_CTYPE, which is also set at the beginning of the configure script. | 69 | # LC_CTYPE, which is also set at the beginning of the configure script. |
88 | # Test for the AIX locale name. | 70 | # Test for the AIX locale name. |
89 | if (LC_ALL=ja_JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | 71 | if (LC_ALL=ja_JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then |
90 | gt_cv_locale_ja=ja_JP | 72 | gt_cv_locale_ja=ja_JP |
73 | else | ||
74 | # Test for the locale name with explicit encoding suffix. | ||
75 | if (LC_ALL=ja_JP.EUC-JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | ||
76 | gt_cv_locale_ja=ja_JP.EUC-JP | ||
91 | else | 77 | else |
92 | # Test for the locale name with explicit encoding suffix. | 78 | # Test for the HP-UX, OSF/1, NetBSD locale name. |
93 | if (LC_ALL=ja_JP.EUC-JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | 79 | if (LC_ALL=ja_JP.eucJP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then |
94 | gt_cv_locale_ja=ja_JP.EUC-JP | 80 | gt_cv_locale_ja=ja_JP.eucJP |
95 | else | 81 | else |
96 | # Test for the HP-UX, OSF/1, NetBSD locale name. | 82 | # Test for the IRIX, FreeBSD locale name. |
97 | if (LC_ALL=ja_JP.eucJP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | 83 | if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then |
98 | gt_cv_locale_ja=ja_JP.eucJP | 84 | gt_cv_locale_ja=ja_JP.EUC |
99 | else | 85 | else |
100 | # Test for the IRIX, FreeBSD locale name. | 86 | # Test for the Solaris 7 locale name. |
101 | if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | 87 | if (LC_ALL=ja LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then |
102 | gt_cv_locale_ja=ja_JP.EUC | 88 | gt_cv_locale_ja=ja |
103 | else | 89 | else |
104 | # Test for the Solaris 7 locale name. | 90 | # Special test for NetBSD 1.6. |
105 | if (LC_ALL=ja LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | 91 | if test -f /usr/share/locale/ja_JP.eucJP/LC_CTYPE; then |
106 | gt_cv_locale_ja=ja | 92 | gt_cv_locale_ja=ja_JP.eucJP |
107 | else | 93 | else |
108 | # Special test for NetBSD 1.6. | 94 | # None found. |
109 | if test -f /usr/share/locale/ja_JP.eucJP/LC_CTYPE; then | 95 | gt_cv_locale_ja=none |
110 | gt_cv_locale_ja=ja_JP.eucJP | ||
111 | else | ||
112 | # None found. | ||
113 | gt_cv_locale_ja=none | ||
114 | fi | ||
115 | fi | 96 | fi |
116 | fi | 97 | fi |
117 | fi | 98 | fi |
118 | fi | 99 | fi |
119 | fi | 100 | fi |
120 | fi | 101 | fi |
121 | rm -fr conftest* | ||
122 | fi | 102 | fi |
103 | rm -fr conftest* | ||
123 | ]) | 104 | ]) |
124 | LOCALE_JA=$gt_cv_locale_ja | 105 | LOCALE_JA=$gt_cv_locale_ja |
125 | AC_SUBST([LOCALE_JA]) | 106 | AC_SUBST([LOCALE_JA]) |
diff --git a/gl/m4/locale-zh.m4 b/gl/m4/locale-zh.m4 index ba7f9c5..36a5f1d 100644 --- a/gl/m4/locale-zh.m4 +++ b/gl/m4/locale-zh.m4 | |||
@@ -1,4 +1,4 @@ | |||
1 | # locale-zh.m4 serial 5 | 1 | # locale-zh.m4 serial 6 |
2 | dnl Copyright (C) 2003, 2005-2009 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2003, 2005-2009 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
@@ -12,25 +12,7 @@ AC_DEFUN([gt_LOCALE_ZH_CN], | |||
12 | AC_REQUIRE([AC_CANONICAL_HOST]) | 12 | AC_REQUIRE([AC_CANONICAL_HOST]) |
13 | AC_REQUIRE([AM_LANGINFO_CODESET]) | 13 | AC_REQUIRE([AM_LANGINFO_CODESET]) |
14 | AC_CACHE_CHECK([for a transitional chinese locale], [gt_cv_locale_zh_CN], [ | 14 | AC_CACHE_CHECK([for a transitional chinese locale], [gt_cv_locale_zh_CN], [ |
15 | macosx= | 15 | AC_LANG_CONFTEST([AC_LANG_SOURCE([ |
16 | changequote(,)dnl | ||
17 | case "$host_os" in | ||
18 | darwin[56]*) ;; | ||
19 | darwin*) macosx=yes;; | ||
20 | esac | ||
21 | changequote([,])dnl | ||
22 | if test -n "$macosx"; then | ||
23 | # On Darwin 7 (MacOS X), the libc supports some locales in non-UTF-8 | ||
24 | # encodings, but the kernel does not support them. The documentation | ||
25 | # says: | ||
26 | # "... all code that calls BSD system routines should ensure | ||
27 | # that the const *char parameters of these routines are in UTF-8 | ||
28 | # encoding. All BSD system functions expect their string | ||
29 | # parameters to be in UTF-8 encoding and nothing else." | ||
30 | # See the comments in config.charset. Therefore we bypass the test. | ||
31 | gt_cv_locale_zh_CN=none | ||
32 | else | ||
33 | AC_LANG_CONFTEST([AC_LANG_SOURCE([ | ||
34 | changequote(,)dnl | 16 | changequote(,)dnl |
35 | #include <locale.h> | 17 | #include <locale.h> |
36 | #include <stdlib.h> | 18 | #include <stdlib.h> |
@@ -80,31 +62,30 @@ int main () | |||
80 | return 0; | 62 | return 0; |
81 | } | 63 | } |
82 | changequote([,])dnl | 64 | changequote([,])dnl |
83 | ])]) | 65 | ])]) |
84 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then | 66 | if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then |
85 | # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because | 67 | # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because |
86 | # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the | 68 | # otherwise on MacOS X 10.3.5 the LC_TIME=C from the beginning of the |
87 | # configure script would override the LC_ALL setting. Likewise for | 69 | # configure script would override the LC_ALL setting. Likewise for |
88 | # LC_CTYPE, which is also set at the beginning of the configure script. | 70 | # LC_CTYPE, which is also set at the beginning of the configure script. |
89 | # Test for the locale name without encoding suffix. | 71 | # Test for the locale name without encoding suffix. |
90 | if (LC_ALL=zh_CN LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | 72 | if (LC_ALL=zh_CN LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then |
91 | gt_cv_locale_zh_CN=zh_CN | 73 | gt_cv_locale_zh_CN=zh_CN |
74 | else | ||
75 | # Test for the locale name with explicit encoding suffix. | ||
76 | if (LC_ALL=zh_CN.GB18030 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | ||
77 | gt_cv_locale_zh_CN=zh_CN.GB18030 | ||
92 | else | 78 | else |
93 | # Test for the locale name with explicit encoding suffix. | 79 | # None found. |
94 | if (LC_ALL=zh_CN.GB18030 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then | 80 | gt_cv_locale_zh_CN=none |
95 | gt_cv_locale_zh_CN=zh_CN.GB18030 | ||
96 | else | ||
97 | # None found. | ||
98 | gt_cv_locale_zh_CN=none | ||
99 | fi | ||
100 | fi | 81 | fi |
101 | else | ||
102 | # If there was a link error, due to mblen(), the system is so old that | ||
103 | # it certainly doesn't have a chinese locale. | ||
104 | gt_cv_locale_zh_CN=none | ||
105 | fi | 82 | fi |
106 | rm -fr conftest* | 83 | else |
84 | # If there was a link error, due to mblen(), the system is so old that | ||
85 | # it certainly doesn't have a chinese locale. | ||
86 | gt_cv_locale_zh_CN=none | ||
107 | fi | 87 | fi |
88 | rm -fr conftest* | ||
108 | ]) | 89 | ]) |
109 | LOCALE_ZH_CN=$gt_cv_locale_zh_CN | 90 | LOCALE_ZH_CN=$gt_cv_locale_zh_CN |
110 | AC_SUBST([LOCALE_ZH_CN]) | 91 | AC_SUBST([LOCALE_ZH_CN]) |
diff --git a/gl/m4/mbrtowc.m4 b/gl/m4/mbrtowc.m4 index 726497b..11d7d23 100644 --- a/gl/m4/mbrtowc.m4 +++ b/gl/m4/mbrtowc.m4 | |||
@@ -1,4 +1,4 @@ | |||
1 | # mbrtowc.m4 serial 13 | 1 | # mbrtowc.m4 serial 15 |
2 | dnl Copyright (C) 2001-2002, 2004-2005, 2008, 2009 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2001-2002, 2004-2005, 2008, 2009 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
@@ -65,9 +65,15 @@ AC_DEFUN([gl_MBSTATE_T_BROKEN], | |||
65 | AC_CHECK_FUNCS_ONCE([mbrtowc]) | 65 | AC_CHECK_FUNCS_ONCE([mbrtowc]) |
66 | if test $ac_cv_func_mbsinit = yes && test $ac_cv_func_mbrtowc = yes; then | 66 | if test $ac_cv_func_mbsinit = yes && test $ac_cv_func_mbrtowc = yes; then |
67 | gl_MBRTOWC_INCOMPLETE_STATE | 67 | gl_MBRTOWC_INCOMPLETE_STATE |
68 | gl_MBRTOWC_SANITYCHECK | ||
69 | REPLACE_MBSTATE_T=0 | ||
68 | case "$gl_cv_func_mbrtowc_incomplete_state" in | 70 | case "$gl_cv_func_mbrtowc_incomplete_state" in |
69 | *yes) REPLACE_MBSTATE_T=0 ;; | 71 | *yes) ;; |
70 | *) REPLACE_MBSTATE_T=1 ;; | 72 | *) REPLACE_MBSTATE_T=1 ;; |
73 | esac | ||
74 | case "$gl_cv_func_mbrtowc_sanitycheck" in | ||
75 | *yes) ;; | ||
76 | *) REPLACE_MBSTATE_T=1 ;; | ||
71 | esac | 77 | esac |
72 | else | 78 | else |
73 | REPLACE_MBSTATE_T=1 | 79 | REPLACE_MBSTATE_T=1 |
@@ -121,7 +127,58 @@ int main () | |||
121 | }], | 127 | }], |
122 | [gl_cv_func_mbrtowc_incomplete_state=yes], | 128 | [gl_cv_func_mbrtowc_incomplete_state=yes], |
123 | [gl_cv_func_mbrtowc_incomplete_state=no], | 129 | [gl_cv_func_mbrtowc_incomplete_state=no], |
124 | []) | 130 | [:]) |
131 | fi | ||
132 | ]) | ||
133 | ]) | ||
134 | |||
135 | dnl Test whether mbrtowc works not worse than mbtowc. | ||
136 | dnl Result is gl_cv_func_mbrtowc_sanitycheck. | ||
137 | |||
138 | AC_DEFUN([gl_MBRTOWC_SANITYCHECK], | ||
139 | [ | ||
140 | AC_REQUIRE([AC_PROG_CC]) | ||
141 | AC_REQUIRE([gt_LOCALE_ZH_CN]) | ||
142 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
143 | AC_CACHE_CHECK([whether mbrtowc works as well as mbtowc], | ||
144 | [gl_cv_func_mbrtowc_sanitycheck], | ||
145 | [ | ||
146 | dnl Initial guess, used when cross-compiling or when no suitable locale | ||
147 | dnl is present. | ||
148 | changequote(,)dnl | ||
149 | case "$host_os" in | ||
150 | # Guess no on Solaris 8. | ||
151 | solaris2.8) gl_cv_func_mbrtowc_sanitycheck="guessing no" ;; | ||
152 | # Guess yes otherwise. | ||
153 | *) gl_cv_func_mbrtowc_sanitycheck="guessing yes" ;; | ||
154 | esac | ||
155 | changequote([,])dnl | ||
156 | if test $LOCALE_ZH_CN != none; then | ||
157 | AC_TRY_RUN([ | ||
158 | #include <locale.h> | ||
159 | #include <string.h> | ||
160 | #include <wchar.h> | ||
161 | int main () | ||
162 | { | ||
163 | /* This fails on Solaris 8: | ||
164 | mbrtowc returns 2, and sets wc to 0x00F0. | ||
165 | mbtowc returns 4 (correct) and sets wc to 0x5EDC. */ | ||
166 | if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) | ||
167 | { | ||
168 | char input[] = "B\250\271\201\060\211\070er"; /* "Büßer" */ | ||
169 | mbstate_t state; | ||
170 | wchar_t wc; | ||
171 | |||
172 | memset (&state, '\0', sizeof (mbstate_t)); | ||
173 | if (mbrtowc (&wc, input + 3, 6, &state) != 4 | ||
174 | && mbtowc (&wc, input + 3, 6) == 4) | ||
175 | return 1; | ||
176 | } | ||
177 | return 0; | ||
178 | }], | ||
179 | [gl_cv_func_mbrtowc_sanitycheck=yes], | ||
180 | [gl_cv_func_mbrtowc_sanitycheck=no], | ||
181 | [:]) | ||
125 | fi | 182 | fi |
126 | ]) | 183 | ]) |
127 | ]) | 184 | ]) |
@@ -168,7 +225,7 @@ int main () | |||
168 | return 1; | 225 | return 1; |
169 | } | 226 | } |
170 | return 0; | 227 | return 0; |
171 | }], [gl_cv_func_mbrtowc_null_arg=yes], [gl_cv_func_mbrtowc_null_arg=no], []) | 228 | }], [gl_cv_func_mbrtowc_null_arg=yes], [gl_cv_func_mbrtowc_null_arg=no], [:]) |
172 | fi | 229 | fi |
173 | ]) | 230 | ]) |
174 | ]) | 231 | ]) |
@@ -238,7 +295,7 @@ int main () | |||
238 | }], | 295 | }], |
239 | [gl_cv_func_mbrtowc_retval=yes], | 296 | [gl_cv_func_mbrtowc_retval=yes], |
240 | [gl_cv_func_mbrtowc_retval=no], | 297 | [gl_cv_func_mbrtowc_retval=no], |
241 | []) | 298 | [:]) |
242 | fi | 299 | fi |
243 | ]) | 300 | ]) |
244 | ]) | 301 | ]) |
@@ -258,10 +315,10 @@ AC_DEFUN([gl_MBRTOWC_NUL_RETVAL], | |||
258 | dnl is present. | 315 | dnl is present. |
259 | changequote(,)dnl | 316 | changequote(,)dnl |
260 | case "$host_os" in | 317 | case "$host_os" in |
261 | # Guess no on Solaris 9. | 318 | # Guess no on Solaris 8 and 9. |
262 | solaris2.9) gl_cv_func_mbrtowc_nul_retval="guessing no" ;; | 319 | solaris2.[89]) gl_cv_func_mbrtowc_nul_retval="guessing no" ;; |
263 | # Guess yes otherwise. | 320 | # Guess yes otherwise. |
264 | *) gl_cv_func_mbrtowc_nul_retval="guessing yes" ;; | 321 | *) gl_cv_func_mbrtowc_nul_retval="guessing yes" ;; |
265 | esac | 322 | esac |
266 | changequote([,])dnl | 323 | changequote([,])dnl |
267 | if test $LOCALE_ZH_CN != none; then | 324 | if test $LOCALE_ZH_CN != none; then |
@@ -271,7 +328,7 @@ changequote([,])dnl | |||
271 | #include <wchar.h> | 328 | #include <wchar.h> |
272 | int main () | 329 | int main () |
273 | { | 330 | { |
274 | /* This fails on Solaris 9. */ | 331 | /* This fails on Solaris 8 and 9. */ |
275 | if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) | 332 | if (setlocale (LC_ALL, "$LOCALE_ZH_CN") != NULL) |
276 | { | 333 | { |
277 | mbstate_t state; | 334 | mbstate_t state; |
@@ -285,7 +342,7 @@ int main () | |||
285 | }], | 342 | }], |
286 | [gl_cv_func_mbrtowc_nul_retval=yes], | 343 | [gl_cv_func_mbrtowc_nul_retval=yes], |
287 | [gl_cv_func_mbrtowc_nul_retval=no], | 344 | [gl_cv_func_mbrtowc_nul_retval=no], |
288 | []) | 345 | [:]) |
289 | fi | 346 | fi |
290 | ]) | 347 | ]) |
291 | ]) | 348 | ]) |
diff --git a/gl/m4/mktime.m4 b/gl/m4/mktime.m4 index 223b9f1..1e926e8 100644 --- a/gl/m4/mktime.m4 +++ b/gl/m4/mktime.m4 | |||
@@ -1,4 +1,4 @@ | |||
1 | # serial 14 | 1 | # serial 15 |
2 | dnl Copyright (C) 2002-2003, 2005-2007, 2009 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002-2003, 2005-2007, 2009 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
@@ -15,6 +15,13 @@ dnl From Jim Meyering. | |||
15 | AC_DEFUN([AC_FUNC_MKTIME], | 15 | AC_DEFUN([AC_FUNC_MKTIME], |
16 | [AC_CHECK_HEADERS_ONCE([unistd.h]) | 16 | [AC_CHECK_HEADERS_ONCE([unistd.h]) |
17 | AC_CHECK_FUNCS_ONCE([alarm]) | 17 | AC_CHECK_FUNCS_ONCE([alarm]) |
18 | AC_REQUIRE([gl_MULTIARCH]) | ||
19 | if test $APPLE_UNIVERSAL_BUILD = 1; then | ||
20 | # A universal build on Apple MacOS X platforms. | ||
21 | # The test result would be 'yes' in 32-bit mode and 'no' in 64-bit mode. | ||
22 | # But we need a configuration result that is valid in both modes. | ||
23 | ac_cv_func_working_mktime=no | ||
24 | fi | ||
18 | AC_CACHE_CHECK([for working mktime], [ac_cv_func_working_mktime], | 25 | AC_CACHE_CHECK([for working mktime], [ac_cv_func_working_mktime], |
19 | [AC_RUN_IFELSE([AC_LANG_SOURCE( | 26 | [AC_RUN_IFELSE([AC_LANG_SOURCE( |
20 | [[/* Test program from Paul Eggert and Tony Leneis. */ | 27 | [[/* Test program from Paul Eggert and Tony Leneis. */ |
diff --git a/gl/m4/multiarch.m4 b/gl/m4/multiarch.m4 index 7b73e15..ec377ba 100644 --- a/gl/m4/multiarch.m4 +++ b/gl/m4/multiarch.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # multiarch.m4 serial 3 | 1 | # multiarch.m4 serial 5 |
2 | dnl Copyright (C) 2008 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2008, 2009 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -19,16 +19,7 @@ dnl with or without modifications, as long as this notice is preserved. | |||
19 | # Detect this situation and set the macro AA_APPLE_UNIVERSAL_BUILD at the | 19 | # Detect this situation and set the macro AA_APPLE_UNIVERSAL_BUILD at the |
20 | # beginning of config.h and set APPLE_UNIVERSAL_BUILD accordingly. | 20 | # beginning of config.h and set APPLE_UNIVERSAL_BUILD accordingly. |
21 | 21 | ||
22 | AC_DEFUN([gl_MULTIARCH], | 22 | AC_DEFUN_ONCE([gl_MULTIARCH], |
23 | [ | ||
24 | dnl This AC_REQUIRE is not necessary in theory. It works around a bug in | ||
25 | dnl autoconf <= 2.63: AC_REQUIRE invocations inside AC_REQUIREd macros are | ||
26 | dnl being handled better than AC_REQUIRE invocations inside normally invoked | ||
27 | dnl macros. | ||
28 | AC_REQUIRE([gl_MULTIARCH_BODY]) | ||
29 | ]) | ||
30 | |||
31 | AC_DEFUN([gl_MULTIARCH_BODY], | ||
32 | [ | 23 | [ |
33 | dnl Code similar to autoconf-2.63 AC_C_BIGENDIAN. | 24 | dnl Code similar to autoconf-2.63 AC_C_BIGENDIAN. |
34 | gl_cv_c_multiarch=no | 25 | gl_cv_c_multiarch=no |
diff --git a/gl/m4/printf.m4 b/gl/m4/printf.m4 index 4d10993..87aa45c 100644 --- a/gl/m4/printf.m4 +++ b/gl/m4/printf.m4 | |||
@@ -1,4 +1,4 @@ | |||
1 | # printf.m4 serial 26 | 1 | # printf.m4 serial 33 |
2 | dnl Copyright (C) 2003, 2007-2009 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2003, 2007-2009 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
@@ -125,7 +125,8 @@ changequote([,])dnl | |||
125 | ]) | 125 | ]) |
126 | 126 | ||
127 | dnl Test whether the *printf family of functions supports infinite and NaN | 127 | dnl Test whether the *printf family of functions supports infinite and NaN |
128 | dnl 'double' arguments in the %f, %e, %g directives. (ISO C99, POSIX:2001) | 128 | dnl 'double' arguments and negative zero arguments in the %f, %e, %g |
129 | dnl directives. (ISO C99, POSIX:2001) | ||
129 | dnl Result is gl_cv_func_printf_infinite. | 130 | dnl Result is gl_cv_func_printf_infinite. |
130 | 131 | ||
131 | AC_DEFUN([gl_PRINTF_INFINITE], | 132 | AC_DEFUN([gl_PRINTF_INFINITE], |
@@ -156,6 +157,13 @@ strisnan (const char *string, size_t start_index, size_t end_index) | |||
156 | } | 157 | } |
157 | return 0; | 158 | return 0; |
158 | } | 159 | } |
160 | static int | ||
161 | have_minus_zero () | ||
162 | { | ||
163 | static double plus_zero = 0.0; | ||
164 | double minus_zero = - plus_zero; | ||
165 | return memcmp (&plus_zero, &minus_zero, sizeof (double)) != 0; | ||
166 | } | ||
159 | static char buf[10000]; | 167 | static char buf[10000]; |
160 | static double zero = 0.0; | 168 | static double zero = 0.0; |
161 | int main () | 169 | int main () |
@@ -187,6 +195,11 @@ int main () | |||
187 | if (sprintf (buf, "%g", zero / zero) < 0 | 195 | if (sprintf (buf, "%g", zero / zero) < 0 |
188 | || !strisnan (buf, 0, strlen (buf))) | 196 | || !strisnan (buf, 0, strlen (buf))) |
189 | return 1; | 197 | return 1; |
198 | /* This test fails on HP-UX 10.20. */ | ||
199 | if (have_minus_zero ()) | ||
200 | if (sprintf (buf, "%g", - zero) < 0 | ||
201 | || strcmp (buf, "-0") != 0) | ||
202 | return 1; | ||
190 | return 0; | 203 | return 0; |
191 | }], [gl_cv_func_printf_infinite=yes], [gl_cv_func_printf_infinite=no], | 204 | }], [gl_cv_func_printf_infinite=yes], [gl_cv_func_printf_infinite=no], |
192 | [ | 205 | [ |
@@ -225,7 +238,7 @@ AC_DEFUN([gl_PRINTF_INFINITE_LONG_DOUBLE], | |||
225 | [ | 238 | [ |
226 | AC_REQUIRE([gl_PRINTF_LONG_DOUBLE]) | 239 | AC_REQUIRE([gl_PRINTF_LONG_DOUBLE]) |
227 | AC_REQUIRE([AC_PROG_CC]) | 240 | AC_REQUIRE([AC_PROG_CC]) |
228 | AC_REQUIRE([AC_C_BIGENDIAN]) | 241 | AC_REQUIRE([gl_BIGENDIAN]) |
229 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | 242 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
230 | dnl The user can set or unset the variable gl_printf_safe to indicate | 243 | dnl The user can set or unset the variable gl_printf_safe to indicate |
231 | dnl that he wishes a safe handling of non-IEEE-754 'long double' values. | 244 | dnl that he wishes a safe handling of non-IEEE-754 'long double' values. |
@@ -545,7 +558,7 @@ int main () | |||
545 | if (sprintf (buf, "%F", 1.0 / 0.0) < 0 | 558 | if (sprintf (buf, "%F", 1.0 / 0.0) < 0 |
546 | || (strcmp (buf, "INF") != 0 && strcmp (buf, "INFINITY") != 0)) | 559 | || (strcmp (buf, "INF") != 0 && strcmp (buf, "INFINITY") != 0)) |
547 | return 1; | 560 | return 1; |
548 | /* This catches a Cygwin 2007 bug. */ | 561 | /* This catches a Cygwin 1.5.x bug. */ |
549 | if (sprintf (buf, "%.F", 1234.0) < 0 | 562 | if (sprintf (buf, "%.F", 1234.0) < 0 |
550 | || strcmp (buf, "1234") != 0) | 563 | || strcmp (buf, "1234") != 0) |
551 | return 1; | 564 | return 1; |
@@ -612,6 +625,84 @@ changequote([,])dnl | |||
612 | ]) | 625 | ]) |
613 | ]) | 626 | ]) |
614 | 627 | ||
628 | dnl Test whether the *printf family of functions supports the %ls format | ||
629 | dnl directive and in particular, when a precision is specified, whether | ||
630 | dnl the functions stop converting the wide string argument when the number | ||
631 | dnl of bytes that have been produced by this conversion equals or exceeds | ||
632 | dnl the precision. | ||
633 | dnl Result is gl_cv_func_printf_directive_ls. | ||
634 | |||
635 | AC_DEFUN([gl_PRINTF_DIRECTIVE_LS], | ||
636 | [ | ||
637 | AC_REQUIRE([AC_PROG_CC]) | ||
638 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles | ||
639 | AC_CACHE_CHECK([whether printf supports the 'ls' directive], | ||
640 | [gl_cv_func_printf_directive_ls], | ||
641 | [ | ||
642 | AC_TRY_RUN([ | ||
643 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | ||
644 | <wchar.h>. | ||
645 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be | ||
646 | included before <wchar.h>. */ | ||
647 | #include <stddef.h> | ||
648 | #include <stdio.h> | ||
649 | #include <time.h> | ||
650 | #include <wchar.h> | ||
651 | #include <string.h> | ||
652 | int main () | ||
653 | { | ||
654 | char buf[100]; | ||
655 | /* Test whether %ls works at all. | ||
656 | This test fails on OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, but not on | ||
657 | Cygwin 1.5. */ | ||
658 | { | ||
659 | static const wchar_t wstring[] = { 'a', 'b', 'c', 0 }; | ||
660 | buf[0] = '\0'; | ||
661 | if (sprintf (buf, "%ls", wstring) < 0 | ||
662 | || strcmp (buf, "abc") != 0) | ||
663 | return 1; | ||
664 | } | ||
665 | /* This test fails on IRIX 6.5, Solaris 2.6, Cygwin 1.5, Haiku (with an | ||
666 | assertion failure inside libc), but not on OpenBSD 4.0. */ | ||
667 | { | ||
668 | static const wchar_t wstring[] = { 'a', 0 }; | ||
669 | buf[0] = '\0'; | ||
670 | if (sprintf (buf, "%ls", wstring) < 0 | ||
671 | || strcmp (buf, "a") != 0) | ||
672 | return 1; | ||
673 | } | ||
674 | /* Test whether precisions in %ls are supported as specified in ISO C 99 | ||
675 | section 7.19.6.1: | ||
676 | "If a precision is specified, no more than that many bytes are written | ||
677 | (including shift sequences, if any), and the array shall contain a | ||
678 | null wide character if, to equal the multibyte character sequence | ||
679 | length given by the precision, the function would need to access a | ||
680 | wide character one past the end of the array." | ||
681 | This test fails on Solaris 10. */ | ||
682 | { | ||
683 | static const wchar_t wstring[] = { 'a', 'b', (wchar_t) 0xfdfdfdfd, 0 }; | ||
684 | buf[0] = '\0'; | ||
685 | if (sprintf (buf, "%.2ls", wstring) < 0 | ||
686 | || strcmp (buf, "ab") != 0) | ||
687 | return 1; | ||
688 | } | ||
689 | return 0; | ||
690 | }], [gl_cv_func_printf_directive_ls=yes], [gl_cv_func_printf_directive_ls=no], | ||
691 | [ | ||
692 | changequote(,)dnl | ||
693 | case "$host_os" in | ||
694 | openbsd*) gl_cv_func_printf_directive_ls="guessing no";; | ||
695 | irix*) gl_cv_func_printf_directive_ls="guessing no";; | ||
696 | solaris*) gl_cv_func_printf_directive_ls="guessing no";; | ||
697 | cygwin*) gl_cv_func_printf_directive_ls="guessing no";; | ||
698 | beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";; | ||
699 | *) gl_cv_func_printf_directive_ls="guessing yes";; | ||
700 | esac | ||
701 | changequote([,])dnl | ||
702 | ]) | ||
703 | ]) | ||
704 | ]) | ||
705 | |||
615 | dnl Test whether the *printf family of functions supports POSIX/XSI format | 706 | dnl Test whether the *printf family of functions supports POSIX/XSI format |
616 | dnl strings with positions. (POSIX:2001) | 707 | dnl strings with positions. (POSIX:2001) |
617 | dnl Result is gl_cv_func_printf_positions. | 708 | dnl Result is gl_cv_func_printf_positions. |
@@ -1142,7 +1233,7 @@ AC_DEFUN([gl_SNPRINTF_SIZE1], | |||
1142 | #include <stdio.h> | 1233 | #include <stdio.h> |
1143 | int main() | 1234 | int main() |
1144 | { | 1235 | { |
1145 | static char buf[8] = "DEADBEEF"; | 1236 | static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; |
1146 | snprintf (buf, 1, "%d", 12345); | 1237 | snprintf (buf, 1, "%d", 12345); |
1147 | return buf[1] != 'E'; | 1238 | return buf[1] != 'E'; |
1148 | }], | 1239 | }], |
@@ -1160,7 +1251,7 @@ dnl --------------------------------------------------------------------- | |||
1160 | dnl #include <stdio.h> | 1251 | dnl #include <stdio.h> |
1161 | dnl int main() | 1252 | dnl int main() |
1162 | dnl { | 1253 | dnl { |
1163 | dnl static char buf[8] = "DEADBEEF"; | 1254 | dnl static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; |
1164 | dnl snprintf (buf, 0, "%d", 12345); | 1255 | dnl snprintf (buf, 0, "%d", 12345); |
1165 | dnl return buf[0] != 'D'; | 1256 | dnl return buf[0] != 'D'; |
1166 | dnl } | 1257 | dnl } |
@@ -1181,7 +1272,7 @@ dnl return ret; | |||
1181 | dnl } | 1272 | dnl } |
1182 | dnl int main() | 1273 | dnl int main() |
1183 | dnl { | 1274 | dnl { |
1184 | dnl static char buf[8] = "DEADBEEF"; | 1275 | dnl static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; |
1185 | dnl my_snprintf (buf, 0, "%d", 12345); | 1276 | dnl my_snprintf (buf, 0, "%d", 12345); |
1186 | dnl return buf[0] != 'D'; | 1277 | dnl return buf[0] != 'D'; |
1187 | dnl } | 1278 | dnl } |
@@ -1209,7 +1300,7 @@ static int my_snprintf (char *buf, int size, const char *format, ...) | |||
1209 | } | 1300 | } |
1210 | int main() | 1301 | int main() |
1211 | { | 1302 | { |
1212 | static char buf[8] = "DEADBEEF"; | 1303 | static char buf[8] = { 'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F' }; |
1213 | my_snprintf (buf, 0, "%d", 12345); | 1304 | my_snprintf (buf, 0, "%d", 12345); |
1214 | return buf[0] != 'D'; | 1305 | return buf[0] != 'D'; |
1215 | }], | 1306 | }], |
@@ -1261,18 +1352,19 @@ dnl 4 = gl_PRINTF_INFINITE_LONG_DOUBLE | |||
1261 | dnl 5 = gl_PRINTF_DIRECTIVE_A | 1352 | dnl 5 = gl_PRINTF_DIRECTIVE_A |
1262 | dnl 6 = gl_PRINTF_DIRECTIVE_F | 1353 | dnl 6 = gl_PRINTF_DIRECTIVE_F |
1263 | dnl 7 = gl_PRINTF_DIRECTIVE_N | 1354 | dnl 7 = gl_PRINTF_DIRECTIVE_N |
1264 | dnl 8 = gl_PRINTF_POSITIONS | 1355 | dnl 8 = gl_PRINTF_DIRECTIVE_LS |
1265 | dnl 9 = gl_PRINTF_FLAG_GROUPING | 1356 | dnl 9 = gl_PRINTF_POSITIONS |
1266 | dnl 10 = gl_PRINTF_FLAG_LEFTADJUST | 1357 | dnl 10 = gl_PRINTF_FLAG_GROUPING |
1267 | dnl 11 = gl_PRINTF_FLAG_ZERO | 1358 | dnl 11 = gl_PRINTF_FLAG_LEFTADJUST |
1268 | dnl 12 = gl_PRINTF_PRECISION | 1359 | dnl 12 = gl_PRINTF_FLAG_ZERO |
1269 | dnl 13 = gl_PRINTF_ENOMEM | 1360 | dnl 13 = gl_PRINTF_PRECISION |
1270 | dnl 14 = gl_SNPRINTF_PRESENCE | 1361 | dnl 14 = gl_PRINTF_ENOMEM |
1271 | dnl 15 = gl_SNPRINTF_TRUNCATION_C99 | 1362 | dnl 15 = gl_SNPRINTF_PRESENCE |
1272 | dnl 16 = gl_SNPRINTF_RETVAL_C99 | 1363 | dnl 16 = gl_SNPRINTF_TRUNCATION_C99 |
1273 | dnl 17 = gl_SNPRINTF_DIRECTIVE_N | 1364 | dnl 17 = gl_SNPRINTF_RETVAL_C99 |
1274 | dnl 18 = gl_SNPRINTF_SIZE1 | 1365 | dnl 18 = gl_SNPRINTF_DIRECTIVE_N |
1275 | dnl 19 = gl_VSNPRINTF_ZEROSIZE_C99 | 1366 | dnl 19 = gl_SNPRINTF_SIZE1 |
1367 | dnl 20 = gl_VSNPRINTF_ZEROSIZE_C99 | ||
1276 | dnl | 1368 | dnl |
1277 | dnl 1 = checking whether printf supports size specifiers as in C99... | 1369 | dnl 1 = checking whether printf supports size specifiers as in C99... |
1278 | dnl 2 = checking whether printf supports 'long double' arguments... | 1370 | dnl 2 = checking whether printf supports 'long double' arguments... |
@@ -1281,42 +1373,44 @@ dnl 4 = checking whether printf supports infinite 'long double' arguments... | |||
1281 | dnl 5 = checking whether printf supports the 'a' and 'A' directives... | 1373 | dnl 5 = checking whether printf supports the 'a' and 'A' directives... |
1282 | dnl 6 = checking whether printf supports the 'F' directive... | 1374 | dnl 6 = checking whether printf supports the 'F' directive... |
1283 | dnl 7 = checking whether printf supports the 'n' directive... | 1375 | dnl 7 = checking whether printf supports the 'n' directive... |
1284 | dnl 8 = checking whether printf supports POSIX/XSI format strings with positions... | 1376 | dnl 8 = checking whether printf supports the 'ls' directive... |
1285 | dnl 9 = checking whether printf supports the grouping flag... | 1377 | dnl 9 = checking whether printf supports POSIX/XSI format strings with positions... |
1286 | dnl 10 = checking whether printf supports the left-adjust flag correctly... | 1378 | dnl 10 = checking whether printf supports the grouping flag... |
1287 | dnl 11 = checking whether printf supports the zero flag correctly... | 1379 | dnl 11 = checking whether printf supports the left-adjust flag correctly... |
1288 | dnl 12 = checking whether printf supports large precisions... | 1380 | dnl 12 = checking whether printf supports the zero flag correctly... |
1289 | dnl 13 = checking whether printf survives out-of-memory conditions... | 1381 | dnl 13 = checking whether printf supports large precisions... |
1290 | dnl 14 = checking for snprintf... | 1382 | dnl 14 = checking whether printf survives out-of-memory conditions... |
1291 | dnl 15 = checking whether snprintf truncates the result as in C99... | 1383 | dnl 15 = checking for snprintf... |
1292 | dnl 16 = checking whether snprintf returns a byte count as in C99... | 1384 | dnl 16 = checking whether snprintf truncates the result as in C99... |
1293 | dnl 17 = checking whether snprintf fully supports the 'n' directive... | 1385 | dnl 17 = checking whether snprintf returns a byte count as in C99... |
1294 | dnl 18 = checking whether snprintf respects a size of 1... | 1386 | dnl 18 = checking whether snprintf fully supports the 'n' directive... |
1295 | dnl 19 = checking whether vsnprintf respects a zero size as in C99... | 1387 | dnl 19 = checking whether snprintf respects a size of 1... |
1388 | dnl 20 = checking whether vsnprintf respects a zero size as in C99... | ||
1296 | dnl | 1389 | dnl |
1297 | dnl . = yes, # = no. | 1390 | dnl . = yes, # = no. |
1298 | dnl | 1391 | dnl |
1299 | dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 1392 | dnl 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
1300 | dnl glibc 2.5 . . . . . . . . . . . . . . . . . . . | 1393 | dnl glibc 2.5 . . . . . . . . . . . . . . . . . . . . |
1301 | dnl glibc 2.3.6 . . . . # . . . . . . . . . . . . . . | 1394 | dnl glibc 2.3.6 . . . . # . . . . . . . . . . . . . . . |
1302 | dnl FreeBSD 5.4, 6.1 . . . . # . . . . . # . # . . . . . . | 1395 | dnl FreeBSD 5.4, 6.1 . . . . # . . . . . . # . # . . . . . . |
1303 | dnl MacOS X 10.3.9 . . . . # . . . . . # . # . . . . . . | 1396 | dnl MacOS X 10.3.9 . . . . # . . . . . . # . # . . . . . . |
1304 | dnl OpenBSD 3.9, 4.0 . . # # # # . . # . # . # . . . . . . | 1397 | dnl OpenBSD 3.9, 4.0 . . # # # # . # . # . # . # . . . . . . |
1305 | dnl Cygwin 2007 (= Cygwin 1.5.24) . . . . # # . . . ? # ? ? . . . . . . | 1398 | dnl Cygwin 1.7.0 (2009) . . . # . . . ? . . . . . ? . . . . . . |
1306 | dnl Cygwin 2006 (= Cygwin 1.5.19) # . . . # # . . # ? # ? ? . . . . . . | 1399 | dnl Cygwin 1.5.25 (2008) . . . # # . . # . . . . . # . . . . . . |
1307 | dnl Solaris 10 . . # # # . . . . . # . . . . . . . . | 1400 | dnl Cygwin 1.5.19 (2006) # . . # # # . # . # . # # # . . . . . . |
1308 | dnl Solaris 2.6 ... 9 # . # # # # . . . . # . . . . . . . . | 1401 | dnl Solaris 10 . . # # # . . # . . . # . . . . . . . . |
1309 | dnl Solaris 2.5.1 # . # # # # . . . . # . . # # # # # # | 1402 | dnl Solaris 2.6 ... 9 # . # # # # . # . . . # . . . . . . . . |
1310 | dnl AIX 5.2 . . # # # . . . . . # . . . . . . . . | 1403 | dnl Solaris 2.5.1 # . # # # # . # . . . # . . # # # # # # |
1311 | dnl AIX 4.3.2, 5.1 # . # # # # . . . . # . . . . . . . . | 1404 | dnl AIX 5.2 . . # # # . . . . . . # . . . . . . . . |
1312 | dnl HP-UX 11.31 . . . . # . . . . . # . . . . # # . . | 1405 | dnl AIX 4.3.2, 5.1 # . # # # # . . . . . # . . . . . . . . |
1313 | dnl HP-UX 11.{00,11,23} # . . . # # . . . . # . . . . # # . # | 1406 | dnl HP-UX 11.31 . . . . # . . . . . . # . . . . # # . . |
1314 | dnl HP-UX 10.20 # . . . # # . . . # # . . . . # # ? # | 1407 | dnl HP-UX 11.{00,11,23} # . . . # # . . . . . # . . . . # # . # |
1315 | dnl IRIX 6.5 # . # # # # . . . . # . . . . # . . . | 1408 | dnl HP-UX 10.20 # . # . # # . ? . . # # . . . . # # ? # |
1316 | dnl OSF/1 5.1 # . # # # # . . . . # . . . . # . . # | 1409 | dnl IRIX 6.5 # . # # # # . # . . . # . . . . # . . . |
1317 | dnl OSF/1 4.0d # . # # # # . . . . # . . # # # # # # | 1410 | dnl OSF/1 5.1 # . # # # # . . . . . # . . . . # . . # |
1318 | dnl NetBSD 4.0 . ? ? ? ? ? . . ? ? ? ? ? . . . ? ? ? | 1411 | dnl OSF/1 4.0d # . # # # # . . . . . # . . # # # # # # |
1319 | dnl NetBSD 3.0 . . . . # # . # # ? # . # . . . . . . | 1412 | dnl NetBSD 4.0 . ? ? ? ? ? . ? . ? ? ? ? ? . . . ? ? ? |
1320 | dnl Haiku . . . # # # . . . . . . ? . . . . . . | 1413 | dnl NetBSD 3.0 . . . . # # . ? # # ? # . # . . . . . . |
1321 | dnl BeOS # # . # # # . # . ? . # ? . . . . . . | 1414 | dnl Haiku . . . # # # . # . . . . . ? . . . . . . |
1322 | dnl mingw # # # # # # . # # . # # ? . # # # . . | 1415 | dnl BeOS # # . # # # . ? # . ? . # ? . . . . . . |
1416 | dnl mingw # # # # # # . . # # . # # ? . # # # . . | ||
diff --git a/gl/m4/regex.m4 b/gl/m4/regex.m4 index 43b0463..aef53d2 100644 --- a/gl/m4/regex.m4 +++ b/gl/m4/regex.m4 | |||
@@ -1,4 +1,4 @@ | |||
1 | # serial 53 | 1 | # serial 54 |
2 | 2 | ||
3 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, | 3 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, |
4 | # 2006, 2007, 2008, 2009 Free Software Foundation, Inc. | 4 | # 2006, 2007, 2008, 2009 Free Software Foundation, Inc. |
@@ -18,12 +18,9 @@ AC_DEFUN([gl_REGEX], | |||
18 | 18 | ||
19 | AC_ARG_WITH([included-regex], | 19 | AC_ARG_WITH([included-regex], |
20 | [AS_HELP_STRING([--without-included-regex], | 20 | [AS_HELP_STRING([--without-included-regex], |
21 | [don't compile regex; this is the default on 32-bit | 21 | [don't compile regex; this is the default on systems |
22 | systems with recent-enough versions of the GNU C | 22 | with recent-enough versions of the GNU C Library |
23 | Library (use with caution on other systems). | 23 | (use with caution on other systems).])]) |
24 | On systems with 64-bit ptrdiff_t and 32-bit int, | ||
25 | --with-included-regex is the default, in case | ||
26 | regex functions operate on very long strings (>2GB)])]) | ||
27 | 24 | ||
28 | case $with_included_regex in #( | 25 | case $with_included_regex in #( |
29 | yes|no) ac_use_included_regex=$with_included_regex | 26 | yes|no) ac_use_included_regex=$with_included_regex |
diff --git a/gl/m4/stdint.m4 b/gl/m4/stdint.m4 index b4194c8..a2e8bdd 100644 --- a/gl/m4/stdint.m4 +++ b/gl/m4/stdint.m4 | |||
@@ -1,4 +1,4 @@ | |||
1 | # stdint.m4 serial 33 | 1 | # stdint.m4 serial 34 |
2 | dnl Copyright (C) 2001-2009 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2001-2009 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
@@ -201,7 +201,75 @@ struct s { | |||
201 | int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1; | 201 | int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1; |
202 | }; | 202 | }; |
203 | ]])], | 203 | ]])], |
204 | [gl_cv_header_working_stdint_h=yes])]) | 204 | [dnl Determine whether the various *_MIN, *_MAX macros are usable |
205 | dnl in preprocessor expression. We could do it by compiling a test | ||
206 | dnl program for each of these macros. It is faster to run a program | ||
207 | dnl that inspects the macro expansion. | ||
208 | dnl This detects a bug on HP-UX 11.23/ia64. | ||
209 | AC_RUN_IFELSE([ | ||
210 | AC_LANG_PROGRAM([[ | ||
211 | #define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ | ||
212 | #define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ | ||
213 | #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ | ||
214 | #include <stdint.h> | ||
215 | ] | ||
216 | gl_STDINT_INCLUDES | ||
217 | [ | ||
218 | #include <stdio.h> | ||
219 | #include <string.h> | ||
220 | #define MVAL(macro) MVAL1(macro) | ||
221 | #define MVAL1(expression) #expression | ||
222 | static const char *macro_values[] = | ||
223 | { | ||
224 | #ifdef INT8_MAX | ||
225 | MVAL (INT8_MAX), | ||
226 | #endif | ||
227 | #ifdef INT16_MAX | ||
228 | MVAL (INT16_MAX), | ||
229 | #endif | ||
230 | #ifdef INT32_MAX | ||
231 | MVAL (INT32_MAX), | ||
232 | #endif | ||
233 | #ifdef INT64_MAX | ||
234 | MVAL (INT64_MAX), | ||
235 | #endif | ||
236 | #ifdef UINT8_MAX | ||
237 | MVAL (UINT8_MAX), | ||
238 | #endif | ||
239 | #ifdef UINT16_MAX | ||
240 | MVAL (UINT16_MAX), | ||
241 | #endif | ||
242 | #ifdef UINT32_MAX | ||
243 | MVAL (UINT32_MAX), | ||
244 | #endif | ||
245 | #ifdef UINT64_MAX | ||
246 | MVAL (UINT64_MAX), | ||
247 | #endif | ||
248 | NULL | ||
249 | }; | ||
250 | ]], [[ | ||
251 | const char **mv; | ||
252 | for (mv = macro_values; *mv != NULL; mv++) | ||
253 | { | ||
254 | const char *value = *mv; | ||
255 | /* Test whether it looks like a cast expression. */ | ||
256 | if (strncmp (value, "((unsigned int)"/*)*/, 15) == 0 | ||
257 | || strncmp (value, "((unsigned short)"/*)*/, 17) == 0 | ||
258 | || strncmp (value, "((unsigned char)"/*)*/, 16) == 0 | ||
259 | || strncmp (value, "((int)"/*)*/, 6) == 0 | ||
260 | || strncmp (value, "((signed short)"/*)*/, 15) == 0 | ||
261 | || strncmp (value, "((signed char)"/*)*/, 14) == 0) | ||
262 | return 1; | ||
263 | } | ||
264 | return 0; | ||
265 | ]])], | ||
266 | [gl_cv_header_working_stdint_h=yes], | ||
267 | [], | ||
268 | [dnl When cross-compiling, assume it works. | ||
269 | gl_cv_header_working_stdint_h=yes | ||
270 | ]) | ||
271 | ]) | ||
272 | ]) | ||
205 | fi | 273 | fi |
206 | if test "$gl_cv_header_working_stdint_h" = yes; then | 274 | if test "$gl_cv_header_working_stdint_h" = yes; then |
207 | STDINT_H= | 275 | STDINT_H= |
diff --git a/gl/m4/stdio_h.m4 b/gl/m4/stdio_h.m4 index 60b4bd7..846b65d 100644 --- a/gl/m4/stdio_h.m4 +++ b/gl/m4/stdio_h.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # stdio_h.m4 serial 14 | 1 | # stdio_h.m4 serial 15 |
2 | dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2007-2009 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -53,6 +53,8 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], | |||
53 | GNULIB_VPRINTF_POSIX=0; AC_SUBST([GNULIB_VPRINTF_POSIX]) | 53 | GNULIB_VPRINTF_POSIX=0; AC_SUBST([GNULIB_VPRINTF_POSIX]) |
54 | GNULIB_VSNPRINTF=0; AC_SUBST([GNULIB_VSNPRINTF]) | 54 | GNULIB_VSNPRINTF=0; AC_SUBST([GNULIB_VSNPRINTF]) |
55 | GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX]) | 55 | GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX]) |
56 | GNULIB_DPRINTF=0; AC_SUBST([GNULIB_DPRINTF]) | ||
57 | GNULIB_VDPRINTF=0; AC_SUBST([GNULIB_VDPRINTF]) | ||
56 | GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF]) | 58 | GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF]) |
57 | GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF]) | 59 | GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF]) |
58 | GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX]) | 60 | GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX]) |
@@ -86,6 +88,10 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS], | |||
86 | HAVE_DECL_VSNPRINTF=1; AC_SUBST([HAVE_DECL_VSNPRINTF]) | 88 | HAVE_DECL_VSNPRINTF=1; AC_SUBST([HAVE_DECL_VSNPRINTF]) |
87 | REPLACE_SPRINTF=0; AC_SUBST([REPLACE_SPRINTF]) | 89 | REPLACE_SPRINTF=0; AC_SUBST([REPLACE_SPRINTF]) |
88 | REPLACE_VSPRINTF=0; AC_SUBST([REPLACE_VSPRINTF]) | 90 | REPLACE_VSPRINTF=0; AC_SUBST([REPLACE_VSPRINTF]) |
91 | HAVE_DPRINTF=1; AC_SUBST([HAVE_DPRINTF]) | ||
92 | REPLACE_DPRINTF=0; AC_SUBST([REPLACE_DPRINTF]) | ||
93 | HAVE_VDPRINTF=1; AC_SUBST([HAVE_VDPRINTF]) | ||
94 | REPLACE_VDPRINTF=0; AC_SUBST([REPLACE_VDPRINTF]) | ||
89 | HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF]) | 95 | HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF]) |
90 | REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF]) | 96 | REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF]) |
91 | HAVE_DECL_OBSTACK_PRINTF=1; AC_SUBST([HAVE_DECL_OBSTACK_PRINTF]) | 97 | HAVE_DECL_OBSTACK_PRINTF=1; AC_SUBST([HAVE_DECL_OBSTACK_PRINTF]) |
diff --git a/gl/m4/stdlib_h.m4 b/gl/m4/stdlib_h.m4 index 582db13..b295f16 100644 --- a/gl/m4/stdlib_h.m4 +++ b/gl/m4/stdlib_h.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # stdlib_h.m4 serial 13 | 1 | # stdlib_h.m4 serial 15 |
2 | dnl Copyright (C) 2007, 2008 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2007-2009 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -8,9 +8,20 @@ AC_DEFUN([gl_STDLIB_H], | |||
8 | [ | 8 | [ |
9 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) | 9 | AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) |
10 | gl_CHECK_NEXT_HEADERS([stdlib.h]) | 10 | gl_CHECK_NEXT_HEADERS([stdlib.h]) |
11 | AC_CHECK_HEADERS([random.h], [], [], [AC_INCLUDES_DEFAULT]) | ||
12 | if test $ac_cv_header_random_h = yes; then | ||
13 | HAVE_RANDOM_H=1 | ||
14 | else | ||
15 | HAVE_RANDOM_H=0 | ||
16 | fi | ||
17 | AC_SUBST([HAVE_RANDOM_H]) | ||
11 | AC_CHECK_TYPES([struct random_data], | 18 | AC_CHECK_TYPES([struct random_data], |
12 | [], [HAVE_STRUCT_RANDOM_DATA=0], | 19 | [], [HAVE_STRUCT_RANDOM_DATA=0], |
13 | [[#include <stdlib.h>]]) | 20 | [[#include <stdlib.h> |
21 | #if HAVE_RANDOM_H | ||
22 | # include <random.h> | ||
23 | #endif | ||
24 | ]]) | ||
14 | ]) | 25 | ]) |
15 | 26 | ||
16 | AC_DEFUN([gl_STDLIB_MODULE_INDICATOR], | 27 | AC_DEFUN([gl_STDLIB_MODULE_INDICATOR], |
diff --git a/gl/m4/strdup.m4 b/gl/m4/strdup.m4 new file mode 100644 index 0000000..d7daac2 --- /dev/null +++ b/gl/m4/strdup.m4 | |||
@@ -0,0 +1,38 @@ | |||
1 | # strdup.m4 serial 11 | ||
2 | |||
3 | dnl Copyright (C) 2002-2009 Free Software Foundation, Inc. | ||
4 | |||
5 | dnl This file is free software; the Free Software Foundation | ||
6 | dnl gives unlimited permission to copy and/or distribute it, | ||
7 | dnl with or without modifications, as long as this notice is preserved. | ||
8 | |||
9 | AC_DEFUN([gl_FUNC_STRDUP], | ||
10 | [ | ||
11 | AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) | ||
12 | AC_REPLACE_FUNCS([strdup]) | ||
13 | AC_CHECK_DECLS_ONCE([strdup]) | ||
14 | if test $ac_cv_have_decl_strdup = no; then | ||
15 | HAVE_DECL_STRDUP=0 | ||
16 | fi | ||
17 | gl_PREREQ_STRDUP | ||
18 | ]) | ||
19 | |||
20 | AC_DEFUN([gl_FUNC_STRDUP_POSIX], | ||
21 | [ | ||
22 | AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS]) | ||
23 | AC_REQUIRE([gl_CHECK_MALLOC_POSIX]) | ||
24 | if test $gl_cv_func_malloc_posix != yes; then | ||
25 | REPLACE_STRDUP=1 | ||
26 | AC_LIBOBJ([strdup]) | ||
27 | else | ||
28 | AC_REPLACE_FUNCS([strdup]) | ||
29 | fi | ||
30 | AC_CHECK_DECLS_ONCE([strdup]) | ||
31 | if test $ac_cv_have_decl_strdup = no; then | ||
32 | HAVE_DECL_STRDUP=0 | ||
33 | fi | ||
34 | gl_PREREQ_STRDUP | ||
35 | ]) | ||
36 | |||
37 | # Prerequisites of lib/strdup.c. | ||
38 | AC_DEFUN([gl_PREREQ_STRDUP], [:]) | ||
diff --git a/gl/m4/sys_socket_h.m4 b/gl/m4/sys_socket_h.m4 index 85a0ace..d1cb9c2 100644 --- a/gl/m4/sys_socket_h.m4 +++ b/gl/m4/sys_socket_h.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # sys_socket_h.m4 serial 12 | 1 | # sys_socket_h.m4 serial 12 |
2 | dnl Copyright (C) 2005-2008 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2005-2009 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -40,32 +40,54 @@ AC_DEFUN([gl_HEADER_SYS_SOCKET], | |||
40 | else | 40 | else |
41 | SYS_SOCKET_H='sys/socket.h' | 41 | SYS_SOCKET_H='sys/socket.h' |
42 | fi | 42 | fi |
43 | # We need to check for ws2tcpip.h now. | ||
44 | gl_PREREQ_SYS_H_SOCKET | ||
45 | AC_CHECK_TYPES([struct sockaddr_storage],,,[ | ||
46 | /* sys/types.h is not needed according to POSIX, but the | ||
47 | sys/socket.h in i386-unknown-freebsd4.10 and | ||
48 | powerpc-apple-darwin5.5 required it. */ | ||
49 | #include <sys/types.h> | ||
50 | #ifdef HAVE_SYS_SOCKET_H | ||
51 | #include <sys/socket.h> | ||
52 | #endif | ||
53 | #ifdef HAVE_WS2TCPIP_H | ||
54 | #include <ws2tcpip.h> | ||
55 | #endif | ||
56 | ]) | ||
57 | if test $ac_cv_type_struct_sockaddr_storage = no; then | ||
58 | HAVE_STRUCT_SOCKADDR_STORAGE=0 | ||
59 | SYS_SOCKET_H='sys/socket.h' | ||
60 | fi | ||
43 | if test -n "$SYS_SOCKET_H"; then | 61 | if test -n "$SYS_SOCKET_H"; then |
44 | dnl Check prerequisites of the <sys/socket.h> replacement. | ||
45 | gl_CHECK_NEXT_HEADERS([sys/socket.h]) | ||
46 | if test $ac_cv_header_sys_socket_h = yes; then | ||
47 | HAVE_SYS_SOCKET_H=1 | ||
48 | HAVE_WS2TCPIP_H=0 | ||
49 | else | ||
50 | HAVE_SYS_SOCKET_H=0 | ||
51 | dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make | ||
52 | dnl the check for those headers unconditional; yet cygwin reports | ||
53 | dnl that the headers are present but cannot be compiled (since on | ||
54 | dnl cygwin, all socket information should come from sys/socket.h). | ||
55 | AC_CHECK_HEADERS([ws2tcpip.h]) | ||
56 | if test $ac_cv_header_ws2tcpip_h = yes; then | ||
57 | HAVE_WS2TCPIP_H=1 | ||
58 | else | ||
59 | HAVE_WS2TCPIP_H=0 | ||
60 | fi | ||
61 | fi | ||
62 | gl_PREREQ_SYS_H_WINSOCK2 | 62 | gl_PREREQ_SYS_H_WINSOCK2 |
63 | AC_SUBST([HAVE_SYS_SOCKET_H]) | ||
64 | AC_SUBST([HAVE_WS2TCPIP_H]) | ||
65 | fi | 63 | fi |
66 | AC_SUBST([SYS_SOCKET_H]) | 64 | AC_SUBST([SYS_SOCKET_H]) |
67 | ]) | 65 | ]) |
68 | 66 | ||
67 | AC_DEFUN([gl_PREREQ_SYS_H_SOCKET], | ||
68 | [ | ||
69 | dnl Check prerequisites of the <sys/socket.h> replacement. | ||
70 | gl_CHECK_NEXT_HEADERS([sys/socket.h]) | ||
71 | if test $ac_cv_header_sys_socket_h = yes; then | ||
72 | HAVE_SYS_SOCKET_H=1 | ||
73 | HAVE_WS2TCPIP_H=0 | ||
74 | else | ||
75 | HAVE_SYS_SOCKET_H=0 | ||
76 | dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make | ||
77 | dnl the check for those headers unconditional; yet cygwin reports | ||
78 | dnl that the headers are present but cannot be compiled (since on | ||
79 | dnl cygwin, all socket information should come from sys/socket.h). | ||
80 | AC_CHECK_HEADERS([ws2tcpip.h]) | ||
81 | if test $ac_cv_header_ws2tcpip_h = yes; then | ||
82 | HAVE_WS2TCPIP_H=1 | ||
83 | else | ||
84 | HAVE_WS2TCPIP_H=0 | ||
85 | fi | ||
86 | fi | ||
87 | AC_SUBST([HAVE_SYS_SOCKET_H]) | ||
88 | AC_SUBST([HAVE_WS2TCPIP_H]) | ||
89 | ]) | ||
90 | |||
69 | # Common prerequisites of of the <sys/socket.h> replacement and of the | 91 | # Common prerequisites of of the <sys/socket.h> replacement and of the |
70 | # <sys/select.h> replacement. | 92 | # <sys/select.h> replacement. |
71 | # Sets and substitutes HAVE_WINSOCK2_H. | 93 | # Sets and substitutes HAVE_WINSOCK2_H. |
@@ -114,4 +136,5 @@ AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS], | |||
114 | GNULIB_SENDTO=0; AC_SUBST([GNULIB_SENDTO]) | 136 | GNULIB_SENDTO=0; AC_SUBST([GNULIB_SENDTO]) |
115 | GNULIB_SETSOCKOPT=0; AC_SUBST([GNULIB_SETSOCKOPT]) | 137 | GNULIB_SETSOCKOPT=0; AC_SUBST([GNULIB_SETSOCKOPT]) |
116 | GNULIB_SHUTDOWN=0; AC_SUBST([GNULIB_SHUTDOWN]) | 138 | GNULIB_SHUTDOWN=0; AC_SUBST([GNULIB_SHUTDOWN]) |
139 | HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) | ||
117 | ]) | 140 | ]) |
diff --git a/gl/m4/unistd_h.m4 b/gl/m4/unistd_h.m4 index 5685273..ff9a4ea 100644 --- a/gl/m4/unistd_h.m4 +++ b/gl/m4/unistd_h.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # unistd_h.m4 serial 16 | 1 | # unistd_h.m4 serial 17 |
2 | dnl Copyright (C) 2006-2008 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2006-2009 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -48,6 +48,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], | |||
48 | GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE]) | 48 | GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE]) |
49 | GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL]) | 49 | GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL]) |
50 | GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN]) | 50 | GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN]) |
51 | GNULIB_LINK=0; AC_SUBST([GNULIB_LINK]) | ||
51 | GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK]) | 52 | GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK]) |
52 | GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK]) | 53 | GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK]) |
53 | GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP]) | 54 | GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP]) |
@@ -63,6 +64,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS], | |||
63 | HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME]) | 64 | HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME]) |
64 | HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE]) | 65 | HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE]) |
65 | HAVE_GETUSERSHELL=1; AC_SUBST([HAVE_GETUSERSHELL]) | 66 | HAVE_GETUSERSHELL=1; AC_SUBST([HAVE_GETUSERSHELL]) |
67 | HAVE_LINK=1; AC_SUBST([HAVE_LINK]) | ||
66 | HAVE_READLINK=1; AC_SUBST([HAVE_READLINK]) | 68 | HAVE_READLINK=1; AC_SUBST([HAVE_READLINK]) |
67 | HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP]) | 69 | HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP]) |
68 | HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON]) | 70 | HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON]) |
diff --git a/gl/m4/vasnprintf.m4 b/gl/m4/vasnprintf.m4 index 9e839d2..3a1d1e0 100644 --- a/gl/m4/vasnprintf.m4 +++ b/gl/m4/vasnprintf.m4 | |||
@@ -1,4 +1,4 @@ | |||
1 | # vasnprintf.m4 serial 26 | 1 | # vasnprintf.m4 serial 29 |
2 | dnl Copyright (C) 2002-2004, 2006-2009 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2002-2004, 2006-2009 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
@@ -52,13 +52,13 @@ AC_DEFUN([gl_PREREQ_PRINTF_PARSE], | |||
52 | ]) | 52 | ]) |
53 | 53 | ||
54 | # Prerequisites of lib/vasnprintf.c. | 54 | # Prerequisites of lib/vasnprintf.c. |
55 | AC_DEFUN([gl_PREREQ_VASNPRINTF], | 55 | AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF], |
56 | [ | 56 | [ |
57 | AC_REQUIRE([AC_FUNC_ALLOCA]) | 57 | AC_REQUIRE([AC_FUNC_ALLOCA]) |
58 | AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) | 58 | AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) |
59 | AC_REQUIRE([gt_TYPE_WCHAR_T]) | 59 | AC_REQUIRE([gt_TYPE_WCHAR_T]) |
60 | AC_REQUIRE([gt_TYPE_WINT_T]) | 60 | AC_REQUIRE([gt_TYPE_WINT_T]) |
61 | AC_CHECK_FUNCS([snprintf wcslen]) | 61 | AC_CHECK_FUNCS([snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb]) |
62 | dnl Use the _snprintf function only if it is declared (because on NetBSD it | 62 | dnl Use the _snprintf function only if it is declared (because on NetBSD it |
63 | dnl is defined as a weak alias of snprintf; we prefer to use the latter). | 63 | dnl is defined as a weak alias of snprintf; we prefer to use the latter). |
64 | AC_CHECK_DECLS([_snprintf], , , [#include <stdio.h>]) | 64 | AC_CHECK_DECLS([_snprintf], , , [#include <stdio.h>]) |
@@ -66,7 +66,7 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF], | |||
66 | 66 | ||
67 | # Extra prerequisites of lib/vasnprintf.c for supporting 'long double' | 67 | # Extra prerequisites of lib/vasnprintf.c for supporting 'long double' |
68 | # arguments. | 68 | # arguments. |
69 | AC_DEFUN([gl_PREREQ_VASNPRINTF_LONG_DOUBLE], | 69 | AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE], |
70 | [ | 70 | [ |
71 | AC_REQUIRE([gl_PRINTF_LONG_DOUBLE]) | 71 | AC_REQUIRE([gl_PRINTF_LONG_DOUBLE]) |
72 | case "$gl_cv_func_printf_long_double" in | 72 | case "$gl_cv_func_printf_long_double" in |
@@ -150,6 +150,21 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_F], | |||
150 | esac | 150 | esac |
151 | ]) | 151 | ]) |
152 | 152 | ||
153 | # Extra prerequisites of lib/vasnprintf.c for supporting the 'ls' directive. | ||
154 | AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_LS], | ||
155 | [ | ||
156 | AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS]) | ||
157 | case "$gl_cv_func_printf_directive_ls" in | ||
158 | *yes) | ||
159 | ;; | ||
160 | *) | ||
161 | AC_DEFINE([NEED_PRINTF_DIRECTIVE_LS], [1], | ||
162 | [Define if the vasnprintf implementation needs special code for | ||
163 | the 'ls' directive.]) | ||
164 | ;; | ||
165 | esac | ||
166 | ]) | ||
167 | |||
153 | # Extra prerequisites of lib/vasnprintf.c for supporting the ' flag. | 168 | # Extra prerequisites of lib/vasnprintf.c for supporting the ' flag. |
154 | AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING], | 169 | AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING], |
155 | [ | 170 | [ |
@@ -247,6 +262,7 @@ AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS], | |||
247 | gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE | 262 | gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE |
248 | gl_PREREQ_VASNPRINTF_DIRECTIVE_A | 263 | gl_PREREQ_VASNPRINTF_DIRECTIVE_A |
249 | gl_PREREQ_VASNPRINTF_DIRECTIVE_F | 264 | gl_PREREQ_VASNPRINTF_DIRECTIVE_F |
265 | gl_PREREQ_VASNPRINTF_DIRECTIVE_LS | ||
250 | gl_PREREQ_VASNPRINTF_FLAG_GROUPING | 266 | gl_PREREQ_VASNPRINTF_FLAG_GROUPING |
251 | gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST | 267 | gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST |
252 | gl_PREREQ_VASNPRINTF_FLAG_ZERO | 268 | gl_PREREQ_VASNPRINTF_FLAG_ZERO |
diff --git a/gl/m4/wchar.m4 b/gl/m4/wchar.m4 index ba8ee6a..2e52a82 100644 --- a/gl/m4/wchar.m4 +++ b/gl/m4/wchar.m4 | |||
@@ -1,13 +1,13 @@ | |||
1 | dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues. | 1 | dnl A placeholder for ISO C99 <wchar.h>, for platforms that have issues. |
2 | 2 | ||
3 | dnl Copyright (C) 2007-2008 Free Software Foundation, Inc. | 3 | dnl Copyright (C) 2007-2009 Free Software Foundation, Inc. |
4 | dnl This file is free software; the Free Software Foundation | 4 | dnl This file is free software; the Free Software Foundation |
5 | dnl gives unlimited permission to copy and/or distribute it, | 5 | dnl gives unlimited permission to copy and/or distribute it, |
6 | dnl with or without modifications, as long as this notice is preserved. | 6 | dnl with or without modifications, as long as this notice is preserved. |
7 | 7 | ||
8 | dnl Written by Eric Blake. | 8 | dnl Written by Eric Blake. |
9 | 9 | ||
10 | # wchar.m4 serial 22 | 10 | # wchar.m4 serial 23 |
11 | 11 | ||
12 | AC_DEFUN([gl_WCHAR_H], | 12 | AC_DEFUN([gl_WCHAR_H], |
13 | [ | 13 | [ |
@@ -73,27 +73,28 @@ AC_DEFUN([gl_WCHAR_H_DEFAULTS], | |||
73 | GNULIB_WCSNRTOMBS=0; AC_SUBST([GNULIB_WCSNRTOMBS]) | 73 | GNULIB_WCSNRTOMBS=0; AC_SUBST([GNULIB_WCSNRTOMBS]) |
74 | GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH]) | 74 | GNULIB_WCWIDTH=0; AC_SUBST([GNULIB_WCWIDTH]) |
75 | dnl Assume proper GNU behavior unless another module says otherwise. | 75 | dnl Assume proper GNU behavior unless another module says otherwise. |
76 | HAVE_BTOWC=1; AC_SUBST([HAVE_BTOWC]) | 76 | HAVE_BTOWC=1; AC_SUBST([HAVE_BTOWC]) |
77 | HAVE_MBSINIT=1; AC_SUBST([HAVE_MBSINIT]) | 77 | HAVE_MBSINIT=1; AC_SUBST([HAVE_MBSINIT]) |
78 | HAVE_MBRTOWC=1; AC_SUBST([HAVE_MBRTOWC]) | 78 | HAVE_MBRTOWC=1; AC_SUBST([HAVE_MBRTOWC]) |
79 | HAVE_MBRLEN=1; AC_SUBST([HAVE_MBRLEN]) | 79 | HAVE_MBRLEN=1; AC_SUBST([HAVE_MBRLEN]) |
80 | HAVE_MBSRTOWCS=1; AC_SUBST([HAVE_MBSRTOWCS]) | 80 | HAVE_MBSRTOWCS=1; AC_SUBST([HAVE_MBSRTOWCS]) |
81 | HAVE_MBSNRTOWCS=1; AC_SUBST([HAVE_MBSNRTOWCS]) | 81 | HAVE_MBSNRTOWCS=1; AC_SUBST([HAVE_MBSNRTOWCS]) |
82 | HAVE_WCRTOMB=1; AC_SUBST([HAVE_WCRTOMB]) | 82 | HAVE_WCRTOMB=1; AC_SUBST([HAVE_WCRTOMB]) |
83 | HAVE_WCSRTOMBS=1; AC_SUBST([HAVE_WCSRTOMBS]) | 83 | HAVE_WCSRTOMBS=1; AC_SUBST([HAVE_WCSRTOMBS]) |
84 | HAVE_WCSNRTOMBS=1; AC_SUBST([HAVE_WCSNRTOMBS]) | 84 | HAVE_WCSNRTOMBS=1; AC_SUBST([HAVE_WCSNRTOMBS]) |
85 | HAVE_DECL_WCTOB=1; AC_SUBST([HAVE_DECL_WCTOB]) | 85 | HAVE_DECL_WCTOB=1; AC_SUBST([HAVE_DECL_WCTOB]) |
86 | HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH]) | 86 | HAVE_DECL_WCWIDTH=1; AC_SUBST([HAVE_DECL_WCWIDTH]) |
87 | REPLACE_MBSTATE_T=0; AC_SUBST([REPLACE_MBSTATE_T]) | 87 | REPLACE_MBSTATE_T=0; AC_SUBST([REPLACE_MBSTATE_T]) |
88 | REPLACE_BTOWC=0; AC_SUBST([REPLACE_BTOWC]) | 88 | REPLACE_BTOWC=0; AC_SUBST([REPLACE_BTOWC]) |
89 | REPLACE_WCTOB=0; AC_SUBST([REPLACE_WCTOB]) | 89 | REPLACE_WCTOB=0; AC_SUBST([REPLACE_WCTOB]) |
90 | REPLACE_MBSINIT=0; AC_SUBST([REPLACE_MBSINIT]) | 90 | REPLACE_MBSINIT=0; AC_SUBST([REPLACE_MBSINIT]) |
91 | REPLACE_MBRTOWC=0; AC_SUBST([REPLACE_MBRTOWC]) | 91 | REPLACE_MBRTOWC=0; AC_SUBST([REPLACE_MBRTOWC]) |
92 | REPLACE_MBRLEN=0; AC_SUBST([REPLACE_MBRLEN]) | 92 | REPLACE_MBRLEN=0; AC_SUBST([REPLACE_MBRLEN]) |
93 | REPLACE_MBSRTOWCS=0; AC_SUBST([REPLACE_MBSRTOWCS]) | 93 | REPLACE_MBSRTOWCS=0; AC_SUBST([REPLACE_MBSRTOWCS]) |
94 | REPLACE_MBSNRTOWCS=0;AC_SUBST([REPLACE_MBSNRTOWCS]) | 94 | REPLACE_MBSNRTOWCS=0; AC_SUBST([REPLACE_MBSNRTOWCS]) |
95 | REPLACE_WCRTOMB=0; AC_SUBST([REPLACE_WCRTOMB]) | 95 | REPLACE_WCRTOMB=0; AC_SUBST([REPLACE_WCRTOMB]) |
96 | REPLACE_WCSRTOMBS=0; AC_SUBST([REPLACE_WCSRTOMBS]) | 96 | REPLACE_WCSRTOMBS=0; AC_SUBST([REPLACE_WCSRTOMBS]) |
97 | REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH]) | 97 | REPLACE_WCSNRTOMBS=0; AC_SUBST([REPLACE_WCSNRTOMBS]) |
98 | WCHAR_H=''; AC_SUBST([WCHAR_H]) | 98 | REPLACE_WCWIDTH=0; AC_SUBST([REPLACE_WCWIDTH]) |
99 | WCHAR_H=''; AC_SUBST([WCHAR_H]) | ||
99 | ]) | 100 | ]) |
diff --git a/gl/m4/wcrtomb.m4 b/gl/m4/wcrtomb.m4 index 22d9433..cb7d926 100644 --- a/gl/m4/wcrtomb.m4 +++ b/gl/m4/wcrtomb.m4 | |||
@@ -1,5 +1,5 @@ | |||
1 | # wcrtomb.m4 serial 2 | 1 | # wcrtomb.m4 serial 4 |
2 | dnl Copyright (C) 2008 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 2008-2009 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl with or without modifications, as long as this notice is preserved. | 5 | dnl with or without modifications, as long as this notice is preserved. |
@@ -9,12 +9,16 @@ AC_DEFUN([gl_FUNC_WCRTOMB], | |||
9 | AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) | 9 | AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) |
10 | 10 | ||
11 | AC_REQUIRE([AC_TYPE_MBSTATE_T]) | 11 | AC_REQUIRE([AC_TYPE_MBSTATE_T]) |
12 | gl_MBSTATE_T_BROKEN | ||
13 | if test $REPLACE_MBSTATE_T = 1; then | ||
14 | REPLACE_WCRTOMB=1 | ||
15 | fi | ||
12 | AC_CHECK_FUNCS_ONCE([wcrtomb]) | 16 | AC_CHECK_FUNCS_ONCE([wcrtomb]) |
13 | if test $ac_cv_func_wcrtomb = no; then | 17 | if test $ac_cv_func_wcrtomb = no; then |
14 | HAVE_WCRTOMB=0 | 18 | HAVE_WCRTOMB=0 |
15 | else | 19 | fi |
16 | 20 | if test $HAVE_WCRTOMB != 0 && test $REPLACE_WCRTOMB != 1; then | |
17 | dnl On OSF/1 5.1 and Solaris 10, wcrtomb (NULL, 0, NULL) sometimes | 21 | dnl On AIX 4.3, OSF/1 5.1 and Solaris 10, wcrtomb (NULL, 0, NULL) sometimes |
18 | dnl returns 0 instead of 1. | 22 | dnl returns 0 instead of 1. |
19 | AC_REQUIRE([AC_PROG_CC]) | 23 | AC_REQUIRE([AC_PROG_CC]) |
20 | AC_REQUIRE([gt_LOCALE_FR]) | 24 | AC_REQUIRE([gt_LOCALE_FR]) |
@@ -29,10 +33,10 @@ AC_DEFUN([gl_FUNC_WCRTOMB], | |||
29 | dnl is present. | 33 | dnl is present. |
30 | changequote(,)dnl | 34 | changequote(,)dnl |
31 | case "$host_os" in | 35 | case "$host_os" in |
32 | # Guess no on OSF/1 and Solaris. | 36 | # Guess no on AIX 4, OSF/1 and Solaris. |
33 | osf* | solaris*) gl_cv_func_wcrtomb_retval="guessing no" ;; | 37 | aix4* | osf* | solaris*) gl_cv_func_wcrtomb_retval="guessing no" ;; |
34 | # Guess yes otherwise. | 38 | # Guess yes otherwise. |
35 | *) gl_cv_func_wcrtomb_retval="guessing yes" ;; | 39 | *) gl_cv_func_wcrtomb_retval="guessing yes" ;; |
36 | esac | 40 | esac |
37 | changequote([,])dnl | 41 | changequote([,])dnl |
38 | if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then | 42 | if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then |
@@ -67,7 +71,7 @@ int main () | |||
67 | }], | 71 | }], |
68 | [gl_cv_func_wcrtomb_retval=yes], | 72 | [gl_cv_func_wcrtomb_retval=yes], |
69 | [gl_cv_func_wcrtomb_retval=no], | 73 | [gl_cv_func_wcrtomb_retval=no], |
70 | []) | 74 | [:]) |
71 | fi | 75 | fi |
72 | ]) | 76 | ]) |
73 | case "$gl_cv_func_wcrtomb_retval" in | 77 | case "$gl_cv_func_wcrtomb_retval" in |
diff --git a/gl/math.in.h b/gl/math.in.h index 6e1b9a2..a0efefd 100644 --- a/gl/math.in.h +++ b/gl/math.in.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* A GNU-like <math.h>. | 1 | /* A GNU-like <math.h>. |
2 | 2 | ||
3 | Copyright (C) 2002-2003, 2007-2008 Free Software Foundation, Inc. | 3 | Copyright (C) 2002-2003, 2007-2009 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This program is free software: you can redistribute it and/or modify | 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 | 6 | it under the terms of the GNU General Public License as published by |
@@ -518,7 +518,8 @@ extern int gl_signbitf (float arg); | |||
518 | extern int gl_signbitd (double arg); | 518 | extern int gl_signbitd (double arg); |
519 | extern int gl_signbitl (long double arg); | 519 | extern int gl_signbitl (long double arg); |
520 | # if __GNUC__ >= 2 && !__STRICT_ANSI__ | 520 | # if __GNUC__ >= 2 && !__STRICT_ANSI__ |
521 | # if defined FLT_SIGNBIT_WORD && defined FLT_SIGNBIT_BIT | 521 | # if defined FLT_SIGNBIT_WORD && defined FLT_SIGNBIT_BIT && !defined gl_signbitf |
522 | # define gl_signbitf_OPTIMIZED_MACRO | ||
522 | # define gl_signbitf(arg) \ | 523 | # define gl_signbitf(arg) \ |
523 | ({ union { float _value; \ | 524 | ({ union { float _value; \ |
524 | unsigned int _word[(sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \ | 525 | unsigned int _word[(sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \ |
@@ -527,7 +528,8 @@ extern int gl_signbitl (long double arg); | |||
527 | (_m._word[FLT_SIGNBIT_WORD] >> FLT_SIGNBIT_BIT) & 1; \ | 528 | (_m._word[FLT_SIGNBIT_WORD] >> FLT_SIGNBIT_BIT) & 1; \ |
528 | }) | 529 | }) |
529 | # endif | 530 | # endif |
530 | # if defined DBL_SIGNBIT_WORD && defined DBL_SIGNBIT_BIT | 531 | # if defined DBL_SIGNBIT_WORD && defined DBL_SIGNBIT_BIT && !defined gl_signbitd |
532 | # define gl_signbitd_OPTIMIZED_MACRO | ||
531 | # define gl_signbitd(arg) \ | 533 | # define gl_signbitd(arg) \ |
532 | ({ union { double _value; \ | 534 | ({ union { double _value; \ |
533 | unsigned int _word[(sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \ | 535 | unsigned int _word[(sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \ |
@@ -536,7 +538,8 @@ extern int gl_signbitl (long double arg); | |||
536 | (_m._word[DBL_SIGNBIT_WORD] >> DBL_SIGNBIT_BIT) & 1; \ | 538 | (_m._word[DBL_SIGNBIT_WORD] >> DBL_SIGNBIT_BIT) & 1; \ |
537 | }) | 539 | }) |
538 | # endif | 540 | # endif |
539 | # if defined LDBL_SIGNBIT_WORD && defined LDBL_SIGNBIT_BIT | 541 | # if defined LDBL_SIGNBIT_WORD && defined LDBL_SIGNBIT_BIT && !defined gl_signbitl |
542 | # define gl_signbitl_OPTIMIZED_MACRO | ||
540 | # define gl_signbitl(arg) \ | 543 | # define gl_signbitl(arg) \ |
541 | ({ union { long double _value; \ | 544 | ({ union { long double _value; \ |
542 | unsigned int _word[(sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \ | 545 | unsigned int _word[(sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \ |
diff --git a/gl/mbrtowc.c b/gl/mbrtowc.c index 603f006..0fec5f1 100644 --- a/gl/mbrtowc.c +++ b/gl/mbrtowc.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Convert multibyte character to wide character. | 1 | /* Convert multibyte character to wide character. |
2 | Copyright (C) 1999-2002, 2005-2008 Free Software Foundation, Inc. | 2 | Copyright (C) 1999-2002, 2005-2009 Free Software Foundation, Inc. |
3 | Written by Bruno Haible <bruno@clisp.org>, 2008. | 3 | Written by Bruno Haible <bruno@clisp.org>, 2008. |
4 | 4 | ||
5 | This program is free software: you can redistribute it and/or modify | 5 | This program is free software: you can redistribute it and/or modify |
@@ -89,7 +89,7 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) | |||
89 | return (size_t)(-1); | 89 | return (size_t)(-1); |
90 | } | 90 | } |
91 | 91 | ||
92 | /* Here 0 < m ≤ 4. */ | 92 | /* Here m > 0. */ |
93 | 93 | ||
94 | # if __GLIBC__ | 94 | # if __GLIBC__ |
95 | /* Work around bug <http://sourceware.org/bugzilla/show_bug.cgi?id=9674> */ | 95 | /* Work around bug <http://sourceware.org/bugzilla/show_bug.cgi?id=9674> */ |
@@ -118,7 +118,7 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) | |||
118 | lack mbrtowc(), we use the second approach. | 118 | lack mbrtowc(), we use the second approach. |
119 | The possible encodings are: | 119 | The possible encodings are: |
120 | - 8-bit encodings, | 120 | - 8-bit encodings, |
121 | - EUC-JP, EUC-KR, GB2312, EUC-TW, BIG5, SJIS, | 121 | - EUC-JP, EUC-KR, GB2312, EUC-TW, BIG5, GB18030, SJIS, |
122 | - UTF-8. | 122 | - UTF-8. |
123 | Use specialized code for each. */ | 123 | Use specialized code for each. */ |
124 | if (m >= 4 || m >= MB_CUR_MAX) | 124 | if (m >= 4 || m >= MB_CUR_MAX) |
@@ -238,6 +238,39 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) | |||
238 | } | 238 | } |
239 | goto invalid; | 239 | goto invalid; |
240 | } | 240 | } |
241 | if (STREQ (encoding, "GB18030", 'G', 'B', '1', '8', '0', '3', '0', 0, 0)) | ||
242 | { | ||
243 | if (m == 1) | ||
244 | { | ||
245 | unsigned char c = (unsigned char) p[0]; | ||
246 | |||
247 | if ((c >= 0x90 && c <= 0xe3) || (c >= 0xf8 && c <= 0xfe)) | ||
248 | goto incomplete; | ||
249 | } | ||
250 | else /* m == 2 || m == 3 */ | ||
251 | { | ||
252 | unsigned char c = (unsigned char) p[0]; | ||
253 | |||
254 | if (c >= 0x90 && c <= 0xe3) | ||
255 | { | ||
256 | unsigned char c2 = (unsigned char) p[1]; | ||
257 | |||
258 | if (c2 >= 0x30 && c2 <= 0x39) | ||
259 | { | ||
260 | if (m == 2) | ||
261 | goto incomplete; | ||
262 | else /* m == 3 */ | ||
263 | { | ||
264 | unsigned char c3 = (unsigned char) p[2]; | ||
265 | |||
266 | if (c3 >= 0x81 && c3 <= 0xfe) | ||
267 | goto incomplete; | ||
268 | } | ||
269 | } | ||
270 | } | ||
271 | } | ||
272 | goto invalid; | ||
273 | } | ||
241 | if (STREQ (encoding, "SJIS", 'S', 'J', 'I', 'S', 0, 0, 0, 0, 0)) | 274 | if (STREQ (encoding, "SJIS", 'S', 'J', 'I', 'S', 0, 0, 0, 0, 0)) |
242 | { | 275 | { |
243 | if (m == 1) | 276 | if (m == 1) |
@@ -258,10 +291,14 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) | |||
258 | incomplete: | 291 | incomplete: |
259 | { | 292 | { |
260 | size_t k = nstate; | 293 | size_t k = nstate; |
261 | /* Here 0 < k < m < 4. */ | 294 | /* Here 0 <= k < m < 4. */ |
262 | pstate[++k] = s[0]; | 295 | pstate[++k] = s[0]; |
263 | if (k < m) | 296 | if (k < m) |
264 | pstate[++k] = s[1]; | 297 | { |
298 | pstate[++k] = s[1]; | ||
299 | if (k < m) | ||
300 | pstate[++k] = s[2]; | ||
301 | } | ||
265 | if (k != m) | 302 | if (k != m) |
266 | abort (); | 303 | abort (); |
267 | } | 304 | } |
diff --git a/gl/mountlist.c b/gl/mountlist.c index 4c975c6..50e90ee 100644 --- a/gl/mountlist.c +++ b/gl/mountlist.c | |||
@@ -1,7 +1,6 @@ | |||
1 | /* mountlist.c -- return a list of mounted file systems | 1 | /* mountlist.c -- return a list of mounted file systems |
2 | 2 | ||
3 | Copyright (C) 1991, 1992, 1997, 1998, 1999, 2000, 2001, 2002, 2003, | 3 | Copyright (C) 1991, 1992, 1997-2009 Free Software Foundation, Inc. |
4 | 2004, 2005, 2006, 2007 Free Software Foundation, Inc. | ||
5 | 4 | ||
6 | This program is free software: you can redistribute it and/or modify | 5 | 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 | 6 | it under the terms of the GNU General Public License as published by |
@@ -24,6 +23,7 @@ | |||
24 | #include <stdio.h> | 23 | #include <stdio.h> |
25 | #include <stdlib.h> | 24 | #include <stdlib.h> |
26 | #include <string.h> | 25 | #include <string.h> |
26 | #include <stdint.h> | ||
27 | 27 | ||
28 | #include "xalloc.h" | 28 | #include "xalloc.h" |
29 | 29 | ||
@@ -134,10 +134,6 @@ | |||
134 | # include "unlocked-io.h" | 134 | # include "unlocked-io.h" |
135 | #endif | 135 | #endif |
136 | 136 | ||
137 | #ifndef SIZE_MAX | ||
138 | # define SIZE_MAX ((size_t) -1) | ||
139 | #endif | ||
140 | |||
141 | /* The results of open() in this file are not used with fchdir, | 137 | /* The results of open() in this file are not used with fchdir, |
142 | therefore save some unnecessary work in fchdir.c. */ | 138 | therefore save some unnecessary work in fchdir.c. */ |
143 | #undef open | 139 | #undef open |
@@ -300,7 +296,6 @@ fstype_to_string (int t) | |||
300 | 296 | ||
301 | /* Return the device number from MOUNT_OPTIONS, if possible. | 297 | /* Return the device number from MOUNT_OPTIONS, if possible. |
302 | Otherwise return (dev_t) -1. */ | 298 | Otherwise return (dev_t) -1. */ |
303 | |||
304 | static dev_t | 299 | static dev_t |
305 | dev_from_mount_options (char const *mount_options) | 300 | dev_from_mount_options (char const *mount_options) |
306 | { | 301 | { |
@@ -327,7 +322,7 @@ dev_from_mount_options (char const *mount_options) | |||
327 | } | 322 | } |
328 | 323 | ||
329 | # endif | 324 | # endif |
330 | 325 | (void) mount_options; | |
331 | return -1; | 326 | return -1; |
332 | } | 327 | } |
333 | 328 | ||
@@ -344,6 +339,7 @@ read_file_system_list (bool need_fs_type) | |||
344 | struct mount_entry *mount_list; | 339 | struct mount_entry *mount_list; |
345 | struct mount_entry *me; | 340 | struct mount_entry *me; |
346 | struct mount_entry **mtail = &mount_list; | 341 | struct mount_entry **mtail = &mount_list; |
342 | (void) need_fs_type; | ||
347 | 343 | ||
348 | #ifdef MOUNTED_LISTMNTENT | 344 | #ifdef MOUNTED_LISTMNTENT |
349 | { | 345 | { |
@@ -378,7 +374,7 @@ read_file_system_list (bool need_fs_type) | |||
378 | #ifdef MOUNTED_GETMNTENT1 /* GNU/Linux, 4.3BSD, SunOS, HP-UX, Dynix, Irix. */ | 374 | #ifdef MOUNTED_GETMNTENT1 /* GNU/Linux, 4.3BSD, SunOS, HP-UX, Dynix, Irix. */ |
379 | { | 375 | { |
380 | struct mntent *mnt; | 376 | struct mntent *mnt; |
381 | char *table = MOUNTED; | 377 | char const *table = MOUNTED; |
382 | FILE *fp; | 378 | FILE *fp; |
383 | 379 | ||
384 | fp = setmntent (table, "r"); | 380 | fp = setmntent (table, "r"); |
diff --git a/gl/regex_internal.h b/gl/regex_internal.h index ac34811..dc322ec 100644 --- a/gl/regex_internal.h +++ b/gl/regex_internal.h | |||
@@ -184,10 +184,6 @@ typedef unsigned long int bitset_word_t; | |||
184 | # if BITSET_WORD_BITS <= SBC_MAX | 184 | # if BITSET_WORD_BITS <= SBC_MAX |
185 | # error "Invalid SBC_MAX" | 185 | # error "Invalid SBC_MAX" |
186 | # endif | 186 | # endif |
187 | #elif BITSET_WORD_MAX == (0xffffffff + 2) * 0xffffffff | ||
188 | /* Work around a bug in 64-bit PGC (before version 6.1-2), where the | ||
189 | preprocessor mishandles large unsigned values as if they were signed. */ | ||
190 | # define BITSET_WORD_BITS 64 | ||
191 | #else | 187 | #else |
192 | # error "Add case for new bitset_word_t size" | 188 | # error "Add case for new bitset_word_t size" |
193 | #endif | 189 | #endif |
diff --git a/gl/stdint.in.h b/gl/stdint.in.h index f141c8f..53aa34a 100644 --- a/gl/stdint.in.h +++ b/gl/stdint.in.h | |||
@@ -435,7 +435,7 @@ typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) - | |||
435 | #undef PTRDIFF_MIN | 435 | #undef PTRDIFF_MIN |
436 | #undef PTRDIFF_MAX | 436 | #undef PTRDIFF_MAX |
437 | #if @APPLE_UNIVERSAL_BUILD@ | 437 | #if @APPLE_UNIVERSAL_BUILD@ |
438 | # if _LP64 | 438 | # ifdef _LP64 |
439 | # define PTRDIFF_MIN _STDINT_MIN (1, 64, 0l) | 439 | # define PTRDIFF_MIN _STDINT_MIN (1, 64, 0l) |
440 | # define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l) | 440 | # define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l) |
441 | # else | 441 | # else |
@@ -463,7 +463,7 @@ typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof (uintmax_t)) - | |||
463 | /* size_t limit */ | 463 | /* size_t limit */ |
464 | #undef SIZE_MAX | 464 | #undef SIZE_MAX |
465 | #if @APPLE_UNIVERSAL_BUILD@ | 465 | #if @APPLE_UNIVERSAL_BUILD@ |
466 | # if _LP64 | 466 | # ifdef _LP64 |
467 | # define SIZE_MAX _STDINT_MAX (0, 64, 0ul) | 467 | # define SIZE_MAX _STDINT_MAX (0, 64, 0ul) |
468 | # else | 468 | # else |
469 | # define SIZE_MAX _STDINT_MAX (0, 32, 0ul) | 469 | # define SIZE_MAX _STDINT_MAX (0, 32, 0ul) |
diff --git a/gl/stdio.in.h b/gl/stdio.in.h index 96cb257..cb273d7 100644 --- a/gl/stdio.in.h +++ b/gl/stdio.in.h | |||
@@ -216,6 +216,38 @@ extern int vsprintf (char *str, const char *format, va_list args) | |||
216 | vsprintf (b, f, a)) | 216 | vsprintf (b, f, a)) |
217 | #endif | 217 | #endif |
218 | 218 | ||
219 | #if @GNULIB_DPRINTF@ | ||
220 | # if @REPLACE_DPRINTF@ | ||
221 | # define dprintf rpl_dprintf | ||
222 | # endif | ||
223 | # if @REPLACE_DPRINTF@ || !@HAVE_DPRINTF@ | ||
224 | extern int dprintf (int fd, const char *format, ...) | ||
225 | __attribute__ ((__format__ (__printf__, 2, 3))); | ||
226 | # endif | ||
227 | #elif defined GNULIB_POSIXCHECK | ||
228 | # undef dprintf | ||
229 | # define dprintf(d,f,a) \ | ||
230 | (GL_LINK_WARNING ("dprintf is unportable - " \ | ||
231 | "use gnulib module dprintf for portability"), \ | ||
232 | dprintf (d, f, a)) | ||
233 | #endif | ||
234 | |||
235 | #if @GNULIB_VDPRINTF@ | ||
236 | # if @REPLACE_VDPRINTF@ | ||
237 | # define vdprintf rpl_vdprintf | ||
238 | # endif | ||
239 | # if @REPLACE_VDPRINTF@ || !@HAVE_VDPRINTF@ | ||
240 | extern int vdprintf (int fd, const char *format, va_list args) | ||
241 | __attribute__ ((__format__ (__printf__, 2, 0))); | ||
242 | # endif | ||
243 | #elif defined GNULIB_POSIXCHECK | ||
244 | # undef vdprintf | ||
245 | # define vdprintf(d,f,a) \ | ||
246 | (GL_LINK_WARNING ("vdprintf is unportable - " \ | ||
247 | "use gnulib module vdprintf for portability"), \ | ||
248 | vdprintf (d, f, a)) | ||
249 | #endif | ||
250 | |||
219 | #if @GNULIB_VASPRINTF@ | 251 | #if @GNULIB_VASPRINTF@ |
220 | # if @REPLACE_VASPRINTF@ | 252 | # if @REPLACE_VASPRINTF@ |
221 | # define asprintf rpl_asprintf | 253 | # define asprintf rpl_asprintf |
diff --git a/gl/stdlib.in.h b/gl/stdlib.in.h index 3820b10..f99767f 100644 --- a/gl/stdlib.in.h +++ b/gl/stdlib.in.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* A GNU-like <stdlib.h>. | 1 | /* A GNU-like <stdlib.h>. |
2 | 2 | ||
3 | Copyright (C) 1995, 2001-2004, 2006-2008 Free Software Foundation, Inc. | 3 | Copyright (C) 1995, 2001-2004, 2006-2009 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This program is free software: you can redistribute it and/or modify | 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 | 6 | it under the terms of the GNU General Public License as published by |
@@ -41,6 +41,12 @@ | |||
41 | # include <sys/loadavg.h> | 41 | # include <sys/loadavg.h> |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | /* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included | ||
45 | from <stdlib.h> if _REENTRANT is defined. Include it always. */ | ||
46 | #if @HAVE_RANDOM_H@ | ||
47 | # include <random.h> | ||
48 | #endif | ||
49 | |||
44 | #if @GNULIB_RANDOM_R@ || !@HAVE_STRUCT_RANDOM_DATA@ | 50 | #if @GNULIB_RANDOM_R@ || !@HAVE_STRUCT_RANDOM_DATA@ |
45 | # include <stdint.h> | 51 | # include <stdint.h> |
46 | #endif | 52 | #endif |
diff --git a/gl/strdup.c b/gl/strdup.c new file mode 100644 index 0000000..bebe5c8 --- /dev/null +++ b/gl/strdup.c | |||
@@ -0,0 +1,55 @@ | |||
1 | /* Copyright (C) 1991, 1996, 1997, 1998, 2002, 2003, 2004, 2006, 2007 Free | ||
2 | Software Foundation, Inc. | ||
3 | |||
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, or (at your option) | ||
9 | 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 along | ||
17 | with this program; if not, write to the Free Software Foundation, | ||
18 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | ||
19 | |||
20 | #ifndef _LIBC | ||
21 | # include <config.h> | ||
22 | #endif | ||
23 | |||
24 | /* Get specification. */ | ||
25 | #include <string.h> | ||
26 | |||
27 | #include <stdlib.h> | ||
28 | |||
29 | #undef __strdup | ||
30 | #ifdef _LIBC | ||
31 | # undef strdup | ||
32 | #endif | ||
33 | |||
34 | #ifndef weak_alias | ||
35 | # define __strdup strdup | ||
36 | #endif | ||
37 | |||
38 | /* Duplicate S, returning an identical malloc'd string. */ | ||
39 | char * | ||
40 | __strdup (const char *s) | ||
41 | { | ||
42 | size_t len = strlen (s) + 1; | ||
43 | void *new = malloc (len); | ||
44 | |||
45 | if (new == NULL) | ||
46 | return NULL; | ||
47 | |||
48 | return (char *) memcpy (new, s, len); | ||
49 | } | ||
50 | #ifdef libc_hidden_def | ||
51 | libc_hidden_def (__strdup) | ||
52 | #endif | ||
53 | #ifdef weak_alias | ||
54 | weak_alias (__strdup, strdup) | ||
55 | #endif | ||
diff --git a/gl/strerror.c b/gl/strerror.c index 787575f..798d854 100644 --- a/gl/strerror.c +++ b/gl/strerror.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* strerror.c --- POSIX compatible system error routine | 1 | /* strerror.c --- POSIX compatible system error routine |
2 | 2 | ||
3 | Copyright (C) 2007-2008 Free Software Foundation, Inc. | 3 | Copyright (C) 2007-2009 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This program is free software: you can redistribute it and/or modify | 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 | 6 | it under the terms of the GNU General Public License as published by |
@@ -40,94 +40,133 @@ | |||
40 | char * | 40 | char * |
41 | rpl_strerror (int n) | 41 | rpl_strerror (int n) |
42 | { | 42 | { |
43 | char const *msg = NULL; | ||
43 | /* These error messages are taken from glibc/sysdeps/gnu/errlist.c. */ | 44 | /* These error messages are taken from glibc/sysdeps/gnu/errlist.c. */ |
44 | switch (n) | 45 | switch (n) |
45 | { | 46 | { |
46 | # if GNULIB_defined_ETXTBSY | 47 | # if GNULIB_defined_ETXTBSY |
47 | case ETXTBSY: | 48 | case ETXTBSY: |
48 | return "Text file busy"; | 49 | msg = "Text file busy"; |
50 | break; | ||
49 | # endif | 51 | # endif |
50 | 52 | ||
51 | # if GNULIB_defined_ESOCK /* native Windows platforms */ | 53 | # if GNULIB_defined_ESOCK /* native Windows platforms */ |
52 | /* EWOULDBLOCK is the same as EAGAIN. */ | 54 | /* EWOULDBLOCK is the same as EAGAIN. */ |
53 | case EINPROGRESS: | 55 | case EINPROGRESS: |
54 | return "Operation now in progress"; | 56 | msg = "Operation now in progress"; |
57 | break; | ||
55 | case EALREADY: | 58 | case EALREADY: |
56 | return "Operation already in progress"; | 59 | msg = "Operation already in progress"; |
60 | break; | ||
57 | case ENOTSOCK: | 61 | case ENOTSOCK: |
58 | return "Socket operation on non-socket"; | 62 | msg = "Socket operation on non-socket"; |
63 | break; | ||
59 | case EDESTADDRREQ: | 64 | case EDESTADDRREQ: |
60 | return "Destination address required"; | 65 | msg = "Destination address required"; |
66 | break; | ||
61 | case EMSGSIZE: | 67 | case EMSGSIZE: |
62 | return "Message too long"; | 68 | msg = "Message too long"; |
69 | break; | ||
63 | case EPROTOTYPE: | 70 | case EPROTOTYPE: |
64 | return "Protocol wrong type for socket"; | 71 | msg = "Protocol wrong type for socket"; |
72 | break; | ||
65 | case ENOPROTOOPT: | 73 | case ENOPROTOOPT: |
66 | return "Protocol not available"; | 74 | msg = "Protocol not available"; |
75 | break; | ||
67 | case EPROTONOSUPPORT: | 76 | case EPROTONOSUPPORT: |
68 | return "Protocol not supported"; | 77 | msg = "Protocol not supported"; |
78 | break; | ||
69 | case ESOCKTNOSUPPORT: | 79 | case ESOCKTNOSUPPORT: |
70 | return "Socket type not supported"; | 80 | msg = "Socket type not supported"; |
81 | break; | ||
71 | case EOPNOTSUPP: | 82 | case EOPNOTSUPP: |
72 | return "Operation not supported"; | 83 | msg = "Operation not supported"; |
84 | break; | ||
73 | case EPFNOSUPPORT: | 85 | case EPFNOSUPPORT: |
74 | return "Protocol family not supported"; | 86 | msg = "Protocol family not supported"; |
87 | break; | ||
75 | case EAFNOSUPPORT: | 88 | case EAFNOSUPPORT: |
76 | return "Address family not supported by protocol"; | 89 | msg = "Address family not supported by protocol"; |
90 | break; | ||
77 | case EADDRINUSE: | 91 | case EADDRINUSE: |
78 | return "Address already in use"; | 92 | msg = "Address already in use"; |
93 | break; | ||
79 | case EADDRNOTAVAIL: | 94 | case EADDRNOTAVAIL: |
80 | return "Cannot assign requested address"; | 95 | msg = "Cannot assign requested address"; |
96 | break; | ||
81 | case ENETDOWN: | 97 | case ENETDOWN: |
82 | return "Network is down"; | 98 | msg = "Network is down"; |
99 | break; | ||
83 | case ENETUNREACH: | 100 | case ENETUNREACH: |
84 | return "Network is unreachable"; | 101 | msg = "Network is unreachable"; |
102 | break; | ||
85 | case ENETRESET: | 103 | case ENETRESET: |
86 | return "Network dropped connection on reset"; | 104 | msg = "Network dropped connection on reset"; |
105 | break; | ||
87 | case ECONNABORTED: | 106 | case ECONNABORTED: |
88 | return "Software caused connection abort"; | 107 | msg = "Software caused connection abort"; |
108 | break; | ||
89 | case ECONNRESET: | 109 | case ECONNRESET: |
90 | return "Connection reset by peer"; | 110 | msg = "Connection reset by peer"; |
111 | break; | ||
91 | case ENOBUFS: | 112 | case ENOBUFS: |
92 | return "No buffer space available"; | 113 | msg = "No buffer space available"; |
114 | break; | ||
93 | case EISCONN: | 115 | case EISCONN: |
94 | return "Transport endpoint is already connected"; | 116 | msg = "Transport endpoint is already connected"; |
117 | break; | ||
95 | case ENOTCONN: | 118 | case ENOTCONN: |
96 | return "Transport endpoint is not connected"; | 119 | msg = "Transport endpoint is not connected"; |
120 | break; | ||
97 | case ESHUTDOWN: | 121 | case ESHUTDOWN: |
98 | return "Cannot send after transport endpoint shutdown"; | 122 | msg = "Cannot send after transport endpoint shutdown"; |
123 | break; | ||
99 | case ETOOMANYREFS: | 124 | case ETOOMANYREFS: |
100 | return "Too many references: cannot splice"; | 125 | msg = "Too many references: cannot splice"; |
126 | break; | ||
101 | case ETIMEDOUT: | 127 | case ETIMEDOUT: |
102 | return "Connection timed out"; | 128 | msg = "Connection timed out"; |
129 | break; | ||
103 | case ECONNREFUSED: | 130 | case ECONNREFUSED: |
104 | return "Connection refused"; | 131 | msg = "Connection refused"; |
132 | break; | ||
105 | case ELOOP: | 133 | case ELOOP: |
106 | return "Too many levels of symbolic links"; | 134 | msg = "Too many levels of symbolic links"; |
135 | break; | ||
107 | case EHOSTDOWN: | 136 | case EHOSTDOWN: |
108 | return "Host is down"; | 137 | msg = "Host is down"; |
138 | break; | ||
109 | case EHOSTUNREACH: | 139 | case EHOSTUNREACH: |
110 | return "No route to host"; | 140 | msg = "No route to host"; |
141 | break; | ||
111 | case EPROCLIM: | 142 | case EPROCLIM: |
112 | return "Too many processes"; | 143 | msg = "Too many processes"; |
144 | break; | ||
113 | case EUSERS: | 145 | case EUSERS: |
114 | return "Too many users"; | 146 | msg = "Too many users"; |
147 | break; | ||
115 | case EDQUOT: | 148 | case EDQUOT: |
116 | return "Disk quota exceeded"; | 149 | msg = "Disk quota exceeded"; |
150 | break; | ||
117 | case ESTALE: | 151 | case ESTALE: |
118 | return "Stale NFS file handle"; | 152 | msg = "Stale NFS file handle"; |
153 | break; | ||
119 | case EREMOTE: | 154 | case EREMOTE: |
120 | return "Object is remote"; | 155 | msg = "Object is remote"; |
156 | break; | ||
121 | # if HAVE_WINSOCK2_H | 157 | # if HAVE_WINSOCK2_H |
122 | /* WSA_INVALID_HANDLE maps to EBADF */ | 158 | /* WSA_INVALID_HANDLE maps to EBADF */ |
123 | /* WSA_NOT_ENOUGH_MEMORY maps to ENOMEM */ | 159 | /* WSA_NOT_ENOUGH_MEMORY maps to ENOMEM */ |
124 | /* WSA_INVALID_PARAMETER maps to EINVAL */ | 160 | /* WSA_INVALID_PARAMETER maps to EINVAL */ |
125 | case WSA_OPERATION_ABORTED: | 161 | case WSA_OPERATION_ABORTED: |
126 | return "Overlapped operation aborted"; | 162 | msg = "Overlapped operation aborted"; |
163 | break; | ||
127 | case WSA_IO_INCOMPLETE: | 164 | case WSA_IO_INCOMPLETE: |
128 | return "Overlapped I/O event object not in signaled state"; | 165 | msg = "Overlapped I/O event object not in signaled state"; |
166 | break; | ||
129 | case WSA_IO_PENDING: | 167 | case WSA_IO_PENDING: |
130 | return "Overlapped operations will complete later"; | 168 | msg = "Overlapped operations will complete later"; |
169 | break; | ||
131 | /* WSAEINTR maps to EINTR */ | 170 | /* WSAEINTR maps to EINTR */ |
132 | /* WSAEBADF maps to EBADF */ | 171 | /* WSAEBADF maps to EBADF */ |
133 | /* WSAEACCES maps to EACCES */ | 172 | /* WSAEACCES maps to EACCES */ |
@@ -172,98 +211,127 @@ rpl_strerror (int n) | |||
172 | /* WSAESTALE is ESTALE */ | 211 | /* WSAESTALE is ESTALE */ |
173 | /* WSAEREMOTE is EREMOTE */ | 212 | /* WSAEREMOTE is EREMOTE */ |
174 | case WSASYSNOTREADY: | 213 | case WSASYSNOTREADY: |
175 | return "Network subsystem is unavailable"; | 214 | msg = "Network subsystem is unavailable"; |
215 | break; | ||
176 | case WSAVERNOTSUPPORTED: | 216 | case WSAVERNOTSUPPORTED: |
177 | return "Winsock.dll version out of range"; | 217 | msg = "Winsock.dll version out of range"; |
218 | break; | ||
178 | case WSANOTINITIALISED: | 219 | case WSANOTINITIALISED: |
179 | return "Successful WSAStartup not yet performed"; | 220 | msg = "Successful WSAStartup not yet performed"; |
221 | break; | ||
180 | case WSAEDISCON: | 222 | case WSAEDISCON: |
181 | return "Graceful shutdown in progress"; | 223 | msg = "Graceful shutdown in progress"; |
224 | break; | ||
182 | case WSAENOMORE: case WSA_E_NO_MORE: | 225 | case WSAENOMORE: case WSA_E_NO_MORE: |
183 | return "No more results"; | 226 | msg = "No more results"; |
227 | break; | ||
184 | case WSAECANCELLED: case WSA_E_CANCELLED: | 228 | case WSAECANCELLED: case WSA_E_CANCELLED: |
185 | return "Call was canceled"; | 229 | msg = "Call was canceled"; |
230 | break; | ||
186 | case WSAEINVALIDPROCTABLE: | 231 | case WSAEINVALIDPROCTABLE: |
187 | return "Procedure call table is invalid"; | 232 | msg = "Procedure call table is invalid"; |
233 | break; | ||
188 | case WSAEINVALIDPROVIDER: | 234 | case WSAEINVALIDPROVIDER: |
189 | return "Service provider is invalid"; | 235 | msg = "Service provider is invalid"; |
236 | break; | ||
190 | case WSAEPROVIDERFAILEDINIT: | 237 | case WSAEPROVIDERFAILEDINIT: |
191 | return "Service provider failed to initialize"; | 238 | msg = "Service provider failed to initialize"; |
239 | break; | ||
192 | case WSASYSCALLFAILURE: | 240 | case WSASYSCALLFAILURE: |
193 | return "System call failure"; | 241 | msg = "System call failure"; |
242 | break; | ||
194 | case WSASERVICE_NOT_FOUND: | 243 | case WSASERVICE_NOT_FOUND: |
195 | return "Service not found"; | 244 | msg = "Service not found"; |
245 | break; | ||
196 | case WSATYPE_NOT_FOUND: | 246 | case WSATYPE_NOT_FOUND: |
197 | return "Class type not found"; | 247 | msg = "Class type not found"; |
248 | break; | ||
198 | case WSAEREFUSED: | 249 | case WSAEREFUSED: |
199 | return "Database query was refused"; | 250 | msg = "Database query was refused"; |
251 | break; | ||
200 | case WSAHOST_NOT_FOUND: | 252 | case WSAHOST_NOT_FOUND: |
201 | return "Host not found"; | 253 | msg = "Host not found"; |
254 | break; | ||
202 | case WSATRY_AGAIN: | 255 | case WSATRY_AGAIN: |
203 | return "Nonauthoritative host not found"; | 256 | msg = "Nonauthoritative host not found"; |
257 | break; | ||
204 | case WSANO_RECOVERY: | 258 | case WSANO_RECOVERY: |
205 | return "Nonrecoverable error"; | 259 | msg = "Nonrecoverable error"; |
260 | break; | ||
206 | case WSANO_DATA: | 261 | case WSANO_DATA: |
207 | return "Valid name, no data record of requested type"; | 262 | msg = "Valid name, no data record of requested type"; |
263 | break; | ||
208 | /* WSA_QOS_* omitted */ | 264 | /* WSA_QOS_* omitted */ |
209 | # endif | 265 | # endif |
210 | # endif | 266 | # endif |
211 | 267 | ||
212 | # if GNULIB_defined_ENOMSG | 268 | # if GNULIB_defined_ENOMSG |
213 | case ENOMSG: | 269 | case ENOMSG: |
214 | return "No message of desired type"; | 270 | msg = "No message of desired type"; |
271 | break; | ||
215 | # endif | 272 | # endif |
216 | 273 | ||
217 | # if GNULIB_defined_EIDRM | 274 | # if GNULIB_defined_EIDRM |
218 | case EIDRM: | 275 | case EIDRM: |
219 | return "Identifier removed"; | 276 | msg = "Identifier removed"; |
277 | break; | ||
220 | # endif | 278 | # endif |
221 | 279 | ||
222 | # if GNULIB_defined_ENOLINK | 280 | # if GNULIB_defined_ENOLINK |
223 | case ENOLINK: | 281 | case ENOLINK: |
224 | return "Link has been severed"; | 282 | msg = "Link has been severed"; |
283 | break; | ||
225 | # endif | 284 | # endif |
226 | 285 | ||
227 | # if GNULIB_defined_EPROTO | 286 | # if GNULIB_defined_EPROTO |
228 | case EPROTO: | 287 | case EPROTO: |
229 | return "Protocol error"; | 288 | msg = "Protocol error"; |
289 | break; | ||
230 | # endif | 290 | # endif |
231 | 291 | ||
232 | # if GNULIB_defined_EMULTIHOP | 292 | # if GNULIB_defined_EMULTIHOP |
233 | case EMULTIHOP: | 293 | case EMULTIHOP: |
234 | return "Multihop attempted"; | 294 | msg = "Multihop attempted"; |
295 | break; | ||
235 | # endif | 296 | # endif |
236 | 297 | ||
237 | # if GNULIB_defined_EBADMSG | 298 | # if GNULIB_defined_EBADMSG |
238 | case EBADMSG: | 299 | case EBADMSG: |
239 | return "Bad message"; | 300 | msg = "Bad message"; |
301 | break; | ||
240 | # endif | 302 | # endif |
241 | 303 | ||
242 | # if GNULIB_defined_EOVERFLOW | 304 | # if GNULIB_defined_EOVERFLOW |
243 | case EOVERFLOW: | 305 | case EOVERFLOW: |
244 | return "Value too large for defined data type"; | 306 | msg = "Value too large for defined data type"; |
307 | break; | ||
245 | # endif | 308 | # endif |
246 | 309 | ||
247 | # if GNULIB_defined_ENOTSUP | 310 | # if GNULIB_defined_ENOTSUP |
248 | case ENOTSUP: | 311 | case ENOTSUP: |
249 | return "Not supported"; | 312 | msg = "Not supported"; |
313 | break; | ||
250 | # endif | 314 | # endif |
251 | 315 | ||
252 | # if GNULIB_defined_ | 316 | # if GNULIB_defined_ |
253 | case ECANCELED: | 317 | case ECANCELED: |
254 | return "Operation canceled"; | 318 | msg = "Operation canceled"; |
319 | break; | ||
255 | # endif | 320 | # endif |
256 | } | 321 | } |
257 | 322 | ||
323 | if (msg) | ||
324 | return (char *) msg; | ||
325 | |||
258 | { | 326 | { |
259 | char *result = strerror (n); | 327 | char *result = strerror (n); |
260 | 328 | ||
261 | if (result == NULL || result[0] == '\0') | 329 | if (result == NULL || result[0] == '\0') |
262 | { | 330 | { |
263 | static char const fmt[] = "Unknown error (%d)"; | 331 | static char const fmt[] = "Unknown error (%d)"; |
264 | static char mesg[sizeof fmt + INT_STRLEN_BOUND (n)]; | 332 | static char msg_buf[sizeof fmt + INT_STRLEN_BOUND (n)]; |
265 | sprintf (mesg, fmt, n); | 333 | sprintf (msg_buf, fmt, n); |
266 | return mesg; | 334 | return msg_buf; |
267 | } | 335 | } |
268 | 336 | ||
269 | return result; | 337 | return result; |
diff --git a/gl/sys_socket.in.h b/gl/sys_socket.in.h index 5d9b3cd..dadd56a 100644 --- a/gl/sys_socket.in.h +++ b/gl/sys_socket.in.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* Provide a sys/socket header file for systems lacking it (read: MinGW) | 1 | /* Provide a sys/socket header file for systems lacking it (read: MinGW) |
2 | and for systems where it is incomplete. | 2 | and for systems where it is incomplete. |
3 | Copyright (C) 2005-2008 Free Software Foundation, Inc. | 3 | Copyright (C) 2005-2009 Free Software Foundation, Inc. |
4 | Written by Simon Josefsson. | 4 | Written by Simon Josefsson. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
@@ -43,6 +43,26 @@ | |||
43 | #ifndef _GL_SYS_SOCKET_H | 43 | #ifndef _GL_SYS_SOCKET_H |
44 | #define _GL_SYS_SOCKET_H | 44 | #define _GL_SYS_SOCKET_H |
45 | 45 | ||
46 | #if !@HAVE_STRUCT_SOCKADDR_STORAGE@ | ||
47 | # include <alignof.h> | ||
48 | /* Code taken from glibc sysdeps/unix/sysv/linux/bits/socket.h on | ||
49 | 2009-05-08, licensed under LGPLv2.1+, plus portability fixes. */ | ||
50 | # define __ss_aligntype unsigned long int | ||
51 | # define _SS_SIZE 256 | ||
52 | # define _SS_PADSIZE \ | ||
53 | (_SS_SIZE - ((sizeof (sa_family_t) >= alignof (__ss_aligntype) \ | ||
54 | ? sizeof (sa_family_t) \ | ||
55 | : alignof (__ss_aligntype)) \ | ||
56 | + sizeof (__ss_aligntype))) | ||
57 | |||
58 | struct sockaddr_storage | ||
59 | { | ||
60 | sa_family_t ss_family; /* Address family, etc. */ | ||
61 | __ss_aligntype __ss_align; /* Force desired alignment. */ | ||
62 | char __ss_padding[_SS_PADSIZE]; | ||
63 | }; | ||
64 | #endif | ||
65 | |||
46 | #if @HAVE_SYS_SOCKET_H@ | 66 | #if @HAVE_SYS_SOCKET_H@ |
47 | 67 | ||
48 | /* A platform that has <sys/socket.h>. */ | 68 | /* A platform that has <sys/socket.h>. */ |
@@ -256,7 +276,7 @@ extern int rpl_getsockname (int, struct sockaddr *, int *); | |||
256 | # if @HAVE_WINSOCK2_H@ | 276 | # if @HAVE_WINSOCK2_H@ |
257 | # undef getsockopt | 277 | # undef getsockopt |
258 | # define getsockopt rpl_getsockopt | 278 | # define getsockopt rpl_getsockopt |
259 | extern int rpl_getsockopt (int, int, int, void *, int *); | 279 | extern int rpl_getsockopt (int, int, int, void *, socklen_t *); |
260 | # endif | 280 | # endif |
261 | # elif @HAVE_WINSOCK2_H@ | 281 | # elif @HAVE_WINSOCK2_H@ |
262 | # undef getsockopt | 282 | # undef getsockopt |
@@ -358,7 +378,7 @@ extern int rpl_sendto (int, const void *, int, int, struct sockaddr *, int); | |||
358 | # if @HAVE_WINSOCK2_H@ | 378 | # if @HAVE_WINSOCK2_H@ |
359 | # undef setsockopt | 379 | # undef setsockopt |
360 | # define setsockopt rpl_setsockopt | 380 | # define setsockopt rpl_setsockopt |
361 | extern int rpl_setsockopt (int, int, int, const void *, int); | 381 | extern int rpl_setsockopt (int, int, int, const void *, socklen_t); |
362 | # endif | 382 | # endif |
363 | # elif @HAVE_WINSOCK2_H@ | 383 | # elif @HAVE_WINSOCK2_H@ |
364 | # undef setsockopt | 384 | # undef setsockopt |
diff --git a/gl/unistd.in.h b/gl/unistd.in.h index 1b2f80e..fa8d84a 100644 --- a/gl/unistd.in.h +++ b/gl/unistd.in.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Substitute for and wrapper around <unistd.h>. | 1 | /* Substitute for and wrapper around <unistd.h>. |
2 | Copyright (C) 2003-2008 Free Software Foundation, Inc. | 2 | Copyright (C) 2003-2009 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This program is free software; you can redistribute it and/or modify | 4 | This program is free software; you can redistribute it and/or modify |
5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
@@ -29,7 +29,7 @@ | |||
29 | #ifndef _GL_UNISTD_H | 29 | #ifndef _GL_UNISTD_H |
30 | #define _GL_UNISTD_H | 30 | #define _GL_UNISTD_H |
31 | 31 | ||
32 | /* mingw doesn't define the SEEK_* macros in <unistd.h>. */ | 32 | /* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>. */ |
33 | #if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) | 33 | #if !(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) |
34 | # include <stdio.h> | 34 | # include <stdio.h> |
35 | #endif | 35 | #endif |
@@ -87,6 +87,17 @@ | |||
87 | /* The definition of GL_LINK_WARNING is copied here. */ | 87 | /* The definition of GL_LINK_WARNING is copied here. */ |
88 | 88 | ||
89 | 89 | ||
90 | /* OS/2 EMX lacks these macros. */ | ||
91 | #ifndef STDIN_FILENO | ||
92 | # define STDIN_FILENO 0 | ||
93 | #endif | ||
94 | #ifndef STDOUT_FILENO | ||
95 | # define STDOUT_FILENO 1 | ||
96 | #endif | ||
97 | #ifndef STDERR_FILENO | ||
98 | # define STDERR_FILENO 2 | ||
99 | #endif | ||
100 | |||
90 | /* Declare overridden functions. */ | 101 | /* Declare overridden functions. */ |
91 | 102 | ||
92 | #ifdef __cplusplus | 103 | #ifdef __cplusplus |
@@ -120,10 +131,6 @@ extern int chown (const char *file, uid_t uid, gid_t gid); | |||
120 | 131 | ||
121 | 132 | ||
122 | #if @GNULIB_CLOSE@ | 133 | #if @GNULIB_CLOSE@ |
123 | # if @UNISTD_H_HAVE_WINSOCK2_H@ | ||
124 | /* Need a gnulib internal function. */ | ||
125 | # define HAVE__GL_CLOSE_FD_MAYBE_SOCKET 1 | ||
126 | # endif | ||
127 | # if @REPLACE_CLOSE@ | 134 | # if @REPLACE_CLOSE@ |
128 | /* Automatically included by modules that need a replacement for close. */ | 135 | /* Automatically included by modules that need a replacement for close. */ |
129 | # undef close | 136 | # undef close |
@@ -475,6 +482,23 @@ extern int lchown (char const *file, uid_t owner, gid_t group); | |||
475 | #endif | 482 | #endif |
476 | 483 | ||
477 | 484 | ||
485 | #if @GNULIB_LINK@ | ||
486 | /* Create a new hard link for an existing file. | ||
487 | Return 0 if successful, otherwise -1 and errno set. | ||
488 | See POSIX:2001 specification | ||
489 | <http://www.opengroup.org/susv3xsh/link.html>. */ | ||
490 | # if !@HAVE_LINK@ | ||
491 | extern int link (const char *path1, const char *path2); | ||
492 | # endif | ||
493 | #elif defined GNULIB_POSIXCHECK | ||
494 | # undef link | ||
495 | # define link(path1,path2) \ | ||
496 | (GL_LINK_WARNING ("link is unportable - " \ | ||
497 | "use gnulib module link for portability"), \ | ||
498 | link (path1, path2)) | ||
499 | #endif | ||
500 | |||
501 | |||
478 | #if @GNULIB_LSEEK@ | 502 | #if @GNULIB_LSEEK@ |
479 | # if @REPLACE_LSEEK@ | 503 | # if @REPLACE_LSEEK@ |
480 | /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END. | 504 | /* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END. |
diff --git a/gl/vasnprintf.c b/gl/vasnprintf.c index 93aef6f..7ac9f43 100644 --- a/gl/vasnprintf.c +++ b/gl/vasnprintf.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* vsprintf with automatic memory allocation. | 1 | /* vsprintf with automatic memory allocation. |
2 | Copyright (C) 1999, 2002-2008 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2002-2009 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This program is free software; you can redistribute it and/or modify | 4 | This program is free software; you can redistribute it and/or modify |
5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
@@ -117,29 +117,6 @@ | |||
117 | # include "fpucw.h" | 117 | # include "fpucw.h" |
118 | #endif | 118 | #endif |
119 | 119 | ||
120 | #if HAVE_WCHAR_T | ||
121 | # if HAVE_WCSLEN | ||
122 | # define local_wcslen wcslen | ||
123 | # else | ||
124 | /* Solaris 2.5.1 has wcslen() in a separate library libw.so. To avoid | ||
125 | a dependency towards this library, here is a local substitute. | ||
126 | Define this substitute only once, even if this file is included | ||
127 | twice in the same compilation unit. */ | ||
128 | # ifndef local_wcslen_defined | ||
129 | # define local_wcslen_defined 1 | ||
130 | static size_t | ||
131 | local_wcslen (const wchar_t *s) | ||
132 | { | ||
133 | const wchar_t *ptr; | ||
134 | |||
135 | for (ptr = s; *ptr != (wchar_t) 0; ptr++) | ||
136 | ; | ||
137 | return ptr - s; | ||
138 | } | ||
139 | # endif | ||
140 | # endif | ||
141 | #endif | ||
142 | |||
143 | /* Default parameters. */ | 120 | /* Default parameters. */ |
144 | #ifndef VASNPRINTF | 121 | #ifndef VASNPRINTF |
145 | # if WIDE_CHAR_VERSION | 122 | # if WIDE_CHAR_VERSION |
@@ -152,6 +129,7 @@ local_wcslen (const wchar_t *s) | |||
152 | # define DIRECTIVES wchar_t_directives | 129 | # define DIRECTIVES wchar_t_directives |
153 | # define PRINTF_PARSE wprintf_parse | 130 | # define PRINTF_PARSE wprintf_parse |
154 | # define DCHAR_CPY wmemcpy | 131 | # define DCHAR_CPY wmemcpy |
132 | # define DCHAR_SET wmemset | ||
155 | # else | 133 | # else |
156 | # define VASNPRINTF vasnprintf | 134 | # define VASNPRINTF vasnprintf |
157 | # define FCHAR_T char | 135 | # define FCHAR_T char |
@@ -162,6 +140,7 @@ local_wcslen (const wchar_t *s) | |||
162 | # define DIRECTIVES char_directives | 140 | # define DIRECTIVES char_directives |
163 | # define PRINTF_PARSE printf_parse | 141 | # define PRINTF_PARSE printf_parse |
164 | # define DCHAR_CPY memcpy | 142 | # define DCHAR_CPY memcpy |
143 | # define DCHAR_SET memset | ||
165 | # endif | 144 | # endif |
166 | #endif | 145 | #endif |
167 | #if WIDE_CHAR_VERSION | 146 | #if WIDE_CHAR_VERSION |
@@ -215,6 +194,64 @@ local_wcslen (const wchar_t *s) | |||
215 | #undef remainder | 194 | #undef remainder |
216 | #define remainder rem | 195 | #define remainder rem |
217 | 196 | ||
197 | #if !USE_SNPRINTF && !WIDE_CHAR_VERSION | ||
198 | # if (HAVE_STRNLEN && !defined _AIX) | ||
199 | # define local_strnlen strnlen | ||
200 | # else | ||
201 | # ifndef local_strnlen_defined | ||
202 | # define local_strnlen_defined 1 | ||
203 | static size_t | ||
204 | local_strnlen (const char *string, size_t maxlen) | ||
205 | { | ||
206 | const char *end = memchr (string, '\0', maxlen); | ||
207 | return end ? (size_t) (end - string) : maxlen; | ||
208 | } | ||
209 | # endif | ||
210 | # endif | ||
211 | #endif | ||
212 | |||
213 | #if (!USE_SNPRINTF || (NEED_PRINTF_DIRECTIVE_LS && !defined IN_LIBINTL)) && HAVE_WCHAR_T && (WIDE_CHAR_VERSION || DCHAR_IS_TCHAR) | ||
214 | # if HAVE_WCSLEN | ||
215 | # define local_wcslen wcslen | ||
216 | # else | ||
217 | /* Solaris 2.5.1 has wcslen() in a separate library libw.so. To avoid | ||
218 | a dependency towards this library, here is a local substitute. | ||
219 | Define this substitute only once, even if this file is included | ||
220 | twice in the same compilation unit. */ | ||
221 | # ifndef local_wcslen_defined | ||
222 | # define local_wcslen_defined 1 | ||
223 | static size_t | ||
224 | local_wcslen (const wchar_t *s) | ||
225 | { | ||
226 | const wchar_t *ptr; | ||
227 | |||
228 | for (ptr = s; *ptr != (wchar_t) 0; ptr++) | ||
229 | ; | ||
230 | return ptr - s; | ||
231 | } | ||
232 | # endif | ||
233 | # endif | ||
234 | #endif | ||
235 | |||
236 | #if !USE_SNPRINTF && HAVE_WCHAR_T && WIDE_CHAR_VERSION | ||
237 | # if HAVE_WCSNLEN | ||
238 | # define local_wcsnlen wcsnlen | ||
239 | # else | ||
240 | # ifndef local_wcsnlen_defined | ||
241 | # define local_wcsnlen_defined 1 | ||
242 | static size_t | ||
243 | local_wcsnlen (const wchar_t *s, size_t maxlen) | ||
244 | { | ||
245 | const wchar_t *ptr; | ||
246 | |||
247 | for (ptr = s; maxlen > 0 && *ptr != (wchar_t) 0; ptr++, maxlen--) | ||
248 | ; | ||
249 | return ptr - s; | ||
250 | } | ||
251 | # endif | ||
252 | # endif | ||
253 | #endif | ||
254 | |||
218 | #if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL | 255 | #if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_DOUBLE || NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL |
219 | /* Determine the decimal-point character according to the current locale. */ | 256 | /* Determine the decimal-point character according to the current locale. */ |
220 | # ifndef decimal_point_char_defined | 257 | # ifndef decimal_point_char_defined |
@@ -376,7 +413,7 @@ divide (mpn_t a, mpn_t b, mpn_t *q) | |||
376 | Normalise [q[m-1],...,q[0]], yields q. | 413 | Normalise [q[m-1],...,q[0]], yields q. |
377 | If m>=n>1, perform a multiple-precision division: | 414 | If m>=n>1, perform a multiple-precision division: |
378 | We have a/b < beta^(m-n+1). | 415 | We have a/b < beta^(m-n+1). |
379 | s:=intDsize-1-(hightest bit in b[n-1]), 0<=s<intDsize. | 416 | s:=intDsize-1-(highest bit in b[n-1]), 0<=s<intDsize. |
380 | Shift a and b left by s bits, copying them. r:=a. | 417 | Shift a and b left by s bits, copying them. r:=a. |
381 | r=[r[m],...,r[0]], b=[b[n-1],...,b[0]] with b[n-1]>=beta/2. | 418 | r=[r[m],...,r[0]], b=[b[n-1],...,b[0]] with b[n-1]>=beta/2. |
382 | For j=m-n,...,0: {Here 0 <= r < b*beta^(j+1).} | 419 | For j=m-n,...,0: {Here 0 <= r < b*beta^(j+1).} |
@@ -1762,18 +1799,18 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
1762 | size_t converted_len = allocated - length; | 1799 | size_t converted_len = allocated - length; |
1763 | # if DCHAR_IS_TCHAR | 1800 | # if DCHAR_IS_TCHAR |
1764 | /* Convert from UTF-8 to locale encoding. */ | 1801 | /* Convert from UTF-8 to locale encoding. */ |
1765 | if (u8_conv_to_encoding (locale_charset (), | 1802 | converted = |
1766 | iconveh_question_mark, | 1803 | u8_conv_to_encoding (locale_charset (), |
1767 | arg, arg_end - arg, NULL, | 1804 | iconveh_question_mark, |
1768 | &converted, &converted_len) | 1805 | arg, arg_end - arg, NULL, |
1769 | < 0) | 1806 | converted, &converted_len); |
1770 | # else | 1807 | # else |
1771 | /* Convert from UTF-8 to UTF-16/UTF-32. */ | 1808 | /* Convert from UTF-8 to UTF-16/UTF-32. */ |
1772 | converted = | 1809 | converted = |
1773 | U8_TO_DCHAR (arg, arg_end - arg, | 1810 | U8_TO_DCHAR (arg, arg_end - arg, |
1774 | converted, &converted_len); | 1811 | converted, &converted_len); |
1775 | if (converted == NULL) | ||
1776 | # endif | 1812 | # endif |
1813 | if (converted == NULL) | ||
1777 | { | 1814 | { |
1778 | int saved_errno = errno; | 1815 | int saved_errno = errno; |
1779 | if (!(result == resultbuf || result == NULL)) | 1816 | if (!(result == resultbuf || result == NULL)) |
@@ -1890,18 +1927,18 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
1890 | size_t converted_len = allocated - length; | 1927 | size_t converted_len = allocated - length; |
1891 | # if DCHAR_IS_TCHAR | 1928 | # if DCHAR_IS_TCHAR |
1892 | /* Convert from UTF-16 to locale encoding. */ | 1929 | /* Convert from UTF-16 to locale encoding. */ |
1893 | if (u16_conv_to_encoding (locale_charset (), | 1930 | converted = |
1894 | iconveh_question_mark, | 1931 | u16_conv_to_encoding (locale_charset (), |
1895 | arg, arg_end - arg, NULL, | 1932 | iconveh_question_mark, |
1896 | &converted, &converted_len) | 1933 | arg, arg_end - arg, NULL, |
1897 | < 0) | 1934 | converted, &converted_len); |
1898 | # else | 1935 | # else |
1899 | /* Convert from UTF-16 to UTF-8/UTF-32. */ | 1936 | /* Convert from UTF-16 to UTF-8/UTF-32. */ |
1900 | converted = | 1937 | converted = |
1901 | U16_TO_DCHAR (arg, arg_end - arg, | 1938 | U16_TO_DCHAR (arg, arg_end - arg, |
1902 | converted, &converted_len); | 1939 | converted, &converted_len); |
1903 | if (converted == NULL) | ||
1904 | # endif | 1940 | # endif |
1941 | if (converted == NULL) | ||
1905 | { | 1942 | { |
1906 | int saved_errno = errno; | 1943 | int saved_errno = errno; |
1907 | if (!(result == resultbuf || result == NULL)) | 1944 | if (!(result == resultbuf || result == NULL)) |
@@ -2018,18 +2055,18 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
2018 | size_t converted_len = allocated - length; | 2055 | size_t converted_len = allocated - length; |
2019 | # if DCHAR_IS_TCHAR | 2056 | # if DCHAR_IS_TCHAR |
2020 | /* Convert from UTF-32 to locale encoding. */ | 2057 | /* Convert from UTF-32 to locale encoding. */ |
2021 | if (u32_conv_to_encoding (locale_charset (), | 2058 | converted = |
2022 | iconveh_question_mark, | 2059 | u32_conv_to_encoding (locale_charset (), |
2023 | arg, arg_end - arg, NULL, | 2060 | iconveh_question_mark, |
2024 | &converted, &converted_len) | 2061 | arg, arg_end - arg, NULL, |
2025 | < 0) | 2062 | converted, &converted_len); |
2026 | # else | 2063 | # else |
2027 | /* Convert from UTF-32 to UTF-8/UTF-16. */ | 2064 | /* Convert from UTF-32 to UTF-8/UTF-16. */ |
2028 | converted = | 2065 | converted = |
2029 | U32_TO_DCHAR (arg, arg_end - arg, | 2066 | U32_TO_DCHAR (arg, arg_end - arg, |
2030 | converted, &converted_len); | 2067 | converted, &converted_len); |
2031 | if (converted == NULL) | ||
2032 | # endif | 2068 | # endif |
2069 | if (converted == NULL) | ||
2033 | { | 2070 | { |
2034 | int saved_errno = errno; | 2071 | int saved_errno = errno; |
2035 | if (!(result == resultbuf || result == NULL)) | 2072 | if (!(result == resultbuf || result == NULL)) |
@@ -2066,6 +2103,522 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
2066 | } | 2103 | } |
2067 | } | 2104 | } |
2068 | #endif | 2105 | #endif |
2106 | #if (!USE_SNPRINTF || (NEED_PRINTF_DIRECTIVE_LS && !defined IN_LIBINTL)) && HAVE_WCHAR_T | ||
2107 | else if (dp->conversion == 's' | ||
2108 | # if WIDE_CHAR_VERSION | ||
2109 | && a.arg[dp->arg_index].type != TYPE_WIDE_STRING | ||
2110 | # else | ||
2111 | && a.arg[dp->arg_index].type == TYPE_WIDE_STRING | ||
2112 | # endif | ||
2113 | ) | ||
2114 | { | ||
2115 | /* The normal handling of the 's' directive below requires | ||
2116 | allocating a temporary buffer. The determination of its | ||
2117 | length (tmp_length), in the case when a precision is | ||
2118 | specified, below requires a conversion between a char[] | ||
2119 | string and a wchar_t[] wide string. It could be done, but | ||
2120 | we have no guarantee that the implementation of sprintf will | ||
2121 | use the exactly same algorithm. Without this guarantee, it | ||
2122 | is possible to have buffer overrun bugs. In order to avoid | ||
2123 | such bugs, we implement the entire processing of the 's' | ||
2124 | directive ourselves. */ | ||
2125 | int flags = dp->flags; | ||
2126 | int has_width; | ||
2127 | size_t width; | ||
2128 | int has_precision; | ||
2129 | size_t precision; | ||
2130 | |||
2131 | has_width = 0; | ||
2132 | width = 0; | ||
2133 | if (dp->width_start != dp->width_end) | ||
2134 | { | ||
2135 | if (dp->width_arg_index != ARG_NONE) | ||
2136 | { | ||
2137 | int arg; | ||
2138 | |||
2139 | if (!(a.arg[dp->width_arg_index].type == TYPE_INT)) | ||
2140 | abort (); | ||
2141 | arg = a.arg[dp->width_arg_index].a.a_int; | ||
2142 | if (arg < 0) | ||
2143 | { | ||
2144 | /* "A negative field width is taken as a '-' flag | ||
2145 | followed by a positive field width." */ | ||
2146 | flags |= FLAG_LEFT; | ||
2147 | width = (unsigned int) (-arg); | ||
2148 | } | ||
2149 | else | ||
2150 | width = arg; | ||
2151 | } | ||
2152 | else | ||
2153 | { | ||
2154 | const FCHAR_T *digitp = dp->width_start; | ||
2155 | |||
2156 | do | ||
2157 | width = xsum (xtimes (width, 10), *digitp++ - '0'); | ||
2158 | while (digitp != dp->width_end); | ||
2159 | } | ||
2160 | has_width = 1; | ||
2161 | } | ||
2162 | |||
2163 | has_precision = 0; | ||
2164 | precision = 6; | ||
2165 | if (dp->precision_start != dp->precision_end) | ||
2166 | { | ||
2167 | if (dp->precision_arg_index != ARG_NONE) | ||
2168 | { | ||
2169 | int arg; | ||
2170 | |||
2171 | if (!(a.arg[dp->precision_arg_index].type == TYPE_INT)) | ||
2172 | abort (); | ||
2173 | arg = a.arg[dp->precision_arg_index].a.a_int; | ||
2174 | /* "A negative precision is taken as if the precision | ||
2175 | were omitted." */ | ||
2176 | if (arg >= 0) | ||
2177 | { | ||
2178 | precision = arg; | ||
2179 | has_precision = 1; | ||
2180 | } | ||
2181 | } | ||
2182 | else | ||
2183 | { | ||
2184 | const FCHAR_T *digitp = dp->precision_start + 1; | ||
2185 | |||
2186 | precision = 0; | ||
2187 | while (digitp != dp->precision_end) | ||
2188 | precision = xsum (xtimes (precision, 10), *digitp++ - '0'); | ||
2189 | has_precision = 1; | ||
2190 | } | ||
2191 | } | ||
2192 | |||
2193 | # if WIDE_CHAR_VERSION | ||
2194 | /* %s in vasnwprintf. See the specification of fwprintf. */ | ||
2195 | { | ||
2196 | const char *arg = a.arg[dp->arg_index].a.a_string; | ||
2197 | const char *arg_end; | ||
2198 | size_t characters; | ||
2199 | |||
2200 | if (has_precision) | ||
2201 | { | ||
2202 | /* Use only as many bytes as needed to produce PRECISION | ||
2203 | wide characters, from the left. */ | ||
2204 | # if HAVE_MBRTOWC | ||
2205 | mbstate_t state; | ||
2206 | memset (&state, '\0', sizeof (mbstate_t)); | ||
2207 | # endif | ||
2208 | arg_end = arg; | ||
2209 | characters = 0; | ||
2210 | for (; precision > 0; precision--) | ||
2211 | { | ||
2212 | int count; | ||
2213 | # if HAVE_MBRTOWC | ||
2214 | count = mbrlen (arg_end, MB_CUR_MAX, &state); | ||
2215 | # else | ||
2216 | count = mblen (arg_end, MB_CUR_MAX); | ||
2217 | # endif | ||
2218 | if (count == 0) | ||
2219 | /* Found the terminating NUL. */ | ||
2220 | break; | ||
2221 | if (count < 0) | ||
2222 | { | ||
2223 | /* Invalid or incomplete multibyte character. */ | ||
2224 | if (!(result == resultbuf || result == NULL)) | ||
2225 | free (result); | ||
2226 | if (buf_malloced != NULL) | ||
2227 | free (buf_malloced); | ||
2228 | CLEANUP (); | ||
2229 | errno = EILSEQ; | ||
2230 | return NULL; | ||
2231 | } | ||
2232 | arg_end += count; | ||
2233 | characters++; | ||
2234 | } | ||
2235 | } | ||
2236 | else if (has_width) | ||
2237 | { | ||
2238 | /* Use the entire string, and count the number of wide | ||
2239 | characters. */ | ||
2240 | # if HAVE_MBRTOWC | ||
2241 | mbstate_t state; | ||
2242 | memset (&state, '\0', sizeof (mbstate_t)); | ||
2243 | # endif | ||
2244 | arg_end = arg; | ||
2245 | characters = 0; | ||
2246 | for (;;) | ||
2247 | { | ||
2248 | int count; | ||
2249 | # if HAVE_MBRTOWC | ||
2250 | count = mbrlen (arg_end, MB_CUR_MAX, &state); | ||
2251 | # else | ||
2252 | count = mblen (arg_end, MB_CUR_MAX); | ||
2253 | # endif | ||
2254 | if (count == 0) | ||
2255 | /* Found the terminating NUL. */ | ||
2256 | break; | ||
2257 | if (count < 0) | ||
2258 | { | ||
2259 | /* Invalid or incomplete multibyte character. */ | ||
2260 | if (!(result == resultbuf || result == NULL)) | ||
2261 | free (result); | ||
2262 | if (buf_malloced != NULL) | ||
2263 | free (buf_malloced); | ||
2264 | CLEANUP (); | ||
2265 | errno = EILSEQ; | ||
2266 | return NULL; | ||
2267 | } | ||
2268 | arg_end += count; | ||
2269 | characters++; | ||
2270 | } | ||
2271 | } | ||
2272 | else | ||
2273 | { | ||
2274 | /* Use the entire string. */ | ||
2275 | arg_end = arg + strlen (arg); | ||
2276 | /* The number of characters doesn't matter. */ | ||
2277 | characters = 0; | ||
2278 | } | ||
2279 | |||
2280 | if (has_width && width > characters | ||
2281 | && !(dp->flags & FLAG_LEFT)) | ||
2282 | { | ||
2283 | size_t n = width - characters; | ||
2284 | ENSURE_ALLOCATION (xsum (length, n)); | ||
2285 | DCHAR_SET (result + length, ' ', n); | ||
2286 | length += n; | ||
2287 | } | ||
2288 | |||
2289 | if (has_precision || has_width) | ||
2290 | { | ||
2291 | /* We know the number of wide characters in advance. */ | ||
2292 | size_t remaining; | ||
2293 | # if HAVE_MBRTOWC | ||
2294 | mbstate_t state; | ||
2295 | memset (&state, '\0', sizeof (mbstate_t)); | ||
2296 | # endif | ||
2297 | ENSURE_ALLOCATION (xsum (length, characters)); | ||
2298 | for (remaining = characters; remaining > 0; remaining--) | ||
2299 | { | ||
2300 | wchar_t wc; | ||
2301 | int count; | ||
2302 | # if HAVE_MBRTOWC | ||
2303 | count = mbrtowc (&wc, arg, arg_end - arg, &state); | ||
2304 | # else | ||
2305 | count = mbtowc (&wc, arg, arg_end - arg); | ||
2306 | # endif | ||
2307 | if (count <= 0) | ||
2308 | /* mbrtowc not consistent with mbrlen, or mbtowc | ||
2309 | not consistent with mblen. */ | ||
2310 | abort (); | ||
2311 | result[length++] = wc; | ||
2312 | arg += count; | ||
2313 | } | ||
2314 | if (!(arg == arg_end)) | ||
2315 | abort (); | ||
2316 | } | ||
2317 | else | ||
2318 | { | ||
2319 | # if HAVE_MBRTOWC | ||
2320 | mbstate_t state; | ||
2321 | memset (&state, '\0', sizeof (mbstate_t)); | ||
2322 | # endif | ||
2323 | while (arg < arg_end) | ||
2324 | { | ||
2325 | wchar_t wc; | ||
2326 | int count; | ||
2327 | # if HAVE_MBRTOWC | ||
2328 | count = mbrtowc (&wc, arg, arg_end - arg, &state); | ||
2329 | # else | ||
2330 | count = mbtowc (&wc, arg, arg_end - arg); | ||
2331 | # endif | ||
2332 | if (count <= 0) | ||
2333 | /* mbrtowc not consistent with mbrlen, or mbtowc | ||
2334 | not consistent with mblen. */ | ||
2335 | abort (); | ||
2336 | ENSURE_ALLOCATION (xsum (length, 1)); | ||
2337 | result[length++] = wc; | ||
2338 | arg += count; | ||
2339 | } | ||
2340 | } | ||
2341 | |||
2342 | if (has_width && width > characters | ||
2343 | && (dp->flags & FLAG_LEFT)) | ||
2344 | { | ||
2345 | size_t n = width - characters; | ||
2346 | ENSURE_ALLOCATION (xsum (length, n)); | ||
2347 | DCHAR_SET (result + length, ' ', n); | ||
2348 | length += n; | ||
2349 | } | ||
2350 | } | ||
2351 | # else | ||
2352 | /* %ls in vasnprintf. See the specification of fprintf. */ | ||
2353 | { | ||
2354 | const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string; | ||
2355 | const wchar_t *arg_end; | ||
2356 | size_t characters; | ||
2357 | # if !DCHAR_IS_TCHAR | ||
2358 | /* This code assumes that TCHAR_T is 'char'. */ | ||
2359 | typedef int TCHAR_T_verify[2 * (sizeof (TCHAR_T) == 1) - 1]; | ||
2360 | TCHAR_T *tmpsrc; | ||
2361 | DCHAR_T *tmpdst; | ||
2362 | size_t tmpdst_len; | ||
2363 | # endif | ||
2364 | size_t w; | ||
2365 | |||
2366 | if (has_precision) | ||
2367 | { | ||
2368 | /* Use only as many wide characters as needed to produce | ||
2369 | at most PRECISION bytes, from the left. */ | ||
2370 | # if HAVE_WCRTOMB | ||
2371 | mbstate_t state; | ||
2372 | memset (&state, '\0', sizeof (mbstate_t)); | ||
2373 | # endif | ||
2374 | arg_end = arg; | ||
2375 | characters = 0; | ||
2376 | while (precision > 0) | ||
2377 | { | ||
2378 | char buf[64]; /* Assume MB_CUR_MAX <= 64. */ | ||
2379 | int count; | ||
2380 | |||
2381 | if (*arg_end == 0) | ||
2382 | /* Found the terminating null wide character. */ | ||
2383 | break; | ||
2384 | # if HAVE_WCRTOMB | ||
2385 | count = wcrtomb (buf, *arg_end, &state); | ||
2386 | # else | ||
2387 | count = wctomb (buf, *arg_end); | ||
2388 | # endif | ||
2389 | if (count < 0) | ||
2390 | { | ||
2391 | /* Cannot convert. */ | ||
2392 | if (!(result == resultbuf || result == NULL)) | ||
2393 | free (result); | ||
2394 | if (buf_malloced != NULL) | ||
2395 | free (buf_malloced); | ||
2396 | CLEANUP (); | ||
2397 | errno = EILSEQ; | ||
2398 | return NULL; | ||
2399 | } | ||
2400 | if (precision < count) | ||
2401 | break; | ||
2402 | arg_end++; | ||
2403 | characters += count; | ||
2404 | precision -= count; | ||
2405 | } | ||
2406 | } | ||
2407 | # if DCHAR_IS_TCHAR | ||
2408 | else if (has_width) | ||
2409 | # else | ||
2410 | else | ||
2411 | # endif | ||
2412 | { | ||
2413 | /* Use the entire string, and count the number of | ||
2414 | bytes. */ | ||
2415 | # if HAVE_WCRTOMB | ||
2416 | mbstate_t state; | ||
2417 | memset (&state, '\0', sizeof (mbstate_t)); | ||
2418 | # endif | ||
2419 | arg_end = arg; | ||
2420 | characters = 0; | ||
2421 | for (;;) | ||
2422 | { | ||
2423 | char buf[64]; /* Assume MB_CUR_MAX <= 64. */ | ||
2424 | int count; | ||
2425 | |||
2426 | if (*arg_end == 0) | ||
2427 | /* Found the terminating null wide character. */ | ||
2428 | break; | ||
2429 | # if HAVE_WCRTOMB | ||
2430 | count = wcrtomb (buf, *arg_end, &state); | ||
2431 | # else | ||
2432 | count = wctomb (buf, *arg_end); | ||
2433 | # endif | ||
2434 | if (count < 0) | ||
2435 | { | ||
2436 | /* Cannot convert. */ | ||
2437 | if (!(result == resultbuf || result == NULL)) | ||
2438 | free (result); | ||
2439 | if (buf_malloced != NULL) | ||
2440 | free (buf_malloced); | ||
2441 | CLEANUP (); | ||
2442 | errno = EILSEQ; | ||
2443 | return NULL; | ||
2444 | } | ||
2445 | arg_end++; | ||
2446 | characters += count; | ||
2447 | } | ||
2448 | } | ||
2449 | # if DCHAR_IS_TCHAR | ||
2450 | else | ||
2451 | { | ||
2452 | /* Use the entire string. */ | ||
2453 | arg_end = arg + local_wcslen (arg); | ||
2454 | /* The number of bytes doesn't matter. */ | ||
2455 | characters = 0; | ||
2456 | } | ||
2457 | # endif | ||
2458 | |||
2459 | # if !DCHAR_IS_TCHAR | ||
2460 | /* Convert the string into a piece of temporary memory. */ | ||
2461 | tmpsrc = (TCHAR_T *) malloc (characters * sizeof (TCHAR_T)); | ||
2462 | if (tmpsrc == NULL) | ||
2463 | goto out_of_memory; | ||
2464 | { | ||
2465 | TCHAR_T *tmpptr = tmpsrc; | ||
2466 | size_t remaining; | ||
2467 | # if HAVE_WCRTOMB | ||
2468 | mbstate_t state; | ||
2469 | memset (&state, '\0', sizeof (mbstate_t)); | ||
2470 | # endif | ||
2471 | for (remaining = characters; remaining > 0; ) | ||
2472 | { | ||
2473 | char buf[64]; /* Assume MB_CUR_MAX <= 64. */ | ||
2474 | int count; | ||
2475 | |||
2476 | if (*arg == 0) | ||
2477 | abort (); | ||
2478 | # if HAVE_WCRTOMB | ||
2479 | count = wcrtomb (buf, *arg, &state); | ||
2480 | # else | ||
2481 | count = wctomb (buf, *arg); | ||
2482 | # endif | ||
2483 | if (count <= 0) | ||
2484 | /* Inconsistency. */ | ||
2485 | abort (); | ||
2486 | memcpy (tmpptr, buf, count); | ||
2487 | tmpptr += count; | ||
2488 | arg++; | ||
2489 | remaining -= count; | ||
2490 | } | ||
2491 | if (!(arg == arg_end)) | ||
2492 | abort (); | ||
2493 | } | ||
2494 | |||
2495 | /* Convert from TCHAR_T[] to DCHAR_T[]. */ | ||
2496 | tmpdst = | ||
2497 | DCHAR_CONV_FROM_ENCODING (locale_charset (), | ||
2498 | iconveh_question_mark, | ||
2499 | tmpsrc, characters, | ||
2500 | NULL, | ||
2501 | NULL, &tmpdst_len); | ||
2502 | if (tmpdst == NULL) | ||
2503 | { | ||
2504 | int saved_errno = errno; | ||
2505 | free (tmpsrc); | ||
2506 | if (!(result == resultbuf || result == NULL)) | ||
2507 | free (result); | ||
2508 | if (buf_malloced != NULL) | ||
2509 | free (buf_malloced); | ||
2510 | CLEANUP (); | ||
2511 | errno = saved_errno; | ||
2512 | return NULL; | ||
2513 | } | ||
2514 | free (tmpsrc); | ||
2515 | # endif | ||
2516 | |||
2517 | if (has_width) | ||
2518 | { | ||
2519 | # if ENABLE_UNISTDIO | ||
2520 | /* Outside POSIX, it's preferrable to compare the width | ||
2521 | against the number of _characters_ of the converted | ||
2522 | value. */ | ||
2523 | w = DCHAR_MBSNLEN (result + length, characters); | ||
2524 | # else | ||
2525 | /* The width is compared against the number of _bytes_ | ||
2526 | of the converted value, says POSIX. */ | ||
2527 | w = characters; | ||
2528 | # endif | ||
2529 | } | ||
2530 | else | ||
2531 | /* w doesn't matter. */ | ||
2532 | w = 0; | ||
2533 | |||
2534 | if (has_width && width > w | ||
2535 | && !(dp->flags & FLAG_LEFT)) | ||
2536 | { | ||
2537 | size_t n = width - w; | ||
2538 | ENSURE_ALLOCATION (xsum (length, n)); | ||
2539 | DCHAR_SET (result + length, ' ', n); | ||
2540 | length += n; | ||
2541 | } | ||
2542 | |||
2543 | # if DCHAR_IS_TCHAR | ||
2544 | if (has_precision || has_width) | ||
2545 | { | ||
2546 | /* We know the number of bytes in advance. */ | ||
2547 | size_t remaining; | ||
2548 | # if HAVE_WCRTOMB | ||
2549 | mbstate_t state; | ||
2550 | memset (&state, '\0', sizeof (mbstate_t)); | ||
2551 | # endif | ||
2552 | ENSURE_ALLOCATION (xsum (length, characters)); | ||
2553 | for (remaining = characters; remaining > 0; ) | ||
2554 | { | ||
2555 | char buf[64]; /* Assume MB_CUR_MAX <= 64. */ | ||
2556 | int count; | ||
2557 | |||
2558 | if (*arg == 0) | ||
2559 | abort (); | ||
2560 | # if HAVE_WCRTOMB | ||
2561 | count = wcrtomb (buf, *arg, &state); | ||
2562 | # else | ||
2563 | count = wctomb (buf, *arg); | ||
2564 | # endif | ||
2565 | if (count <= 0) | ||
2566 | /* Inconsistency. */ | ||
2567 | abort (); | ||
2568 | memcpy (result + length, buf, count); | ||
2569 | length += count; | ||
2570 | arg++; | ||
2571 | remaining -= count; | ||
2572 | } | ||
2573 | if (!(arg == arg_end)) | ||
2574 | abort (); | ||
2575 | } | ||
2576 | else | ||
2577 | { | ||
2578 | # if HAVE_WCRTOMB | ||
2579 | mbstate_t state; | ||
2580 | memset (&state, '\0', sizeof (mbstate_t)); | ||
2581 | # endif | ||
2582 | while (arg < arg_end) | ||
2583 | { | ||
2584 | char buf[64]; /* Assume MB_CUR_MAX <= 64. */ | ||
2585 | int count; | ||
2586 | |||
2587 | if (*arg == 0) | ||
2588 | abort (); | ||
2589 | # if HAVE_WCRTOMB | ||
2590 | count = wcrtomb (buf, *arg, &state); | ||
2591 | # else | ||
2592 | count = wctomb (buf, *arg); | ||
2593 | # endif | ||
2594 | if (count <= 0) | ||
2595 | /* Inconsistency. */ | ||
2596 | abort (); | ||
2597 | ENSURE_ALLOCATION (xsum (length, count)); | ||
2598 | memcpy (result + length, buf, count); | ||
2599 | length += count; | ||
2600 | arg++; | ||
2601 | } | ||
2602 | } | ||
2603 | # else | ||
2604 | ENSURE_ALLOCATION (xsum (length, tmpdst_len)); | ||
2605 | DCHAR_CPY (result + length, tmpdst, tmpdst_len); | ||
2606 | free (tmpdst); | ||
2607 | length += tmpdst_len; | ||
2608 | # endif | ||
2609 | |||
2610 | if (has_width && width > w | ||
2611 | && (dp->flags & FLAG_LEFT)) | ||
2612 | { | ||
2613 | size_t n = width - w; | ||
2614 | ENSURE_ALLOCATION (xsum (length, n)); | ||
2615 | DCHAR_SET (result + length, ' ', n); | ||
2616 | length += n; | ||
2617 | } | ||
2618 | } | ||
2619 | } | ||
2620 | # endif | ||
2621 | #endif | ||
2069 | #if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL | 2622 | #if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE) && !defined IN_LIBINTL |
2070 | else if ((dp->conversion == 'a' || dp->conversion == 'A') | 2623 | else if ((dp->conversion == 'a' || dp->conversion == 'A') |
2071 | # if !(NEED_PRINTF_DIRECTIVE_A || (NEED_PRINTF_LONG_DOUBLE && NEED_PRINTF_DOUBLE)) | 2624 | # if !(NEED_PRINTF_DIRECTIVE_A || (NEED_PRINTF_LONG_DOUBLE && NEED_PRINTF_DOUBLE)) |
@@ -4032,16 +4585,64 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
4032 | # if HAVE_WCHAR_T | 4585 | # if HAVE_WCHAR_T |
4033 | if (type == TYPE_WIDE_STRING) | 4586 | if (type == TYPE_WIDE_STRING) |
4034 | { | 4587 | { |
4035 | tmp_length = | 4588 | # if WIDE_CHAR_VERSION |
4036 | local_wcslen (a.arg[dp->arg_index].a.a_wide_string); | 4589 | /* ISO C says about %ls in fwprintf: |
4037 | 4590 | "If the precision is not specified or is greater | |
4038 | # if !WIDE_CHAR_VERSION | 4591 | than the size of the array, the array shall |
4039 | tmp_length = xtimes (tmp_length, MB_CUR_MAX); | 4592 | contain a null wide character." |
4593 | So if there is a precision, we must not use | ||
4594 | wcslen. */ | ||
4595 | const wchar_t *arg = | ||
4596 | a.arg[dp->arg_index].a.a_wide_string; | ||
4597 | |||
4598 | if (has_precision) | ||
4599 | tmp_length = local_wcsnlen (arg, precision); | ||
4600 | else | ||
4601 | tmp_length = local_wcslen (arg); | ||
4602 | # else | ||
4603 | /* ISO C says about %ls in fprintf: | ||
4604 | "If a precision is specified, no more than that | ||
4605 | many bytes are written (including shift | ||
4606 | sequences, if any), and the array shall contain | ||
4607 | a null wide character if, to equal the | ||
4608 | multibyte character sequence length given by | ||
4609 | the precision, the function would need to | ||
4610 | access a wide character one past the end of the | ||
4611 | array." | ||
4612 | So if there is a precision, we must not use | ||
4613 | wcslen. */ | ||
4614 | /* This case has already been handled above. */ | ||
4615 | abort (); | ||
4040 | # endif | 4616 | # endif |
4041 | } | 4617 | } |
4042 | else | 4618 | else |
4043 | # endif | 4619 | # endif |
4044 | tmp_length = strlen (a.arg[dp->arg_index].a.a_string); | 4620 | { |
4621 | # if WIDE_CHAR_VERSION | ||
4622 | /* ISO C says about %s in fwprintf: | ||
4623 | "If the precision is not specified or is greater | ||
4624 | than the size of the converted array, the | ||
4625 | converted array shall contain a null wide | ||
4626 | character." | ||
4627 | So if there is a precision, we must not use | ||
4628 | strlen. */ | ||
4629 | /* This case has already been handled above. */ | ||
4630 | abort (); | ||
4631 | # else | ||
4632 | /* ISO C says about %s in fprintf: | ||
4633 | "If the precision is not specified or greater | ||
4634 | than the size of the array, the array shall | ||
4635 | contain a null character." | ||
4636 | So if there is a precision, we must not use | ||
4637 | strlen. */ | ||
4638 | const char *arg = a.arg[dp->arg_index].a.a_string; | ||
4639 | |||
4640 | if (has_precision) | ||
4641 | tmp_length = local_strnlen (arg, precision); | ||
4642 | else | ||
4643 | tmp_length = strlen (arg); | ||
4644 | # endif | ||
4645 | } | ||
4045 | break; | 4646 | break; |
4046 | 4647 | ||
4047 | case 'p': | 4648 | case 'p': |
@@ -4614,14 +5215,13 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp, | |||
4614 | # else | 5215 | # else |
4615 | tmpsrc = tmp; | 5216 | tmpsrc = tmp; |
4616 | # endif | 5217 | # endif |
4617 | tmpdst = NULL; | 5218 | tmpdst = |
4618 | tmpdst_len = 0; | 5219 | DCHAR_CONV_FROM_ENCODING (locale_charset (), |
4619 | if (DCHAR_CONV_FROM_ENCODING (locale_charset (), | 5220 | iconveh_question_mark, |
4620 | iconveh_question_mark, | 5221 | tmpsrc, count, |
4621 | tmpsrc, count, | 5222 | NULL, |
4622 | NULL, | 5223 | NULL, &tmpdst_len); |
4623 | &tmpdst, &tmpdst_len) | 5224 | if (tmpdst == NULL) |
4624 | < 0) | ||
4625 | { | 5225 | { |
4626 | int saved_errno = errno; | 5226 | int saved_errno = errno; |
4627 | if (!(result == resultbuf || result == NULL)) | 5227 | if (!(result == resultbuf || result == NULL)) |
diff --git a/gl/wchar.in.h b/gl/wchar.in.h index cc436b1..cc5baad 100644 --- a/gl/wchar.in.h +++ b/gl/wchar.in.h | |||
@@ -264,7 +264,11 @@ extern size_t wcsrtombs (char *dest, const wchar_t **srcp, size_t len, mbstate_t | |||
264 | 264 | ||
265 | /* Convert a wide string to a string. */ | 265 | /* Convert a wide string to a string. */ |
266 | #if @GNULIB_WCSNRTOMBS@ | 266 | #if @GNULIB_WCSNRTOMBS@ |
267 | # if !@HAVE_WCSNRTOMBS@ | 267 | # if @REPLACE_WCSNRTOMBS@ |
268 | # undef wcsnrtombs | ||
269 | # define wcsnrtombs rpl_wcsnrtombs | ||
270 | # endif | ||
271 | # if !@HAVE_WCSNRTOMBS@ || @REPLACE_WCSNRTOMBS@ | ||
268 | extern size_t wcsnrtombs (char *dest, const wchar_t **srcp, size_t srclen, size_t len, mbstate_t *ps); | 272 | extern size_t wcsnrtombs (char *dest, const wchar_t **srcp, size_t srclen, size_t len, mbstate_t *ps); |
269 | # endif | 273 | # endif |
270 | #elif defined GNULIB_POSIXCHECK | 274 | #elif defined GNULIB_POSIXCHECK |
diff --git a/gl/xmalloc.c b/gl/xmalloc.c index 89ecf17..585fb4b 100644 --- a/gl/xmalloc.c +++ b/gl/xmalloc.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* xmalloc.c -- malloc with out of memory checking | 1 | /* xmalloc.c -- malloc with out of memory checking |
2 | 2 | ||
3 | Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, | 3 | Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, |
4 | 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2008 Free Software Foundation, | 4 | 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2008-2009 Free Software Foundation, |
5 | Inc. | 5 | Inc. |
6 | 6 | ||
7 | This program is free software: you can redistribute it and/or modify | 7 | This program is free software: you can redistribute it and/or modify |
@@ -28,10 +28,6 @@ | |||
28 | #include <stdlib.h> | 28 | #include <stdlib.h> |
29 | #include <string.h> | 29 | #include <string.h> |
30 | 30 | ||
31 | #ifndef SIZE_MAX | ||
32 | # define SIZE_MAX ((size_t) -1) | ||
33 | #endif | ||
34 | |||
35 | /* 1 if calloc is known to be compatible with GNU calloc. This | 31 | /* 1 if calloc is known to be compatible with GNU calloc. This |
36 | matters if we are not also using the calloc module, which defines | 32 | matters if we are not also using the calloc module, which defines |
37 | HAVE_CALLOC and supports the GNU API even on non-GNU platforms. */ | 33 | HAVE_CALLOC and supports the GNU API even on non-GNU platforms. */ |