summaryrefslogtreecommitdiff
path: root/gl/m4/printf.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/printf.m4')
-rw-r--r--gl/m4/printf.m428
1 files changed, 23 insertions, 5 deletions
diff --git a/gl/m4/printf.m4 b/gl/m4/printf.m4
index 9df21534..df473d87 100644
--- a/gl/m4/printf.m4
+++ b/gl/m4/printf.m4
@@ -1,4 +1,4 @@
-# printf.m4 serial 62
+# printf.m4 serial 64
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.
@@ -1412,10 +1422,18 @@ int main ()
[gl_cv_func_snprintf_directive_n=yes],
[gl_cv_func_snprintf_directive_n=no],
[
-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"])
+ ;;
+changequote(,)dnl
# Guess yes on musl systems.
*-musl*) gl_cv_func_snprintf_directive_n="guessing yes";;
# Guess yes on FreeBSD >= 5.
@@ -1448,8 +1466,8 @@ changequote(,)dnl
mingw*) gl_cv_func_snprintf_directive_n="guessing no";;
# If we don't know, obey --enable-cross-guesses.
*) gl_cv_func_snprintf_directive_n="$gl_cross_guess_normal";;
- esac
changequote([,])dnl
+ esac
])
])
])