From: Jakub Stachowski Date: Mon, 29 Aug 2005 22:35:06 +0000 (+0000) Subject: Include qt mainloop adapter in build system. Moc finding code is cracktastic thanks to X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=4ddfb3cc4ac10efff11fc58693ae2aacf592fb73;p=catta Include qt mainloop adapter in build system. Moc finding code is cracktastic thanks to not providing its location in .pc file and debian that renames it to moc-qt3 and moc-qt4 git-svn-id: file:///home/lennart/svn/public/avahi/trunk@495 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- diff --git a/Makefile.am b/Makefile.am index fd19300..f22fa04 100644 --- a/Makefile.am +++ b/Makefile.am @@ -46,6 +46,7 @@ SUBDIRS = \ avahi-glib \ avahi-core \ avahi-discover-standalone \ + avahi-qt \ avahi-client \ avahi-daemon \ initscript \ diff --git a/avahi-qt/Makefile.am b/avahi-qt/Makefile.am new file mode 100644 index 0000000..ebf454c --- /dev/null +++ b/avahi-qt/Makefile.am @@ -0,0 +1,53 @@ +AM_CFLAGS=-I$(top_srcdir) + +avahiincludedir=$(includedir)/avahi-qt + +lib_LTLIBRARIES = +BUILT_SOURCES = + +if HAVE_QT3 + +avahiinclude_HEADERS = \ + qt-watch.h + +lib_LTLIBRARIES += \ + libavahi-qt3.la + +BUILT_SOURCES += qt-watch.moc3 + +libavahi_qt3_la_SOURCES = \ + qt-watch.cpp + +qt-watch.moc3: + $(MOC_QT3) qt-watch.cpp > $@ + + +libavahi_qt3_la_CPPFLAGS = $(AM_CFLAGS) $(QT3_CFLAGS) +libavahi_qt3_la_LIBADD = $(AM_LDADD) ../avahi-common/libavahi-common.la $(QT3_LIBS) +libavahi_qt3_la_LDFLAGS = $(AM_LDFLAGS) -export-dynamic -version-info 0:1:0 + +endif + + +if HAVE_QT4 + +avahiinclude_HEADERS = \ + qt-watch.h + +lib_LTLIBRARIES += \ + libavahi-qt4.la + +BUILT_SOURCES += qt-watch.moc4 + +libavahi_qt4_la_SOURCES = \ + qt-watch.cpp + +qt-watch.moc4: + $(MOC_QT4) qt-watch.cpp > $@ + + +libavahi_qt4_la_CPPFLAGS = $(AM_CFLAGS) $(QT4_CFLAGS) -DQT4 +libavahi_qt4_la_LIBADD = $(AM_LDADD) ../avahi-common/libavahi-common.la $(QT4_LIBS) +libavahi_qt4_la_LDFLAGS = $(AM_LDFLAGS) -export-dynamic -version-info 0:1:0 + +endif \ No newline at end of file diff --git a/avahi-qt/qt-watch.cpp b/avahi-qt/qt-watch.cpp index 407a905..c5052fd 100644 --- a/avahi-qt/qt-watch.cpp +++ b/avahi-qt/qt-watch.cpp @@ -170,7 +170,7 @@ static void q_timeout_free(AvahiTimeout *t) static AvahiPoll qt_poll; -const AvahiPoll* avahi_qt_poll_get() +const AvahiPoll* avahi_qt_poll_get(void) { qt_poll.userdata=0; qt_poll.watch_new = q_watch_new; @@ -184,4 +184,8 @@ const AvahiPoll* avahi_qt_poll_get() return &qt_poll; } -#include "qt-watch.moc" +#ifdef QT4 +#include "qt-watch.moc4" +#else +#include "qt-watch.moc3" +#endif diff --git a/avahi-qt/qt-watch.h b/avahi-qt/qt-watch.h index 05b5010..bbcf30c 100644 --- a/avahi-qt/qt-watch.h +++ b/avahi-qt/qt-watch.h @@ -29,7 +29,7 @@ AVAHI_C_DECL_BEGIN /** Setup abstract poll structure for integration with Qt main loop */ -const AvahiPoll* avahi_qt_poll_get(); +const AvahiPoll* avahi_qt_poll_get(void); #ifndef DOXYGEN_SHOULD_SKIP_THIS AVAHI_C_DECL_END diff --git a/configure.ac b/configure.ac index 0525ffb..32364af 100644 --- a/configure.ac +++ b/configure.ac @@ -169,6 +169,59 @@ if test "x$HAVE_GLIB" = "xyes" ; then fi AM_CONDITIONAL(HAVE_GLIB, test "x$HAVE_GLIB" = "xyes") +# +# Check for Qt 3 +# +AC_ARG_ENABLE(qt3, + AS_HELP_STRING([--disable-qt3],[Disable building of Qt3 mainloop integration]), + [case "${enableval}" in + yes) HAVE_QT3=yes ;; + no) HAVE_QT3=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-qt3) ;; + esac], + [HAVE_QT3=yes]) + +if test "x$HAVE_QT3" = "xyes" ; then + PKG_CHECK_MODULES( QT3, [ qt-mt >= 3.0.0 ], [ + AC_SUBST(QT3_CFLAGS) + AC_SUBST(QT3_LIBS) + QT3_PREFIX="`$PKG_CONFIG --variable=prefix qt-mt`/bin" + MOC_QT3="no" + AC_CHECK_FILE( "$QT3_PREFIX/moc-qt3", [ MOC_QT3=$QT3_PREFIX/moc-qt3 ], [ + AC_CHECK_FILE("$QT3_PREFIX/moc", [ MOC_QT3=$QT3_PREFIX/moc ], [ HAVE_QT3=no ] ) + ] ) + AC_SUBST(MOC_QT3) + ], [ HAVE_QT3=no ] ) +fi +AM_CONDITIONAL(HAVE_QT3, test "x$HAVE_QT3" = "xyes") + +# +# Check for Qt 4 +# +AC_ARG_ENABLE(qt4, + AS_HELP_STRING([--disable-qt4],[Disable building of Qt4Core mainloop integration]), + [case "${enableval}" in + yes) HAVE_QT4=yes ;; + no) HAVE_QT4=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-qt4) ;; + esac], + [HAVE_QT4=yes]) + +if test "x$HAVE_QT4" = "xyes" ; then + PKG_CHECK_MODULES( QT4, [ QtCore >= 4.0.0 ], [ + AC_SUBST(QT4_CFLAGS) + AC_SUBST(QT4_LIBS) + QT4_PREFIX="`$PKG_CONFIG --variable=prefix QtCore`/bin" + MOC_QT4="no" + AC_CHECK_FILE( "$QT4_PREFIX/moc-qt4", [ MOC_QT4=$QT4_PREFIX/moc-qt4 ], [ + AC_CHECK_FILE("$QT4_PREFIX/moc", [ MOC_QT4=$QT4_PREFIX/moc ], [ HAVE_QT4=no ] ) + ] ) + AC_SUBST(MOC_QT4) + ], [ HAVE_QT4=no ] ) +fi +AM_CONDITIONAL(HAVE_QT4, test "x$HAVE_QT4" = "xyes") + + # # Check for GTK+ # @@ -375,6 +428,7 @@ Makefile avahi-common/Makefile avahi-core/Makefile avahi-glib/Makefile +avahi-qt/Makefile avahi-daemon/Makefile avahi-daemon/avahi-dbus.conf avahi-discover-standalone/Makefile