summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--m4/vasnwprintf-gnu.m426
-rw-r--r--m4/vasnwprintf-posix.m429
-rw-r--r--modules/vasnwprintf-gnu32
4 files changed, 82 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index ddadbad8d1..994d8792f7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2023-03-24 Bruno Haible <bruno@clisp.org>
+ vasnwprintf-gnu: New module.
+ * m4/vasnwprintf-posix.m4 (gl_FUNC_VASNWPRINTF_IS_POSIX): New macro.
+ (gl_FUNC_VASNWPRINTF_POSIX): Require it. Invoke
+ gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS.
+ * m4/vasnwprintf-gnu.m4: New file, based on m4/vasnprintf-gnu.m4.
+ * modules/vasnwprintf-gnu: New file, based on modules/vasnprintf-gnu.
+
+2023-03-24 Bruno Haible <bruno@clisp.org>
+
obstack-printf-gnu: Add tests.
* modules/obstack-printf-gnu-tests: New file, based on
modules/obstack-printf-posix-tests.
diff --git a/m4/vasnwprintf-gnu.m4 b/m4/vasnwprintf-gnu.m4
new file mode 100644
index 0000000000..ee89bef237
--- /dev/null
+++ b/m4/vasnwprintf-gnu.m4
@@ -0,0 +1,26 @@
+# vasnwprintf-gnu.m4 serial 1
+dnl Copyright (C) 2023 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_VASNWPRINTF_GNU],
+[
+ AC_REQUIRE([gl_FUNC_VASNWPRINTF_IS_POSIX])
+ AC_REQUIRE([gl_PRINTF_DIRECTIVE_UPPERCASE_B])
+ gl_cv_func_vasnwprintf_gnu=no
+ if test $gl_cv_func_vasnwprintf_posix = yes; then
+ case "$gl_cv_func_printf_directive_uppercase_b" in
+ *yes)
+ # vasnwprintf exists and is already POSIX compliant and GNU compatible.
+ gl_cv_func_vasnwprintf_gnu=yes
+ ;;
+ esac
+ fi
+ if test $gl_cv_func_vasnwprintf_gnu = no; then
+ dnl Note: This invokes gl_PREREQ_VASNPRINTF_DIRECTIVE_LC although not needed
+ dnl here. Doesn't matter.
+ gl_PREREQ_VASNPRINTF_WITH_GNU_EXTRAS
+ gl_FUNC_VASNWPRINTF
+ fi
+])
diff --git a/m4/vasnwprintf-posix.m4 b/m4/vasnwprintf-posix.m4
index d9dc41fa97..310b4ffe60 100644
--- a/m4/vasnwprintf-posix.m4
+++ b/m4/vasnwprintf-posix.m4
@@ -1,4 +1,4 @@
-# vasnwprintf-posix.m4 serial 2
+# vasnwprintf-posix.m4 serial 3
dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -6,17 +6,18 @@ dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_VASNWPRINTF_POSIX],
[
- gl_FUNC_VASNWPRINTF
- 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_B
- 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
+ AC_REQUIRE([gl_FUNC_VASNWPRINTF_IS_POSIX])
+ if test $gl_cv_func_vasnwprintf_posix = no; then
+ dnl Note: This invokes gl_PREREQ_VASNPRINTF_DIRECTIVE_LC although not needed
+ dnl here. Doesn't matter.
+ gl_PREREQ_VASNPRINTF_WITH_POSIX_EXTRAS
+ gl_FUNC_VASNWPRINTF
+ fi
+])
+
+dnl Test whether vasnwprintf exists and is POSIX compliant.
+dnl Result is gl_cv_func_vasnwprintf_posix.
+AC_DEFUN([gl_FUNC_VASNWPRINTF_IS_POSIX],
+[
+ gl_cv_func_vasnwprintf_posix=no
])
diff --git a/modules/vasnwprintf-gnu b/modules/vasnwprintf-gnu
new file mode 100644
index 0000000000..582a185edd
--- /dev/null
+++ b/modules/vasnwprintf-gnu
@@ -0,0 +1,32 @@
+Description:
+POSIX and GNU compatible vswprintf with automatic memory allocation and bounded
+output size.
+
+Comment:
+This module should not be used as a dependency from a test module,
+otherwise when this module occurs as a tests-related module, it will
+have side effects on the compilation of the 'vasnwprintf' module, if
+that module occurs among the main modules in lib/.
+
+Files:
+m4/vasnwprintf-gnu.m4
+
+Depends-on:
+vasnwprintf-posix
+
+configure.ac:
+gl_FUNC_VASNWPRINTF_GNU
+
+Makefile.am:
+
+Include:
+"vasnwprintf.h"
+
+Link:
+$(MBRTOWC_LIB)
+
+License:
+LGPLv2+
+
+Maintainer:
+all