source: git/m4/ax_cxx_gcc_abi_demangle.m4 @ 56bce65

spielwiese
Last change on this file since 56bce65 was 56bce65, checked in by Oleksandr Motsak <motsak@…>, 12 years ago
added autoconf tests for cxxabi.h and execinfo.h in order to use backtrace* and abi::__cxa_demangle
  • Property mode set to 100644
File size: 1.5 KB
RevLine 
[56bce65]1# ===========================================================================
2#  http://www.gnu.org/software/autoconf-archive/ax_cxx_gcc_abi_demangle.html
3# ===========================================================================
4#
5# SYNOPSIS
6#
7#   AX_CXX_GCC_ABI_DEMANGLE
8#
9# DESCRIPTION
10#
11#   If the compiler supports GCC C++ ABI name demangling (has header
12#   cxxabi.h and abi::__cxa_demangle() function), define
13#   HAVE_GCC_ABI_DEMANGLE
14#
15#   Adapted from AX_CXX_RTTI by Luc Maisonobe
16#
17# LICENSE
18#
19#   Copyright (c) 2008 Neil Ferguson <nferguso@eso.org>
20#
21#   Copying and distribution of this file, with or without modification, are
22#   permitted in any medium without royalty provided the copyright notice
23#   and this notice are preserved. This file is offered as-is, without any
24#   warranty.
25
26#serial 8
27
28AC_DEFUN([AX_CXX_GCC_ABI_DEMANGLE],
29[AC_CACHE_CHECK(whether the compiler supports GCC C++ ABI name demangling,
30ax_cv_cxx_gcc_abi_demangle,
31[AC_LANG_SAVE
32 AC_LANG_CPLUSPLUS
33 AC_TRY_COMPILE([#include <typeinfo>
34#include <cxxabi.h>
35#include <string>
36
37template<typename TYPE>
38class A {};
39],[A<int> instance;
40int status = 0;
41char* c_name = 0;
42
43c_name = abi::__cxa_demangle(typeid(instance).name(), 0, 0, &status);
44
45std::string name(c_name);
46free(c_name);
47
48return name == "A<int>";
49],
50 ax_cv_cxx_gcc_abi_demangle=yes, ax_cv_cxx_gcc_abi_demangle=no)
51 AC_LANG_RESTORE
52])
53if test "$ax_cv_cxx_gcc_abi_demangle" = yes; then
54  AC_DEFINE(HAVE_GCC_ABI_DEMANGLE,1,
55            [define if the compiler supports GCC C++ ABI name demangling])
56fi
57])
Note: See TracBrowser for help on using the repository browser.