#include <iterator>
#include <glog/logging.h>
-#undef FOLLY_DEMANGLE
-
-#if defined(__GNUG__) && __GNUG__ >= 4
+#if FOLLY_HAVE_CPLUS_DEMANGLE_V3_CALLBACK
# include <cxxabi.h>
-# define FOLLY_DEMANGLE 1
// From libiberty
//
} // namespace
-#ifdef FOLLY_DEMANGLE
+#if FOLLY_HAVE_CPLUS_DEMANGLE_V3_CALLBACK
fbstring demangle(const char* name) {
int status;
}
#endif
-#undef FOLLY_DEMANGLE
namespace detail {
AC_DEFINE([HAVE_WEAK_SYMBOLS], [1],
[Define to 1 if the linker supports weak symbols.])])
+AC_SEARCH_LIBS([cplus_demangle_v3_callback], [iberty])
+if test "$ac_cv_search_cplus_demangle_v3_callback" != "no" ; then
+ AC_DEFINE([HAVE_CPLUS_DEMANGLE_V3_CALLBACK], [1],
+ [Define to 1 if we have cplus_demangle_v3_callback.])
+fi
+
# Check for clock_gettime(2). This is not in an AC_CHECK_FUNCS() because we
# want to link with librt if necessary.
AC_SEARCH_LIBS([clock_gettime], [rt],
};
} // namespace folly_test
+#if FOLLY_HAVE_CPLUS_DEMANGLE_V3_CALLBACK
TEST(System, demangle) {
char expected[] = "folly_test::ThisIsAVeryLongStructureName";
EXPECT_STREQ(
EXPECT_STREQ("folly_test", buf);
}
}
+#endif
namespace {