diff options
author | Bruno Haible <bruno@clisp.org> | 2020-03-08 22:54:02 +0100 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2020-03-08 22:54:02 +0100 |
commit | 1045f81589d74392c0d634c21f0452e81c973a9b (patch) | |
tree | f8c0451ae515674cbccce43bae241e93fe64dd84 /m4/printf.m4 | |
parent | 36ebd778f6c9c35c8a8d25d81a893b6e5a4fdf9d (diff) | |
download | gnulib-1045f81589d74392c0d634c21f0452e81c973a9b.tar.gz |
*printf-posix: Document why it's overridden on some glibc systems.
Reported by Adrian Bunk <bunk@stusta.de> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-03/msg00011.html>.
* doc/posix-functions/*printf.texi: Document the problem with the %n
directive on some glibc systems.
* m4/printf.m4 (gl_PRINTF_DIRECTIVE_N, gl_SNPRINTF_DIRECTIVE_N): Adjust
the cross-compilation guesses accordingly.
Diffstat (limited to 'm4/printf.m4')
-rw-r--r-- | m4/printf.m4 | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/m4/printf.m4 b/m4/printf.m4 index 9df21534b1..54a2d71314 100644 --- a/m4/printf.m4 +++ b/m4/printf.m4 @@ -1,4 +1,4 @@ -# printf.m4 serial 62 +# printf.m4 serial 63 dnl Copyright (C) 2003, 2007-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -711,6 +711,16 @@ int main () [gl_cv_func_printf_directive_n=yes], [gl_cv_func_printf_directive_n=no], [case "$host_os" in + # Guess no on glibc when _FORTIFY_SOURCE >= 2. + *-gnu* | gnu*) AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if _FORTIFY_SOURCE >= 2 + error fail + #endif + ]])], + [gl_cv_func_printf_directive_n="guessing yes"], + [gl_cv_func_printf_directive_n="guessing no"]) + ;; # Guess no on Android. linux*-android*) gl_cv_func_printf_directive_n="guessing no";; # Guess no on native Windows. @@ -1414,8 +1424,16 @@ int main () [ changequote(,)dnl case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_snprintf_directive_n="guessing yes";; + # Guess no on glibc when _FORTIFY_SOURCE >= 2. + *-gnu* | gnu*) AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if _FORTIFY_SOURCE >= 2 + error fail + #endif + ]])], + [gl_cv_func_snprintf_directive_n="guessing yes"], + [gl_cv_func_snprintf_directive_n="guessing no"]) + ;; # Guess yes on musl systems. *-musl*) gl_cv_func_snprintf_directive_n="guessing yes";; # Guess yes on FreeBSD >= 5. |