summaryrefslogtreecommitdiff
blob: aa7e4a5c812c7605eac280862ce6bec24befbb0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
diff -rupN avahi-0.6.31/avahi-qt/Makefile.am avahi-qt5/avahi-qt/Makefile.am
--- avahi-0.6.31/avahi-qt/Makefile.am	2010-08-25 19:51:39.011153001 -0500
+++ avahi-qt5/avahi-qt/Makefile.am	2014-10-19 13:55:14.825086832 -0500
@@ -65,4 +65,26 @@ libavahi_qt4_la_LIBADD = $(AM_LDADD) ../
 libavahi_qt4_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LIBAVAHI_QT4_VERSION_INFO)
 endif
 
+if HAVE_QT5
+
+avahiqt5includedir=$(includedir)/avahi-qt5
+avahiqt5include_HEADERS = \
+	qt-watch.h
+
+lib_LTLIBRARIES += \
+	libavahi-qt5.la
+
+BUILT_SOURCES += qt-watch.moc5
+
+libavahi_qt5_la_SOURCES = \
+	qt-watch.cpp
+
+qt-watch.moc5: qt-watch.cpp
+	$(AM_V_GEN)$(MOC_QT5) $^ > $@
+
+libavahi_qt5_la_CPPFLAGS = $(AM_CFLAGS) --std=gnu++11 $(QT5_CFLAGS) -DQT5 $(VISIBILITY_HIDDEN_CFLAGS)
+libavahi_qt5_la_LIBADD = $(AM_LDADD) ../avahi-common/libavahi-common.la $(QT5_LIBS)
+libavahi_qt5_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LIBAVAHI_QT5_VERSION_INFO)
+endif
+
 CLEANFILES = $(BUILT_SOURCES)
diff -rupN avahi-0.6.31/avahi-qt/qt-watch.cpp avahi-qt5/avahi-qt/qt-watch.cpp
--- avahi-0.6.31/avahi-qt/qt-watch.cpp	2010-08-25 19:51:39.011153001 -0500
+++ avahi-qt5/avahi-qt/qt-watch.cpp	2014-10-19 13:56:14.076226518 -0500
@@ -18,10 +18,10 @@
 ***/
 
 #include <sys/time.h>
-#ifdef QT4
-#include <Qt/qsocketnotifier.h>
-#include <Qt/qobject.h>
-#include <Qt/qtimer.h>
+#if defined(QT5) || defined(QT4)
+#include <QSocketNotifier>
+#include <QObject>
+#include <QTimer>
 #else
 #include <qsocketnotifier.h>
 #include <qobject.h>
@@ -114,7 +114,7 @@ AvahiTimeout::AvahiTimeout(const struct
     m_callback(callback), m_userdata(userdata)
 {
     connect(&m_timer, SIGNAL(timeout()), this, SLOT(timeout()));
-#ifdef QT4
+#if defined(QT5) || defined(QT4)
     m_timer.setSingleShot(true);
 #endif
     update(tv);
@@ -125,7 +125,7 @@ void AvahiTimeout::update(const struct t
     m_timer.stop();
     if (tv) {
     AvahiUsec u = avahi_age(tv)/1000;
-#ifdef QT4
+#if defined(QT5) || defined(QT4)
     m_timer.start( (u>0) ? 0 : -u);
 #else
     m_timer.start( (u>0) ? 0 : -u,true);
@@ -191,8 +191,10 @@ const AvahiPoll* avahi_qt_poll_get(void)
     return &qt_poll;
 }
 
-#ifdef QT4
+#if defined(QT5)
+#include "qt-watch.moc5"
+#elif defined(QT4)
 #include "qt-watch.moc4"
-#else
+#elif defined(QT3)
 #include "qt-watch.moc3"
 #endif
diff -rupN avahi-0.6.31/avahi-qt5.pc.in avahi-qt5/avahi-qt5.pc.in
--- avahi-0.6.31/avahi-qt5.pc.in	1969-12-31 18:00:00.000000000 -0600
+++ avahi-qt5/avahi-qt5.pc.in	2014-10-19 13:55:14.825086832 -0500
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=@libdir@
+includedir=${prefix}/include
+
+Name: avahi-qt5
+Description: Avahi Multicast DNS Responder (QT5 Support)
+Version: @PACKAGE_VERSION@
+Requires: Qt5Core >= 5.0.0
+Libs: -L${libdir} -lavahi-qt5
+Cflags: -D_REENTRANT -I${includedir}
diff -rupN avahi-0.6.31/configure.ac avahi-qt5/configure.ac
--- avahi-0.6.31/configure.ac	2012-02-14 15:44:25.484742099 -0600
+++ avahi-qt5/configure.ac	2014-10-19 13:55:14.825086832 -0500
@@ -34,6 +34,7 @@ AC_SUBST(LIBAVAHI_GLIB_VERSION_INFO, [1:
 AC_SUBST(LIBAVAHI_GOBJECT_VERSION_INFO, [0:4:0])
 AC_SUBST(LIBAVAHI_QT3_VERSION_INFO, [1:2:0])
 AC_SUBST(LIBAVAHI_QT4_VERSION_INFO, [1:2:0])
+AC_SUBST(LIBAVAHI_QT5_VERSION_INFO, [1:2:0])
 AC_SUBST(LIBAVAHI_UI_VERSION_INFO, [1:4:1])
 
 # Do not touch these, since they we took this version-info from upstream HOWL/Bonjour
@@ -525,6 +526,31 @@ fi
 AM_CONDITIONAL(HAVE_QT4, test "x$HAVE_QT4" = "xyes")
 
 #
+# Check for Qt 5
+#
+AC_ARG_ENABLE(qt5,
+        AS_HELP_STRING([--disable-qt5],[Disable building of Qt5Core mainloop integration]),
+        [case "${enableval}" in
+                yes) HAVE_QT5=yes ;;
+                no)  HAVE_QT5=no ;;
+                *) AC_MSG_ERROR(bad value ${enableval} for --enable-qt5) ;;
+        esac],
+        [HAVE_QT5=yes])
+
+if test "x$HAVE_QT5" = "xyes" ; then
+        PKG_CHECK_MODULES( QT5, [ Qt5Core >= 5.0.0 ])
+        AC_SUBST(QT5_CFLAGS)
+        AC_SUBST(QT5_LIBS)
+        QT5_PREFIX="`$PKG_CONFIG --variable=host_bins Qt5Core`"
+        AC_PATH_PROGS(MOC_QT5, [moc-qt5 moc], no, [$QT5_PREFIX])
+        if test "$MOC_QT5" = no; then
+            AC_MSG_ERROR([Could not find QT5 moc])
+        fi
+        AC_SUBST(MOC_QT5)
+fi
+AM_CONDITIONAL(HAVE_QT5, test "x$HAVE_QT5" = "xyes")
+
+#
 # Check for GTK+ 2.0
 #
 AC_ARG_ENABLE(gtk,
@@ -1157,6 +1183,7 @@ echo "
     Enable python-dbus:                        ${HAVE_PYTHON_DBUS}
     Enable QT3:                                ${HAVE_QT3}
     Enable QT4:                                ${HAVE_QT4}
+    Enable QT5:                                ${HAVE_QT5}
     Enable Mono:                               ${HAVE_MONO}
     Enable Monodoc:                            ${HAVE_MONODOC}
     Distribution/OS:                           ${with_distro}
@@ -1226,6 +1253,7 @@ echo "\
     Building avahi-discover-standalone: ${HAVE_GTK2OR3}
     Building libavahi-qt3:              ${HAVE_QT3}
     Building libavahi-qt4:              ${HAVE_QT4}
+    Building libavahi-qt5:              ${HAVE_QT5}
     Building avahi-sharp:               ${HAVE_MONO}
     Building avahi-compat-libdns_sd:    ${ENABLE_COMPAT_LIBDNS_SD}
     Building avahi-compat-howl:         ${ENABLE_COMPAT_HOWL}
diff -rupN avahi-0.6.31/Makefile.am avahi-qt5/Makefile.am
--- avahi-0.6.31/Makefile.am	2011-12-30 15:26:44.925511922 -0600
+++ avahi-qt5/Makefile.am	2014-10-19 13:55:14.825086832 -0500
@@ -43,6 +43,7 @@ EXTRA_DIST = \
 	avahi-gobject.pc.in \
 	avahi-qt3.pc.in \
 	avahi-qt4.pc.in \
+	avahi-qt5.pc.in \
 	avahi-sharp.pc.in \
 	avahi-ui-sharp.pc.in \
 	avahi-compat-libdns_sd.pc.in \
@@ -101,6 +102,10 @@ if HAVE_QT4
 DX_INPUT += \
 	$(srcdir)/avahi-qt/qt-watch.h
 endif
+if HAVE_QT5
+DX_INPUT += \
+	$(srcdir)/avahi-qt/qt-watch.h
+endif
 endif
 
 if HAVE_GLIB
@@ -216,6 +221,11 @@ pkgconfig_DATA += avahi-qt4.pc
 CLEANFILES += avahi-qt4.pc
 endif
 
+if HAVE_QT5
+pkgconfig_DATA += avahi-qt5.pc
+CLEANFILES += avahi-qt5.pc
+endif
+
 CLEANFILES += avahi.devhelp
 
 avahi.devhelp: doxygen-run