LIBUSBCONFIG=""
AC_PATH_PROG(LIBUSBCONFIG,libusb-config,no)
if test $LIBUSBCONFIG = "no"  ; then
    AC_MSG_WARN(Can't find libusb-config)
    AC_MSG_WARN(Check your libusb installation)
    USB_LIBS=""
    USB_CFLAGS=""
else  
    USB_LIBS="$($LIBUSBCONFIG --libs)"
    USB_CFLAGS="$($LIBUSBCONFIG --cflags)"
AC_CHECK_LIB(usb,main,
    AC_DEFINE(HAVE_LIBUSB, 1, [Defined if you have libusb]),
    [],
    $USB_LIBS
)
fi
AC_SUBST(USB_LIBS)
AC_SUBST(USB_CFLAGS)

