summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SConstruct19
-rw-r--r--doc/Makefile2
-rw-r--r--gpsd.h-tail10
-rw-r--r--ntpshm.c3
-rw-r--r--ppsthread.c6
5 files changed, 30 insertions, 10 deletions
diff --git a/SConstruct b/SConstruct
index 51da3106..b63c000a 100644
--- a/SConstruct
+++ b/SConstruct
@@ -428,6 +428,20 @@ def CheckCompilerOption(context, option):
context.Result(ret)
return ret
+def CheckDefine(context, define, file):
+ context.Message( 'Checking if %s supplies %s ...' %(file,define) )
+ ret = context.TryLink("""
+ #include <%s>
+ #ifndef %s
+ #error %s is not defined
+ #endif
+ int main(int argc, char **argv) {
+ return 0;
+ }
+ """ % (file, define, define),'.c')
+ context.Result(ret)
+ return ret
+
def CheckEndian(context):
context.Message("checking endianess ... ")
import struct
@@ -448,6 +462,7 @@ config = Configure(env, custom_tests = { 'CheckPKG' : CheckPKG,
'CheckExecutable' : CheckExecutable,
'CheckXsltproc' : CheckXsltproc,
'CheckCompilerOption' : CheckCompilerOption,
+ 'CheckDefine' : CheckDefine,
'CheckEndian' : CheckEndian})
@@ -621,6 +636,10 @@ if config.CheckFunc("pselect"):
else:
confdefs.append("#define COMPAT_SELECT\n")
+if not config.CheckDefine("TIOCMIWAIT", "sys/ioctl.h"):
+ announce("Forcing pps=no (TIOCMIWAIT not available)")
+ env["pps"] = False
+
endian = config.CheckEndian()
if endian == 'big':
confdefs.append("#define WORDS_BIGENDIAN 1\n")
diff --git a/doc/Makefile b/doc/Makefile
index 83672ef1..a52ff9ea 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -1,2 +1,2 @@
explanation.html: $(shell ls *.xml)
- xmlto xhtml-nochunks explanation.xml
+ xmlto xhtml-nochunks internals.xml
diff --git a/gpsd.h-tail b/gpsd.h-tail
index 29a79a2b..a11bcac3 100644
--- a/gpsd.h-tail
+++ b/gpsd.h-tail
@@ -250,11 +250,11 @@ struct gps_context_t {
* 'optimize' as 'dead code' the writes to SHM */
/*@reldef@*/volatile struct shmTime *shmTime[NTPSHMSEGS];
bool shmTimeInuse[NTPSHMSEGS];
+#endif /* NTPSHM_ENABLE */
# ifdef PPS_ENABLE
/*@null@*/ void (*pps_hook)(struct gps_device_t *,
unsigned long, struct timespec *);
# endif /* PPS_ENABLE */
-#endif /* NTPSHM_ENABLE */
#ifdef SHM_EXPORT_ENABLE
/* we don't want the compiler to treat writes to shmexport as dead code,
* and we don't want them reordered either */
@@ -463,10 +463,11 @@ struct gps_device_t {
#endif /* TIMING_ENABLE */
#ifdef NTPSHM_ENABLE
int shmindex;
- timestamp_t last_fixtime; /* so updates happen once */
bool ship_to_ntpd;
-# ifdef PPS_ENABLE
+#endif /* NTPSHM_ENABLE */
+#ifdef PPS_ENABLE
int shmTimeP;
+ timestamp_t last_fixtime; /* so updates happen once */
#if defined(HAVE_SYS_TIMEPPS_H)
pps_handle_t kernelpps_handle;
#endif /* defined(HAVE_SYS_TIMEPPS_H) */
@@ -478,8 +479,7 @@ struct gps_device_t {
struct timespec *,
double);
/*@null@*/ void (*thread_wrap_hook)(struct gps_device_t *);
-# endif /* PPS_ENABLE */
-#endif /* NTPSHM_ENABLE */
+#endif /* PPS_ENABLE */
double mag_var; /* magnetic variation in degrees */
bool back_to_nmea; /* back to NMEA on revert? */
char msgbuf[MAX_PACKET_LENGTH*2+1]; /* command message buffer for sends */
diff --git a/ntpshm.c b/ntpshm.c
index 4ccea3ed..5fe96af3 100644
--- a/ntpshm.c
+++ b/ntpshm.c
@@ -22,6 +22,8 @@
#endif /* S_SPLINT_S */
#include "gpsd.h"
+
+#ifdef NTPSHM_ENABLE
#include <sys/time.h>
#include <sys/ipc.h>
#include <sys/shm.h>
@@ -499,4 +501,5 @@ void ntpd_link_activate(struct gps_device_t *session)
}
}
+#endif /* NTPSHM_ENABLE */
/* end */
diff --git a/ppsthread.c b/ppsthread.c
index f7d95350..64aa021f 100644
--- a/ppsthread.c
+++ b/ppsthread.c
@@ -33,9 +33,7 @@
#ifdef PPS_ENABLE
#if defined(HAVE_SYS_TIMEPPS_H)
#include <fcntl.h> /* needed for open() and friends */
-#endif
-#if defined(HAVE_SYS_TIMEPPS_H)
static pthread_mutex_t initialization_mutex;
static volatile int uninitialized_pps_thread_count;
#endif /* defined(HAVE_SYS_TIMEPPS_H) */
@@ -281,7 +279,7 @@ static /*@null@*/ void *gpsd_ppsmonitor(void *arg)
break;
}
TVTOTS( &ts, &tv);
-#endif
+#endif /* HAVE_CLOCK_GETTIME */
/*@+noeffect@*/
/* ok and log used by KPPS and TIOMCWAIT */
@@ -501,7 +499,7 @@ static /*@null@*/ void *gpsd_ppsmonitor(void *arg)
ts = pi.clear_timestamp; /* structure copy */
}
} else
-#endif
+#endif /* defined(HAVE_SYS_TIMEPPS_H) */
{
// use plain PPS
/*@i10@*/TVTOTS( &ts, &tv);