Build fix for FreeBSD/OS X.

This commit is contained in:
Gunnar Beutner 2014-03-31 02:08:15 +02:00 committed by Gunnar Beutner
parent 2a90817c66
commit aba2a09245
4 changed files with 21 additions and 21 deletions

View File

@ -67,7 +67,7 @@ static bool LoadConfigFiles(const String& appType, ValidationType validate)
ConfigCompilerContext::GetInstance()->Reset(); ConfigCompilerContext::GetInstance()->Reset();
if (g_AppParams.count("config") > 0) { if (g_AppParams.count("config") > 0) {
BOOST_FOREACH(const String& configPath, g_AppParams["config"].as<std::vector<String> >()) { BOOST_FOREACH(const String& configPath, g_AppParams["config"].as<std::vector<std::string> >()) {
ConfigCompiler::CompileFile(configPath); ConfigCompiler::CompileFile(configPath);
} }
} }
@ -216,19 +216,19 @@ int main(int argc, char **argv)
desc.add_options() desc.add_options()
("help", "show this help message") ("help", "show this help message")
("version,V", "show version information") ("version,V", "show version information")
("library,l", po::value<std::vector<String> >(), "load a library") ("library,l", po::value<std::vector<std::string> >(), "load a library")
("include,I", po::value<std::vector<String> >(), "add include search directory") ("include,I", po::value<std::vector<std::string> >(), "add include search directory")
("define,D", po::value<std::vector<String> >(), "define a constant") ("define,D", po::value<std::vector<std::string> >(), "define a constant")
("config,c", po::value<std::vector<String> >(), "parse a configuration file") ("config,c", po::value<std::vector<std::string> >(), "parse a configuration file")
("no-config,z", "start without a configuration file") ("no-config,z", "start without a configuration file")
("validate,C", "exit after validating the configuration") ("validate,C", "exit after validating the configuration")
("no-validate,Z", "skip validating the configuration") ("no-validate,Z", "skip validating the configuration")
("debug,x", "enable debugging") ("debug,x", "enable debugging")
("daemonize,d", "detach from the controlling terminal") ("daemonize,d", "detach from the controlling terminal")
("errorlog,e", po::value<String>(), "log fatal errors to the specified log file (only works in combination with --daemonize)") ("errorlog,e", po::value<std::string>(), "log fatal errors to the specified log file (only works in combination with --daemonize)")
#ifndef _WIN32 #ifndef _WIN32
("user,u", po::value<String>(), "user to run Icinga as") ("user,u", po::value<std::string>(), "user to run Icinga as")
("group,g", po::value<String>(), "group to run Icinga as") ("group,g", po::value<std::string>(), "group to run Icinga as")
#endif #endif
; ;
@ -245,7 +245,7 @@ int main(int argc, char **argv)
#ifndef _WIN32 #ifndef _WIN32
if (g_AppParams.count("group")) { if (g_AppParams.count("group")) {
String group = g_AppParams["group"].as<String>(); String group = g_AppParams["group"].as<std::string>();
errno = 0; errno = 0;
struct group *gr = getgrnam(group.CStr()); struct group *gr = getgrnam(group.CStr());
@ -268,7 +268,7 @@ int main(int argc, char **argv)
} }
if (g_AppParams.count("user")) { if (g_AppParams.count("user")) {
String user = g_AppParams["user"].as<String>(); String user = g_AppParams["user"].as<std::string>();
errno = 0; errno = 0;
struct passwd *pw = getpwnam(user.CStr()); struct passwd *pw = getpwnam(user.CStr());
@ -326,7 +326,7 @@ int main(int argc, char **argv)
} }
if (g_AppParams.count("define")) { if (g_AppParams.count("define")) {
BOOST_FOREACH(const String& define, g_AppParams["define"].as<std::vector<String> >()) { BOOST_FOREACH(const String& define, g_AppParams["define"].as<std::vector<std::string> >()) {
String key, value; String key, value;
size_t pos = define.FindFirstOf('='); size_t pos = define.FindFirstOf('=');
if (pos != String::NPos) { if (pos != String::NPos) {
@ -353,7 +353,7 @@ int main(int argc, char **argv)
String appType = LoadAppType(Application::GetApplicationType()); String appType = LoadAppType(Application::GetApplicationType());
if (g_AppParams.count("library")) { if (g_AppParams.count("library")) {
BOOST_FOREACH(const String& libraryName, g_AppParams["library"].as<std::vector<String> >()) { BOOST_FOREACH(const String& libraryName, g_AppParams["library"].as<std::vector<std::string> >()) {
(void) Utility::LoadExtensionLibrary(libraryName); (void) Utility::LoadExtensionLibrary(libraryName);
} }
} }
@ -361,7 +361,7 @@ int main(int argc, char **argv)
ConfigCompiler::AddIncludeSearchDir(Application::GetPkgDataDir()); ConfigCompiler::AddIncludeSearchDir(Application::GetPkgDataDir());
if (g_AppParams.count("include")) { if (g_AppParams.count("include")) {
BOOST_FOREACH(const String& includePath, g_AppParams["include"].as<std::vector<String> >()) { BOOST_FOREACH(const String& includePath, g_AppParams["include"].as<std::vector<std::string> >()) {
ConfigCompiler::AddIncludeSearchDir(includePath); ConfigCompiler::AddIncludeSearchDir(includePath);
} }
} }
@ -376,7 +376,7 @@ int main(int argc, char **argv)
String errorLog; String errorLog;
if (g_AppParams.count("errorlog")) if (g_AppParams.count("errorlog"))
errorLog = g_AppParams["errorlog"].as<String>(); errorLog = g_AppParams["errorlog"].as<std::string>();
Daemonize(errorLog); Daemonize(errorLog);
Logger::DisableConsoleLog(); Logger::DisableConsoleLog();

View File

@ -64,7 +64,7 @@ public:
template<typename T> template<typename T>
static String ToString(const T& val) static String ToString(const T& val)
{ {
return boost::lexical_cast<String>(val); return boost::lexical_cast<std::string>(val);
} }
static String ToString(const String& val); static String ToString(const String& val);

View File

@ -34,7 +34,7 @@ void __cxa_throw(void *obj, void *pvtinfo, void (*dest)(void *))
if (real_cxa_throw == 0) if (real_cxa_throw == 0)
real_cxa_throw = (cxa_throw_fn)dlsym(RTLD_NEXT, "__cxa_throw"); real_cxa_throw = (cxa_throw_fn)dlsym(RTLD_NEXT, "__cxa_throw");
#ifndef __APPLE__ #ifdef __GLIBC__
void *thrown_ptr = obj; void *thrown_ptr = obj;
const std::type_info *tinfo = static_cast<std::type_info *>(pvtinfo); const std::type_info *tinfo = static_cast<std::type_info *>(pvtinfo);
const std::type_info *boost_exc = &typeid(boost::exception); 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; thrown_ptr = *(void **)thrown_ptr;
if (!user_exc->__do_catch(tinfo, &thrown_ptr, 1)) { if (!user_exc->__do_catch(tinfo, &thrown_ptr, 1)) {
#endif /* __APPLE__ */ #endif /* __GLIBCXX__ */
StackTrace stack; StackTrace stack;
SetLastExceptionStack(stack); SetLastExceptionStack(stack);
ContextTrace context; ContextTrace context;
SetLastExceptionContext(context); SetLastExceptionContext(context);
#ifndef __APPLE__ #ifdef __GLIBCXX__
/* Check if thrown_ptr inherits from boost::exception. */ /* Check if thrown_ptr inherits from boost::exception. */
if (boost_exc->__do_catch(tinfo, &thrown_ptr, 1)) { if (boost_exc->__do_catch(tinfo, &thrown_ptr, 1)) {
boost::exception *ex = (boost::exception *)thrown_ptr; boost::exception *ex = (boost::exception *)thrown_ptr;
@ -64,7 +64,7 @@ void __cxa_throw(void *obj, void *pvtinfo, void (*dest)(void *))
*ex << ContextTraceErrorInfo(context); *ex << ContextTraceErrorInfo(context);
} }
} }
#endif /* __APPLE__ */ #endif /* __GLIBCXX__ */
real_cxa_throw(obj, pvtinfo, dest); real_cxa_throw(obj, pvtinfo, dest);
} }

View File

@ -51,9 +51,9 @@ Value::operator String(void) const
fractional = modf(boost::get<double>(m_Value), &integral); fractional = modf(boost::get<double>(m_Value), &integral);
if (fractional != 0) if (fractional != 0)
return boost::lexical_cast<String>(m_Value); return boost::lexical_cast<std::string>(m_Value);
else else
return boost::lexical_cast<String>((long)integral); return boost::lexical_cast<std::string>((long)integral);
case ValueString: case ValueString:
return boost::get<String>(m_Value); return boost::get<String>(m_Value);
case ValueObject: case ValueObject: