b1346ee
diff -ur vfrnav/src/geomavx.cc vfrnav/src/geomavx.cc
b1346ee
--- vfrnav/src/geomavx.cc	2016-03-21 22:27:17.000000000 +0100
b1346ee
+++ vfrnav/src/geomavx.cc	2016-03-22 02:19:20.836678670 +0100
b1346ee
@@ -24,10 +24,6 @@
b1346ee
 #include <boost/multiprecision/cpp_int.hpp>
b1346ee
 #endif
b1346ee
 
b1346ee
-#ifdef __AVX__
b1346ee
-#include <immintrin.h>
b1346ee
-#endif
b1346ee
-
b1346ee
 #include <sstream>
b1346ee
 #include <iomanip>
b1346ee
 
b1346ee
diff -ur vfrnav/src/geom.h vfrnav/src/geom.h
b1346ee
--- vfrnav/src/geom.h	2016-03-21 22:27:17.000000000 +0100
b1346ee
+++ vfrnav/src/geom.h	2016-03-22 02:19:23.956632290 +0100
b1346ee
@@ -21,6 +21,10 @@
b1346ee
 #include <glibmm.h>
b1346ee
 #include <interval.hh>
b1346ee
 
b1346ee
+#ifdef __AVX__
b1346ee
+#include <immintrin.h>
b1346ee
+#endif
b1346ee
+
b1346ee
 #include "sysdeps.h"
b1346ee
 #include "alignedalloc.h"
b1346ee
 
b1346ee
diff -ur vfrnav/src/Navigate.cc vfrnav/src/Navigate.cc
b1346ee
--- vfrnav/src/Navigate.cc	2016-03-21 22:27:17.000000000 +0100
b1346ee
+++ vfrnav/src/Navigate.cc	2016-03-22 02:19:27.748575921 +0100
b1346ee
@@ -4,7 +4,7 @@
b1346ee
 // Description: Navigation Mode Windows
b1346ee
 //
b1346ee
 //
b1346ee
-// Author: Thomas Sailer <t.sailer@alumni.ethz.ch>, (C) 2007, 2009, 2011, 2012
b1346ee
+// Author: Thomas Sailer <t.sailer@alumni.ethz.ch>, (C) 2007, 2009, 2011, 2012, 2016
b1346ee
 //
b1346ee
 // Copyright: See COPYING file that comes with this distribution
b1346ee
 //
b1346ee
@@ -181,7 +181,7 @@
b1346ee
         return SVVector();
b1346ee
 }
b1346ee
 
b1346ee
-#ifdef HAVE_LIBLOCATION
b1346ee
+#if defined(HAVE_LIBLOCATION)
b1346ee
 
b1346ee
 class Navigate::GPSCommGPSD : public Navigate::GPSComm {
b1346ee
         private:
b1346ee
@@ -946,9 +946,13 @@
b1346ee
 
b1346ee
 #elif defined(HAVE_LIBGPS)
b1346ee
 
b1346ee
+#if GPSD_API_MAJOR_VERSION >= 5
b1346ee
+#define gps_open_r gps_open
b1346ee
+#endif
b1346ee
+
b1346ee
 class Navigate::GPSCommGPSD : public Navigate::GPSComm {
b1346ee
         private:
b1346ee
-                GPSCommGPSD(struct gps_data_t *gd);
b1346ee
+                GPSCommGPSD(struct gps_data_t& gd);
b1346ee
                 virtual ~GPSCommGPSD();
b1346ee
 
b1346ee
         public:
b1346ee
@@ -978,23 +982,27 @@
b1346ee
                 virtual SVVector get_svvector(void) const;
b1346ee
 
b1346ee
         private:
b1346ee
-                struct gps_data_t *m_gpsdata;
b1346ee
+                struct gps_data_t m_gpsdata;
b1346ee
+                sigc::connection m_gpssigioconn;
b1346ee
+#if GPSD_API_MAJOR_VERSION < 5
b1346ee
                 typedef std::map<struct gps_data_t *, GPSCommGPSD *> gpsmap_t;
b1346ee
                 static gpsmap_t m_gpsmap;
b1346ee
-                sigc::connection m_gpssigioconn;
b1346ee
 
b1346ee
                 static void gps_hook(struct gps_data_t *, char *, size_t, int);
b1346ee
+#endif
b1346ee
                 bool gps_poll(Glib::IOCondition iocond);
b1346ee
                 void update_gps(void);
b1346ee
                 void gps_send(const std::string& s);
b1346ee
 };
b1346ee
 
b1346ee
+#if GPSD_API_MAJOR_VERSION < 5
b1346ee
 Navigate::GPSCommGPSD::gpsmap_t Navigate::GPSCommGPSD::m_gpsmap;
b1346ee
+#endif
b1346ee
 
b1346ee
 Navigate::GPSCommGPSD *Navigate::GPSCommGPSD::create( const Glib::ustring & server, const Glib::ustring & port )
b1346ee
 {
b1346ee
-        struct gps_data_t *gpsdata = gps_open(server.c_str(), port.c_str());
b1346ee
-        if (!gpsdata) {
b1346ee
+	struct gps_data_t gpsdata;
b1346ee
+	if (gps_open_r(server.c_str(), port.c_str(), &gpsdata)) {
b1346ee
                 std::cerr << "open_gps: error opening GPS" << std::endl;
b1346ee
                 return 0;
b1346ee
         }
b1346ee
@@ -1002,32 +1010,36 @@
b1346ee
         return ngps;
b1346ee
 }
b1346ee
 
b1346ee
-Navigate::GPSCommGPSD::GPSCommGPSD( struct gps_data_t * gd )
b1346ee
+Navigate::GPSCommGPSD::GPSCommGPSD(struct gps_data_t& gd)
b1346ee
         : m_gpsdata(gd)
b1346ee
 {
b1346ee
-        m_gpsmap[m_gpsdata] = this;
b1346ee
+#if GPSD_API_MAJOR_VERSION < 5
b1346ee
+        m_gpsmap[&m_gpsdata] = this;
b1346ee
         gps_set_raw_hook(m_gpsdata, gps_hook);
b1346ee
-        m_gpssigioconn = Glib::signal_io().connect(sigc::mem_fun(*this, &Navigate::GPSCommGPSD::gps_poll), m_gpsdata->gps_fd, Glib::IO_IN);
b1346ee
+#endif
b1346ee
+        m_gpssigioconn = Glib::signal_io().connect(sigc::mem_fun(*this, &Navigate::GPSCommGPSD::gps_poll), m_gpsdata.gps_fd, Glib::IO_IN);
b1346ee
         gps_send("w1\n");
b1346ee
 }
b1346ee
 
b1346ee
 Navigate::GPSCommGPSD::~GPSCommGPSD( )
b1346ee
 {
b1346ee
         m_gpssigioconn.disconnect();
b1346ee
-        gpsmap_t::iterator i(m_gpsmap.find(m_gpsdata));
b1346ee
+ #if GPSD_API_MAJOR_VERSION < 5
b1346ee
+       gpsmap_t::iterator i(m_gpsmap.find(m_gpsdata));
b1346ee
         if (i != m_gpsmap.end())
b1346ee
                 m_gpsmap.erase(i);
b1346ee
-        gps_close(m_gpsdata);
b1346ee
-        m_gpsdata = 0;
b1346ee
+#endif
b1346ee
+        gps_close(&m_gpsdata);
b1346ee
 }
b1346ee
 
b1346ee
 void Navigate::GPSCommGPSD::gps_send(const std::string& s)
b1346ee
 {
b1346ee
-        int r = write(m_gpsdata->gps_fd, s.c_str(), s.size());
b1346ee
+        int r = write(m_gpsdata.gps_fd, s.c_str(), s.size());
b1346ee
         if (r != s.size())
b1346ee
                 std::cerr << "gps_send: error " << r << std::endl;
b1346ee
 }
b1346ee
 
b1346ee
+#if GPSD_API_MAJOR_VERSION < 5
b1346ee
 void Navigate::GPSCommGPSD::gps_hook( struct gps_data_t *p, char *, size_t, int )
b1346ee
 {
b1346ee
         gpsmap_t::iterator i(m_gpsmap.find(p));
b1346ee
@@ -1036,13 +1048,19 @@
b1346ee
                 return;
b1346ee
         }
b1346ee
 }
b1346ee
+#endif
b1346ee
 
b1346ee
 bool Navigate::GPSCommGPSD::gps_poll(Glib::IOCondition iocond)
b1346ee
 {
b1346ee
         if (!(iocond & Glib::IO_IN))
b1346ee
                 return true;
b1346ee
+#if GPSD_API_MAJOR_VERSION >= 5
b1346ee
+	if (gps_read(&m_gpsdata) >= 0)
b1346ee
+		update_gps();
b1346ee
+#else
b1346ee
         ::gps_poll(m_gpsdata);
b1346ee
-        std::cerr << "status " << m_gpsdata->status << " fixtype " << m_gpsdata->fix.mode << std::endl;
b1346ee
+#endif
b1346ee
+        std::cerr << "status " << m_gpsdata.status << " fixtype " << m_gpsdata.fix.mode << std::endl;
b1346ee
         return true;
b1346ee
 }
b1346ee
 
b1346ee
@@ -1053,7 +1071,7 @@
b1346ee
 
b1346ee
 Navigate::GPSCommGPSD::fixtype_t Navigate::GPSCommGPSD::get_fixtype(void) const
b1346ee
 {
b1346ee
-        switch (m_gpsdata->fix.mode) {
b1346ee
+        switch (m_gpsdata.fix.mode) {
b1346ee
                 default:
b1346ee
                 case MODE_NOT_SEEN:
b1346ee
                         return fixtype_noconn;
b1346ee
@@ -1071,7 +1089,7 @@
b1346ee
 
b1346ee
 Navigate::GPSCommGPSD::fixstatus_t Navigate::GPSCommGPSD::get_fixstatus(void) const
b1346ee
 {
b1346ee
-        switch (m_gpsdata->status) {
b1346ee
+        switch (m_gpsdata.status) {
b1346ee
                 default:
b1346ee
                 case STATUS_NO_FIX:
b1346ee
                         return fixstatus_nofix;
b1346ee
@@ -1079,119 +1097,170 @@
b1346ee
                 case STATUS_FIX:
b1346ee
                         return fixstatus_fix;
b1346ee
 
b1346ee
+#if GPSD_API_MAJOR_VERSION < 6
b1346ee
                 case STATUS_DGPS_FIX:
b1346ee
                         return fixstatus_dgpsfix;
b1346ee
+#endif
b1346ee
         }
b1346ee
 }
b1346ee
 
b1346ee
 double Navigate::GPSCommGPSD::get_fixtime(void) const
b1346ee
 {
b1346ee
-        return m_gpsdata->fix.time;
b1346ee
+        return m_gpsdata.fix.time;
b1346ee
 }
b1346ee
 
b1346ee
 Point Navigate::GPSCommGPSD::get_coord(void) const
b1346ee
 {
b1346ee
-        return Point((int32_t)(m_gpsdata->fix.longitude * Point::from_deg),
b1346ee
-                     (int32_t)(m_gpsdata->fix.latitude * Point::from_deg));
b1346ee
+        return Point((int32_t)(m_gpsdata.fix.longitude * Point::from_deg),
b1346ee
+                     (int32_t)(m_gpsdata.fix.latitude * Point::from_deg));
b1346ee
 }
b1346ee
 
b1346ee
 float Navigate::GPSCommGPSD::get_coord_uncertainty(void) const
b1346ee
 {
b1346ee
-        return m_gpsdata->fix.ept;
b1346ee
+        return m_gpsdata.fix.ept;
b1346ee
 }
b1346ee
 
b1346ee
 bool Navigate::GPSCommGPSD::is_coord_valid(void) const
b1346ee
 {
b1346ee
-        return Navigate::GPSComm::is_coord_valid() && (!std::isnan(m_gpsdata->fix.longitude)) && (!std::isnan(m_gpsdata->fix.latitude));
b1346ee
+        return Navigate::GPSComm::is_coord_valid() && (!std::isnan(m_gpsdata.fix.longitude)) && (!std::isnan(m_gpsdata.fix.latitude));
b1346ee
 }
b1346ee
 
b1346ee
 float Navigate::GPSCommGPSD::get_altitude(void) const
b1346ee
 {
b1346ee
-        return m_gpsdata->fix.altitude;
b1346ee
+        return m_gpsdata.fix.altitude;
b1346ee
 }
b1346ee
 
b1346ee
 float Navigate::GPSCommGPSD::get_altitude_uncertainty(void) const
b1346ee
 {
b1346ee
-        return m_gpsdata->fix.epv;
b1346ee
+        return m_gpsdata.fix.epv;
b1346ee
 }
b1346ee
 
b1346ee
 bool Navigate::GPSCommGPSD::is_altitude_valid(void) const
b1346ee
 {
b1346ee
-        return Navigate::GPSComm::is_altitude_valid() && !std::isnan(m_gpsdata->fix.altitude);
b1346ee
+        return Navigate::GPSComm::is_altitude_valid() && !std::isnan(m_gpsdata.fix.altitude);
b1346ee
 }
b1346ee
 
b1346ee
 float Navigate::GPSCommGPSD::get_track(void) const
b1346ee
 {
b1346ee
-        return m_gpsdata->fix.track;
b1346ee
+        return m_gpsdata.fix.track;
b1346ee
 }
b1346ee
 
b1346ee
 float Navigate::GPSCommGPSD::get_track_uncertainty(void) const
b1346ee
 {
b1346ee
-        return m_gpsdata->fix.epd;
b1346ee
+        return m_gpsdata.fix.epd;
b1346ee
 }
b1346ee
 
b1346ee
 float Navigate::GPSCommGPSD::get_velocity(void) const
b1346ee
 {
b1346ee
-        return m_gpsdata->fix.speed;
b1346ee
+        return m_gpsdata.fix.speed;
b1346ee
 }
b1346ee
 
b1346ee
 float Navigate::GPSCommGPSD::get_velocity_uncertainty(void) const
b1346ee
 {
b1346ee
-        return m_gpsdata->fix.eps;
b1346ee
+        return m_gpsdata.fix.eps;
b1346ee
 }
b1346ee
 
b1346ee
 float Navigate::GPSCommGPSD::get_verticalvelocity(void) const
b1346ee
 {
b1346ee
-        return m_gpsdata->fix.climb;
b1346ee
+        return m_gpsdata.fix.climb;
b1346ee
 }
b1346ee
 
b1346ee
 float Navigate::GPSCommGPSD::get_verticalvelocity_uncertainty(void) const
b1346ee
 {
b1346ee
-        return m_gpsdata->fix.epc;
b1346ee
+        return m_gpsdata.fix.epc;
b1346ee
 }
b1346ee
 
b1346ee
 float Navigate::GPSCommGPSD::get_pdop(void) const
b1346ee
 {
b1346ee
-        return m_gpsdata->pdop;
b1346ee
+#if GPSD_API_MAJOR_VERSION < 6
b1346ee
+        return m_gpsdata.pdop;
b1346ee
+#else
b1346ee
+        return m_gpsdata.dop.pdop;
b1346ee
+#endif
b1346ee
 }
b1346ee
 
b1346ee
 float Navigate::GPSCommGPSD::get_hdop(void) const
b1346ee
 {
b1346ee
-        return m_gpsdata->hdop;
b1346ee
+#if GPSD_API_MAJOR_VERSION < 6
b1346ee
+        return m_gpsdata.hdop;
b1346ee
+#else
b1346ee
+        return m_gpsdata.dop.pdop;
b1346ee
+#endif
b1346ee
 }
b1346ee
 
b1346ee
 float Navigate::GPSCommGPSD::get_vdop(void) const
b1346ee
 {
b1346ee
-        return m_gpsdata->vdop;
b1346ee
+#if GPSD_API_MAJOR_VERSION < 6
b1346ee
+        return m_gpsdata.vdop;
b1346ee
+#else
b1346ee
+        return m_gpsdata.dop.vdop;
b1346ee
+#endif
b1346ee
 }
b1346ee
 
b1346ee
 float Navigate::GPSCommGPSD::get_tdop(void) const
b1346ee
 {
b1346ee
-        return m_gpsdata->tdop;
b1346ee
+#if GPSD_API_MAJOR_VERSION < 6
b1346ee
+        return m_gpsdata.tdop;
b1346ee
+#else
b1346ee
+        return m_gpsdata.dop.tdop;
b1346ee
+#endif
b1346ee
 }
b1346ee
 
b1346ee
 float Navigate::GPSCommGPSD::get_gdop(void) const
b1346ee
 {
b1346ee
-        return m_gpsdata->gdop;
b1346ee
+#if GPSD_API_MAJOR_VERSION < 6
b1346ee
+        return m_gpsdata.gdop;
b1346ee
+#else
b1346ee
+        return m_gpsdata.dop.gdop;
b1346ee
+#endif
b1346ee
 }
b1346ee
 
b1346ee
 unsigned int Navigate::GPSCommGPSD::get_nrsv(void) const
b1346ee
 {
b1346ee
-        return m_gpsdata->satellites;
b1346ee
+	if (!(m_gpsdata.set & SATELLITE_SET))
b1346ee
+		return 0;
b1346ee
+        return m_gpsdata.satellites_visible;
b1346ee
 }
b1346ee
 
b1346ee
 Navigate::GPSCommGPSD::SV Navigate::GPSCommGPSD::get_sv( unsigned int idx ) const
b1346ee
 {
b1346ee
-        if (idx >= (unsigned int)m_gpsdata->satellites)
b1346ee
-                return SV();
b1346ee
-        return SV(m_gpsdata->PRN[idx], m_gpsdata->azimuth[idx], m_gpsdata->elevation[idx], m_gpsdata->ss[idx], !!m_gpsdata->used[idx]);
b1346ee
+	if (!(m_gpsdata.set & SATELLITE_SET))
b1346ee
+		return SV();
b1346ee
+        if (idx >= (unsigned int)m_gpsdata.satellites_visible)
b1346ee
+		return SV();
b1346ee
+#if GPSD_API_MAJOR_VERSION >= 6
b1346ee
+	std::set<int> satused;
b1346ee
+	for (int i = 0; i < m_gpsdata.satellites_used; ++i)
b1346ee
+		satused.insert(m_gpsdata.skyview[i].used);
b1346ee
+	return SV(m_gpsdata.skyview[idx].PRN, m_gpsdata.skyview[idx].azimuth, m_gpsdata.skyview[idx].elevation,
b1346ee
+		  m_gpsdata.skyview[idx].ss, satused.find(m_gpsdata.skyview[idx].PRN) != satused.end());
b1346ee
+#else
b1346ee
+	std::set<int> satused;
b1346ee
+	for (int i = 0; i < m_gpsdata.satellites_used; ++i)
b1346ee
+		satused.insert(m_gpsdata.used[i]);
b1346ee
+        return SV(m_gpsdata.PRN[idx], m_gpsdata.azimuth[idx], m_gpsdata.elevation[idx],
b1346ee
+		  m_gpsdata.ss[idx], satused.find(m_gpsdata.PRN[idx]) != satused.end());
b1346ee
+#endif
b1346ee
 }
b1346ee
 
b1346ee
 Navigate::GPSCommGPSD::SVVector Navigate::GPSCommGPSD::get_svvector(void) const
b1346ee
 {
b1346ee
         SVVector v;
b1346ee
-        for (int i = 0; i < m_gpsdata->satellites; i++)
b1346ee
-                v.push_back(SV(m_gpsdata->PRN[i], m_gpsdata->azimuth[i], m_gpsdata->elevation[i], m_gpsdata->ss[i], !!m_gpsdata->used[i]));
b1346ee
+#if GPSD_API_MAJOR_VERSION >= 6
b1346ee
+	std::set<int> satused;
b1346ee
+	for (int i = 0; i < m_gpsdata.satellites_used; ++i)
b1346ee
+		satused.insert(m_gpsdata.skyview[i].used);
b1346ee
+        for (int i = 0; i < m_gpsdata.satellites_visible; ++i)
b1346ee
+                v.push_back(SV(m_gpsdata.skyview[i].PRN, m_gpsdata.skyview[i].azimuth, m_gpsdata.skyview[i].elevation,
b1346ee
+			       m_gpsdata.skyview[i].ss, satused.find(m_gpsdata.skyview[i].PRN) != satused.end()));
b1346ee
+#else
b1346ee
+	std::set<int> satused;
b1346ee
+	for (int i = 0; i < m_gpsdata.satellites_used; ++i)
b1346ee
+		satused.insert(m_gpsdata.used[i]);
b1346ee
+        for (int i = 0; i < m_gpsdata.satellites_visible; ++i)
b1346ee
+                v.push_back(SV(m_gpsdata.PRN[i], m_gpsdata.azimuth[i], m_gpsdata.elevation[i],
b1346ee
+			       m_gpsdata.ss[i], satused.find(m_gpsdata.PRN[idx]) != satused.end()));
b1346ee
+#endif
b1346ee
         return v;
b1346ee
 }
b1346ee
 
b1346ee
diff -ur vfrnav/src/ssetest.cc vfrnav/src/ssetest.cc
b1346ee
--- vfrnav/src/ssetest.cc	2016-03-21 22:27:17.000000000 +0100
b1346ee
+++ vfrnav/src/ssetest.cc	2016-03-22 02:19:15.836752996 +0100
b1346ee
@@ -29,10 +29,6 @@
b1346ee
 #include <sys/time.h>
b1346ee
 #include <stdlib.h>
b1346ee
 
b1346ee
-#ifdef __AVX__
b1346ee
-#include <immintrin.h>
b1346ee
-#endif
b1346ee
-
b1346ee
 typedef std::pair<int64_t,int64_t> tpoint_t;
b1346ee
 
b1346ee
 static tpoint_t transform1(const Point& pt, const Point& porigin, const Point& pvec)
b1346ee
diff -ur vfrnav/vfrnav.spec.in vfrnav/vfrnav.spec.in
b1346ee
--- vfrnav/vfrnav.spec.in	2016-03-21 23:20:49.000000000 +0100
b1346ee
+++ vfrnav/vfrnav.spec.in	2016-03-21 23:27:35.547023953 +0100
b1346ee
@@ -282,7 +282,8 @@
b1346ee
 
b1346ee
 %files
b1346ee
 %defattr(-,root,root,-)
b1346ee
-%doc AUTHORS ChangeLog COPYING INSTALL NEWS README TODO doc/flightdeck.pdf
b1346ee
+%license COPYING
b1346ee
+%doc AUTHORS ChangeLog INSTALL NEWS README TODO doc/flightdeck.pdf
b1346ee
 %{_datadir}/applications/vfrnav.desktop
b1346ee
 %{_datadir}/applications/flightdeck.desktop
b1346ee
 %{_datadir}/applications/vfrairporteditor.desktop
5378b21
Index: flightdeck/sensgeoclue2.cc
5378b21
===================================================================
5378b21
--- vfrnav/flightdeck/sensgeoclue2.cc	(revision 244)
5378b21
+++ vfrnav/flightdeck/sensgeoclue2.cc	(working copy)
5378b21
@@ -12,7 +12,6 @@
5378b21
 
5378b21
 #include <limits>
5378b21
 #include <iomanip>
5378b21
-#include <geoclue/geoclue-master.h>
5378b21
 #include <glibmm/datetime.h>
5378b21
 
5378b21
 #include "sensgeoclue2.h"