From 7b03f52e996892f162b9daacf12e259cd5e7f614 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Sat, 12 May 2012 16:12:26 +0200 Subject: [PATCH] Added support for --disable-shared. --- Makefile.am | 4 ++-- base/application.cpp | 2 ++ base/component.h | 10 ++++++++-- components/configfile/configfilecomponent.cpp | 2 +- components/configrpc/configrpccomponent.cpp | 2 +- components/demo/democomponent.cpp | 2 +- components/discovery/discoverycomponent.cpp | 2 +- configure.ac | 2 +- icinga-app/Makefile.am | 9 ++++++++- 9 files changed, 25 insertions(+), 10 deletions(-) diff --git a/Makefile.am b/Makefile.am index f9d566af0..643922b40 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,8 +7,8 @@ SUBDIRS = ltdl \ base \ jsonrpc \ icinga \ - icinga-app \ - components + components \ + icinga-app icinga2docdir = ${prefix}/share/doc/icinga2 icinga2doc_DATA = \ diff --git a/base/application.cpp b/base/application.cpp index 6fd6fb64b..e9a5a1fca 100644 --- a/base/application.cpp +++ b/base/application.cpp @@ -38,6 +38,8 @@ Application::Application(void) WSADATA wsaData; WSAStartup(MAKEWORD(1, 1), &wsaData); #else /* _WIN32 */ + LTDL_SET_PRELOADED_SYMBOLS(); + lt_dlinit(); #endif /* _WIN32 */ diff --git a/base/component.h b/base/component.h index 822f59dd2..054a5872c 100644 --- a/base/component.h +++ b/base/component.h @@ -46,8 +46,14 @@ public: typedef Component *(*CreateComponentFunction)(void); -#define EXPORT_COMPONENT(klass) \ - extern "C" I2_EXPORT icinga::Component *CreateComponent(void) \ +#ifdef _WIN32 +# define SYM_CREATECOMPONENT(component) CreateComponent +#else /* _WIN32 */ +# define SYM_CREATECOMPONENT(component) component ## _LTX_CreateComponent +#endif /* _WIN32 */ + +#define EXPORT_COMPONENT(component, klass) \ + extern "C" I2_EXPORT icinga::Component *SYM_CREATECOMPONENT(component)(void) \ { \ return new klass(); \ } diff --git a/components/configfile/configfilecomponent.cpp b/components/configfile/configfilecomponent.cpp index e709e0098..59fb080da 100644 --- a/components/configfile/configfilecomponent.cpp +++ b/components/configfile/configfilecomponent.cpp @@ -104,4 +104,4 @@ void ConfigFileComponent::Stop(void) { } -EXPORT_COMPONENT(ConfigFileComponent); +EXPORT_COMPONENT(configfile, ConfigFileComponent); diff --git a/components/configrpc/configrpccomponent.cpp b/components/configrpc/configrpccomponent.cpp index a81d5cab6..86dbd8d1c 100644 --- a/components/configrpc/configrpccomponent.cpp +++ b/components/configrpc/configrpccomponent.cpp @@ -225,4 +225,4 @@ int ConfigRpcComponent::RemoteObjectRemovedHandler(const NewRequestEventArgs& ea return 0; } -EXPORT_COMPONENT(ConfigRpcComponent); +EXPORT_COMPONENT(configrpc, ConfigRpcComponent); diff --git a/components/demo/democomponent.cpp b/components/demo/democomponent.cpp index cc31aa27f..ef3f683be 100644 --- a/components/demo/democomponent.cpp +++ b/components/demo/democomponent.cpp @@ -102,4 +102,4 @@ int DemoComponent::HelloWorldRequestHandler(const NewRequestEventArgs& nrea) return 0; } -EXPORT_COMPONENT(DemoComponent); +EXPORT_COMPONENT(demo, DemoComponent); diff --git a/components/discovery/discoverycomponent.cpp b/components/discovery/discoverycomponent.cpp index 974a171f3..c13bbcbce 100644 --- a/components/discovery/discoverycomponent.cpp +++ b/components/discovery/discoverycomponent.cpp @@ -604,4 +604,4 @@ int DiscoveryComponent::DiscoveryTimerHandler(const TimerEventArgs& tea) return 0; } -EXPORT_COMPONENT(DiscoveryComponent); +EXPORT_COMPONENT(discovery, DiscoveryComponent); diff --git a/configure.ac b/configure.ac index 6071c9fce..fed66a4f8 100644 --- a/configure.ac +++ b/configure.ac @@ -36,7 +36,7 @@ fi AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[#include ]], []), [], [AC_MSG_ERROR([You need the OpenSSL headers and libraries in order to build this application]) ]) -LT_INIT([disable-static]) +LT_INIT([dlopen, disable-static]) LT_CONFIG_LTDL_DIR([ltdl]) LTDL_INIT diff --git a/icinga-app/Makefile.am b/icinga-app/Makefile.am index 1fe4fbacf..626250697 100644 --- a/icinga-app/Makefile.am +++ b/icinga-app/Makefile.am @@ -17,4 +17,11 @@ icinga_CXXFLAGS = \ icinga_LDADD = \ ${top_builddir}/base/libbase.la \ - ${top_builddir}/icinga/libicinga.la + ${top_builddir}/icinga/libicinga.la \ + -dlopen ${top_builddir}/components/configfile/configfile.la \ + -dlopen ${top_builddir}/components/configrpc/configrpc.la \ + -dlopen ${top_builddir}/components/demo/demo.la \ + -dlopen ${top_builddir}/components/discovery/discovery.la + +icinga_DEPENDENCIES = \ + ${top_builddir}/components/configfile/configfile.la -- 2.40.0