From 6aed88281aabf08f7042dbf9d2b23ae6ca75b02d Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Fri, 12 Jan 2007 22:41:05 +0000 Subject: [PATCH] * configure.ac: Improve the detection of the Win32 HID library, and the presence of the header ddk/hidsdi.h. It now works correctly under Cygwin and several flavours of MinGW. * Makefile.am: Add new LIBHID pattern. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk@719 81a1dc3b-b13d-400b-aceb-764788c761c2 --- avrdude/ChangeLog | 7 +++++++ avrdude/Makefile.am | 2 +- avrdude/configure.ac | 47 ++++++++++++++++++++++++-------------------- 3 files changed, 34 insertions(+), 22 deletions(-) diff --git a/avrdude/ChangeLog b/avrdude/ChangeLog index c464c149..46aa5625 100644 --- a/avrdude/ChangeLog +++ b/avrdude/ChangeLog @@ -1,3 +1,10 @@ +2007-01-12 Joerg Wunsch + + * configure.ac: Improve the detection of the Win32 HID library, + and the presence of the header ddk/hidsdi.h. It now works + correctly under Cygwin and several flavours of MinGW. + * Makefile.am: Add new LIBHID pattern. + 2007-01-11 Joerg Wunsch * butterfly.c (butterfly_initialize): when sending the 'T' diff --git a/avrdude/Makefile.am b/avrdude/Makefile.am index 5f881ab3..bd557830 100644 --- a/avrdude/Makefile.am +++ b/avrdude/Makefile.am @@ -47,7 +47,7 @@ avrdude_CPPFLAGS = -DCONFIG_DIR=\"$(sysconfdir)\" avrdude_CFLAGS = @ENABLE_WARNINGS@ -avrdude_LDADD = @LIBUSB@ +avrdude_LDADD = @LIBUSB@ @LIBHID@ bin_PROGRAMS = avrdude diff --git a/avrdude/configure.ac b/avrdude/configure.ac index bae45077..398a733f 100644 --- a/avrdude/configure.ac +++ b/avrdude/configure.ac @@ -60,16 +60,36 @@ if test x$have_libusb = xyes; then fi AC_SUBST(LIBUSB, $LIBUSB) +# Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS([limits.h stdlib.h string.h]) +AC_CHECK_HEADERS([fcntl.h sys/ioctl.h sys/time.h termios.h unistd.h]) +AC_CHECK_HEADERS([ddk/hidsdi.h],,,[#include +#include ]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_HEADER_TIME + +# Checks for library functions. +AC_PROG_GCC_TRADITIONAL +AC_FUNC_MALLOC +AC_CHECK_FUNCS([memset select strcasecmp strdup strerror strncasecmp strtol strtoul gettimeofday]) + AC_MSG_CHECKING([for a Win32 HID libray]) SAVED_LIBS="${LIBS}" case $target in - *-*-mingw32*) + *-*-mingw32* | *-*-cygwin* | *-*-windows*) LIBHID="-lhid -lsetupapi" - HIDINCLUDE="#include " + if test $ac_cv_header_ddk_hidsdi_h = yes + then + HIDINCLUDE="#include " + else + HIDINCLUDE="#include \"my_ddk_hidsdi.h\"" + fi ;; *) - LIBHID="-lhid" - HIDINCLUDE='#include "my_ddk_hidsdi.h"' + LIBHID="" ;; esac LIBS="${LIBS} ${LIBHID}" @@ -96,22 +116,7 @@ else LIBHID="" fi LIBS="${SAVED_LIBS}" - -# Checks for header files. -AC_HEADER_STDC -AC_CHECK_HEADERS([limits.h stdlib.h string.h]) -AC_CHECK_HEADERS([fcntl.h sys/ioctl.h sys/time.h termios.h unistd.h]) -AC_CHECK_HEADERS([ddk/hidsdi.h],,,[#include -#include ]) - -# Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_HEADER_TIME - -# Checks for library functions. -AC_PROG_GCC_TRADITIONAL -AC_FUNC_MALLOC -AC_CHECK_FUNCS([memset select strcasecmp strdup strerror strncasecmp strtol strtoul gettimeofday]) +AC_SUBST(LIBHID, $LIBHID) # Checks for misc stuff. @@ -232,7 +237,7 @@ export confsubst case $target in *-*-mingw32* | *-*-cygwin* | *-*-windows*) WINDOWS_DIRS="windows" - CFLAGS="-mno-cygwin -DWIN32NATIVE" + CFLAGS="${CFLAGS} -mno-cygwin -DWIN32NATIVE" LDFLAGS="${LDFLAGS} -static" ;; esac