AS_AC_EXPAND([ICINGA_LOCALSTATEDIR], $localstatedir)
AC_DEFINE_UNQUOTED([ICINGA_LOCALSTATEDIR], "$ICINGA_LOCALSTATEDIR", [The local state dir.])
+AS_AC_EXPAND([ICINGA_PKGLIBDIR], $libdir/$PACKAGE_NAME)
+AC_DEFINE_UNQUOTED([ICINGA_PKGLIBDIR], "$ICINGA_PKGLIBDIR", [The package lib dir.])
+
AC_CONFIG_FILES([
Makefile
components/Makefile
Application::SetLocalStateDir(ICINGA_LOCALSTATEDIR);
#endif /* ICINGA_LOCALSTATEDIR */
+#ifdef ICINGA_PKGLIBDIR
+ Application::SetPkgLibDir(ICINGA_PKGLIBDIR);
+#endif /* ICINGA_PKGLIBDIR */
+
Logger::Write(LogInformation, "icinga", "Icinga application loader"
#ifndef _WIN32
" (version: " ICINGA_VERSION ")"
return EXIT_FAILURE;
}
- String exeDirectory = Utility::DirName(Application::GetExePath(argv[0]));
- Component::AddSearchDir(exeDirectory + "/../lib/icinga2");
- Component::AddSearchDir(exeDirectory + "/../lib64/icinga2");
-
-#ifdef ICINGA_LIBDIR
- Component::AddSearchDir(ICINGA_LIBDIR);
-#endif /* ICINGA_LIBDIR */
+ Component::AddSearchDir(Application::GetPkgLibDir());
try {
DynamicObject::BeginTx();
boost::thread::id Application::m_MainThreadID;
String Application::m_PrefixDir;
String Application::m_LocalStateDir;
+String Application::m_PkgLibDir;
/**
* Constructor for the Application class.
String Application::GetPrefixDir(void)
{
if (m_PrefixDir.IsEmpty())
- return "./";
+ return ".";
else
return m_PrefixDir;
}
String Application::GetLocalStateDir(void)
{
if (m_LocalStateDir.IsEmpty())
- return "./var/";
+ return "./var";
else
return m_LocalStateDir;
}
m_LocalStateDir = path;
}
+/**
+ * Retrives the path for the package lib dir.
+ *
+ * @returns The path.
+ */
+String Application::GetPkgLibDir(void)
+{
+ if (m_PkgLibDir.IsEmpty())
+ return ".";
+ else
+ return m_PkgLibDir;
+}
+
+/**
+ * Sets the path for the package lib dir.
+ *
+ * @param path The new path.
+ */
+void Application::SetPkgLibDir(const String& path)
+{
+ m_PkgLibDir = path;
+}
static String GetLocalStateDir(void);
static void SetLocalStateDir(const String& path);
+ static String GetPkgLibDir(void);
+ static void SetPkgLibDir(const String& path);
+
protected:
void RunEventLoop(void);
static boost::thread::id m_MainThreadID; /**< ID of the main thread. */
static String m_PrefixDir; /**< The installation prefix. */
static String m_LocalStateDir; /**< The local state dir. */
+ static String m_PkgLibDir; /**< The package lib dir. */
#ifndef _WIN32
static void SigIntHandler(int signum);
*/
void Component::AddSearchDir(const String& componentDirectory)
{
+ Logger::Write(LogInformation, "base", "Adding library search dir: " +
+ componentDirectory);
+
#ifdef _WIN32
SetDllDirectory(componentDirectory.CStr());
#else /* _WIN32 */