aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Schink <openocd-dev@marcschink.de>2016-06-06 22:01:33 +0200
committerPaul Fertser <fercerpav@gmail.com>2016-11-05 20:38:51 +0000
commit37ed4751e857563d39b2da04360c9bd2b576aed0 (patch)
tree6fea6f9a3b7fe771a48643bf05c8c257412c8326
parent21832327eed48be9d44607890d11d31b88d1bd30 (diff)
configure.ac: Fix libjaylink integration
Do not configure internal libjaylink if libusb-1.0 is not available or if J-Link driver is disabled (--disable-jlink). Change-Id: I021bca91dbbc33888a997c664f7836225306c3ef Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/3528 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
-rw-r--r--configure.ac38
-rw-r--r--src/Makefile.am4
-rw-r--r--src/jtag/drivers/Makefile.am1
3 files changed, 23 insertions, 20 deletions
diff --git a/configure.ac b/configure.ac
index fb5514ee..bec3b39f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -201,7 +201,6 @@ m4_define([ADAPTER_OPT], [m4_translit(ADAPTER_ARG($1), [_], [-])])
m4_define([USB1_ADAPTERS],
[[[ftdi], [MPSSE mode of FTDI based devices], [FTDI]],
- [[jlink], [Segger J-Link JTAG Programmer], [JLINK]],
[[stlink], [ST-Link JTAG Programmer], [HLADAPTER_STLINK]],
[[ti_icdi], [TI ICDI JTAG Programmer], [HLADAPTER_ICDI]],
[[ulink], [Keil ULINK JTAG Programmer], [ULINK]],
@@ -221,6 +220,9 @@ m4_define([USB0_ADAPTERS],
m4_define([HIDAPI_ADAPTERS],
[[[cmsis_dap], [CMSIS-DAP Compliant Debugger], [CMSIS_DAP]]])
+m4_define([LIBJAYLINK_ADAPTERS],
+ [[[jlink], [Segger J-Link JTAG Programmer], [JLINK]]])
+
#========================================
# FTD2XXX support comes in 4 forms.
# (1) win32 - via a zip file
@@ -379,7 +381,7 @@ m4_define([AC_ARG_ADAPTERS], [
])
])
-AC_ARG_ADAPTERS([USB1_ADAPTERS, USB_ADAPTERS, USB0_ADAPTERS, HIDAPI_ADAPTERS], [auto])
+AC_ARG_ADAPTERS([USB1_ADAPTERS, USB_ADAPTERS, USB0_ADAPTERS, HIDAPI_ADAPTERS, LIBJAYLINK_ADAPTERS], [auto])
AC_ARG_ENABLE([parport],
AS_HELP_STRING([--enable-parport], [Enable building the pc parallel port driver]),
@@ -792,19 +794,6 @@ if test $use_internal_jimtcl = yes; then
fi
fi
-if test $use_internal_libjaylink = yes; then
- if test -f "$srcdir/src/jtag/drivers/libjaylink/configure.ac"; then
- ( cd $srcdir/src/jtag/drivers/libjaylink/ && ./autogen.sh )
- AX_CONFIG_SUBDIR_OPTION([src/jtag/drivers/libjaylink],
- [--enable-subproject-build])
- else
- AC_MSG_ERROR([Internal libjaylink not found, run either 'git submodule init' and 'git submodule update' or disable internal libjaylink with --disable-internal-libjaylink.])
- fi
-else
- PKG_CHECK_MODULES([libjaylink], [libjaylink >= 0.1],
- [CFLAGS="$CFLAGS $libjaylink_CFLAGS"; LIBS="$LIBS $libjaylink_LIBS"; HAVE_LIBJAYLINK=yes], [HAVE_LIBJAYLINK=no])
-fi
-
if test $build_remote_bitbang = yes; then
build_bitbang=yes
AC_DEFINE([BUILD_REMOTE_BITBANG], [1], [1 if you want the Remote Bitbang JTAG driver.])
@@ -1160,6 +1149,9 @@ for hidapi_lib in hidapi hidapi-hidraw hidapi-libusb; do
])
done
+PKG_CHECK_MODULES([libjaylink], [libjaylink >= 0.1],
+ [HAVE_LIBJAYLINK=yes], [HAVE_LIBJAYLINK=no])
+
m4_define([PROCESS_ADAPTERS], [
m4_foreach([adapter], [$1], [
if test $2; then
@@ -1182,6 +1174,7 @@ PROCESS_ADAPTERS([USB1_ADAPTERS], [$use_libusb1 = yes], [libusb-1.x])
PROCESS_ADAPTERS([USB_ADAPTERS], [$use_libusb1 = yes -o $use_libusb0 = yes], [libusb-1.x or libusb-0.1])
PROCESS_ADAPTERS([USB0_ADAPTERS], [$use_libusb0 = yes], [libusb-0.1])
PROCESS_ADAPTERS([HIDAPI_ADAPTERS], [$use_hidapi = yes], [hidapi])
+PROCESS_ADAPTERS([LIBJAYLINK_ADAPTERS], [$use_libusb1 = yes -a $use_internal_libjaylink = yes -o $HAVE_LIBJAYLINK = yes], [libusb-1.x or libjaylink-0.1])
if test $enable_stlink != no -o $enable_ti_icdi != no; then
AC_DEFINE([BUILD_HLADAPTER], [1], [1 if you want the High Level JTAG driver.])
@@ -1190,11 +1183,15 @@ else
fi
AM_CONDITIONAL([HLADAPTER], [test $enable_stlink != no -o $enable_ti_icdi != no])
-# Disable J-Link driver if internal libjaylink is disabled and libjaylink was
-# not found by pkg-config.
if test $enable_jlink != no; then
- if test $use_internal_libjaylink$HAVE_LIBJAYLINK = nono; then
- enable_jlink=no
+ if test $use_internal_libjaylink = yes; then
+ if test -f "$srcdir/src/jtag/drivers/libjaylink/configure.ac"; then
+ ( cd $srcdir/src/jtag/drivers/libjaylink/ && ./autogen.sh )
+ AX_CONFIG_SUBDIR_OPTION([src/jtag/drivers/libjaylink],
+ [--enable-subproject-build])
+ else
+ AC_MSG_ERROR([Internal libjaylink not found, run either 'git submodule init' and 'git submodule update' or disable internal libjaylink with --disable-internal-libjaylink.])
+ fi
fi
fi
@@ -1317,7 +1314,8 @@ echo
echo
echo OpenOCD configuration summary
echo --------------------------------------------------
-m4_foreach([adapter], [USB1_ADAPTERS, USB_ADAPTERS, USB0_ADAPTERS, HIDAPI_ADAPTERS],
+m4_foreach([adapter], [USB1_ADAPTERS, USB_ADAPTERS, USB0_ADAPTERS,
+ HIDAPI_ADAPTERS, LIBJAYLINK_ADAPTERS],
[s=m4_format(["%-40s"], ADAPTER_DESC([adapter]))
case $ADAPTER_VAR([adapter]) in
auto)
diff --git a/src/Makefile.am b/src/Makefile.am
index 26e02d08..fe403366 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -76,6 +76,10 @@ libopenocd_la_LIBADD = \
$(LIBFTDI_LIBS) $(MINGWLDADD) \
$(HIDAPI_LIBS) $(LIBUSB0_LIBS) $(LIBUSB1_LIBS)
+if !INTERNAL_LIBJAYLINK
+libopenocd_la_LIBADD += $(libjaylink_LIBS)
+endif
+
STARTUP_TCL_SRCS = \
$(srcdir)/helper/startup.tcl \
$(srcdir)/jtag/startup.tcl \
diff --git a/src/jtag/drivers/Makefile.am b/src/jtag/drivers/Makefile.am
index 2aaf8fd8..00d8371c 100644
--- a/src/jtag/drivers/Makefile.am
+++ b/src/jtag/drivers/Makefile.am
@@ -33,6 +33,7 @@ noinst_LTLIBRARIES += libjaylink_internal.la
libocdjtagdrivers_la_LIBADD += libjaylink_internal.la
else
DRIVERFILES += jlink.c
+libocdjtagdrivers_la_CPPFLAGS += $(libjaylink_CFLAGS)
endif
endif