build: remove hard coded ftdi and usb libraries
This patch remove the hardcoded libraries. Also a check for libftdi1 installations was added. This check fix an issue with gentoo and maybe other systems. Change-Id: Ieff9ec4d66ee0f3e6b22261a10e4cab9f26b6b51 Signed-off-by: Mathias K <kesmtp@freenet.de> Reviewed-on: http://openocd.zylin.com/1759 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
This commit is contained in:
parent
0da3f66ed4
commit
23be4e435f
19
configure.ac
19
configure.ac
|
@ -999,19 +999,29 @@ fi
|
||||||
|
|
||||||
if test $build_ft2232_libftdi = yes -o $build_usb_blaster_libftdi = yes -o \
|
if test $build_ft2232_libftdi = yes -o $build_usb_blaster_libftdi = yes -o \
|
||||||
$build_openjtag_ftdi = yes; then
|
$build_openjtag_ftdi = yes; then
|
||||||
# We assume: the package is preinstalled in the proper place
|
|
||||||
# these present as 2 libraries..
|
# we can have libftdi or libftdi1, so check it and use the latest one
|
||||||
LIBS="$LIBS -lftdi -lusb"
|
PKG_CHECK_MODULES([LIBFTDI], [libftdi1], [use_libftdi=yes], [use_libftdi=no])
|
||||||
|
if test $use_libftdi = no; then
|
||||||
|
PKG_CHECK_MODULES([LIBFTDI], [libftdi], [use_libftdi=yes], [use_libftdi=no])
|
||||||
|
fi
|
||||||
|
if test $use_libftdi = no; then
|
||||||
|
AC_MSG_ERROR([The libftdi driver is not present on your system.])
|
||||||
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Try to build a small program.
|
# Try to build a small program.
|
||||||
AC_MSG_CHECKING([Build & Link with libftdi...])
|
AC_MSG_CHECKING([Build & Link with libftdi...])
|
||||||
|
|
||||||
LDFLAGS_SAVE=$LDFLAGS
|
LDFLAGS_SAVE=$LDFLAGS
|
||||||
CFLAGS_SAVE=$CFLAGS
|
CFLAGS_SAVE=$CFLAGS
|
||||||
|
LIBS_SAVE=$LIBS
|
||||||
_LDFLAGS=`eval echo $LDFLAGS`
|
_LDFLAGS=`eval echo $LDFLAGS`
|
||||||
_CFLAGS=`eval echo $CFLAGS`
|
_CFLAGS=`eval echo $CFLAGS`
|
||||||
|
_LIBS=`eval echo $LIBS`
|
||||||
LDFLAGS=$_LDFLAGS
|
LDFLAGS=$_LDFLAGS
|
||||||
CFLAGS=$_CFLAGS
|
CFLAGS="$_CFLAGS $LIBFTDI_CFLAGS"
|
||||||
|
LIBS="$_LIBS $LIBFTDI_LIBS"
|
||||||
|
|
||||||
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
|
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -1075,6 +1085,7 @@ enum ftdi_chip_type x = TYPE_232H;
|
||||||
# Restore the 'unexpanded ldflags'
|
# Restore the 'unexpanded ldflags'
|
||||||
LDFLAGS=$LDFLAGS_SAVE
|
LDFLAGS=$LDFLAGS_SAVE
|
||||||
CFLAGS=$CFLAGS_SAVE
|
CFLAGS=$CFLAGS_SAVE
|
||||||
|
LIBS=$LIBS_SAVE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PKG_CHECK_MODULES([LIBUSB1], [libusb-1.0], [
|
PKG_CHECK_MODULES([LIBUSB1], [libusb-1.0], [
|
||||||
|
|
|
@ -52,7 +52,7 @@ libopenocd_la_CPPFLAGS += -DGITVERSION=\"`cd $(top_srcdir) && git describe`\"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# add default CPPFLAGS
|
# add default CPPFLAGS
|
||||||
libopenocd_la_CPPFLAGS += $(AM_CPPFLAGS) $(CPPFLAGS)
|
libopenocd_la_CPPFLAGS += $(AM_CPPFLAGS) $(CPPFLAGS) $(LIBFTDI_CFLAGS)
|
||||||
|
|
||||||
# the library search path.
|
# the library search path.
|
||||||
libopenocd_la_LDFLAGS = $(all_libraries)
|
libopenocd_la_LDFLAGS = $(all_libraries)
|
||||||
|
@ -63,25 +63,6 @@ else
|
||||||
MINGWLDADD =
|
MINGWLDADD =
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if FT2232_LIBFTDI
|
|
||||||
FTDI2232LIB = -lftdi -lusb
|
|
||||||
else
|
|
||||||
if PRESTO_LIBFTDI
|
|
||||||
FTDI2232LIB = -lftdi -lusb
|
|
||||||
else
|
|
||||||
FTDI2232LIB =
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBUSB =
|
|
||||||
if USE_LIBUSB1
|
|
||||||
LIBUSB += $(LIBUSB1_LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
if USE_LIBUSB0
|
|
||||||
LIBUSB += $(LIBUSB0_LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
libopenocd_la_LIBADD = \
|
libopenocd_la_LIBADD = \
|
||||||
$(top_builddir)/src/xsvf/libxsvf.la \
|
$(top_builddir)/src/xsvf/libxsvf.la \
|
||||||
$(top_builddir)/src/svf/libsvf.la \
|
$(top_builddir)/src/svf/libsvf.la \
|
||||||
|
@ -93,7 +74,8 @@ libopenocd_la_LIBADD = \
|
||||||
$(top_builddir)/src/server/libserver.la \
|
$(top_builddir)/src/server/libserver.la \
|
||||||
$(top_builddir)/src/rtos/librtos.la \
|
$(top_builddir)/src/rtos/librtos.la \
|
||||||
$(top_builddir)/src/helper/libhelper.la \
|
$(top_builddir)/src/helper/libhelper.la \
|
||||||
$(FTDI2232LIB) $(MINGWLDADD) $(LIBUSB)
|
$(LIBFTDI_LIBS) $(MINGWLDADD) \
|
||||||
|
$(LIBUSB1_LIBS) $(LIBUSB0_LIBS)
|
||||||
|
|
||||||
STARTUP_TCL_SRCS = \
|
STARTUP_TCL_SRCS = \
|
||||||
$(srcdir)/helper/startup.tcl \
|
$(srcdir)/helper/startup.tcl \
|
||||||
|
|
Loading…
Reference in New Issue