From: Gunnar Beutner Date: Mon, 31 Mar 2014 00:08:15 +0000 (+0200) Subject: Build fix for FreeBSD/OS X. X-Git-Tag: v0.0.9~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aba2a092451927d636ff872dd412944b3c6b7eff;p=icinga2 Build fix for FreeBSD/OS X. --- diff --git a/icinga-app/icinga.cpp b/icinga-app/icinga.cpp index abb43672b..4c10e3a8c 100644 --- a/icinga-app/icinga.cpp +++ b/icinga-app/icinga.cpp @@ -67,7 +67,7 @@ static bool LoadConfigFiles(const String& appType, ValidationType validate) ConfigCompilerContext::GetInstance()->Reset(); if (g_AppParams.count("config") > 0) { - BOOST_FOREACH(const String& configPath, g_AppParams["config"].as >()) { + BOOST_FOREACH(const String& configPath, g_AppParams["config"].as >()) { ConfigCompiler::CompileFile(configPath); } } @@ -216,19 +216,19 @@ int main(int argc, char **argv) desc.add_options() ("help", "show this help message") ("version,V", "show version information") - ("library,l", po::value >(), "load a library") - ("include,I", po::value >(), "add include search directory") - ("define,D", po::value >(), "define a constant") - ("config,c", po::value >(), "parse a configuration file") + ("library,l", po::value >(), "load a library") + ("include,I", po::value >(), "add include search directory") + ("define,D", po::value >(), "define a constant") + ("config,c", po::value >(), "parse a configuration file") ("no-config,z", "start without a configuration file") ("validate,C", "exit after validating the configuration") ("no-validate,Z", "skip validating the configuration") ("debug,x", "enable debugging") ("daemonize,d", "detach from the controlling terminal") - ("errorlog,e", po::value(), "log fatal errors to the specified log file (only works in combination with --daemonize)") + ("errorlog,e", po::value(), "log fatal errors to the specified log file (only works in combination with --daemonize)") #ifndef _WIN32 - ("user,u", po::value(), "user to run Icinga as") - ("group,g", po::value(), "group to run Icinga as") + ("user,u", po::value(), "user to run Icinga as") + ("group,g", po::value(), "group to run Icinga as") #endif ; @@ -245,7 +245,7 @@ int main(int argc, char **argv) #ifndef _WIN32 if (g_AppParams.count("group")) { - String group = g_AppParams["group"].as(); + String group = g_AppParams["group"].as(); errno = 0; struct group *gr = getgrnam(group.CStr()); @@ -268,7 +268,7 @@ int main(int argc, char **argv) } if (g_AppParams.count("user")) { - String user = g_AppParams["user"].as(); + String user = g_AppParams["user"].as(); errno = 0; struct passwd *pw = getpwnam(user.CStr()); @@ -326,7 +326,7 @@ int main(int argc, char **argv) } if (g_AppParams.count("define")) { - BOOST_FOREACH(const String& define, g_AppParams["define"].as >()) { + BOOST_FOREACH(const String& define, g_AppParams["define"].as >()) { String key, value; size_t pos = define.FindFirstOf('='); if (pos != String::NPos) { @@ -353,7 +353,7 @@ int main(int argc, char **argv) String appType = LoadAppType(Application::GetApplicationType()); if (g_AppParams.count("library")) { - BOOST_FOREACH(const String& libraryName, g_AppParams["library"].as >()) { + BOOST_FOREACH(const String& libraryName, g_AppParams["library"].as >()) { (void) Utility::LoadExtensionLibrary(libraryName); } } @@ -361,7 +361,7 @@ int main(int argc, char **argv) ConfigCompiler::AddIncludeSearchDir(Application::GetPkgDataDir()); if (g_AppParams.count("include")) { - BOOST_FOREACH(const String& includePath, g_AppParams["include"].as >()) { + BOOST_FOREACH(const String& includePath, g_AppParams["include"].as >()) { ConfigCompiler::AddIncludeSearchDir(includePath); } } @@ -376,7 +376,7 @@ int main(int argc, char **argv) String errorLog; if (g_AppParams.count("errorlog")) - errorLog = g_AppParams["errorlog"].as(); + errorLog = g_AppParams["errorlog"].as(); Daemonize(errorLog); Logger::DisableConsoleLog(); diff --git a/lib/base/convert.h b/lib/base/convert.h index 6e55ebf12..a66e9b7ce 100644 --- a/lib/base/convert.h +++ b/lib/base/convert.h @@ -64,7 +64,7 @@ public: template static String ToString(const T& val) { - return boost::lexical_cast(val); + return boost::lexical_cast(val); } static String ToString(const String& val); diff --git a/lib/base/exception.cpp b/lib/base/exception.cpp index fd142d734..58ff7aaed 100644 --- a/lib/base/exception.cpp +++ b/lib/base/exception.cpp @@ -34,7 +34,7 @@ void __cxa_throw(void *obj, void *pvtinfo, void (*dest)(void *)) if (real_cxa_throw == 0) real_cxa_throw = (cxa_throw_fn)dlsym(RTLD_NEXT, "__cxa_throw"); -#ifndef __APPLE__ +#ifdef __GLIBC__ void *thrown_ptr = obj; const std::type_info *tinfo = static_cast(pvtinfo); const std::type_info *boost_exc = &typeid(boost::exception); @@ -45,14 +45,14 @@ void __cxa_throw(void *obj, void *pvtinfo, void (*dest)(void *)) thrown_ptr = *(void **)thrown_ptr; if (!user_exc->__do_catch(tinfo, &thrown_ptr, 1)) { -#endif /* __APPLE__ */ +#endif /* __GLIBCXX__ */ StackTrace stack; SetLastExceptionStack(stack); ContextTrace context; SetLastExceptionContext(context); -#ifndef __APPLE__ +#ifdef __GLIBCXX__ /* Check if thrown_ptr inherits from boost::exception. */ if (boost_exc->__do_catch(tinfo, &thrown_ptr, 1)) { boost::exception *ex = (boost::exception *)thrown_ptr; @@ -64,7 +64,7 @@ void __cxa_throw(void *obj, void *pvtinfo, void (*dest)(void *)) *ex << ContextTraceErrorInfo(context); } } -#endif /* __APPLE__ */ +#endif /* __GLIBCXX__ */ real_cxa_throw(obj, pvtinfo, dest); } diff --git a/lib/base/value-operators.cpp b/lib/base/value-operators.cpp index afd4d8a16..eb507fbac 100644 --- a/lib/base/value-operators.cpp +++ b/lib/base/value-operators.cpp @@ -51,9 +51,9 @@ Value::operator String(void) const fractional = modf(boost::get(m_Value), &integral); if (fractional != 0) - return boost::lexical_cast(m_Value); + return boost::lexical_cast(m_Value); else - return boost::lexical_cast((long)integral); + return boost::lexical_cast((long)integral); case ValueString: return boost::get(m_Value); case ValueObject: