usb 2.0.0-alpha.1 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. package/.gitattributes +1 -0
  2. package/.gitmodules +1 -1
  3. package/CHANGELOG.md +91 -0
  4. package/README.md +570 -0
  5. package/binding.gyp +2 -2
  6. package/dist/index.d.ts +16 -5
  7. package/dist/index.js +135 -5
  8. package/dist/index.js.map +1 -1
  9. package/dist/usb/bindings.d.ts +13 -0
  10. package/dist/usb/bindings.js +2 -1
  11. package/dist/usb/bindings.js.map +1 -1
  12. package/dist/usb/index.d.ts +0 -2
  13. package/dist/usb/index.js +75 -112
  14. package/dist/usb/index.js.map +1 -1
  15. package/dist/usb/interface.js.map +1 -1
  16. package/dist/webusb/index.d.ts +28 -19
  17. package/dist/webusb/index.js +152 -66
  18. package/dist/webusb/index.js.map +1 -1
  19. package/dist/webusb/webusb-device.d.ts +1 -1
  20. package/dist/webusb/webusb-device.js +15 -6
  21. package/dist/webusb/webusb-device.js.map +1 -1
  22. package/libusb/.private/pre-commit.sh +7 -1
  23. package/libusb/.travis.yml +49 -0
  24. package/libusb/AUTHORS +44 -3
  25. package/libusb/Brewfile +4 -0
  26. package/libusb/ChangeLog +74 -2
  27. package/libusb/README.md +32 -0
  28. package/libusb/TODO +1 -1
  29. package/libusb/Xcode/common.xcconfig +12 -0
  30. package/libusb/Xcode/config.h +0 -3
  31. package/libusb/Xcode/libusb.xcodeproj/project.pbxproj +959 -1
  32. package/libusb/android/README +4 -2
  33. package/libusb/android/config.h +0 -6
  34. package/libusb/appveyor.yml +41 -0
  35. package/libusb/appveyor_cygwin.bat +11 -0
  36. package/libusb/appveyor_minGW.bat +19 -0
  37. package/libusb/autogen.sh +1 -1
  38. package/libusb/bootstrap.sh +3 -16
  39. package/libusb/configure.ac +108 -80
  40. package/libusb/doc/doxygen.cfg.in +1785 -739
  41. package/libusb/examples/Makefile.am +1 -1
  42. package/libusb/examples/dpfp.c +3 -1
  43. package/libusb/examples/dpfp_threaded.c +23 -10
  44. package/libusb/examples/ezusb.c +3 -3
  45. package/libusb/examples/ezusb.h +2 -2
  46. package/libusb/examples/fxload.c +31 -9
  47. package/libusb/examples/hotplugtest.c +35 -7
  48. package/libusb/examples/listdevs.c +3 -1
  49. package/libusb/examples/sam3u_benchmark.c +3 -3
  50. package/libusb/examples/testlibusb.c +277 -0
  51. package/libusb/examples/xusb.c +40 -34
  52. package/libusb/libusb/Makefile.am +49 -23
  53. package/libusb/libusb/core.c +855 -457
  54. package/libusb/libusb/descriptor.c +72 -78
  55. package/libusb/libusb/hotplug.c +122 -76
  56. package/libusb/libusb/hotplug.h +42 -25
  57. package/libusb/libusb/io.c +625 -390
  58. package/libusb/libusb/libusb-1.0.def +12 -0
  59. package/libusb/libusb/libusb.h +218 -150
  60. package/libusb/libusb/libusbi.h +346 -176
  61. package/libusb/libusb/os/darwin_usb.c +604 -319
  62. package/libusb/libusb/os/darwin_usb.h +61 -20
  63. package/libusb/libusb/os/haiku_pollfs.cpp +367 -0
  64. package/libusb/libusb/os/haiku_usb.h +113 -0
  65. package/libusb/libusb/os/haiku_usb_backend.cpp +533 -0
  66. package/libusb/libusb/os/haiku_usb_raw.cpp +267 -0
  67. package/libusb/libusb/os/haiku_usb_raw.h +188 -0
  68. package/libusb/libusb/os/linux_netlink.c +186 -146
  69. package/libusb/libusb/os/linux_udev.c +36 -14
  70. package/libusb/libusb/os/linux_usbfs.c +426 -225
  71. package/libusb/libusb/os/linux_usbfs.h +5 -3
  72. package/libusb/libusb/os/netbsd_usb.c +21 -77
  73. package/libusb/libusb/os/openbsd_usb.c +32 -115
  74. package/libusb/libusb/os/poll_posix.c +38 -5
  75. package/libusb/libusb/os/poll_posix.h +3 -0
  76. package/libusb/libusb/os/poll_windows.c +277 -626
  77. package/libusb/libusb/os/poll_windows.h +11 -44
  78. package/libusb/libusb/os/sunos_usb.c +1695 -0
  79. package/libusb/libusb/os/sunos_usb.h +80 -0
  80. package/libusb/libusb/os/threads_posix.c +24 -26
  81. package/libusb/libusb/os/threads_posix.h +73 -21
  82. package/libusb/libusb/os/threads_windows.c +71 -157
  83. package/libusb/libusb/os/threads_windows.h +68 -44
  84. package/libusb/libusb/os/wince_usb.c +276 -420
  85. package/libusb/libusb/os/wince_usb.h +23 -28
  86. package/libusb/libusb/os/windows_common.h +78 -58
  87. package/libusb/libusb/os/windows_nt_common.c +1010 -0
  88. package/libusb/libusb/os/windows_nt_common.h +110 -0
  89. package/libusb/libusb/os/windows_nt_shared_types.h +147 -0
  90. package/libusb/libusb/os/windows_usbdk.c +830 -0
  91. package/libusb/libusb/os/windows_usbdk.h +103 -0
  92. package/libusb/libusb/os/windows_winusb.c +4391 -0
  93. package/libusb/libusb/os/windows_winusb.h +783 -0
  94. package/libusb/libusb/strerror.c +41 -7
  95. package/libusb/libusb/sync.c +41 -13
  96. package/libusb/libusb/version.h +1 -1
  97. package/libusb/libusb/version_nano.h +1 -1
  98. package/libusb/libusb-1.0.pc.in +1 -1
  99. package/libusb/msvc/appveyor.bat +27 -0
  100. package/libusb/msvc/config.h +5 -4
  101. package/libusb/msvc/ddk_build.cmd +87 -43
  102. package/libusb/msvc/fxload_2010.vcxproj +24 -104
  103. package/libusb/msvc/fxload_2012.vcxproj +24 -107
  104. package/libusb/msvc/fxload_2013.vcxproj +24 -107
  105. package/libusb/msvc/fxload_2015.vcxproj +91 -0
  106. package/libusb/msvc/fxload_2017.vcxproj +114 -0
  107. package/libusb/msvc/fxload_sources +1 -1
  108. package/libusb/msvc/getopt_2010.vcxproj +16 -75
  109. package/libusb/msvc/getopt_2012.vcxproj +16 -79
  110. package/libusb/msvc/getopt_2013.vcxproj +16 -79
  111. package/libusb/msvc/getopt_2015.vcxproj +73 -0
  112. package/libusb/msvc/getopt_2017.vcxproj +98 -0
  113. package/libusb/msvc/getopt_sources +6 -2
  114. package/libusb/msvc/hotplugtest_2010.vcxproj +18 -99
  115. package/libusb/msvc/hotplugtest_2012.vcxproj +18 -102
  116. package/libusb/msvc/hotplugtest_2013.vcxproj +18 -102
  117. package/libusb/msvc/hotplugtest_2015.vcxproj +83 -0
  118. package/libusb/msvc/hotplugtest_2017.vcxproj +106 -0
  119. package/libusb/msvc/hotplugtest_sources +1 -1
  120. package/libusb/msvc/libusb_2005.sln +20 -20
  121. package/libusb/msvc/libusb_2010.sln +57 -46
  122. package/libusb/msvc/libusb_2012.sln +57 -46
  123. package/libusb/msvc/libusb_2013.sln +57 -50
  124. package/libusb/msvc/libusb_2015.sln +59 -52
  125. package/libusb/msvc/libusb_2017.sln +186 -0
  126. package/libusb/msvc/libusb_dll.dsp +2 -2
  127. package/libusb/msvc/libusb_dll_2005.vcproj +30 -2
  128. package/libusb/msvc/libusb_dll_2010.vcxproj +26 -90
  129. package/libusb/msvc/libusb_dll_2012.vcxproj +28 -96
  130. package/libusb/msvc/libusb_dll_2013.vcxproj +28 -96
  131. package/libusb/msvc/libusb_dll_2015.vcxproj +107 -0
  132. package/libusb/msvc/libusb_dll_2017.vcxproj +134 -0
  133. package/libusb/msvc/libusb_dll_wince.vcproj +9 -1
  134. package/libusb/msvc/libusb_sources +10 -5
  135. package/libusb/msvc/libusb_static.dsp +2 -2
  136. package/libusb/msvc/libusb_static_2005.vcproj +32 -4
  137. package/libusb/msvc/libusb_static_2010.vcxproj +24 -83
  138. package/libusb/msvc/libusb_static_2012.vcxproj +25 -87
  139. package/libusb/msvc/libusb_static_2013.vcxproj +25 -87
  140. package/libusb/msvc/libusb_static_2015.vcxproj +98 -0
  141. package/libusb/msvc/libusb_static_2017.vcxproj +117 -0
  142. package/libusb/msvc/libusb_static_wince.vcproj +20 -26
  143. package/libusb/msvc/libusb_wince.sln +88 -88
  144. package/libusb/msvc/listdevs_2010.vcxproj +16 -99
  145. package/libusb/msvc/listdevs_2012.vcxproj +16 -102
  146. package/libusb/msvc/listdevs_2013.vcxproj +16 -102
  147. package/libusb/msvc/listdevs_2015.vcxproj +83 -0
  148. package/libusb/msvc/listdevs_2017.vcxproj +106 -0
  149. package/libusb/msvc/listdevs_sources +2 -1
  150. package/libusb/msvc/stress_2010.vcxproj +20 -101
  151. package/libusb/msvc/stress_2012.vcxproj +20 -104
  152. package/libusb/msvc/stress_2013.vcxproj +20 -104
  153. package/libusb/msvc/stress_2015.vcxproj +87 -0
  154. package/libusb/msvc/stress_2017.vcxproj +110 -0
  155. package/libusb/msvc/stress_sources +21 -0
  156. package/libusb/msvc/testlibusb_2010.vcxproj +82 -0
  157. package/libusb/msvc/testlibusb_2012.vcxproj +83 -0
  158. package/libusb/msvc/testlibusb_2013.vcxproj +83 -0
  159. package/libusb/msvc/testlibusb_2015.vcxproj +83 -0
  160. package/libusb/msvc/testlibusb_2017.vcxproj +106 -0
  161. package/libusb/msvc/testlibusb_sources +20 -0
  162. package/libusb/msvc/xusb_2010.vcxproj +17 -98
  163. package/libusb/msvc/xusb_2012.vcxproj +17 -101
  164. package/libusb/msvc/xusb_2013.vcxproj +17 -101
  165. package/libusb/msvc/xusb_2015.vcxproj +83 -0
  166. package/libusb/msvc/xusb_2017.vcxproj +106 -0
  167. package/libusb/msvc/xusb_sources +1 -1
  168. package/libusb/tests/stress.c +2 -2
  169. package/libusb/tests/testlib.c +0 -4
  170. package/libusb/travis-autogen.sh +39 -0
  171. package/libusb.gypi +13 -2
  172. package/package.json +23 -13
  173. package/prebuilds/android-arm/node.napi.armv7.node +0 -0
  174. package/prebuilds/android-arm64/node.napi.armv8.node +0 -0
  175. package/prebuilds/darwin-x64+arm64/node.napi.node +0 -0
  176. package/prebuilds/linux-arm/node.napi.armv6.node +0 -0
  177. package/prebuilds/linux-arm/node.napi.armv7.node +0 -0
  178. package/prebuilds/linux-arm64/node.napi.armv8.node +0 -0
  179. package/prebuilds/linux-ia32/node.napi.node +0 -0
  180. package/prebuilds/linux-x64/node.napi.glibc.node +0 -0
  181. package/prebuilds/linux-x64/node.napi.musl.node +0 -0
  182. package/prebuilds/win32-ia32/node.napi.node +0 -0
  183. package/prebuilds/win32-x64/node.napi.node +0 -0
  184. package/src/device.cc +7 -7
  185. package/src/node_usb.cc +43 -1
  186. package/src/node_usb.h +1 -0
  187. package/src/uv_async_queue.h +33 -25
  188. package/test/usb.coffee +12 -4
  189. package/tsc/index.ts +68 -8
  190. package/tsc/usb/bindings.ts +19 -1
  191. package/tsc/usb/index.ts +66 -68
  192. package/tsc/usb/interface.ts +2 -2
  193. package/tsc/webusb/index.ts +187 -75
  194. package/tsc/webusb/webusb-device.ts +28 -17
  195. package/.github/workflows/prebuild.yml +0 -48
  196. package/Readme.md +0 -339
  197. package/dist/webusb/typed-event-target.d.ts +0 -11
  198. package/dist/webusb/typed-event-target.js +0 -21
  199. package/dist/webusb/typed-event-target.js.map +0 -1
  200. package/docs/assets/css/main.css +0 -2660
  201. package/docs/assets/images/icons.png +0 -0
  202. package/docs/assets/images/icons@2x.png +0 -0
  203. package/docs/assets/images/widgets.png +0 -0
  204. package/docs/assets/images/widgets@2x.png +0 -0
  205. package/docs/assets/js/main.js +0 -248
  206. package/docs/assets/js/search.js +0 -1
  207. package/docs/classes/usb_bindings.device.html +0 -1338
  208. package/docs/classes/usb_bindings.libusbexception.html +0 -234
  209. package/docs/classes/usb_bindings.transfer.html +0 -344
  210. package/docs/classes/usb_capability.capability.html +0 -297
  211. package/docs/classes/usb_device.extendeddevice.html +0 -766
  212. package/docs/classes/usb_endpoint.endpoint.html +0 -472
  213. package/docs/classes/usb_endpoint.inendpoint.html +0 -766
  214. package/docs/classes/usb_endpoint.outendpoint.html +0 -582
  215. package/docs/classes/usb_interface.interface.html +0 -648
  216. package/docs/classes/webusb.webusb-1.html +0 -615
  217. package/docs/classes/webusb_mutex.mutex.html +0 -270
  218. package/docs/classes/webusb_typed_event_target.typedeventtarget.html +0 -443
  219. package/docs/classes/webusb_webusb_device.webusbdevice.html +0 -904
  220. package/docs/index.html +0 -500
  221. package/docs/interfaces/usb.deviceevents.html +0 -242
  222. package/docs/interfaces/usb_descriptors.bosdescriptor.html +0 -293
  223. package/docs/interfaces/usb_descriptors.capabilitydescriptor.html +0 -274
  224. package/docs/interfaces/usb_descriptors.configdescriptor.html +0 -388
  225. package/docs/interfaces/usb_descriptors.devicedescriptor.html +0 -464
  226. package/docs/interfaces/usb_descriptors.endpointdescriptor.html +0 -370
  227. package/docs/interfaces/usb_descriptors.interfacedescriptor.html +0 -407
  228. package/docs/interfaces/webusb.usboptions.html +0 -226
  229. package/docs/modules/index.html +0 -173
  230. package/docs/modules/usb.html +0 -173
  231. package/docs/modules/usb_bindings.html +0 -2319
  232. package/docs/modules/usb_capability.html +0 -156
  233. package/docs/modules/usb_descriptors.html +0 -176
  234. package/docs/modules/usb_device.html +0 -156
  235. package/docs/modules/usb_endpoint.html +0 -164
  236. package/docs/modules/usb_interface.html +0 -156
  237. package/docs/modules/webusb.html +0 -165
  238. package/docs/modules/webusb_mutex.html +0 -156
  239. package/docs/modules/webusb_typed_event_target.html +0 -156
  240. package/docs/modules/webusb_webusb_device.html +0 -156
  241. package/docs/modules.html +0 -156
  242. package/libusb/INSTALL +0 -234
  243. package/libusb/README +0 -28
  244. package/libusb/libusb/os/windows_usb.c +0 -5347
  245. package/libusb/libusb/os/windows_usb.h +0 -971
  246. package/libusb/msvc/fxload_2010.vcxproj.filters +0 -25
  247. package/libusb/msvc/fxload_2012.vcxproj.filters +0 -25
  248. package/libusb/msvc/getopt_2010.vcxproj.filters +0 -26
  249. package/libusb/msvc/getopt_2012.vcxproj.filters +0 -26
  250. package/libusb/msvc/hotplugtest_2010.vcxproj.filters +0 -14
  251. package/libusb/msvc/hotplugtest_2012.vcxproj.filters +0 -14
  252. package/libusb/msvc/libusb_dll_2010.vcxproj.filters +0 -81
  253. package/libusb/msvc/libusb_dll_2012.vcxproj.filters +0 -84
  254. package/libusb/msvc/libusb_static_2010.vcxproj.filters +0 -74
  255. package/libusb/msvc/libusb_static_2012.vcxproj.filters +0 -74
  256. package/libusb/msvc/listdevs_2010.vcxproj.filters +0 -14
  257. package/libusb/msvc/listdevs_2012.vcxproj.filters +0 -14
  258. package/libusb/msvc/stress_2010.vcxproj.filters +0 -25
  259. package/libusb/msvc/stress_2012.vcxproj.filters +0 -25
  260. package/libusb/msvc/xusb_2010.vcxproj.filters +0 -14
  261. package/libusb/msvc/xusb_2012.vcxproj.filters +0 -14
  262. package/tsc/webusb/typed-event-target.ts +0 -23
@@ -24,8 +24,10 @@ The libusb library, examples and tests can then be found in:
24
24
  Where $ARCH is one of:
25
25
  armeabi
26
26
  armeabi-v7a
27
+ mips
28
+ mips64
27
29
  x86
28
-
30
+ x86_64
29
31
 
30
32
  Installing:
31
33
  -----------
@@ -62,7 +64,7 @@ image of a running device:
62
64
  # Install libusb
63
65
  adb push obj/local/armeabi/libusb1.0.so /sdcard/
64
66
  adb shell su -c "cat > /system/lib/libusb1.0.so < /sdcard/libusb1.0.so"
65
- adb shell rm /system/lib/libusb1.0.so
67
+ adb shell rm /sdcard/libusb1.0.so
66
68
 
67
69
  # Install the samples and tests
68
70
  for B in listdevs fxload xusb sam3u_benchmark hotplugtest stress
@@ -26,9 +26,6 @@
26
26
  /* Define to 1 if you have the <dlfcn.h> header file. */
27
27
  #define HAVE_DLFCN_H 1
28
28
 
29
- /* Define to 1 if you have the `gettimeofday' function. */
30
- #define HAVE_GETTIMEOFDAY 1
31
-
32
29
  /* Define to 1 if you have the <inttypes.h> header file. */
33
30
  #define HAVE_INTTYPES_H 1
34
31
 
@@ -53,9 +50,6 @@
53
50
  /* Define to 1 if you have the <poll.h> header file. */
54
51
  #define HAVE_POLL_H 1
55
52
 
56
- /* Define to 1 if you have the <signal.h> header file. */
57
- #define HAVE_SIGNAL_H 1
58
-
59
53
  /* Define to 1 if you have the <sys/stat.h> header file. */
60
54
  #define HAVE_SYS_STAT_H 1
61
55
 
@@ -0,0 +1,41 @@
1
+ version: 1.0.{build}
2
+ configuration:
3
+ - Debug
4
+ - Release
5
+ platform:
6
+ - x64
7
+ - Win32
8
+ build:
9
+ project: msvc\libusb_2013.sln
10
+ parallel: true
11
+ verbosity: detailed
12
+ environment:
13
+ matrix:
14
+ - libusb_2015: msvc\libusb_2015.sln
15
+ libusb_2013: msvc\libusb_2013.sln
16
+ libusb_2012: msvc\libusb_2012.sln
17
+ libusb_2010: msvc\libusb_2010.sln
18
+ install:
19
+
20
+ - cmd: >-
21
+ rem Copying libusb to cygwin home directory
22
+
23
+ xcopy /S C:\projects\libusb C:\cygwin\home\appveyor\
24
+
25
+ rem Copying libusb to MinGW home directory
26
+
27
+ xcopy /S C:\projects\libusb C:\msys64\home\appveyor\
28
+
29
+ build_script:
30
+ - cmd: >-
31
+ msbuild %libusb_2015% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
32
+
33
+ msbuild %libusb_2013% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
34
+
35
+ msbuild %libusb_2012% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
36
+
37
+ msvc/appveyor.bat
38
+
39
+ appveyor_minGW.bat
40
+
41
+ appveyor_cygwin.bat
@@ -0,0 +1,11 @@
1
+ echo on
2
+ SetLocal EnableDelayedExpansion
3
+
4
+ if [%Configuration%] NEQ [Release] exit 0
5
+ if [%Platform%] NEQ [Win32] exit 0
6
+
7
+ C:\cygwin\bin\bash -e -l -c "./bootstrap.sh" || exit /B
8
+ C:\cygwin\bin\bash -e -l -c "mkdir build-Win32-cygwin" || exit /B
9
+ C:\cygwin\bin\bash -e -l -c "cd build-Win32-cygwin && ../configure --enable-examples-build --enable-tests-build" || exit /B
10
+ C:\cygwin\bin\bash -e -l -c "cd build-Win32-cygwin && make -j4" || exit /B
11
+ C:\cygwin\bin\bash -e -l -c "cd build-Win32-cygwin && make install" || exit /B
@@ -0,0 +1,19 @@
1
+ echo on
2
+ SetLocal EnableDelayedExpansion
3
+
4
+ if [%Configuration%] NEQ [Release] exit 0
5
+
6
+ if [%Platform%] NEQ [x64] goto Win32
7
+ C:\msys64\usr\bin\bash -e -l -c "./bootstrap.sh" || exit /B
8
+ C:\msys64\usr\bin\bash -e -l -c "mkdir build-x64" || exit /B
9
+ C:\msys64\usr\bin\bash -e -l -c "cd build-x64 && ../configure --prefix=/mingw64 --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32" || exit /B
10
+ C:\msys64\usr\bin\bash -e -l -c "cd build-x64 && make -j4" || exit /B
11
+ C:\msys64\usr\bin\bash -e -l -c "cd build-x64 && make install" || exit /B
12
+
13
+ :Win32
14
+ if [%Platform%] NEQ [Win32] exit 0
15
+ C:\msys64\usr\bin\bash -e -l -c "./bootstrap.sh" || exit /B
16
+ C:\msys64\usr\bin\bash -e -l -c "mkdir build-Win32" || exit /B
17
+ C:\msys64\usr\bin\bash -e -l -c "cd build-Win32 && ../configure --prefix=/mingw32 --build=i686-w64-mingw32 --host=i686-w64-mingw32" || exit /B
18
+ C:\msys64\usr\bin\bash -e -l -c "cd build-Win32 && make -j4" || exit /B
19
+ C:\msys64\usr\bin\bash -e -l -c "cd build-Win32 && make install" || exit /B
package/libusb/autogen.sh CHANGED
@@ -4,5 +4,5 @@ set -e
4
4
 
5
5
  ./bootstrap.sh
6
6
  if test -z "$NOCONFIGURE"; then
7
- exec ./configure --enable-maintainer-mode --enable-examples-build --enable-tests-build "$@"
7
+ exec ./configure --enable-examples-build --enable-tests-build "$@"
8
8
  fi
@@ -1,19 +1,6 @@
1
1
  #!/bin/sh
2
2
 
3
- set -e
4
-
5
- # use libtoolize if available, otherwise look for glibtoolize (darwin)
6
- if (libtoolize --version) < /dev/null > /dev/null 2>&1; then
7
- LIBTOOLIZE=libtoolize
8
- elif (glibtoolize --version) < /dev/null > /dev/null 2>&1; then
9
- LIBTOOLIZE=glibtoolize
10
- else
11
- echo "libtoolize or glibtoolize was not found! Please install libtool." 1>&2
12
- exit 1
3
+ if ! test -d m4 ; then
4
+ mkdir m4
13
5
  fi
14
-
15
- $LIBTOOLIZE --copy --force || exit 1
16
- aclocal || exit 1
17
- autoheader || exit 1
18
- autoconf || exit 1
19
- automake -a -c || exit 1
6
+ autoreconf -ivf || exit 1
@@ -21,21 +21,21 @@ AC_INIT([libusb],[LIBUSB_MAJOR[.]LIBUSB_MINOR[.]LIBUSB_MICRO[]LIBUSB_RC],[libusb
21
21
  # These numbers should be tweaked on every release. Read carefully:
22
22
  # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
23
23
  # http://sourceware.org/autobook/autobook/autobook_91.html
24
- lt_current="1"
25
- lt_revision="0"
26
- lt_age="1"
24
+ lt_current=2
25
+ lt_revision=0
26
+ lt_age=2
27
27
  LTLDFLAGS="-version-info ${lt_current}:${lt_revision}:${lt_age}"
28
28
 
29
29
  AM_INIT_AUTOMAKE
30
- AM_MAINTAINER_MODE
31
30
 
32
31
  AC_CONFIG_SRCDIR([libusb/core.c])
33
32
  AC_CONFIG_MACRO_DIR([m4])
34
33
  AC_CONFIG_HEADERS([config.h])
35
34
  m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
36
35
 
37
- AC_PREREQ([2.50])
36
+ AC_PREREQ([2.69])
38
37
  AC_PROG_CC
38
+ AC_PROG_CXX
39
39
  LT_INIT
40
40
  LT_LANG([Windows Resource])
41
41
  AC_C_INLINE
@@ -50,87 +50,87 @@ dnl on linux-android platform, some functions are in different places
50
50
  case $host in
51
51
  *-linux-android*)
52
52
  AC_MSG_RESULT([This is a Linux-Android system])
53
- is_backend_android="yes"
53
+ is_backend_android=yes
54
54
  ;;
55
55
  *)
56
- is_backend_android="no"
56
+ is_backend_android=no
57
57
  esac
58
58
 
59
59
  case $host in
60
60
  *-linux* | *-uclinux*)
61
61
  AC_MSG_RESULT([Linux])
62
- backend="linux"
63
- threads="posix"
62
+ backend=linux
63
+ threads=posix
64
64
  ;;
65
65
  *-darwin*)
66
66
  AC_MSG_RESULT([Darwin/Mac OS X])
67
- backend="darwin"
68
- threads="posix"
67
+ backend=darwin
68
+ threads=posix
69
69
  ;;
70
70
  *-openbsd*)
71
71
  AC_MSG_RESULT([OpenBSD])
72
- backend="openbsd"
73
- threads="posix"
72
+ backend=openbsd
73
+ threads=posix
74
74
  ;;
75
75
  *-netbsd*)
76
76
  AC_MSG_RESULT([NetBSD])
77
- backend="netbsd"
78
- threads="posix"
77
+ backend=netbsd
78
+ threads=posix
79
79
  ;;
80
- *-mingw*)
80
+ *-mingw* | *msys*)
81
81
  AC_MSG_RESULT([Windows])
82
- backend="windows"
83
- threads="windows"
84
- create_import_lib="yes"
82
+ backend=windows
83
+ threads=windows
84
+ create_import_lib=yes
85
85
  AM_CFLAGS="${AM_CFLAGS} -fno-omit-frame-pointer"
86
86
  ;;
87
87
  *-cygwin*)
88
88
  AC_MSG_RESULT([Cygwin (using Windows backend)])
89
- backend="windows"
90
- threads="posix"
89
+ backend=windows
90
+ threads=posix
91
+ ;;
92
+ *-haiku*)
93
+ AC_MSG_RESULT([Haiku])
94
+ backend=haiku
95
+ threads=posix
96
+ ;;
97
+ *-solaris*)
98
+ AC_MSG_RESULT([SunOS])
99
+ backend=sunos
100
+ threads=posix
91
101
  ;;
92
102
  *)
93
- AC_MSG_ERROR([unsupported operating system])
103
+ AC_MSG_ERROR([unsupported operating system $host])
94
104
  esac
95
105
 
96
106
  case $backend in
97
107
  linux)
98
108
  AC_DEFINE(OS_LINUX, 1, [Linux backend])
99
109
  AC_SUBST(OS_LINUX)
100
- AC_SEARCH_LIBS(clock_gettime, rt, [], [], -pthread)
110
+ AC_SEARCH_LIBS([clock_gettime], [rt], [], [], [-pthread])
101
111
  AC_ARG_ENABLE([udev],
102
112
  [AC_HELP_STRING([--enable-udev], [use udev for device enumeration and hotplug support (recommended) [default=yes]])],
103
- [], [enable_udev="yes"])
104
- if test "x$enable_udev" = "xyes" ; then
113
+ [], [enable_udev=yes])
114
+ if test "x$enable_udev" = xyes ; then
105
115
  # system has udev. use it or fail!
106
- AC_CHECK_HEADERS([libudev.h],[],[AC_ERROR(["udev support requested but libudev not installed"])])
107
- AC_CHECK_LIB([udev], [udev_new], [], [AC_ERROR(["udev support requested but libudev not installed"])])
116
+ AC_CHECK_HEADERS([libudev.h], [], [AC_MSG_ERROR([udev support requested but libudev header not installed])])
117
+ AC_CHECK_LIB([udev], [udev_new], [], [AC_MSG_ERROR([udev support requested but libudev not installed])])
108
118
  AC_DEFINE(USE_UDEV, 1, [Use udev for device enumeration/hotplug])
109
119
  else
110
- AC_CHECK_HEADERS([asm/types.h sys/socket.h], [], [])
111
- AC_CHECK_HEADERS([linux/netlink.h linux/filter.h], [], [AC_ERROR(["Linux netlink headers not found"])], [
120
+ AC_CHECK_HEADERS([asm/types.h], [], [])
121
+ AC_CHECK_HEADERS([sys/socket.h linux/netlink.h], [], [AC_MSG_ERROR([Linux netlink headers not found])], [
112
122
  #ifdef HAVE_ASM_TYPES_H
113
123
  #include <asm/types.h>
114
124
  #endif
115
- #ifdef HAVE_SYS_SOCKET_H
116
125
  #include <sys/socket.h>
117
- #endif
118
126
  ])
119
127
  fi
120
128
  AC_SUBST(USE_UDEV)
121
129
 
122
- case $is_backend_android in
123
- yes)
124
- dnl some pthread functions is in libc
125
- THREAD_CFLAGS="-c"
126
- LIBS="${LIBS} -c"
127
- dnl there are gettimeofday function but configure doesn't seem to be able to find it.
128
- AC_DEFINE([HAVE_GETTIMEOFDAY], [1], [Define if you have gettimeofday])
129
- ;;
130
- *)
131
- THREAD_CFLAGS="-pthread"
132
- LIBS="${LIBS} -pthread"
133
- esac
130
+ if test "x$is_backend_android" != xyes; then
131
+ THREAD_CFLAGS="-pthread"
132
+ LIBS="${LIBS} -pthread"
133
+ fi
134
134
 
135
135
  AC_CHECK_HEADERS([poll.h])
136
136
  AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])
@@ -154,6 +154,14 @@ openbsd)
154
154
  AC_CHECK_HEADERS([poll.h])
155
155
  AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])
156
156
  ;;
157
+ sunos)
158
+ AC_DEFINE(OS_SUNOS, 1, [SunOS backend])
159
+ AC_SUBST(OS_SUNOS)
160
+ THREAD_CFLAGS="-pthread"
161
+ LIBS="-pthread -ldevinfo"
162
+ AC_CHECK_HEADERS([poll.h])
163
+ AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])
164
+ ;;
157
165
  netbsd)
158
166
  AC_DEFINE(OS_NETBSD, 1, [NetBSD backend])
159
167
  AC_SUBST(OS_NETBSD)
@@ -169,6 +177,14 @@ windows)
169
177
  LTLDFLAGS="${LTLDFLAGS} -avoid-version -Wl,--add-stdcall-alias"
170
178
  AC_DEFINE([POLL_NFDS_TYPE],[unsigned int],[type of second poll() argument])
171
179
  AC_DEFINE([WINVER], 0x0501, [Oldest Windows version supported])
180
+ AC_DEFINE([_WIN32_WINNT], 0x0501, [Oldest Windows version supported])
181
+ ;;
182
+ haiku)
183
+ AC_DEFINE(OS_HAIKU, 1, [Haiku backend])
184
+ AC_SUBST(OS_HAIKU)
185
+ LIBS="${LIBS} -lbe"
186
+ AC_CHECK_HEADERS([poll.h])
187
+ AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])
172
188
  ;;
173
189
  esac
174
190
 
@@ -177,12 +193,14 @@ AC_SUBST(LIBS)
177
193
  AM_CONDITIONAL(OS_LINUX, test "x$backend" = xlinux)
178
194
  AM_CONDITIONAL(OS_DARWIN, test "x$backend" = xdarwin)
179
195
  AM_CONDITIONAL(OS_OPENBSD, test "x$backend" = xopenbsd)
196
+ AM_CONDITIONAL(OS_SUNOS, test "x$backend" = xsunos)
180
197
  AM_CONDITIONAL(OS_NETBSD, test "x$backend" = xnetbsd)
181
198
  AM_CONDITIONAL(OS_WINDOWS, test "x$backend" = xwindows)
199
+ AM_CONDITIONAL(OS_HAIKU, test "x$backend" = xhaiku)
182
200
  AM_CONDITIONAL(THREADS_POSIX, test "x$threads" = xposix)
183
- AM_CONDITIONAL(CREATE_IMPORT_LIB, test "x$create_import_lib" = "xyes")
201
+ AM_CONDITIONAL(CREATE_IMPORT_LIB, test "x$create_import_lib" = xyes)
184
202
  AM_CONDITIONAL(USE_UDEV, test "x$enable_udev" = xyes)
185
- if test "$threads" = posix; then
203
+ if test "x$threads" = xposix; then
186
204
  AC_DEFINE(THREADS_POSIX, 1, [Use POSIX Threads])
187
205
  fi
188
206
 
@@ -191,22 +209,22 @@ AC_CHECK_HEADER([sys/timerfd.h], [timerfd_h=1], [timerfd_h=0])
191
209
  AC_ARG_ENABLE([timerfd],
192
210
  [AS_HELP_STRING([--enable-timerfd],
193
211
  [use timerfd for timing [default=auto]])],
194
- [use_timerfd=$enableval], [use_timerfd='auto'])
212
+ [use_timerfd=$enableval], [use_timerfd=auto])
195
213
 
196
- if test "x$use_timerfd" = "xyes" -a "x$timerfd_h" = "x0"; then
214
+ if test "x$use_timerfd" = xyes -a "x$timerfd_h" = x0; then
197
215
  AC_MSG_ERROR([timerfd header not available; glibc 2.9+ required])
198
216
  fi
199
217
 
200
- AC_CHECK_DECL([TFD_NONBLOCK], [tfd_hdr_ok=yes], [tfd_hdr_ok=no], [#include <sys/timerfd.h>])
201
- if test "x$use_timerfd" = "xyes" -a "x$tfd_hdr_ok" = "xno"; then
218
+ AC_CHECK_DECLS([TFD_NONBLOCK, TFD_CLOEXEC], [tfd_hdr_ok=yes], [tfd_hdr_ok=no], [#include <sys/timerfd.h>])
219
+ if test "x$use_timerfd" = xyes -a "x$tfd_hdr_ok" = xno; then
202
220
  AC_MSG_ERROR([timerfd header not usable; glibc 2.9+ required])
203
221
  fi
204
222
 
205
223
  AC_MSG_CHECKING([whether to use timerfd for timing])
206
- if test "x$use_timerfd" = "xno"; then
224
+ if test "x$use_timerfd" = xno; then
207
225
  AC_MSG_RESULT([no (disabled by user)])
208
226
  else
209
- if test "x$timerfd_h" = "x1" -a "x$tfd_hdr_ok" = "xyes"; then
227
+ if test "x$timerfd_h" = x1 -a "x$tfd_hdr_ok" = xyes; then
210
228
  AC_MSG_RESULT([yes])
211
229
  AC_DEFINE(USBI_TIMERFD_AVAILABLE, 1, [timerfd headers available])
212
230
  else
@@ -214,52 +232,60 @@ else
214
232
  fi
215
233
  fi
216
234
 
217
- AC_CHECK_TYPES(struct timespec)
235
+ AC_CHECK_FUNCS([pipe2])
236
+ AC_CHECK_TYPES([struct timespec])
218
237
 
219
238
  # Message logging
220
239
  AC_ARG_ENABLE([log], [AS_HELP_STRING([--disable-log], [disable all logging])],
221
240
  [log_enabled=$enableval],
222
- [log_enabled='yes'])
223
- if test "x$log_enabled" != "xno"; then
241
+ [log_enabled=yes])
242
+ if test "x$log_enabled" != xno; then
224
243
  AC_DEFINE([ENABLE_LOGGING], 1, [Message logging])
225
244
  fi
226
245
 
227
246
  AC_ARG_ENABLE([debug-log], [AS_HELP_STRING([--enable-debug-log],
228
247
  [start with debug message logging enabled [default=no]])],
229
248
  [debug_log_enabled=$enableval],
230
- [debug_log_enabled='no'])
231
- if test "x$debug_log_enabled" != "xno"; then
249
+ [debug_log_enabled=no])
250
+ if test "x$debug_log_enabled" != xno; then
232
251
  AC_DEFINE([ENABLE_DEBUG_LOGGING], 1, [Start with debug message logging enabled])
233
252
  fi
234
253
 
235
254
  AC_ARG_ENABLE([system-log], [AS_HELP_STRING([--enable-system-log],
236
255
  [output logging messages to system wide log, if supported by the OS [default=no]])],
237
256
  [system_log_enabled=$enableval],
238
- [system_log_enabled='no'])
239
- if test "x$system_log_enabled" != "xno"; then
257
+ [system_log_enabled=no])
258
+ if test "x$system_log_enabled" != xno; then
240
259
  AC_DEFINE([USE_SYSTEM_LOGGING_FACILITY], 1, [Enable output to system log])
241
- fi
242
260
 
243
- # Check if syslog is available in standard C library
244
- AC_CHECK_HEADERS(syslog.h)
245
- AC_CHECK_FUNC([syslog], [have_syslog=yes], [have_syslog=no])
246
- if test "x$have_syslog" != "xno"; then
247
- AC_DEFINE([HAVE_SYSLOG_FUNC], 1, [syslog() function available])
261
+ # Check if syslog is available in standard C library
262
+ AC_CHECK_HEADERS(syslog.h)
263
+ AC_CHECK_FUNC([syslog], [have_syslog=yes], [have_syslog=no])
264
+ if test "x$have_syslog" != xno; then
265
+ AC_DEFINE([HAVE_SYSLOG_FUNC], 1, [syslog() function available])
266
+ fi
248
267
  fi
249
268
 
250
269
  # Examples build
251
270
  AC_ARG_ENABLE([examples-build], [AS_HELP_STRING([--enable-examples-build],
252
271
  [build example applications [default=no]])],
253
272
  [build_examples=$enableval],
254
- [build_examples='no'])
255
- AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$build_examples" != "xno"])
273
+ [build_examples=no])
274
+ AM_CONDITIONAL(BUILD_EXAMPLES, test "x$build_examples" != xno)
256
275
 
257
276
  # Tests build
258
277
  AC_ARG_ENABLE([tests-build], [AS_HELP_STRING([--enable-tests-build],
259
278
  [build test applications [default=no]])],
260
279
  [build_tests=$enableval],
261
- [build_tests='no'])
262
- AM_CONDITIONAL([BUILD_TESTS], [test "x$build_tests" != "xno"])
280
+ [build_tests=no])
281
+ AM_CONDITIONAL(BUILD_TESTS, test "x$build_tests" != xno)
282
+
283
+ # headers not available on all platforms but required on others
284
+ AC_CHECK_HEADERS([sys/time.h])
285
+
286
+ # sigaction not available on MinGW
287
+ AC_CHECK_FUNC([sigaction], [have_sigaction=yes], [have_sigaction=no])
288
+ AM_CONDITIONAL(HAVE_SIGACTION, test "x$have_sigaction" = xyes)
263
289
 
264
290
  # check for -fvisibility=hidden compiler support (GCC >= 3.4)
265
291
  saved_cflags="$CFLAGS"
@@ -267,9 +293,9 @@ saved_cflags="$CFLAGS"
267
293
  CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
268
294
  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
269
295
  [VISIBILITY_CFLAGS="-fvisibility=hidden"
270
- AC_DEFINE([DEFAULT_VISIBILITY], [__attribute__((visibility("default")))], [Default visibility]) ],
271
- [ VISIBILITY_CFLAGS=""
272
- AC_DEFINE([DEFAULT_VISIBILITY], [], [Default visibility]) ],
296
+ AC_DEFINE([DEFAULT_VISIBILITY], [__attribute__((visibility("default")))], [Default visibility])],
297
+ [VISIBILITY_CFLAGS=""
298
+ AC_DEFINE([DEFAULT_VISIBILITY], [], [Default visibility])],
273
299
  ])
274
300
  CFLAGS="$saved_cflags"
275
301
 
@@ -280,16 +306,18 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
280
306
  nopointersign_cflags="-Wno-pointer-sign", nopointersign_cflags="")
281
307
  CFLAGS="$saved_cflags"
282
308
 
283
- # sigaction not available on MinGW
284
- AC_CHECK_FUNC([sigaction], [have_sigaction=yes], [have_sigaction=no])
285
- AM_CONDITIONAL([HAVE_SIGACTION], [test "x$have_sigaction" = "xyes"])
286
-
287
- # headers not available on all platforms but required on others
288
- AC_CHECK_HEADERS([sys/time.h])
289
- AC_CHECK_FUNCS(gettimeofday)
290
- AC_CHECK_HEADERS([signal.h])
309
+ # check for -std=gnu99 compiler support
310
+ saved_cflags="$CFLAGS"
311
+ CFLAGS="-std=gnu99"
312
+ AC_MSG_CHECKING([whether CC supports -std=gnu99])
313
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
314
+ [AC_MSG_RESULT([yes])]
315
+ [AM_CFLAGS="${AM_CFLAGS} -std=gnu99"],
316
+ [AC_MSG_RESULT([no])]
317
+ )
318
+ CFLAGS="$saved_cflags"
291
319
 
292
- AM_CFLAGS="${AM_CFLAGS} -std=gnu99 -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration $nopointersign_cflags -Wshadow ${THREAD_CFLAGS} ${VISIBILITY_CFLAGS}"
320
+ AM_CFLAGS="${AM_CFLAGS} -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration $nopointersign_cflags -Wshadow ${THREAD_CFLAGS} ${VISIBILITY_CFLAGS}"
293
321
 
294
322
  AC_SUBST(AM_CFLAGS)
295
323
  AC_SUBST(LTLDFLAGS)