[PATCH] fix building on non-Linux systems (e.g. BSD)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Not all C libraries provide byteswap.h, so check for it before we include
it.  Further, we use functions from unistd.h (e.g. access()), but don't
include the header, so pull it in.

Signed-off-by: Mike Frysinger <vapier@xxxxxxxxxx>
---
 configure.ac |    2 ++
 lsusb.c      |    5 +++++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index e0a714c..c9ead3a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,6 +9,8 @@ AC_PREFIX_DEFAULT([/usr])
 AC_USE_SYSTEM_EXTENSIONS
 AC_SYS_LARGEFILE
 
+AC_CHECK_HEADERS([byteswap.h])
+
 USE_ZLIB=yes
 AC_ARG_ENABLE(zlib,
 	AS_HELP_STRING(--disable-zlib,disable support for zlib),
diff --git a/lsusb.c b/lsusb.c
index 61d362f..197c0fe 100644
--- a/lsusb.c
+++ b/lsusb.c
@@ -32,8 +32,13 @@
 #include <errno.h>
 #include <stdio.h>
 #include <stdarg.h>
+
+#ifdef HAVE_BYTESWAP_H
 #include <byteswap.h>
+#endif
+
 #include <usb.h>
+#include <unistd.h>
 
 #include "names.h"
 #include "devtree.h"
-- 
1.7.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux