summaryrefslogtreecommitdiffstats
path: root/patches/gpsd-2.39/0002-fix-link-breakage-if-some-drivers-are-not-enabled.patch
blob: b39161ec17e566f4900aa18df44bc564f249f956 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
From: Luotao Fu <l.fu@pengutronix.de>
Date: Thu, 23 Apr 2009 18:18:54 +0200
Subject: [PATCH] fix link breakage if some drivers are not enabled

rtcm*_unpack and rtcm*_dump functions are only declared if the rtcm drivers are
enabled during configuration. The same for aivdm. If these drivers are not
enabled, linking will fail due to unknow reference. Add some ifdefs to avoid
this. This is ugly ifdef hell. It'd be way eleganter to change the structures in
driver code and put some function pointer checking in here. Due to lack of time
I only did this quick hack. Better ideas are highly welcome.

Signed-off-by: Luotao Fu <l.fu@pengutronix.de>
---
# 20110222 wsa: fixed in master meanwhile. Like this.

 gpsdecode.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/gpsdecode.c b/gpsdecode.c
index ffe898b..e18c698 100644
--- a/gpsdecode.c
+++ b/gpsdecode.c
@@ -57,19 +57,25 @@ static void decode(FILE *fpin, FILE *fpout)
 	else if (lexer.type == COMMENT_PACKET)
 	    continue;
 	else if (lexer.type == RTCM2_PACKET) {
+#if defined(RTCM104V2_ENABLE)
 	    rtcm2_unpack(&rtcm2, (char *)lexer.isgps.buf);
 	    rtcm2_dump(&rtcm2, buf, sizeof(buf));
 	    (void)fputs(buf, fpout);
+#endif
 	}
 	else if (lexer.type == RTCM3_PACKET) {
+#if defined(RTCM104V3_ENABLE)
 	    rtcm3_unpack(&rtcm3, (char *)lexer.outbuffer);
 	    rtcm3_dump(&rtcm3, stdout);
+#endif
 	}
 	else if (lexer.type == AIVDM_PACKET) {
+#if defined(aivdm_dump)
 	    /*@ -uniondef */
 	    if (aivdm_decode((char *)lexer.outbuffer, lexer.outbuflen, &aivdm))
 		aivdm_dump(&aivdm.decoded, scaled, labeled, stdout);
 	    /*@ +uniondef */
+#endif
 	}
     }
 }