-Fix FTBFS against libgps-2.90.
-d5db05b5fd83c961237aea1f51b74cb448c221c7
-diff --git a/navit/attr_def.h b/navit/attr_def.h
-index d2ee03e..03fbe67 100644
---- a/navit/attr_def.h
-+++ b/navit/attr_def.h
-@@ -226,7 +226,6 @@ ATTR(description)
+To cope both with libgps18 and libgps19
+Index: navit/configure.in
+===================================================================
+--- navit.orig/configure.in 2010-01-06 00:08:44.000000000 +0100
++++ navit/configure.in 2010-01-06 00:08:44.000000000 +0100
+@@ -773,7 +773,17 @@
+ AC_ARG_ENABLE(vehicle-gpsd, [ --disable-vehicle-gpsd disable vehicle type gpsd], vehicle_gpsd=$enableval;vehicle_gpsd_reason="configure parameter")
+ if test "x${vehicle_gpsd}" = xyes
+ then
+- 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" )
++ PKG_CHECK_MODULES([GPSD], [libgps], have_libgps="yes", have_libgps="no")
++ if test "x$have_libgps" = "xyes"; then
++ AC_DEFINE([HAVE_LIBGPS],[],Define to 1 if you have libgps.)
++ PKG_CHECK_MODULES([LIBGPS19], [libgps >= 2.90], have_libgps19="yes", have_libgps19="no")
++ if test "x$have_libgps19" = "xyes"; then
++ AC_DEFINE([HAVE_LIBGPS19],[],Define to 1 if you have libgps19.)
++ fi
++ else
++ vehicle_gpsd=no; vehicle_gpsd_reason="no libgps"
++ fi
++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" )
+ fi
+ AC_SUBST(GPSD_CFLAGS)
+ AC_SUBST(GPSD_LIBS)
+Index: navit/navit/attr_def.h
+===================================================================
+--- navit.orig/navit/attr_def.h 2010-01-06 00:06:16.000000000 +0100
++++ navit/navit/attr_def.h 2010-01-06 00:08:44.000000000 +0100
+@@ -226,7 +226,9 @@
ATTR(gc_type)
ATTR(layout)
ATTR(position_nmea)
--ATTR(gpsd_query)
++#ifndef HAVE_LIBGPS19
+ ATTR(gpsd_query)
++#endif
ATTR(on_eof)
ATTR(command)
ATTR(src)
-diff --git a/navit/navit_shipped.xml b/navit/navit_shipped.xml
-index b975d8e..b6af6b8 100644
---- a/navit/navit_shipped.xml
-+++ b/navit/navit_shipped.xml
-@@ -99,7 +99,7 @@ Navigation</text></img>
- <osd enabled="no" type="button" x="-96" y="-96" command="zoom_in()" src="zoom_in.xpm"/>
- <osd enabled="no" type="button" x="0" y="-96" command="zoom_out()" src="zoom_out.xpm"/>
-
-- <vehicle name="Local GPS" profilename="car" enabled="yes" active="1" source="gpsd://localhost" gpsd_query="w+xj">
-+ <vehicle name="Local GPS" profilename="car" enabled="yes" active="1" source="gpsd://localhost">
- <!-- Navit can write a tracklog in several formats (gpx, nmea or textfile): -->
- <log enabled="no" type="gpx" attr_types="position_time_iso8601,position_direction,position_speed,profilename,position_radius" data="track_%Y%m%d-%i.gpx" flush_size="1000" flush_time="30"/>
- </vehicle>
-diff --git a/navit/vehicle/gpsd/vehicle_gpsd.c b/navit/vehicle/gpsd/vehicle_gpsd.c
-index 4bba75f..a51d93f 100644
---- a/navit/vehicle/gpsd/vehicle_gpsd.c
-+++ b/navit/vehicle/gpsd/vehicle_gpsd.c
-@@ -36,7 +36,6 @@
+Index: navit/navit/vehicle/gpsd/vehicle_gpsd.c
+===================================================================
+--- navit.orig/navit/vehicle/gpsd/vehicle_gpsd.c 2010-01-06 00:06:16.000000000 +0100
++++ navit/navit/vehicle/gpsd/vehicle_gpsd.c 2010-01-06 00:08:44.000000000 +0100
+@@ -36,7 +36,9 @@
static struct vehicle_priv {
char *source;
-- char *gpsd_query;
++#ifndef HAVE_LIBGPS19
+ char *gpsd_query;
++#endif
struct callback_list *cbl;
struct callback *cb;
struct event_watch *evwatch;
-@@ -69,8 +68,7 @@ static struct vehicle_priv {
+@@ -69,8 +71,12 @@
static void vehicle_gpsd_io(struct vehicle_priv *priv);
static void
--vehicle_gpsd_callback(struct gps_data_t *data, char *buf, size_t len,
-- int level)
++#ifdef HAVE_LIBGPS19
+vehicle_gpsd_callback(struct gps_data_t *data, char *buf, size_t len)
++#else
+ vehicle_gpsd_callback(struct gps_data_t *data, char *buf, size_t len,
+ int level)
++#endif
{
char *pos,*nmea_data_buf;
int i=0,sats_signal=0;
-@@ -108,16 +106,16 @@ vehicle_gpsd_callback(struct gps_data_t *data, char *buf, size_t len,
+@@ -108,16 +114,32 @@
data->set &= ~ALTITUDE_SET;
}
if (data->set & SATELLITE_SET) {
-- if(data->satellites > 0) {
++#ifdef HAVE_LIBGPS19
+ if(data->satellites_visible > 0) {
++#else
+ if(data->satellites > 0) {
++#endif
sats_signal=0;
-- for( i=0;i<data->satellites;i++) {
++#ifdef HAVE_LIBGPS19
+ for( i=0;i<data->satellites_visible;i++) {
++#else
+ for( i=0;i<data->satellites;i++) {
++#endif
if (data->ss[i] > 0)
sats_signal++;
}
}
-- if (priv->sats_used != data->satellites_used || priv->sats != data->satellites || priv->sats_signal != sats_signal ) {
++#ifdef HAVE_LIBGPS19
+ if (priv->sats_used != data->satellites_used || priv->sats != data->satellites_visible || priv->sats_signal != sats_signal ) {
++#else
+ if (priv->sats_used != data->satellites_used || priv->sats != data->satellites || priv->sats_signal != sats_signal ) {
++#endif
priv->sats_used = data->satellites_used;
-- priv->sats = data->satellites;
++#ifdef HAVE_LIBGPS19
+ priv->sats = data->satellites_visible;
++#else
+ priv->sats = data->satellites;
++#endif
priv->sats_signal = sats_signal;
callback_list_call_attr_0(priv->cbl, attr_position_sats);
}
-@@ -135,10 +133,10 @@ vehicle_gpsd_callback(struct gps_data_t *data, char *buf, size_t len,
+@@ -135,10 +157,17 @@
priv->fix_time = data->fix.time;
data->set &= ~TIME_SET;
}
-- if (data->set & PDOP_SET) {
-- dbg(1, "pdop : %g\n", data->pdop);
-- priv->hdop = data->hdop;
-- data->set &= ~PDOP_SET;
++#ifdef HAVE_LIBGPS19
+ if (data->set & DOP_SET) {
+ dbg(1, "pdop : %g\n", data->dop.pdop);
+ priv->hdop = data->dop.pdop;
+ data->set &= ~DOP_SET;
++#else
+ if (data->set & PDOP_SET) {
+ dbg(1, "pdop : %g\n", data->pdop);
+ priv->hdop = data->hdop;
+ data->set &= ~PDOP_SET;
++#endif
}
if (data->set & LATLON_SET) {
priv->geo.lat = data->fix.latitude;
-@@ -180,7 +178,7 @@ vehicle_gpsd_try_open(gpointer *data)
+@@ -180,7 +209,11 @@
dbg(0,"gps_open failed for '%s'. Retrying in %d seconds. Have you started gpsd?\n", priv->source, priv->retry_interval);
return TRUE;
}
-- gps_query(priv->gps, priv->gpsd_query);
++#ifdef HAVE_LIBGPS19
+ gps_stream(priv->gps, WATCH_ENABLE, NULL);
++#else
+ gps_query(priv->gps, priv->gpsd_query);
++#endif
gps_set_raw_hook(priv->gps, vehicle_gpsd_callback);
priv->cb = callback_new_1(callback_cast(vehicle_gpsd_io), priv);
priv->evwatch = event_add_watch((void *)priv->gps->gps_fd, event_watch_cond_read, priv->cb);
-@@ -268,8 +266,6 @@ vehicle_gpsd_destroy(struct vehicle_priv *priv)
+@@ -268,8 +301,10 @@
vehicle_gpsd_close(priv);
if (priv->source)
g_free(priv->source);
-- if (priv->gpsd_query)
-- g_free(priv->gpsd_query);
++#ifndef HAVE_LIBGPS19
+ if (priv->gpsd_query)
+ g_free(priv->gpsd_query);
++#endif
g_free(priv);
}
-@@ -350,19 +346,12 @@ vehicle_gpsd_new_gpsd(struct vehicle_methods
+@@ -350,12 +385,17 @@
*cbl, struct attr **attrs)
{
struct vehicle_priv *ret;
-- struct attr *source, *query, *retry_int;
++#ifdef HAVE_LIBGPS19
+ struct attr *source, *retry_int;
++#else
+ struct attr *source, *query, *retry_int;
++#endif
dbg(1, "enter\n");
source = attr_search(attrs, NULL, attr_source);
ret = g_new0(struct vehicle_priv, 1);
ret->source = g_strdup(source->u.str);
-- query = attr_search(attrs, NULL, attr_gpsd_query);
-- if (query) {
-- ret->gpsd_query = g_strconcat(query->u.str, "\n", NULL);
-- } else {
-- ret->gpsd_query = g_strdup("w+x\n");
-- }
-- dbg(1,"Format string for gpsd_query: %s\n",ret->gpsd_query);
++#ifndef HAVE_LIBGPS19
+ query = attr_search(attrs, NULL, attr_gpsd_query);
+ if (query) {
+ ret->gpsd_query = g_strconcat(query->u.str, "\n", NULL);
+@@ -363,6 +403,7 @@
+ ret->gpsd_query = g_strdup("w+x\n");
+ }
+ dbg(1,"Format string for gpsd_query: %s\n",ret->gpsd_query);
++#endif
retry_int = attr_search(attrs, NULL, attr_retry_interval);
if (retry_int) {
ret->retry_interval = retry_int->u.num;
+Index: navit/navit/attr.h
+===================================================================
+--- navit.orig/navit/attr.h 2010-01-06 00:06:16.000000000 +0100
++++ navit/navit/attr.h 2010-01-06 00:08:44.000000000 +0100
+@@ -25,6 +25,7 @@
+ #endif
+
+ #include "projection.h"
++#include "config.h"
+
+ enum item_type;
+
+Index: navit/navit/map/garmin/Makefile.am
+===================================================================
+--- navit.orig/navit/map/garmin/Makefile.am 2010-01-06 00:09:00.000000000 +0100
++++ navit/navit/map/garmin/Makefile.am 2010-01-06 00:09:09.000000000 +0100
+@@ -20,7 +20,7 @@
+ gentypes_SOURCES=gentypes.c
+
+ gentypes.$(OBJEXT): gentypes.c
+- $(CC_FOR_BUILD) -I$(top_srcdir)/navit -c -o $@ $<
++ $(CC_FOR_BUILD) -I$(top_srcdir)/navit -I$(top_srcdir) -c -o $@ $<
+
+ gentypes$(EXEEXT): $(gentypes_OBJECTS) $(gentypes_DEPENDENCIES)
+ @rm -f gentypes$(EXEEXT)
+++ /dev/null
-To cope both with libgps18 and libgps19
-Index: navit/configure.in
-===================================================================
---- navit.orig/configure.in 2010-01-06 00:08:44.000000000 +0100
-+++ navit/configure.in 2010-01-06 00:08:44.000000000 +0100
-@@ -773,7 +773,17 @@
- AC_ARG_ENABLE(vehicle-gpsd, [ --disable-vehicle-gpsd disable vehicle type gpsd], vehicle_gpsd=$enableval;vehicle_gpsd_reason="configure parameter")
- if test "x${vehicle_gpsd}" = xyes
- then
-- 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" )
-+ PKG_CHECK_MODULES([GPSD], [libgps], have_libgps="yes", have_libgps="no")
-+ if test "x$have_libgps" = "xyes"; then
-+ AC_DEFINE([HAVE_LIBGPS],[],Define to 1 if you have libgps.)
-+ PKG_CHECK_MODULES([LIBGPS19], [libgps >= 2.90], have_libgps19="yes", have_libgps19="no")
-+ if test "x$have_libgps19" = "xyes"; then
-+ AC_DEFINE([HAVE_LIBGPS19],[],Define to 1 if you have libgps19.)
-+ fi
-+ else
-+ vehicle_gpsd=no; vehicle_gpsd_reason="no libgps"
-+ fi
-+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" )
- fi
- AC_SUBST(GPSD_CFLAGS)
- AC_SUBST(GPSD_LIBS)
-Index: navit/navit/attr_def.h
-===================================================================
---- navit.orig/navit/attr_def.h 2010-01-06 00:06:16.000000000 +0100
-+++ navit/navit/attr_def.h 2010-01-06 00:08:44.000000000 +0100
-@@ -226,7 +226,9 @@
- ATTR(gc_type)
- ATTR(layout)
- ATTR(position_nmea)
-+#ifndef HAVE_LIBGPS19
- ATTR(gpsd_query)
-+#endif
- ATTR(on_eof)
- ATTR(command)
- ATTR(src)
-Index: navit/navit/vehicle/gpsd/vehicle_gpsd.c
-===================================================================
---- navit.orig/navit/vehicle/gpsd/vehicle_gpsd.c 2010-01-06 00:06:16.000000000 +0100
-+++ navit/navit/vehicle/gpsd/vehicle_gpsd.c 2010-01-06 00:08:44.000000000 +0100
-@@ -36,7 +36,9 @@
-
- static struct vehicle_priv {
- char *source;
-+#ifndef HAVE_LIBGPS19
- char *gpsd_query;
-+#endif
- struct callback_list *cbl;
- struct callback *cb;
- struct event_watch *evwatch;
-@@ -69,8 +71,12 @@
- static void vehicle_gpsd_io(struct vehicle_priv *priv);
-
- static void
-+#ifdef HAVE_LIBGPS19
-+vehicle_gpsd_callback(struct gps_data_t *data, char *buf, size_t len)
-+#else
- vehicle_gpsd_callback(struct gps_data_t *data, char *buf, size_t len,
- int level)
-+#endif
- {
- char *pos,*nmea_data_buf;
- int i=0,sats_signal=0;
-@@ -108,16 +114,32 @@
- data->set &= ~ALTITUDE_SET;
- }
- if (data->set & SATELLITE_SET) {
-+#ifdef HAVE_LIBGPS19
-+ if(data->satellites_visible > 0) {
-+#else
- if(data->satellites > 0) {
-+#endif
- sats_signal=0;
-+#ifdef HAVE_LIBGPS19
-+ for( i=0;i<data->satellites_visible;i++) {
-+#else
- for( i=0;i<data->satellites;i++) {
-+#endif
- if (data->ss[i] > 0)
- sats_signal++;
- }
- }
-+#ifdef HAVE_LIBGPS19
-+ if (priv->sats_used != data->satellites_used || priv->sats != data->satellites_visible || priv->sats_signal != sats_signal ) {
-+#else
- if (priv->sats_used != data->satellites_used || priv->sats != data->satellites || priv->sats_signal != sats_signal ) {
-+#endif
- priv->sats_used = data->satellites_used;
-+#ifdef HAVE_LIBGPS19
-+ priv->sats = data->satellites_visible;
-+#else
- priv->sats = data->satellites;
-+#endif
- priv->sats_signal = sats_signal;
- callback_list_call_attr_0(priv->cbl, attr_position_sats);
- }
-@@ -135,10 +157,17 @@
- priv->fix_time = data->fix.time;
- data->set &= ~TIME_SET;
- }
-+#ifdef HAVE_LIBGPS19
-+ if (data->set & DOP_SET) {
-+ dbg(1, "pdop : %g\n", data->dop.pdop);
-+ priv->hdop = data->dop.pdop;
-+ data->set &= ~DOP_SET;
-+#else
- if (data->set & PDOP_SET) {
- dbg(1, "pdop : %g\n", data->pdop);
- priv->hdop = data->hdop;
- data->set &= ~PDOP_SET;
-+#endif
- }
- if (data->set & LATLON_SET) {
- priv->geo.lat = data->fix.latitude;
-@@ -180,7 +209,11 @@
- dbg(0,"gps_open failed for '%s'. Retrying in %d seconds. Have you started gpsd?\n", priv->source, priv->retry_interval);
- return TRUE;
- }
-+#ifdef HAVE_LIBGPS19
-+ gps_stream(priv->gps, WATCH_ENABLE, NULL);
-+#else
- gps_query(priv->gps, priv->gpsd_query);
-+#endif
- gps_set_raw_hook(priv->gps, vehicle_gpsd_callback);
- priv->cb = callback_new_1(callback_cast(vehicle_gpsd_io), priv);
- priv->evwatch = event_add_watch((void *)priv->gps->gps_fd, event_watch_cond_read, priv->cb);
-@@ -268,8 +301,10 @@
- vehicle_gpsd_close(priv);
- if (priv->source)
- g_free(priv->source);
-+#ifndef HAVE_LIBGPS19
- if (priv->gpsd_query)
- g_free(priv->gpsd_query);
-+#endif
- g_free(priv);
- }
-
-@@ -350,12 +385,17 @@
- *cbl, struct attr **attrs)
- {
- struct vehicle_priv *ret;
-+#ifdef HAVE_LIBGPS19
-+ struct attr *source, *retry_int;
-+#else
- struct attr *source, *query, *retry_int;
-+#endif
-
- dbg(1, "enter\n");
- source = attr_search(attrs, NULL, attr_source);
- ret = g_new0(struct vehicle_priv, 1);
- ret->source = g_strdup(source->u.str);
-+#ifndef HAVE_LIBGPS19
- query = attr_search(attrs, NULL, attr_gpsd_query);
- if (query) {
- ret->gpsd_query = g_strconcat(query->u.str, "\n", NULL);
-@@ -363,6 +403,7 @@
- ret->gpsd_query = g_strdup("w+x\n");
- }
- dbg(1,"Format string for gpsd_query: %s\n",ret->gpsd_query);
-+#endif
- retry_int = attr_search(attrs, NULL, attr_retry_interval);
- if (retry_int) {
- ret->retry_interval = retry_int->u.num;
-Index: navit/navit/attr.h
-===================================================================
---- navit.orig/navit/attr.h 2010-01-06 00:06:16.000000000 +0100
-+++ navit/navit/attr.h 2010-01-06 00:08:44.000000000 +0100
-@@ -25,6 +25,7 @@
- #endif
-
- #include "projection.h"
-+#include "config.h"
-
- enum item_type;
-
-Index: navit/navit/map/garmin/Makefile.am
-===================================================================
---- navit.orig/navit/map/garmin/Makefile.am 2010-01-06 00:09:00.000000000 +0100
-+++ navit/navit/map/garmin/Makefile.am 2010-01-06 00:09:09.000000000 +0100
-@@ -20,7 +20,7 @@
- gentypes_SOURCES=gentypes.c
-
- gentypes.$(OBJEXT): gentypes.c
-- $(CC_FOR_BUILD) -I$(top_srcdir)/navit -c -o $@ $<
-+ $(CC_FOR_BUILD) -I$(top_srcdir)/navit -I$(top_srcdir) -c -o $@ $<
-
- gentypes$(EXEEXT): $(gentypes_OBJECTS) $(gentypes_DEPENDENCIES)
- @rm -f gentypes$(EXEEXT)