make libusb usage optional

git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2053 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.2.5
Stéphane Fillod, F8CFE 2005-11-19 14:41:37 +00:00
rodzic e5cfd4a43b
commit 07a8c95610
2 zmienionych plików z 20 dodań i 6 usunięć

Wyświetl plik

@ -347,7 +347,7 @@ if test "${cf_with_cxx}" = "yes" ; then
AC_MSG_RESULT($cf_with_gnuradio)
if test "${cf_with_gnuradio}" = "yes" ; then
PKG_CHECK_MODULES(GNURADIO, gnuradio >= 0.9, [])
PKG_CHECK_MODULES(GNURADIO, gnuradio >= 0.9)
dnl check for pthreads
ACX_PTHREAD([BACKEND_LIST="$BACKEND_LIST gnuradio"],
[AC_MSG_FAILURE([gnuradio backend requires POSIX threads. pthreads not found.])])
@ -372,7 +372,8 @@ AC_SUBST(GNURADIO_CFLAGS)
AC_SUBST(GNURADIO_LIBS)
PKG_CHECK_MODULES(LIBUSB, libusb >= 0.1, [])
PKG_CHECK_MODULES(LIBUSB, libusb >= 0.1, ,
[AC_MSG_WARN([libusb pkg-config not found, USB backends will be disabled])])
AC_CHECK_HEADERS([usb.h])
AC_MSG_CHECKING(whether to build USB backends)
if test x"${LIBUSB_LIBS}" = x; then

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib Interface - parallel communication low-level support
* Copyright (c) 2000-2005 by Stephane Fillod
*
* $Id: usb_port.c,v 1.1 2005-11-01 23:02:02 fillods Exp $
* $Id: usb_port.c,v 1.2 2005-11-19 14:41:37 fillods Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -24,17 +24,18 @@
#include "config.h"
#endif
#include <hamlib/rig.h>
/*
* Compile only this model if libusb is available
*/
#ifdef HAVE_USB_H
#if defined(HAVE_LIBUSB) && defined(HAVE_USB_H)
#include <stdlib.h>
#include <stdio.h> /* Standard input/output definitions */
#include <string.h> /* String function definitions */
#include <unistd.h> /* UNIX standard function definitions */
#include <usb.h>
#include <errno.h>
#include <sys/types.h>
#include <unistd.h>
@ -126,4 +127,16 @@ int usb_port_close(hamlib_port_t *port)
return usb_close (udh) == 0 ? RIG_OK : -RIG_EIO;
}
#endif /* HAVE_LIBUSB */
#else
int usb_port_open(hamlib_port_t *port)
{
return -RIG_ENAVAIL;
}
int usb_port_close(hamlib_port_t *port)
{
return -RIG_ENAVAIL;
}
#endif /* defined(HAVE_LIBUSB) && defined(HAVE_USB_H) */