NEWS
-EXTRA_DIST = $(icinga2doc_DATA)
+EXTRA_DIST = $(icinga2doc_DATA) git_version.sh
# Remove doc directory on uninstall
## Process this file with automake to produce Makefile.in
-noinst_LIBRARIES = \
- libbase.a
+noinst_LTLIBRARIES = \
+ libbase.la
-libbase_a_SOURCES = \
+libbase_la_SOURCES = \
application.cpp \
application.h \
component.cpp \
unix.h \
win32.cpp \
win32.h
+
+libbase_la_LIBADD=$(LIBLTDL)
+
+AM_CFLAGS=$(LTDLINCL)
+AM_CXXFLAGS=$(LTDLINCL)
#include "i2-base.h"
+#ifndef _WIN32
+# include <ltdl.h>
+#endif
+
using namespace icinga;
Application::RefType Application::Instance;
Log("Loading component '%s'", path.c_str());
+#ifdef _WIN32
HMODULE hModule = LoadLibrary(path.c_str());
+#else /* _WIN32 */
+ lt_dlhandle hModule = 0;
+ lt_dladvise advise;
+
+ if (!lt_dladvise_init(&advise) && !lt_dladvise_global(&advise)) {
+ hModule = lt_dlopenadvise(path.c_str(), advise);
+ }
+
+ lt_dladvise_destroy(&advise);
+#endif /* _WIN32 */
- if (hModule == INVALID_HANDLE_VALUE)
+ if (hModule == NULL)
throw exception(/*"Could not load module"*/);
- pCreateComponent = (Component *(*)())GetProcAddress(hModule, "CreateComponent");
+#ifdef _WIN32
+ pCreateComponent = (Component *(*)())GetProcAddress(hModule, );
+#else /* _WIN32 */
+ pCreateComponent = (Component *(*)())lt_dlsym(hModule, "CreateComponent");
+#endif /* _WIN32 */
if (pCreateComponent == NULL)
throw exception(/*"Module does not contain CreateComponent function"*/);
<ClCompile Include="thread.cpp" />
<ClCompile Include="timer.cpp" />
<ClCompile Include="unix.cpp" />
+ <ClCompile Include="win32.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="application.h" />
usleep(milliseconds * 1000);
}
-inline void closesocket(SOCKET fd)
+void closesocket(SOCKET fd)
{
close(fd);
}
-inline HMODULE LoadLibrary(const char *filename)
-{
- lt_dlhandle handle = 0;
- lt_dladvise advise;
-
- if (!lt_dladvise_init(&advise) && !lt_dladvise_global(&advise)) {
- handle = lt_dlopenadvise(filename, advise);
- }
-
- lt_dladvise_destroy(&advise);
-
- return handle;
-}
-
-inline void FreeLibrary(HMODULE module)
-{
- if (module)
- lt_dlclose(module);
-}
-
-inline void *GetProcAddress(HMODULE module, const char *function)
-{
- return lt_dlsym(module, function);
-}
-
#endif /* I2_PLATFORM == PLATFORM_UNIX */
#define I2_EXPORT
#define I2_IMPORT
-typedef void *HMODULE;
-
-#define INVALID_HANDLE_VALUE NULL
-
-HMODULE LoadLibrary(const char *filename);
-void FreeLibrary(HMODULE module);
-void *GetProcAddress(HMODULE module, const char *function);
-
#endif /* UNIX_H */
libconfigfilecomponent_la_CXXFLAGS = -I${top_srcdir}/base -I${top_srcdir}/jsonrpc
-libconfigfilecomponent_la_LDFLAGS = -module -version-info 0:0:0 -no-undefined
\ No newline at end of file
+libconfigfilecomponent_la_LDFLAGS = -module -version-info 0:0:0 -no-undefined
+libconfigfilecomponent_la_LIBADD = ${top_builddir}/base/libbase.la ${top_builddir}/jsonrpc/libjsonrpc.la
\ No newline at end of file
libconfigrpccomponent_la_CXXFLAGS = -I${top_srcdir}/base -I${top_srcdir}/jsonrpc -I${top_srcdir}/icinga
-libconfigrpccomponent_la_LDFLAGS = -module -version-info 0:0:0 -no-undefined
\ No newline at end of file
+libconfigrpccomponent_la_LDFLAGS = -module -version-info 0:0:0 -no-undefined
+libconfigfilecomponent_la_LIBADD = ${top_builddir}/base/libbase.la ${top_builddir}/jsonrpc/libjsonrpc.la
LT_CONFIG_LTDL_DIR([ltdl])
LTDL_INIT
-
+if test "x$with_included_ltdl" != "xyes"; then
+ AC_CHECK_LIB([ltdl], [lt_dladvise_init],
+ [],
+ [AC_MSG_ERROR([installed libltdl is too old])])
+fi
icinga_CXXFLAGS = -I${top_srcdir}/base \
-I${top_srcdir}/jsonrpc -I${top_srcdir}
-icinga_LDFLAGS = $(top_builddir)/base/libbase.a \
- $(top_builddir)/jsonrpc/libjsonrpc.a -lltdl
\ No newline at end of file
+icinga_LDFLAGS = $(top_builddir)/base/libbase.la \
+ $(top_builddir)/jsonrpc/libjsonrpc.la
\ No newline at end of file
## Process this file with automake to produce Makefile.in
-noinst_LIBRARIES = \
- libjsonrpc.a
+noinst_LTLIBRARIES = \
+ libjsonrpc.la
-libjsonrpc_a_SOURCES = \
+libjsonrpc_la_SOURCES = \
cJSON.c \
cJSON.h \
connectionmanager.cpp \
netstring.cpp \
netstring.h
-libjsonrpc_a_CXXFLAGS = -I${top_srcdir}/base
+libjsonrpc_la_CXXFLAGS = -I${top_srcdir}/base