Check boost::signals2 in configure.ac
authorPeng Huang <shawn.p.huang@gmail.com>
Tue, 20 Apr 2010 06:01:56 +0000 (14:01 +0800)
committerPeng Huang <shawn.p.huang@gmail.com>
Tue, 20 Apr 2010 06:01:56 +0000 (14:01 +0800)
configure.ac
src/Makefile.am
src/Signal.h

index 78f3167..755df88 100644 (file)
@@ -86,11 +86,21 @@ AC_CHECK_FUNCS([uuid_create], [], [
     ])
 ])
 
-AM_CONDITIONAL(WITH_LIBUUID, test x"$HAVE_LIBUUID" = x"yes")
+AM_CONDITIONAL(HAVE_LIBUUID, test x"$HAVE_LIBUUID" = x"yes")
 
 # check boost
 BOOST_REQUIRE([1.39])
-
+BOOST_FIND_HEADER([boost/signals2.hpp])
+# BOOST_FIND_HEADER([boost/signals2.hpp], [
+#     HAVE_BOOST_SIGNALS2=no
+#     BOOST_SIGNALS([s])
+# ], [
+#     AC_DEFINE(HAVE_BOOST_SIGNALS2_HPP, 1, [Define if found boost.signals2])
+#     HAVE_BOOST_SGINALS2=yes
+# ])
+# 
+# AM_CONDITIONAL(HAVE_BOOST_SIGNALS2, test x"$HAVE_BOOST_SIGNALS2" = x"yes")
+# 
 # check sigc
 # PKG_CHECK_MODULES(SIGC, [
 #     sigc++-2.0
index a936803..ea382ea 100644 (file)
@@ -117,11 +117,21 @@ ibus_engine_pinyin_LDADD = \
        @SQLITE_LIBS@ \
        $(NULL)
 
-if WITH_LIBUUID
+if HAVE_LIBUUID
 ibus_engine_pinyin_CXXFLAGS += $(LIBUUID_CFLAGS)
 ibus_engine_pinyin_LDADD += $(LIBUUID_LIBS)
 endif
 
+# if HAVE_BOOST_SIGNALS2
+# # do nothing
+# else
+# ibus_engine_pinyin_CXXFLAGS += $(LIBUUID_CFLAGS)
+# ibus_engine_pinyin_LDADD += \
+#      $(BOOST_SIGNALS_LDFLAGS) \
+#      $(BOOST_SIGNALS_LIBS) \
+#      $(NULL)
+# endif
+
 BUILT_SOURCES = \
        $(ibus_engine_built_c_sources) \
        $(ibus_engine_built_h_sources) \
index 00b1fef..d195854 100644 (file)
@@ -1,16 +1,31 @@
 #ifndef __PY_SIGNAL_H_
 #define __PY_SIGNAL_H_
 
-#include <boost/signals2.hpp>
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#ifdef HAVE_BOOST_SIGNALS2_HPP
+#  include <boost/signals2.hpp>
+#elif HAVE_BOOST_SIGNALS_HPP
+#  include <boost/signals.hpp>
+#else
+#  error "Can not find boost.signals2 or boost.signal"
+#endif
+
 #include <boost/bind.hpp>
 
 namespace PY {
 
 using boost::bind;
 
+#if HAVE_BOOST_SIGNALS2_HPP
 template <typename Signature>
 struct signal : public boost::signals2::signal_type <Signature, boost::signals2::keywords::mutex_type<boost::signals2::dummy_mutex> >::type {
-};
+    };
+#elif HAVE_BOOST_SIGNALS_HPP
+using boost::signal;
+#endif
 
 };