snprintf.m4 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # snprintf.m4 serial 6
  2. dnl Copyright (C) 2002-2004, 2007-2014 Free Software Foundation, Inc.
  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. dnl Libintl 0.17 will replace snprintf only if it does not support %1$s,
  7. dnl but defers to any gnulib snprintf replacements. Therefore, gnulib
  8. dnl must guarantee that the decision for replacing snprintf is a superset
  9. dnl of the reasons checked by libintl.
  10. AC_DEFUN([gl_FUNC_SNPRINTF],
  11. [
  12. AC_REQUIRE([gl_STDIO_H_DEFAULTS])
  13. gl_cv_func_snprintf_usable=no
  14. AC_CHECK_FUNCS([snprintf])
  15. if test $ac_cv_func_snprintf = yes; then
  16. gl_SNPRINTF_SIZE1
  17. case "$gl_cv_func_snprintf_size1" in
  18. *yes)
  19. gl_SNPRINTF_RETVAL_C99
  20. case "$gl_cv_func_snprintf_retval_c99" in
  21. *yes)
  22. gl_PRINTF_POSITIONS
  23. case "$gl_cv_func_printf_positions" in
  24. *yes)
  25. gl_cv_func_snprintf_usable=yes
  26. ;;
  27. esac
  28. ;;
  29. esac
  30. ;;
  31. esac
  32. fi
  33. if test $gl_cv_func_snprintf_usable = no; then
  34. gl_REPLACE_SNPRINTF
  35. fi
  36. AC_CHECK_DECLS_ONCE([snprintf])
  37. if test $ac_cv_have_decl_snprintf = no; then
  38. HAVE_DECL_SNPRINTF=0
  39. fi
  40. ])
  41. AC_DEFUN([gl_REPLACE_SNPRINTF],
  42. [
  43. AC_REQUIRE([gl_STDIO_H_DEFAULTS])
  44. AC_LIBOBJ([snprintf])
  45. if test $ac_cv_func_snprintf = yes; then
  46. REPLACE_SNPRINTF=1
  47. fi
  48. gl_PREREQ_SNPRINTF
  49. ])
  50. # Prerequisites of lib/snprintf.c.
  51. AC_DEFUN([gl_PREREQ_SNPRINTF], [:])