Trim redundant import
[ghc-hetmet.git] / libffi / libffi-dllize-3.0.6.patch
1 --- libffi-3.0.6/include/ffi.h.in       2008-04-03 20:57:34.000000000 +0200
2 +++ build/include/ffi.h.in      2008-10-14 09:51:55.000000000 +0200
3 @@ -61,6 +61,17 @@
4  #define @TARGET@
5  #endif
6  
7 +#if @LIBFFI_DLL@
8 +#ifdef DLL_EXPORT
9 +#define __FFI_DECLSPEC __declspec(__dllexport__)
10 +#else
11 +#define __FFI_DECLSPEC __declspec(__dllimport__)
12 +#endif
13 +#else
14 +#define __FFI_DECLSPEC
15 +#endif
16 +
17 +
18  /* ---- System configuration information --------------------------------- */
19  
20  #include <ffitarget.h>
21 @@ -223,27 +234,27 @@
22  #endif
23  
24  
25 -void ffi_raw_call (ffi_cif *cif,
26 -                  void (*fn)(void),
27 -                  void *rvalue,
28 -                  ffi_raw *avalue);
29 -
30 -void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw);
31 -void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args);
32 -size_t ffi_raw_size (ffi_cif *cif);
33 +__FFI_DECLSPEC void ffi_raw_call (ffi_cif *cif,
34 +                                 void (*fn)(void),
35 +                                 void *rvalue,
36 +                                 ffi_raw *avalue);
37 +
38 +__FFI_DECLSPEC void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw);
39 +__FFI_DECLSPEC void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args);
40 +__FFI_DECLSPEC size_t ffi_raw_size (ffi_cif *cif);
41  
42  /* This is analogous to the raw API, except it uses Java parameter     */
43  /* packing, even on 64-bit machines.  I.e. on 64-bit machines          */
44  /* longs and doubles are followed by an empty 64-bit word.             */
45  
46 -void ffi_java_raw_call (ffi_cif *cif,
47 -                       void (*fn)(void),
48 -                       void *rvalue,
49 -                       ffi_java_raw *avalue);
50 -
51 -void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw);
52 -void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args);
53 -size_t ffi_java_raw_size (ffi_cif *cif);
54 +__FFI_DECLSPEC void ffi_java_raw_call (ffi_cif *cif,
55 +                                      void (*fn)(void),
56 +                                      void *rvalue,
57 +                                      ffi_java_raw *avalue);
58 +
59 +__FFI_DECLSPEC void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw);
60 +__FFI_DECLSPEC void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args);
61 +__FFI_DECLSPEC size_t ffi_java_raw_size (ffi_cif *cif);
62  
63  /* ---- Definitions for closures ----------------------------------------- */
64  
65 @@ -256,16 +267,16 @@
66    void      *user_data;
67  } ffi_closure __attribute__((aligned (8)));
68  
69 -void *ffi_closure_alloc (size_t size, void **code);
70 -void ffi_closure_free (void *);
71 +__FFI_DECLSPEC void *ffi_closure_alloc (size_t size, void **code);
72 +__FFI_DECLSPEC void ffi_closure_free (void *);
73  
74 -ffi_status
75 +__FFI_DECLSPEC ffi_status
76  ffi_prep_closure (ffi_closure*,
77                   ffi_cif *,
78                   void (*fun)(ffi_cif*,void*,void**,void*),
79                   void *user_data);
80  
81 -ffi_status
82 +__FFI_DECLSPEC ffi_status
83  ffi_prep_closure_loc (ffi_closure*,
84                       ffi_cif *,
85                       void (*fun)(ffi_cif*,void*,void**,void*),
86 @@ -314,26 +325,26 @@
87  
88  } ffi_java_raw_closure;
89  
90 -ffi_status
91 +__FFI_DECLSPEC ffi_status
92  ffi_prep_raw_closure (ffi_raw_closure*,
93                       ffi_cif *cif,
94                       void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
95                       void *user_data);
96  
97 -ffi_status
98 +__FFI_DECLSPEC ffi_status
99  ffi_prep_raw_closure_loc (ffi_raw_closure*,
100                           ffi_cif *cif,
101                           void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
102                           void *user_data,
103                           void *codeloc);
104  
105 -ffi_status
106 +__FFI_DECLSPEC ffi_status
107  ffi_prep_java_raw_closure (ffi_java_raw_closure*,
108                            ffi_cif *cif,
109                            void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
110                            void *user_data);
111  
112 -ffi_status
113 +__FFI_DECLSPEC ffi_status
114  ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*,
115                                ffi_cif *cif,
116                                void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
117 @@ -344,16 +355,16 @@
118  
119  /* ---- Public interface definition -------------------------------------- */
120  
121 -ffi_status ffi_prep_cif(ffi_cif *cif,
122 -                       ffi_abi abi,
123 -                       unsigned int nargs,
124 -                       ffi_type *rtype,
125 -                       ffi_type **atypes);
126 -
127 -void ffi_call(ffi_cif *cif,
128 -             void (*fn)(void),
129 -             void *rvalue,
130 -             void **avalue);
131 +__FFI_DECLSPEC ffi_status ffi_prep_cif(ffi_cif *cif,
132 +                                      ffi_abi abi,
133 +                                      unsigned int nargs,
134 +                                      ffi_type *rtype,
135 +                                      ffi_type **atypes);
136 +
137 +__FFI_DECLSPEC void ffi_call(ffi_cif *cif,
138 +                            void (*fn)(void),
139 +                            void *rvalue,
140 +                            void **avalue);
141  
142  /* Useful for eliminating compiler warnings */
143  #define FFI_FN(f) ((void (*)(void))f)
144 --- build/Makefile.am   2008-02-21 14:21:24.000000000 +0100
145 +++ build-shared/Makefile.am    2008-10-11 20:44:15.000000000 +0200
146 @@ -165,7 +165,7 @@
147  
148  AM_CFLAGS = -Wall -g -fexceptions
149  
150 -libffi_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version`
151 +libffi_la_LDFLAGS = $(LIBFFI_LDFLAGS) -version-info `grep -v '^\#' $(srcdir)/libtool-version`
152  
153  AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src
154  AM_CCASFLAGS = $(AM_CPPFLAGS)
155 --- build/src/x86/win32.S       2008-02-15 02:17:20.000000000 +0100
156 +++ build-shared/src/x86/win32.S        2008-10-11 19:19:03.000000000 +0200
157 @@ -33,8 +33,6 @@
158   
159  .text
160   
161 -.globl ffi_prep_args
162
163          # This assumes we are using gas.
164          .balign 16
165  .globl _ffi_call_SYSV
166
167 --- build/include/ffi_common.h  2008-01-29 16:15:17.000000000 +0100
168 +++ build-shared/include/ffi_common.h   2008-10-13 00:35:02.000000000 +0200
169 @@ -49,9 +49,9 @@
170  #endif
171  
172  #ifdef FFI_DEBUG
173 -void ffi_assert(char *expr, char *file, int line);
174 -void ffi_stop_here(void);
175 -void ffi_type_test(ffi_type *a, char *file, int line);
176 +__FFI_DECLSPEC void ffi_assert(char *expr, char *file, int line);
177 +__FFI_DECLSPEC void ffi_stop_here(void);
178 +__FFI_DECLSPEC void ffi_type_test(ffi_type *a, char *file, int line);
179  
180  #define FFI_ASSERT(x) ((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__))
181  #define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l)))
182 @@ -66,7 +66,7 @@
183  #define ALIGN_DOWN(v, a) (((size_t) (v)) & -a)
184  
185  /* Perform machine dependent cif processing */
186 -ffi_status ffi_prep_cif_machdep(ffi_cif *cif);
187 +__FFI_DECLSPEC ffi_status ffi_prep_cif_machdep(ffi_cif *cif);
188  
189  /* Extended cif, used in callback from assembly routine */
190  typedef struct
191 --- build/configure.ac  2008-02-24 18:20:21.000000000 +0100
192 +++ build-shared/configure.ac   2008-10-13 19:20:04.000000000 +0200
193 @@ -26,6 +26,20 @@
194  
195  AM_PROG_AS
196  AM_PROG_CC_C_O
197 +
198 +AC_LIBTOOL_WIN32_DLL
199 +AC_SUBST(LIBFFI_DLL,0)
200 +
201 +case $host in
202 +  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
203 +    if test "$enable_shared" = yes; then
204 +      LIBFFI_LDFLAGS="-no-undefined -Wl,--export-all-symbols"
205 +      LIBFFI_DLL=1
206 +    fi
207 +    ;;
208 +esac
209 +AC_SUBST(LIBFFI_LDFLAGS)
210 +
211  AC_PROG_LIBTOOL
212  
213  AM_MAINTAINER_MODE