changeset 269:6cbc409ff09f 2.6

Added asprintf redux
author lost
date Tue, 22 Dec 2009 05:53:05 +0000
parents c48e676d641f
children 6e940229360b
files Makefile.in aclocal.m4 configure doc/Makefile.in lib/Makefile.am lib/Makefile.in lib/asprintf.c lib/vasprintf.c lwar/Makefile.in lwasm/Makefile.in lwasm/config.h.in lwlink/Makefile.in m4/gnulib-cache.m4 m4/gnulib-comp.m4 m4/vasprintf.m4
diffstat 15 files changed, 257 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.in	Tue Dec 22 05:46:58 2009 +0000
+++ b/Makefile.in	Tue Dec 22 05:53:05 2009 +0000
@@ -62,10 +62,11 @@
 	$(top_srcdir)/m4/strings_h.m4 $(top_srcdir)/m4/strndup.m4 \
 	$(top_srcdir)/m4/strnlen.m4 $(top_srcdir)/m4/sysexits.m4 \
 	$(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/vasnprintf.m4 \
-	$(top_srcdir)/m4/vsnprintf.m4 $(top_srcdir)/m4/wchar.m4 \
-	$(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \
-	$(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xsize.m4 \
-	$(top_srcdir)/m4/xstrndup.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/vsnprintf.m4 \
+	$(top_srcdir)/m4/wchar.m4 $(top_srcdir)/m4/wchar_t.m4 \
+	$(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xalloc.m4 \
+	$(top_srcdir)/m4/xsize.m4 $(top_srcdir)/m4/xstrndup.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
--- a/aclocal.m4	Tue Dec 22 05:46:58 2009 +0000
+++ b/aclocal.m4	Tue Dec 22 05:53:05 2009 +0000
@@ -1441,6 +1441,7 @@
 m4_include([m4/sysexits.m4])
 m4_include([m4/unistd_h.m4])
 m4_include([m4/vasnprintf.m4])
+m4_include([m4/vasprintf.m4])
 m4_include([m4/vsnprintf.m4])
 m4_include([m4/wchar.m4])
 m4_include([m4/wchar_t.m4])
--- a/configure	Tue Dec 22 05:46:58 2009 +0000
+++ b/configure	Tue Dec 22 05:53:05 2009 +0000
@@ -9571,6 +9571,68 @@
   fi
 
 
+  for ac_func in vasprintf
+do :
+  ac_fn_c_check_func "$LINENO" "vasprintf" "ac_cv_func_vasprintf"
+if test "x$ac_cv_func_vasprintf" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_VASPRINTF 1
+_ACEOF
+
+fi
+done
+
+  if test $ac_cv_func_vasprintf = no; then
+
+
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS vasprintf.$ac_objext"
+
+
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS asprintf.$ac_objext"
+
+
+  if test $ac_cv_func_vasprintf = yes; then
+    REPLACE_VASPRINTF=1
+  else
+    HAVE_VASPRINTF=0
+  fi
+
+
+
+
+
+
+
+
+  fi
+
+
+
+  GNULIB_VASPRINTF=1
+
+
+
+  XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS --flag=asprintf:2:c-format"
+
+
+
+  XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS --flag=vasprintf:2:c-format"
+
+
 
   gl_cv_func_vsnprintf_usable=no
   for ac_func in vsnprintf
--- a/doc/Makefile.in	Tue Dec 22 05:46:58 2009 +0000
+++ b/doc/Makefile.in	Tue Dec 22 05:53:05 2009 +0000
@@ -59,10 +59,11 @@
 	$(top_srcdir)/m4/strings_h.m4 $(top_srcdir)/m4/strndup.m4 \
 	$(top_srcdir)/m4/strnlen.m4 $(top_srcdir)/m4/sysexits.m4 \
 	$(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/vasnprintf.m4 \
-	$(top_srcdir)/m4/vsnprintf.m4 $(top_srcdir)/m4/wchar.m4 \
-	$(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \
-	$(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xsize.m4 \
-	$(top_srcdir)/m4/xstrndup.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/vsnprintf.m4 \
+	$(top_srcdir)/m4/wchar.m4 $(top_srcdir)/m4/wchar_t.m4 \
+	$(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xalloc.m4 \
+	$(top_srcdir)/m4/xsize.m4 $(top_srcdir)/m4/xstrndup.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
--- a/lib/Makefile.am	Tue Dec 22 05:46:58 2009 +0000
+++ b/lib/Makefile.am	Tue Dec 22 05:53:05 2009 +0000
@@ -9,7 +9,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --no-libtool --macro-prefix=gl argp asprintf
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --no-libtool --macro-prefix=gl argp vasprintf
 
 AUTOMAKE_OPTIONS = 1.5 gnits
 
@@ -695,6 +695,15 @@
 
 ## end   gnulib module vasnprintf
 
+## begin gnulib module vasprintf
+
+
+EXTRA_DIST += asprintf.c vasprintf.c
+
+EXTRA_libgnu_a_SOURCES += asprintf.c vasprintf.c
+
+## end   gnulib module vasprintf
+
 ## begin gnulib module vsnprintf
 
 
--- a/lib/Makefile.in	Tue Dec 22 05:46:58 2009 +0000
+++ b/lib/Makefile.in	Tue Dec 22 05:53:05 2009 +0000
@@ -24,7 +24,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --no-libtool --macro-prefix=gl argp
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --no-libtool --macro-prefix=gl argp vasprintf
 
 
 
@@ -74,10 +74,11 @@
 	$(top_srcdir)/m4/strings_h.m4 $(top_srcdir)/m4/strndup.m4 \
 	$(top_srcdir)/m4/strnlen.m4 $(top_srcdir)/m4/sysexits.m4 \
 	$(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/vasnprintf.m4 \
-	$(top_srcdir)/m4/vsnprintf.m4 $(top_srcdir)/m4/wchar.m4 \
-	$(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \
-	$(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xsize.m4 \
-	$(top_srcdir)/m4/xstrndup.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/vsnprintf.m4 \
+	$(top_srcdir)/m4/wchar.m4 $(top_srcdir)/m4/wchar_t.m4 \
+	$(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xalloc.m4 \
+	$(top_srcdir)/m4/xsize.m4 $(top_srcdir)/m4/xstrndup.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -563,7 +564,8 @@
 	string.in.h strings.in.h strndup.c strnlen.c sysexits.in.h \
 	unistd.in.h asnprintf.c float+.h printf-args.c printf-args.h \
 	printf-parse.c printf-parse.h vasnprintf.c vasnprintf.h \
-	vsnprintf.c wchar.in.h xalloc.h xmalloc.c
+	asprintf.c vasprintf.c vsnprintf.c wchar.in.h xalloc.h \
+	xmalloc.c
 BUILT_SOURCES = $(ALLOCA_H) $(ERRNO_H) $(FLOAT_H) $(GETOPT_H) \
 	$(STDBOOL_H) $(STDINT_H) stdio.h stdlib.h string.h strings.h \
 	$(SYSEXITS_H) unistd.h $(WCHAR_H)
@@ -591,7 +593,7 @@
 	mempcpy.c rawmemchr.c sleep.c stdio-write.c strcasecmp.c \
 	strncasecmp.c strchrnul.c strerror.c strndup.c strnlen.c \
 	asnprintf.c printf-args.c printf-parse.c vasnprintf.c \
-	vsnprintf.c xmalloc.c
+	asprintf.c vasprintf.c vsnprintf.c xmalloc.c
 LINK_WARNING_H = $(top_srcdir)/./link-warning.h
 all: $(BUILT_SOURCES)
 	$(MAKE) $(AM_MAKEFLAGS) all-recursive
@@ -664,6 +666,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/argp-pvh.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/argp-xinl.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asnprintf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asprintf.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basename.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dirname.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Po@am__quote@
@@ -685,6 +688,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strndup.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strnlen.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vasnprintf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vasprintf.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vsnprintf.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xalloc-die.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmalloc.Po@am__quote@
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/asprintf.c	Tue Dec 22 05:53:05 2009 +0000
@@ -0,0 +1,39 @@
+/* Formatted output to strings.
+   Copyright (C) 1999, 2002, 2006-2007 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#include <config.h>
+
+/* Specification.  */
+#ifdef IN_LIBASPRINTF
+# include "vasprintf.h"
+#else
+# include <stdio.h>
+#endif
+
+#include <stdarg.h>
+
+int
+asprintf (char **resultp, const char *format, ...)
+{
+  va_list args;
+  int result;
+
+  va_start (args, format);
+  result = vasprintf (resultp, format, args);
+  va_end (args);
+  return result;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/vasprintf.c	Tue Dec 22 05:53:05 2009 +0000
@@ -0,0 +1,51 @@
+/* Formatted output to strings.
+   Copyright (C) 1999, 2002, 2006-2008 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this program; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#include <config.h>
+
+/* Specification.  */
+#ifdef IN_LIBASPRINTF
+# include "vasprintf.h"
+#else
+# include <stdio.h>
+#endif
+
+#include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
+
+#include "vasnprintf.h"
+
+int
+vasprintf (char **resultp, const char *format, va_list args)
+{
+  size_t length;
+  char *result = vasnprintf (NULL, &length, format, args);
+  if (result == NULL)
+    return -1;
+
+  if (length > INT_MAX)
+    {
+      free (result);
+      errno = EOVERFLOW;
+      return -1;
+    }
+
+  *resultp = result;
+  /* Return the number of resulting bytes, excluding the trailing NUL.  */
+  return length;
+}
--- a/lwar/Makefile.in	Tue Dec 22 05:46:58 2009 +0000
+++ b/lwar/Makefile.in	Tue Dec 22 05:53:05 2009 +0000
@@ -61,10 +61,11 @@
 	$(top_srcdir)/m4/strings_h.m4 $(top_srcdir)/m4/strndup.m4 \
 	$(top_srcdir)/m4/strnlen.m4 $(top_srcdir)/m4/sysexits.m4 \
 	$(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/vasnprintf.m4 \
-	$(top_srcdir)/m4/vsnprintf.m4 $(top_srcdir)/m4/wchar.m4 \
-	$(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \
-	$(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xsize.m4 \
-	$(top_srcdir)/m4/xstrndup.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/vsnprintf.m4 \
+	$(top_srcdir)/m4/wchar.m4 $(top_srcdir)/m4/wchar_t.m4 \
+	$(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xalloc.m4 \
+	$(top_srcdir)/m4/xsize.m4 $(top_srcdir)/m4/xstrndup.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
--- a/lwasm/Makefile.in	Tue Dec 22 05:46:58 2009 +0000
+++ b/lwasm/Makefile.in	Tue Dec 22 05:53:05 2009 +0000
@@ -62,10 +62,11 @@
 	$(top_srcdir)/m4/strings_h.m4 $(top_srcdir)/m4/strndup.m4 \
 	$(top_srcdir)/m4/strnlen.m4 $(top_srcdir)/m4/sysexits.m4 \
 	$(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/vasnprintf.m4 \
-	$(top_srcdir)/m4/vsnprintf.m4 $(top_srcdir)/m4/wchar.m4 \
-	$(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \
-	$(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xsize.m4 \
-	$(top_srcdir)/m4/xstrndup.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/vsnprintf.m4 \
+	$(top_srcdir)/m4/wchar.m4 $(top_srcdir)/m4/wchar_t.m4 \
+	$(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xalloc.m4 \
+	$(top_srcdir)/m4/xsize.m4 $(top_srcdir)/m4/xstrndup.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
--- a/lwasm/config.h.in	Tue Dec 22 05:46:58 2009 +0000
+++ b/lwasm/config.h.in	Tue Dec 22 05:53:05 2009 +0000
@@ -308,6 +308,9 @@
 /* Define to 1 if you have the `vasnprintf' function. */
 #undef HAVE_VASNPRINTF
 
+/* Define to 1 if you have the `vasprintf' function. */
+#undef HAVE_VASPRINTF
+
 /* Define to 1 if you have the `vsnprintf' function. */
 #undef HAVE_VSNPRINTF
 
--- a/lwlink/Makefile.in	Tue Dec 22 05:46:58 2009 +0000
+++ b/lwlink/Makefile.in	Tue Dec 22 05:53:05 2009 +0000
@@ -61,10 +61,11 @@
 	$(top_srcdir)/m4/strings_h.m4 $(top_srcdir)/m4/strndup.m4 \
 	$(top_srcdir)/m4/strnlen.m4 $(top_srcdir)/m4/sysexits.m4 \
 	$(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/vasnprintf.m4 \
-	$(top_srcdir)/m4/vsnprintf.m4 $(top_srcdir)/m4/wchar.m4 \
-	$(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \
-	$(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xsize.m4 \
-	$(top_srcdir)/m4/xstrndup.m4 $(top_srcdir)/configure.ac
+	$(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/vsnprintf.m4 \
+	$(top_srcdir)/m4/wchar.m4 $(top_srcdir)/m4/wchar_t.m4 \
+	$(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xalloc.m4 \
+	$(top_srcdir)/m4/xsize.m4 $(top_srcdir)/m4/xstrndup.m4 \
+	$(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
--- a/m4/gnulib-cache.m4	Tue Dec 22 05:46:58 2009 +0000
+++ b/m4/gnulib-cache.m4	Tue Dec 22 05:53:05 2009 +0000
@@ -15,13 +15,13 @@
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --no-libtool --macro-prefix=gl argp asprintf
+#   gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --no-libtool --macro-prefix=gl argp vasprintf
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
 gl_LOCAL_DIR([])
 gl_MODULES([
   argp
-  asprintf
+  vasprintf
 ])
 gl_AVOID([])
 gl_SOURCE_BASE([lib])
--- a/m4/gnulib-comp.m4	Tue Dec 22 05:46:58 2009 +0000
+++ b/m4/gnulib-comp.m4	Tue Dec 22 05:53:05 2009 +0000
@@ -91,6 +91,11 @@
   gl_SYSEXITS
   gl_UNISTD_H
   gl_FUNC_VASNPRINTF
+  gl_FUNC_VASPRINTF
+  gl_STDIO_MODULE_INDICATOR([vasprintf])
+  m4_ifdef([AM_XGETTEXT_OPTION],
+    [AM_XGETTEXT_OPTION([--flag=asprintf:2:c-format])
+     AM_XGETTEXT_OPTION([--flag=vasprintf:2:c-format])])
   gl_FUNC_VSNPRINTF
   gl_STDIO_MODULE_INDICATOR([vsnprintf])
   gl_WCHAR_H
@@ -246,6 +251,7 @@
   lib/argp-xinl.c
   lib/argp.h
   lib/asnprintf.c
+  lib/asprintf.c
   lib/basename.c
   lib/dirname.c
   lib/dirname.h
@@ -291,6 +297,7 @@
   lib/unistd.in.h
   lib/vasnprintf.c
   lib/vasnprintf.h
+  lib/vasprintf.c
   lib/vsnprintf.c
   lib/wchar.in.h
   lib/xalloc-die.c
@@ -340,6 +347,7 @@
   m4/sysexits.m4
   m4/unistd_h.m4
   m4/vasnprintf.m4
+  m4/vasprintf.m4
   m4/vsnprintf.m4
   m4/wchar.m4
   m4/wchar_t.m4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m4/vasprintf.m4	Tue Dec 22 05:53:05 2009 +0000
@@ -0,0 +1,45 @@
+# vasprintf.m4 serial 6
+dnl Copyright (C) 2002-2003, 2006-2007 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_VASPRINTF],
+[
+  AC_CHECK_FUNCS([vasprintf])
+  if test $ac_cv_func_vasprintf = no; then
+    gl_REPLACE_VASPRINTF
+  fi
+])
+
+AC_DEFUN([gl_REPLACE_VASPRINTF],
+[
+  AC_LIBOBJ([vasprintf])
+  AC_LIBOBJ([asprintf])
+  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  if test $ac_cv_func_vasprintf = yes; then
+    REPLACE_VASPRINTF=1
+  else
+    HAVE_VASPRINTF=0
+  fi
+  gl_PREREQ_VASPRINTF_H
+  gl_PREREQ_VASPRINTF
+  gl_PREREQ_ASPRINTF
+])
+
+# Prerequisites of the vasprintf portion of lib/stdio.h.
+AC_DEFUN([gl_PREREQ_VASPRINTF_H],
+[
+  dnl Persuade glibc <stdio.h> to declare asprintf() and vasprintf().
+  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+])
+
+# Prerequisites of lib/vasprintf.c.
+AC_DEFUN([gl_PREREQ_VASPRINTF],
+[
+])
+
+# Prerequisites of lib/asprintf.c.
+AC_DEFUN([gl_PREREQ_ASPRINTF],
+[
+])