Mercurial > hg > octave-nkf > gnulib-hg
annotate m4/vsnprintf-posix.m4 @ 17602:f98ee53d8e71
tests: simplify porting to Solaris 10 /bin/sh
Some test cases in 'grep' need a shell that groks '$(';
export re_shell_ for their benefit. Problem reported for 'grep'
by Dagobert Michelsen in <http://bugs.gnu.org/16380>.
* tests/init.sh (re_shell_): Export if it's used.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Tue, 07 Jan 2014 11:46:27 -0800 |
parents | 344018b6e5d7 |
children | ab58d4870664 |
rev | line source |
---|---|
15591
2171e9d2231b
*printf: Add support for MSVC compiler.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
1 # vsnprintf-posix.m4 serial 15 |
17587 | 2 dnl Copyright (C) 2007-2014 Free Software Foundation, Inc. |
8363 | 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 AC_DEFUN([gl_FUNC_VSNPRINTF_POSIX], | |
8 [ | |
9 AC_REQUIRE([gl_PRINTF_SIZES_C99]) | |
8860
771a56a41b5b
Fix *printf result for NaN, Inf on AIX, Solaris, OSF/1.
Bruno Haible <bruno@clisp.org>
parents:
8840
diff
changeset
|
10 AC_REQUIRE([gl_PRINTF_LONG_DOUBLE]) |
8840
792e05ae7ac8
Fix *printf result for NaN, Inf, -0.0 on mingw.
Bruno Haible <bruno@clisp.org>
parents:
8832
diff
changeset
|
11 AC_REQUIRE([gl_PRINTF_INFINITE]) |
8860
771a56a41b5b
Fix *printf result for NaN, Inf on AIX, Solaris, OSF/1.
Bruno Haible <bruno@clisp.org>
parents:
8840
diff
changeset
|
12 AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE]) |
8363 | 13 AC_REQUIRE([gl_PRINTF_DIRECTIVE_A]) |
8664
40c507f55b0f
Implement the %F directive if the system doesn't implement it correctly.
Bruno Haible <bruno@clisp.org>
parents:
8554
diff
changeset
|
14 AC_REQUIRE([gl_PRINTF_DIRECTIVE_F]) |
8363 | 15 AC_REQUIRE([gl_PRINTF_DIRECTIVE_N]) |
11219
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
9940
diff
changeset
|
16 AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS]) |
8363 | 17 AC_REQUIRE([gl_PRINTF_POSITIONS]) |
8803
6c1d98929550
Work around lack of support of grouping flag.
Bruno Haible <bruno@clisp.org>
parents:
8763
diff
changeset
|
18 AC_REQUIRE([gl_PRINTF_FLAG_GROUPING]) |
9674
b69f1141e94f
Fix *printf behaviour regarding the left-adjust flag on HP-UX 10.20.
Bruno Haible <bruno@clisp.org>
parents:
9446
diff
changeset
|
19 AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST]) |
8804
6ce313658b4d
Work around an incorrect implementation of the 0 flag on most platforms.
Bruno Haible <bruno@clisp.org>
parents:
8803
diff
changeset
|
20 AC_REQUIRE([gl_PRINTF_FLAG_ZERO]) |
9446
0519fc8ce06a
Fix *printf behaviour for large precisions on mingw and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
9442
diff
changeset
|
21 AC_REQUIRE([gl_PRINTF_PRECISION]) |
9442
ad275322f8f1
Fix *printf behaviour in out-of-memory situations on MacOS X and *BSD.
Bruno Haible <bruno@clisp.org>
parents:
8860
diff
changeset
|
22 AC_REQUIRE([gl_PRINTF_ENOMEM]) |
8363 | 23 gl_cv_func_vsnprintf_posix=no |
24 AC_CHECK_FUNCS([vsnprintf]) | |
25 if test $ac_cv_func_vsnprintf = yes; then | |
15591
2171e9d2231b
*printf: Add support for MSVC compiler.
Bruno Haible <bruno@clisp.org>
parents:
14079
diff
changeset
|
26 dnl These tests use vsnprintf() if snprintf() does not exist. |
8363 | 27 gl_SNPRINTF_TRUNCATION_C99 |
28 gl_SNPRINTF_RETVAL_C99 | |
29 gl_SNPRINTF_DIRECTIVE_N | |
9940
0471a8660b70
Work around snprintf bug on Linux libc5.
Bruno Haible <bruno@clisp.org>
parents:
9831
diff
changeset
|
30 gl_SNPRINTF_SIZE1 |
8763
39bb5430fc0e
Guard against vsnprintf implementations that mishandle a size=0 argument.
Bruno Haible <bruno@clisp.org>
parents:
8664
diff
changeset
|
31 gl_VSNPRINTF_ZEROSIZE_C99 |
8389
e7c9cf0455da
Use 'case' statements instead of 'expr' invocations.
Bruno Haible <bruno@clisp.org>
parents:
8363
diff
changeset
|
32 case "$gl_cv_func_printf_sizes_c99" in |
e7c9cf0455da
Use 'case' statements instead of 'expr' invocations.
Bruno Haible <bruno@clisp.org>
parents:
8363
diff
changeset
|
33 *yes) |
8860
771a56a41b5b
Fix *printf result for NaN, Inf on AIX, Solaris, OSF/1.
Bruno Haible <bruno@clisp.org>
parents:
8840
diff
changeset
|
34 case "$gl_cv_func_printf_long_double" in |
8389
e7c9cf0455da
Use 'case' statements instead of 'expr' invocations.
Bruno Haible <bruno@clisp.org>
parents:
8363
diff
changeset
|
35 *yes) |
8860
771a56a41b5b
Fix *printf result for NaN, Inf on AIX, Solaris, OSF/1.
Bruno Haible <bruno@clisp.org>
parents:
8840
diff
changeset
|
36 case "$gl_cv_func_printf_infinite" in |
8389
e7c9cf0455da
Use 'case' statements instead of 'expr' invocations.
Bruno Haible <bruno@clisp.org>
parents:
8363
diff
changeset
|
37 *yes) |
8860
771a56a41b5b
Fix *printf result for NaN, Inf on AIX, Solaris, OSF/1.
Bruno Haible <bruno@clisp.org>
parents:
8840
diff
changeset
|
38 case "$gl_cv_func_printf_infinite_long_double" in |
8389
e7c9cf0455da
Use 'case' statements instead of 'expr' invocations.
Bruno Haible <bruno@clisp.org>
parents:
8363
diff
changeset
|
39 *yes) |
8860
771a56a41b5b
Fix *printf result for NaN, Inf on AIX, Solaris, OSF/1.
Bruno Haible <bruno@clisp.org>
parents:
8840
diff
changeset
|
40 case "$gl_cv_func_printf_directive_a" in |
8389
e7c9cf0455da
Use 'case' statements instead of 'expr' invocations.
Bruno Haible <bruno@clisp.org>
parents:
8363
diff
changeset
|
41 *yes) |
8860
771a56a41b5b
Fix *printf result for NaN, Inf on AIX, Solaris, OSF/1.
Bruno Haible <bruno@clisp.org>
parents:
8840
diff
changeset
|
42 case "$gl_cv_func_printf_directive_f" in |
8389
e7c9cf0455da
Use 'case' statements instead of 'expr' invocations.
Bruno Haible <bruno@clisp.org>
parents:
8363
diff
changeset
|
43 *yes) |
8860
771a56a41b5b
Fix *printf result for NaN, Inf on AIX, Solaris, OSF/1.
Bruno Haible <bruno@clisp.org>
parents:
8840
diff
changeset
|
44 case "$gl_cv_func_printf_directive_n" in |
8389
e7c9cf0455da
Use 'case' statements instead of 'expr' invocations.
Bruno Haible <bruno@clisp.org>
parents:
8363
diff
changeset
|
45 *yes) |
11219
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
9940
diff
changeset
|
46 case "$gl_cv_func_printf_directive_ls" in |
8664
40c507f55b0f
Implement the %F directive if the system doesn't implement it correctly.
Bruno Haible <bruno@clisp.org>
parents:
8554
diff
changeset
|
47 *yes) |
11219
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
9940
diff
changeset
|
48 case "$gl_cv_func_printf_positions" in |
8763
39bb5430fc0e
Guard against vsnprintf implementations that mishandle a size=0 argument.
Bruno Haible <bruno@clisp.org>
parents:
8664
diff
changeset
|
49 *yes) |
11219
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
9940
diff
changeset
|
50 case "$gl_cv_func_printf_flag_grouping" in |
8803
6c1d98929550
Work around lack of support of grouping flag.
Bruno Haible <bruno@clisp.org>
parents:
8763
diff
changeset
|
51 *yes) |
11219
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
9940
diff
changeset
|
52 case "$gl_cv_func_printf_flag_leftadjust" in |
8804
6ce313658b4d
Work around an incorrect implementation of the 0 flag on most platforms.
Bruno Haible <bruno@clisp.org>
parents:
8803
diff
changeset
|
53 *yes) |
11219
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
9940
diff
changeset
|
54 case "$gl_cv_func_printf_flag_zero" in |
8832
1466c973f476
Add support for 'long double' number output.
Bruno Haible <bruno@clisp.org>
parents:
8804
diff
changeset
|
55 *yes) |
11219
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
9940
diff
changeset
|
56 case "$gl_cv_func_printf_precision" in |
8840
792e05ae7ac8
Fix *printf result for NaN, Inf, -0.0 on mingw.
Bruno Haible <bruno@clisp.org>
parents:
8832
diff
changeset
|
57 *yes) |
11219
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
9940
diff
changeset
|
58 case "$gl_cv_func_printf_enomem" in |
8860
771a56a41b5b
Fix *printf result for NaN, Inf on AIX, Solaris, OSF/1.
Bruno Haible <bruno@clisp.org>
parents:
8840
diff
changeset
|
59 *yes) |
11219
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
9940
diff
changeset
|
60 case "$gl_cv_func_snprintf_truncation_c99" in |
9442
ad275322f8f1
Fix *printf behaviour in out-of-memory situations on MacOS X and *BSD.
Bruno Haible <bruno@clisp.org>
parents:
8860
diff
changeset
|
61 *yes) |
11219
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
9940
diff
changeset
|
62 case "$gl_cv_func_snprintf_retval_c99" in |
9446
0519fc8ce06a
Fix *printf behaviour for large precisions on mingw and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
9442
diff
changeset
|
63 *yes) |
11219
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
9940
diff
changeset
|
64 case "$gl_cv_func_snprintf_directive_n" in |
9674
b69f1141e94f
Fix *printf behaviour regarding the left-adjust flag on HP-UX 10.20.
Bruno Haible <bruno@clisp.org>
parents:
9446
diff
changeset
|
65 *yes) |
11219
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
9940
diff
changeset
|
66 case "$gl_cv_func_snprintf_size1" in |
9940
0471a8660b70
Work around snprintf bug on Linux libc5.
Bruno Haible <bruno@clisp.org>
parents:
9831
diff
changeset
|
67 *yes) |
11219
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
9940
diff
changeset
|
68 case "$gl_cv_func_vsnprintf_zerosize_c99" in |
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
9940
diff
changeset
|
69 *yes) |
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
9940
diff
changeset
|
70 # vsnprintf exists and is |
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
9940
diff
changeset
|
71 # already POSIX compliant. |
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
9940
diff
changeset
|
72 gl_cv_func_vsnprintf_posix=yes |
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
9940
diff
changeset
|
73 ;; |
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
9940
diff
changeset
|
74 esac |
9940
0471a8660b70
Work around snprintf bug on Linux libc5.
Bruno Haible <bruno@clisp.org>
parents:
9831
diff
changeset
|
75 ;; |
0471a8660b70
Work around snprintf bug on Linux libc5.
Bruno Haible <bruno@clisp.org>
parents:
9831
diff
changeset
|
76 esac |
9674
b69f1141e94f
Fix *printf behaviour regarding the left-adjust flag on HP-UX 10.20.
Bruno Haible <bruno@clisp.org>
parents:
9446
diff
changeset
|
77 ;; |
b69f1141e94f
Fix *printf behaviour regarding the left-adjust flag on HP-UX 10.20.
Bruno Haible <bruno@clisp.org>
parents:
9446
diff
changeset
|
78 esac |
9446
0519fc8ce06a
Fix *printf behaviour for large precisions on mingw and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
9442
diff
changeset
|
79 ;; |
0519fc8ce06a
Fix *printf behaviour for large precisions on mingw and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
9442
diff
changeset
|
80 esac |
9442
ad275322f8f1
Fix *printf behaviour in out-of-memory situations on MacOS X and *BSD.
Bruno Haible <bruno@clisp.org>
parents:
8860
diff
changeset
|
81 ;; |
ad275322f8f1
Fix *printf behaviour in out-of-memory situations on MacOS X and *BSD.
Bruno Haible <bruno@clisp.org>
parents:
8860
diff
changeset
|
82 esac |
8860
771a56a41b5b
Fix *printf result for NaN, Inf on AIX, Solaris, OSF/1.
Bruno Haible <bruno@clisp.org>
parents:
8840
diff
changeset
|
83 ;; |
771a56a41b5b
Fix *printf result for NaN, Inf on AIX, Solaris, OSF/1.
Bruno Haible <bruno@clisp.org>
parents:
8840
diff
changeset
|
84 esac |
8840
792e05ae7ac8
Fix *printf result for NaN, Inf, -0.0 on mingw.
Bruno Haible <bruno@clisp.org>
parents:
8832
diff
changeset
|
85 ;; |
792e05ae7ac8
Fix *printf result for NaN, Inf, -0.0 on mingw.
Bruno Haible <bruno@clisp.org>
parents:
8832
diff
changeset
|
86 esac |
8832
1466c973f476
Add support for 'long double' number output.
Bruno Haible <bruno@clisp.org>
parents:
8804
diff
changeset
|
87 ;; |
1466c973f476
Add support for 'long double' number output.
Bruno Haible <bruno@clisp.org>
parents:
8804
diff
changeset
|
88 esac |
8804
6ce313658b4d
Work around an incorrect implementation of the 0 flag on most platforms.
Bruno Haible <bruno@clisp.org>
parents:
8803
diff
changeset
|
89 ;; |
6ce313658b4d
Work around an incorrect implementation of the 0 flag on most platforms.
Bruno Haible <bruno@clisp.org>
parents:
8803
diff
changeset
|
90 esac |
8803
6c1d98929550
Work around lack of support of grouping flag.
Bruno Haible <bruno@clisp.org>
parents:
8763
diff
changeset
|
91 ;; |
6c1d98929550
Work around lack of support of grouping flag.
Bruno Haible <bruno@clisp.org>
parents:
8763
diff
changeset
|
92 esac |
8763
39bb5430fc0e
Guard against vsnprintf implementations that mishandle a size=0 argument.
Bruno Haible <bruno@clisp.org>
parents:
8664
diff
changeset
|
93 ;; |
39bb5430fc0e
Guard against vsnprintf implementations that mishandle a size=0 argument.
Bruno Haible <bruno@clisp.org>
parents:
8664
diff
changeset
|
94 esac |
8664
40c507f55b0f
Implement the %F directive if the system doesn't implement it correctly.
Bruno Haible <bruno@clisp.org>
parents:
8554
diff
changeset
|
95 ;; |
40c507f55b0f
Implement the %F directive if the system doesn't implement it correctly.
Bruno Haible <bruno@clisp.org>
parents:
8554
diff
changeset
|
96 esac |
8389
e7c9cf0455da
Use 'case' statements instead of 'expr' invocations.
Bruno Haible <bruno@clisp.org>
parents:
8363
diff
changeset
|
97 ;; |
e7c9cf0455da
Use 'case' statements instead of 'expr' invocations.
Bruno Haible <bruno@clisp.org>
parents:
8363
diff
changeset
|
98 esac |
e7c9cf0455da
Use 'case' statements instead of 'expr' invocations.
Bruno Haible <bruno@clisp.org>
parents:
8363
diff
changeset
|
99 ;; |
e7c9cf0455da
Use 'case' statements instead of 'expr' invocations.
Bruno Haible <bruno@clisp.org>
parents:
8363
diff
changeset
|
100 esac |
e7c9cf0455da
Use 'case' statements instead of 'expr' invocations.
Bruno Haible <bruno@clisp.org>
parents:
8363
diff
changeset
|
101 ;; |
e7c9cf0455da
Use 'case' statements instead of 'expr' invocations.
Bruno Haible <bruno@clisp.org>
parents:
8363
diff
changeset
|
102 esac |
e7c9cf0455da
Use 'case' statements instead of 'expr' invocations.
Bruno Haible <bruno@clisp.org>
parents:
8363
diff
changeset
|
103 ;; |
e7c9cf0455da
Use 'case' statements instead of 'expr' invocations.
Bruno Haible <bruno@clisp.org>
parents:
8363
diff
changeset
|
104 esac |
e7c9cf0455da
Use 'case' statements instead of 'expr' invocations.
Bruno Haible <bruno@clisp.org>
parents:
8363
diff
changeset
|
105 ;; |
e7c9cf0455da
Use 'case' statements instead of 'expr' invocations.
Bruno Haible <bruno@clisp.org>
parents:
8363
diff
changeset
|
106 esac |
e7c9cf0455da
Use 'case' statements instead of 'expr' invocations.
Bruno Haible <bruno@clisp.org>
parents:
8363
diff
changeset
|
107 ;; |
e7c9cf0455da
Use 'case' statements instead of 'expr' invocations.
Bruno Haible <bruno@clisp.org>
parents:
8363
diff
changeset
|
108 esac |
e7c9cf0455da
Use 'case' statements instead of 'expr' invocations.
Bruno Haible <bruno@clisp.org>
parents:
8363
diff
changeset
|
109 ;; |
e7c9cf0455da
Use 'case' statements instead of 'expr' invocations.
Bruno Haible <bruno@clisp.org>
parents:
8363
diff
changeset
|
110 esac |
8363 | 111 fi |
112 if test $gl_cv_func_vsnprintf_posix = no; then | |
8832
1466c973f476
Add support for 'long double' number output.
Bruno Haible <bruno@clisp.org>
parents:
8804
diff
changeset
|
113 gl_PREREQ_VASNPRINTF_LONG_DOUBLE |
8860
771a56a41b5b
Fix *printf result for NaN, Inf on AIX, Solaris, OSF/1.
Bruno Haible <bruno@clisp.org>
parents:
8840
diff
changeset
|
114 gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE |
771a56a41b5b
Fix *printf result for NaN, Inf on AIX, Solaris, OSF/1.
Bruno Haible <bruno@clisp.org>
parents:
8840
diff
changeset
|
115 gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE |
8554
35eb5062216c
Prefer nl_langinfo over localeconv.
Bruno Haible <bruno@clisp.org>
parents:
8389
diff
changeset
|
116 gl_PREREQ_VASNPRINTF_DIRECTIVE_A |
8664
40c507f55b0f
Implement the %F directive if the system doesn't implement it correctly.
Bruno Haible <bruno@clisp.org>
parents:
8554
diff
changeset
|
117 gl_PREREQ_VASNPRINTF_DIRECTIVE_F |
11219
aaeb2f86d096
Fix *printf behaviour regarding the %ls directive.
Bruno Haible <bruno@clisp.org>
parents:
9940
diff
changeset
|
118 gl_PREREQ_VASNPRINTF_DIRECTIVE_LS |
8803
6c1d98929550
Work around lack of support of grouping flag.
Bruno Haible <bruno@clisp.org>
parents:
8763
diff
changeset
|
119 gl_PREREQ_VASNPRINTF_FLAG_GROUPING |
9674
b69f1141e94f
Fix *printf behaviour regarding the left-adjust flag on HP-UX 10.20.
Bruno Haible <bruno@clisp.org>
parents:
9446
diff
changeset
|
120 gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST |
8804
6ce313658b4d
Work around an incorrect implementation of the 0 flag on most platforms.
Bruno Haible <bruno@clisp.org>
parents:
8803
diff
changeset
|
121 gl_PREREQ_VASNPRINTF_FLAG_ZERO |
9446
0519fc8ce06a
Fix *printf behaviour for large precisions on mingw and BeOS.
Bruno Haible <bruno@clisp.org>
parents:
9442
diff
changeset
|
122 gl_PREREQ_VASNPRINTF_PRECISION |
9442
ad275322f8f1
Fix *printf behaviour in out-of-memory situations on MacOS X and *BSD.
Bruno Haible <bruno@clisp.org>
parents:
8860
diff
changeset
|
123 gl_PREREQ_VASNPRINTF_ENOMEM |
8363 | 124 gl_REPLACE_VASNPRINTF |
125 gl_REPLACE_VSNPRINTF | |
126 fi | |
127 ]) |