[PATCH 50/59] squash! libctf, dedup: add deduplicator

Nick Alcock nick.alcock@oracle.com
Wed Jul 22 09:33:09 GMT 2020


Build on systems lacking stpcpy, such as mingw.

ChangeLog delta added to original commit:

libctf/
	* configure.ac: Check for stpcpy.
        * config.h.in: Regenerated.
        * configure: Regenerated.
        * ctf-decls.h [!HAVE_DECL_STPCPY]: Add prototype.
---
 libctf/config.h.in  |  4 ++++
 libctf/configure    | 10 ++++++++++
 libctf/configure.ac |  2 +-
 libctf/ctf-decls.h  |  4 ++++
 4 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/libctf/config.h.in b/libctf/config.h.in
index 2ddd5126088..5db637c7903 100644
--- a/libctf/config.h.in
+++ b/libctf/config.h.in
@@ -32,6 +32,10 @@
    don't. */
 #undef HAVE_DECL_BSWAP_64
 
+/* Define to 1 if you have the declaration of `stpcpy', and to 0 if you don't.
+   */
+#undef HAVE_DECL_STPCPY
+
 /* Define to 1 if you have the declaration of `vasprintf', and to 0 if you
    don't. */
 #undef HAVE_DECL_VASPRINTF
diff --git a/libctf/configure b/libctf/configure
index 9f16ae92b8d..a1f5b7ff09f 100755
--- a/libctf/configure
+++ b/libctf/configure
@@ -13186,6 +13186,16 @@ fi
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_VASPRINTF $ac_have_decl
 _ACEOF
+ac_fn_c_check_decl "$LINENO" "stpcpy" "ac_cv_have_decl_stpcpy" "$ac_includes_default"
+if test "x$ac_cv_have_decl_stpcpy" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STPCPY $ac_have_decl
+_ACEOF
 
 
 
diff --git a/libctf/configure.ac b/libctf/configure.ac
index 3799a0cb906..f5ed973b10d 100644
--- a/libctf/configure.ac
+++ b/libctf/configure.ac
@@ -108,7 +108,7 @@ AC_CHECK_FUNCS(pread)
 
 dnl Check for bswap_{16,32,64}
 AC_CHECK_DECLS([bswap_16, bswap_32, bswap_64], [], [], [[#include <byteswap.h>]])
-AC_CHECK_DECLS([asprintf, vasprintf])
+AC_CHECK_DECLS([asprintf, vasprintf, stpcpy])
 
 dnl Check for qsort_r.  (Taken from gnulib.)
 AC_CHECK_FUNCS_ONCE([qsort_r])
diff --git a/libctf/ctf-decls.h b/libctf/ctf-decls.h
index c47a72e722f..e1ada3b9592 100644
--- a/libctf/ctf-decls.h
+++ b/libctf/ctf-decls.h
@@ -72,4 +72,8 @@ void ctf_qsort_r (void *base, size_t nmemb, size_t size,
 #define MAX(a, b) ((a) > (b) ? (a) : (b))
 #define MIN(a, b) ((a) < (b) ? (a) : (b))
 
+#if !HAVE_DECL_STPCPY
+extern char *stpcpy (char *, const char *);
+#endif
+
 #endif /* _CTF_DECLS_H */
-- 
2.27.0.247.g3dff7de930


More information about the Binutils mailing list