Pārlūkot izejas kodu

Merge pull request #1121 from richardkchapman/macport

Macport
Reviewed-by: Gavin Halliday <ghalliday@hpccsystems.com>
Gavin Halliday 13 gadi atpakaļ
vecāks
revīzija
2020cbc458

+ 12 - 11
cmake_modules/commonSetup.cmake

@@ -40,16 +40,15 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
 
   cmake_policy ( SET CMP0011 NEW )
 
-  # For options that we don't presently support setting to off, we have a SET() below rather than an option...
-
+  option(USE_BINUTILS "Enable use of binutils to embed workunit info into dhard objects" ON)
   option(USE_CPPUNIT "Enable unit tests (requires cppunit)" OFF)
-  set (USE_OPENLDAP 1)     # option(USE_OPENLDAP "Enable OpenLDAP support (requires OpenLDAP)" ON)
-  set (USE_ICU 1)          # option(USE_ICU "Enable unicode support (requires ICU)" ON)
-  set (USE_XALAN 1)        # option(USE_XALAN "Configure use of xalan" ON)
-  set (USE_XERCES 1)       # option(USE_XERCES "Configure use of xerces" ON)
+  option(USE_OPENLDAP "Enable OpenLDAP support (requires OpenLDAP)" ON)
+  option(USE_ICU "Enable unicode support (requires ICU)" ON)
+  option(USE_XALAN "Configure use of xalan" ON)
+  option(USE_XERCES "Configure use of xerces" ON)
   option(USE_BOOST_REGEX "Configure use of boost regex" ON)
   option(Boost_USE_STATIC_LIBS "Use boost_regex static library for RPM BUILD" OFF)
-  set (USE_OPENSSL 1)      # option(USE_OPENSSL "Configure use of OpenSSL" ON)
+  option(USE_OPENSSL "Configure use of OpenSSL" ON)
   option(USE_ZLIB "Configure use of zlib" ON)
   option(USE_NATIVE_LIBRARIES "Search standard OS locations for thirdparty libraries" ON)
   option(USE_GIT_DESCRIBE "Use git describe to generate build tag" ON)
@@ -116,7 +115,7 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
     set ( LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/libs" )
     if (${CMAKE_COMPILER_IS_GNUCXX})
       SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -frtti -fPIC -fmessage-length=0 -Wformat -Wformat-security -Wformat-nonliteral -pthread")
-      SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-export-dynamic")
+      SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -rdynamic")
       SET (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -g -fno-default-inline -fno-inline-functions")
     endif ()
     # All of these are defined in platform.h too, but need to be defned before any system header is included
@@ -222,10 +221,12 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
 
   # External library setup - some can be optionally selected based on USE_xxx flags, some are required
 
-  IF (NOT WIN32)
+  IF (USE_BINUTILS AND NOT WIN32)
     find_package(BINUTILS)
-    IF (NOT BINUTILS_FOUND)
-      message(FATAL_ERROR "BINUTILS package not found")
+    IF (BINUTILS_FOUND)
+      add_definitions (-D_USE_BINUTILS)
+    ELSE()
+      message(FATAL_ERROR "BINUTILS requested but package not found")
     ENDIF()
   ENDIF()
 

+ 5 - 3
common/dllserver/thorplugin.cpp

@@ -24,7 +24,7 @@
 #include "jdebug.hpp"
 #include "jlzw.hpp"
 #include "eclrtl.hpp"
-#ifndef _WIN32
+#ifdef _USE_BINUTILS
 #include "bfd.h"
 #endif
 
@@ -203,7 +203,7 @@ bool HelperDll::getResource(size32_t & len, const void * & data, const char * ty
 #endif
 }
 
-#ifndef _WIN32
+#ifdef _USE_BINUTILS
 struct SecScanParam
 {
     MemoryBuffer &result;
@@ -245,7 +245,7 @@ extern bool getResourceFromFile(const char *filename, MemoryBuffer &data, const
     data.append(len, rdata);
     FreeLibrary(dllHandle);
     return true;
-#else
+#elif defined (_USE_BINUTILS)
     bfd_init ();
     bfd *file = bfd_openr(filename, NULL);
     if (file)
@@ -258,6 +258,8 @@ extern bool getResourceFromFile(const char *filename, MemoryBuffer &data, const
         bfd_close (file);
    }
    return data.length() != 0;
+#else
+   UNIMPLEMENTED;
 #endif
 }
 

+ 1 - 1
ecl/hql/hqlparse.cpp

@@ -78,7 +78,7 @@ public:
 
 // =========================== CTemplateContext =========================================
 
-class CTemplateContext : public CInterface, implements ITemplateContext
+class CTemplateContext : implements ITemplateContext, public CInterface
 {
     IXmlScope* m_xmlScope;
     int m_startLine,m_startCol;

+ 1 - 1
ecl/hqlcpp/hqlcatom.cpp

@@ -720,7 +720,7 @@ _ATOM xmlReadMarkerAtom;
 #define MAKESYSATOM(x)  _##x##_Atom = createSystemAtom("$_" #x "_")
 #define MAKEID(x)   x##IdAtom = createIdentifierAtom(#x)
 
-MODULE_INIT(INIT_PRIORITY_HQLATOM)
+MODULE_INIT(INIT_PRIORITY_HQLATOM-1)
 {
     MAKEATOM(activeActivityMarker);
     MAKEATOM(activeMatchText);

+ 4 - 2
ecl/hqlcpp/hqlres.cpp

@@ -24,7 +24,7 @@
 #include "jexcept.hpp"
 #include "hqlcerrors.hpp"
 #include "thorplugin.hpp"
-#ifndef _WIN32
+#ifdef _USE_BINUTILS
 #include "bfd.h"
 #endif
 
@@ -371,7 +371,7 @@ void ResourceManager::flush(const char *filename, bool flushText, bool target64b
             putbytes(h, "\x00\x00\x00",4-(totalbytes & 3));
     }
     _close(h);
-#else
+#elif defined(_USE_BINUTILS)
     asymbol **syms = NULL;
     bfd *file = NULL;
     StringArray names;  // need to make sure that the strings we use in symbol table have appropriate lifetime 
@@ -438,6 +438,8 @@ void ResourceManager::flush(const char *filename, bool flushText, bool target64b
             bfd_close_all_done(file); // allow bfd to clean up memory
         throwError1(HQLERR_ResourceCreateFailed, msg.str());
     }
+#else
+    UNIMPLEMENTED;
 #endif
     if (flushText)
         flushAsText(filename);

+ 1 - 1
system/jlib/jatomic.hpp

@@ -58,7 +58,7 @@ typedef volatile long atomic_t;
 #endif      
 
 
-#elif defined(__linux__) 
+#elif defined(__GNUC__)
 
 typedef struct { volatile int counter; } atomic_t;
 #define ATOMIC_INIT(i)          { (i) }

+ 3 - 3
system/jlib/jiface.cpp

@@ -30,7 +30,7 @@ void CInterface::beforeDispose()
 
 //===========================================================================
 
-#if !defined(_WIN32) && !defined(__linux__)
+#if !defined(_WIN32) && !defined(__GNUC__)
 
 static CriticalSection *ICrit;
 
@@ -47,7 +47,7 @@ MODULE_EXIT()
 bool poor_atomic_dec_and_test(atomic_t * v)
 {
     ICrit->enter();
-    bool ret = (++(*v) == 0);
+    bool ret = (--(*v) == 0);
     ICrit->leave();
     return ret;
 }
@@ -55,7 +55,7 @@ bool poor_atomic_dec_and_test(atomic_t * v)
 bool poor_atomic_inc_and_test(atomic_t * v)
 {
     ICrit->enter();
-    bool ret = (--(*v) == 0);
+    bool ret = (++(*v) == 0);
     ICrit->leave();
     return ret;
 }

+ 1 - 1
system/jlib/jlog.ipp

@@ -696,7 +696,7 @@ class DropLogMsg;
 
 // Implementation of logging manager
 
-class CLogMsgManager : public CInterface, implements ILogMsgManager
+class CLogMsgManager : public ILogMsgManager, public CInterface
 {
 private:
     class MsgProcessor : public Thread

+ 0 - 19
system/jlib/jlzma.cpp

@@ -22,30 +22,11 @@
 
 #include "jlzma.hpp"
 
-#ifdef _WIN32
-extern "C" {
-#endif
 #include "Types.h"
 #include "LzFind.h"
 #include "LzHash.h"
 #include "LzmaEnc.h"
 #include "LzmaDec.h"
-#ifdef _WIN32
-}
-#endif
-
-#ifdef _WIN32 // Kludge to avoid using library (too many VS6 .dsws out there!)
-extern "C" {
-#endif
-#include "LzFind.c"
-#include "LzmaEnc.c"
-#undef kNumFullDistances
-#define kLiteralNextStates decLiteralNextStates
-#include "LzmaDec.c"
-#ifdef _WIN32
-}
-#endif
-
 
 static void *SzAlloc(void *, size_t size)
 { 

+ 1 - 5
system/lzma/CMakeLists.txt

@@ -32,13 +32,9 @@ set ( SRCS
         LzmaEnc.c
 )
 
-# CSRCS = \ 
-# LzFind.c \ 
-# LzmaDec.c \ 
-# LzmaInc.c 
-# COBJS = \ 
 ADD_DEFINITIONS( -D_LIB )
 
+SET_SOURCE_FILES_PROPERTIES( ${SRCS} PROPERTIES LANGUAGE CXX )
 HPCC_ADD_LIBRARY( lzma STATIC ${SRCS} )
 install ( TARGETS lzma DESTINATION ${OSSDIR}/lib )