diff options
-rw-r--r-- | android/config.h | 9 | ||||
-rw-r--r-- | configure.ac | 22 | ||||
-rw-r--r-- | libusb/libusbi.h | 9 | ||||
-rw-r--r-- | libusb/version_nano.h | 2 |
4 files changed, 32 insertions, 10 deletions
diff --git a/android/config.h b/android/config.h index c1594cf..0d0fdb7 100644 --- a/android/config.h +++ b/android/config.h @@ -79,12 +79,3 @@ /* Define to 1 if you have the <sys/socket.h> header file. */ #define HAVE_SYS_SOCKET_H 1 - -/* Add defines which Android is missing */ -#ifndef TIMESPEC_TO_TIMEVAL -#define TIMESPEC_TO_TIMEVAL(tv, ts) \ - do { \ - (tv)->tv_sec = (ts)->tv_sec; \ - (tv)->tv_usec = (ts)->tv_nsec / 1000; \ - } while (0) -#endif diff --git a/configure.ac b/configure.ac index 9a2e24d..3495acf 100644 --- a/configure.ac +++ b/configure.ac @@ -46,6 +46,16 @@ LTLDFLAGS="${LTLDFLAGS} -no-undefined" AC_MSG_CHECKING([operating system]) +dnl on linux-android platform, some functions are in different places +case $host in +*-linux-android*) + AC_MSG_RESULT([This is a Linux-Android system]) + is_backend_android="yes" + ;; +*) + is_backend_android="no" +esac + case $host in *-linux* | *-uclinux*) AC_MSG_RESULT([Linux]) @@ -108,8 +118,20 @@ linux) ]) fi AC_SUBST(USE_UDEV) + +case $is_backend_android in +yes) + dnl some pthread functions is in libc + THREAD_CFLAGS="-c" + LIBS="${LIBS} -c" + dnl there are gettimeofday function but configure doesn't seem to be able to find it. + AC_DEFINE([HAVE_GETTIMEOFDAY], [1], [Define if you have gettimeofday]) + ;; +*) THREAD_CFLAGS="-pthread" LIBS="${LIBS} -pthread" +esac + AC_CHECK_HEADERS([poll.h]) AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument]) ;; diff --git a/libusb/libusbi.h b/libusb/libusbi.h index a4d74f6..5cf5425 100644 --- a/libusb/libusbi.h +++ b/libusb/libusbi.h @@ -149,6 +149,15 @@ static inline void *usbi_reallocf(void *ptr, size_t size) #define TIMESPEC_IS_SET(ts) ((ts)->tv_sec != 0 || (ts)->tv_nsec != 0) +/* Some platforms don't have this define */ +#ifndef TIMESPEC_TO_TIMEVAL +#define TIMESPEC_TO_TIMEVAL(tv, ts) \ + do { \ + (tv)->tv_sec = (ts)->tv_sec; \ + (tv)->tv_usec = (ts)->tv_nsec / 1000; \ + } while (0) +#endif + void usbi_log(struct libusb_context *ctx, enum libusb_log_level level, const char *function, const char *format, ...); diff --git a/libusb/version_nano.h b/libusb/version_nano.h index 92a8c18..d2ce690 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 10854 +#define LIBUSB_NANO 10855 |