aboutsummaryrefslogtreecommitdiff
path: root/libbacktrace
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2012-09-18 16:06:53 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2012-09-18 16:06:53 +0000
commit772a71a95943f4f8fcb45d74e4e398abbe6c74f7 (patch)
tree1d0ec15038dc3804c55d18677d6055999ae4f182 /libbacktrace
parent9a9baa5254a06287326469f1b2f9ba1f7db6fd71 (diff)
downloadgcc-772a71a95943f4f8fcb45d74e4e398abbe6c74f7.zip
gcc-772a71a95943f4f8fcb45d74e4e398abbe6c74f7.tar.gz
gcc-772a71a95943f4f8fcb45d74e4e398abbe6c74f7.tar.bz2
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
Diffstat (limited to 'libbacktrace')
-rw-r--r--libbacktrace/ChangeLog6
-rw-r--r--libbacktrace/config.h.in4
-rwxr-xr-xlibbacktrace/configure62
-rw-r--r--libbacktrace/configure.ac2
-rw-r--r--libbacktrace/dwarf.c5
5 files changed, 77 insertions, 2 deletions
diff --git a/libbacktrace/ChangeLog b/libbacktrace/ChangeLog
index 277927b..8275ebc 100644
--- a/libbacktrace/ChangeLog
+++ b/libbacktrace/ChangeLog
@@ -1,3 +1,9 @@
+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>
* fileline.c: Include <stdlib.h>.
diff --git a/libbacktrace/config.h.in b/libbacktrace/config.h.in
index c7b534b..e6464c6 100644
--- a/libbacktrace/config.h.in
+++ b/libbacktrace/config.h.in
@@ -3,6 +3,10 @@
/* ELF size: 32 or 64 */
#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. */
#undef HAVE_DLFCN_H
diff --git a/libbacktrace/configure b/libbacktrace/configure
index d566922..d8c1a02 100755
--- a/libbacktrace/configure
+++ b/libbacktrace/configure
@@ -1823,6 +1823,51 @@ fi
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_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
This file contains any messages produced by compilers while
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; }
# AIX 5 now supports IA64 processor
lt_prog_compiler_static='-Bstatic'
fi
+ lt_prog_compiler_pic='-fPIC'
;;
amigaos*)
@@ -10388,7 +10434,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10391 "configure"
+#line 10437 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10494,7 +10540,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10497 "configure"
+#line 10543 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11061,6 +11107,18 @@ if test "$ALLOC_FILE" = "alloc.lo"; then
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_n "checking whether tests can run... " >&6; }
if test "${libbacktrace_cv_sys_native+set}" = set; then :
diff --git a/libbacktrace/configure.ac b/libbacktrace/configure.ac
index 7a44fdf..35ed987 100644
--- a/libbacktrace/configure.ac
+++ b/libbacktrace/configure.ac
@@ -199,6 +199,8 @@ if test "$ALLOC_FILE" = "alloc.lo"; then
fi
AC_SUBST(BACKTRACE_USES_MALLOC)
+AC_CHECK_DECLS(strnlen)
+
AC_CACHE_CHECK([whether tests can run],
[libbacktrace_cv_sys_native],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([], [return 0;])],
diff --git a/libbacktrace/dwarf.c b/libbacktrace/dwarf.c
index dffd20b..34861fc 100644
--- a/libbacktrace/dwarf.c
+++ b/libbacktrace/dwarf.c
@@ -44,6 +44,11 @@ POSSIBILITY OF SUCH DAMAGE. */
#include "backtrace.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. */
struct dwarf_buf