X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=m4%2Fax_cxx_gcc_abi_demangle.m4;h=072d5db882e10971f8376d78915171418fa6250c;hb=cefa03b14574d23cdd2f9db5ff28f210e697042c;hp=2da0057e78f44b49370b0d2de74444e5e396473f;hpb=906d0558357bdd81dec000c71c165646af8c6e5f;p=awesomized%2Flibmemcached diff --git a/m4/ax_cxx_gcc_abi_demangle.m4 b/m4/ax_cxx_gcc_abi_demangle.m4 index 2da0057e..072d5db8 100644 --- a/m4/ax_cxx_gcc_abi_demangle.m4 +++ b/m4/ax_cxx_gcc_abi_demangle.m4 @@ -16,6 +16,7 @@ # # LICENSE # +# Copyright (c) 2012 Brian Aker # Copyright (c) 2008 Neil Ferguson # # Copying and distribution of this file, with or without modification, are @@ -23,37 +24,39 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 9 +#serial 10 - AC_DEFUN([AX_CXX_GCC_ABI_DEMANGLE], - [AC_CACHE_CHECK([whether the compiler supports GCC C++ ABI name demangling], - [ax_cv_cxx_gcc_abi_demangle], - [AC_LANG_PUSH([C++]) - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [ -#include +AC_DEFUN([AX_CXX_GCC_ABI_DEMANGLE], + [AC_PREREQ([2.63])dnl + AC_CACHE_CHECK([whether the compiler supports GCC C++ ABI name demangling], + [ax_cv_cxx_gcc_abi_demangle], + [AC_LANG_PUSH([C++]) + AC_RUN_IFELSE([AC_LANG_PROGRAM([[#include #include #include #include + template + class A {};]], + [[A instance; +#if defined(_WIN32) + return EXIT_FAILURE; +#endif + int status = 0; + char* c_name = abi::__cxa_demangle(typeid(instance).name(), 0, 0, &status); -template class A {}; - ],[ -A instance; -int status = 0; -char* c_name = 0; + std::string name(c_name); + ::free(c_name); -c_name = abi::__cxa_demangle(typeid(instance).name(), 0, 0, &status); -std::string name(c_name); -::free(c_name); -return name == "A"; - ])], - [ax_cv_cxx_gcc_abi_demangle=yes], - [ax_cv_cxx_gcc_abi_demangle=no]) - AC_LANG_POP() - ]) - - if test "$ax_cv_cxx_gcc_abi_demangle" = yes; then - AC_DEFINE(HAVE_GCC_ABI_DEMANGLE, [1], [define if the compiler supports GCC C++ ABI name demangling]) - fi - ]) + if (name.compare("A") != 0) + { + return EXIT_FAILURE; + }]])], + [ax_cv_cxx_gcc_abi_demangle=yes], + [ax_cv_cxx_gcc_abi_demangle=no], + [ax_cv_cxx_gcc_abi_demangle=no]) + AC_LANG_POP]) + AC_MSG_CHECKING([checking for cxx_gcc_abi_demangle]) + AC_MSG_RESULT(["$ax_cv_cxx_gcc_abi_demangle"]) + AS_IF([test "x$ax_cv_cxx_gcc_abi_demangle" = xyes], + [AC_DEFINE([HAVE_GCC_ABI_DEMANGLE],[1],[define if the compiler supports GCC C++ ABI name demangling])]) + ])