From c573e47717ce13c2bdb2f52ce2d021e23ce313ed 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/avrdude@719 81a1dc3b-b13d-400b-aceb-764788c761c2 --- ChangeLog | 7 +++++++ Makefile.am | 2 +- configure.ac | 47 ++++++++++++++++++++++++++--------------------- 3 files changed, 34 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index c464c149..46aa5625 100644 --- a/ChangeLog +++ b/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/Makefile.am b/Makefile.am index 5f881ab3..bd557830 100644 --- a/Makefile.am +++ b/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/configure.ac b/configure.ac index bae45077..398a733f 100644 --- a/configure.ac +++ b/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