dnl backtrace() and backtrace_symbols() for wxStackWalker
if test "$wxUSE_STACKWALKER" = "yes" -a "$wxUSE_UNIX" = "yes"; then
    AC_CACHE_CHECK([for backtrace() in <execinfo.h>], wx_cv_func_backtrace,
        [
            AC_LANG_PUSH(C++)
            AC_TRY_COMPILE([#include <execinfo.h>],
                [
                    void *trace[1];
                    char **messages;

                    backtrace(trace, 1);
                    messages = backtrace_symbols(trace, 1);
                ],
                wx_cv_func_backtrace=yes,
                wx_cv_func_backtrace=no
            )
            AC_LANG_POP()
        ]
    )


    if test "$wx_cv_func_backtrace" = "no"; then
        AC_MSG_WARN([backtrace() is not available, wxStackWalker will not be available])
        wxUSE_STACKWALKER=no
    else
        AC_CACHE_CHECK([for __cxa_demangle() in <cxxabi.h>], wx_cv_func_cxa_demangle,
            [
                AC_LANG_PUSH(C++)
                AC_TRY_LINK([#include <cxxabi.h>],
                    [
                        int rc;
                        __cxxabiv1::__cxa_demangle("foo", 0, 0, &rc);
                    ],
                    wx_cv_func_cxa_demangle=yes,
                    wx_cv_func_cxa_demangle=no
                )
                AC_LANG_POP()
            ]
        )

        if test "$wx_cv_func_cxa_demangle" = "yes"; then
            AC_DEFINE(HAVE_CXA_DEMANGLE)
        fi
    fi
fi
