[binutils-gdb] PR 34486 opcodes fails to compile with mingw
Alan Modra via Binutils-cvs <[email protected]>
| Newsgroups | gmane.comp.gnu.binutils.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c5844702b5ab12b12e66084d06c38f5235437002 commit c5844702b5ab12b12e66084d06c38f5235437002 Author: Alan Modra <[email protected]> Date: Sun Aug 23 19:06:52 2026 +0930 PR 34486 opcodes fails to compile with mingw Add the config machinery to ensure asprintf is supplied by libiberty if missing. While we're at it, check decls for some other functions used in opcodes that may not be in C90 systems. * configure.ac: CHECK_DECLS for asprintf, snprintf, strtoull and vsnprintf. * configure: Regenerate. * config.in: Regenerate. Diff: --- opcodes/config.in | 16 ++++++++++++++++ opcodes/configure | 40 ++++++++++++++++++++++++++++++++++++++++ opcodes/configure.ac | 2 +- 3 files changed, 57 insertions(+), 1 deletion(-) diff --git a/opcodes/config.in b/opcodes/config.in index 64b3303d32d..36e654292b2 100644 --- a/opcodes/config.in +++ b/opcodes/config.in @@ -26,14 +26,30 @@ */ #undef HAVE_DCGETTEXT +/* Define to 1 if you have the declaration of `asprintf', and to 0 if you + don't. */ +#undef HAVE_DECL_ASPRINTF + /* Define to 1 if you have the declaration of `basename', and to 0 if you don't. */ #undef HAVE_DECL_BASENAME +/* Define to 1 if you have the declaration of `snprintf', and to 0 if you + don't. */ +#undef HAVE_DECL_SNPRINTF + /* 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 `strtoull', and to 0 if you + don't. */ +#undef HAVE_DECL_STRTOULL + +/* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you + don't. */ +#undef HAVE_DECL_VSNPRINTF + /* Define to 1 if you have the <dlfcn.h> header file. */ #undef HAVE_DLFCN_H diff --git a/opcodes/configure b/opcodes/configure index 3e0962b9408..7c0aad6a462 100755 --- a/opcodes/configure +++ b/opcodes/configure @@ -13969,6 +13969,16 @@ CPPFLAGS=$OLD_CPPFLAGS +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" "basename" "ac_cv_have_decl_basename" "$ac_includes_default" if test "x$ac_cv_have_decl_basename" = xyes; then : ac_have_decl=1 @@ -13979,6 +13989,16 @@ fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_BASENAME $ac_have_decl _ACEOF +ac_fn_c_check_decl "$LINENO" "snprintf" "ac_cv_have_decl_snprintf" "$ac_includes_default" +if test "x$ac_cv_have_decl_snprintf" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SNPRINTF $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 @@ -13989,6 +14009,26 @@ fi cat >>confdefs.h <<_ACEOF #define HAVE_DECL_STPCPY $ac_have_decl _ACEOF +ac_fn_c_check_decl "$LINENO" "strtoull" "ac_cv_have_decl_strtoull" "$ac_includes_default" +if test "x$ac_cv_have_decl_strtoull" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRTOULL $ac_have_decl +_ACEOF +ac_fn_c_check_decl "$LINENO" "vsnprintf" "ac_cv_have_decl_vsnprintf" "$ac_includes_default" +if test "x$ac_cv_have_decl_vsnprintf" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_VSNPRINTF $ac_have_decl +_ACEOF # Check if sigsetjmp is available. Using AC_CHECK_FUNCS won't do diff --git a/opcodes/configure.ac b/opcodes/configure.ac index 2c2556598c9..c6d8972aa0a 100644 --- a/opcodes/configure.ac +++ b/opcodes/configure.ac @@ -96,7 +96,7 @@ BFD_64_BIT AC_SUBST(HDEFINES) AC_PROG_INSTALL -AC_CHECK_DECLS([basename, stpcpy]) +AC_CHECK_DECLS([asprintf, basename, snprintf, stpcpy, strtoull, vsnprintf]) # Check if sigsetjmp is available. Using AC_CHECK_FUNCS won't do # since sigsetjmp might only be defined as a macro.