THRIFT-2098 Add support for Qt5+
diff --git a/lib/cpp/Makefile.am b/lib/cpp/Makefile.am
index 857569a..c95b43d 100755
--- a/lib/cpp/Makefile.am
+++ b/lib/cpp/Makefile.am
@@ -22,6 +22,9 @@
 moc_%.cpp: %.h
 	$(QT_MOC) $(QT_CFLAGS) $< -o $@
 
+moc__%.cpp: %.h
+	$(QT5_MOC) $(QT5_CFLAGS) $< -o $@
+
 SUBDIRS = .
 
 if WITH_TESTS
@@ -48,6 +51,10 @@
 lib_LTLIBRARIES += libthriftqt.la
 pkgconfig_DATA += thrift-qt.pc
 endif
+if AMX_HAVE_QT5
+lib_LTLIBRARIES += libthriftqt5.la
+pkgconfig_DATA += thrift-qt5.pc
+endif
 
 AM_CXXFLAGS = -Wall -Wextra -pedantic
 AM_CPPFLAGS = $(BOOST_CPPFLAGS) $(OPENSSL_INCLUDES) -I$(srcdir)/src
@@ -112,16 +119,28 @@
                          src/thrift/qt/TQTcpServer.cpp
 CLEANFILES = $(libthriftqt_la_MOC)
 
+libthriftqt5_la_MOC = src/thrift/qt/moc__TQTcpServer.cpp
+libthriftqt5_la_SOURCES = $(libthriftqt5_la_MOC) \
+                         src/thrift/qt/TQIODeviceTransport.cpp \
+                         src/thrift/qt/TQTcpServer.cpp
+CLEANFILES = $(libthriftqt5_la_MOC)
+
 # Flags for the various libraries
 libthriftnb_la_CPPFLAGS = $(AM_CPPFLAGS) $(LIBEVENT_CPPFLAGS)
 libthriftz_la_CPPFLAGS  = $(AM_CPPFLAGS) $(ZLIB_CPPFLAGS)
 libthriftqt_la_CPPFLAGS = $(AM_CPPFLAGS) $(QT_CFLAGS)
+libthriftqt5_la_CPPFLAGS = $(AM_CPPFLAGS) $(QT5_CFLAGS)
+if QT5_REDUCE_RELOCATIONS
+libthriftqt5_la_CPPFLAGS += -fPIC
+endif
 libthriftnb_la_CXXFLAGS = $(AM_CXXFLAGS)
 libthriftz_la_CXXFLAGS  = $(AM_CXXFLAGS)
 libthriftqt_la_CXXFLAGS  = $(AM_CXXFLAGS)
+libthriftqt5_la_CXXFLAGS  = $(AM_CXXFLAGS)
 libthriftnb_la_LDFLAGS  = -release $(VERSION) $(BOOST_LDFLAGS)
 libthriftz_la_LDFLAGS   = -release $(VERSION) $(BOOST_LDFLAGS)
 libthriftqt_la_LDFLAGS   = -release $(VERSION) $(BOOST_LDFLAGS) $(QT_LIBS)
+libthriftqt5_la_LDFLAGS   = -release $(VERSION) $(BOOST_LDFLAGS) $(QT5_LIBS)
 
 include_thriftdir = $(includedir)/thrift
 include_thrift_HEADERS = \
@@ -242,6 +261,7 @@
              thrift.pc.in \
              thrift-z.pc.in \
              thrift-qt.pc.in \
+             thrift-qt5.pc.in \
              $(WINDOWS_DIST)
 
 style-local: