Commit 1fe3dc7c20dc4dbd8fed0d19c8618027d44ed971

Anthony Green 2009-12-25T01:39:00

Add windows support patch.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
diff --git a/.pc/applied-patches b/.pc/applied-patches
index 4eb83f7..991579e 100644
--- a/.pc/applied-patches
+++ b/.pc/applied-patches
@@ -4,3 +4,4 @@ snow-leopard
 sgi-mips
 fix-docs
 fix-huge_struct-test
+windows
diff --git a/ChangeLog.libffi b/ChangeLog.libffi
index 51ea348..0c53b85 100644
--- a/ChangeLog.libffi
+++ b/ChangeLog.libffi
@@ -1,3 +1,10 @@
+2009-12-25  Carlo Bramini  <carlo.bramix@libero.it>
+
+	* configure.ac (AM_LTLDFLAGS): Define for windows hosts.
+	* Makefile.am (libffi_la_LDFLAGS): Add AM_LTLDFLAGS.
+	* configure: Rebuilt.
+	* Makefile.in: Rebuilt.
+
 2009-12-24  Anthony Green  <green@redhat.com>
 
 	* testsuite/libffi.call/huge_struct.c: Fix printf format, and
@@ -224,20 +231,20 @@
 2008-12-22  Timothy Wall  <twall@users.sf.net>
 
 	* testsuite/libffi.call/closure_fn0.c,
-        testsuite/libffi.call/closure_fn1.c,    
-        testsuite/libffi.call/closure_fn2.c,    
-        testsuite/libffi.call/closure_fn3.c,    
-        testsuite/libffi.call/closure_fn4.c,    
-        testsuite/libffi.call/closure_fn5.c,    
-        testsuite/libffi.call/closure_fn6.c,    
-        testsuite/libffi.call/closure_loc_fn0.c,    
-        testsuite/libffi.call/closure_stdcall.c,    
-        testsuite/libffi.call/cls_align_pointer.c,    
-        testsuite/libffi.call/cls_pointer.c,    
+        testsuite/libffi.call/closure_fn1.c,
+        testsuite/libffi.call/closure_fn2.c,
+        testsuite/libffi.call/closure_fn3.c,
+        testsuite/libffi.call/closure_fn4.c,
+        testsuite/libffi.call/closure_fn5.c,
+        testsuite/libffi.call/closure_fn6.c,
+        testsuite/libffi.call/closure_loc_fn0.c,
+        testsuite/libffi.call/closure_stdcall.c,
+        testsuite/libffi.call/cls_align_pointer.c,
+        testsuite/libffi.call/cls_pointer.c,
         testsuite/libffi.call/cls_pointer_stack.c: use portable cast from
         pointer to integer (intptr_t).
         * testsuite/libffi.call/cls_longdouble.c: disable for win64.
-	
+
 2008-12-19  Anthony Green  <green@redhat.com>
 
 	* configure.ac: Bump version to 3.0.8.
diff --git a/Makefile.am b/Makefile.am
index 8992fc2..edfd6d9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -175,7 +175,7 @@ nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES)
 
 AM_CFLAGS = -Wall -g -fexceptions
 
-libffi_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version`
+libffi_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(AM_LTLDFLAGS)
 
 AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
 AM_CCASFLAGS = $(AM_CPPFLAGS)
diff --git a/Makefile.in b/Makefile.in
index 98d0345..49afcc1 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -52,14 +52,15 @@ target_triplet = @target@
 @POWERPC_DARWIN_TRUE@am__append_14 = src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S
 @POWERPC_FREEBSD_TRUE@am__append_15 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S
 @ARM_TRUE@am__append_16 = src/arm/sysv.S src/arm/ffi.c
-@LIBFFI_CRIS_TRUE@am__append_17 = src/cris/sysv.S src/cris/ffi.c
-@FRV_TRUE@am__append_18 = src/frv/eabi.S src/frv/ffi.c
-@S390_TRUE@am__append_19 = src/s390/sysv.S src/s390/ffi.c
-@X86_64_TRUE@am__append_20 = src/x86/ffi64.c src/x86/unix64.S src/x86/ffi.c src/x86/sysv.S
-@SH_TRUE@am__append_21 = src/sh/sysv.S src/sh/ffi.c
-@SH64_TRUE@am__append_22 = src/sh64/sysv.S src/sh64/ffi.c
-@PA_LINUX_TRUE@am__append_23 = src/pa/linux.S src/pa/ffi.c
-@PA_HPUX_TRUE@am__append_24 = src/pa/hpux32.S src/pa/ffi.c
+@AVR32_TRUE@am__append_17 = src/avr32/sysv.S src/avr32/ffi.c
+@LIBFFI_CRIS_TRUE@am__append_18 = src/cris/sysv.S src/cris/ffi.c
+@FRV_TRUE@am__append_19 = src/frv/eabi.S src/frv/ffi.c
+@S390_TRUE@am__append_20 = src/s390/sysv.S src/s390/ffi.c
+@X86_64_TRUE@am__append_21 = src/x86/ffi64.c src/x86/unix64.S src/x86/ffi.c src/x86/sysv.S
+@SH_TRUE@am__append_22 = src/sh/sysv.S src/sh/ffi.c
+@SH64_TRUE@am__append_23 = src/sh64/sysv.S src/sh64/ffi.c
+@PA_LINUX_TRUE@am__append_24 = src/pa/linux.S src/pa/ffi.c
+@PA_HPUX_TRUE@am__append_25 = src/pa/hpux32.S src/pa/ffi.c
 subdir = .
 DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in $(srcdir)/doc/stamp-vti \
@@ -134,15 +135,16 @@ am_libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo src/types.lo \
 @POWERPC_FREEBSD_TRUE@	src/powerpc/sysv.lo \
 @POWERPC_FREEBSD_TRUE@	src/powerpc/ppc_closure.lo
 @ARM_TRUE@am__objects_16 = src/arm/sysv.lo src/arm/ffi.lo
-@LIBFFI_CRIS_TRUE@am__objects_17 = src/cris/sysv.lo src/cris/ffi.lo
-@FRV_TRUE@am__objects_18 = src/frv/eabi.lo src/frv/ffi.lo
-@S390_TRUE@am__objects_19 = src/s390/sysv.lo src/s390/ffi.lo
-@X86_64_TRUE@am__objects_20 = src/x86/ffi64.lo src/x86/unix64.lo \
+@AVR32_TRUE@am__objects_17 = src/avr32/sysv.lo src/avr32/ffi.lo
+@LIBFFI_CRIS_TRUE@am__objects_18 = src/cris/sysv.lo src/cris/ffi.lo
+@FRV_TRUE@am__objects_19 = src/frv/eabi.lo src/frv/ffi.lo
+@S390_TRUE@am__objects_20 = src/s390/sysv.lo src/s390/ffi.lo
+@X86_64_TRUE@am__objects_21 = src/x86/ffi64.lo src/x86/unix64.lo \
 @X86_64_TRUE@	src/x86/ffi.lo src/x86/sysv.lo
-@SH_TRUE@am__objects_21 = src/sh/sysv.lo src/sh/ffi.lo
-@SH64_TRUE@am__objects_22 = src/sh64/sysv.lo src/sh64/ffi.lo
-@PA_LINUX_TRUE@am__objects_23 = src/pa/linux.lo src/pa/ffi.lo
-@PA_HPUX_TRUE@am__objects_24 = src/pa/hpux32.lo src/pa/ffi.lo
+@SH_TRUE@am__objects_22 = src/sh/sysv.lo src/sh/ffi.lo
+@SH64_TRUE@am__objects_23 = src/sh64/sysv.lo src/sh64/ffi.lo
+@PA_LINUX_TRUE@am__objects_24 = src/pa/linux.lo src/pa/ffi.lo
+@PA_HPUX_TRUE@am__objects_25 = src/pa/hpux32.lo src/pa/ffi.lo
 nodist_libffi_la_OBJECTS = $(am__objects_1) $(am__objects_2) \
 	$(am__objects_3) $(am__objects_4) $(am__objects_5) \
 	$(am__objects_6) $(am__objects_7) $(am__objects_8) \
@@ -151,25 +153,26 @@ nodist_libffi_la_OBJECTS = $(am__objects_1) $(am__objects_2) \
 	$(am__objects_15) $(am__objects_16) $(am__objects_17) \
 	$(am__objects_18) $(am__objects_19) $(am__objects_20) \
 	$(am__objects_21) $(am__objects_22) $(am__objects_23) \
-	$(am__objects_24)
+	$(am__objects_24) $(am__objects_25)
 libffi_la_OBJECTS = $(am_libffi_la_OBJECTS) \
 	$(nodist_libffi_la_OBJECTS)
 libffi_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
 	$(libffi_la_LDFLAGS) $(LDFLAGS) -o $@
 libffi_convenience_la_LIBADD =
-am__objects_25 = src/debug.lo src/prep_cif.lo src/types.lo \
+am__objects_26 = src/debug.lo src/prep_cif.lo src/types.lo \
 	src/raw_api.lo src/java_raw_api.lo src/closures.lo
-am_libffi_convenience_la_OBJECTS = $(am__objects_25)
-am__objects_26 = $(am__objects_1) $(am__objects_2) $(am__objects_3) \
+am_libffi_convenience_la_OBJECTS = $(am__objects_26)
+am__objects_27 = $(am__objects_1) $(am__objects_2) $(am__objects_3) \
 	$(am__objects_4) $(am__objects_5) $(am__objects_6) \
 	$(am__objects_7) $(am__objects_8) $(am__objects_9) \
 	$(am__objects_10) $(am__objects_11) $(am__objects_12) \
 	$(am__objects_13) $(am__objects_14) $(am__objects_15) \
 	$(am__objects_16) $(am__objects_17) $(am__objects_18) \
 	$(am__objects_19) $(am__objects_20) $(am__objects_21) \
-	$(am__objects_22) $(am__objects_23) $(am__objects_24)
-nodist_libffi_convenience_la_OBJECTS = $(am__objects_26)
+	$(am__objects_22) $(am__objects_23) $(am__objects_24) \
+	$(am__objects_25)
+nodist_libffi_convenience_la_OBJECTS = $(am__objects_27)
 libffi_convenience_la_OBJECTS = $(am_libffi_convenience_la_OBJECTS) \
 	$(nodist_libffi_convenience_la_OBJECTS)
 DEFAULT_INCLUDES = -I.@am__isrc@
@@ -261,6 +264,7 @@ distcleancheck_listfiles = find . -type f -print
 ACLOCAL = @ACLOCAL@
 ALLOCA = @ALLOCA@
 AMTAR = @AMTAR@
+AM_LTLDFLAGS = @AM_LTLDFLAGS@
 AM_RUNTESTFLAGS = @AM_RUNTESTFLAGS@
 AR = @AR@
 AUTOCONF = @AUTOCONF@
@@ -388,6 +392,7 @@ SUBDIRS = include testsuite man
 EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host \
 	src/alpha/ffi.c src/alpha/osf.S src/alpha/ffitarget.h \
 	src/arm/ffi.c src/arm/sysv.S src/arm/ffitarget.h \
+	src/avr32/ffi.c src/avr32/sysv.S src/avr32/ffitarget.h \
 	src/cris/ffi.c src/cris/sysv.S src/cris/ffitarget.h \
 	src/ia64/ffi.c src/ia64/ffitarget.h src/ia64/ia64_flags.h \
 	src/ia64/unix.S \
@@ -470,11 +475,11 @@ nodist_libffi_la_SOURCES = $(am__append_1) $(am__append_2) \
 	$(am__append_15) $(am__append_16) $(am__append_17) \
 	$(am__append_18) $(am__append_19) $(am__append_20) \
 	$(am__append_21) $(am__append_22) $(am__append_23) \
-	$(am__append_24)
+	$(am__append_24) $(am__append_25)
 libffi_convenience_la_SOURCES = $(libffi_la_SOURCES)
 nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES)
 AM_CFLAGS = -Wall -g -fexceptions
-libffi_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version`
+libffi_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(AM_LTLDFLAGS)
 AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
 AM_CCASFLAGS = $(AM_CPPFLAGS)
 all: fficonfig.h
@@ -709,6 +714,16 @@ src/arm/sysv.lo: src/arm/$(am__dirstamp) \
 	src/arm/$(DEPDIR)/$(am__dirstamp)
 src/arm/ffi.lo: src/arm/$(am__dirstamp) \
 	src/arm/$(DEPDIR)/$(am__dirstamp)
+src/avr32/$(am__dirstamp):
+	@$(MKDIR_P) src/avr32
+	@: > src/avr32/$(am__dirstamp)
+src/avr32/$(DEPDIR)/$(am__dirstamp):
+	@$(MKDIR_P) src/avr32/$(DEPDIR)
+	@: > src/avr32/$(DEPDIR)/$(am__dirstamp)
+src/avr32/sysv.lo: src/avr32/$(am__dirstamp) \
+	src/avr32/$(DEPDIR)/$(am__dirstamp)
+src/avr32/ffi.lo: src/avr32/$(am__dirstamp) \
+	src/avr32/$(DEPDIR)/$(am__dirstamp)
 src/cris/$(am__dirstamp):
 	@$(MKDIR_P) src/cris
 	@: > src/cris/$(am__dirstamp)
@@ -786,6 +801,10 @@ mostlyclean-compile:
 	-rm -f src/arm/ffi.lo
 	-rm -f src/arm/sysv.$(OBJEXT)
 	-rm -f src/arm/sysv.lo
+	-rm -f src/avr32/ffi.$(OBJEXT)
+	-rm -f src/avr32/ffi.lo
+	-rm -f src/avr32/sysv.$(OBJEXT)
+	-rm -f src/avr32/sysv.lo
 	-rm -f src/closures.$(OBJEXT)
 	-rm -f src/closures.lo
 	-rm -f src/cris/ffi.$(OBJEXT)
@@ -900,6 +919,8 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@src/alpha/$(DEPDIR)/osf.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/arm/$(DEPDIR)/ffi.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/arm/$(DEPDIR)/sysv.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/avr32/$(DEPDIR)/ffi.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/avr32/$(DEPDIR)/sysv.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cris/$(DEPDIR)/ffi.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/cris/$(DEPDIR)/sysv.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@src/frv/$(DEPDIR)/eabi.Plo@am__quote@
@@ -1001,6 +1022,7 @@ clean-libtool:
 	-rm -rf src/.libs src/_libs
 	-rm -rf src/alpha/.libs src/alpha/_libs
 	-rm -rf src/arm/.libs src/arm/_libs
+	-rm -rf src/avr32/.libs src/avr32/_libs
 	-rm -rf src/cris/.libs src/cris/_libs
 	-rm -rf src/frv/.libs src/frv/_libs
 	-rm -rf src/ia64/.libs src/ia64/_libs
@@ -1551,6 +1573,8 @@ distclean-generic:
 	-rm -f src/alpha/$(am__dirstamp)
 	-rm -f src/arm/$(DEPDIR)/$(am__dirstamp)
 	-rm -f src/arm/$(am__dirstamp)
+	-rm -f src/avr32/$(DEPDIR)/$(am__dirstamp)
+	-rm -f src/avr32/$(am__dirstamp)
 	-rm -f src/cris/$(DEPDIR)/$(am__dirstamp)
 	-rm -f src/cris/$(am__dirstamp)
 	-rm -f src/frv/$(DEPDIR)/$(am__dirstamp)
@@ -1588,7 +1612,7 @@ clean-am: clean-aminfo clean-generic clean-libLTLIBRARIES \
 
 distclean: distclean-recursive
 	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-	-rm -rf src/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/mips/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/x86/$(DEPDIR)
+	-rm -rf src/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/mips/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/x86/$(DEPDIR)
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-hdr distclean-libtool distclean-tags
@@ -1708,7 +1732,7 @@ installcheck-am:
 maintainer-clean: maintainer-clean-recursive
 	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
 	-rm -rf $(top_srcdir)/autom4te.cache
-	-rm -rf src/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/mips/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/x86/$(DEPDIR)
+	-rm -rf src/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/mips/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/x86/$(DEPDIR)
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-aminfo \
 	maintainer-clean-generic maintainer-clean-vti
diff --git a/configure b/configure
index a6e45aa..47de0f1 100755
--- a/configure
+++ b/configure
@@ -847,6 +847,7 @@ SPARC_FALSE
 SPARC_TRUE
 MIPS_FALSE
 MIPS_TRUE
+AM_LTLDFLAGS
 AM_RUNTESTFLAGS
 TESTSUBDIR_FALSE
 TESTSUBDIR_TRUE
@@ -4772,13 +4773,13 @@ if test "${lt_cv_nm_interface+set}" = set; then
 else
   lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:4775: $ac_compile\"" >&5)
+  (eval echo "\"\$as_me:4776: $ac_compile\"" >&5)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:4778: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval echo "\"\$as_me:4779: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:4781: output\"" >&5)
+  (eval echo "\"\$as_me:4782: output\"" >&5)
   cat conftest.out >&5
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
@@ -5984,7 +5985,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 5987 "configure"' > conftest.$ac_ext
+  echo '#line 5988 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -7837,11 +7838,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7840: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7841: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7844: \$? = $ac_status" >&5
+   echo "$as_me:7845: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -8176,11 +8177,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:8179: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8180: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:8183: \$? = $ac_status" >&5
+   echo "$as_me:8184: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -8281,11 +8282,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:8284: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8285: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:8288: \$? = $ac_status" >&5
+   echo "$as_me:8289: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -8336,11 +8337,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:8339: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8340: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:8343: \$? = $ac_status" >&5
+   echo "$as_me:8344: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -11139,7 +11140,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11142 "configure"
+#line 11143 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11235,7 +11236,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11238 "configure"
+#line 11239 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12184,6 +12185,8 @@ case "$host" in
 	;;
   i?86-win32* | i?86-*-cygwin* | i?86-*-mingw*)
 	TARGET=X86_WIN32; TARGETDIR=x86
+	# All mingw/cygwin/win32 builds require this for sharedlib
+	AM_LTLDFLAGS="-no-undefined"
 	;;
   i?86-*-darwin*)
 	TARGET=X86_DARWIN; TARGETDIR=x86
@@ -12263,6 +12266,7 @@ esac
 
 
 
+
 if test $TARGETDIR = unknown; then
   { { $as_echo "$as_me:$LINENO: error: \"libffi has not been ported to $host.\"" >&5
 $as_echo "$as_me: error: \"libffi has not been ported to $host.\"" >&2;}
diff --git a/configure.ac b/configure.ac
index fe1f873..405eeea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -85,6 +85,8 @@ case "$host" in
 	;;
   i?86-win32* | i?86-*-cygwin* | i?86-*-mingw*)
 	TARGET=X86_WIN32; TARGETDIR=x86
+	# All mingw/cygwin/win32 builds require this for sharedlib
+	AM_LTLDFLAGS="-no-undefined"
 	;;
   i?86-*-darwin*)
 	TARGET=X86_DARWIN; TARGETDIR=x86
@@ -163,6 +165,7 @@ case "$host" in
 esac
 
 AC_SUBST(AM_RUNTESTFLAGS)
+AC_SUBST(AM_LTLDFLAGS)
 
 if test $TARGETDIR = unknown; then
   AC_MSG_ERROR(["libffi has not been ported to $host."])
diff --git a/include/Makefile.in b/include/Makefile.in
index 136f36c..3a55fd4 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -78,6 +78,7 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 ALLOCA = @ALLOCA@
 AMTAR = @AMTAR@
+AM_LTLDFLAGS = @AM_LTLDFLAGS@
 AM_RUNTESTFLAGS = @AM_RUNTESTFLAGS@
 AR = @AR@
 AUTOCONF = @AUTOCONF@
diff --git a/man/Makefile.in b/man/Makefile.in
index 3e40be2..d50f19d 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -76,6 +76,7 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 ALLOCA = @ALLOCA@
 AMTAR = @AMTAR@
+AM_LTLDFLAGS = @AM_LTLDFLAGS@
 AM_RUNTESTFLAGS = @AM_RUNTESTFLAGS@
 AR = @AR@
 AUTOCONF = @AUTOCONF@
diff --git a/patches/fix-huge_struct-test b/patches/fix-huge_struct-test
index 2aae019..9c28aa5 100644
--- a/patches/fix-huge_struct-test
+++ b/patches/fix-huge_struct-test
@@ -15,12 +15,16 @@ Index: libffi/testsuite/libffi.call/huge_struct.c
 ===================================================================
 --- libffi.orig/testsuite/libffi.call/huge_struct.c
 +++ libffi/testsuite/libffi.call/huge_struct.c
-@@ -8,7 +8,7 @@
- /* { dg-excess-errors "" { target avr32-*-* x86_64-*-mingw* x86_64-*-cygwin* i*86-*-linux-* x86_64-*-linux-* } } */
+@@ -5,10 +5,10 @@
+ 	Originator:		Blake Chaffin	6/18/2007
+ */
+ 
+-/* { dg-excess-errors "" { target avr32-*-* x86_64-*-mingw* x86_64-*-cygwin* i*86-*-linux-* x86_64-*-linux-* } } */
++/* { dg-excess-errors "" { target avr32-*-* x86_64-*-mingw* x86_64-*-cygwin* } } */
  /* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */
  /* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */
 -/* { dg-output "" { xfail avr32-*-* x86_64-*-mingw* x86_64-*-cygwin* i*86-*-linux-* x86_64-*-linux-* } } */
-+/* { dg-output "" { xfail avr32-*-* x86_64-*-mingw* x86_64-*-cygwin* x86_64-*-linux-* } } */
++/* { dg-output "" { xfail avr32-*-* x86_64-*-mingw* x86_64-*-cygwin* } } */
  
  #include <stdint.h>
  
@@ -47,7 +51,18 @@ Index: libffi/testsuite/libffi.call/huge_struct.c
  		ui8_1, si8_1, ui16_1, si16_1, ui32_1, si32_1, ui64_1, si64_1, f_1, d_1, ld_1, p_1,
  		ui8_2, si8_2, ui16_2, si16_2, ui32_2, si32_2, ui64_2, si64_2, f_2, d_2, ld_2, p_2,
  		ui8_3, si8_3, ui16_3, si16_3, ui32_3, si32_3, ui64_3, si64_3, f_3, d_3, ld_3, p_3,
-@@ -296,10 +296,10 @@ main(int argc __UNUSED__, const char** a
+@@ -229,7 +229,9 @@ main(int argc __UNUSED__, const char** a
+ 
+ 	ffi_type	ret_struct_type;
+ 	ffi_type*	st_fields[51];
+-	BigStruct	retVal	= {0};
++	BigStruct	retVal;
++
++	memset (&retVal, 0, sizeof(retVal));
+ 
+ 	ret_struct_type.size = 0;
+ 	ret_struct_type.alignment = 0;
+@@ -296,10 +298,10 @@ main(int argc __UNUSED__, const char** a
  
  	ffi_call(&cif, FFI_FN(test_large_fn), &retVal, argValues);
  	// { dg-output "1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" }
@@ -62,7 +77,7 @@ Index: libffi/testsuite/libffi.call/huge_struct.c
  		retVal.a, retVal.b, retVal.c, retVal.d, retVal.e, retVal.f,
  		retVal.g, retVal.h, retVal.i, retVal.j, retVal.k, retVal.l,
  		retVal.m, retVal.n, retVal.o, retVal.p, retVal.q, retVal.r,
-@@ -324,10 +324,10 @@ main(int argc __UNUSED__, const char** a
+@@ -324,10 +326,10 @@ main(int argc __UNUSED__, const char** a
  		ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p,
  		ui8, si8);
  	// { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" }
diff --git a/patches/series b/patches/series
index 4eb83f7..991579e 100644
--- a/patches/series
+++ b/patches/series
@@ -4,3 +4,4 @@ snow-leopard
 sgi-mips
 fix-docs
 fix-huge_struct-test
+windows
diff --git a/testsuite/Makefile.in b/testsuite/Makefile.in
index 698c461..a954696 100644
--- a/testsuite/Makefile.in
+++ b/testsuite/Makefile.in
@@ -53,6 +53,7 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 ALLOCA = @ALLOCA@
 AMTAR = @AMTAR@
+AM_LTLDFLAGS = @AM_LTLDFLAGS@
 AM_RUNTESTFLAGS = 
 AR = @AR@
 AUTOCONF = @AUTOCONF@