summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPete Batard <pete@akeo.ie>2012-04-19 18:01:04 +0100
committerPete Batard <pete@akeo.ie>2012-04-19 18:01:41 +0100
commit968df1244673e1e2b0e1acfffa9375d092d2c26d (patch)
treee360d38ce0086e47e4ad261fea8aa84fe29dc618
parent81b627b4a0856468b21f4605bc667132d87b66df (diff)
downloadlibusb-968df1244673e1e2b0e1acfffa9375d092d2c26d.tar.gz
BSD: add NetBSD experimental support
* also improve OS/backend selection in configure.ac * original libusb patches from Peter Stuge and Xiaofan Chen
-rw-r--r--configure.ac69
-rw-r--r--libusb-1.0.pc.in2
-rw-r--r--libusb/version.h2
3 files changed, 45 insertions, 28 deletions
diff --git a/configure.ac b/configure.ac
index 69b30ce..db5c534 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,47 +45,32 @@ AC_DEFINE([_GNU_SOURCE], 1, [Use GNU extensions])
LTLDFLAGS="${LTLDFLAGS} -no-undefined"
AC_MSG_CHECKING([operating system])
+
case $host in
*-linux*)
- AC_DEFINE(OS_LINUX, 1, [Linux backend])
- AC_SUBST(OS_LINUX)
AC_MSG_RESULT([Linux])
backend="linux"
- AC_CHECK_LIB(rt, clock_gettime, PC_LIBS_PRIVATE="-lrt")
threads="posix"
- THREAD_CFLAGS="-pthread"
- PC_LIBS_PRIVATE="${PC_LIBS_PRIVATE} -pthread"
- AC_CHECK_HEADERS([poll.h])
- AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])
;;
*-darwin*)
- AC_DEFINE(OS_DARWIN, 1, [Darwin backend])
- AC_SUBST(OS_DARWIN)
AC_MSG_RESULT([Darwin/Mac OS X])
backend="darwin"
threads="posix"
- PC_LIBS_PRIVATE="-lobjc -Wl,-framework,IOKit -Wl,-framework,CoreFoundation"
- LTLDFLAGS="${LTLDFLAGS} -Wl,-prebind"
- AC_CHECK_HEADERS([poll.h])
- AC_CHECK_TYPE([nfds_t],
- [AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])],
- [AC_DEFINE([POLL_NFDS_TYPE],[unsigned int],[type of second poll() argument])],
- [#include <poll.h>])
;;
*-openbsd*)
- AC_DEFINE(OS_OPENBSD, 1, [OpenBSD backend])
- AC_SUBST(OS_OPENBSD)
AC_MSG_RESULT([OpenBSD])
- backend="openbsd"
+ backend="bsd"
+ threads="posix"
+ ;;
+*-netbsd*)
+ AC_MSG_RESULT([NetBSD (using OpenBSD backend)])
+ backend="bsd"
threads="posix"
- THREAD_CFLAGS="-pthread"
- PC_LIBS_PRIVATE="-pthread"
- AC_CHECK_HEADERS([poll.h])
- AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])
;;
*-mingw*)
AC_MSG_RESULT([Windows])
backend="windows"
+ threads="windows"
;;
*-cygwin*)
AC_MSG_RESULT([Cygwin (using Windows backend)])
@@ -95,20 +80,52 @@ case $host in
*)
AC_MSG_ERROR([unsupported operating system])
esac
-if test "$backend" = windows; then
+
+case $backend in
+linux)
+ AC_DEFINE(OS_LINUX, 1, [Linux backend])
+ AC_SUBST(OS_LINUX)
+ AC_CHECK_LIB(rt, clock_gettime, PC_LIBS_PRIVATE="-lrt")
+ THREAD_CFLAGS="-pthread"
+ PC_LIBS_PRIVATE="${PC_LIBS_PRIVATE} -pthread"
+ AC_CHECK_HEADERS([poll.h])
+ AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])
+ ;;
+darwin)
+ AC_DEFINE(OS_DARWIN, 1, [Darwin backend])
+ AC_SUBST(OS_DARWIN)
+ PC_LIBS_PRIVATE="-lobjc -Wl,-framework,IOKit -Wl,-framework,CoreFoundation"
+ LTLDFLAGS="${LTLDFLAGS} -Wl,-prebind"
+ AC_CHECK_HEADERS([poll.h])
+ AC_CHECK_TYPE([nfds_t],
+ [AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])],
+ [AC_DEFINE([POLL_NFDS_TYPE],[unsigned int],[type of second poll() argument])],
+ [#include <poll.h>])
+ ;;
+bsd)
+ AC_DEFINE(OS_OPENBSD, 1, [OpenBSD/NetBSD backend])
+ AC_SUBST(OS_OPENBSD)
+ THREAD_CFLAGS="-pthread"
+ PC_LIBS_PRIVATE="-pthread"
+ AC_CHECK_HEADERS([poll.h])
+ AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])
+ ;;
+windows)
AC_DEFINE(OS_WINDOWS, 1, [Windows backend])
AC_SUBST(OS_WINDOWS)
PC_LIBS_PRIVATE=""
LTLDFLAGS="${LTLDFLAGS} -avoid-version -Wl,--add-stdcall-alias"
AC_DEFINE([POLL_NFDS_TYPE],[unsigned int],[type of second poll() argument])
-fi
+ ;;
+esac
+
AC_SUBST(THREAD_CFLAGS)
AC_SUBST(PC_LIBS_PRIVATE)
LIBS="${LIBS} ${PC_LIBS_PRIVATE}"
AM_CONDITIONAL(OS_LINUX, test "x$backend" = xlinux)
AM_CONDITIONAL(OS_DARWIN, test "x$backend" = xdarwin)
-AM_CONDITIONAL(OS_OPENBSD, test "x$backend" = xopenbsd)
+AM_CONDITIONAL(OS_OPENBSD, test "x$backend" = xbsd)
AM_CONDITIONAL(OS_WINDOWS, test "x$backend" = xwindows)
AM_CONDITIONAL(THREADS_POSIX, test "x$threads" = xposix)
if test "$threads" = posix; then
diff --git a/libusb-1.0.pc.in b/libusb-1.0.pc.in
index 645c978..8e403b8 100644
--- a/libusb-1.0.pc.in
+++ b/libusb-1.0.pc.in
@@ -4,7 +4,7 @@ libdir=@libdir@
includedir=@includedir@
Name: libusbx-1.0
-Description: C API for USB device access from Linux, Mac OS X, Windows and OpenBSD userspace
+Description: C API for USB device access from Linux, Mac OS X, Windows and OpenBSD/NetBSD userspace
Version: @VERSION@
Libs: -L${libdir} -lusb-1.0
Libs.private: @PC_LIBS_PRIVATE@
diff --git a/libusb/version.h b/libusb/version.h
index 958fd11..f7715e3 100644
--- a/libusb/version.h
+++ b/libusb/version.h
@@ -9,7 +9,7 @@
#define LIBUSB_MICRO 10
#endif
#ifndef LIBUSB_NANO
-#define LIBUSB_NANO 10476
+#define LIBUSB_NANO 10477
#endif
/* LIBUSB_RC is the release candidate suffix. Should normally be empty. */
#ifndef LIBUSB_RC