Mercurial > gnulib
annotate m4/vsnprintf.m4 @ 40057:b06060465f09
maint: Run 'make update-copyright'
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Tue, 01 Jan 2019 00:25:11 +0100 |
parents | 10eb9086bea0 |
children |
rev | line source |
---|---|
18579
2086401c42d7
Avoid redefinition errors on MSVC.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
1 # vsnprintf.m4 serial 7 |
40057
b06060465f09
maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents:
19484
diff
changeset
|
2 dnl Copyright (C) 2002-2004, 2007-2019 Free Software Foundation, Inc. |
5611
87c42e194f4a
Use an all-permissive copyright notice, recommended by RMS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5340
diff
changeset
|
3 dnl This file is free software; the Free Software Foundation |
87c42e194f4a
Use an all-permissive copyright notice, recommended by RMS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5340
diff
changeset
|
4 dnl gives unlimited permission to copy and/or distribute it, |
87c42e194f4a
Use an all-permissive copyright notice, recommended by RMS.
Paul Eggert <eggert@cs.ucla.edu>
parents:
5340
diff
changeset
|
5 dnl with or without modifications, as long as this notice is preserved. |
5340 | 6 |
15340
03a50862ef09
snprintf: guarantee %1$d, for libintl
Eric Blake <eblake@redhat.com>
parents:
14079
diff
changeset
|
7 dnl Libintl 0.17 will replace vsnprintf only if it does not support %1$s, |
03a50862ef09
snprintf: guarantee %1$d, for libintl
Eric Blake <eblake@redhat.com>
parents:
14079
diff
changeset
|
8 dnl but defers to any gnulib vsnprintf replacements. Therefore, gnulib |
03a50862ef09
snprintf: guarantee %1$d, for libintl
Eric Blake <eblake@redhat.com>
parents:
14079
diff
changeset
|
9 dnl must guarantee that the decision for replacing vsnprintf is a superset |
03a50862ef09
snprintf: guarantee %1$d, for libintl
Eric Blake <eblake@redhat.com>
parents:
14079
diff
changeset
|
10 dnl of the reasons checked by libintl. |
5340 | 11 AC_DEFUN([gl_FUNC_VSNPRINTF], |
12 [ | |
8211
a7182ec8249f
vsnprintf.h is replaced with <stdio.h>.
Bruno Haible <bruno@clisp.org>
parents:
5611
diff
changeset
|
13 AC_REQUIRE([gl_STDIO_H_DEFAULTS]) |
9940
0471a8660b70
Work around snprintf bug on Linux libc5.
Bruno Haible <bruno@clisp.org>
parents:
8368
diff
changeset
|
14 gl_cv_func_vsnprintf_usable=no |
8363
b55fb0efed6d
New module 'vsnprintf-posix'.
Bruno Haible <bruno@clisp.org>
parents:
8211
diff
changeset
|
15 AC_CHECK_FUNCS([vsnprintf]) |
9940
0471a8660b70
Work around snprintf bug on Linux libc5.
Bruno Haible <bruno@clisp.org>
parents:
8368
diff
changeset
|
16 if test $ac_cv_func_vsnprintf = yes; then |
0471a8660b70
Work around snprintf bug on Linux libc5.
Bruno Haible <bruno@clisp.org>
parents:
8368
diff
changeset
|
17 gl_SNPRINTF_SIZE1 |
0471a8660b70
Work around snprintf bug on Linux libc5.
Bruno Haible <bruno@clisp.org>
parents:
8368
diff
changeset
|
18 case "$gl_cv_func_snprintf_size1" in |
0471a8660b70
Work around snprintf bug on Linux libc5.
Bruno Haible <bruno@clisp.org>
parents:
8368
diff
changeset
|
19 *yes) |
14003
f82a977dcf0b
vsnprintf: make more consistent with snprintf; doc fixes
Paul Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
20 gl_SNPRINTF_RETVAL_C99 |
f82a977dcf0b
vsnprintf: make more consistent with snprintf; doc fixes
Paul Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
21 case "$gl_cv_func_snprintf_retval_c99" in |
f82a977dcf0b
vsnprintf: make more consistent with snprintf; doc fixes
Paul Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
22 *yes) |
15340
03a50862ef09
snprintf: guarantee %1$d, for libintl
Eric Blake <eblake@redhat.com>
parents:
14079
diff
changeset
|
23 gl_PRINTF_POSITIONS |
03a50862ef09
snprintf: guarantee %1$d, for libintl
Eric Blake <eblake@redhat.com>
parents:
14079
diff
changeset
|
24 case "$gl_cv_func_printf_positions" in |
03a50862ef09
snprintf: guarantee %1$d, for libintl
Eric Blake <eblake@redhat.com>
parents:
14079
diff
changeset
|
25 *yes) |
03a50862ef09
snprintf: guarantee %1$d, for libintl
Eric Blake <eblake@redhat.com>
parents:
14079
diff
changeset
|
26 gl_cv_func_vsnprintf_usable=yes |
03a50862ef09
snprintf: guarantee %1$d, for libintl
Eric Blake <eblake@redhat.com>
parents:
14079
diff
changeset
|
27 ;; |
03a50862ef09
snprintf: guarantee %1$d, for libintl
Eric Blake <eblake@redhat.com>
parents:
14079
diff
changeset
|
28 esac |
14003
f82a977dcf0b
vsnprintf: make more consistent with snprintf; doc fixes
Paul Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
29 ;; |
f82a977dcf0b
vsnprintf: make more consistent with snprintf; doc fixes
Paul Eggert <eggert@cs.ucla.edu>
parents:
12559
diff
changeset
|
30 esac |
9940
0471a8660b70
Work around snprintf bug on Linux libc5.
Bruno Haible <bruno@clisp.org>
parents:
8368
diff
changeset
|
31 ;; |
0471a8660b70
Work around snprintf bug on Linux libc5.
Bruno Haible <bruno@clisp.org>
parents:
8368
diff
changeset
|
32 esac |
0471a8660b70
Work around snprintf bug on Linux libc5.
Bruno Haible <bruno@clisp.org>
parents:
8368
diff
changeset
|
33 fi |
9959 | 34 if test $gl_cv_func_vsnprintf_usable = no; then |
8363
b55fb0efed6d
New module 'vsnprintf-posix'.
Bruno Haible <bruno@clisp.org>
parents:
8211
diff
changeset
|
35 gl_REPLACE_VSNPRINTF |
b55fb0efed6d
New module 'vsnprintf-posix'.
Bruno Haible <bruno@clisp.org>
parents:
8211
diff
changeset
|
36 fi |
b55fb0efed6d
New module 'vsnprintf-posix'.
Bruno Haible <bruno@clisp.org>
parents:
8211
diff
changeset
|
37 AC_CHECK_DECLS_ONCE([vsnprintf]) |
8211
a7182ec8249f
vsnprintf.h is replaced with <stdio.h>.
Bruno Haible <bruno@clisp.org>
parents:
5611
diff
changeset
|
38 if test $ac_cv_have_decl_vsnprintf = no; then |
a7182ec8249f
vsnprintf.h is replaced with <stdio.h>.
Bruno Haible <bruno@clisp.org>
parents:
5611
diff
changeset
|
39 HAVE_DECL_VSNPRINTF=0 |
a7182ec8249f
vsnprintf.h is replaced with <stdio.h>.
Bruno Haible <bruno@clisp.org>
parents:
5611
diff
changeset
|
40 fi |
8363
b55fb0efed6d
New module 'vsnprintf-posix'.
Bruno Haible <bruno@clisp.org>
parents:
8211
diff
changeset
|
41 ]) |
b55fb0efed6d
New module 'vsnprintf-posix'.
Bruno Haible <bruno@clisp.org>
parents:
8211
diff
changeset
|
42 |
b55fb0efed6d
New module 'vsnprintf-posix'.
Bruno Haible <bruno@clisp.org>
parents:
8211
diff
changeset
|
43 AC_DEFUN([gl_REPLACE_VSNPRINTF], |
b55fb0efed6d
New module 'vsnprintf-posix'.
Bruno Haible <bruno@clisp.org>
parents:
8211
diff
changeset
|
44 [ |
8368
0a5e8b4fe214
Fix last commit: Require gl_STDIO_H_DEFAULTS.
Bruno Haible <bruno@clisp.org>
parents:
8363
diff
changeset
|
45 AC_REQUIRE([gl_STDIO_H_DEFAULTS]) |
8363
b55fb0efed6d
New module 'vsnprintf-posix'.
Bruno Haible <bruno@clisp.org>
parents:
8211
diff
changeset
|
46 AC_LIBOBJ([vsnprintf]) |
b55fb0efed6d
New module 'vsnprintf-posix'.
Bruno Haible <bruno@clisp.org>
parents:
8211
diff
changeset
|
47 if test $ac_cv_func_vsnprintf = yes; then |
b55fb0efed6d
New module 'vsnprintf-posix'.
Bruno Haible <bruno@clisp.org>
parents:
8211
diff
changeset
|
48 REPLACE_VSNPRINTF=1 |
18579
2086401c42d7
Avoid redefinition errors on MSVC.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
49 else |
2086401c42d7
Avoid redefinition errors on MSVC.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
50 AC_CHECK_DECLS_ONCE([vsnprintf]) |
2086401c42d7
Avoid redefinition errors on MSVC.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
51 if test $ac_cv_have_decl_vsnprintf = yes; then |
2086401c42d7
Avoid redefinition errors on MSVC.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
52 dnl If the function is declared but does not appear to exist, it may be |
2086401c42d7
Avoid redefinition errors on MSVC.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
53 dnl defined as an inline function. In order to avoid a conflict, we have |
2086401c42d7
Avoid redefinition errors on MSVC.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
54 dnl to define rpl_vsnprintf, not vsnprintf. |
2086401c42d7
Avoid redefinition errors on MSVC.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
55 REPLACE_VSNPRINTF=1 |
2086401c42d7
Avoid redefinition errors on MSVC.
Bruno Haible <bruno@clisp.org>
parents:
18189
diff
changeset
|
56 fi |
8363
b55fb0efed6d
New module 'vsnprintf-posix'.
Bruno Haible <bruno@clisp.org>
parents:
8211
diff
changeset
|
57 fi |
5340 | 58 gl_PREREQ_VSNPRINTF |
59 ]) | |
60 | |
61 # Prerequisites of lib/vsnprintf.c. | |
62 AC_DEFUN([gl_PREREQ_VSNPRINTF], [:]) |