~ubuntu-branches/ubuntu/hardy/autoconf-archive/hardy

« back to all changes in this revision

Viewing changes to m4source/ax_cxx_gcc_abi_demangle.m4

  • Committer: Bazaar Package Importer
  • Author(s): Martin A. Godisch
  • Date: 2004-06-26 09:43:57 UTC
  • Revision ID: james.westby@ubuntu.com-20040626094357-3be3jwcz1vcdhpe8
Tags: upstream-20040616
ImportĀ upstreamĀ versionĀ 20040616

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl Available from the GNU Autoconf Macro Archive at:
 
2
dnl http://www.gnu.org/software/ac-archive/htmldoc/ax_cxx_gcc_abi_demangle.html
 
3
dnl
 
4
AC_DEFUN([AX_CXX_GCC_ABI_DEMANGLE],
 
5
[AC_CACHE_CHECK(whether the compiler supports GCC C++ ABI name demangling, 
 
6
ac_cv_cxx_gcc_abi_demangle,
 
7
[AC_LANG_SAVE
 
8
 AC_LANG_CPLUSPLUS
 
9
 AC_TRY_COMPILE([#include <typeinfo>
 
10
#include <cxxabi.h>
 
11
#include <string>
 
12
 
 
13
template<typename TYPE>
 
14
class A {};
 
15
],[A<int> instance;
 
16
int status = 0;
 
17
char* c_name = 0;
 
18
 
 
19
c_name = abi::__cxa_demangle(typeid(instance).name(), 0, 0, &status);
 
20
        
 
21
std::string name(c_name);
 
22
free(c_name);
 
23
 
 
24
return name == "A<int>";
 
25
],
 
26
 ac_cv_cxx_gcc_abi_demangle=yes, ac_cv_cxx_gcc_abi_demangle=no)
 
27
 AC_LANG_RESTORE
 
28
])
 
29
if test "$ac_cv_cxx_gcc_abi_demangle" = yes; then
 
30
  AC_DEFINE(HAVE_GCC_ABI_DEMANGLE,1,
 
31
            [define if the compiler supports GCC C++ ABI name demangling]) 
 
32
fi
 
33
])