[39/59] libctf: check for vasprintf

Message ID 20200630233146.338613-40-nick.alcock@oracle.com
State New
Headers show
Series
  • Deduplicating CTF linker
Related show

Commit Message

H.J. Lu via Binutils June 30, 2020, 11:31 p.m.
We've been using this for all of libctf's history in binutils: we should
check for it in configure.

libctf/
	configure.ac: Check for vasprintf.
	configure: Regenerated.
	config.h.in: Likewise.
---
 libctf/config.h.in  |  4 ++++
 libctf/configure    | 32 +++++++++++++++++++++-----------
 libctf/configure.ac |  2 +-
 3 files changed, 26 insertions(+), 12 deletions(-)

-- 
2.27.0.247.g3dff7de930

Patch

diff --git a/libctf/config.h.in b/libctf/config.h.in
index e663c694d85..897587e5875 100644
--- a/libctf/config.h.in
+++ b/libctf/config.h.in
@@ -29,6 +29,10 @@ 
    don't. */
 #undef HAVE_DECL_BSWAP_64
 
+/* Define to 1 if you have the declaration of `vasprintf', and to 0 if you
+   don't. */
+#undef HAVE_DECL_VASPRINTF
+
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
diff --git a/libctf/configure b/libctf/configure
index 1dc1b65fac3..58aaa3a529b 100755
--- a/libctf/configure
+++ b/libctf/configure
@@ -13099,17 +13099,6 @@  fi
 done
 
 
-ac_fn_c_check_decl "$LINENO" "asprintf" "ac_cv_have_decl_asprintf" "$ac_includes_default"
-if test "x$ac_cv_have_decl_asprintf" = xyes; then :
-  ac_have_decl=1
-else
-  ac_have_decl=0
-fi
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_ASPRINTF $ac_have_decl
-_ACEOF
-
 ac_fn_c_check_decl "$LINENO" "bswap_16" "ac_cv_have_decl_bswap_16" "#include <byteswap.h>
 "
 if test "x$ac_cv_have_decl_bswap_16" = xyes; then :
@@ -13144,6 +13133,27 @@  cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_BSWAP_64 $ac_have_decl
 _ACEOF
 
+ac_fn_c_check_decl "$LINENO" "asprintf" "ac_cv_have_decl_asprintf" "$ac_includes_default"
+if test "x$ac_cv_have_decl_asprintf" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_ASPRINTF $ac_have_decl
+_ACEOF
+ac_fn_c_check_decl "$LINENO" "vasprintf" "ac_cv_have_decl_vasprintf" "$ac_includes_default"
+if test "x$ac_cv_have_decl_vasprintf" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_VASPRINTF $ac_have_decl
+_ACEOF
+
 
 
 
diff --git a/libctf/configure.ac b/libctf/configure.ac
index f31108c0fad..26b062e7a54 100644
--- a/libctf/configure.ac
+++ b/libctf/configure.ac
@@ -100,9 +100,9 @@  AC_C_BIGENDIAN
 AC_CHECK_HEADERS(byteswap.h endian.h)
 AC_CHECK_FUNCS(pread)
 
-AC_CHECK_DECLS([asprintf])
 dnl Check for bswap_{16,32,64}
 AC_CHECK_DECLS([bswap_16, bswap_32, bswap_64], [], [], [[#include <byteswap.h>]])
+AC_CHECK_DECLS([asprintf, vasprintf])
 
 dnl Check for qsort_r.  (Taken from gnulib.)
 AC_CHECK_FUNCS_ONCE([qsort_r])