summaryrefslogtreecommitdiffstats
path: root/usbmuxd
diff options
context:
space:
mode:
authorGravatar Hector Martin2009-08-24 17:59:35 +0200
committerGravatar Hector Martin2009-08-24 17:59:35 +0200
commitec63619f611c7246247485ae3d27818aa2aa1dbd (patch)
tree2e9f404deb24c15dbe44bc87f28065b6008ee099 /usbmuxd
parent0a1fe2abddbd73ed00a93afd8dcaf38f5210c0fc (diff)
downloadusbmuxd-ec63619f611c7246247485ae3d27818aa2aa1dbd.tar.gz
usbmuxd-ec63619f611c7246247485ae3d27818aa2aa1dbd.tar.bz2
ZLP flag is an enum, move check into CMake.
Now prints the big fat warning at configure time
Diffstat (limited to 'usbmuxd')
-rw-r--r--usbmuxd/CMakeLists.txt21
-rw-r--r--usbmuxd/usb-linux.c11
2 files changed, 20 insertions, 12 deletions
diff --git a/usbmuxd/CMakeLists.txt b/usbmuxd/CMakeLists.txt
index 7d0d3d8..f95727c 100644
--- a/usbmuxd/CMakeLists.txt
+++ b/usbmuxd/CMakeLists.txt
@@ -6,8 +6,27 @@ include_directories (${CMAKE_SOURCE_DIR}/common)
include_directories (${CMAKE_SOURCE_DIR}/usbmuxd)
include_directories (${CMAKE_SOURCE_DIR}/libusbmuxd)
+include(CheckConstantExists)
+set(CMAKE_REQUIRED_INCLUDES ${USB_INCLUDE_DIRS})
+check_constant_exists(LIBUSB_TRANSFER_ZERO_PACKET libusb.h HAVE_LIBUSB_ZLP)
+
+if(NOT HAVE_LIBUSB_ZLP)
+ message("
+================================================================================
+==================================== WARNING ===================================
+================================================================================
+Your libusb is missing proper Zero Length Packet support! If you are using a
+recent libusb Git, things may or may not work. If you are using libusb 1.0.2 or
+earlier, things will definitely not work properly.
+
+Please apply the patch in the contrib/ directory to your libusb 1.0 tree.
+================================================================================
+")
+ add_definitions(-DEXPLICIT_ZLP_TRANSACTION)
+endif(NOT HAVE_LIBUSB_ZLP)
+
add_definitions(-Wall -O2 -g -DUSBMUXD_DAEMON)
add_executable(usbmuxd main.c usb-linux.c log.c ../common/utils.c device.c client.c)
target_link_libraries(usbmuxd ${LIBS})
-install(TARGETS usbmuxd RUNTIME DESTINATION sbin) \ No newline at end of file
+install(TARGETS usbmuxd RUNTIME DESTINATION sbin)
diff --git a/usbmuxd/usb-linux.c b/usbmuxd/usb-linux.c
index 2d6053e..c09cdc9 100644
--- a/usbmuxd/usb-linux.c
+++ b/usbmuxd/usb-linux.c
@@ -33,17 +33,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "log.h"
#include "device.h"
-#ifndef LIBUSB_TRANSFER_ZERO_PACKET
-#warning Your libusb is missing proper Zero Length Packet support!
-#warning
-#warning If you are using a recent libusb Git, things may or may not work.
-#warning If you are using libusb 1.0.2 or earlier, things will definitely not work
-#warning properly.
-#warning
-#warning Please apply the patch in the contrib/ directory to your libusb 1.0 tree.
-#define EXPLICIT_ZLP_TRANSACTION
-#endif
-
// interval for device connection/disconnection polling, in milliseconds
// we need this because there is currently no asynchronous device discovery mechanism in libusb
#define DEVICE_POLL_TIME 1000