1# obstack-printf.m4 serial 4
2dnl Copyright (C) 2008-2020 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7dnl From Eric Blake.
8dnl Test whether obstack_printf() exists.  For now, we assume that
9dnl obstack_vprintf behaves identically, so we only test for one.
10
11AC_DEFUN([gl_FUNC_OBSTACK_PRINTF],
12[
13  dnl Persuade glibc <stdio.h> to declare obstack_printf(), obstack_vprintf().
14  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
15
16  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
17  AC_CHECK_FUNCS_ONCE([obstack_printf])
18  if test $ac_cv_func_obstack_printf = no ; then
19    gl_REPLACE_OBSTACK_PRINTF
20  fi
21
22  gl_DECL_OBSTACK_PRINTF
23])
24
25AC_DEFUN([gl_REPLACE_OBSTACK_PRINTF],
26[
27  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
28  if test $ac_cv_func_obstack_printf = yes; then
29    REPLACE_OBSTACK_PRINTF=1
30  fi
31])
32
33dnl Ensure obstack_printf() and obstack_vprintf() are declared
34dnl (whether or not they are being replaced).
35AC_DEFUN([gl_DECL_OBSTACK_PRINTF],
36[
37  AC_CHECK_DECLS_ONCE([obstack_printf])
38  if test $ac_cv_have_decl_obstack_printf = no; then
39    HAVE_DECL_OBSTACK_PRINTF=0
40  fi
41])
42