summaryrefslogtreecommitdiff
path: root/m4/execinfo.m4
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2012-08-24 03:29:39 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2012-08-24 03:33:43 -0700
commitbb527a2f06a2de15f9d306e9a4c35243c720f599 (patch)
tree35d0bc7e76e9ab1814789ddd0803bdf97a4add62 /m4/execinfo.m4
parent1ba1387ffbf3e352e50960a0fcbe4fdc7580de5e (diff)
downloadgnulib-bb527a2f06a2de15f9d306e9a4c35243c720f599.tar.gz
execinfo: port to FreeBSD
* m4/execinfo.m4 (gl_EXECINFO_H): Set LIB_EXECINFO to -lexecinfo if needed, as in FreeBSD. Reported by Bastien Roucariès in <http://lists.gnu.org/archive/html/bug-gnulib/2012-08/msg00113.html>. * modules/execinfo (Link): Add $(LIB_EXECINFO).
Diffstat (limited to 'm4/execinfo.m4')
-rw-r--r--m4/execinfo.m416
1 files changed, 13 insertions, 3 deletions
diff --git a/m4/execinfo.m4 b/m4/execinfo.m4
index fa2b84523b..f1f3cd9163 100644
--- a/m4/execinfo.m4
+++ b/m4/execinfo.m4
@@ -9,13 +9,23 @@ AC_DEFUN([gl_EXECINFO_H],
[
AC_CHECK_HEADERS_ONCE([execinfo.h])
+ LIB_EXECINFO=''
+ EXECINFO_H='execinfo.h'
+
if test $ac_cv_header_execinfo_h = yes; then
- EXECINFO_H=''
- else
- EXECINFO_H='execinfo.h'
+ gl_saved_libs=$LIBS
+ AC_SEARCH_LIBS([backtrace_symbols_fd], [execinfo],
+ [test "$ac_cv_search_backtrace_symbols_fd" = "none required" ||
+ LIB_EXECINFO=$ac_cv_search_backtrace_symbols_fd])
+ LIBS=$gl_saved_libs
+ test "$ac_cv_search_backtrace_symbols_fd" = no || EXECINFO_H=''
+ fi
+
+ if test -n "$EXECINFO_H"; then
AC_LIBOBJ([execinfo])
fi
AC_SUBST([EXECINFO_H])
+ AC_SUBST([LIB_EXECINFO])
AM_CONDITIONAL([GL_GENERATE_EXECINFO_H], [test -n "$EXECINFO_H"])
])