Newer
Older
#include "windows.h"
#endif
#include <stdio.h>
#include <ftd2xx.h>
AC_DEFINE([BUILD_FT2232_HIGHSPEED], [1],
[Support FT2232H/FT4232HS with FTD2XX or libftdi.])
build_ft2232_highspeed=yes
AC_MSG_RESULT([$build_ft2232_highspeed])
if test $build_ft2232_highspeed = no; then
AC_MSG_WARN([You need a newer FTD2XX driver (version 2.04.16 or later).])
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
AC_MSG_CHECKING([for ftd2xx FT232H device support])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include "confdefs.h"
#if IS_WIN32
#include "windows.h"
#endif
#include <stdio.h>
#include <ftd2xx.h>
DWORD x = FT_DEVICE_232H;
]], [])], [
AC_DEFINE([HAS_ENUM_FT232H], [1],
[Support FT232H with FTD2XX or libftdi.])
has_enum_ft232h=yes
], [
has_enum_ft232h=no
])
AC_MSG_RESULT([$has_enum_ft232h])
if test $has_enum_ft232h = no; then
AC_MSG_WARN([You need a newer FTD2XX driver (version 2.08.12 or later).])
fi
LDFLAGS=$LDFLAGS_SAVE
CFLAGS=$CFLAGS_SAVE
fi
if test $build_ft2232_libftdi = yes ; then
# We assume: the package is preinstalled in the proper place
# these present as 2 libraries..
LIBS="$LIBS -lftdi -lusb"
# Try to build a small program.
AC_MSG_CHECKING([Build & Link with libftdi...])
LDFLAGS_SAVE=$LDFLAGS
CFLAGS_SAVE=$CFLAGS
_LDFLAGS=`eval echo $LDFLAGS`
_CFLAGS=`eval echo $CFLAGS`
LDFLAGS=$_LDFLAGS
CFLAGS=$_CFLAGS
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
struct ftdi_context *p;
p = ftdi_new();
if( p != NULL ){
return 0;
} else {
fprintf( stderr, "calling ftdi_new() failed\n");
return 1;
}
AC_MSG_RESULT([Success])
], [
AC_MSG_ERROR([Cannot build & run test program using libftdi])
], [
AC_MSG_RESULT([Skipping as we are cross-compiling])
AC_MSG_CHECKING([for libftdi highspeed device support])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#include <ftdi.h>
enum ftdi_chip_type x = TYPE_2232H;
AC_DEFINE([BUILD_FT2232_HIGHSPEED], [1],
[Support FT2232H/FT4232HS with FTD2XX or libftdi.])
build_ft2232_highspeed=yes
], [
build_ft2232_highspeed=no
])
AC_MSG_RESULT([$build_ft2232_highspeed])
if test $build_ft2232_highspeed = no; then
AC_MSG_WARN([You need a newer libftdi version (0.16 or later).])
AC_MSG_CHECKING([for libftdi FT232H device support])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#include <ftdi.h>
]], [[
enum ftdi_chip_type x = TYPE_232H;
]])], [
AC_DEFINE([HAS_ENUM_FT232H], [1],
[Support FT232H with FTD2XX or libftdi.])
has_enum_ft232h=yes
], [
has_enum_ft232h=no
])
AC_MSG_RESULT([$has_enum_ft232h])
if test $has_enum_ft232h = no; then
AC_MSG_WARN([You need a newer libftdi version (0.20 or later).])
fi
# Restore the 'unexpanded ldflags'
LDFLAGS=$LDFLAGS_SAVE
CFLAGS=$CFLAGS_SAVE
fi
# check for usb.h when a driver will require it
if test $build_vsllink = yes -o $build_usbprog = yes -o \
$build_rlink = yes -o $build_ulink = yes -o $build_armjtagew = yes
# Check for libusb1 ported drivers.
build_usb_ng=no
if test $build_jlink = yes -o $build_stlink = yes -o $build_osbdm = yes -o \
$build_opendous = yes -o $build_ftdi = yes
# check for libusb library if necessary
use_libusb0=no
use_libusb1=no
if test $build_usb = yes -o $build_usb_ng = yes; then
if test $check_libusb0 = no -a $build_usb_ng = yes; then
AC_CHECK_HEADER([libusb-1.0/libusb.h],
[AC_DEFINE(HAVE_LIBUSB1, 1, [Define if you have libusb-1.0]) check_libusb0=no use_libusb1=yes ],
[ check_libusb0=yes use_libusb1=no ])
fi
if test $check_libusb0 = yes -o $build_usb = yes; then
AC_CHECK_HEADERS([usb.h], [use_libusb0=yes],
[AC_MSG_ERROR([libusb or libusb-1.0 are required to build some OpenOCD driver(s)])])
fi
fi
AM_CONDITIONAL([RELEASE], [test $build_release = yes])
AM_CONDITIONAL([PARPORT], [test $build_parport = yes])
AM_CONDITIONAL([DUMMY], [test $build_dummy = yes])
AM_CONDITIONAL([GIVEIO], [test x$parport_use_giveio = xyes])
AM_CONDITIONAL([EP93XX], [test $build_ep93xx = yes])
AM_CONDITIONAL([ZY1000], [test $build_zy1000 = yes])
AM_CONDITIONAL([ZY1000_MASTER], [test $build_zy1000_master = yes])
AM_CONDITIONAL([IOUTIL], [test $build_ioutil = yes])
AM_CONDITIONAL([AT91RM9200], [test $build_at91rm9200 = yes])
AM_CONDITIONAL([BITBANG], [test $build_bitbang = yes])
AM_CONDITIONAL([FT2232_LIBFTDI], [test $build_ft2232_libftdi = yes])
AM_CONDITIONAL([FT2232_DRIVER], [test $build_ft2232_ftd2xx = yes -o $build_ft2232_libftdi = yes])
AM_CONDITIONAL([FTDI_DRIVER], [test $build_ftdi = yes])
AM_CONDITIONAL([USB_BLASTER_LIBFTDI], [test $build_usb_blaster_libftdi = yes])
AM_CONDITIONAL([USB_BLASTER_DRIVER], [test $build_usb_blaster_ftd2xx = yes -o $build_usb_blaster_libftdi = yes])
AM_CONDITIONAL([AMTJTAGACCEL], [test $build_amtjtagaccel = yes])
AM_CONDITIONAL([GW16012], [test $build_gw16012 = yes])
AM_CONDITIONAL([PRESTO_LIBFTDI], [test $build_presto_libftdi = yes])
AM_CONDITIONAL([PRESTO_DRIVER], [test $build_presto_ftd2xx = yes -o $build_presto_libftdi = yes])
AM_CONDITIONAL([USBPROG], [test $build_usbprog = yes])
AM_CONDITIONAL([OOCD_TRACE], [test $build_oocd_trace = yes])
AM_CONDITIONAL([JLINK], [test $build_jlink = yes])
AM_CONDITIONAL([VSLLINK], [test $build_vsllink = yes])
AM_CONDITIONAL([RLINK], [test $build_rlink = yes])
AM_CONDITIONAL([ULINK], [test $build_ulink = yes])
AM_CONDITIONAL([ARMJTAGEW], [test $build_armjtagew = yes])
AM_CONDITIONAL([REMOTE_BITBANG], [test $build_remote_bitbang = yes])
AM_CONDITIONAL([BUSPIRATE], [test $build_buspirate = yes])
AM_CONDITIONAL([STLINK], [test $build_stlink = yes])
AM_CONDITIONAL([OSBDM], [test $build_osbdm = yes])
AM_CONDITIONAL([OPENDOUS], [test $build_opendous = yes])
AM_CONDITIONAL([USB], [test $build_usb = yes])
AM_CONDITIONAL([USB_NG], [test $build_usb_ng = yes])
AM_CONDITIONAL([USE_LIBUSB0], [test $use_libusb0 = yes])
AM_CONDITIONAL([USE_LIBUSB1], [test $use_libusb1 = yes])
AM_CONDITIONAL([IS_CYGWIN], [test $is_cygwin = yes])
AM_CONDITIONAL([IS_MINGW], [test $is_mingw = ye]s)
AM_CONDITIONAL([IS_WIN32], [test $is_win32 = ye]s)
AM_CONDITIONAL([IS_DARWIN], [test $is_darwin = ye]s)
AM_CONDITIONAL([BITQ], [test $build_bitq = yes])
AM_CONDITIONAL([MINIDRIVER], [test $build_minidriver = ye]s)
AM_CONDITIONAL([MINIDRIVER_DUMMY], [test $build_minidriver_dummy = yes])
AM_CONDITIONAL([INTERNAL_JIMTCL], [test $use_internal_jimtcl = yes])
# Look for environ alternatives. Possibility #1: is environ in unistd.h or stdlib.h?
AC_MSG_CHECKING([for environ in unistd.h and stdlib.h])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#define _GNU_SOURCE
#include <unistd.h>
#include <stdlib.h>
]], [[char **ep = environ;]]
)], [
AC_MSG_RESULT([yes])
has_environ=yes
], [
AC_MSG_RESULT([no])
# Possibility #2: can environ be found in an available library?
AC_MSG_CHECKING([for extern environ])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
extern char **environ;
]], [[char **ep = environ;]]
)], [
AC_DEFINE(NEED_ENVIRON_EXTERN, [1], [Must declare 'environ' to use it.])
has_environ=yes
], [
has_environ=no
])
AC_MSG_RESULT([${has_environ}])
])
if test "${has_environ}" != "yes" ; then
AC_MSG_FAILURE([Could not find 'environ' in unistd.h or available libraries.])
fi
AC_DEFINE([_GNU_SOURCE],[1],[Use GNU C library extensions (e.g. stdndup).])
# set default gcc warnings
GCC_WARNINGS="-Wall -Wstrict-prototypes -Wformat-security -Wshadow"
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
if test "${gcc_wextra}" = yes; then
GCC_WARNINGS="${GCC_WARNINGS} -Wextra -Wno-unused-parameter"
GCC_WARNINGS="${GCC_WARNINGS} -Wbad-function-cast"
GCC_WARNINGS="${GCC_WARNINGS} -Wcast-align"
GCC_WARNINGS="${GCC_WARNINGS} -Wredundant-decls"
fi
if test "${gcc_werror}" = yes; then
GCC_WARNINGS="${GCC_WARNINGS} -Werror"
fi
# overide default gcc cflags
if test $gcc_warnings = yes; then
CFLAGS="$CFLAGS $GCC_WARNINGS"
fi
# Setup for compiling build tools
AC_MSG_CHECKING([for a C compiler for build tools])
if test $cross_compiling = yes; then
AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
CFLAGS_FOR_BUILD="-g -O2 $GCC_WARNINGS"
else
CC_FOR_BUILD=$CC
CFLAGS_FOR_BUILD=$CFLAGS
fi
AC_MSG_RESULT([$CC_FOR_BUILD])
AC_SUBST([CC_FOR_BUILD])
AC_SUBST([CFLAGS_FOR_BUILD])
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
AC_MSG_CHECKING([for suffix of executable build tools])
if test $cross_compiling = yes; then
cat >conftest.c <<\_______EOF
int main ()
{
exit (0);
}
_______EOF
for i in .exe ""; do
compile="$CC_FOR_BUILD conftest.c -o conftest$i"
if AC_TRY_EVAL(compile); then
if (./conftest) 2>&AC_FD_CC; then
EXEEXT_FOR_BUILD=$i
break
fi
fi
done
rm -f conftest*
if test "${EXEEXT_FOR_BUILD+set}" != set; then
AC_MSG_ERROR([Cannot determine suffix of executable build tools])
fi
else
EXEEXT_FOR_BUILD=$EXEEXT
fi
AC_MSG_RESULT([$EXEEXT_FOR_BUILD])
AC_SUBST([EXEEXT_FOR_BUILD])
AC_CONFIG_FILES([
Makefile
src/Makefile
src/helper/Makefile
src/jtag/Makefile
src/jtag/drivers/Makefile
src/transport/Makefile
src/xsvf/Makefile
src/svf/Makefile
src/target/Makefile
src/rtos/Makefile
src/server/Makefile
src/flash/Makefile
src/flash/nor/Makefile
src/flash/nand/Makefile
src/pld/Makefile
doc/Makefile
])
AC_OUTPUT