diff -up libftdi-0.18/aclocal.m4.libusb libftdi-0.18/aclocal.m4 --- libftdi-0.18/aclocal.m4.libusb 2010-12-06 11:22:51.207159911 +0100 +++ libftdi-0.18/aclocal.m4 2010-12-06 11:23:46.692156198 +0100 @@ -7968,6 +7968,162 @@ m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_D m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# +# Copyright © 2004 Scott James Remnant . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi + +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# +# Similar to PKG_CHECK_MODULES, make sure that the first instance of +# this or PKG_CHECK_MODULES is called, or make sure to call +# PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_ifval([$2], [$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + ifelse([$4], , [AC_MSG_ERROR(dnl +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT +])], + [AC_MSG_RESULT([no]) + $4]) +elif test $pkg_failed = untried; then + ifelse([$4], , [AC_MSG_FAILURE(dnl +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])], + [$4]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + ifelse([$3], , :, [$3]) +fi[]dnl +])# PKG_CHECK_MODULES + # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation diff -up libftdi-0.18/configure.in.libusb libftdi-0.18/configure.in --- libftdi-0.18/configure.in.libusb 2010-06-25 17:04:13.000000000 +0200 +++ libftdi-0.18/configure.in 2010-12-06 11:20:30.748660156 +0100 @@ -7,30 +7,12 @@ AC_PROG_CC AM_PROG_LIBTOOL AC_PROG_CXX -dnl check for libusb-config -AC_CHECK_TOOL(HAVELIBUSB, libusb-config) - -if test ! -z "$HAVELIBUSB"; then - LIBUSB_CFLAGS=`$HAVELIBUSB --cflags` - LIBUSB_LIBS=`$HAVELIBUSB --libs` - +dnl check for libusb +PKG_CHECK_MODULES(LIBUSB, libusb, +[ CFLAGS="$CFLAGS $LIBUSB_CFLAGS" LIBS="$LIBS $LIBUSB_LIBS" -else - AC_MSG_ERROR([*** libusb-config not found. You need a working libusb installation.]) -fi - -dnl check for version of libusb -AC_MSG_CHECKING([if libusb version is >= 0.1.7]) -libusb_version_needed="1007" -libusb_version=`$HAVELIBUSB --version | sed -e "s/libusb //" | awk 'BEGIN { FS = "."; } { printf "%d", ($''1 * 1000 + $''2) * 1000 + $''3;}'` - -if test $libusb_version -lt $libusb_version_needed; then - AC_MSG_RESULT(no) - AC_MSG_ERROR([*** libusb is too old ($libusb_version). You need a libusb installation newer or equal to 0.1.7.]) -else - AC_MSG_RESULT(yes) -fi +]) ENABLE_ASYNC_MODE=0 AC_ARG_WITH(async-mode, diff -up libftdi-0.18/configure.libusb libftdi-0.18/configure --- libftdi-0.18/configure.libusb 2010-12-06 11:20:51.143153972 +0100 +++ libftdi-0.18/configure 2010-12-06 11:23:52.276158997 +0100 @@ -815,7 +815,9 @@ BOOST_CPPFLAGS BUILD_EXAMPLES_FALSE BUILD_EXAMPLES_TRUE ENABLE_ASYNC_MODE -HAVELIBUSB +LIBUSB_LIBS +LIBUSB_CFLAGS +PKG_CONFIG CXXCPP am__fastdepCXX_FALSE am__fastdepCXX_TRUE @@ -957,7 +959,10 @@ CPP CXX CXXFLAGS CCC -CXXCPP' +CXXCPP +PKG_CONFIG +LIBUSB_CFLAGS +LIBUSB_LIBS' # Initialize some variables set by options. @@ -1629,6 +1634,10 @@ Some influential environment variables: CXX C++ compiler command CXXFLAGS C++ compiler flags CXXCPP C++ preprocessor + PKG_CONFIG path to pkg-config utility + LIBUSB_CFLAGS + C compiler flags for LIBUSB, overriding pkg-config + LIBUSB_LIBS linker flags for LIBUSB, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -15290,25 +15299,30 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}libusb-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}libusb-config; ac_word=$2 + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_HAVELIBUSB+set}" = set; then +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then $as_echo_n "(cached) " >&6 else - if test -n "$HAVELIBUSB"; then - ac_cv_prog_HAVELIBUSB="$HAVELIBUSB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_HAVELIBUSB="${ac_tool_prefix}libusb-config" + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -15316,12 +15330,13 @@ done done IFS=$as_save_IFS + ;; +esac fi -fi -HAVELIBUSB=$ac_cv_prog_HAVELIBUSB -if test -n "$HAVELIBUSB"; then - { $as_echo "$as_me:$LINENO: result: $HAVELIBUSB" >&5 -$as_echo "$HAVELIBUSB" >&6; } +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } @@ -15329,26 +15344,28 @@ fi fi -if test -z "$ac_cv_prog_HAVELIBUSB"; then - ac_ct_HAVELIBUSB=$HAVELIBUSB - # Extract the first word of "libusb-config", so it can be a program name with args. -set dummy libusb-config; ac_word=$2 +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_HAVELIBUSB+set}" = set; then +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then $as_echo_n "(cached) " >&6 else - if test -n "$ac_ct_HAVELIBUSB"; then - ac_cv_prog_ac_ct_HAVELIBUSB="$ac_ct_HAVELIBUSB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_HAVELIBUSB="libusb-config" + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -15356,19 +15373,20 @@ done done IFS=$as_save_IFS + ;; +esac fi -fi -ac_ct_HAVELIBUSB=$ac_cv_prog_ac_ct_HAVELIBUSB -if test -n "$ac_ct_HAVELIBUSB"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_HAVELIBUSB" >&5 -$as_echo "$ac_ct_HAVELIBUSB" >&6; } +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi - if test "x$ac_ct_HAVELIBUSB" = x; then - HAVELIBUSB="" + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" else case $cross_compiling:$ac_tool_warned in yes:) @@ -15376,39 +15394,138 @@ yes:) $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac - HAVELIBUSB=$ac_ct_HAVELIBUSB + PKG_CONFIG=$ac_pt_PKG_CONFIG fi else - HAVELIBUSB="$ac_cv_prog_HAVELIBUSB" + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { $as_echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi -if test ! -z "$HAVELIBUSB"; then - LIBUSB_CFLAGS=`$HAVELIBUSB --cflags` - LIBUSB_LIBS=`$HAVELIBUSB --libs` +fi - CFLAGS="$CFLAGS $LIBUSB_CFLAGS" - LIBS="$LIBS $LIBUSB_LIBS" +pkg_failed=no +{ $as_echo "$as_me:$LINENO: checking for LIBUSB" >&5 +$as_echo_n "checking for LIBUSB... " >&6; } + +if test -n "$LIBUSB_CFLAGS"; then + pkg_cv_LIBUSB_CFLAGS="$LIBUSB_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libusb\"") >&5 + ($PKG_CONFIG --exists --print-errors "libusb") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_LIBUSB_CFLAGS=`$PKG_CONFIG --cflags "libusb" 2>/dev/null` else - { { $as_echo "$as_me:$LINENO: error: *** libusb-config not found. You need a working libusb installation." >&5 -$as_echo "$as_me: error: *** libusb-config not found. You need a working libusb installation." >&2;} - { (exit 1); exit 1; }; } + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBUSB_LIBS"; then + pkg_cv_LIBUSB_LIBS="$LIBUSB_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libusb\"") >&5 + ($PKG_CONFIG --exists --print-errors "libusb") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_LIBUSB_LIBS=`$PKG_CONFIG --libs "libusb" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried fi -{ $as_echo "$as_me:$LINENO: checking if libusb version is >= 0.1.7" >&5 -$as_echo_n "checking if libusb version is >= 0.1.7... " >&6; } -libusb_version_needed="1007" -libusb_version=`$HAVELIBUSB --version | sed -e "s/libusb //" | awk 'BEGIN { FS = "."; } { printf "%d", ($''1 * 1000 + $''2) * 1000 + $''3;}'` -if test $libusb_version -lt $libusb_version_needed; then - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:$LINENO: error: *** libusb is too old ($libusb_version). You need a libusb installation newer or equal to 0.1.7." >&5 -$as_echo "$as_me: error: *** libusb is too old ($libusb_version). You need a libusb installation newer or equal to 0.1.7." >&2;} + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBUSB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libusb" 2>&1` + else + LIBUSB_PKG_ERRORS=`$PKG_CONFIG --print-errors "libusb" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBUSB_PKG_ERRORS" >&5 + + { { $as_echo "$as_me:$LINENO: error: Package requirements (libusb) were not met: + +$LIBUSB_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables LIBUSB_CFLAGS +and LIBUSB_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. +" >&5 +$as_echo "$as_me: error: Package requirements (libusb) were not met: + +$LIBUSB_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables LIBUSB_CFLAGS +and LIBUSB_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. +" >&2;} { (exit 1); exit 1; }; } +elif test $pkg_failed = untried; then + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables LIBUSB_CFLAGS +and LIBUSB_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables LIBUSB_CFLAGS +and LIBUSB_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } else - { $as_echo "$as_me:$LINENO: result: yes" >&5 + LIBUSB_CFLAGS=$pkg_cv_LIBUSB_CFLAGS + LIBUSB_LIBS=$pkg_cv_LIBUSB_LIBS + { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } + + CFLAGS="$CFLAGS $LIBUSB_CFLAGS" + LIBS="$LIBS $LIBUSB_LIBS" + fi ENABLE_ASYNC_MODE=0