~linuxjedi/libdrizzle/5.1-docs2

44.1.1 by Brian Aker
Add autoconf rules.
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) 2012 Brian Aker <brian@tangent.org>
20
#   Copyright (c) 2008 Neil Ferguson <nferguso@eso.org>
21
#
22
#   Copying and distribution of this file, with or without modification, are
23
#   permitted in any medium without royalty provided the copyright notice
24
#   and this notice are preserved. This file is offered as-is, without any
25
#   warranty.
26
84.1.2 by Brian Aker
Update to build files.
27
#serial 10
44.1.1 by Brian Aker
Add autoconf rules.
28
29
AC_DEFUN([AX_CXX_GCC_ABI_DEMANGLE],
30
    [AC_PREREQ([2.63])dnl
31
    AC_CACHE_CHECK([whether the compiler supports GCC C++ ABI name demangling],
32
      [ax_cv_cxx_gcc_abi_demangle],
33
      [AC_LANG_PUSH([C++])
34
      AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include <typeinfo>
35
#include <cxxabi.h>
36
#include <cstdlib>
37
#include <string>
38
          template<typename TYPE>
39
          class A {};]],
40
          [[A<int> instance;
84.1.2 by Brian Aker
Update to build files.
41
#if defined(_WIN32) 
42
          return EXIT_FAILURE; 
43
#endif
44.1.1 by Brian Aker
Add autoconf rules.
44
          int status = 0;
45
          char* c_name = abi::__cxa_demangle(typeid(instance).name(), 0, 0, &status);
46
47
          std::string name(c_name);
48
          ::free(c_name);
49
50
          if (name.compare("A<int>") != 0)
51
          { 
52
          return EXIT_FAILURE;
53
          }]])],
54
        [ax_cv_cxx_gcc_abi_demangle=yes],
55
        [ax_cv_cxx_gcc_abi_demangle=no],
56
        [ax_cv_cxx_gcc_abi_demangle=no])
57
      AC_LANG_POP])
84.1.2 by Brian Aker
Update to build files.
58
      AC_MSG_CHECKING([checking for cxx_gcc_abi_demangle])
59
  AC_MSG_RESULT(["$ax_cv_cxx_gcc_abi_demangle"])
44.1.1 by Brian Aker
Add autoconf rules.
60
  AS_IF([test "x$ax_cv_cxx_gcc_abi_demangle" = xyes],
61
      [AC_DEFINE([HAVE_GCC_ABI_DEMANGLE],[1],[define if the compiler supports GCC C++ ABI name demangling])])
62
  ])