]> granicus.if.org Git - icinga2/commitdiff
Build fixes for CentOS 5.3
authorGunnar Beutner <gunnar.beutner@netways.de>
Mon, 2 Apr 2012 08:29:08 +0000 (10:29 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Mon, 2 Apr 2012 10:32:23 +0000 (12:32 +0200)
Makefile.am
base/Makefile.am
base/application.cpp
base/base.vcxproj
base/unix.cpp
base/unix.h
configfilecomponent/Makefile.am
configrpccomponent/Makefile.am
configure.ac
icinga/Makefile.am
jsonrpc/Makefile.am

index 5ce7c0b9027db37c97e8bfc1cb7deae5aee90e34..1f2d5b6bda714e1580c80b75e87fb9778ef74de7 100644 (file)
@@ -18,7 +18,7 @@ icinga2doc_DATA = \
        NEWS
 
 
-EXTRA_DIST = $(icinga2doc_DATA)
+EXTRA_DIST = $(icinga2doc_DATA) git_version.sh
 
 
 # Remove doc directory on uninstall
index 77758017c0c49d8b735b9d6e31cf8e435be64efb..c8f50b60281b1b78a3a34506111d11bc0a13a5fb 100644 (file)
@@ -1,10 +1,10 @@
 ## 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 \
@@ -42,3 +42,8 @@ libbase_a_SOURCES =  \
        unix.h \
        win32.cpp \
        win32.h
+
+libbase_la_LIBADD=$(LIBLTDL)
+
+AM_CFLAGS=$(LTDLINCL)
+AM_CXXFLAGS=$(LTDLINCL)
index c675a9e691b5145edae3ae01cf2bd836b838cc44..9c1c5e3643bd59cce8e54e94acec9b94a8c750ee 100644 (file)
@@ -1,5 +1,9 @@
 #include "i2-base.h"
 
+#ifndef _WIN32
+#      include <ltdl.h>
+#endif
+
 using namespace icinga;
 
 Application::RefType Application::Instance;
@@ -178,12 +182,27 @@ Component::RefType Application::LoadComponent(string path, ConfigObject::RefType
 
        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"*/);
index 1f4e82545d96c14497f816ef77e24fcb77f60ec2..389883f4576b2d8550aa07d6e3b044a2ddfc3a26 100644 (file)
@@ -27,6 +27,7 @@
     <ClCompile Include="thread.cpp" />
     <ClCompile Include="timer.cpp" />
     <ClCompile Include="unix.cpp" />
+    <ClCompile Include="win32.cpp" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="application.h" />
index 4cdf87edca55545f85ad6c3bbfbc520d203f769c..3e7eca4038725753f05627bb1e4eef4e22bbf806 100644 (file)
@@ -10,34 +10,9 @@ void Sleep(unsigned long milliseconds)
        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 */
index 327fcdd577051f8035199d23dd8b00427d064111..de9892be31b13871966cfe0b5c7047a84ac6de5c 100644 (file)
@@ -23,12 +23,4 @@ void closesocket(SOCKET fd);
 #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 */
index 84d57ce4bd361091d4d32a4011bb3a8226eea53f..23adca4ced8ec248e1be5adb74dc85f8a2029577 100644 (file)
@@ -10,4 +10,5 @@ libconfigfilecomponent_la_SOURCES =  \
 
 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
index 4435dddf941cff316475d04804bc2d31a5b33644..dbdcbca54dc2389b8c46804fcb1fb33367514f1d 100644 (file)
@@ -10,4 +10,5 @@ libconfigrpccomponent_la_SOURCES =  \
 
 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
index 06238a114d890911cff436123f30e5c48c246d95..2e618d159ad4aceae2545d61fb146d72ba344486 100644 (file)
@@ -20,7 +20,11 @@ LT_INIT
 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
 
 
 
index 1c9db3a2920e8fe00e1eb9586e6d708230cf7583..598c4cd423c211a2890df2c3a642ca5f8052a85f 100644 (file)
@@ -12,5 +12,5 @@ icinga_SOURCES =  \
 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
index 54a41784541c863af40a95b58b5ed195ca489dc2..a74d76e4abed819bb8c32ad908da2c332d440afb 100644 (file)
@@ -1,10 +1,10 @@
 ## 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 \
@@ -19,4 +19,4 @@ libjsonrpc_a_SOURCES =  \
        netstring.cpp \
        netstring.h
 
-libjsonrpc_a_CXXFLAGS = -I${top_srcdir}/base 
+libjsonrpc_la_CXXFLAGS = -I${top_srcdir}/base