]> granicus.if.org Git - icinga2/commitdiff
Proper integration for Boost.
authorGunnar Beutner <gunnar@beutner.name>
Fri, 25 May 2012 20:04:03 +0000 (22:04 +0200)
committerGunnar Beutner <gunnar@beutner.name>
Fri, 25 May 2012 20:04:03 +0000 (22:04 +0200)
15 files changed:
Makefile.am
base/Makefile.am
base/application.cpp
base/application.h
base/object.cpp
compat/Makefile.am [new file with mode: 0644]
components/configfile/Makefile.am
components/configrpc/Makefile.am
components/demo/Makefile.am
components/discovery/Makefile.am
config/ax_boost_base.m4
configure.ac
icinga-app/Makefile.am
icinga/Makefile.am
jsonrpc/Makefile.am

index c6d4315ed6bffbdea3784ce677ffc3c398891b06..f73047f0e51fa39d967a6df112755f8d8b260067 100644 (file)
@@ -3,7 +3,9 @@
 
 include aminclude.am
 
-SUBDIRS = ltdl \
+SUBDIRS = \
+       compat \
+       ltdl \
        mmatch \
        cJSON \
        base \
index 9c947730bc31a4c55870fa420464711d52905064..5a2947c7bf391a9904b1a985b30b427d2e101c2c 100644 (file)
@@ -53,6 +53,7 @@ libbase_la_SOURCES =  \
 libbase_la_CXXFLAGS = \
        -DI2_BASE_BUILD \
        $(LTDLINCL) \
+       $(BOOST_CPPFLAGS) \
        -I${top_srcdir}/mmatch
 
 libbase_la_LDFLAGS = \
@@ -61,4 +62,5 @@ libbase_la_LDFLAGS = \
 
 libbase_la_LIBADD = \
        $(LIBLTDL) \
+       $(BOOST_LDFLAGS) \
        ${top_builddir}/mmatch/libmmatch.la
index 63c21556cb8f2f83fd3bda7d15eb0ddd2ad519d0..d1c4fd5d1c2255723337769425b208f1c1a4ca50 100644 (file)
@@ -26,6 +26,7 @@
 using namespace icinga;
 
 Application::Ptr I2_EXPORT Application::m_Instance;
+bool I2_EXPORT Application::m_ShuttingDown = false;
 
 /**
  * Constructor for the Application class.
@@ -50,7 +51,6 @@ Application::Application(void)
                m_Debugging = true;
 #endif /* _WIN32 */
 
-       m_ShuttingDown = false;
        m_ConfigHive = make_shared<ConfigHive>();
 }
 
@@ -59,6 +59,8 @@ Application::Application(void)
  */
 Application::~Application(void)
 {
+       m_ShuttingDown = true;
+
        /* stop all components */
        for (map<string, Component::Ptr>::iterator i = m_Components.begin();
            i != m_Components.end(); i++) {
@@ -81,7 +83,10 @@ Application::~Application(void)
  */
 Application::Ptr Application::GetInstance(void)
 {
-       return m_Instance;
+       if (m_ShuttingDown)
+               return Application::Ptr();
+       else
+               return m_Instance;
 }
 
 /**
index 3996cd7797eef3b18d78f48bdbfd2d820ccd3ef1..5b22db9f678bf986e90a2d1365c45a0ab7f42fcf 100644 (file)
@@ -45,7 +45,7 @@ public:
 
        virtual int Main(const vector<string>& args) = 0;
 
-       void Shutdown(void);
+       static void Shutdown(void);
 
        static void Log(string message);
 
@@ -65,9 +65,9 @@ protected:
        string GetExeDirectory(void) const;
 
 private:
-       static Application::Ptr m_Instance;
+       static Application::Ptr m_Instance; /**< The application instance. */
 
-       bool m_ShuttingDown; /**< Whether the application is in the process of
+       static bool m_ShuttingDown; /**< Whether the application is in the process of
                                  shutting down. */
        ConfigHive::Ptr m_ConfigHive; /**< The application's configuration. */
        map< string, shared_ptr<Component> > m_Components; /**< Components that
index be1858b128282b0d88f851b25b50886bbaabf7f9..8bee4935c48c567c466b8441800a60b5b7aafead 100644 (file)
@@ -33,4 +33,5 @@ Object::Object(void)
  */
 Object::~Object(void)
 {
-}
\ No newline at end of file
+}
+
diff --git a/compat/Makefile.am b/compat/Makefile.am
new file mode 100644 (file)
index 0000000..229d9e1
--- /dev/null
@@ -0,0 +1,9 @@
+EXTRA_DIST=include
+
+dist-hook:
+       mkdir -p boost && \
+       bcp --boost=$(BOOST_PATH)/include tr1 smart_ptr bind function make_shared boost && \
+       rm -Rf include && \
+       mkdir include && \
+       mv boost/boost include/ && \
+       rm -Rf boost
index cd38dcb1bd3022c144a27694b6ae25b68c615667..fc98fd555981f97a452779d1c09d640cbf4a1212 100644 (file)
@@ -9,6 +9,7 @@ configfile_la_SOURCES = \
        i2-configfile.h
 
 configfile_la_CXXFLAGS = \
+       $(BOOST_CPPFLAGS) \
        -I${top_srcdir}/base \
        -I${top_srcdir}/icinga \
        -I${top_srcdir}/jsonrpc \
@@ -20,6 +21,7 @@ configfile_la_LDFLAGS = \
        -version-info 0:0:0
 
 configfile_la_LIBADD = \
+       $(BOOST_LDFLAGS) \
        $(top_builddir)/base/libbase.la \
        $(top_builddir)/icinga/libicinga.la \
        $(top_builddir)/cJSON/libcJSON.la
index aa92bba17707cd199a22134541ad7433afe79017..dabb9e384d2ed5d4c680c6d4fc564ab935b3353f 100644 (file)
@@ -9,6 +9,7 @@ configrpc_la_SOURCES = \
        i2-configrpc.h
 
 configrpc_la_CXXFLAGS = \
+       $(BOOST_CPPFLAGS) \
        -I${top_srcdir}/base \
        -I${top_srcdir}/jsonrpc \
        -I${top_srcdir}/icinga
@@ -19,6 +20,7 @@ configrpc_la_LDFLAGS = \
        -version-info 0:0:0
 
 configrpc_la_LIBADD = \
+       $(BOOST_LDFLAGS) \
        ${top_builddir}/base/libbase.la \
        ${top_builddir}/jsonrpc/libjsonrpc.la \
        ${top_builddir}/icinga/libicinga.la
index 0406f4d3f50d964eb1f9871144895f20f251952e..b47f5fc2b7a850c301dfda78e4a8371c9a307dda 100644 (file)
@@ -9,6 +9,7 @@ demo_la_SOURCES = \
        i2-demo.h
 
 demo_la_CXXFLAGS = \
+       $(BOOST_CPPFLAGS) \
        -I${top_srcdir}/base \
        -I${top_srcdir}/jsonrpc \
        -I${top_srcdir}/cJSON \
@@ -20,6 +21,7 @@ demo_la_LDFLAGS = \
        -version-info 0:0:0
 
 demo_la_LIBADD = \
+       $(BOOST_LDFLAGS) \
        ${top_builddir}/base/libbase.la \
        ${top_builddir}/jsonrpc/libjsonrpc.la \
        ${top_builddir}/icinga/libicinga.la
index 7d536eddf0d75ae2a8350cc6e717f8430a4620ea..41f0912cddf92f2287eb9b59ff29cdfda71f5e72 100644 (file)
@@ -10,13 +10,21 @@ discovery_la_SOURCES =  \
        discoverymessage.h \
        i2-discovery.h
 
-discovery_la_CXXFLAGS = -I${top_srcdir}/base \
+discovery_la_CXXFLAGS = \
+       $(BOOST_CPPFLAGS) \
+       -I${top_srcdir}/base \
        -I${top_srcdir}/jsonrpc \
        -I${top_srcdir}/cJSON \
        -I${top_srcdir}/icinga
 
-discovery_la_LDFLAGS = -module -version-info 0:0:0 -no-undefined -pthread
-discovery_la_LIBADD = ${top_builddir}/base/libbase.la \
+discovery_la_LDFLAGS = \
+       -module \
+       -version-info 0:0:0 \
+       -no-undefined
+
+discovery_la_LIBADD = \
+       $(BOOST_LDFLAGS) \
+       ${top_builddir}/base/libbase.la \
        ${top_builddir}/jsonrpc/libjsonrpc.la \
        ${top_builddir}/cJSON/libcJSON.la \
        ${top_builddir}/icinga/libicinga.la
index 54a2a1bee74e97f9c20eae32667dc6cf66c05bdd..f72bc2c3d250df967ff2097e6adebc1dd9ec1e22 100644 (file)
@@ -17,7 +17,7 @@
 #
 #   This macro calls:
 #
-#     AC_SUBST(BOOST_CPPFLAGS) / AC_SUBST(BOOST_LDFLAGS)
+#     AC_SUBST(BOOST_CPPFLAGS) / AC_SUBST(BOOST_LDFLAGS) AC_SUBST(BOOST_PATH)
 #
 #   And sets:
 #
@@ -100,6 +100,7 @@ if test "x$want_boost" = "xyes"; then
     dnl or if you install boost with RPM
     if test "$ac_boost_path" != ""; then
         BOOST_CPPFLAGS="-I$ac_boost_path/include"
+        BOOST_PATH="$ac_boost_path"
         for ac_boost_path_tmp in $libsubdirs; do
                 if test -d "$ac_boost_path"/"$ac_boost_path_tmp" ; then
                         BOOST_LDFLAGS="-L$ac_boost_path/$ac_boost_path_tmp"
@@ -107,13 +108,14 @@ if test "x$want_boost" = "xyes"; then
                 fi
         done
     elif test "$cross_compiling" != yes; then
-        for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
+        for ac_boost_path_tmp in /usr /usr/local /opt /opt/local "`pwd`/compat" ; do
             if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
                 for libsubdir in $libsubdirs ; do
                     if ls "$ac_boost_path_tmp/$libsubdir/libboost_"* >/dev/null 2>&1 ; then break; fi
                 done
                 BOOST_LDFLAGS="-L$ac_boost_path_tmp/$libsubdir"
                 BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
+                BOOST_PATH="$ac_boost_path_tmp"
                 break;
             fi
         done
@@ -246,6 +248,7 @@ if test "x$want_boost" = "xyes"; then
     else
         AC_SUBST(BOOST_CPPFLAGS)
         AC_SUBST(BOOST_LDFLAGS)
+        AC_SUBST(BOOST_PATH)
         AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available])
         # execute ACTION-IF-FOUND (if present):
         ifelse([$2], , :, [$2])
index 3169ddeb26e84941f01651232184c64c31de5f97..e51b072329a9acd4535eec5e90c8705db9421897 100644 (file)
@@ -54,6 +54,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <openssl/ssl.h>]], [])], [], [AC_M
 
 AC_OUTPUT([
 Makefile
+compat/Makefile
 base/Makefile
 cJSON/Makefile
 components/Makefile
index 62625069792ee6ac1194fda5ac71460b1b4a6c0d..6cc726a2506481682cc0356f119407f8b4fcb088 100644 (file)
@@ -9,6 +9,7 @@ icinga_SOURCES = \
 
 icinga_CXXFLAGS = \
        -DI2_ICINGALAUNCHER_BUILD \
+       $(BOOST_CPPFLAGS) \
        -I${top_srcdir}/base \
        -I${top_srcdir}/jsonrpc \
        -I${top_srcdir}/cJSON \
@@ -16,6 +17,7 @@ icinga_CXXFLAGS = \
        -I${top_srcdir}
 
 icinga_LDADD = \
+       $(BOOST_LDFLAGS) \
        ${top_builddir}/base/libbase.la \
        ${top_builddir}/icinga/libicinga.la \
        -dlopen ${top_builddir}/components/configfile/configfile.la \
index 85f99d2ecfe11a14568fb65974f30c62ff53af42..e127ac3054c5f8af838851c235da3fd1126f3e47 100644 (file)
@@ -23,6 +23,7 @@ libicinga_la_CFLAGS = -DI2_ICINGA_BUILD
 
 libicinga_la_CXXFLAGS = \
        -DI2_ICINGA_BUILD \
+       $(BOOST_CPPFLAGS) \
        -I${top_srcdir}/base \
        -I${top_srcdir}/jsonrpc \
        -I${top_srcdir}/cJSON \
@@ -33,5 +34,6 @@ libicinga_la_LDFLAGS = \
        -version-info 0:0:0
 
 libicinga_la_LIBADD = \
+       $(BOOST_LDFLAGS) \
        ${top_builddir}/jsonrpc/libjsonrpc.la \
        ${top_builddir}/base/libbase.la
index ffa2fe50b3491b3bb94d131cf6fdf3b3ad009d5b..b4c38a4084244d3c34aada91b8ab048543167998 100644 (file)
@@ -21,6 +21,7 @@ libjsonrpc_la_SOURCES = \
 
 libjsonrpc_la_CXXFLAGS = \
        -DI2_JSONRPC_BUILD \
+       $(BOOST_CPPFLAGS) \
        -I${top_srcdir}/base \
        -I${top_srcdir}/cJSON
 
@@ -29,5 +30,6 @@ libjsonrpc_la_LDFLAGS = \
        -version-info 0:0:0
 
 libjsonrpc_la_LIBADD = \
+       $(BOOST_LDFLAGS) \
        ${top_builddir}/base/libbase.la \
        ${top_builddir}/cJSON/libcJSON.la