73 Commits

Author SHA1 Message Date
Pete Batard
1e6928ccab Core: Use HAVE_SYS_TYPES_H and HAVE_SIGNAL_H
* These files may not be available on all platforms (eg. WinCE)
2013-01-23 00:39:47 +00:00
Toby Gray
21cf6e4748 Tests: Add libusbx stress test
See https://github.com/tobygray/libusbx/tree/testing as well
as http://libusbx.1081486.n5.nabble.com/Libusbx-devel-Crashes-tt433.html#a438
2012-11-25 01:32:59 +00:00
Peter Stuge
94b0ccc5e5 Autotools: Carry over 2012.10.23 libusb changes
* Use LIBS instead of PC_LIBS_PRIVATE
* Move THREAD_CFLAGS & VISIBILITY_CFLAGS into AM_CFLAGS
* Use AC_SEARCH_LIBS(clock_gettime) for pthreads on Linux
2012-11-25 00:27:45 +00:00
Pete Batard
9ceb3bcd5e Misc: Update and shorten various libusbx URLs 2012-08-22 21:42:21 +01:00
Pete Batard
6b33cd4589 Windows: Enable MinGW and MSVC DLL interchangeability
* Because we use the WINAPI calling convention, the def file MUST have the @n
  aliases. There is no way around this as MinGW's .o use decoration always
  for __stdcall, which can't be turned off.
* dlltool must therefore be invoked to create a proper import lib from the .def,
  using the --kill-at option.
* To do that, a CREATE_IMPORT_LIB autotools variable is introduced.
* Note: the .def file is currently maintained manually.
2012-06-08 23:31:56 +01:00
Pete Batard
ff3259b440 Windows: Fix possible crash when using longjmp and gcc 4.6
* With gcc-4.6 the option -fomit-frame-pointer is turned on per default
  even for the win32 target. This results in segfaults for any application
  using setjmp/longjmp and MSVCRT.dll on WinXP.
  See http://gcc.gnu.org/ml/gcc/2011-10/msg00351.html
* Issue reported by Lars Kanis
2012-06-07 11:55:30 +01:00
Pete Batard
0c089c7a14 Autotools: Fix versioning regression in configure.ac
* Because of missing [], "LIBUSB_MICROLIBUSB_RC" was being displayed
  in lieu of version number
* Regression introduced with c9d41fe5f0324d969f758f42843e1fd05859f438
2012-06-05 17:29:46 +01:00
Pete Batard
cf6e68acb1 Core: Add toggleable debug logging
* Also fix a missing space in debug log messages introduced
  with the previous timestamp logging update
2012-06-04 01:31:06 +01:00
Ludovic Rousseau
c9d41fe5f0 Autotools: Apply autoupdate 2.68 recommendations
* Not applied: AC_PREREQ([2.68]) as this doesn't seem
  necessary and 2.68 was released less than 2 years ago.
2012-06-04 01:19:25 +01:00
Peter Stuge
463dda06db Core: Add a timestamping and thread ID to logging 2012-05-06 23:46:34 +01:00
Pete Batard
968df12446 BSD: add NetBSD experimental support
* also improve OS/backend selection in configure.ac
* original libusb patches from Peter Stuge and Xiaofan Chen
2012-04-19 18:01:41 +01:00
Pete Batard
5c311cb2dd Autotools: Fix package name and URLs in configure.ac 2012-03-30 13:04:18 +01:00
Pete Batard
4f9fd6a29a autotools: LT_LANG([Windows Resource]) makes windres check redundant 2012-03-28 00:31:52 +01:00
Martin Pieuchot
c56828857e OpenBSD backend 2012-01-30 10:43:46 +01:00
Xiaofan Chen
d2285744c7 configure.ac: Darwin: Move -lobjc from LIBS to PC_LIBS_PRIVATE
Since commit 40327cd134718475f6cec8935b856d4fdff2099c it is neccessary
to explicitly include -lobjc not only when linking libusb itself, but
also for programs linking statically against libusb. References #63.

See also http://marc.info/?m=132505900202378
2012-01-13 18:07:34 +01:00
Peter Stuge
fa9b682a63 configure.ac: Enable libtool support for Windows Resource language 2011-10-17 16:25:51 +02:00
Peter Stuge
cbc2d7b2de Support release candidate versions in configure.ac and libusb-1.0.rc 2011-10-17 16:25:50 +02:00
Sean McBride
bb8854ff56 configure.ac: Fix #97 clang warning about -fgnu89-inline
Remove the test that sets the flag since GNU89 inline semantics are not
required by libusb.

[stuge: Also remove reference to the test result]
2011-07-24 22:29:09 +02:00
Sean McBride
40327cd134 Darwin: Fix #63 error when apps use Objective-C garbage collection 2011-06-13 22:06:32 +02:00
Peter Stuge
85a14f43e0 Move library version number from configure.ac to libusb/version.h
This is neccessary to support native MS builds. The Windows resource
file libusb/libusb-1.0.rc must include the release version, which was
previously only available after configure had run and had substituted
the numbers into a generated libusb/libusb-1.0.rc file.

The version atoms are now stored as CPP style #defines in libusb/version.h
so that the .rc no longer needs to be generated but can simply include the
header file and access the version information directly.

The m4 macro LU_DEFINE_VERSION_ATOM() was added to configure.ac to get
version atoms from libusb/version.h for use in AC_INIT(). The macro
handles C and C++ style comments in version.h, but can easily be made
to fail by obscuring the file. Please don't do that.

Tested with MinGW using autoconf, and manual compile of libusb-1.0.rc
using RC.EXE Version 5.2.3690.0 from Visual C++ 2005 Express Edition.
2011-06-13 22:06:30 +02:00
Pete Batard
ae675c1f49 Windows: Remove SetupAPI, AdvAPI32 and OLE32 link-time dependencies
* this ensures that libusb dependent applications only need
  to explicitly link against libusb on Windows

The run-time dependency on Cfgmgr32.dll, OLE32.dll and SetupAPI.dll remains.
2011-06-13 22:06:30 +02:00
Peter Stuge
1a2d21fe42 configure.ac: Refactor Windows backend settings into one occurence
The Windows backend is used both with MinGW and Cygwin, and since most
settings are identical they can be set in one place.
2011-06-13 22:01:43 +02:00
Peter Stuge
717f47621d configure.ac: Rename AM_LDFLAGS to LTLDFLAGS and actually use them
The new variable name tries to clarify that libtool is being used.
Linker flags must thus always be specified with -Wl.

Factor out the libtool flag -no-undefined from host specific cases.
The flag is required to build a Windows DLL, but is correct also for
the other supported systems.

Also, start actually using LTLDFLAGS in libusb/Makefile.am, so that
libtool will see the options set by configure.
2011-06-13 22:01:43 +02:00
Peter Stuge
3cbe573646 configure.ac: Clean up PC_LIBS_PRIVATE and AM_LDFLAGS
Move linker options for when linking the library itself from
PC_LIBS_PRIVATE into AM_LDFLAGS. PC_LIBS_PRIVATE should only
contain flags needed to link applications statically against libusb.
Fixes #72.
2011-06-13 22:01:43 +02:00
Peter Stuge
ef39d15105 configure.ac: Call AC_CONFIG_FILES() for each output file
This avoids a problem with Windows line endings.
2011-06-13 22:01:43 +02:00
Peter Stuge
6e52ea0677 configure.ac: Whitespace changes and trivial reordering 2011-06-13 22:01:42 +02:00
Peter Stuge
44b85dabc3 configure.ac: Quote AC_COMPILE_IFELSE() input 2011-06-13 22:01:42 +02:00
Peter Stuge
19d5882c39 configure.ac: Define booleans to 1 when set, instead of an empty string
This makes the generated config.h look a lot nicer.
2011-06-13 22:01:42 +02:00
Peter Stuge
c24649d796 configure.ac: Clean up redundancy and fix LIBS on Linux
LIBS, AM_LDFLAGS, OS_ conditionals and THREADS_POSIX had a bit of
redundancy throughout the file, and on Linux LIBS ended up missing
the -pthread flag.
2011-06-13 22:01:42 +02:00
Peter Stuge
0bd4a4dd89 configure.ac: Touch up Darwin and Cygwin OS messages 2011-06-13 22:01:42 +02:00
Peter Stuge
16cf11a121 configure.ac: Do not use -pthread on Darwin
It's not needed because Darwin has POSIX Threads in libc. Fixes #96.
2011-06-13 22:01:42 +02:00
Peter Stuge
a120747d56 configure.ac: Check for poll.h, and for nfds_t on Darwin
On Linux, assume nfds_t is always available.

On Darwin, fall back to unsigned int when poll() exists but there
is no nfds_t, such as on Mac OS X before 10.4.

On Windows (both MinGW and Cygwin), always use unsigned int instead
of nfds_t, and don't check for poll.h because we use our own poll()
implementation.
2011-06-13 22:01:42 +02:00
Nathan Hjelm
67d9ef7b68 Remove USBI_OS_HANDLES_TIMEOUT and fix int/isoc timeouts on Darwin
Backends set USBI_TRANSFER_OS_HANDLES_TIMEOUT for transfers instead.
Darwin only handles timeouts for bulk and control transfers, so the
backend now sets that flag accordingly, making libusb core handle
timeouts for interrupt and isochronous transfers. Fixes #31.

Signed-off-by: Nathan Hjelm <hjelmn@me.com>

[stuge: rework libusb_get_next_timeout() and enum usbi_transfer_flags]
[stuge: fix typo; set USBI_TRANSFER_TIMED_OUT flag correctly]
2010-11-26 20:47:23 +01:00
Daniel Drake
d7c25451f4 Fix libtool version setting
This was being set too early to take effect.
2010-10-04 20:03:58 +01:00
Mike Frysinger
a6fb54e2ee Populate the pkg-config Libs.private field 2010-10-04 20:01:07 +01:00
Daniel Drake
d192c5bd32 Update libtool version info
With input from various people on the mailing list, update the libtool
versioning info and start to update this on every release.

The next libusb release will not need a change here. All following ones
will.
2010-10-04 18:45:18 +01:00
Daniel Drake
bd623f70d9 MinGW: Use --add-stdcall-alias linker option
Naming of symbols inside the library is inconsistent on Windows:
http://wyw.dcweb.cn/stdcall.htm

Use this linker option to add aliases which add compatibility with
the "MSVC DLL" platform when a DEF file is used. It also better matches
the appearance of the Windows API itself.
2010-09-19 15:09:17 +01:00
Pete Batard
29f9f9e3af Introduced calling convention (for Windows)
Under Windows, a variety of compilers and configurations are available,
meaning that the manner of parameter passing (e.g. registers vs stack)
can vary.

Match the Windows API calling convention and document this appropriately.
This calling convention will be used regardless of the configuration of
the user's development platform.

The only user-level complication is that all functions used as libusb
callbacks must use the same calling convention as libusb. The
LIBUSB_CALL macro is provided to make this easy.

Signed-off-by: Michael Plante <michael.plante@gmail.com>
Signed-off-by: Pete Batard <pbatard@gmail.com>
[dsd: slight change of strategy, add documentation]
2010-08-23 18:48:55 -06:00
Pete Batard
33cd2f68b4 removed trailing whitespaces 2010-08-06 21:44:10 -06:00
Pete Batard
9a4249f8a1 Add Windows support
Via Cygwin/MinGW, libusb now has windows support.
Thanks to contributors: Michael Plante, Orin Eman, Peter Stuge,
Stephan Meyer, Xiaofan Chen.
2010-07-27 20:57:20 -06:00
Daniel Drake
a516fcb993 Only compile dpfp examples when sigaction is available
It's not available on MinGW.
2010-07-22 18:33:37 -06:00
Aurelien Jarno
a1d831ef82 configure.ac: fix bashisms 2010-07-05 21:36:56 -06:00
Daniel Drake
7211aba6e2 Only include sys/time.h on appropriate platforms
This header doesn't exist on windows.
For libusb, determine at configure-time if the header is available.
For libusb.h, use gcc predefined macros to only include the header
on platforms that need it.
2010-06-25 12:01:58 -05:00
Ludovic Rousseau
351c062aac add AM_MAINTAINER_MODE 2010-06-10 17:03:18 -05:00
Peter Stuge
23b5db8b3e Add internal abstraction for POSIX Threads
This prepares for a Windows backend without dependency on pthreads-w32.

pthread_* is renamed to usbi_* and PTHREAD_* to USBI_*.

A usbi_mutex_static_t and usbi_mutex_static_lock() and _unlock() are
introduced for statically initialized mutexes, since they may be
implemented using other types when pthreads mutexes aren't used.

Move -pthread from libusb/Makefile.am to host-specific THREAD_CFLAGS in
configure.ac. This will enable optional use of -lpthread for cygwin.

[dsd: minor tweaks, and roll in a change based on patches from Pete
Batard to only build dpfp_threaded example when we're using pthreads]
2010-05-12 22:11:29 -03:00
Daniel Drake
a04cbb0095 v1.0.8 release 2010-05-04 19:01:59 -03:00
Daniel Drake
3af329db6d v1.0.7 release 2010-04-19 19:36:55 -03:00
Daniel Drake
a4186794d8 v1.0.6 release 2009-11-22 17:20:53 +00:00
Daniel Drake
0bd7ef5d86 Refine timerfd header check (#18)
Require glibc-2.9 for the working timerfd support.
2009-11-21 16:58:31 +00:00
Daniel Drake
90d8fcab90 v1.0.5 release 2009-11-15 12:17:13 +00:00