]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
configure.ac: Check whether strnlen is declared.
authorIan Lance Taylor <iant@google.com>
Tue, 18 Sep 2012 16:06:53 +0000 (16:06 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Tue, 18 Sep 2012 16:06:53 +0000 (16:06 +0000)
* configure.ac: Check whether strnlen is declared.
* dwarf.c: Declare strnlen if not declared.
* configure, config.h.in: Rebuild.

From-SVN: r191433

libbacktrace/ChangeLog
libbacktrace/config.h.in
libbacktrace/configure
libbacktrace/configure.ac
libbacktrace/dwarf.c

index 277927bc3bc559ce767af1dfca91dc5a87cf5ec6..8275ebcaa6a255d2756a50c0e64fabacd02cea98 100644 (file)
@@ -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>.
index c7b534b3e69e96c992e50db7cde7e4090c55cdd6..e6464c60597abe5e2a8a60e35936159d4287b91f 100644 (file)
@@ -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
 
index d566922a95c893308d9879e25095d7755313585a..d8c1a02425c8221176f4ed71c9c2f5b83baaf730 100755 (executable)
@@ -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 :
index 7a44fdfc7a84398c4222352fdf298b20f73eb936..35ed987eff39037b4d6e81f9319a2319288442d6 100644 (file)
@@ -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;])],
index dffd20bb15420e257bf4a522d724d394f3527b61..34861fce484a641cc75bab748dc08c3d77b71805 100644 (file)
@@ -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