+is_darwin=no
+
+if test $cross_compiling = no; then
+ # guess-rev.sh only exists in the repository, not in the released archives
+ AC_CHECK_FILE("$srcdir/guess-rev.sh", has_guess_rev=yes, has_guess_rev=no)
+
+ AC_MSG_CHECKING([whether to build a release])
+ if test $has_guess_rev = no; then
+ build_release=yes
+ else
+ build_release=no
+ fi
+ AC_MSG_RESULT($build_release)
+else
+ build_release=yes
+fi
+
+# We are not *ALWAYS* being installed in the standard place.
+# We may be installed in a "tool-build" specific location.
+# Normally with other packages - as part of a tool distro.
+# Thus - we should search that 'libdir' also.
+#
+# And - if we are being installed there - the odds are
+# The libraries unique to what we are are there too.
+#
+
+# Expand nd deal with NONE - just like configure will do later
+OCDprefix=$prefix
+OCDxprefix=$exec_prefix
+test x"$OCDprefix" = xNONE && OCDprefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test x"$OCDxprefix" = xNONE && OCDxprefix="$OCDprefix"
+
+# what matters is the "exec-prefix"
+if test "$OCDxprefix" != "$ac_default_prefix"
+then
+ # We are installing in a non-standard place
+ # Nonstandard --prefix and/or --exec-prefix
+ # We have an override of some sort.
+ # use build specific install library dir
+
+ LDFLAGS="$LDFLAGS -L$OCDxprefix/lib"
+ # RPATH becomes an issue on Linux only
+ if test $host_os = linux-gnu || test $host_os = linux ; then
+ LDFLAGS="$LDFLAGS -Wl,-rpath,$OCDxprefix/lib"
+ fi
+ # The "INCDIR" is also usable
+ CFLAGS="$CFLAGS -I$includedir"
+fi
+
+AC_ARG_WITH(ftd2xx,
+ AS_HELP_STRING([--with-ftd2xx=<PATH>],[This option has been removed.]),
+ [
+# Option Given.
+cat << __EOF__
+
+The option: --with-ftd2xx=<PATH> has been removed.
+On Linux, the new option is:
+
+ --with-ftd2xx-linux-tardir=/path/to/files
+
+Where <path> is the path the the directory where the "tar.gz" file
+from FTDICHIP.COM was unpacked, for example:
+
+ --with-ftd2xx-linux-tardir=${HOME}/libftd2xx0.4.16
+
+On Cygwin/MingW32, the new option is:
+
+ --with-ftd2xx-win32-zipdir=/path/to/files
+
+Where <path> is the path to the directory where the "zip" file from
+FTDICHIP.COM was unpacked, for example:
+
+ --with-ftd2xx-win32-zipdir=${HOME}/ftd2xx.cdm.files
+
+__EOF__
+
+ AC_MSG_ERROR([Sorry Cannot continue])
+ ], [true])
+
+#========================================
+# FTD2XXX support comes in 4 forms.
+# (1) win32 - via a zip file
+# (2) linux - via a tar file
+# (3) linux/cygwin/mingw - via libftdi
+# (4) darwin - installed under /usr/local
+#
+# In case (1) and (2) we need to know where the package was unpacked.
+
+AC_ARG_WITH(ftd2xx-win32-zipdir,
+ AS_HELP_STRING([--with-ftd2xx-win32-zipdir],[Where (CYGWIN/MINGW) the zip file from ftdichip.com was unpacked <default=search>]),
+ [
+ # option present
+ if test -d $with_ftd2xx_win32_zipdir
+ then
+ with_ftd2xx_win32_zipdir=`cd $with_ftd2xx_win32_zipdir && pwd`
+ AC_MSG_NOTICE([Using: ftdichip.com library: $with_ftd2xx_win32_zipdir])
+ else
+ AC_MSG_ERROR([Parameter to --with-ftd2xx-win32-zipdir is not a dir: $with_ftd2xx_win32_zipdir])
+ fi
+ ], [true])
+
+AC_ARG_WITH(ftd2xx-linux-tardir,
+ AS_HELP_STRING([--with-ftd2xx-linux-tardir], [Where (Linux/Unix) the tar file from ftdichip.com was unpacked <default=search>]),
+ [
+ # Option present
+ if test $is_win32 = yes ; then
+ AC_MSG_ERROR([The option: --with-ftd2xx-linux-tardir is only usable on linux])
+ fi
+ if test -d $with_ftd2xx_linux_tardir
+ then
+ with_ftd2xx_linux_tardir=`cd $with_ftd2xx_linux_tardir && pwd`
+ AC_MSG_NOTICE([Using: ftdichip.com library: $with_ftd2xx_linux_tardir])
+ else
+ AC_MSG_ERROR([Parameter to --with-ftd2xx-linux-tardir is not a dir: $with_ftd2xx_linux_tardir])
+ fi
+ ], [true])
+
+AC_ARG_WITH(ftd2xx-lib,
+ AS_HELP_STRING([--with-ftd2xx-lib],
+ [Use static or shared ftd2xx libs on default static]),
+ [
+ case "$withval" in
+ static)
+ with_ftd2xx_lib=$withval
+ ;;
+ shared)
+ with_ftd2xx_lib=$withval
+ ;;
+ *)
+ AC_MSG_ERROR([Option: --with-ftd2xx-lib=static or --with-ftd2xx-lib=shared not, $withval])
+ ;;
+ esac
+ ], [
+ # Default is static - it is simpler :-(
+ with_ftd2xx_lib=static
+ ])
+
+AC_ARG_ENABLE(gccwarnings,
+ AS_HELP_STRING([--disable-gccwarnings], [Disable compiler warnings]),
+ [gcc_warnings=$enableval], [gcc_warnings=yes])
+
+AC_ARG_ENABLE(wextra,
+ AS_HELP_STRING([--disable-wextra], [Disable extra compiler warnings]),
+ [gcc_wextra=$enableval], [gcc_wextra=$gcc_warnings])
+
+AC_ARG_ENABLE(werror,
+ AS_HELP_STRING([--disable-werror], [Do not treat warnings as errors]),
+ [gcc_werror=$enableval], [gcc_werror=$gcc_warnings])
+
+# set default verbose options, overridden by following options
+debug_jtag_io=no
+debug_usb_io=no
+debug_usb_comms=no
+
+AC_ARG_ENABLE(verbose,
+ AS_HELP_STRING([--enable-verbose],
+ [Enable verbose JTAG I/O messages (for debugging).]),
+ [
+ debug_jtag_io=$enableval
+ debug_usb_io=$enableval
+ debug_usb_comms=$enableval
+ ], [])
+
+AC_ARG_ENABLE(verbose_jtag_io,
+ AS_HELP_STRING([--enable-verbose-jtag-io],
+ [Enable verbose JTAG I/O messages (for debugging).]),
+ [debug_jtag_io=$enableval], [])
+AC_ARG_ENABLE(verbose_usb_io,
+ AS_HELP_STRING([--enable-verbose-usb-io],
+ [Enable verbose USB I/O messages (for debugging)]),
+ [debug_usb_io=$enableval], [])
+AC_ARG_ENABLE(verbose_usb_comms,
+ AS_HELP_STRING([--enable-verbose-usb-comms],
+ [Enable verbose USB communication messages (for debugging)]),
+ [debug_usb_comms=$enableval], [])
+
+AC_MSG_CHECKING([whether to enable verbose JTAG I/O messages]);
+AC_MSG_RESULT($debug_jtag_io)
+if test $debug_jtag_io = yes; then
+ AC_DEFINE([_DEBUG_JTAG_IO_],[1], [Print verbose JTAG I/O messages])
+fi
+
+AC_MSG_CHECKING([whether to enable verbose USB I/O messages]);
+AC_MSG_RESULT($debug_usb_io)
+if test $debug_usb_io = yes; then
+ AC_DEFINE([_DEBUG_USB_IO_],[1], [Print verbose USB I/O messages])
+fi
+
+AC_MSG_CHECKING([whether to enable verbose USB communication messages]);
+AC_MSG_RESULT($debug_usb_comms)
+if test $debug_usb_comms = yes; then
+ AC_DEFINE([_DEBUG_USB_COMMS_],[1], [Print verbose USB communication messages])
+fi
+
+
+debug_malloc=no
+AC_ARG_ENABLE(malloc_logging,
+ AS_HELP_STRING([--enable-malloc-logging],
+ [Include free space in logging messages (requires malloc.h).]),
+ [debug_malloc=$enableval], [])
+
+AC_MSG_CHECKING([whether to enable malloc free space logging]);
+AC_MSG_RESULT($debug_malloc)
+if test $debug_malloc = yes; then
+ AC_DEFINE([_DEBUG_FREE_SPACE_],[1], [Include malloc free space in logging])
+fi
+
+
+AC_ARG_ENABLE(dummy,
+ AS_HELP_STRING([--enable-dummy], [Enable building the dummy port driver]),
+ [build_dummy=$enableval], [build_dummy=no])