]> git.lyx.org Git - features.git/blob - development/Win32/patches/mingw/gettext-0.14.5.patch
set eol-style
[features.git] / development / Win32 / patches / mingw / gettext-0.14.5.patch
1 diff -urN -x .build -x .inst -x .sinst -x '*~' gettext-tools/src/hostname.c gettext-tools/src/hostname.c
2 --- gettext-tools/src/hostname.c        2005-05-20 16:40:02.000000000 -0400
3 +++ gettext-tools/src/hostname.c        2005-11-11 11:02:07.203125000 -0500
4 @@ -99,7 +99,7 @@
5  static enum { default_format, short_format, long_format, ip_format } format;
6  
7  /* Long options.  */
8 -static const struct option long_options[] =
9 +static CONST_PROBLEMATIC_WIN32 struct option long_options[] =
10  {
11    { "fqdn", no_argument, NULL, 'f' },
12    { "help", no_argument, NULL, 'h' },
13 diff -urN -x .build -x .inst -x .sinst -x '*~' gettext-tools/src/msgattrib.c gettext-tools/src/msgattrib.c
14 --- gettext-tools/src/msgattrib.c       2005-05-20 16:40:15.000000000 -0400
15 +++ gettext-tools/src/msgattrib.c       2005-11-11 11:01:39.484375000 -0500
16 @@ -69,7 +69,7 @@
17  static int to_change;
18  
19  /* Long options.  */
20 -static const struct option long_options[] =
21 +static CONST_PROBLEMATIC_WIN32 struct option long_options[] =
22  {
23    { "add-location", no_argument, &line_comment, 1 },
24    { "clear-fuzzy", no_argument, NULL, CHAR_MAX + 8 },
25 diff -urN -x .build -x .inst -x .sinst -x '*~' gettext-tools/src/msgcat.c gettext-tools/src/msgcat.c
26 --- gettext-tools/src/msgcat.c  2005-05-20 16:40:19.000000000 -0400
27 +++ gettext-tools/src/msgcat.c  2005-11-11 11:02:33.109375000 -0500
28 @@ -53,7 +53,7 @@
29  static const char *to_code;
30  
31  /* Long options.  */
32 -static const struct option long_options[] =
33 +static CONST_PROBLEMATIC_WIN32 struct option long_options[] =
34  {
35    { "add-location", no_argument, &line_comment, 1 },
36    { "directory", required_argument, NULL, 'D' },
37 diff -urN -x .build -x .inst -x .sinst -x '*~' gettext-tools/src/msgcmp.c gettext-tools/src/msgcmp.c
38 --- gettext-tools/src/msgcmp.c  2005-05-20 16:40:23.000000000 -0400
39 +++ gettext-tools/src/msgcmp.c  2005-11-11 11:02:51.906250000 -0500
40 @@ -49,7 +49,7 @@
41  static bool multi_domain_mode = false;
42  
43  /* Long options.  */
44 -static const struct option long_options[] =
45 +static CONST_PROBLEMATIC_WIN32 struct option long_options[] =
46  {
47    { "directory", required_argument, NULL, 'D' },
48    { "help", no_argument, NULL, 'h' },
49 diff -urN -x .build -x .inst -x .sinst -x '*~' gettext-tools/src/msgcomm.c gettext-tools/src/msgcomm.c
50 --- gettext-tools/src/msgcomm.c 2005-05-20 16:40:27.000000000 -0400
51 +++ gettext-tools/src/msgcomm.c 2005-11-11 11:03:09.406250000 -0500
52 @@ -55,7 +55,7 @@
53  static const char *to_code;
54  
55  /* Long options.  */
56 -static const struct option long_options[] =
57 +static CONST_PROBLEMATIC_WIN32 struct option long_options[] =
58  {
59    { "add-location", no_argument, &line_comment, 1 },
60    { "directory", required_argument, NULL, 'D' },
61 diff -urN -x .build -x .inst -x .sinst -x '*~' gettext-tools/src/msgconv.c gettext-tools/src/msgconv.c
62 --- gettext-tools/src/msgconv.c 2005-05-20 16:40:31.000000000 -0400
63 +++ gettext-tools/src/msgconv.c 2005-11-11 11:03:21.671875000 -0500
64 @@ -52,7 +52,7 @@
65  static const char *to_code;
66  
67  /* Long options.  */
68 -static const struct option long_options[] =
69 +static CONST_PROBLEMATIC_WIN32 struct option long_options[] =
70  {
71    { "add-location", no_argument, &line_comment, 1 },
72    { "directory", required_argument, NULL, 'D' },
73 diff -urN -x .build -x .inst -x .sinst -x '*~' gettext-tools/src/msgen.c gettext-tools/src/msgen.c
74 --- gettext-tools/src/msgen.c   2005-05-20 16:40:35.000000000 -0400
75 +++ gettext-tools/src/msgen.c   2005-11-11 11:03:54.531250000 -0500
76 @@ -48,7 +48,7 @@
77  static int force_po;
78  
79  /* Long options.  */
80 -static const struct option long_options[] =
81 +static CONST_PROBLEMATIC_WIN32 struct option long_options[] =
82  {
83    { "add-location", no_argument, &line_comment, 1 },
84    { "directory", required_argument, NULL, 'D' },
85 diff -urN -x .build -x .inst -x .sinst -x '*~' gettext-tools/src/msgexec.c gettext-tools/src/msgexec.c
86 --- gettext-tools/src/msgexec.c 2005-05-20 16:40:40.000000000 -0400
87 +++ gettext-tools/src/msgexec.c 2005-11-11 11:04:07.546875000 -0500
88 @@ -74,7 +74,7 @@
89  static int exitcode;
90  
91  /* Long options.  */
92 -static const struct option long_options[] =
93 +static CONST_PROBLEMATIC_WIN32 struct option long_options[] =
94  {
95    { "directory", required_argument, NULL, 'D' },
96    { "help", no_argument, NULL, 'h' },
97 diff -urN -x .build -x .inst -x .sinst -x '*~' gettext-tools/src/msgfilter.c gettext-tools/src/msgfilter.c
98 --- gettext-tools/src/msgfilter.c       2005-05-20 16:40:44.000000000 -0400
99 +++ gettext-tools/src/msgfilter.c       2005-11-11 11:04:19.062500000 -0500
100 @@ -97,7 +97,7 @@
101  static int sub_argc;
102  
103  /* Long options.  */
104 -static const struct option long_options[] =
105 +static CONST_PROBLEMATIC_WIN32 struct option long_options[] =
106  {
107    { "add-location", no_argument, &line_comment, 1 },
108    { "directory", required_argument, NULL, 'D' },
109 diff -urN -x .build -x .inst -x .sinst -x '*~' gettext-tools/src/msgfmt.c gettext-tools/src/msgfmt.c
110 --- gettext-tools/src/msgfmt.c  2005-11-11 00:58:30.000000000 -0500
111 +++ gettext-tools/src/msgfmt.c  2005-11-11 11:04:30.546875000 -0500
112 @@ -163,7 +163,7 @@
113  static int do_statistics;
114  
115  /* Long options.  */
116 -static const struct option long_options[] =
117 +static CONST_PROBLEMATIC_WIN32 struct option long_options[] =
118  {
119    { "alignment", required_argument, NULL, 'a' },
120    { "check", no_argument, NULL, 'c' },
121 diff -urN -x .build -x .inst -x .sinst -x '*~' gettext-tools/src/msggrep.c gettext-tools/src/msggrep.c
122 --- gettext-tools/src/msggrep.c 2005-05-20 16:41:05.000000000 -0400
123 +++ gettext-tools/src/msggrep.c 2005-11-11 11:03:39.796875000 -0500
124 @@ -81,7 +81,7 @@
125  static struct grep_task grep_task[3];
126  
127  /* Long options.  */
128 -static const struct option long_options[] =
129 +static CONST_PROBLEMATIC_WIN32 struct option long_options[] =
130  {
131    { "add-location", no_argument, &line_comment, 1 },
132    { "comment", no_argument, NULL, 'C' },
133 diff -urN -x .build -x .inst -x .sinst -x '*~' gettext-tools/src/msginit.c gettext-tools/src/msginit.c
134 --- gettext-tools/src/msginit.c 2005-11-11 00:59:01.000000000 -0500
135 +++ gettext-tools/src/msginit.c 2005-11-11 11:04:42.078125000 -0500
136 @@ -125,7 +125,7 @@
137  static bool no_translator;
138  
139  /* Long options.  */
140 -static const struct option long_options[] =
141 +static CONST_PROBLEMATIC_WIN32 struct option long_options[] =
142  {
143    { "help", no_argument, NULL, 'h' },
144    { "input", required_argument, NULL, 'i' },
145 diff -urN -x .build -x .inst -x .sinst -x '*~' gettext-tools/src/msgmerge.c gettext-tools/src/msgmerge.c
146 --- gettext-tools/src/msgmerge.c        2005-05-20 16:42:09.000000000 -0400
147 +++ gettext-tools/src/msgmerge.c        2005-11-11 11:04:51.328125000 -0500
148 @@ -84,7 +84,7 @@
149  static const char *backup_suffix_string;
150  
151  /* Long options.  */
152 -static const struct option long_options[] =
153 +static CONST_PROBLEMATIC_WIN32 struct option long_options[] =
154  {
155    { "add-location", no_argument, &line_comment, 1 },
156    { "backup", required_argument, NULL, CHAR_MAX + 1 },
157 diff -urN -x .build -x .inst -x .sinst -x '*~' gettext-tools/src/msgunfmt.c gettext-tools/src/msgunfmt.c
158 --- gettext-tools/src/msgunfmt.c        2005-05-20 16:42:11.000000000 -0400
159 +++ gettext-tools/src/msgunfmt.c        2005-11-11 11:05:45.718750000 -0500
160 @@ -73,7 +73,7 @@
161  static int force_po;
162  
163  /* Long options.  */
164 -static const struct option long_options[] =
165 +static CONST_PROBLEMATIC_WIN32 struct option long_options[] =
166  {
167    { "csharp", no_argument, NULL, CHAR_MAX + 4 },
168    { "csharp-resources", no_argument, NULL, CHAR_MAX + 5 },
169 diff -urN -x .build -x .inst -x .sinst -x '*~' gettext-tools/src/msguniq.c gettext-tools/src/msguniq.c
170 --- gettext-tools/src/msguniq.c 2005-05-20 16:42:23.000000000 -0400
171 +++ gettext-tools/src/msguniq.c 2005-11-11 11:05:57.968750000 -0500
172 @@ -52,7 +52,7 @@
173  static const char *to_code;
174  
175  /* Long options.  */
176 -static const struct option long_options[] =
177 +static CONST_PROBLEMATIC_WIN32 struct option long_options[] =
178  {
179    { "add-location", no_argument, &line_comment, 1 },
180    { "directory", required_argument, NULL, 'D' },
181 diff -urN -x .build -x .inst -x .sinst -x '*~' gettext-tools/src/urlget.c gettext-tools/src/urlget.c
182 --- gettext-tools/src/urlget.c  2005-05-20 16:44:41.000000000 -0400
183 +++ gettext-tools/src/urlget.c  2005-11-11 11:06:10.968750000 -0500
184 @@ -65,7 +65,7 @@
185  
186  
187  /* Long options.  */
188 -static const struct option long_options[] =
189 +static CONST_PROBLEMATIC_WIN32 struct option long_options[] =
190  {
191    { "help", no_argument, NULL, 'h' },
192    { "version", no_argument, NULL, 'V' },
193 diff -urN -x .build -x .inst -x .sinst -x '*~' gettext-tools/src/xgettext.c gettext-tools/src/xgettext.c
194 --- gettext-tools/src/xgettext.c        2005-05-20 16:47:42.000000000 -0400
195 +++ gettext-tools/src/xgettext.c        2005-11-11 11:06:25.406250000 -0500
196 @@ -176,7 +176,7 @@
197  #endif
198  
199  /* Long options.  */
200 -static const struct option long_options[] =
201 +static CONST_PROBLEMATIC_WIN32 struct option long_options[] =
202  {
203    { "add-comments", optional_argument, NULL, 'c' },
204    { "add-location", no_argument, &line_comment, 1 },
205 diff -urN -x .build -x .inst -x .sinst -x '*~' gettext-tools/tests/tstgettext.c gettext-tools/tests/tstgettext.c
206 --- gettext-tools/tests/tstgettext.c    2005-05-20 16:48:17.000000000 -0400
207 +++ gettext-tools/tests/tstgettext.c    2005-11-11 11:10:29.046875000 -0500
208 @@ -52,7 +52,7 @@
209  static bool do_expand;
210  
211  /* Long options.  */
212 -static const struct option long_options[] =
213 +static CONST_PROBLEMATIC_WIN32 struct option long_options[] =
214  {
215    { "domain", required_argument, NULL, 'd' },
216    { "env", required_argument, NULL, '=' },
217 diff -urN -x .build -x .inst -x .sinst -x '*~' gettext-tools/tests/tstngettext.c gettext-tools/tests/tstngettext.c
218 --- gettext-tools/tests/tstngettext.c   2005-05-20 16:48:20.000000000 -0400
219 +++ gettext-tools/tests/tstngettext.c   2005-11-11 11:10:39.875000000 -0500
220 @@ -42,7 +42,7 @@
221  #define _(str) gettext (str)
222  
223  /* Long options.  */
224 -static const struct option long_options[] =
225 +static CONST_PROBLEMATIC_WIN32 struct option long_options[] =
226  {
227    { "domain", required_argument, NULL, 'd' },
228    { "env", required_argument, NULL, '=' },
229 diff -urN -x .build -x .inst -x .sinst -x '*~' gettext-runtime/configure.ac gettext-runtime/configure.ac
230 --- gettext-runtime/configure.ac        2005-11-11 00:04:26.000000000 -0500
231 +++ gettext-runtime/configure.ac        2005-11-11 11:34:46.687500000 -0500
232 @@ -111,6 +111,28 @@
233  #endif
234  ])
235  
236 +dnl Since gcc-3.3.3, const variables are placed in .rdata section
237 +dnl On windows (cygwin, mingw) this is a problem if the variable
238 +dnl is a composite containing references to other variables, because
239 +dnl the runtime relocation machinery can't fixup the address.  Thus
240 +dnl these composite vars must NOT be declared const.  This typically
241 +dnl occurs in long_options structs, containing references to variables
242 +dnl that are the targets of an option flag.
243 +case "$host_os" in
244 +  *cygwin* | *mingw* )
245 +    AC_DEFINE([CONST_IS_PROBLEMATIC_WIN32], 1,
246 +    [Define to 1 if structs-containing-references must not be declared const])
247 +    ;;
248 +esac
249 +AH_VERBATIM([DEF_CONST_PROBLEMATIC_WIN32],
250 +[/* On some platforms, structs-containing-references must not be declared const */
251 +#if defined CONST_IS_PROBLEMATIC_WIN32
252 +# define CONST_PROBLEMATIC_WIN32
253 +#else
254 +# define CONST_PROBLEMATIC_WIN32 const
255 +#endif
256 +])
257 +
258  AH_VERBATIM([DEF_OS2],
259  [/* Extra OS/2 (emx+gcc) defines.  */
260  #ifdef __EMX__
261 diff -urN -x .build -x .inst -x .sinst -x '*~' gettext-tools/configure.ac gettext-tools/configure.ac
262 --- gettext-tools/configure.ac  2005-11-11 00:26:09.000000000 -0500
263 +++ gettext-tools/configure.ac  2005-11-11 11:34:03.140625000 -0500
264 @@ -214,6 +214,28 @@
265  #endif
266  ])
267  
268 +dnl Since gcc-3.3.3, const variables are placed in .rdata section
269 +dnl On windows (cygwin, mingw) this is a problem if the variable
270 +dnl is a composite containing references to other variables, because
271 +dnl the runtime relocation machinery can't fixup the address.  Thus
272 +dnl these composite vars must NOT be declared const.  This typically
273 +dnl occurs in long_options structs, containing references to variables
274 +dnl that are the targets of an option flag.
275 +case "$host_os" in
276 +  *cygwin* | *mingw* )
277 +    AC_DEFINE([CONST_IS_PROBLEMATIC_WIN32], 1,
278 +    [Define to 1 if structs-containing-references must not be declared const])
279 +    ;;
280 +esac
281 +AH_VERBATIM([DEF_CONST_PROBLEMATIC_WIN32],
282 +[/* On some platforms, structs-containing-references must not be declared const */
283 +#if defined CONST_IS_PROBLEMATIC_WIN32
284 +# define CONST_PROBLEMATIC_WIN32
285 +#else
286 +# define CONST_PROBLEMATIC_WIN32 const
287 +#endif
288 +])
289 +
290  dnl Check for the expat XML parser.
291  dnl On operating systems where binary distribution vendors are likely to
292  dnl ship both gettext and expat, we use dynamic loading to avoid a hard
293 diff -urN -x .build -x .inst -x .sinst -x '*~' gettext-runtime/src/envsubst.c gettext-runtime/src/envsubst.c
294 --- gettext-runtime/src/envsubst.c      2005-05-20 16:14:16.000000000 -0400
295 +++ gettext-runtime/src/envsubst.c      2005-11-11 11:07:50.796875000 -0500
296 @@ -43,7 +43,7 @@
297  static bool all_variables;
298  
299  /* Long options.  */
300 -static const struct option long_options[] =
301 +static CONST_PROBLEMATIC_WIN32 struct option long_options[] =
302  {
303    { "help", no_argument, NULL, 'h' },
304    { "variables", no_argument, NULL, 'v' },
305 diff -urN -x .build -x .inst -x .sinst -x '*~' gettext-runtime/src/gettext.c gettext-runtime/src/gettext.c
306 --- gettext-runtime/src/gettext.c       2005-05-20 16:14:21.000000000 -0400
307 +++ gettext-runtime/src/gettext.c       2005-11-11 11:08:03.859375000 -0500
308 @@ -48,7 +48,7 @@
309  static bool do_expand;
310  
311  /* Long options.  */
312 -static const struct option long_options[] =
313 +static CONST_PROBLEMATIC_WIN32 struct option long_options[] =
314  {
315    { "domain", required_argument, NULL, 'd' },
316    { "help", no_argument, NULL, 'h' },
317 diff -urN -x .build -x .inst -x .sinst -x '*~' gettext-runtime/src/ngettext.c gettext-runtime/src/ngettext.c
318 --- gettext-runtime/src/ngettext.c      2005-05-20 16:14:39.000000000 -0400
319 +++ gettext-runtime/src/ngettext.c      2005-11-11 11:08:16.062500000 -0500
320 @@ -44,7 +44,7 @@
321  static int do_expand;
322  
323  /* Long options.  */
324 -static const struct option long_options[] =
325 +static CONST_PROBLEMATIC_WIN32 struct option long_options[] =
326  {
327    { "domain", required_argument, NULL, 'd' },
328    { "help", no_argument, NULL, 'h' },
329