Tested with cygwin, mingw32 and ubuntu...

Cygwin and ubuntu compiles smoothly but mingw complains a lot about wrong format strings. But fixing mingw is another patch...

/Ake

From 4914746a5614aeca312d57192399b9284e5593d1 Mon Sep 17 00:00:00 2001
From: ARE <ake.rehn...@gmail.com>
Date: Sat, 11 Mar 2017 16:07:31 +0100
Subject: [PATCH] Changed configure.ac to make libtool linking work with
 cygwin/mingw and ftd2xx.

-no-undefined was added to src/Makefile to allow dynamic linking of ftd2xx

Inclusion of windows.h was moved out from sysdep.h and added to direct.c and
libftd2xx.c
---
 urjtag/configure.ac                | 4 ++--
 urjtag/src/Makefile.am             | 2 +-
 urjtag/src/tap/parport/direct.c    | 4 +++-
 urjtag/src/tap/usbconn/libftd2xx.c | 8 ++++++++
 urjtag/sysdep.h                    | 4 ----
 5 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/urjtag/configure.ac b/urjtag/configure.ac
index 73610dc..da70f56 100644
--- a/urjtag/configure.ac
+++ b/urjtag/configure.ac
@@ -297,9 +297,9 @@ AS_IF([test "x$with_ftd2xx" = xyes -o "x$with_ftd2xx" = 
xcheck], [
     *cygwin*|*mingw*)
       CFLAGS="$CFLAGS -I$with_ftd2xx"
       AS_IF([test -d "$with_ftd2xx/i386"], [
-        FTD2XXLIB="$with_ftd2xx/i386/ftd2xx.lib"
+        FTD2XXLIB="-L$with_ftd2xx/i386 -l:ftd2xx.lib"
       ],[
-        FTD2XXLIB="$with_ftd2xx/ftd2xx.lib"
+        FTD2XXLIB="-L$with_ftd2xx -l:ftd2xx.lib"
       ])
       ;;
     *)
diff --git a/urjtag/src/Makefile.am b/urjtag/src/Makefile.am
index 0025d6a..b68f9fc 100644
--- a/urjtag/src/Makefile.am
+++ b/urjtag/src/Makefile.am
@@ -54,7 +54,7 @@ pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = urjtag.pc
 
 lib_LTLIBRARIES = liburjtag.la
-liburjtag_la_LDFLAGS = -version-info 0:0:0
+liburjtag_la_LDFLAGS = -version-info 0:0:0 -no-undefined
 
 liburjtag_la_SOURCES =
 
diff --git a/urjtag/src/tap/parport/direct.c b/urjtag/src/tap/parport/direct.c
index 10bea4d..c83885e 100644
--- a/urjtag/src/tap/parport/direct.c
+++ b/urjtag/src/tap/parport/direct.c
@@ -38,7 +38,9 @@
 #include "../parport.h"
 
 #if defined(HAVE_INPOUTXX)
-
+#ifdef HAVE_WINDOWS_H
+#include <windows.h>
+#endif
 static HINSTANCE inpout32_dll_handle = NULL;
 
 typedef short _stdcall (*inpfuncPtr) (short p);
diff --git a/urjtag/src/tap/usbconn/libftd2xx.c 
b/urjtag/src/tap/usbconn/libftd2xx.c
index 2a78ebc..cac1591 100644
--- a/urjtag/src/tap/usbconn/libftd2xx.c
+++ b/urjtag/src/tap/usbconn/libftd2xx.c
@@ -31,7 +31,15 @@
 #include <stdint.h>
 #include <unistd.h>
 
+#ifdef HAVE_WINDOWS_H
+#include <windows.h>
+#ifndef _WIN32
+#define _WIN32
+#endif
+#endif
+
 #include <ftd2xx.h>
+#undef interface
 
 #include <urjtag/error.h>
 #include <urjtag/log.h>
diff --git a/urjtag/sysdep.h b/urjtag/sysdep.h
index 734ed78..b4c27c9 100644
--- a/urjtag/sysdep.h
+++ b/urjtag/sysdep.h
@@ -43,10 +43,6 @@
 #define        ngettext(s,p,n) s
 #endif
 
-#ifdef HAVE_WINDOWS_H
-#include <windows.h>
-#endif
-
 #ifdef __MINGW32__
 /* Microsoft uses a different swprintf() than ISO C requires */
 #include <stdio.h>
-- 
2.8.3

------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
UrJTAG-development mailing list
UrJTAG-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/urjtag-development

Reply via email to