* lib/Makefile.am, lib/alloca.c, lib/alloca.in.h, lib/argp-ba.c, lib/argp-eexst.c, lib/argp-fmtstream.c, lib/argp-fmtstream.h, lib/argp-fs-xinl.c, lib/argp-help.c, lib/argp-namefrob.h, lib/argp-parse.c, lib/argp-pin.c, lib/argp-pv.c, lib/argp-pvh.c, lib/argp-xinl.c, lib/argp.h, lib/asnprintf.c, lib/basename-lgpl.c, lib/dirname-lgpl.c, lib/dirname.h, lib/dosname.h, lib/errno.in.h, lib/float+.h, lib/float.c, lib/float.in.h, lib/getopt.c, lib/getopt.in.h, lib/getopt1.c, lib/getopt_int.h, lib/gettext.h, lib/intprops.h, lib/itold.c, lib/malloc.c, lib/memchr.c, lib/memchr.valgrind, lib/mempcpy.c, lib/printf-args.c, lib/printf-args.h, lib/printf-parse.c, lib/printf-parse.h, lib/rawmemchr.c, lib/rawmemchr.valgrind, lib/size_max.h, lib/sleep.c, lib/stdalign.in.h, lib/stdbool.in.h, lib/stddef.in.h, lib/stdint.in.h, lib/stdio.in.h, lib/stdlib.in.h, lib/strcasecmp.c, lib/strchrnul.c, lib/strchrnul.valgrind, lib/strerror-override.c, lib/strerror-override.h, lib/strerror.c, lib/string.in.h, lib/strings.in.h, lib/stripslash.c, lib/strncasecmp.c, lib/strndup.c, lib/strnlen.c, lib/sys_types.in.h, lib/sysexits.in.h, lib/unistd.in.h, lib/vasnprintf.c, lib/vasnprintf.h, lib/verify.h, lib/vsnprintf.c, lib/wchar.in.h, lib/xsize.h, m4/00gnulib.m4, m4/alloca.m4, m4/argp.m4, m4/dirname.m4, m4/double-slash-root.m4, m4/errno_h.m4, m4/exponentd.m4, m4/extensions.m4, m4/float_h.m4, m4/getopt.m4, m4/gnulib-cache.m4, m4/gnulib-common.m4, m4/gnulib-comp.m4, m4/gnulib-tool.m4, m4/include_next.m4, m4/intmax_t.m4, m4/inttypes_h.m4, m4/longlong.m4, m4/malloc.m4, m4/math_h.m4, m4/memchr.m4, m4/mempcpy.m4, m4/mmap-anon.m4, m4/multiarch.m4, m4/nocrash.m4, m4/off_t.m4, m4/printf.m4, m4/rawmemchr.m4, m4/size_max.m4, m4/sleep.m4, m4/ssize_t.m4, m4/stdalign.m4, m4/stdbool.m4, m4/stddef_h.m4, m4/stdint.m4, m4/stdint_h.m4, m4/stdio_h.m4, m4/stdlib_h.m4, m4/strcase.m4, m4/strchrnul.m4, m4/strerror.m4, m4/string_h.m4, m4/strings_h.m4, m4/strndup.m4, m4/strnlen.m4, m4/sys_socket_h.m4, m4/sys_types_h.m4, m4/sysexits.m4, m4/unistd_h.m4, m4/vasnprintf.m4, m4/vsnprintf.m4, m4/warn-on-use.m4, m4/wchar_h.m4, m4/wchar_t.m4, m4/wint_t.m4, m4/xsize.m4, tools/snippet/_Noreturn.h, tools/snippet/arg-nonnull.h, tools/snippet/c++defs.h, tools/snippet/warn-on-use.h: New files from gnulib 1af55d85d9762a679b4302d5995f05ccd883e956. * configure.ac, Makefile.am: Adjust to compile gnulib. * src/bin/Makefile.am: Adjust to use gnulib. * README: Mention lib/.
292 lines
8.6 KiB
Text
292 lines
8.6 KiB
Text
# vasnprintf.m4 serial 35
|
|
dnl Copyright (C) 2002-2004, 2006-2012 Free Software Foundation, Inc.
|
|
dnl This file is free software; the Free Software Foundation
|
|
dnl gives unlimited permission to copy and/or distribute it,
|
|
dnl with or without modifications, as long as this notice is preserved.
|
|
|
|
AC_DEFUN([gl_FUNC_VASNPRINTF],
|
|
[
|
|
AC_CHECK_FUNCS_ONCE([vasnprintf])
|
|
if test $ac_cv_func_vasnprintf = no; then
|
|
gl_REPLACE_VASNPRINTF
|
|
fi
|
|
])
|
|
|
|
AC_DEFUN([gl_REPLACE_VASNPRINTF],
|
|
[
|
|
AC_CHECK_FUNCS_ONCE([vasnprintf])
|
|
AC_LIBOBJ([vasnprintf])
|
|
AC_LIBOBJ([printf-args])
|
|
AC_LIBOBJ([printf-parse])
|
|
AC_LIBOBJ([asnprintf])
|
|
if test $ac_cv_func_vasnprintf = yes; then
|
|
AC_DEFINE([REPLACE_VASNPRINTF], [1],
|
|
[Define if vasnprintf exists but is overridden by gnulib.])
|
|
fi
|
|
gl_PREREQ_PRINTF_ARGS
|
|
gl_PREREQ_PRINTF_PARSE
|
|
gl_PREREQ_VASNPRINTF
|
|
gl_PREREQ_ASNPRINTF
|
|
])
|
|
|
|
# Prerequisites of lib/printf-args.h, lib/printf-args.c.
|
|
AC_DEFUN([gl_PREREQ_PRINTF_ARGS],
|
|
[
|
|
AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
|
|
AC_REQUIRE([gt_TYPE_WCHAR_T])
|
|
AC_REQUIRE([gt_TYPE_WINT_T])
|
|
])
|
|
|
|
# Prerequisites of lib/printf-parse.h, lib/printf-parse.c.
|
|
AC_DEFUN([gl_PREREQ_PRINTF_PARSE],
|
|
[
|
|
AC_REQUIRE([gl_FEATURES_H])
|
|
AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
|
|
AC_REQUIRE([gt_TYPE_WCHAR_T])
|
|
AC_REQUIRE([gt_TYPE_WINT_T])
|
|
AC_REQUIRE([AC_TYPE_SIZE_T])
|
|
AC_CHECK_TYPE([ptrdiff_t], ,
|
|
[AC_DEFINE([ptrdiff_t], [long],
|
|
[Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
|
|
])
|
|
AC_REQUIRE([gt_AC_TYPE_INTMAX_T])
|
|
])
|
|
|
|
# Prerequisites of lib/vasnprintf.c.
|
|
AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF],
|
|
[
|
|
AC_REQUIRE([AC_C_INLINE])
|
|
AC_REQUIRE([AC_FUNC_ALLOCA])
|
|
AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
|
|
AC_REQUIRE([gt_TYPE_WCHAR_T])
|
|
AC_REQUIRE([gt_TYPE_WINT_T])
|
|
AC_CHECK_FUNCS([snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb])
|
|
dnl Use the _snprintf function only if it is declared (because on NetBSD it
|
|
dnl is defined as a weak alias of snprintf; we prefer to use the latter).
|
|
AC_CHECK_DECLS([_snprintf], , , [[#include <stdio.h>]])
|
|
dnl Knowing DBL_EXPBIT0_WORD and DBL_EXPBIT0_BIT enables an optimization
|
|
dnl in the code for NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE.
|
|
AC_REQUIRE([gl_DOUBLE_EXPONENT_LOCATION])
|
|
dnl We can avoid a lot of code by assuming that snprintf's return value
|
|
dnl conforms to ISO C99. So check that.
|
|
AC_REQUIRE([gl_SNPRINTF_RETVAL_C99])
|
|
case "$gl_cv_func_snprintf_retval_c99" in
|
|
*yes)
|
|
AC_DEFINE([HAVE_SNPRINTF_RETVAL_C99], [1],
|
|
[Define if the return value of the snprintf function is the number of
|
|
of bytes (excluding the terminating NUL) that would have been produced
|
|
if the buffer had been large enough.])
|
|
;;
|
|
esac
|
|
])
|
|
|
|
# Extra prerequisites of lib/vasnprintf.c for supporting 'long double'
|
|
# arguments.
|
|
AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE],
|
|
[
|
|
AC_REQUIRE([gl_PRINTF_LONG_DOUBLE])
|
|
case "$gl_cv_func_printf_long_double" in
|
|
*yes)
|
|
;;
|
|
*)
|
|
AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1],
|
|
[Define if the vasnprintf implementation needs special code for
|
|
'long double' arguments.])
|
|
;;
|
|
esac
|
|
])
|
|
|
|
# Extra prerequisites of lib/vasnprintf.c for supporting infinite 'double'
|
|
# arguments.
|
|
AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE],
|
|
[
|
|
AC_REQUIRE([gl_PRINTF_INFINITE])
|
|
case "$gl_cv_func_printf_infinite" in
|
|
*yes)
|
|
;;
|
|
*)
|
|
AC_DEFINE([NEED_PRINTF_INFINITE_DOUBLE], [1],
|
|
[Define if the vasnprintf implementation needs special code for
|
|
infinite 'double' arguments.])
|
|
;;
|
|
esac
|
|
])
|
|
|
|
# Extra prerequisites of lib/vasnprintf.c for supporting infinite 'long double'
|
|
# arguments.
|
|
AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE],
|
|
[
|
|
AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE])
|
|
dnl There is no need to set NEED_PRINTF_INFINITE_LONG_DOUBLE if
|
|
dnl NEED_PRINTF_LONG_DOUBLE is already set.
|
|
AC_REQUIRE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE])
|
|
case "$gl_cv_func_printf_long_double" in
|
|
*yes)
|
|
case "$gl_cv_func_printf_infinite_long_double" in
|
|
*yes)
|
|
;;
|
|
*)
|
|
AC_DEFINE([NEED_PRINTF_INFINITE_LONG_DOUBLE], [1],
|
|
[Define if the vasnprintf implementation needs special code for
|
|
infinite 'long double' arguments.])
|
|
;;
|
|
esac
|
|
;;
|
|
esac
|
|
])
|
|
|
|
# Extra prerequisites of lib/vasnprintf.c for supporting the 'a' directive.
|
|
AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_A],
|
|
[
|
|
AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
|
|
case "$gl_cv_func_printf_directive_a" in
|
|
*yes)
|
|
;;
|
|
*)
|
|
AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], [1],
|
|
[Define if the vasnprintf implementation needs special code for
|
|
the 'a' and 'A' directives.])
|
|
AC_CHECK_FUNCS([nl_langinfo])
|
|
;;
|
|
esac
|
|
])
|
|
|
|
# Extra prerequisites of lib/vasnprintf.c for supporting the 'F' directive.
|
|
AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_F],
|
|
[
|
|
AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
|
|
case "$gl_cv_func_printf_directive_f" in
|
|
*yes)
|
|
;;
|
|
*)
|
|
AC_DEFINE([NEED_PRINTF_DIRECTIVE_F], [1],
|
|
[Define if the vasnprintf implementation needs special code for
|
|
the 'F' directive.])
|
|
;;
|
|
esac
|
|
])
|
|
|
|
# Extra prerequisites of lib/vasnprintf.c for supporting the 'ls' directive.
|
|
AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_LS],
|
|
[
|
|
AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
|
|
case "$gl_cv_func_printf_directive_ls" in
|
|
*yes)
|
|
;;
|
|
*)
|
|
AC_DEFINE([NEED_PRINTF_DIRECTIVE_LS], [1],
|
|
[Define if the vasnprintf implementation needs special code for
|
|
the 'ls' directive.])
|
|
;;
|
|
esac
|
|
])
|
|
|
|
# Extra prerequisites of lib/vasnprintf.c for supporting the ' flag.
|
|
AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING],
|
|
[
|
|
AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
|
|
case "$gl_cv_func_printf_flag_grouping" in
|
|
*yes)
|
|
;;
|
|
*)
|
|
AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], [1],
|
|
[Define if the vasnprintf implementation needs special code for the
|
|
' flag.])
|
|
;;
|
|
esac
|
|
])
|
|
|
|
# Extra prerequisites of lib/vasnprintf.c for supporting the '-' flag.
|
|
AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST],
|
|
[
|
|
AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
|
|
case "$gl_cv_func_printf_flag_leftadjust" in
|
|
*yes)
|
|
;;
|
|
*)
|
|
AC_DEFINE([NEED_PRINTF_FLAG_LEFTADJUST], [1],
|
|
[Define if the vasnprintf implementation needs special code for the
|
|
'-' flag.])
|
|
;;
|
|
esac
|
|
])
|
|
|
|
# Extra prerequisites of lib/vasnprintf.c for supporting the 0 flag.
|
|
AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO],
|
|
[
|
|
AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
|
|
case "$gl_cv_func_printf_flag_zero" in
|
|
*yes)
|
|
;;
|
|
*)
|
|
AC_DEFINE([NEED_PRINTF_FLAG_ZERO], [1],
|
|
[Define if the vasnprintf implementation needs special code for the
|
|
0 flag.])
|
|
;;
|
|
esac
|
|
])
|
|
|
|
# Extra prerequisites of lib/vasnprintf.c for supporting large precisions.
|
|
AC_DEFUN([gl_PREREQ_VASNPRINTF_PRECISION],
|
|
[
|
|
AC_REQUIRE([gl_PRINTF_PRECISION])
|
|
case "$gl_cv_func_printf_precision" in
|
|
*yes)
|
|
;;
|
|
*)
|
|
AC_DEFINE([NEED_PRINTF_UNBOUNDED_PRECISION], [1],
|
|
[Define if the vasnprintf implementation needs special code for
|
|
supporting large precisions without arbitrary bounds.])
|
|
AC_DEFINE([NEED_PRINTF_DOUBLE], [1],
|
|
[Define if the vasnprintf implementation needs special code for
|
|
'double' arguments.])
|
|
AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1],
|
|
[Define if the vasnprintf implementation needs special code for
|
|
'long double' arguments.])
|
|
;;
|
|
esac
|
|
])
|
|
|
|
# Extra prerequisites of lib/vasnprintf.c for surviving out-of-memory
|
|
# conditions.
|
|
AC_DEFUN([gl_PREREQ_VASNPRINTF_ENOMEM],
|
|
[
|
|
AC_REQUIRE([gl_PRINTF_ENOMEM])
|
|
case "$gl_cv_func_printf_enomem" in
|
|
*yes)
|
|
;;
|
|
*)
|
|
AC_DEFINE([NEED_PRINTF_ENOMEM], [1],
|
|
[Define if the vasnprintf implementation needs special code for
|
|
surviving out-of-memory conditions.])
|
|
AC_DEFINE([NEED_PRINTF_DOUBLE], [1],
|
|
[Define if the vasnprintf implementation needs special code for
|
|
'double' arguments.])
|
|
AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1],
|
|
[Define if the vasnprintf implementation needs special code for
|
|
'long double' arguments.])
|
|
;;
|
|
esac
|
|
])
|
|
|
|
# Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance.
|
|
AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS],
|
|
[
|
|
AC_REQUIRE([gl_PREREQ_VASNPRINTF])
|
|
gl_PREREQ_VASNPRINTF_LONG_DOUBLE
|
|
gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE
|
|
gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
|
|
gl_PREREQ_VASNPRINTF_DIRECTIVE_A
|
|
gl_PREREQ_VASNPRINTF_DIRECTIVE_F
|
|
gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
|
|
gl_PREREQ_VASNPRINTF_FLAG_GROUPING
|
|
gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
|
|
gl_PREREQ_VASNPRINTF_FLAG_ZERO
|
|
gl_PREREQ_VASNPRINTF_PRECISION
|
|
gl_PREREQ_VASNPRINTF_ENOMEM
|
|
])
|
|
|
|
# Prerequisites of lib/asnprintf.c.
|
|
AC_DEFUN([gl_PREREQ_ASNPRINTF],
|
|
[
|
|
])
|