-fi # linux
-
-if test $build_ft2232_ftd2xx = yes -o $build_presto_ftd2xx = yes; then
-
-# Before we go any further - make sure we can *BUILD* and *RUN*
-# a simple app with the "ftd2xx.lib" file - in what ever form we where given
-# We should be able to compile, link and run this test program now
-AC_MSG_CHECKING([whether ftd2xx library works])
-
-#
-# Save the LDFLAGS for later..
-LDFLAGS_SAVE=$LDFLAGS
-CFLAGS_SAVE=$CFLAGS
-_LDFLAGS=`eval echo $LDFLAGS`
-_CFLAGS=`eval echo $CFLAGS`
-LDFLAGS=$_LDFLAGS
-CFLAGS=$_CFLAGS
-
-AC_RUN_IFELSE([AC_LANG_PROGRAM([[
-#include "confdefs.h"
-#if IS_WIN32
-#include "windows.h"
-#endif
-#include <stdio.h>
-#include <ftd2xx.h>
- ]], [[
- DWORD x;
- FT_GetLibraryVersion( &x );
- ]])], [
- AC_MSG_RESULT([Success!])
- ], [
- AC_MSG_ERROR([Cannot build & run test program using ftd2xx.lib])
- ], [
- AC_MSG_RESULT([Skipping as we are cross-compiling])
- ])
-
-AC_MSG_CHECKING([for ftd2xx highspeed 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_4232H;
- ]], [])], [
- 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 FTD2XX driver (version 2.04.16 or later).])
- fi
-
-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([[
-#include <stdio.h>
-#include <ftdi.h>
- ]], [[
- 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).])
- fi
-
-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