Fix build time problem with MingGW hosts, which do not have a strnlen() function.

2014-03-13  Meador Inge  <meadori@codesourcery.com>

	 * configure.in: Add strnlen to AC_CHECK_DECLS.
	 * config.in: Regenerate.
         * configure: Regenerate.
	 * sysdep.h (strnlen): Add prototype.

         * dwarf.c (strnlen): Move prototype ...
	 * sysdep.h (strnlen): ... to here.
This commit is contained in:
Nick Clifton 2014-03-14 11:21:00 +00:00
parent dc6ae99692
commit 5a026fc9a2
8 changed files with 36 additions and 4 deletions

View File

@ -1,3 +1,10 @@
2014-03-14 Meador Inge <meadori@codesourcery.com>
* configure.in: Add strnlen to AC_CHECK_DECLS.
* config.in: Regenerate.
* configure: Regenerate.
* sysdep.h (strnlen): Add prototype.
2014-03-14 Alan Modra <amodra@gmail.com>
* elf32-ppc.c (ppc_elf_relocate_section): Correct overflow

View File

@ -64,6 +64,10 @@
*/
#undef HAVE_DECL_STPCPY
/* Define to 1 if you have the declaration of `strnlen', and to 0 if you
don't. */
#undef HAVE_DECL_STRNLEN
/* Define to 1 if you have the declaration of `strstr', and to 0 if you don't.
*/
#undef HAVE_DECL_STRSTR

11
bfd/configure vendored
View File

@ -13766,6 +13766,17 @@ cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_VSNPRINTF $ac_have_decl
_ACEOF
ac_fn_c_check_decl "$LINENO" "strnlen" "ac_cv_have_decl_strnlen" "$ac_includes_default"
if test "x$ac_cv_have_decl_strnlen" = x""yes; then :
ac_have_decl=1
else
ac_have_decl=0
fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_STRNLEN $ac_have_decl
_ACEOF
# Link in zlib if we can. This allows us to read compressed debug sections.
# This is used only by compress.c.

View File

@ -239,6 +239,7 @@ AC_CHECK_DECLS(stpcpy)
AC_CHECK_DECLS(strstr)
AC_CHECK_DECLS(snprintf)
AC_CHECK_DECLS(vsnprintf)
AC_CHECK_DECLS(strnlen)
# Link in zlib if we can. This allows us to read compressed debug sections.
# This is used only by compress.c.

View File

@ -170,6 +170,10 @@ extern int fseeko64 (FILE *stream, off64_t offset, int whence);
#endif
#endif
#if !HAVE_DECL_STRNLEN
size_t strnlen (const char *, size_t);
#endif
/* Define offsetof for those systems which lack it */
#ifndef offsetof

View File

@ -1,3 +1,8 @@
2014-03-14 Meador Inge <meadori@codesourcery.com>
* dwarf.c (strnlen): Move prototype ...
* sysdep.h (strnlen): ... to here.
2014-03-12 Nick Clifton <nickc@redhat.com>
PR binutils/16652

View File

@ -29,10 +29,6 @@
#include "dwarf.h"
#include "gdb/gdb-index.h"
#if !HAVE_DECL_STRNLEN
size_t strnlen (const char *, size_t);
#endif
static const char *regname (unsigned int regno, int row);
static int have_frame_base;

View File

@ -112,6 +112,10 @@ extern int snprintf(char *, size_t, const char *, ...);
extern int vsnprintf(char *, size_t, const char *, va_list);
#endif
#if !HAVE_DECL_STRNLEN
size_t strnlen (const char *, size_t);
#endif
#ifndef O_RDONLY
#define O_RDONLY 0
#endif