Use pkg-config for libusb

feature/test-new-mem-api
nirenjan 2017-09-10 17:13:38 -07:00
parent 3845c81229
commit 86642e5b16
6 changed files with 14 additions and 19 deletions

View File

@ -5,23 +5,14 @@ AC_PROG_CC
AM_PROG_AR AM_PROG_AR
AM_PATH_PYTHON([2.6]) AM_PATH_PYTHON([2.6])
LT_INIT LT_INIT
PKG_PROG_PKG_CONFIG
# Check for libusb-1.0 # Check for libusb-1.0
AC_SEARCH_LIBS([libusb_init], [usb-1.0], [have_libusb=yes]) PKG_CHECK_MODULES([LIBUSB], [libusb-1.0])
AS_IF([test "x${have_libusb}" = xyes], [ AC_SUBST([LIBUSB_CFLAGS])
AC_CHECK_HEADERS([libusb-1.0/libusb.h], [], [have_libusb=no]) AC_SUBST([LIBUSB_LDFLAGS])
]) AC_SUBST([LIBUSB_LIBS])
AS_IF([test "x${have_libusb}" != xyes], [
AC_MSG_ERROR([
-------------------------------------------------------
The library libusb-1.0 and header file libusb.h
are required to build x52pro-linux. Stopping...
Check 'config.log' for more information.
-------------------------------------------------------
])
])
AC_SUBST([X52_PKG_VERSION], [0.1]) AC_SUBST([X52_PKG_VERSION], [0.1])
AC_SUBST([X52_INCLUDE], ["-I \$(top_srcdir)/lib/libx52"]) AC_SUBST([X52_INCLUDE], ["-I \$(top_srcdir)/lib/libx52"])

View File

@ -4,15 +4,17 @@ ACLOCAL_AMFLAGS = -I m4
check_LTLIBRARIES = libusbx52.la check_LTLIBRARIES = libusbx52.la
libusbx52_la_SOURCES = usb_x52_stub.c libusbx52_la_SOURCES = usb_x52_stub.c
libusbx52_la_CFLAGS = @LIBUSB_CFLAGS@
libusbx52_la_LDFLAGS = -rpath /nowhere -module libusbx52_la_LDFLAGS = -rpath /nowhere -module
# Utility programs for use by tests # Utility programs for use by tests
check_PROGRAMS = x52test_create_device_list x52test_log_actions check_PROGRAMS = x52test_create_device_list x52test_log_actions
x52test_create_device_list_SOURCES = util/create_device_list.c x52test_create_device_list_SOURCES = util/create_device_list.c
x52test_create_device_list_CFLAGS = @LIBUSB_CFLAGS@
x52test_log_actions_SOURCES = util/log_actions.c x52test_log_actions_SOURCES = util/log_actions.c
x52test_log_actions_CFLAGS = @X52_INCLUDE@ x52test_log_actions_CFLAGS = @X52_INCLUDE@ @LIBUSB_CFLAGS@
x52test_log_actions_LDADD = libusbx52.la x52test_log_actions_LDADD = libusbx52.la
EXTRA_DIST = README.md libusbx52.h EXTRA_DIST = README.md libusbx52.h

View File

@ -10,7 +10,8 @@
*/ */
#include <stdio.h> #include <stdio.h>
#include <libusb-1.0/libusb.h> // #include <libusb-1.0/libusb.h>
#include <libusb.h>
struct libusb_device { struct libusb_device {
struct libusb_context *context; struct libusb_context *context;

View File

@ -11,7 +11,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <libusb-1.0/libusb.h> #include <libusb.h>
#include "libusbx52.h" #include "libusbx52.h"
int libusb_init(libusb_context **ctx) int libusb_init(libusb_context **ctx)

View File

@ -6,7 +6,8 @@ lib_LTLIBRARIES = libx52.la
# This library handles the USB communication between the host and the X52 # This library handles the USB communication between the host and the X52
libx52_la_SOURCES = x52_control.c x52_core.c x52_date_time.c x52_mfd_led.c \ libx52_la_SOURCES = x52_control.c x52_core.c x52_date_time.c x52_mfd_led.c \
x52_strerror.c x52_strerror.c
libx52_la_LDFLAGS = -version-info 3:0:1 -lusb-1.0 libx52_la_CFLAGS = @LIBUSB_CFLAGS@
libx52_la_LDFLAGS = -version-info 3:0:1 @LIBUSB_LIBS@
# Header files that need to be copied # Header files that need to be copied
x52includedir = $(includedir)/x52pro x52includedir = $(includedir)/x52pro

View File

@ -14,7 +14,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <libusb-1.0/libusb.h> #include <libusb.h>
#include "libx52.h" #include "libx52.h"
/* /*