New module 'fprintf-posix'.
[gnulib.git] / m4 / fprintf-posix.m4
1 # fprintf-posix.m4 serial 1
2 dnl Copyright (C) 2007 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
7 AC_DEFUN([gl_FUNC_FPRINTF_POSIX],
8 [
9   AC_REQUIRE([gl_EOVERFLOW])
10   AC_REQUIRE([gl_PRINTF_SIZES_C99])
11   AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
12   AC_REQUIRE([gl_PRINTF_DIRECTIVE_N])
13   AC_REQUIRE([gl_PRINTF_POSITIONS])
14   gl_cv_func_fprintf_posix=no
15   case "$gl_cv_func_printf_sizes_c99" in
16     *yes)
17       case "$gl_cv_func_printf_directive_a" in
18         *yes)
19           case "$gl_cv_func_printf_directive_n" in
20             *yes)
21               case "$gl_cv_func_printf_positions" in
22                 *yes)
23                   # fprintf exists and is already POSIX compliant.
24                   gl_cv_func_fprintf_posix=yes
25                   ;;
26               esac
27               ;;
28           esac
29           ;;
30       esac
31       ;;
32   esac
33   if test $gl_cv_func_fprintf_posix = no; then
34     if ! expr "$gl_cv_func_printf_directive_a" : ".*yes" > /dev/null; then
35       AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], 1,
36         [Define if the vasnprintf implementation needs special code for
37          the 'a' and 'A' directives.])
38     fi
39     gl_REPLACE_VASNPRINTF
40     gl_REPLACE_FPRINTF
41   fi
42 ])
43
44 AC_DEFUN([gl_REPLACE_FPRINTF],
45 [
46   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
47   AC_LIBOBJ([fprintf])
48   REPLACE_FPRINTF=1
49   gl_PREREQ_FPRINTF
50 ])
51
52 AC_DEFUN([gl_PREREQ_FPRINTF], [:])