Commit 772a71a9 by Ian Lance Taylor Committed by Ian Lance Taylor

configure.ac: Check whether strnlen is declared.

	* configure.ac: Check whether strnlen is declared.
	* dwarf.c: Declare strnlen if not declared.
	* configure, config.h.in: Rebuild.

From-SVN: r191433
parent 9a9baa52
2012-09-18 Ian Lance Taylor <iant@google.com>
* configure.ac: Check whether strnlen is declared.
* dwarf.c: Declare strnlen if not declared.
* configure, config.h.in: Rebuild.
2012-09-18 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> 2012-09-18 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* fileline.c: Include <stdlib.h>. * fileline.c: Include <stdlib.h>.
......
...@@ -3,6 +3,10 @@ ...@@ -3,6 +3,10 @@
/* ELF size: 32 or 64 */ /* ELF size: 32 or 64 */
#undef BACKTRACE_ELF_SIZE #undef BACKTRACE_ELF_SIZE
/* 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 <dlfcn.h> header file. */ /* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H #undef HAVE_DLFCN_H
......
...@@ -1823,6 +1823,51 @@ fi ...@@ -1823,6 +1823,51 @@ fi
eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
} # ac_fn_c_check_header_mongrel } # ac_fn_c_check_header_mongrel
# ac_fn_c_check_decl LINENO SYMBOL VAR
# ------------------------------------
# Tests whether SYMBOL is declared, setting cache variable VAR accordingly.
ac_fn_c_check_decl ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
as_decl_name=`echo $2|sed 's/ *(.*//'`
as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
#ifndef $as_decl_name
#ifdef __cplusplus
(void) $as_decl_use;
#else
(void) $as_decl_name;
#endif
#endif
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
eval "$3=yes"
else
eval "$3=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
} # ac_fn_c_check_decl
cat >config.log <<_ACEOF cat >config.log <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
...@@ -7442,6 +7487,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; } ...@@ -7442,6 +7487,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
# AIX 5 now supports IA64 processor # AIX 5 now supports IA64 processor
lt_prog_compiler_static='-Bstatic' lt_prog_compiler_static='-Bstatic'
fi fi
lt_prog_compiler_pic='-fPIC'
;; ;;
amigaos*) amigaos*)
...@@ -10388,7 +10434,7 @@ else ...@@ -10388,7 +10434,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF cat > conftest.$ac_ext <<_LT_EOF
#line 10391 "configure" #line 10437 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
...@@ -10494,7 +10540,7 @@ else ...@@ -10494,7 +10540,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF cat > conftest.$ac_ext <<_LT_EOF
#line 10497 "configure" #line 10543 "configure"
#include "confdefs.h" #include "confdefs.h"
#if HAVE_DLFCN_H #if HAVE_DLFCN_H
...@@ -11061,6 +11107,18 @@ if test "$ALLOC_FILE" = "alloc.lo"; then ...@@ -11061,6 +11107,18 @@ if test "$ALLOC_FILE" = "alloc.lo"; then
fi fi
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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether tests can run" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether tests can run" >&5
$as_echo_n "checking whether tests can run... " >&6; } $as_echo_n "checking whether tests can run... " >&6; }
if test "${libbacktrace_cv_sys_native+set}" = set; then : if test "${libbacktrace_cv_sys_native+set}" = set; then :
......
...@@ -199,6 +199,8 @@ if test "$ALLOC_FILE" = "alloc.lo"; then ...@@ -199,6 +199,8 @@ if test "$ALLOC_FILE" = "alloc.lo"; then
fi fi
AC_SUBST(BACKTRACE_USES_MALLOC) AC_SUBST(BACKTRACE_USES_MALLOC)
AC_CHECK_DECLS(strnlen)
AC_CACHE_CHECK([whether tests can run], AC_CACHE_CHECK([whether tests can run],
[libbacktrace_cv_sys_native], [libbacktrace_cv_sys_native],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([], [return 0;])], [AC_RUN_IFELSE([AC_LANG_PROGRAM([], [return 0;])],
......
...@@ -44,6 +44,11 @@ POSSIBILITY OF SUCH DAMAGE. */ ...@@ -44,6 +44,11 @@ POSSIBILITY OF SUCH DAMAGE. */
#include "backtrace.h" #include "backtrace.h"
#include "internal.h" #include "internal.h"
#ifndef HAVE_DECL_STRNLEN
/* The function is defined in libiberty if needed. */
extern size_t strnlen (const char *, size_t);
#endif
/* A buffer to read DWARF info. */ /* A buffer to read DWARF info. */
struct dwarf_buf struct dwarf_buf
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment