+ ;;
+ esac
+ if test $libusbok = yes; then
+ dnl PKGCONFIG found a version of LIBUSB, or the info was
+ dnl provided by the user, or the OS is Windows.
+
+ dnl Check it to make sure it meets enough criteria:
+ dnl Verify that $usb_header is a valid header. If so, then
+ dnl verify that $usb_lib_func can be found in the library
+ dnl $usb_lib_name. if so, verify that the symbol 'usb_debug' is
+ dnl found in the library if not using Windows.
+
+ dnl Check for the header. Similar to AC_CHECK_HEADERS,
+ dnl but doesn't append to known \#defines.
+ dnl If PKGCONFIG found variable USB_INCLUDEDIR, and it is
+ dnl not empty, use it for checking for $usb_header.
+ dnl Otherwise, maybe the user's shell environment is already
+ dnl configured to find this header.
+ AC_LANG_PUSH(C)
+ save_CPPFLAGS="$CPPFLAGS"
+ if test x$USB_INCLUDEDIR != x; then
+ USB_INCLUDES="-I$USB_INCLUDEDIR"
+ CPPFLAGS="$USB_INCLUDES"
+ fi
+ AC_MSG_CHECKING([$libusb_name for header $usb_header])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ #include "$usb_header"
+ ]], [])],
+ [libusbok=yes],[libusbok=no])
+ AC_MSG_RESULT([$libusbok])
+ CPPFLAGS="$save_CPPFLAGS"
+ AC_LANG_POP(C)
+
+ if test $libusbok = yes; then
+ dnl found the header; now make sure the library is OK
+ dnl On Darwin, need to include the IOKit library.
+
+ AC_LANG_PUSH(C)
+ save_LIBS="$LIBS"
+ case "$host_os" in
+ darwin*)
+ USB_LIBS="$USB_LIBS -lIOKit"
+ ;;
+ *) ;;
+ esac
+ LIBS="$USB_LIBS"
+
+ dnl find the library link name
+ usb_lib_name=`echo $USB_LIBS | sed -e "s@.*-l\(usb[[^ ]]*\).*@\1@"`