1 To cope both with libgps18 and libgps19
2 Index: navit/configure.in
3 ===================================================================
4 --- navit.orig/configure.in 2010-01-06 00:08:44.000000000 +0100
5 +++ navit/configure.in 2010-01-06 00:08:44.000000000 +0100
7 AC_ARG_ENABLE(vehicle-gpsd, [ --disable-vehicle-gpsd disable vehicle type gpsd], vehicle_gpsd=$enableval;vehicle_gpsd_reason="configure parameter")
8 if test "x${vehicle_gpsd}" = xyes
10 - AC_CHECK_HEADER(gps.h, AC_DEFINE([HAVE_LIBGPS],[],Define to 1 if you have the <gps.h> header file.) GPSD_LIBS="-lgps", vehicle_gpsd=no; vehicle_gpsd_reason="no gps.h" )
11 + PKG_CHECK_MODULES([GPSD], [libgps], have_libgps="yes", have_libgps="no")
12 + if test "x$have_libgps" = "xyes"; then
13 + AC_DEFINE([HAVE_LIBGPS],[],Define to 1 if you have libgps.)
14 + PKG_CHECK_MODULES([LIBGPS19], [libgps >= 2.90], have_libgps19="yes", have_libgps19="no")
15 + if test "x$have_libgps19" = "xyes"; then
16 + AC_DEFINE([HAVE_LIBGPS19],[],Define to 1 if you have libgps19.)
19 + vehicle_gpsd=no; vehicle_gpsd_reason="no libgps"
21 +dnl AC_CHECK_HEADER(gps.h, AC_DEFINE([HAVE_LIBGPS],[],Define to 1 if you have the <gps.h> header file.) GPSD_LIBS="-lgps", vehicle_gpsd=no; vehicle_gpsd_reason="no gps.h" )
25 Index: navit/navit/attr_def.h
26 ===================================================================
27 --- navit.orig/navit/attr_def.h 2010-01-06 00:06:16.000000000 +0100
28 +++ navit/navit/attr_def.h 2010-01-06 00:08:44.000000000 +0100
33 +#ifndef HAVE_LIBGPS19
39 Index: navit/navit/vehicle/gpsd/vehicle_gpsd.c
40 ===================================================================
41 --- navit.orig/navit/vehicle/gpsd/vehicle_gpsd.c 2010-01-06 00:06:16.000000000 +0100
42 +++ navit/navit/vehicle/gpsd/vehicle_gpsd.c 2010-01-06 00:08:44.000000000 +0100
45 static struct vehicle_priv {
47 +#ifndef HAVE_LIBGPS19
50 struct callback_list *cbl;
52 struct event_watch *evwatch;
54 static void vehicle_gpsd_io(struct vehicle_priv *priv);
58 +vehicle_gpsd_callback(struct gps_data_t *data, char *buf, size_t len)
60 vehicle_gpsd_callback(struct gps_data_t *data, char *buf, size_t len,
64 char *pos,*nmea_data_buf;
65 int i=0,sats_signal=0;
67 data->set &= ~ALTITUDE_SET;
69 if (data->set & SATELLITE_SET) {
71 + if(data->satellites_visible > 0) {
73 if(data->satellites > 0) {
77 + for( i=0;i<data->satellites_visible;i++) {
79 for( i=0;i<data->satellites;i++) {
86 + if (priv->sats_used != data->satellites_used || priv->sats != data->satellites_visible || priv->sats_signal != sats_signal ) {
88 if (priv->sats_used != data->satellites_used || priv->sats != data->satellites || priv->sats_signal != sats_signal ) {
90 priv->sats_used = data->satellites_used;
92 + priv->sats = data->satellites_visible;
94 priv->sats = data->satellites;
96 priv->sats_signal = sats_signal;
97 callback_list_call_attr_0(priv->cbl, attr_position_sats);
100 priv->fix_time = data->fix.time;
101 data->set &= ~TIME_SET;
103 +#ifdef HAVE_LIBGPS19
104 + if (data->set & DOP_SET) {
105 + dbg(1, "pdop : %g\n", data->dop.pdop);
106 + priv->hdop = data->dop.pdop;
107 + data->set &= ~DOP_SET;
109 if (data->set & PDOP_SET) {
110 dbg(1, "pdop : %g\n", data->pdop);
111 priv->hdop = data->hdop;
112 data->set &= ~PDOP_SET;
115 if (data->set & LATLON_SET) {
116 priv->geo.lat = data->fix.latitude;
118 dbg(0,"gps_open failed for '%s'. Retrying in %d seconds. Have you started gpsd?\n", priv->source, priv->retry_interval);
121 +#ifdef HAVE_LIBGPS19
122 + gps_stream(priv->gps, WATCH_ENABLE, NULL);
124 gps_query(priv->gps, priv->gpsd_query);
126 gps_set_raw_hook(priv->gps, vehicle_gpsd_callback);
127 priv->cb = callback_new_1(callback_cast(vehicle_gpsd_io), priv);
128 priv->evwatch = event_add_watch((void *)priv->gps->gps_fd, event_watch_cond_read, priv->cb);
130 vehicle_gpsd_close(priv);
132 g_free(priv->source);
133 +#ifndef HAVE_LIBGPS19
134 if (priv->gpsd_query)
135 g_free(priv->gpsd_query);
140 @@ -350,12 +385,17 @@
141 *cbl, struct attr **attrs)
143 struct vehicle_priv *ret;
144 +#ifdef HAVE_LIBGPS19
145 + struct attr *source, *retry_int;
147 struct attr *source, *query, *retry_int;
151 source = attr_search(attrs, NULL, attr_source);
152 ret = g_new0(struct vehicle_priv, 1);
153 ret->source = g_strdup(source->u.str);
154 +#ifndef HAVE_LIBGPS19
155 query = attr_search(attrs, NULL, attr_gpsd_query);
157 ret->gpsd_query = g_strconcat(query->u.str, "\n", NULL);
159 ret->gpsd_query = g_strdup("w+x\n");
161 dbg(1,"Format string for gpsd_query: %s\n",ret->gpsd_query);
163 retry_int = attr_search(attrs, NULL, attr_retry_interval);
165 ret->retry_interval = retry_int->u.num;
166 Index: navit/navit/attr.h
167 ===================================================================
168 --- navit.orig/navit/attr.h 2010-01-06 00:06:16.000000000 +0100
169 +++ navit/navit/attr.h 2010-01-06 00:08:44.000000000 +0100
173 #include "projection.h"
178 Index: navit/navit/map/garmin/Makefile.am
179 ===================================================================
180 --- navit.orig/navit/map/garmin/Makefile.am 2010-01-06 00:09:00.000000000 +0100
181 +++ navit/navit/map/garmin/Makefile.am 2010-01-06 00:09:09.000000000 +0100
183 gentypes_SOURCES=gentypes.c
185 gentypes.$(OBJEXT): gentypes.c
186 - $(CC_FOR_BUILD) -I$(top_srcdir)/navit -c -o $@ $<
187 + $(CC_FOR_BUILD) -I$(top_srcdir)/navit -I$(top_srcdir) -c -o $@ $<
189 gentypes$(EXEEXT): $(gentypes_OBJECTS) $(gentypes_DEPENDENCIES)
190 @rm -f gentypes$(EXEEXT)