summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt <ukyg9e5r6k7gubiekd6@yahoo.com>2015-01-23 19:28:36 +1100
committerEric S. Raymond <esr@thyrsus.com>2015-01-23 04:52:06 -0500
commit822cf84c9f93398befe3c19137a46207383254b6 (patch)
tree2ba3494e4a98e87e4c975c392377f1d0643778bf
parent8ad7639727312ec64d989bb911babe8ae01f469d (diff)
downloadgpsd-822cf84c9f93398befe3c19137a46207383254b6.tar.gz
Guard includes of termios.h with #ifdef HAVE_TERMIOS_H
Guard includes of termios.h with #ifdef HAVE_TERMIOS_H. Test for termios.h in scons, and define/undefine HAVE_TERMIOS_H accordingly. Fixes the below error seen on cygwin, which lacks termios.h: In file included from gpsutils.c:22:0: gpsd.h:349:21: fatal error: termios.h: No such file or directory #include <termios.h> ^
-rw-r--r--SConstruct5
-rw-r--r--gps2udp.c5
-rw-r--r--gpsd.h-tail2
-rw-r--r--gpspipe.c4
4 files changed, 16 insertions, 0 deletions
diff --git a/SConstruct b/SConstruct
index ea425f85..f6f85287 100644
--- a/SConstruct
+++ b/SConstruct
@@ -624,6 +624,11 @@ else:
announce("You do not have kernel CANbus available.")
env["nmea2000"] = False
+ if config.CheckHeader("termios.h"):
+ confdefs.append("#define HAVE_TERMIOS_H 1\n")
+ else:
+ confdefs.append("/* #undef HAVE_TERMIOS_H */\n")
+
# endian.h is required for rtcm104v2 unless the compiler defines
# __ORDER_BIG_ENDIAN__, __ORDER_LITTLE_ENDIAN__ and __BYTE_ORDER__
if config.CheckCompilerDefines("__ORDER_BIG_ENDIAN__") \
diff --git a/gps2udp.c b/gps2udp.c
index c530275e..c1965ccf 100644
--- a/gps2udp.c
+++ b/gps2udp.c
@@ -11,6 +11,9 @@
* BSD terms apply: see the file COPYING in the distribution root for details.
*
*/
+
+#include "gpsd_config.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
@@ -18,7 +21,9 @@
#include <string.h>
#include <strings.h>
#include <fcntl.h>
+#ifdef HAVE_TERMIOS_H
#include <termios.h>
+#endif /* HAVE_TERMIOS_H */
#include <time.h>
#include <assert.h>
#include <sys/time.h>
diff --git a/gpsd.h-tail b/gpsd.h-tail
index 63cfd69f..fd7d2a89 100644
--- a/gpsd.h-tail
+++ b/gpsd.h-tail
@@ -5,7 +5,9 @@
*/
#endif /* GPSD_CONFIG_H */
+#ifdef HAVE_TERMIOS_H
#include <termios.h>
+#endif /* HAVE_TERMIOS_H */
#include <stdint.h>
#include <stdarg.h>
#include "gps.h"
diff --git a/gpspipe.c b/gpspipe.c
index 7e6a37b1..64cc39e1 100644
--- a/gpspipe.c
+++ b/gpspipe.c
@@ -23,6 +23,8 @@
*
*/
+#include "gpsd_config.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
@@ -30,7 +32,9 @@
#include <string.h>
#include <strings.h>
#include <fcntl.h>
+#ifdef HAVE_TERMIOS_H
#include <termios.h>
+#endif /* HAVE_TERMIOS_H */
#include <time.h>
#include <sys/time.h>
#include <sys/types.h>