[Pkg-voip-commits] [dahdi-tools] 256/285: configure.ac: add libusb/libusbx support (for xpp)
tzafrir at debian.org
tzafrir at debian.org
Thu Jul 7 19:19:08 UTC 2016
This is an automated email from the git hooks/post-receive script.
tzafrir pushed a commit to branch master
in repository dahdi-tools.
commit 5ee15a2337607cfd9867292acb404850fec895ea
Author: Oron Peled <oron.peled at xorcom.com>
Date: Mon Dec 15 06:40:14 2014 -0500
configure.ac: add libusb/libusbx support (for xpp)
* Use pkg-config
* For tight control have: --with-libusbx, --with-libusb
- For now, we choose libusb (AKA libusb-0.1)
- After committing support for libusbx (AKA libusb-1.0)
we'll change the default.
Signed-off-by: Oron Peled <oron.peled at xorcom.com>
Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
---
configure.ac | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
xpp/Makefile.am | 18 ++++++++++++++---
2 files changed, 75 insertions(+), 5 deletions(-)
diff --git a/configure.ac b/configure.ac
index 5a38257..38a1d12 100644
--- a/configure.ac
+++ b/configure.ac
@@ -182,6 +182,66 @@ AM_CONDITIONAL([PBX_PCAP], [test "$PBX_PCAP" = "1" -a "$DAHDI_TXMIRROR" = "1"])
AC_CHECK_FUNCS([semtimedop])
+# What the user asked for? libusb/libusbx
+AC_ARG_WITH([libusbx],
+ [AS_HELP_STRING([--without-libusbx], [Disable libusbx @<:@default=check@:>@])],
+ [],
+ [with_libusbx=check])
+AC_ARG_WITH([libusb],
+ [AS_HELP_STRING([--without-libusb], [Disable libusb-0.1 @<:@default=check@:>@])],
+ [],
+ [with_libusb=check])
+
+# LIBUSBX tests
+have_libusbx=
+AS_IF([test "$with_libusbx" = "yes"],
+ [PKG_CHECK_MODULES([LIBUSBX], [libusb-1.0],
+ [AC_CHECK_LIB([usb-1.0], [libusb_error_name],
+ [
+ have_libusbx="yes"
+ AC_SUBST([PKG_CONFIG_LIBUSB], [libusb-1.0])
+ AC_DEFINE([HAVE_LIBUSBX], [1], [Define to 1 if you have <libusb.h>.])
+ AC_SUBST([PBX_USB], [1])
+ ], [
+ if test "$with_libusbx" != "yes"; then
+ AC_MSG_NOTICE([Ignoring old libusb-1.0, trying fallback to old libusb])
+ fi
+ ])
+ ], [:])
+ ], [])
+
+AS_IF([test "$with_libusbx" = "yes" -a "$have_libusbx" = ""],
+ [AC_MSG_ERROR([No libusbx found (--with-libusbx was given)])])
+
+# LIBUSB tests
+have_libusb=
+AS_IF([test "$with_libusb" != "no"],
+ [AS_IF([test "$have_libusbx" != ""],
+ [
+ AS_IF([test "$with_libusbx" = "check"], [
+ AC_MSG_NOTICE([Skipping LIBUSB tests (have good LIBUSBX)])
+ ])
+ ], [
+ PKG_CHECK_MODULES([LIBUSB], [libusb],
+ [
+ have_libusb="yes"
+ AC_SUBST([PKG_CONFIG_LIBUSB], [libusb])
+ AC_SUBST([PBX_USB], [1])
+ ]
+ [AC_DEFINE([HAVE_LIBUSB], [1], [Define to 1 if you have <usb.h>.])],
+ [:]
+ )
+ ])
+ ], [])
+
+AS_IF([test "$with_libusb" = "yes" -a "$have_libusb" = ""],
+ [AC_MSG_ERROR([No libusb found (--with-libusb was given)])])
+
+AM_CONDITIONAL([LIBUSBX], [test "$have_libusbx" != ""])
+AM_CONDITIONAL([LIBUSB], [test "$have_libusb" != ""])
+AM_CONDITIONAL([PBX_USB], [test "$PBX_USB" = "1"])
+
+
PBX_HDLC=0
AC_MSG_CHECKING([for GENERIC_HDLC_VERSION version 4 in linux/hdlc.h])
AC_COMPILE_IFELSE(
@@ -296,8 +356,6 @@ fi
AC_SUBST(PPPD_VERSION)
-AM_CONDITIONAL([PBX_USB], [test "$PBX_USB" = "1"])
-
# Taken from octasic-helper
AC_SUBST([USE_OCTASIC], [yes])
AM_CONDITIONAL([USE_OCTASIC], [test "$USE_OCTASIC" = 'yes'])
diff --git a/xpp/Makefile.am b/xpp/Makefile.am
index fe58cfd..0168036 100644
--- a/xpp/Makefile.am
+++ b/xpp/Makefile.am
@@ -66,6 +66,18 @@ if PBX_USB
SUBDIRS += oct612x
+if LIBUSBX
+USB_CFLAGS = $(LIBUSBX_CFLAGS)
+USB_LIBS = $(LIBUSBX_LIBS)
+USB_NAME = libusbx
+else
+if LIBUSB
+USB_CFLAGS = $(LIBUSB_CFLAGS)
+USB_LIBS = $(LIBUSB_LIBS)
+USB_NAME = libusb
+endif
+endif
+
noinst_LTLIBRARIES = libastribank.la libecholoader.la libhexfile.la
libastribank_la_SOURCES = \
@@ -115,7 +127,7 @@ test_parse_LDADD = libhexfile.la
astribank_tool_SOURCES = astribank_tool.c
astribank_tool_CFLAGS = $(GLOBAL_CFLAGS)
-astribank_tool_LDFLAGS = $(USB_LIB)
+astribank_tool_LDFLAGS = $(USB_LIBS)
astribank_tool_LDADD = libastribank.la
astribank_hexload_SOURCES = \
@@ -125,7 +137,7 @@ astribank_hexload_SOURCES = \
#
astribank_hexload_CFLAGS = $(GLOBAL_CFLAGS) $(OCTASIC_CFLAGS)
-astribank_hexload_LDFLAGS = $(USB_LIB)
+astribank_hexload_LDFLAGS = $(USB_LIBS)
astribank_hexload_LDADD = \
libhexfile.la \
libastribank.la \
@@ -140,7 +152,7 @@ astribank_allow_SOURCES = \
#
astribank_allow_CFLAGS = $(GLOBAL_CFLAGS)
-astribank_allow_LDFLAGS = $(USB_LIB)
+astribank_allow_LDFLAGS = $(USB_LIBS)
astribank_allow_LDADD = libastribank.la
man_pages = \
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/dahdi-tools.git
More information about the Pkg-voip-commits
mailing list