Skip to content

Commit

Permalink
Fix build with libpgps <= 3.24 using pkg-config
Browse files Browse the repository at this point in the history
Introduce back the fixsource_t struct definition based on libgps
version, retrieved from pkg-config.

This fixes the build with libgps versions inferior or equal to 3.24

Closes: OLSR#122
Signed-off-by: Nicolas Peugnet <[email protected]>
  • Loading branch information
yann-morin-1998 authored and n-peugnet committed Jun 27, 2024
1 parent d72be9a commit eff010b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ BISON ?= bison
FLEX ?= flex
LDCONFIG ?= /sbin/ldconfig
TAGCMD ?= etags
PKG_CONFIG ?= pkg-config

# target directories and names
DESTDIR ?=
Expand Down
3 changes: 3 additions & 0 deletions lib/pud/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ include $(TOPDIR)/Makefile.inc
PUD_NMEALIB_STATICALLY_LINKED ?=
CFLAGS += -D_GNU_SOURCE

LIBGPS_VERSION := $(shell $(PKG_CONFIG) --modversion libgps)
CFLAGS += -DLIBGPS_VERSION_MAJOR=$(word 1,$(subst ., ,$(LIBGPS_VERSION)))
CFLAGS += -DLIBGPS_VERSION_MINOR=$(word 2,$(subst ., ,$(LIBGPS_VERSION)))

RESOURCESDIR = ./resources
NMEALIB_LIB = $(NMEALIB_PATH)/lib
Expand Down
14 changes: 14 additions & 0 deletions lib/pud/src/gpsdclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,20 @@ struct GpsdConnectionState {
struct devconfig_t dev[MAXUSERDEVS];
};

/**
* describe a data source
*
* Starting with gpsd 3.25, this is now provided in gps.h.
*/
#if LIBGPS_VERSION_MAJOR <= 3 && LIBGPS_VERSION_MINOR <= 24
struct fixsource_t {
char spec[PATH_MAX]; /* working space, will be modified */
char *server; /* pointer into spec field */
char *port; /* pointer into spec field */
char *device; /* pointer into spec field */
};
#endif

/**
* The gpsd daemon spec
*/
Expand Down

0 comments on commit eff010b

Please sign in to comment.