]> git.stg.codes - ssmd.git/commitdiff
Fix build on osx. master
authorMaxim Mamontov <madf@madf.info>
Sat, 24 Mar 2018 10:04:39 +0000 (12:04 +0200)
committerMaxim Mamontov <madf@madf.info>
Sat, 24 Mar 2018 10:04:39 +0000 (12:04 +0200)
3rdparty/snmp++/Makefile
Makefile
include/logger.h
include/pidfile.h
include/settings.h
include/settings.inl.h
src/settingsfileparser.cpp
src/syncer.cpp

index 2a67cd94203462d874a7e8c6ff24dc9ef77e6872..2c34f3484ba92e297a16c42eb009b164ad8b3e7e 100644 (file)
@@ -1,6 +1,6 @@
 SHELL = /bin/sh
 DEFS += -D_USE_OPENSSL
-INCS += -Iinclude
+INCS += -I/opt/local/include -Iinclude
 CXXFLAGS += -W -Wall -Wextra $(DEFS) $(INCS)
 PROG = libsnmp++.a
 
index ad0f66296af2ad48e6895f2f25dbd46c2315d42e..5b86f16734c5fcc9eea5cb7633dece6997572706 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3,11 +3,18 @@ ifeq ($(BUILD),Debug)
        CXXFLAGS += -g3
 endif
 
-INCS = -Iinclude -I3rdparty/snmp++/include
+UNAME = $(shell uname -s)
+
+ifeq ($(UNAME), Darwin)
+       BOOST_SUFFIX = -mt
+endif
+
+INCS = -I/opt/local/include -Iinclude -I3rdparty/snmp++/include
 CXXFLAGS += -W -Wall -Wextra $(INCS) $(DEFS)
-LIBS = 3rdparty/snmp++/libsnmp++.a \
-       -lboost_system \
-       -lboost_program_options \
+LIBS = -L/opt/local/lib \
+       3rdparty/snmp++/libsnmp++.a \
+       -lboost_system$(BOOST_SUFFIX) \
+       -lboost_program_options$(BOOST_SUFFIX) \
        -lcurl \
        -lssl \
        -lcrypto \
@@ -45,8 +52,9 @@ snmplib:
 include/version.h: version
 
 version:
-       @sed 's/@VERSION@/$(VERSION)/g' include/version.h.in > include/version.h
-       @sed -i 's/@GIT_SHA@/'`git rev-parse --short HEAD`'/g' include/version.h
+       @sed 's/@VERSION@/$(VERSION)/g' include/version.h.in > include/version.h.tmp
+       @sed "s/@GIT_SHA@/$$(git rev-parse --short HEAD)/g" include/version.h.tmp > include/version.h
+       @rm include/version.h.tmp
 
 $(PROG): version $(subst .cpp,.o,$(SOURCES)) snmplib
        $(CXX) $(subst .cpp,.o,$(SOURCES)) $(LIBS) -o $@
index 7207003a92c998fd07808d37f73f645905ec82f5..7906548c0079086f36c70340648587a090e0cff7 100644 (file)
@@ -15,7 +15,7 @@ public:
         : fout(),
           consoleLog(true)
     {}
-    Logger(const std::string & fileName)
+    explicit Logger(const std::string & fileName)
         : fout(fileName.c_str(), std::ios::app),
           logFile(fileName),
           consoleLog(!fout.is_open())
index ba9adec412cb586a59b4e40c2830a1aa0471576f..a791c65001332425cd827ea39503720d8a9b41b1 100644 (file)
@@ -10,7 +10,7 @@ namespace SSMD {
 class PIDFile : private boost::noncopyable {
     public:
         PIDFile();
-        PIDFile(const std::string & file);
+        explicit PIDFile(const std::string & file);
         ~PIDFile();
     private:
         const std::string fileName;
index 041453a9a3bb1cd86b2d7a21d839fc5185a40667..6a7dfec8ee85d28df05d47731bd8746f69a51399 100644 (file)
@@ -18,7 +18,7 @@ class Settings {
         Settings(const Settings & rvalue);
         ~Settings();
 
-        const Settings & operator=(const Settings & rvalue);
+        Settings & operator=(const Settings & rvalue);
         
         // Accessors
         bool isHelp() const throw() { return _isHelp; }
index e922c82dd7be4ae08229b3567d21f9723d795a2b..c93e40b78dda4db08961814c7eb7ca7dd0f04179 100644 (file)
@@ -50,7 +50,7 @@ Settings::~Settings()
 }
 
 inline
-const Settings & Settings::operator=(const Settings & rvalue)
+Settings & Settings::operator=(const Settings & rvalue)
 {
     _isHelp = rvalue._isHelp;
     _isVersion = rvalue._isVersion;
index a21130766a8f997e23d50f4f9120b39e0be199df..006626954357f5c59be9d8658260e00107addfb6 100644 (file)
@@ -42,12 +42,6 @@ struct IniGrammar
     qi::rule<Iterator> comment, space, eol;
 };
 
-inline
-bool sectionExists(const SectionsType & data, const std::string & sectionName) throw()
-{
-    return data.find(sectionName) != data.end();
-}
-
 inline
 bool fieldExists(const SectionsType & data, const std::string & sectionName, const std::string & fieldName) throw()
 {
index fefd843259cd7f1ce55a43dba4c67ecd169df60c..436c396af29d8203683029f2d8e9a32edf93c302 100644 (file)
@@ -64,7 +64,7 @@ Syncer::~Syncer()
 void Syncer::run(const bool & running, bool & reload)
 {
     logger << "Syncer::run()" << std::endl;
-    while (running) {
+    while (true) {
         if (wait()) {
             logger << "Syncer::run() - wait stopped by signal" << std::endl;
             if (!running)