configure.ac: Enhance compiler checks for pthreads

There apparently exist some compiler ports (e.g Haiku's GCC) that do not
support the ubiquitous '-pthread' compiler option. Add a check for this
and only use the option if supported.

Also tweak the check for the pthread library to check for the
pthread_create() function. Even though libusb does not use this function,
it seems to be sufficiently distinct such that the standard C library
would not provide this directly if the pthread implementation resided in
a separate library. Also explicitly check whether no additional library
linkage is required.

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
diff --git a/configure.ac b/configure.ac
index 2aaa9e6..d386053 100644
--- a/configure.ac
+++ b/configure.ac
@@ -153,10 +153,20 @@
 
 if test "x$threads" = xposix; then
 	AC_DEFINE([THREADS_POSIX], [1], [Define to 1 if using POSIX threads.])
-	AC_SUBST(THREAD_CFLAGS, [-pthread])
+	dnl Some compilers do not support the '-pthread' option so check for it here
+	saved_CFLAGS="${CFLAGS}"
+	CFLAGS="-Wall -Werror -pthread"
+	AC_MSG_CHECKING([if $CC recognizes -pthread])
+	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
+		[AC_MSG_RESULT([yes])
+		 AC_SUBST(THREAD_CFLAGS, [-pthread])],
+		[AC_MSG_RESULT([no])])
+	CFLAGS="${saved_CFLAGS}"
 	dnl Android Linux and Darwin provide pthread functions directly in libc
 	dnl glibc also provides some pthread functions directly, so search for a thread-specific function
-	AC_SEARCH_LIBS([pthread_key_create], [pthread], [AC_SUBST(THREAD_LIBS, [-lpthread])], [], [])
+	AC_SEARCH_LIBS([pthread_create], [pthread],
+		[test "x$ac_cv_search_pthread_create" != "xnone required" && AC_SUBST(THREAD_LIBS, [-lpthread])],
+		[], [])
 elif test "x$threads" = xwindows; then
 	AC_DEFINE([THREADS_WINDOWS], [1], [Define to 1 if using Windows threads.])
 else
diff --git a/libusb/version_nano.h b/libusb/version_nano.h
index 07b0839..f5243a0 100644
--- a/libusb/version_nano.h
+++ b/libusb/version_nano.h
@@ -1 +1 @@
-#define LIBUSB_NANO 11488
+#define LIBUSB_NANO 11489