]> git.donarmstrong.com Git - lilypond.git/commitdiff
Don't let yaffut try to demangle when autoconf figures this won't work
authorDavid Kastrup <dak@gnu.org>
Thu, 10 Nov 2011 12:16:48 +0000 (13:16 +0100)
committerDavid Kastrup <dak@gnu.org>
Fri, 11 Nov 2011 13:16:48 +0000 (14:16 +0100)
config.hh.in
configure.in
flower/include/yaffut.hh

index 3863a88d0df36a23a40db83b26c0b25571446ca5..800d77d8a27f71473014c5f57af036aa389d3c2f 100644 (file)
@@ -94,3 +94,7 @@
 
 /* define if Guile has type scm_t_subr */
 #define HAVE_GUILE_SUBR_TYPE 0
+
+/* define if cxxabi.h has workable demangler */
+
+#define HAVE_CXA_DEMANGLE 0
index cf0178f457b5c3ac0e0971ebe23617f2aacc0584..3770c89f9d1aadf61e99b74114041109e2fc6ea6 100644 (file)
@@ -123,6 +123,18 @@ AC_CHECK_TYPES([scm_t_subr],
               [#include <libguile.h>])
 CXXFLAGS="$save_CXXFLAGS"
 
+## Check for usable cxxabi
+AC_MSG_CHECKING(for usable C++ demangler)
+AC_LINK_IFELSE([#include <cxxabi.h>
+int main(){
+    size_t sz;
+    int status;
+    char *ptr = abi::__cxa_demangle ("", 0, &sz, &status);
+    return 0;
+ }], [AC_DEFINE(HAVE_CXA_DEMANGLE)
+      AC_MSG_RESULT(yes)],
+    [AC_MSG_RESULT([no, use c++filt -t for manual demangling])])
+
 ## check rational bugfix.
 save_CPPFLAGS="$CPPFLAGS"
 CPPFLAGS="$GUILE_CFLAGS $CPPFLAGS"
index 376c036ed1ff617304395f61ac86aca52fe2acf6..cf444626d9439e4b11b6a691e70556bceb1ca5ac 100644 (file)
@@ -6,7 +6,12 @@
 #ifndef __YAFFUT_H__
 #define __YAFFUT_H__
 
+#include "config.hh"
+#if HAVE_CXA_DEMANGLE
 #include <cxxabi.h>
+#else
+#include <typeinfo>
+#endif
 
 #include <cmath>
 #include <cstring>
@@ -65,6 +70,7 @@ namespace yaffut
 template <typename T>
 std::string demangle ()
 {
+#if HAVE_CXA_DEMANGLE
   size_t sz;
   int status;
   char *ptr = abi::__cxa_demangle (typeid (T).name (), 0, &sz, &status);
@@ -76,6 +82,9 @@ std::string demangle ()
       name = name.substr (pos + 2);
     }
   return name;
+#else
+  return typeid (T).name ();
+#endif
 }
 
 struct ITest