Windows: fd_to_winfd() shouldn't treat fd 0 as invalid

* fd_to_winfd() currently returns INVALID_WINFD if fd is 0, but usbi_create_fd()
  can legally assign an fd number of 0 if poll_fd[0] is not already occupied.
* Transfers which are assigned an fd number of 0 for their event handle are then
  unable to have their event handle retrieved later on.

See http://libusbx.1081486.n5.nabble.com/Libusbx-devel-PATCH-1-1-Windows-fd-to-winfd-shouldn-t-treat-fd-0-as-invalid-tt1535.html
WinCE: Fix race between wince_clock_gettime_threaded() and wince_clock_gettime()

* When the timer thread is created in wince_init(), it performs an initialisation
  phase in which it uses QueryPerformanceFrequency() to determine if there is a
  high resolution timer available, and sets hires_frequency and hires_ticks_to_ps
  appropriately. However, since wince_init() does not wait for this initialisation
  phase to complete, wince_clock_gettime() can be called before hires_frequency
  and hires_ticks_to_ps have been updated. This can result in
  wince_clock_gettime() temporarily returning real-time clock values even though
  the platform supports a monotonic clock.
* See http://sourceforge.net/mailarchive/forum.php?thread_name=1373619997-3535-1-git-send-email-simon.haggett%40realvnc.com&forum_name=libusbx-devel
Windows: Fix race between windows_clock_gettime_threaded() and windows_clock_gettime()

* When the timer thread is created in windows_init(), it performs an
  initialisation phase in which it uses QueryPerformanceFrequency() to determine
  if there is a high resolution timer available, and sets hires_frequency and
  hires_ticks_to_ps appropriately. However, since windows_init() does not wait for
  this initialisation phase to complete, windows_clock_gettime() can be called
  before hires_frequency and hires_ticks_to_ps have been updated. This can result
  in windows_clock_gettime() temporarily returning real-time clock values even
  though the platform supports a monotonic clock.
* See http://sourceforge.net/mailarchive/forum.php?thread_name=1373620013-3574-1-git-send-email-simon.haggett%40realvnc.com&forum_name=libusbx-devel
Core: Fix potential segfault caused by using freed memory

When a transfer is submitted, the device is referenced in libusb_submit_transfer()
and unreferenced in usbi_handle_transfer_completion(). This transfer could potentially
be freed by any user callback, or is freed by libusb if LIBUSB_TRANSFER_FREE_TRANSFER
is set in the flags. The call to unreference the device uses this potentially freed
memory. Reading the device handle beforehand will prevent this disaster.
linux: ensure the netlink socket is correctly opened with older Linux kernels

It is possible for the extra socket flags (available from 2.6.27 on) to be
defined but not available. Check for this case and set the flags correctly
on the netlink socket.
Core: Add compile time option to use native OS logging facility

* This change makes it easier to debug issues in UI applications
  which don't necessarily have a console connected to stderr.
* Outputting to the debugger shouldn't occur in normal situations so
  this change has to be explicitly enabled by a build-time config flag.
* Uses OutputDebugString() on Windows platforms or the syslog facility
  on other OSes, if available.
* Also align the report of configure defaults to autotool's.