Mercurial > hg > octave-lojdl > gnulib-hg
annotate m4/obstack-printf-posix.m4 @ 15308:a3ba680ad389
strerror_r: fix OpenBSD behavior on 0
OpenBSD treats strerror_r(0,,) as a success, but with a message
"Undefined error: 0"; while this is distinct from strerror_r(-1,,)
returning "Unknown error: -1", it does not imply success. Meanwhile,
if buf is short enough for ERANGE, then we can't use strstr to look
for "Unknown" or "Undefined" in the resulting message, like we had
been doing for strerror(). Fix this by shifting the burden - now
the strerror-override code guarantees that 0 will have an
override when needed.
* lib/strerror-override.c (strerror_override): Also override 0
when needed.
* lib/strerror-override.h (strerror_override): Likewise.
* lib/strerror.c (strerror): Simplify, now that 0 override is done
earlier.
* lib/strerror_r.c (strerror_r): Likewise.
* m4/strerror.m4 (gl_FUNC_STRERROR): Split detection of 0
behavior...
(gl_FUNC_STRERROR_0): ...into new macro.
* m4/strerror_r.m4 (gl_FUNC_STRERROR_R): Replace strerror_r if 0
is overridden.
(gl_FUNC_STRERROR_R_WORKS): Avoid extra tests if 0 is broken.
* modules/strerror-override (Files): Add strerror.m4.
(configure.ac): Also provide override for 0 when needed.
* doc/posix-functions/strerror.texi (strerror): Document this.
* doc/posix-functions/perror.texi (perror): Likewise.
Signed-off-by: Eric Blake <eblake@redhat.com>
author | Eric Blake <eblake@redhat.com> |
---|---|
date | Tue, 21 Jun 2011 08:50:51 -0600 |
parents | 97fc9a21a8fb |
children | 8250f2777afc |
rev | line source |
---|---|
12860
1825e6a0ff37
obstack-printf-posix: ensure declaration
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
1 # obstack-printf-posix.m4 serial 4 |
14079
97fc9a21a8fb
maint: update almost all copyright ranges to include 2011
Jim Meyering <meyering@redhat.com>
parents:
12860
diff
changeset
|
2 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. |
10205
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
3 dnl This file is free software; the Free Software Foundation |
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
4 dnl gives unlimited permission to copy and/or distribute it, |
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
5 dnl with or without modifications, as long as this notice is preserved. |
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
6 |
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
7 AC_DEFUN([gl_FUNC_OBSTACK_PRINTF_POSIX], |
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
8 [ |
10206
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
9 dnl Persuade glibc <stdio.h> to declare obstack_printf(), obstack_vprintf(). |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
10 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
11 |
10205
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
12 AC_REQUIRE([gl_PRINTF_SIZES_C99]) |
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
13 AC_REQUIRE([gl_PRINTF_LONG_DOUBLE]) |
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
14 AC_REQUIRE([gl_PRINTF_INFINITE]) |
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
15 AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE]) |
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
16 AC_REQUIRE([gl_PRINTF_DIRECTIVE_A]) |
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
17 AC_REQUIRE([gl_PRINTF_DIRECTIVE_F]) |
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
18 AC_REQUIRE([gl_PRINTF_DIRECTIVE_N]) |
11219
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
10350
diff
changeset
|
19 AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS]) |
10205
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
20 AC_REQUIRE([gl_PRINTF_POSITIONS]) |
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
21 AC_REQUIRE([gl_PRINTF_FLAG_GROUPING]) |
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
22 AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST]) |
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
23 AC_REQUIRE([gl_PRINTF_FLAG_ZERO]) |
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
24 AC_REQUIRE([gl_PRINTF_PRECISION]) |
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
25 AC_REQUIRE([gl_PRINTF_ENOMEM]) |
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
26 gl_cv_func_obstack_printf_posix=no |
10206
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
27 AC_CHECK_FUNCS_ONCE([obstack_printf]) |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
28 if test $ac_cv_func_obstack_printf = yes ; then |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
29 case "$gl_cv_func_printf_sizes_c99" in |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
30 *yes) |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
31 case "$gl_cv_func_printf_long_double" in |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
32 *yes) |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
33 case "$gl_cv_func_printf_infinite" in |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
34 *yes) |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
35 case "$gl_cv_func_printf_infinite_long_double" in |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
36 *yes) |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
37 case "$gl_cv_func_printf_directive_a" in |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
38 *yes) |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
39 case "$gl_cv_func_printf_directive_f" in |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
40 *yes) |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
41 case "$gl_cv_func_printf_directive_n" in |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
42 *yes) |
11219
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
10350
diff
changeset
|
43 case "$gl_cv_func_printf_directive_ls" in |
10206
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
44 *yes) |
11219
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
10350
diff
changeset
|
45 case "$gl_cv_func_printf_positions" in |
10206
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
46 *yes) |
11219
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
10350
diff
changeset
|
47 case "$gl_cv_func_printf_flag_grouping" in |
10206
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
48 *yes) |
11219
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
10350
diff
changeset
|
49 case "$gl_cv_func_printf_flag_leftadjust" in |
10206
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
50 *yes) |
11219
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
10350
diff
changeset
|
51 case "$gl_cv_func_printf_flag_zero" in |
10206
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
52 *yes) |
11219
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
10350
diff
changeset
|
53 case "$gl_cv_func_printf_precision" in |
10206
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
54 *yes) |
11219
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
10350
diff
changeset
|
55 case "$gl_cv_func_printf_enomem" in |
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
10350
diff
changeset
|
56 *yes) |
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
10350
diff
changeset
|
57 # obstack_printf exists and is |
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
10350
diff
changeset
|
58 # already POSIX compliant. |
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
10350
diff
changeset
|
59 gl_cv_func_obstack_printf_posix=yes |
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
10350
diff
changeset
|
60 ;; |
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
10350
diff
changeset
|
61 esac |
10206
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
62 ;; |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
63 esac |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
64 ;; |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
65 esac |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
66 ;; |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
67 esac |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
68 ;; |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
69 esac |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
70 ;; |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
71 esac |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
72 ;; |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
73 esac |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
74 ;; |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
75 esac |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
76 ;; |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
77 esac |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
78 ;; |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
79 esac |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
80 ;; |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
81 esac |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
82 ;; |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
83 esac |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
84 ;; |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
85 esac |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
86 ;; |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
87 esac |
927afe014a7d
Fix various problems in 'obstack-printf' module.
Bruno Haible <bruno@clisp.org>
parents:
10205
diff
changeset
|
88 fi |
10205
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
89 if test $gl_cv_func_obstack_printf_posix = no; then |
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
90 gl_PREREQ_VASNPRINTF_LONG_DOUBLE |
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
91 gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE |
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
92 gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE |
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
93 gl_PREREQ_VASNPRINTF_DIRECTIVE_A |
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
94 gl_PREREQ_VASNPRINTF_DIRECTIVE_F |
11219
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
10350
diff
changeset
|
95 gl_PREREQ_VASNPRINTF_DIRECTIVE_LS |
10205
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
96 gl_PREREQ_VASNPRINTF_FLAG_GROUPING |
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
97 gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST |
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
98 gl_PREREQ_VASNPRINTF_FLAG_ZERO |
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
99 gl_PREREQ_VASNPRINTF_PRECISION |
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
100 gl_PREREQ_VASNPRINTF_ENOMEM |
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
101 gl_REPLACE_VASNPRINTF |
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
102 gl_REPLACE_OBSTACK_PRINTF |
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
103 fi |
12860
1825e6a0ff37
obstack-printf-posix: ensure declaration
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
104 gl_DECL_OBSTACK_PRINTF |
10205
3384541effec
Add obstack-printf and obstack-printf-posix modules.
Eric Blake <ebb9@byu.net>
parents:
diff
changeset
|
105 ]) |