usb 2.17.0 → 3.0.0-alpha.2

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 (207) hide show
  1. package/LICENSE +18 -4
  2. package/README.md +25 -516
  3. package/dist/index.d.ts +67 -13
  4. package/dist/index.js +333 -64
  5. package/index.d.ts +89 -0
  6. package/index.js +583 -0
  7. package/package.json +53 -33
  8. package/CHANGELOG.md +0 -294
  9. package/binding.gyp +0 -128
  10. package/dist/index.js.map +0 -1
  11. package/dist/usb/bindings.d.ts +0 -266
  12. package/dist/usb/bindings.js +0 -10
  13. package/dist/usb/bindings.js.map +0 -1
  14. package/dist/usb/capability.d.ts +0 -13
  15. package/dist/usb/capability.js +0 -17
  16. package/dist/usb/capability.js.map +0 -1
  17. package/dist/usb/descriptors.d.ts +0 -128
  18. package/dist/usb/descriptors.js +0 -3
  19. package/dist/usb/descriptors.js.map +0 -1
  20. package/dist/usb/device.d.ts +0 -100
  21. package/dist/usb/device.js +0 -297
  22. package/dist/usb/device.js.map +0 -1
  23. package/dist/usb/endpoint.d.ts +0 -94
  24. package/dist/usb/endpoint.js +0 -219
  25. package/dist/usb/endpoint.js.map +0 -1
  26. package/dist/usb/index.d.ts +0 -31
  27. package/dist/usb/index.js +0 -116
  28. package/dist/usb/index.js.map +0 -1
  29. package/dist/usb/interface.d.ts +0 -80
  30. package/dist/usb/interface.js +0 -133
  31. package/dist/usb/interface.js.map +0 -1
  32. package/dist/webusb/index.d.ts +0 -64
  33. package/dist/webusb/index.js +0 -295
  34. package/dist/webusb/index.js.map +0 -1
  35. package/dist/webusb/webusb-device.d.ts +0 -54
  36. package/dist/webusb/webusb-device.js +0 -434
  37. package/dist/webusb/webusb-device.js.map +0 -1
  38. package/libusb/.clang-tidy +0 -34
  39. package/libusb/.codespellrc +0 -3
  40. package/libusb/.private/README.txt +0 -5
  41. package/libusb/.private/appveyor_build.sh +0 -26
  42. package/libusb/.private/bm.sh +0 -54
  43. package/libusb/.private/ci-build.sh +0 -92
  44. package/libusb/.private/ci-container-build.sh +0 -67
  45. package/libusb/.private/post-rewrite.sh +0 -32
  46. package/libusb/.private/pre-commit.sh +0 -52
  47. package/libusb/.private/wbs.txt +0 -43
  48. package/libusb/.travis.yml +0 -58
  49. package/libusb/AUTHORS +0 -231
  50. package/libusb/COPYING +0 -504
  51. package/libusb/ChangeLog +0 -365
  52. package/libusb/HACKING +0 -25
  53. package/libusb/INSTALL_WIN.txt +0 -52
  54. package/libusb/KEYS +0 -123
  55. package/libusb/Makefile.am +0 -50
  56. package/libusb/NEWS +0 -2
  57. package/libusb/PORTING +0 -94
  58. package/libusb/README +0 -29
  59. package/libusb/README.git +0 -41
  60. package/libusb/TODO +0 -2
  61. package/libusb/Xcode/common.xcconfig +0 -92
  62. package/libusb/Xcode/config.h +0 -31
  63. package/libusb/Xcode/debug.xcconfig +0 -32
  64. package/libusb/Xcode/libusb.xcconfig +0 -21
  65. package/libusb/Xcode/libusb.xcodeproj/project.pbxproj +0 -1391
  66. package/libusb/Xcode/libusb_debug.xcconfig +0 -21
  67. package/libusb/Xcode/libusb_release.xcconfig +0 -21
  68. package/libusb/Xcode/release.xcconfig +0 -30
  69. package/libusb/android/README +0 -152
  70. package/libusb/android/config.h +0 -55
  71. package/libusb/android/examples/unrooted_android.c +0 -301
  72. package/libusb/android/examples/unrooted_android.h +0 -36
  73. package/libusb/android/jni/Android.mk +0 -23
  74. package/libusb/android/jni/Application.mk +0 -40
  75. package/libusb/android/jni/examples.mk +0 -168
  76. package/libusb/android/jni/libusb.mk +0 -60
  77. package/libusb/android/jni/tests.mk +0 -45
  78. package/libusb/appveyor.yml +0 -108
  79. package/libusb/autogen.sh +0 -10
  80. package/libusb/bootstrap.sh +0 -10
  81. package/libusb/configure.ac +0 -450
  82. package/libusb/doc/Makefile.in +0 -22
  83. package/libusb/doc/doxygen.cfg.in +0 -2571
  84. package/libusb/doc/libusb.png +0 -0
  85. package/libusb/examples/Makefile.am +0 -12
  86. package/libusb/examples/dpfp.c +0 -711
  87. package/libusb/examples/ezusb.c +0 -846
  88. package/libusb/examples/ezusb.h +0 -109
  89. package/libusb/examples/fxload.c +0 -310
  90. package/libusb/examples/hotplugtest.c +0 -147
  91. package/libusb/examples/listdevs.c +0 -73
  92. package/libusb/examples/sam3u_benchmark.c +0 -228
  93. package/libusb/examples/testlibusb.c +0 -312
  94. package/libusb/examples/xusb.c +0 -1254
  95. package/libusb/libusb/Makefile.am +0 -98
  96. package/libusb/libusb/Makefile.am.extra +0 -26
  97. package/libusb/libusb/core.c +0 -2925
  98. package/libusb/libusb/descriptor.c +0 -1558
  99. package/libusb/libusb/hotplug.c +0 -489
  100. package/libusb/libusb/io.c +0 -2865
  101. package/libusb/libusb/libusb-1.0.def +0 -199
  102. package/libusb/libusb/libusb-1.0.rc +0 -53
  103. package/libusb/libusb/libusb.h +0 -2421
  104. package/libusb/libusb/libusbi.h +0 -1535
  105. package/libusb/libusb/os/darwin_usb.c +0 -2977
  106. package/libusb/libusb/os/darwin_usb.h +0 -156
  107. package/libusb/libusb/os/emscripten_webusb.cpp +0 -875
  108. package/libusb/libusb/os/events_posix.c +0 -340
  109. package/libusb/libusb/os/events_posix.h +0 -62
  110. package/libusb/libusb/os/events_windows.c +0 -214
  111. package/libusb/libusb/os/events_windows.h +0 -46
  112. package/libusb/libusb/os/haiku_pollfs.cpp +0 -372
  113. package/libusb/libusb/os/haiku_usb.h +0 -113
  114. package/libusb/libusb/os/haiku_usb_backend.cpp +0 -532
  115. package/libusb/libusb/os/haiku_usb_raw.cpp +0 -231
  116. package/libusb/libusb/os/haiku_usb_raw.h +0 -188
  117. package/libusb/libusb/os/linux_netlink.c +0 -401
  118. package/libusb/libusb/os/linux_udev.c +0 -321
  119. package/libusb/libusb/os/linux_usbfs.c +0 -2829
  120. package/libusb/libusb/os/linux_usbfs.h +0 -221
  121. package/libusb/libusb/os/netbsd_usb.c +0 -617
  122. package/libusb/libusb/os/null_usb.c +0 -111
  123. package/libusb/libusb/os/openbsd_usb.c +0 -700
  124. package/libusb/libusb/os/sunos_usb.c +0 -1619
  125. package/libusb/libusb/os/sunos_usb.h +0 -79
  126. package/libusb/libusb/os/threads_posix.c +0 -126
  127. package/libusb/libusb/os/threads_posix.h +0 -98
  128. package/libusb/libusb/os/threads_windows.c +0 -40
  129. package/libusb/libusb/os/threads_windows.h +0 -113
  130. package/libusb/libusb/os/windows_common.c +0 -923
  131. package/libusb/libusb/os/windows_common.h +0 -424
  132. package/libusb/libusb/os/windows_usbdk.c +0 -724
  133. package/libusb/libusb/os/windows_usbdk.h +0 -106
  134. package/libusb/libusb/os/windows_winusb.c +0 -4766
  135. package/libusb/libusb/os/windows_winusb.h +0 -787
  136. package/libusb/libusb/strerror.c +0 -223
  137. package/libusb/libusb/sync.c +0 -342
  138. package/libusb/libusb/version.h +0 -18
  139. package/libusb/libusb/version_nano.h +0 -1
  140. package/libusb/libusb-1.0.pc.in +0 -11
  141. package/libusb/msvc/Base.props +0 -60
  142. package/libusb/msvc/Configuration.Application.props +0 -7
  143. package/libusb/msvc/Configuration.Base.props +0 -47
  144. package/libusb/msvc/Configuration.DynamicLibrary.props +0 -21
  145. package/libusb/msvc/Configuration.StaticLibrary.props +0 -7
  146. package/libusb/msvc/ProjectConfigurations.Base.props +0 -69
  147. package/libusb/msvc/build_all.ps1 +0 -17
  148. package/libusb/msvc/config.h +0 -58
  149. package/libusb/msvc/dpfp.vcxproj +0 -33
  150. package/libusb/msvc/dpfp_threaded.vcxproj +0 -38
  151. package/libusb/msvc/fxload.vcxproj +0 -46
  152. package/libusb/msvc/getopt/getopt.c +0 -1060
  153. package/libusb/msvc/getopt/getopt.h +0 -180
  154. package/libusb/msvc/getopt/getopt1.c +0 -188
  155. package/libusb/msvc/getopt.vcxproj +0 -33
  156. package/libusb/msvc/hotplugtest.vcxproj +0 -32
  157. package/libusb/msvc/init_context.vcxproj +0 -35
  158. package/libusb/msvc/libusb.sln +0 -542
  159. package/libusb/msvc/libusb_dll.vcxproj +0 -61
  160. package/libusb/msvc/libusb_static.vcxproj +0 -49
  161. package/libusb/msvc/listdevs.vcxproj +0 -32
  162. package/libusb/msvc/sam3u_benchmark.vcxproj +0 -33
  163. package/libusb/msvc/set_option.vcxproj +0 -35
  164. package/libusb/msvc/stress.vcxproj +0 -35
  165. package/libusb/msvc/stress_mt.vcxproj +0 -33
  166. package/libusb/msvc/testlibusb.vcxproj +0 -32
  167. package/libusb/msvc/xusb.vcxproj +0 -38
  168. package/libusb/tests/Makefile.am +0 -40
  169. package/libusb/tests/init_context.c +0 -153
  170. package/libusb/tests/libusb_testlib.h +0 -76
  171. package/libusb/tests/macos.c +0 -130
  172. package/libusb/tests/set_option.c +0 -253
  173. package/libusb/tests/stress.c +0 -172
  174. package/libusb/tests/stress_mt.c +0 -267
  175. package/libusb/tests/testlib.c +0 -184
  176. package/libusb/tests/umockdev.c +0 -1175
  177. package/libusb/tests/webusb-test-shim/index.js +0 -12
  178. package/libusb/tests/webusb-test-shim/package-lock.json +0 -50
  179. package/libusb/tests/webusb-test-shim/package.json +0 -10
  180. package/libusb.gypi +0 -154
  181. package/libusb_config/config.h +0 -1
  182. package/prebuilds/android-arm/node.napi.armv7.node +0 -0
  183. package/prebuilds/android-arm64/node.napi.armv8.node +0 -0
  184. package/prebuilds/darwin-x64+arm64/node.napi.node +0 -0
  185. package/prebuilds/linux-arm/node.napi.armv6.node +0 -0
  186. package/prebuilds/linux-arm/node.napi.armv7.node +0 -0
  187. package/prebuilds/linux-arm64/node.napi.armv8.node +0 -0
  188. package/prebuilds/linux-ia32/node.napi.node +0 -0
  189. package/prebuilds/linux-x64/node.napi.glibc.node +0 -0
  190. package/prebuilds/linux-x64/node.napi.musl.node +0 -0
  191. package/prebuilds/win32-arm64/node.napi.node +0 -0
  192. package/prebuilds/win32-ia32/node.napi.node +0 -0
  193. package/prebuilds/win32-x64/node.napi.node +0 -0
  194. package/src/device.cc +0 -439
  195. package/src/helpers.h +0 -64
  196. package/src/hotplug/hotplug.h +0 -22
  197. package/src/hotplug/libusb.cc +0 -90
  198. package/src/hotplug/windows.cc +0 -168
  199. package/src/node_usb.cc +0 -314
  200. package/src/node_usb.h +0 -131
  201. package/src/thread_name.cc +0 -79
  202. package/src/thread_name.h +0 -11
  203. package/src/transfer.cc +0 -143
  204. package/src/uv_async_queue.h +0 -41
  205. package/test/usb.coffee +0 -250
  206. package/test/webusb.coffee +0 -227
  207. package/test/worker.cjs +0 -13
@@ -1,450 +0,0 @@
1
- dnl These m4 macros are whitespace sensitive and break if moved around much.
2
- m4_define([LU_VERSION_H], m4_include([libusb/version.h]))
3
- m4_define([LU_DEFINE_VERSION_ATOM],
4
- [m4_define([$1], m4_bregexp(LU_VERSION_H,
5
- [^#define\s*$1\s*\([0-9]*\).*], [\1]))])
6
- m4_define([LU_DEFINE_VERSION_RC_ATOM],
7
- [m4_define([$1], m4_bregexp(LU_VERSION_H,
8
- [^#define\s*$1\s*"\(-rc[0-9]*\)".*], [\1]))])
9
- dnl The m4_bregexp() returns (only) the numbers following the #define named
10
- dnl in the first macro parameter. m4_define() then defines the name for use
11
- dnl in AC_INIT.
12
-
13
- LU_DEFINE_VERSION_ATOM([LIBUSB_MAJOR])
14
- LU_DEFINE_VERSION_ATOM([LIBUSB_MINOR])
15
- LU_DEFINE_VERSION_ATOM([LIBUSB_MICRO])
16
- LU_DEFINE_VERSION_RC_ATOM([LIBUSB_RC])
17
-
18
- AC_PREREQ([2.69])
19
- AC_INIT([libusb-1.0], [LIBUSB_MAJOR[.]LIBUSB_MINOR[.]LIBUSB_MICRO[]LIBUSB_RC], [libusb-devel@lists.sourceforge.net], [libusb-1.0], [https://libusb.info])
20
- AC_CONFIG_HEADERS([config.h])
21
- AC_CONFIG_SRCDIR([libusb/core.c])
22
- AC_CONFIG_MACRO_DIR([m4])
23
- AC_PROG_CC
24
- AC_PROG_CXX
25
- AC_C_INLINE
26
- AM_INIT_AUTOMAKE
27
- LT_INIT
28
- LT_LANG([Windows Resource])
29
-
30
- dnl Library versioning
31
- dnl These numbers should be tweaked on every release. Read carefully:
32
- dnl http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
33
- dnl http://sourceware.org/autobook/autobook/autobook_91.html
34
- lt_current=5
35
- lt_revision=0
36
- lt_age=5
37
- LT_LDFLAGS="-version-info ${lt_current}:${lt_revision}:${lt_age} -no-undefined"
38
-
39
- m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
40
-
41
- EXTRA_CPPFLAGS=
42
- EXTRA_CFLAGS=
43
-
44
- dnl check for -std=gnu11 compiler support (optional)
45
- dnl note that we don't just check if the compiler accepts '-std=x11'
46
- dnl but also that it supports the _Thread_local keyword because some compilers
47
- dnl (e.g. gcc 4.8) accept the command line option but do not implement TLS
48
- saved_CFLAGS="${CFLAGS}"
49
- CFLAGS="-std=gnu11"
50
- AC_MSG_CHECKING([if $CC supports -std=gnu11])
51
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([_Thread_local int x;], [x = 42;])],
52
- [AC_MSG_RESULT([yes])
53
- c_dialect=gnu],
54
- [AC_MSG_RESULT([no])
55
- c_dialect=])
56
- if test "x$c_dialect" != xgnu; then
57
- dnl fallback check for -std=c11 compiler support (required)
58
- CFLAGS="-std=c11"
59
- AC_MSG_CHECKING([if $CC supports -std=c11])
60
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([_Thread_local int x;], [x = 42;])],
61
- [AC_MSG_RESULT([yes])],
62
- [AC_MSG_RESULT([no])
63
- AC_MSG_ERROR([compiler with C11 support is required to build libusb])])
64
- c_dialect=c
65
- fi
66
- CFLAGS="${saved_CFLAGS}"
67
-
68
- AC_DEFINE([_GNU_SOURCE], [1], [Enable GNU extensions.])
69
- AC_DEFINE([DEFAULT_VISIBILITY], [__attribute__ ((visibility ("default")))], [Define to the attribute for default visibility.])
70
- AC_DEFINE([PRINTF_FORMAT(a, b)], [__attribute__ ((__format__ (__printf__, a, b)))], [Define to the attribute for enabling parameter checks on printf-like functions.])
71
-
72
- create_import_lib=
73
- is_android_linux=
74
- AC_MSG_CHECKING([operating system])
75
- case $host in
76
- *-darwin*)
77
- AC_MSG_RESULT([Darwin/Mac OS X])
78
- backend=darwin
79
- platform=posix
80
- ;;
81
- *-haiku*)
82
- AC_MSG_RESULT([Haiku])
83
- backend=haiku
84
- platform=posix
85
- ;;
86
- wasm*-emscripten)
87
- AC_MSG_RESULT([Emscripten])
88
- backend=emscripten
89
- platform=posix
90
- ;;
91
- wasm*-unknown-none)
92
- AC_MSG_ERROR([
93
- --host=$host_alias is not accepted as it might become ambiguous in the future.
94
- Please use an explicit --host=$host_cpu-emscripten instead.
95
- ])
96
- ;;
97
- *-linux* | *-uclinux*)
98
- dnl on Android Linux, some functions are in different places
99
- case $host in
100
- *-linux-android*)
101
- AC_MSG_RESULT([Android Linux])
102
- is_android_linux=yes
103
- ;;
104
- *)
105
- AC_MSG_RESULT([Linux])
106
- ;;
107
- esac
108
- backend=linux
109
- platform=posix
110
- ;;
111
- *-netbsd*)
112
- AC_MSG_RESULT([NetBSD])
113
- backend=netbsd
114
- platform=posix
115
- ;;
116
- *-openbsd*)
117
- AC_MSG_RESULT([OpenBSD])
118
- backend=openbsd
119
- platform=posix
120
- ;;
121
- *-solaris*)
122
- AC_MSG_RESULT([SunOS])
123
- backend=sunos
124
- platform=posix
125
- ;;
126
- *-cygwin*)
127
- AC_MSG_RESULT([Windows (using Cygwin)])
128
- backend=windows
129
- platform=windows
130
- EXTRA_CFLAGS="-mwin32"
131
- ;;
132
- *-mingw* | *msys*)
133
- AC_MSG_RESULT([Windows])
134
- backend=windows
135
- platform=windows
136
- test "x$enable_shared" = xyes && create_import_lib=yes
137
- EXTRA_CFLAGS="-fno-omit-frame-pointer"
138
- EXTRA_LDFLAGS="-static-libgcc"
139
- ;;
140
- *)
141
- AC_MSG_RESULT([Null])
142
- AC_MSG_WARN([The host being compiled for is not supported.])
143
- AC_MSG_WARN([The library may compile but will not function in any useful manner.])
144
- backend=null
145
- platform=posix
146
- ;;
147
- esac
148
-
149
- if test "x$platform" = xposix; then
150
- AC_DEFINE([PLATFORM_POSIX], [1], [Define to 1 if compiling for a POSIX platform.])
151
- AC_CHECK_TYPES([nfds_t], [], [], [[#include <poll.h>]])
152
- if test "x$backend" != xemscripten; then
153
- # pipe2 is detected as present on Emscripten, but it isn't actually ported and always
154
- # returns an error. https://github.com/emscripten-core/emscripten/issues/14824
155
- AC_CHECK_FUNCS([pipe2])
156
- fi
157
- dnl Some compilers do not support the '-pthread' option so check for it here
158
- saved_CFLAGS="${CFLAGS}"
159
- CFLAGS="-Wall -Werror -pthread"
160
- AC_MSG_CHECKING([if $CC recognizes -pthread])
161
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
162
- [AC_MSG_RESULT([yes])
163
- AC_SUBST(THREAD_CFLAGS, [-pthread])],
164
- [AC_MSG_RESULT([no])])
165
- CFLAGS="${saved_CFLAGS}"
166
- dnl Android Linux and Darwin provide pthread functions directly in libc
167
- dnl glibc also provides some pthread functions directly, so search for a thread-specific function
168
- AC_SEARCH_LIBS([pthread_create], [pthread],
169
- [test "x$ac_cv_search_pthread_create" != "xnone required" && AC_SUBST(THREAD_LIBS, [-lpthread])],
170
- [], [])
171
- dnl Check for new-style atomic builtins. We first check without linking to -latomic.
172
- AC_MSG_CHECKING(whether __atomic_load_n is supported)
173
- AC_LINK_IFELSE([AC_LANG_SOURCE([[
174
- #include <stdint.h>
175
- int main() {
176
- struct {
177
- uint64_t *v;
178
- } x;
179
- return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) &
180
- (int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL);
181
- }]])], GCC_ATOMIC_BUILTINS_SUPPORTED=yes, GCC_ATOMIC_BUILTINS_SUPPORTED=no)
182
- AC_MSG_RESULT($GCC_ATOMIC_BUILTINS_SUPPORTED)
183
- if test "x$GCC_ATOMIC_BUILTINS_SUPPORTED" != xyes; then
184
- AC_SEARCH_LIBS([__atomic_fetch_add_4], [atomic])
185
- fi
186
- elif test "x$platform" = xwindows; then
187
- AC_DEFINE([PLATFORM_WINDOWS], [1], [Define to 1 if compiling for a Windows platform.])
188
- else
189
- AC_MSG_ERROR([Unknown platform])
190
- fi
191
-
192
- case $backend in
193
- darwin)
194
- AC_CHECK_FUNCS([pthread_threadid_np])
195
- LIBS="${LIBS} -lobjc -Wl,-framework,IOKit -Wl,-framework,CoreFoundation -Wl,-framework,Security"
196
- AC_CHECK_HEADERS([IOKit/usb/IOUSBHostFamilyDefinitions.h])
197
- ;;
198
- haiku)
199
- LIBS="${LIBS} -lbe"
200
- ;;
201
- linux)
202
- AC_SEARCH_LIBS([clock_gettime], [rt], [], [], [])
203
- AC_CHECK_FUNCS([pthread_setname_np])
204
- AC_ARG_ENABLE([udev],
205
- [AS_HELP_STRING([--enable-udev], [use udev for device enumeration and hotplug support (recommended) [default=yes]])],
206
- [use_udev=$enableval], [use_udev=yes])
207
- if test "x$use_udev" = xyes; then
208
- dnl system has udev. use it or fail!
209
- AC_CHECK_HEADER([libudev.h], [], [AC_MSG_ERROR([udev support requested but libudev header not installed])])
210
- AC_CHECK_LIB([udev], [udev_new], [], [AC_MSG_ERROR([udev support requested but libudev not installed])])
211
-
212
- # We can build umockdev tests (if available)
213
- m4_ifdef([PKG_PROG_PKG_CONFIG],[
214
- PKG_PROG_PKG_CONFIG
215
- PKG_CHECK_MODULES([UMOCKDEV], [umockdev-1.0 >= 0.16.0], [ac_have_umockdev=yes], [ac_have_umockdev=no])
216
- PKG_CHECK_MODULES([UMOCKDEV_HOTPLUG], [umockdev-1.0 >= 0.17.7], [ac_umockdev_hotplug=yes], [ac_umockdev_hotplug=no])
217
- if test $ac_umockdev_hotplug = yes; then
218
- AC_DEFINE([UMOCKDEV_HOTPLUG], [1], [UMockdev hotplug code is not racy])
219
- fi
220
- ], [])
221
- else
222
- AC_CHECK_HEADERS([asm/types.h])
223
- AC_CHECK_HEADER([linux/netlink.h], [], [AC_MSG_ERROR([Linux netlink header not found])])
224
- AC_CHECK_HEADER([sys/socket.h], [], [AC_MSG_ERROR([Linux socket header not found])])
225
- fi
226
- ;;
227
- sunos)
228
- LIBS="${LIBS} -ldevinfo"
229
- ;;
230
- windows)
231
- AC_CHECK_TYPES([struct timespec], [], [], [[#include <time.h>]])
232
- AC_DEFINE([_WIN32_WINNT], [_WIN32_WINNT_VISTA], [Define to the oldest supported Windows version.])
233
- LT_LDFLAGS="${LT_LDFLAGS} -avoid-version"
234
- ;;
235
- emscripten)
236
- # Note: LT_LDFLAGS is not enough here because we need link flags for executable.
237
- EM_LDFLAGS="--bind -s ASYNCIFY"
238
- AM_LDFLAGS="${AM_LDFLAGS} ${EM_LDFLAGS} -s ASSERTIONS -s ALLOW_MEMORY_GROWTH"
239
- LIBS="${LIBS} ${EM_LDFLAGS}"
240
- ;;
241
- *)
242
- dnl no special handling required
243
- ;;
244
- esac
245
-
246
- dnl headers not available on all platforms but required on others
247
- AC_CHECK_HEADERS([sys/time.h])
248
-
249
- dnl check availability of clock_gettime(), except don't bother on Darwin, because the result is not used.
250
- if test "x$platform" = xposix && test "x$backend" != xdarwin; then
251
- AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes], [AC_MSG_ERROR([clock_gettime() is required on this platform])])
252
-
253
- if test "x$have_clock_gettime" = xyes; then
254
- dnl the clock_gettime() function needs certain clock IDs defined
255
- AC_CHECK_DECL([CLOCK_MONOTONIC], [], [AC_MSG_ERROR([C library headers missing definition for CLOCK_MONOTONIC])], [[#include <time.h>]])
256
- dnl use the monotonic clock for condition variable timed waits if possible
257
- AC_CHECK_FUNCS([pthread_condattr_setclock], [need_clock_realtime=], [need_clock_realtime=yes])
258
- if test "x$need_clock_realtime" = xyes; then
259
- AC_CHECK_DECL([CLOCK_REALTIME], [], [AC_MSG_ERROR([C library headers missing definition for CLOCK_REALTIME])], [[#include <time.h>]])
260
- fi
261
- fi
262
- fi
263
-
264
- dnl eventfd support
265
- if test "x$backend" = xlinux || test "x$backend" = xsunos; then
266
- AC_ARG_ENABLE([eventfd],
267
- [AS_HELP_STRING([--enable-eventfd], [use eventfd for signalling [default=auto]])],
268
- [use_eventfd=$enableval],
269
- [use_eventfd=auto])
270
- if test "x$use_eventfd" != xno; then
271
- AC_CHECK_HEADER([sys/eventfd.h], [eventfd_h=yes], [eventfd_h=])
272
- if test "x$eventfd_h" = xyes; then
273
- AC_CHECK_DECLS([EFD_NONBLOCK, EFD_CLOEXEC], [eventfd_h_ok=yes], [eventfd_h_ok=], [[#include <sys/eventfd.h>]])
274
- if test "x$eventfd_h_ok" = xyes; then
275
- AC_CHECK_FUNC([eventfd], [eventfd_ok=yes], [eventfd_ok=])
276
- if test "x$eventfd_ok" = xyes; then
277
- AC_DEFINE([HAVE_EVENTFD], [1], [Define to 1 if the system has eventfd functionality.])
278
- elif test "x$use_eventfd" = xyes; then
279
- AC_MSG_ERROR([eventfd() function not found; glibc 2.9+ required])
280
- fi
281
- elif test "x$use_eventfd" = xyes; then
282
- AC_MSG_ERROR([eventfd header not usable; glibc 2.9+ required])
283
- fi
284
- elif test "x$use_eventfd" = xyes; then
285
- AC_MSG_ERROR([eventfd header not available; glibc 2.9+ required])
286
- fi
287
- fi
288
- AC_MSG_CHECKING([whether to use eventfd for signalling])
289
- if test "x$use_eventfd" = xno; then
290
- AC_MSG_RESULT([no (disabled by user)])
291
- elif test "x$eventfd_h" != xyes; then
292
- AC_MSG_RESULT([no (header not available)])
293
- elif test "x$eventfd_h_ok" != xyes; then
294
- AC_MSG_RESULT([no (header not usable)])
295
- elif test "x$eventfd_ok" != xyes; then
296
- AC_MSG_RESULT([no (functions not available)])
297
- else
298
- AC_MSG_RESULT([yes])
299
- fi
300
- fi
301
-
302
- dnl timerfd support
303
- if test "x$backend" = xlinux || test "x$backend" = xsunos; then
304
- AC_ARG_ENABLE([timerfd],
305
- [AS_HELP_STRING([--enable-timerfd], [use timerfd for timing [default=auto]])],
306
- [use_timerfd=$enableval],
307
- [use_timerfd=auto])
308
- if test "x$use_timerfd" != xno; then
309
- AC_CHECK_HEADER([sys/timerfd.h], [timerfd_h=yes], [timerfd_h=])
310
- if test "x$timerfd_h" = xyes; then
311
- AC_CHECK_DECLS([TFD_NONBLOCK, TFD_CLOEXEC], [timerfd_h_ok=yes], [timerfd_h_ok=], [[#include <sys/timerfd.h>]])
312
- if test "x$timerfd_h_ok" = xyes; then
313
- AC_CHECK_FUNC([timerfd_create], [timerfd_ok=yes], [timerfd_ok=])
314
- if test "x$timerfd_ok" = xyes; then
315
- AC_DEFINE([HAVE_TIMERFD], [1], [Define to 1 if the system has timerfd functionality.])
316
- elif test "x$use_timerfd" = xyes; then
317
- AC_MSG_ERROR([timerfd_create() function not found; glibc 2.9+ required])
318
- fi
319
- elif test "x$use_timerfd" = xyes; then
320
- AC_MSG_ERROR([timerfd header not usable; glibc 2.9+ required])
321
- fi
322
- elif test "x$use_timerfd" = xyes; then
323
- AC_MSG_ERROR([timerfd header not available; glibc 2.9+ required])
324
- fi
325
- fi
326
- AC_MSG_CHECKING([whether to use timerfd for timing])
327
- if test "x$use_timerfd" = xno; then
328
- AC_MSG_RESULT([no (disabled by user)])
329
- elif test "x$timerfd_h" != xyes; then
330
- AC_MSG_RESULT([no (header not available)])
331
- elif test "x$timerfd_h_ok" != xyes; then
332
- AC_MSG_RESULT([no (header not usable)])
333
- elif test "x$timerfd_ok" != xyes; then
334
- AC_MSG_RESULT([no (functions not available)])
335
- else
336
- AC_MSG_RESULT([yes])
337
- fi
338
- fi
339
-
340
- dnl Message logging
341
- AC_ARG_ENABLE([log],
342
- [AS_HELP_STRING([--disable-log], [disable all logging])],
343
- [log_enabled=$enableval],
344
- [log_enabled=yes])
345
- if test "x$log_enabled" != xno; then
346
- AC_DEFINE([ENABLE_LOGGING], [1], [Define to 1 to enable message logging.])
347
- fi
348
-
349
- AC_ARG_ENABLE([debug-log],
350
- [AS_HELP_STRING([--enable-debug-log], [start with debug message logging enabled [default=no]])],
351
- [debug_log_enabled=$enableval],
352
- [debug_log_enabled=no])
353
- if test "x$debug_log_enabled" != xno; then
354
- AC_DEFINE([ENABLE_DEBUG_LOGGING], [1], [Define to 1 to start with debug message logging enabled.])
355
- fi
356
-
357
- AC_ARG_ENABLE([system-log],
358
- [AS_HELP_STRING([--enable-system-log], [output logging messages to the systemwide log, if supported by the OS [default=no]])],
359
- [system_log_enabled=$enableval],
360
- [system_log_enabled=no])
361
- if test "x$system_log_enabled" != xno; then
362
- AC_DEFINE([USE_SYSTEM_LOGGING_FACILITY], [1], [Define to 1 to output logging messages to the systemwide log.])
363
- if test "x$backend" != xwindows && test "x$is_android_linux" != xyes; then
364
- dnl Check if syslog is available in standard C library
365
- AC_CHECK_HEADER([syslog.h], [syslog_h=yes], [syslog_h=])
366
- if test "x$syslog_h" = xyes; then
367
- AC_CHECK_FUNCS([syslog])
368
- fi
369
- fi
370
- fi
371
-
372
- dnl Examples build
373
- AC_ARG_ENABLE([examples-build],
374
- [AS_HELP_STRING([--enable-examples-build], [build example applications [default=no]])],
375
- [build_examples=$enableval],
376
- [build_examples=no])
377
-
378
- dnl Tests build
379
- AC_ARG_ENABLE([tests-build],
380
- [AS_HELP_STRING([--enable-tests-build], [build test applications [default=no]])],
381
- [build_tests=$enableval],
382
- [build_tests=no])
383
-
384
- AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$build_examples" != xno])
385
- AM_CONDITIONAL([BUILD_TESTS], [test "x$build_tests" != xno])
386
- AM_CONDITIONAL([BUILD_UMOCKDEV_TEST], [test "x$ac_have_umockdev" = xyes -a "x$log_enabled" != xno -a "x$debug_log_enabled" != xyes])
387
- AM_CONDITIONAL([CREATE_IMPORT_LIB], [test "x$create_import_lib" = xyes])
388
- AM_CONDITIONAL([OS_DARWIN], [test "x$backend" = xdarwin])
389
- AM_CONDITIONAL([OS_HAIKU], [test "x$backend" = xhaiku])
390
- AM_CONDITIONAL([OS_LINUX], [test "x$backend" = xlinux])
391
- AM_CONDITIONAL([OS_NETBSD], [test "x$backend" = xnetbsd])
392
- AM_CONDITIONAL([OS_NULL], [test "x$backend" = xnull])
393
- AM_CONDITIONAL([OS_OPENBSD], [test "x$backend" = xopenbsd])
394
- AM_CONDITIONAL([OS_SUNOS], [test "x$backend" = xsunos])
395
- AM_CONDITIONAL([OS_WINDOWS], [test "x$backend" = xwindows])
396
- AM_CONDITIONAL([OS_EMSCRIPTEN], [test "x$backend" = xemscripten])
397
- AM_CONDITIONAL([PLATFORM_POSIX], [test "x$platform" = xposix])
398
- AM_CONDITIONAL([PLATFORM_WINDOWS], [test "x$platform" = xwindows])
399
- AM_CONDITIONAL([USE_UDEV], [test "x$use_udev" = xyes])
400
-
401
- dnl The -Wcast-function-type warning causes a flurry of warnings when compiling
402
- dnl Windows with GCC 8 or later because of dynamically loaded functions
403
- if test "x$backend" = xwindows; then
404
- saved_CFLAGS="${CFLAGS}"
405
- CFLAGS="-Werror -Wcast-function-type"
406
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
407
- [EXTRA_CFLAGS="${EXTRA_CFLAGS} -Wno-cast-function-type"],
408
- [])
409
- CFLAGS="${saved_CFLAGS}"
410
- fi
411
-
412
- dnl Some linkers do not support the '--add-stdcall-alias' option so check for it here
413
- if test "x$backend" = xwindows; then
414
- saved_CFLAGS="${CFLAGS}"
415
- CFLAGS="-Wl,--add-stdcall-alias"
416
- AC_MSG_CHECKING([if linker supports --add-stdcall-alias])
417
- AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
418
- [AC_MSG_RESULT([yes])
419
- LT_LDFLAGS="${LT_LDFLAGS} -Wl,--add-stdcall-alias"],
420
- [AC_MSG_RESULT([no])])
421
- CFLAGS="${saved_CFLAGS}"
422
- fi
423
-
424
- SHARED_CFLAGS="-Wall -Wextra -Wshadow -Wunused -Wwrite-strings -Werror=format-security -Werror=implicit-function-declaration -Werror=implicit-int -Werror=init-self -Werror=missing-prototypes -Werror=strict-prototypes -Werror=undef -Werror=uninitialized"
425
-
426
- AM_CPPFLAGS="${EXTRA_CPPFLAGS}"
427
- AC_SUBST(AM_CPPFLAGS)
428
-
429
- AM_CFLAGS="-std=${c_dialect}11 ${EXTRA_CFLAGS} ${SHARED_CFLAGS}"
430
- AC_SUBST(AM_CFLAGS)
431
-
432
- AM_CXXFLAGS="-std=${c_dialect}++11 ${EXTRA_CFLAGS} ${SHARED_CFLAGS} -Wmissing-declarations"
433
- AC_SUBST(AM_CXXFLAGS)
434
-
435
- AC_SUBST(LT_LDFLAGS)
436
- AC_SUBST(AM_LDFLAGS)
437
-
438
- AC_SUBST([EXTRA_LDFLAGS])
439
-
440
- dnl set name of html output directory for doxygen
441
- AC_SUBST(DOXYGEN_HTMLDIR, [api-1.0])
442
-
443
- AC_CONFIG_FILES([libusb-1.0.pc])
444
- AC_CONFIG_FILES([Makefile])
445
- AC_CONFIG_FILES([libusb/Makefile])
446
- AC_CONFIG_FILES([examples/Makefile])
447
- AC_CONFIG_FILES([tests/Makefile])
448
- AC_CONFIG_FILES([doc/Makefile])
449
- AC_CONFIG_FILES([doc/doxygen.cfg])
450
- AC_OUTPUT
@@ -1,22 +0,0 @@
1
- LIBUSB_SRC_DIR = @top_srcdir@/libusb
2
- EXCLUDED_FILES = libusbi.h version.h version_nano.h
3
- LIBUSB_SRC = $(wildcard $(LIBUSB_SRC_DIR)/*.c) $(wildcard $(LIBUSB_SRC_DIR)/*.h)
4
- LIBUSB_DOC_SRC = $(filter-out $(addprefix $(LIBUSB_SRC_DIR)/,$(EXCLUDED_FILES)),$(LIBUSB_SRC))
5
-
6
- docs: @DOXYGEN_HTMLDIR@
7
-
8
- @DOXYGEN_HTMLDIR@: doxygen.cfg @top_srcdir@/doc/libusb.png $(LIBUSB_DOC_SRC)
9
- doxygen $<
10
-
11
- sfurl = web.sourceforge.net:/home/project-web/libusb/htdocs
12
- docs-upload: @DOXYGEN_HTMLDIR@
13
- if [ -z "$$SF_USER" ]; then \
14
- rsync -rv --delete $< $(sfurl); \
15
- else \
16
- rsync -rv --delete $< $$SF_USER@$(sfurl); \
17
- fi
18
-
19
- clean:
20
- rm -rf @DOXYGEN_HTMLDIR@
21
-
22
- .PHONY: clean docs docs-upload