Changeset 256


Ignore:
Timestamp:
02/14/10 11:11:13 (2 years ago)
Author:
mickem
Message:

Fixed *nix compatiblity issues

Location:
trunk
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/CMakeLists.txt

    r254 r256  
    88SET(VERSION_MAJOR 4) 
    99SET(VERSION_MINOR 0) 
     10 
     11 
     12IF(APPLE) 
     13  SET_TARGET_PROPERTIES(${TARGET} PROPERTIES COMPILE_FLAGS "-fPIC -w -DOSX  -DNDEBUG -finline-functions -O3 -DCRYPTOPP_DISABLE_ASM") 
     14ELSEIF(UNIX AND NOT APPLE) 
     15  IF (ARCH_X86_64 EQUAL 1) 
     16    MESSAGE(STATUS, "Adding FPIC") 
     17    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") 
     18  ELSE(ARCH_X86_64 EQUAL 1) 
     19    MESSAGE(STATUS, "Adding FPIC (noia64)") 
     20    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") 
     21  ENDIF (ARCH_X86_64 EQUAL 1) 
     22  #SET_TARGET_PROPERTIES(${TARGET} PROPERTIES COMPILE_FLAGS "-fPIC -w -pipe -DNDEBUG -DLINUX -finline-functions -O3") 
     23ELSEIF(WIN32) 
     24  IF(NOT MSVC) 
     25  SET_TARGET_PROPERTIES(${TARGET} PROPERTIES COMPILE_FLAGS "-mthreads -w -finline-functions -O3 -DNDEBUG -D__MINGW__ -DWIN32 -D_WIN32_WINNT=0x0501 -D_WIN32") 
     26  ENDIF(NOT MSVC) 
     27ENDIF(APPLE) 
     28 
     29 
    1030 
    1131IF(NOT SHARED_LIBS) 
     
    223243    set_target_properties ("nsclient++" ${ALL_MODULE_NAMES} PROPERTIES PREFIX "../") 
    224244endif() 
     245 
     246IF("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64") 
     247SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fPIC"  ) 
     248SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_DEBUG} -fPIC"  ) 
     249ENDIF("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64") 
     250 
     251 
  • trunk/build.cmake

    r255 r256  
    11SET(Boost_DEBUG 1) 
    22 
    3 set(Boost_USE_STATIC_LIBS   ON) 
     3#set(Boost_USE_STATIC_LIBS   ON) 
    44set(BOOST_USE_MULTITHREADED ON) 
    55 
     
    1313SET(CMAKE_LIBRARY_PATH c:/src/lib/x86/) 
    1414 
    15 SET(PROTOBUF_INCLUDE_DIR C:/src/protobuf-2.3.0/src) 
    16 SET(PROTOBUF_LIBRARYDIR C:/src/protobuf-2.3.0/vsprojects/Debug) 
    17 SET(PROTOBUF_BINARYDIR C:/src/protobuf-2.3.0/vsprojects/Debug) 
     15#SET(PROTOBUF_INCLUDE_DIR C:/src/protobuf-2.3.0/src) 
     16#SET(PROTOBUF_LIBRARYDIR C:/src/protobuf-2.3.0/vsprojects/Debug) 
     17#SET(PROTOBUF_BINARYDIR C:/src/protobuf-2.3.0/vsprojects/Debug) 
    1818 
    1919#SET(PROTOBUF_LIBRARYDIR C:/src/protobuf-2.3.0/vsprojects/Release) 
  • trunk/cmake/NSCPPBuffer.cmake

    r244 r256  
    2626  # in cache already 
    2727  SET(PROTOBUF_FOUND TRUE) 
     28  MESSAGE(STATUS, "CACHED Protocol buffers was found!") 
    2829ELSE (PROTOBUF_LIBRARY AND PROTOBUF_INCLUDE_DIR AND PROTOBUF_PROTOC_EXECUTABLE) 
    2930 
     
    5152  SET(PROTOBUF_PROTOC_EXECUTABLE ${PROTOBUF_PROTOC_EXECUTABLE} CACHE INTERNAL "The protocol buffers compiler") 
    5253 
     54  MESSAGE(STATUS, "PROTOBUF_INCLUDE_DIR: ${PROTOBUF_INCLUDE_DIR}, PROTOBUF_LIBRARY: ${PROTOBUF_LIBRARY}, PROTOBUF_PROTOC_EXECUTABLE: ${PROTOBUF_PROTOC_EXECUTABLE}") 
     55 
    5356ENDIF (PROTOBUF_LIBRARY AND PROTOBUF_INCLUDE_DIR AND PROTOBUF_PROTOC_EXECUTABLE) 
    5457 
    5558IF (PROTOBUF_FOUND) 
     59  MESSAGE(STATUS, "Good: Protocol buffers was found (${PROTOBUF_INCLUDE_DIR})") 
    5660  # Define the WRAP_PROTO function 
     61  SET(PROTOBUF_FOUND TRUE PARENT_SCOPE) 
    5762  FUNCTION(WRAP_PROTO VAR) 
    5863    IF (NOT ARGN) 
     
    8590 
    8691  ENDFUNCTION(WRAP_PROTO) 
     92ELSE(PROTOBUF_FOUND) 
     93  MESSAGE(STATUS, "Error: Protocol buffers was not found!") 
    8794ENDIF(PROTOBUF_FOUND) 
  • trunk/include/NSCHelper.cpp

    r254 r256  
    509509  boost::tokenizer<boost::escaped_list_separator<wchar_t>, std::wstring::const_iterator, std::wstring > tok(args, boost::escaped_list_separator<wchar_t>(L'\\', splitChar, L'\"')); 
    510510  std::list<std::wstring> arglist; 
    511   BOOST_FOREACH(wstring s, tok) 
     511  BOOST_FOREACH(std::wstring s, tok) 
    512512    arglist.push_back(s); 
    513513  return InjectSimpleCommand(command, arglist, message, perf); 
     
    529529  boost::tokenizer<boost::escaped_list_separator<wchar_t>, std::wstring::const_iterator, std::wstring > tok(buffer, boost::escaped_list_separator<wchar_t>(L'\\', spliwchar_t, L'\"')); 
    530530  std::list<std::wstring> arglist; 
    531   BOOST_FOREACH(wstring s, tok) 
     531  BOOST_FOREACH(std::wstring s, tok) 
    532532    arglist.push_back(s); 
    533533  return InjectSimpleCommand(command.c_str(), arglist, message, perf); 
  • trunk/include/NSCHelper.h

    r254 r256  
    3333#include <strEx.h> 
    3434 
    35 #include "../proto/plugin.proto.h" 
     35#include "../libs/protobuf/plugin.proto.h" 
    3636 
    3737#ifdef WIN32 
  • trunk/include/nrpe/nrpe_socket.hpp

    r254 r256  
    1414    boost::shared_ptr<tcp::socket> socket_; 
    1515  public: 
    16     typedef boost::asio::basic_socket<tcp,boost::asio::stream_socket_service<tcp>>  basic_socket_type; 
     16    typedef boost::asio::basic_socket<tcp,boost::asio::stream_socket_service<tcp> >  basic_socket_type; 
    1717 
    1818  public: 
     
    7474  class ssl_socket : public socket { 
    7575  private: 
    76     boost::shared_ptr<boost::asio::ssl::stream<tcp::socket>> ssl_socket_; 
     76    boost::shared_ptr<boost::asio::ssl::stream<tcp::socket> > ssl_socket_; 
    7777 
    7878  public: 
  • trunk/include/nsca/nsca_socket.hpp

    r254 r256  
    1717    nsca_encrypt crypt_inst; 
    1818  public: 
    19     typedef boost::asio::basic_socket<tcp,boost::asio::stream_socket_service<tcp>>  basic_socket_type; 
     19    typedef boost::asio::basic_socket<tcp,boost::asio::stream_socket_service<tcp> >  basic_socket_type; 
    2020 
    2121  public: 
     
    8787  class ssl_socket : public socket { 
    8888  private: 
    89     boost::shared_ptr<boost::asio::ssl::stream<tcp::socket>> ssl_socket_; 
     89    boost::shared_ptr<boost::asio::ssl::stream<tcp::socket> > ssl_socket_; 
    9090 
    9191  public: 
  • trunk/include/strEx.h

    r255 r256  
    792792  template<typename T> 
    793793  inline void parse_command(T &cmd_line, std::list<T> &args) { 
    794     boost::tokenizer<boost::escaped_list_separator<wchar_t>, T::const_iterator, T > tok(cmd_line, boost::escaped_list_separator<wchar_t>(L'\\', L' ', L'\"')); 
     794    boost::tokenizer<boost::escaped_list_separator<wchar_t>, typename T::const_iterator, T > tok(cmd_line, boost::escaped_list_separator<wchar_t>(L'\\', L' ', L'\"')); 
    795795    BOOST_FOREACH(T s, tok) 
    796796      args.push_back(s); 
     
    798798  template<typename T> 
    799799  inline void parse_command(T cmd_line, T &cmd, std::list<T> &args) { 
    800     boost::tokenizer<boost::escaped_list_separator<wchar_t>, T::const_iterator, T > tok(cmd_line, boost::escaped_list_separator<wchar_t>(L'\\', L' ', L'\"')); 
     800    boost::tokenizer<boost::escaped_list_separator<wchar_t>, typename T::const_iterator, T > tok(cmd_line, boost::escaped_list_separator<wchar_t>(L'\\', L' ', L'\"')); 
    801801    bool first = true; 
    802802    BOOST_FOREACH(T s, tok)  
  • trunk/libs/protobuf/CMakeLists.txt

    r254 r256  
    1616  ${PROTOBUF_LIBRARY} 
    1717) 
    18  
    19  
    20 #INSTALL(FILES ${PROJECT_SOURCE_DIR}/cmake/FindWt.cmake DESTINATION 
    21 #    ${CMAKE_INSTALL_PREFIX}/${WT_CMAKE_FINDER_INSTALL_DIR} ) 
    22  
  • trunk/modules/CheckExternalScripts/CheckExternalScripts.cpp

    r254 r256  
    134134  if (isAlias || allowArgs_) { 
    135135    int i=1; 
    136     BOOST_FOREACH(wstring str, arguments) { 
     136    BOOST_FOREACH(std::wstring str, arguments) { 
    137137      if (isAlias || allowNasty_) { 
    138138        if (str.find_first_of(NASTY_METACHARS) != std::wstring::npos) { 
  • trunk/modules/CheckHelpers/CMakeLists.txt

    r244 r256  
    2323ENDIF(WIN32) 
    2424 
    25 add_library(${TARGET} MODULE ${SRCS}) 
     25 
     26ADD_LIBRARY(${TARGET} MODULE ${SRCS}) 
     27 
     28 
     29SET_TARGET_PROPERTIES(${TARGET} PROPERTIES COMPILE_FLAGS "-fPIC -w -pipe -DNDEBUG -DLINUX -finline-functions -O3") 
    2630 
    2731target_link_libraries(${TARGET} 
     
    3438#    ${CMAKE_INSTALL_PREFIX}/${WT_CMAKE_FINDER_INSTALL_DIR} ) 
    3539 
     40 
     41 
  • trunk/modules/FileLogger/FileLogger.cpp

    r245 r256  
    8484 
    8585bool FileLogger::loadModule(NSCAPI::moduleLoadMode mode) { 
    86   _tzset(); 
     86  //_tzset(); 
    8787  getFileName(); 
    8888 
     
    157157  std::wstringstream ss; 
    158158  boost::posix_time::time_facet *facet = new boost::posix_time::time_facet(format_.c_str()); 
    159   ss.imbue(locale(cout.getloc(), facet)); 
     159  ss.imbue(std::locale(std::cout.getloc(), facet)); 
    160160  ss << boost::posix_time::second_clock::local_time(); 
    161161  return ss.str(); 
  • trunk/modules/FileLogger/FileLogger.h

    r245 r256  
    5858 
    5959  std::string getFileName(); 
    60   inline std::wstring FileLogger::get_formated_date(); 
     60  inline std::wstring get_formated_date(); 
    6161 
    6262}; 
  • trunk/modules/NRPEClient/NRPEClient.cpp

    r254 r256  
    5454  boost::filesystem::wpath p = NSCModuleHelper::getBasePath() + std::wstring(_T("security/nrpe_dh_512.pem")); 
    5555  cert_ = p.string(); 
    56   if (boost::filesystem::is_regular_file(p)) { 
     56  if (boost::filesystem::is_regular(p)) { 
    5757    NSC_DEBUG_MSG_STD(_T("Using certificate: ") + cert_); 
    5858  } else { 
     
    149149  if (SETTINGS_GET_BOOL(nrpe::ALLOW_ARGS) == 1) { 
    150150    int i=1; 
    151     BOOST_FOREACH(wstring arg, arguments) 
     151    BOOST_FOREACH(std::wstring arg, arguments) 
    152152    { 
    153153      if (SETTINGS_GET_INT(nrpe::ALLOW_NASTY) == 0) { 
  • trunk/modules/NSCAAgent/NSCAAgent.cpp

    r254 r256  
    3030 
    3131NSCAAgent gNSCAAgent; 
    32  
    33 /** 
    34  * DLL Entry point 
    35  * @param hModule  
    36  * @param ul_reason_for_call  
    37  * @param lpReserved  
    38  * @return  
    39  */ 
    40 BOOL APIENTRY DllMain( HANDLE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved) 
    41 { 
    42   NSCModuleWrapper::wrapDllMain(hModule, ul_reason_for_call); 
    43   return TRUE; 
    44 } 
    4532 
    4633/** 
     
    146133 
    147134 
     135NSC_WRAP_DLL(); 
    148136NSC_WRAPPERS_MAIN_DEF(gNSCAAgent); 
    149137NSC_WRAPPERS_IGNORE_MSG_DEF(); 
  • trunk/modules/NSCAAgent/NSCAAgent.h

    r254 r256  
    2020***************************************************************************/ 
    2121#pragma once 
    22  
    23 #include <CheckMemory.h> 
    2422 
    2523NSC_WRAPPERS_MAIN(); 
  • trunk/modules/NSCAAgent/stdafx.h

    r254 r256  
    2525 
    2626#include <iostream> 
    27 #include <tchar.h> 
     27//#include <tchar.h> 
    2828#include <string> 
    2929#include <hash_map> 
  • trunk/service/NSCPlugin.cpp

    r254 r256  
    396396 
    397397    fHandleCommand = (lpHandleCommand)module_.load_proc("NSHandleCommand"); 
    398     if (!fHandleCommand) 
    399       throw NSPluginException(module_, _T("Could not load NSHandleCommand")); 
     398    //if (!fHandleCommand) 
     399    //  throw NSPluginException(module_, _T("Could not load NSHandleCommand")); 
    400400 
    401401    fDeleteBuffer = (lpDeleteBuffer)module_.load_proc("NSDeleteBuffer"); 
  • trunk/service/NSClient++.cpp

    r254 r256  
    4040#include "service_manager.hpp" 
    4141 
    42 #include "../proto/plugin.proto.h" 
     42#include "../libs/protobuf/plugin.proto.h" 
    4343 
    4444NSClient mainClient(SZSERVICENAME); // Global core instance. 
     
    10501050 
    10511051    boost::tokenizer<boost::escaped_list_separator<char> > tok(args, boost::escaped_list_separator<char>('\\', ' ', '\"')); 
    1052     BOOST_FOREACH(string s, tok) 
     1052    BOOST_FOREACH(std::string s, tok) 
    10531053      req->add_arguments(s); 
    10541054 
Note: See TracChangeset for help on using the changeset viewer.