diff --git a/CMakeLists.txt b/CMakeLists.txt index a8656fe94..221ee4089 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -191,13 +191,21 @@ if(NOT HAVE_LIBV4L1_VIDEODEV_H) endif(NOT HAVE_LIBV4L1_VIDEODEV_H) check_include_file("linux/videodev2.h" HAVE_LINUX_VIDEODEV2_H) check_include_file("execinfo.h" HAVE_EXECINFO_H) +if (HAVE_EXECINFO_H) + check_function_exists("backtrace" HAVE_DECL_BACKTRACE) + if (NOT HAVE_DECL_BACKTRACE) + find_library (EXECINFO_LIBRARY NAMES execinfo) + if (EXECINFO_LIBRARY) + list(APPEND ZM_BIN_LIBS "-l${EXECINFO_LIBRARY}") + endif (EXECINFO_LIBRARY) + endif (NOT HAVE_DECL_BACKTRACE) + check_function_exists("backtrace_symbols" HAVE_DECL_BACKTRACE_SYMBOLS) +endif (HAVE_EXECINFO_H) check_include_file("ucontext.h" HAVE_UCONTEXT_H) check_include_file("sys/sendfile.h" HAVE_SYS_SENDFILE_H) check_include_file("sys/syscall.h" HAVE_SYS_SYSCALL_H) check_function_exists("syscall" HAVE_SYSCALL) check_function_exists("sendfile" HAVE_SENDFILE) -check_function_exists("backtrace" HAVE_DECL_BACKTRACE) -check_function_exists("backtrace_symbols" HAVE_DECL_BACKTRACE_SYMBOLS) check_function_exists("posix_memalign" HAVE_POSIX_MEMALIGN) check_type_size("siginfo_t" HAVE_SIGINFO_T) check_type_size("ucontext_t" HAVE_UCONTEXT_T) diff --git a/configure.ac b/configure.ac index 0bdb55fd5..a05248d1b 100644 --- a/configure.ac +++ b/configure.ac @@ -442,6 +442,7 @@ fi fi AC_CHECK_DECLS(backtrace,,,[#include ]) AC_CHECK_DECLS(backtrace_symbols,,,[#include ]) +AC_CHECK_LIB(execinfo,backtrace) AC_SUBST(LDFLAGS)