From 71bd4232abd6ab3f28e49e4c93aa7281bdfbee9f Mon Sep 17 00:00:00 2001
From: Marcel Loose <loose@astron.nl>
Date: Fri, 14 Jan 2011 14:58:41 +0000
Subject: [PATCH] Bug 1617: We don't need a configure test for
 __cxa_demangle(). Every GNU C++ compiler supports it, so we can simply test
 for the __GNUG__ preprocessor variable.

---
 CMake/FindBacktrace.cmake           | 14 ++------------
 CMake/variants/variants.dop131      |  1 +
 LCS/Common/src/AddressTranslator.cc |  4 ++--
 lofar_config.h.cmake                |  3 ---
 4 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/CMake/FindBacktrace.cmake b/CMake/FindBacktrace.cmake
index 1993144d334..ef0ba11e7ff 100644
--- a/CMake/FindBacktrace.cmake
+++ b/CMake/FindBacktrace.cmake
@@ -14,12 +14,8 @@
 #  HAVE_BFD_H          - true if header file bfd.h exists
 #                        (contains declaration of bfd_* functions)
 #  BFD_LIBRARY         - full path to libbfd, if found
-#  IBERTY_LIBRARY      - full path to libiberty, if found
-#  HAVE_DEMANGLE_H     - true if header file demangle.h exists
-#                        (contains declaration of cplus_demangle())
-#  HAVE_DECL_BASENAME  - true if a declaration for basename() exists
-#  HAVE_CPLUS_DEMANGLE - true if function demangle() exists
-#  Z_LIBRARY           - full path to libz, if found
+#  IBERTY_LIBRARY      - full path to libiberty, if searched and found
+#  Z_LIBRARY           - full path to libz, if searched and found
 
 # Copyright (C) 2009-2010
 # ASTRON (Netherlands Institute for Radio Astronomy)
@@ -43,7 +39,6 @@
 
 include(CheckIncludeFile)
 include(CheckFunctionExists)
-include(CheckCXXSourceCompiles)
 include(FindPackageHandleStandardArgs)
 
 if(NOT BACKTRACE_FOUND)
@@ -69,11 +64,6 @@ if(NOT BACKTRACE_FOUND)
               list(APPEND BACKTRACE_LIBRARIES ${Z_LIBRARY})
             endif(Z_LIBRARY)
           endif(BFD_LIBRARY MATCHES "${CMAKE_STATIC_LIBRARY_SUFFIX}$")
-          # Check for C++ demangler
-          check_cxx_source_compiles("
-            #include <cxxabi.h>
-            int main() { abi::__cxa_demangle(\"\", 0, 0, 0); }"
-            HAVE___CXA_DEMANGLE)
         endif(BFD_LIBRARY)
       endif(HAVE_BFD_H)
     endif(HAVE_BACKTRACE)
diff --git a/CMake/variants/variants.dop131 b/CMake/variants/variants.dop131
index 8eb81ff190e..c62db6ec079 100644
--- a/CMake/variants/variants.dop131
+++ b/CMake/variants/variants.dop131
@@ -1,2 +1,3 @@
 option(BUILD_SHARED_LIBS "Build shared libraries" ON)
 #set(CASACORE_ROOT_DIR /opt/lofar/external/casacore)
+set(ENV{JAVA_HOME} /usr/lib64/jvm/java-1.6.0-openjdk-1.6.0)
diff --git a/LCS/Common/src/AddressTranslator.cc b/LCS/Common/src/AddressTranslator.cc
index 1f89c87af68..41c197a61ad 100644
--- a/LCS/Common/src/AddressTranslator.cc
+++ b/LCS/Common/src/AddressTranslator.cc
@@ -30,7 +30,7 @@
 #include <cstdlib>
 #include <cstring>
 
-#ifdef HAVE___CXA_DEMANGLE
+#ifdef __GNUG__
 # include <cxxabi.h>
 #endif
 
@@ -66,7 +66,7 @@ namespace LOFAR
     
       if (found) {
         if (functionname && *functionname) {
-# ifdef HAVE___CXA_DEMANGLE
+# ifdef __GNUG__
           char* realname = abi::__cxa_demangle(functionname, 0, 0, 0);
           if (realname) {
             trace[i].function = realname;
diff --git a/lofar_config.h.cmake b/lofar_config.h.cmake
index 5e6a22d3ceb..14d6aeb3717 100644
--- a/lofar_config.h.cmake
+++ b/lofar_config.h.cmake
@@ -161,8 +161,5 @@
 /* Define to 1 if you have the `backtrace' function. */
 #cmakedefine HAVE_BACKTRACE 1
 
-/* Define to 1 if you have the `abi::__cxa_demangle' function. */
-#cmakedefine HAVE___CXA_DEMANGLE 1
-
 /* Define to 1 if you have a declaration for the `getprotobyname_r' function. */
 #cmakedefine HAVE_GETPROTOBYNAME_R 1
-- 
GitLab