97 Commits

Author SHA1 Message Date
Sameeh Jubran
020103af78 Windows: Ditch UsbDk build configuration
Previous patch introduced run-time UsbDk backend activation,
therefore separate build configuration is not needed anymore.

Signed-off-by: Sameeh Jubran <sameeh@daynix.com>
2018-01-08 10:18:09 -08:00
Chris Dickens
3001f93477 Misc: Ensure that both WINVER and _WIN32_WINNT are defined for Windows builds
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-01-03 19:19:39 -08:00
Chris Dickens
aa73b2ecb8 linux: Mark internal file descriptors as CLOEXEC
As a library, libusb should take care to be as friendly as possible
with various use cases. One such way is to ensure that internal file
descriptors have the CLOEXEC flag set, thus allowing processes to do
a fork() + exec() without leaking libusb's file descriptors to the
child process.

References #268

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2017-02-28 21:25:25 -08:00
Chris Dickens
cb77a25e51 configure.ac: Remove obsolete AC_ERROR and make formatting consistent
Remove unnecessary quotes around simple string values.
Replace AC_ERROR with AC_MSG_ERROR.
Use [] around arguments to macros.

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2017-02-20 00:22:35 -08:00
Chris Dickens
9417868d94 configure.ac: Clean up style
For consistency, only use quotes for strings where variables are
interpolated.

Also make the check for syslog capability dependent upon whether system
logging has been enabled.

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2017-01-12 15:03:29 -08:00
Chris Dickens
068b594306 core: Remove use of gettimeofday()
Prior to this commit, gettimeofday() was being used for timestamps
in debug messages. This function has been marked as deprecated in
the latest POSIX specification and furthermore is not supported on
Windows, thus requiring our own implementation as usbi_gettimeofday().

This commit changes the logging code to obtain timestamps using the
clock_gettime() function provided by the backend. The implementation of
usbi_gettimeofday() for Windows was actually equivalent to that of the
USBI_CLOCK_REALTIME implementation for clock_gettime(), so this
eliminates code duplication. In addition, the USBI_CLOCK_REALTIME
implementation has been updated for Windows to leverage the
timespec_get() function available in VS 2015 and later.

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2017-01-12 15:03:16 -08:00
Chris Dickens
80f1657f06 core: Remove check for and inclusion of signal.h
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2017-01-12 15:02:59 -08:00
Lei Chen
eefd32213e Solaris backend
Closes #177

Signed-off-by: Nathan Hjelm <hjelmn@me.com>
2016-07-24 20:00:00 -06:00
Nathan Hjelm
2040ab109c configure: bump autoconf version and remove obsolete AM_MAINTAINER_MODE
This commit bumps the minimum autoconf version to 2.69. This only
affects maintainers and will ensure libusb tarballs have up-to-date
configure scripts. At the same time we are removing the
AM_MAINTAINER_MODE macro as even its creator recommends against
using it.

Closes #122

Signed-off-by: Nathan Hjelm <hjelmn@me.com>
2016-03-11 08:45:50 -07:00
Evan Hunter
8e3d41e581 windows: Fix compilation for MSYS2
Closes #140

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2016-02-23 23:09:50 -08:00
Chris Dickens
3f4df898b7 linux_netlink: Remove unnecessary header includes and conditionals
We always require <sys/socket.h> and do not need <linux/filter.h>.

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2016-02-23 22:43:34 -08:00
Dmitry Fleytman
24c5289342 build: Integrate usbdk backend
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2016-01-26 23:38:23 -08:00
Chris Dickens
3dc781ce3e Misc: Simplify Haiku build and fix broken parallel build
The Haiku build was previously being done as a nested package
due to its C++ requirement, but for some reason setting SUBDIR
in an automake conditional breaks parallel builds. To fix this
and simplify the Haiku build process, this commit adds an
unconditional check for a C++ compiler using AC_PROG_CXX and
builds the Haiku sources as part of the main libusb project.

Note that AC_PROG_CXX itself does not cause the configure script
to fail if a C++ compiler is not found. Therefore on non-Haiku
platforms there is no requirement to have a C++ compiler installed
in order to build libusb.

Closes #121

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2015-12-17 01:02:08 -08:00
Venkatesh Shukla
c7401ca1e0 Remove -c flag. Erroneous output caused on android
While cross-building for android, the -c flag was causing errors.
This -c option ends up in Libs.private of libusb-1.0.pc file.
On its usage, it is interpreted as "Compile and assemble, but do not link"
option of gcc. Usage of -c in this way might be unintended.
Hence, removing this option.

Signed-off-by: Venkatesh Shukla <venkatesh.shukla.eee11@iitbhu.ac.in>
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2015-03-01 01:15:58 -08:00
Akshay Jaggi
dc97425bb4 haiku: Add Haiku support 2014-09-25 21:42:16 +01:00
Tormod Volden
4e95d0e7f9 Windows: Define WINVER to fix building on MinGW
* For newer versions of MinGW, VerSetConditionMask() is only defined
  if building for Windows XP (0x501) or newer.
2014-09-03 14:10:42 +01:00
hjelmn@cs.unm.edu
1eff220474 Misc: Revert all references to libusb/libusb.info 2014-01-08 23:51:01 +00:00
Kuangye Guo
7e3de5de09 Android: Add support for Linux/Android platforms
* Closes #154
2013-12-28 23:03:32 +00:00
Gustavo Zacarias
5f366718c4 configure.ac: uclinux is also linux
When the tuple contains uclinux rather than just linux (nommu flat
targets) configure will fail with an unknown operating system.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-09-06 14:15:48 +02:00
Hans de Goede
eb4e7bee44 openbsd: Split openbsd backend into separate openbsd and netbsd backends
Note the new netbsd_usb.c is an unmodified copy of openbsd_usb.c with
s/obsd/netbsd done on it. The reason for this split is that the openbsd
developers have been working on various improvements for their userspace
usb support, and adding support for those means breaking netbsd support,
by giving netbsd its own backend we can add support for the openbsd
improvements without breaking netbsd support.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-08-21 16:18:39 +02:00
Toby Gray
9222a548bd 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.
2013-08-09 01:55:04 +01:00
Nathan Hjelm
83021abc20 Add checks for headers needed by linux/netlink.h
These headers are required by netlink.h. I am not sure how this
worked at all. It certainly doesn't work with older versions of Linux
2.6.

References #124.
2013-07-30 09:10:08 -06:00
Hans de Goede
8ad7e5ad51 configure: Fix --enable-udev help text
We use AC_ARG_ENABLE so the help string should be --enable-udev, so that
the user knows to pass --disable-udev to disable udev

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-05-16 17:18:32 +02:00
Nathan Hjelm
6853291ed0 Add hotplug support to the Linux backend.
There are two ways to configure hotplug support for Linux: udev, and netlink. It
is strongly recommened that udev support is used on systems that utilize udev.
We reenforce this recommendation by defaulting to --with-udev=yes at configure
time. To enable netlink support run configure with --with-udev=no. If udev
support is enabled all device enumeration is done with udev.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-05-15 20:43:32 +02:00
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 c9d41fe5f0
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 40327cd134 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