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
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
|
This file is part of MXE.
See index.html for further information.
Contains ad hoc patches for cross building.
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Boris Nagaev <bnagaev@gmail.com>
Date: Sat, 16 Jul 2016 13:01:59 +0200
Subject: [PATCH] apply mingw-build.patch from MINGW-packages
Source: https://git.io/vKz1V
diff --git a/Makefile.in b/Makefile.in
index 1111111..2222222 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -60,6 +60,14 @@ GPDLOBJDIR=./$(BUILDDIRPREFIX)@OBJDIR_BSDMAKE_WORKAROUND@
CONTRIBDIR=@srcdir@/contrib
+# ------ MINGW options ------ #
+
+MINGW_BUILD=@MINGW_BUILD@
+MINGW_PLATFORM=@MINGW_PLATFORM@
+MINGW_PLATFORM_BITS=@MINGW_PLATFORM_BITS@
+MINGW_WITH_WINLIB_NAMES=@MINGW_WITH_WINLIB_NAMES@
+MINGW_WITH_GDI=@MINGW_WITH_GDI@
+
# Do not edit the next group of lines.
include $(GLSRCDIR)/version.mak
@@ -433,8 +441,8 @@ LDFLAGS_SO=@DYNAMIC_LDFLAGS@
# Solaris may need -lnsl -lsocket -lposix4.
# (Libraries required by individual drivers are handled automatically.)
-EXTRALIBS=$(XTRALIBS) @LIBS@ @DYNAMIC_LIBS@ @FONTCONFIG_LIBS@ @FT_LIBS@ @JPX_AUTOCONF_LIBS@
-AUXEXTRALIBS=$(XTRALIBS) @LIBS@ @DYNAMIC_LIBS@ @FONTCONFIG_LIBS@ @FT_LIBS@ @JPX_AUTOCONF_LIBS@ @AUX_SHARED_ZLIB@
+EXTRALIBS=$(XTRALIBS) @LIBS@ @MINGW_XTLIBS@ @DYNAMIC_LIBS@ @FONTCONFIG_LIBS@ @FT_LIBS@ @JPX_AUTOCONF_LIBS@
+AUXEXTRALIBS=$(XTRALIBS) @LIBS@ @MINGW_XTLIBS@ @DYNAMIC_LIBS@ @FONTCONFIG_LIBS@ @FT_LIBS@ @JPX_AUTOCONF_LIBS@ @AUX_SHARED_ZLIB@
# Define the standard libraries to search at the end of linking.
# Most platforms require -lpthread for the POSIX threads library;
@@ -484,9 +492,10 @@ SYNC=@SYNC@
RM=rm -f
# ------ Dynamic loader options ------- #
-SOC_CFLAGS = @SOC_CFLAGS@
-SOC_LIBS = @SOC_LIBS@
-SOC_LOADER = @SOC_LOADER@
+SOC_CFLAGS = @SOC_CFLAGS@
+SOC_LIBS = @SOC_LIBS@
+SOC_LOADER = @SOC_LOADER@
+SOC_LOADER_PLAIN = @SOC_LOADER_PLAIN@
# on virtually every Unix-a-like system, this is "so",
# but Apple just had to be different, so it's now set
@@ -637,7 +646,17 @@ AK=
CCFLAGS=$(GENOPT) $(CAPOPT) $(CFLAGS)
CC_=$(CC) $(CCFLAGS)
-CCAUX_=$(CCAUX) $(CFLAGS)
+
+ifeq ($(MINGW_BUILD), 1)
+ # adding -lz to the compilation flags seems to be an error:
+ # if not always, then at least under MSys/MinGW,
+ # compiled against the system's zlib,
+ # and having no zlib sub-folder (see also: unixaux.mak)
+ CCAUX_=$(CCAUX) $(CFLAGS)
+else
+ CCAUX_=$(CCAUX) $(CFLAGS) @AUX_SHARED_ZLIB@
+endif
+
CC_LEAF=$(CC_)
# note gcc can't use -fomit-frame-pointer with -pg.
CC_LEAF_PG=$(CC_)
@@ -707,6 +726,12 @@ include $(GLSRCDIR)/unixinst.mak
@CONTRIBINCLUDE@
@CUPSINCLUDE@
+# conditionally include the two .mak files that are only needed with a MINGW build
+ifeq ($(MINGW_BUILD), 1)
+ include $(GLSRCDIR)/mingw-fs.mak
+ include $(GLSRCDIR)/mingwlib.mak
+endif
+
# Clean up after the autotools scripts
distclean : clean config-clean soclean pgclean debugclean mementoclean
-$(RM_) -r $(BINDIR) $(GLOBJDIR) $(PSOBJDIR) $(AUXDIR)
diff --git a/base/gp_mswin.c b/base/gp_mswin.c
index 1111111..2222222 100644
--- a/base/gp_mswin.c
+++ b/base/gp_mswin.c
@@ -989,7 +989,7 @@ bool gp_fseekable (FILE *f)
/* ------------------------- _snprintf -----------------------------*/
-#if defined(_MSC_VER) && _MSC_VER>=1900 /* VS 2014 and later have (finally) snprintf */
+#if (defined(_MSC_VER) && _MSC_VER>=1900) || defined(__MINGW64_VERSION_MAJOR) /* VS 2014 and later have (finally) snprintf */
# define STDC99
#else
/* Microsoft Visual C++ 2005 doesn't properly define snprintf,
diff --git a/base/gp_mswin.h b/base/gp_mswin.h
index 1111111..2222222 100644
--- a/base/gp_mswin.h
+++ b/base/gp_mswin.h
@@ -56,4 +56,13 @@ extern int is_spool(const char *queue);
#endif /* !defined(RC_INVOKED) */
+// in gp_mswin.c, mswin_popen is called
+// before it is implemented, so we must
+// provide a prototype (at least with GCC) to
+// avoid implicit definition with the wrong return type
+
+#ifdef __GNUC__
+FILE *mswin_popen(const char *cmd, const char *mode);
+#endif
+
#endif /* gp_mswin_INCLUDED */
diff --git a/base/gs.mak b/base/gs.mak
index 1111111..2222222 100644
--- a/base/gs.mak
+++ b/base/gs.mak
@@ -520,6 +520,7 @@ $(gconfig_h) : $(gconfxx_h)
# save our set of makefile variables that are defined in every build (paths, etc.)
$(gconfigd_h) : $(ECHOGS_XE) $(GS_MAK) $(GLSRCDIR)$(D)version.mak $(MAKEDIRS)
$(EXP)$(ECHOGS_XE) -w $(gconfigd_h) -x 23 define -s -u GS_LIB_DEFAULT -x 2022 $(GS_LIB_DEFAULT) -x 22
+ $(MINGW_FONTPATH_PATCH_OR_EMPTY_COMMAND)
$(EXP)$(ECHOGS_XE) -a $(gconfigd_h) -x 23 define -s -u GS_DEV_DEFAULT -x 2022 $(GS_DEV_DEFAULT) -x 22
$(EXP)$(ECHOGS_XE) -a $(gconfigd_h) -x 23 define -s -u GS_CACHE_DIR -x 2022 $(GS_CACHE_DIR) -x 22
$(EXP)$(ECHOGS_XE) -a $(gconfigd_h) -x 23 define -s -u SEARCH_HERE_FIRST -s $(SEARCH_HERE_FIRST)
diff --git a/base/lib.mak b/base/lib.mak
index 1111111..2222222 100644
--- a/base/lib.mak
+++ b/base/lib.mak
@@ -42,13 +42,13 @@ GLCCSHARED=$(CC_SHARED) $(GLCCFLAGS)
# We can't use $(CC_) for GLLCMSCC becuase that includes /Za on
# msvc builds, and lcms configures itself to depend on msvc extensions
# (inline asm, including windows.h) when compiled under msvc.
-GLLCMSCC=$(CC) $(LCMS_CFLAGS) $(CFLAGS) $(I_)$(GLI_) $(II)$(LCMSSRCDIR)$(D)include$(_I) $(GLF_)
+GLLCMSCC=$(CC) $(LCMS_CFLAGS) $(CFLAGS) $(I_)$(GLI_) $(GLF_)
lcms_h=$(LCMSSRCDIR)$(D)include$(D)lcms.h
icc34_h=$(GLSRC)icc34.h
# We can't use $(CC_) for GLLCMS2CC becuase that includes /Za on
# msvc builds, and lcms configures itself to depend on msvc extensions
# (inline asm, including windows.h) when compiled under msvc.
-GLLCMS2CC=$(CC) $(LCMS2_CFLAGS) $(CFLAGS) $(I_)$(GLI_) $(II)$(LCMS2SRCDIR)$(D)include$(_I) $(GLF_)
+GLLCMS2CC=$(CC) $(LCMS2_CFLAGS) $(CFLAGS) $(I_)$(GLI_) $(GLF_)
lcms2_h=$(LCMS2SRCDIR)$(D)include$(D)lcms2.h
lcms2_plugin_h=$(LCMS2SRCDIR)$(D)include$(D)lcms2_plugin.h
diff --git a/base/mingw-fp.sh b/base/mingw-fp.sh
new file mode 100644
index 1111111..2222222
--- /dev/null
+++ b/base/mingw-fp.sh
@@ -0,0 +1 @@
+sed -i -e 's?\\?/?g' $1
diff --git a/base/mingw-fs.mak b/base/mingw-fs.mak
new file mode 100644
index 1111111..2222222
--- /dev/null
+++ b/base/mingw-fs.mak
@@ -0,0 +1,34 @@
+# MSys/MinGW file- and operating-system section
+# adapted from winplat.mak
+
+# Define the name of this makefile.
+
+MINGW_FS_MAK=$(GLSRC)mingw-fs.mak
+
+# Define generic Windows-specific modules.
+
+mingw-fs_=$(GLOBJ)gp_ntfs.$(OBJ) $(GLOBJ)gp_win32.$(OBJ)
+$(GLD)mingw-fs.dev : $(MINGW_FS_MAK) $(ECHOGS_XE) $(mingw-fs_)
+ $(SETMOD) $(GLD)mingw-fs $(mingw-fs_)
+
+$(GLOBJ)gp_ntfs.$(OBJ): $(GLSRC)gp_ntfs.c $(AK)\
+ $(dos__h) $(memory__h) $(stdio__h) $(string__h) $(windows__h)\
+ $(gp_h) $(gpmisc_h) $(gsmemory_h) $(gsstruct_h) $(gstypes_h) $(gsutil_h)
+ $(GLCC) $(GLO_)gp_ntfs.$(OBJ) $(C_) $(GLSRC)gp_ntfs.c
+
+$(GLOBJ)gp_win32.$(OBJ): $(GLSRC)gp_win32.c $(AK)\
+ $(dos__h) $(malloc__h) $(stdio__h) $(string__h) $(windows__h)\
+ $(gp_h) $(gsmemory_h) $(gstypes_h)
+ $(GLCC) $(GLO_)gp_win32.$(OBJ) $(C_) $(GLSRC)gp_win32.c
+
+# Define the Windows thread / synchronization module.
+
+winsync_=$(GLOBJ)gp_wsync.$(OBJ)
+$(GLD)winsync.dev : $(MINGW_FS_MAK) $(ECHOGS_XE) $(winsync_)
+ $(SETMOD) $(GLD)winsync $(winsync_)
+ $(ADDMOD) $(GLD)winsync -replace $(GLD)nosync
+
+$(GLOBJ)gp_wsync.$(OBJ): $(GLSRC)gp_wsync.c $(AK)\
+ $(dos__h) $(malloc__h) $(stdio__h) $(string__h) $(windows__h)\
+ $(gp_h) $(gsmemory_h) $(gstypes_h)
+ $(GLCC) $(GLO_)gp_wsync.$(OBJ) $(C_) $(GLSRC)gp_wsync.c
diff --git a/base/mingwlib.mak b/base/mingwlib.mak
new file mode 100644
index 1111111..2222222
--- /dev/null
+++ b/base/mingwlib.mak
@@ -0,0 +1,76 @@
+# Common makefile section for MSys/MinGW
+# adapted from winlib.mak
+
+# Define the files to be removed by `make clean'.
+# nmake expands macros when encountered, not when used,
+# so this must precede the !include statements.
+
+BEGINFILES=$(GLGENDIR)\ccf32.tr\
+ $(GLOBJDIR)\*.res $(GLOBJDIR)\*.ico\
+ $(BINDIR)\$(GSDLL).dll $(BINDIR)\$(GSCONSOLE).exe\
+ $(BINDIR)\setupgs.exe $(BINDIR)\uninstgs.exe\
+ $(GLOBJDIR)\cups\*.h\
+ $(BEGINFILES2)
+
+# -------------------------------- Library -------------------------------- #
+
+# The MSys/MinGW Win32 platform
+
+mingw32__=$(GLOBJ)gp_mswin.$(OBJ) $(GLOBJ)gp_wgetv.$(OBJ) $(GLOBJ)gp_wpapr.$(OBJ) \
+ $(GLOBJ)gp_stdia.$(OBJ) $(GLOBJ)gp_wutf8.$(OBJ)
+mingw32_inc=$(GLD)nosync.dev $(GLD)mingw-fs.dev
+
+$(GLGEN)mingw32_.dev: $(mingw32__) $(ECHOGS_XE) $(mingw32_inc)
+ $(SETMOD) $(GLGEN)mingw32_ $(mingw32__)
+ $(ADDMOD) $(GLGEN)mingw32_ -include $(mingw32_inc)
+
+$(GLOBJ)gp_mswin.$(OBJ): $(GLSRC)gp_mswin.c $(AK) $(gp_mswin_h) \
+ $(ctype__h) $(dos__h) $(malloc__h) $(memory__h) $(pipe__h) \
+ $(stdio__h) $(string__h) $(windows__h) $(winspool_h)\
+ $(gx_h) $(gp_h) $(gpcheck_h) $(gpmisc_h) $(gserrors_h) $(gsexit_h)
+ $(GLCC) $(GLO_)gp_mswin.$(OBJ) $(C_) $(GLSRC)gp_mswin.c
+
+$(GLOBJ)gp_wutf8.$(OBJ): $(GLSRC)gp_wutf8.c $(windows__h)
+ $(GLCC) $(GLO_)gp_wutf8.$(OBJ) $(C_) $(GLSRC)gp_wutf8.c
+
+$(GLOBJ)gp_wgetv.$(OBJ): $(GLSRC)gp_wgetv.c $(AK) $(gscdefs_h)
+ $(GLCC) $(GLO_)gp_wgetv.$(OBJ) $(C_) $(GLSRC)gp_wgetv.c
+
+$(GLOBJ)gp_wpapr.$(OBJ): $(GLSRC)gp_wpapr.c $(AK) $(gp_h)
+ $(GLCC) $(GLO_)gp_wpapr.$(OBJ) $(C_) $(GLSRC)gp_wpapr.c
+
+# Define MS-Windows handles (file system) as a separable feature.
+
+mshandle_=$(GLOBJ)gp_mshdl.$(OBJ)
+$(GLD)mshandle.dev: $(ECHOGS_XE) $(mshandle_)
+ $(SETMOD) $(GLD)mshandle $(mshandle_)
+ $(ADDMOD) $(GLD)mshandle -iodev handle
+
+$(GLOBJ)gp_mshdl.$(OBJ): $(GLSRC)gp_mshdl.c $(AK)\
+ $(ctype__h) $(errno__h) $(stdio__h) $(string__h)\
+ $(gsmemory_h) $(gstypes_h) $(gxiodev_h) $(gserrors_h)
+ $(GLCC) $(GLO_)gp_mshdl.$(OBJ) $(C_) $(GLSRC)gp_mshdl.c
+
+# Define MS-Windows printer (file system) as a separable feature.
+
+msprinter_=$(GLOBJ)gp_msprn.$(OBJ)
+$(GLD)msprinter.dev: $(ECHOGS_XE) $(msprinter_)
+ $(SETMOD) $(GLD)msprinter $(msprinter_)
+ $(ADDMOD) $(GLD)msprinter -iodev printer
+
+$(GLOBJ)gp_msprn.$(OBJ): $(GLSRC)gp_msprn.c $(AK)\
+ $(ctype__h) $(errno__h) $(stdio__h) $(string__h)\
+ $(gsmemory_h) $(gstypes_h) $(gxiodev_h)
+ $(GLCC) $(GLO_)gp_msprn.$(OBJ) $(C_) $(GLSRC)gp_msprn.c
+
+# Define MS-Windows polling as a separable feature
+# because it is not needed by the gslib.
+mspoll_=$(GLOBJ)gp_mspol.$(OBJ)
+$(GLD)mspoll.dev: $(ECHOGS_XE) $(mspoll_)
+ $(SETMOD) $(GLD)mspoll $(mspoll_)
+
+$(GLOBJ)gp_mspol.$(OBJ): $(GLSRC)gp_mspol.c $(AK)\
+ $(gx_h) $(gp_h) $(gpcheck_h)
+ $(GLCC) $(GLO_)gp_mspol.$(OBJ) $(C_) $(GLSRC)gp_mspol.c
+
+# end of mingwlib.mak
diff --git a/base/stat_.h b/base/stat_.h
index 1111111..2222222 100644
--- a/base/stat_.h
+++ b/base/stat_.h
@@ -43,7 +43,7 @@
* Microsoft C uses _stat instead of stat,
* for both the function name and the structure name.
*/
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__MINGW32__)
# define stat _stat
#define struct_stat struct _stat
#else
diff --git a/base/time_.h b/base/time_.h
index 1111111..2222222 100644
--- a/base/time_.h
+++ b/base/time_.h
@@ -78,7 +78,7 @@ struct timezone {
#endif
/* Some System V environments, and Posix environments, need <sys/times.h>. */
-#if defined(HAVE_SYS_TIMES_H) && HAVE_SYS_TIMES_H == 1
+#if defined(HAVE_SYS_TIMES_H) && HAVE_SYS_TIMES_H == 1 && !defined(__MINGW32__)
# include <sys/times.h>
# define use_times_for_usertime 1
/* Posix 1003.1b-1993 section 4.8.1.5 says that
diff --git a/base/unix-aux.mak b/base/unix-aux.mak
index 1111111..2222222 100644
--- a/base/unix-aux.mak
+++ b/base/unix-aux.mak
@@ -69,6 +69,13 @@ $(GLOBJ)gp_sysv.$(OBJ): $(GLSRC)gp_sysv.c $(stdio__h) $(time__h) $(AK)\
$(UNIX_AUX_MAK) $(MAKEDIRS)
$(GLCC) $(GLO_)gp_sysv.$(OBJ) $(C_) $(GLSRC)gp_sysv.c
+# the MINGW platform / build environment, joining unix for the ride
+mingw__=$(GLOBJ)gp_wgetv.$(OBJ) $(GLOBJ)gp_wpapr.$(OBJ) $(GLOBJ)gp_win32.$(OBJ) $(GLOBJ)gp_mswin.$(OBJ) $(GLOBJ)gp_ntfs.$(OBJ) $(GLOBJ)gp_stdia.$(OBJ) $(GLOBJ)gp_wutf8.$(OBJ) $(GLOBJ)gp_nxpsprn.$(OBJ)
+$(GLGEN)mingw_.dev: $(mingw__) $(GLD)nosync.dev $(GLD)smd5.dev
+ $(SETMOD) $(GLGEN)mingw_ $(mingw__) -include $(GLD)nosync
+ $(ADDMOD) $(GLGEN)mingw_ -include $(GLD)smd5
+
+
# -------------------------- Auxiliary programs --------------------------- #
$(ECHOGS_XE): $(GLSRC)echogs.c $(AK) $(stdpre_h) $(UNIX_AUX_MAK) $(MAKEDIRS)
@@ -91,18 +98,31 @@ $(GENHT_XE): $(GLSRC)genht.c $(AK) $(GENHT_DEPS) $(UNIX_AUX_MAK) $(MAKEDIRS)
# To get GS to use the system zlib, you remove/hide the gs/zlib directory
# which means that the mkromfs build can't find the zlib source it needs.
# So it's split into two targets, one using the zlib source directly.....
-MKROMFS_OBJS_0=$(MKROMFS_ZLIB_OBJS) $(AUX)gpmisc.$(OBJ) $(AUX)gp_getnv.$(OBJ) \
- $(AUX)gscdefs.$(OBJ) $(AUX)gp_unix.$(OBJ) $(AUX)gp_unifs.$(OBJ) $(AUX)gp_unifn.$(OBJ) \
- $(AUX)gp_stdia.$(OBJ) $(AUX)gsutil.$(OBJ) $(AUX)memento.$(OBJ)
+ifeq ($(MINGW_BUILD), 1)
+ MKROMFS_OBJS_0=$(MKROMFS_ZLIB_OBJS) $(AUX)gpmisc.$(OBJ) $(AUX)gp_getnv.$(OBJ) \
+ $(AUX)gscdefs.$(OBJ) $(AUX)gp_ntfs.$(OBJ) $(AUX)gp_mswin.$(OBJ) \
+ $(AUX)gp_stdia.$(OBJ) $(AUX)gsutil.$(OBJ) $(AUX)memento.$(OBJ)
+else
+ MKROMFS_OBJS_0=$(MKROMFS_ZLIB_OBJS) $(AUX)gpmisc.$(OBJ) $(AUX)gp_getnv.$(OBJ) \
+ $(AUX)gscdefs.$(OBJ) $(AUX)gp_unix.$(OBJ) $(AUX)gp_unifs.$(OBJ) $(AUX)gp_unifn.$(OBJ) \
+ $(AUX)gp_stdia.$(OBJ) $(AUX)gsutil.$(OBJ) $(AUX)memento.$(OBJ)
+endif
$(MKROMFS_XE)_0: $(GLSRC)mkromfs.c $(MKROMFS_COMMON_DEPS) $(MKROMFS_OBJS_0) $(UNIX_AUX_MAK) $(MAKEDIRS)
$(CCAUX_) $(GENOPT) $(CFLAGS) $(I_)$(GLSRCDIR)$(_I) $(I_)$(GLOBJ)$(_I) $(I_)$(ZSRCDIR)$(_I) $(GLSRC)mkromfs.c $(O_)$(MKROMFS_XE)_0 $(MKROMFS_OBJS_0) $(AUXEXTRALIBS)
# .... and one using the zlib library linked via the command line
-MKROMFS_OBJS_1=$(AUX)gscdefs.$(OBJ) \
- $(AUX)gpmisc.$(OBJ) $(AUX)gp_getnv.$(OBJ) \
- $(AUX)gp_unix.$(OBJ) $(AUX)gp_unifs.$(OBJ) $(AUX)gp_unifn.$(OBJ) \
- $(AUX)gp_stdia.$(OBJ) $(AUX)gsutil.$(OBJ)
+# (here two, MINGW has a different set of dependencies,
+# most notably gp_ntfs and gp_wutf8)
+ifeq ($(MINGW_BUILD), 1)
+ MKROMFS_OBJS_1=$(GLOBJ)gp_ntfs.$(OBJ) $(GLOBJ)gp_wutf8.$(OBJ) \
+ $(GLOBJ)gpmisc.$(OBJ) $(GLOBJ)gp_wgetv.$(OBJ) $(GLOBJ)gscdefs.$(OBJ)
+else
+ MKROMFS_OBJS_1=$(AUX)gscdefs.$(OBJ) \
+ $(AUX)gpmisc.$(OBJ) $(AUX)gp_getnv.$(OBJ) \
+ $(AUX)gp_unix.$(OBJ) $(AUX)gp_unifs.$(OBJ) $(AUX)gp_unifn.$(OBJ) \
+ $(AUX)gp_stdia.$(OBJ) $(AUX)gsutil.$(OBJ)
+endif
$(MKROMFS_XE)_1: $(GLSRC)mkromfs.c $(MKROMFS_COMMON_DEPS) $(MKROMFS_OBJS_1) $(UNIX_AUX_MAK) $(MAKEDIRS)
$(CCAUX_) $(GENOPT) $(CFLAGS) $(I_)$(GLSRCDIR)$(_I) $(I_)$(GLOBJ)$(_I) $(I_)$(ZSRCDIR)$(_I) $(GLSRC)mkromfs.c $(O_)$(MKROMFS_XE)_1 $(MKROMFS_OBJS_1) $(AUXEXTRALIBS)
diff --git a/base/unix-dll.mak b/base/unix-dll.mak
index 1111111..2222222 100644
--- a/base/unix-dll.mak
+++ b/base/unix-dll.mak
@@ -35,17 +35,38 @@ SODEBUGDIRPREFIX=sodebug
# Shared object names
# simple loader (no support for display device)
-GSSOC_XENAME=$(GS_SO_BASE)c$(XE)
+ifeq ($(MINGW_WITH_WINLIB_NAMES), 1)
+ GSSOC_XENAME=gswin$(MINGW_PLATFORM_BITS)c$(XE)
+else
+ GSSOC_XENAME=$(GS_SO_BASE)c$(XE)
+endif
+
GSSOC_XE=$(BINDIR)/$(GSSOC_XENAME)
GSSOC=$(BINDIR)/$(GSSOC_XENAME)
# loader suporting display device using Gtk+
-GSSOX_XENAME=$(GS_SO_BASE)x$(XE)
+ifeq ($(MINGW_WITH_WINLIB_NAMES), 1)
+ GSSOX_XENAME=gswin$(MINGW_PLATFORM_BITS)$(XE)
+else
+ GSSOX_XENAME=$(GS_SO_BASE)x$(XE)
+endif
+
GSSOX_XE=$(BINDIR)/$(GSSOX_XENAME)
GSSOX=$(BINDIR)/$(GSSOX_XENAME)
-# shared library
-GS_SONAME_BASE=lib$(GS_SO_BASE)
+# shared library: handle unix and mingw library names
+ifeq ($(MINGW_BUILD), 1)
+ ifeq ($(MINGW_WITH_WINLIB_NAMES), 1)
+ GS_SONAME_BASE=gsdll$(MINGW_PLATFORM_BITS)
+ GS_SONAME_LINK=$(GS_SONAME_BASE)
+ else
+ GS_SONAME_BASE=lib$(GS_SO_BASE)
+ GS_SONAME_LINK=lib$(GS_SO_BASE)
+ endif
+else
+ GS_SONAME_BASE=lib$(GS_SO_BASE)
+ GS_SONAME_LINK=$(GS_SO_BASE)
+endif
# GNU/Linux
GS_SOEXT=$(SO_LIB_EXT)
@@ -82,30 +103,30 @@ GS_SO_MAJOR_MINOR=$(BINDIR)/$(GS_SONAME_MAJOR_MINOR)
# Create symbolic links to the Ghostscript interpreter library
-$(GS_SO): $(GS_SO_MAJOR) $(UNIX_DLL_MAK) $(MAKEDIRS)
+$(GS_SO): $(GS_SO_MAJOR_MINOR) $(UNIX_DLL_MAK) $(MAKEDIRS)
$(RM_) $(GS_SO)
- ln -s $(GS_SONAME_MAJOR_MINOR) $(GS_SO)
+ ln -s $(GS_SONAME_MAJOR) $(GS_SO)
-$(GS_SO_MAJOR): $(GS_SO_MAJOR_MINOR) $(UNIX_DLL_MAK) $(MAKEDIRS)
- $(RM_) $(GS_SO_MAJOR)
- ln -s $(GS_SONAME_MAJOR_MINOR) $(GS_SO_MAJOR)
+$(GS_SO_MAJOR_MINOR): $(GS_SO_MAJOR) $(UNIX_DLL_MAK) $(MAKEDIRS)
+ $(RM_) $(GS_SO_MAJOR_MINOR)
+ ln -s $(GS_SONAME_MAJOR) $(GS_SO_MAJOR_MINOR)
so-links-subtarget: $(GS_SO) $(UNIX_DLL_MAK) $(MAKEDIRS)
$(NO_OP)
# Build the small Ghostscript loaders, with Gtk+ and without
$(GSSOC_XE): so-links-subtarget $(PSSRC)$(SOC_LOADER) $(UNIX_DLL_MAK) $(MAKEDIRS)
- $(GLCC) -g -o $(GSSOC_XE) $(PSSRC)dxmainc.c \
- -L$(BINDIR) -l$(GS_SO_BASE)
+ $(GLCC) -g -o $(GSSOC_XE) $(PSSRC)$(SOC_LOADER_PLAIN) \
+ -L$(BINDIR) -l$(GS_SONAME_LINK)
$(GSSOX_XE): so-links-subtarget $(PSSRC)$(SOC_LOADER) $(UNIX_DLL_MAK) $(MAKEDIRS)
$(GLCC) -g $(SOC_CFLAGS) -o $(GSSOX_XE) $(PSSRC)$(SOC_LOADER) \
- -L$(BINDIR) -l$(GS_SO_BASE) $(SOC_LIBS)
+ -L$(BINDIR) -l$(GS_SONAME_LINK) $(SOC_LIBS)
# ------------------------- Recursive make targets ------------------------- #
SODEFS=\
- GS_XE=$(BINDIR)/$(GS_SONAME_MAJOR_MINOR)\
+ GS_XE=$(BINDIR)/$(GS_SONAME_MAJOR)\
DISPLAY_DEV=$(DD)display.dev\
STDIO_IMPLEMENTATION=c\
BUILDDIRPREFIX=$(BUILDDIRPREFIX)
@@ -179,11 +200,17 @@ install-so-subtarget: so-subtarget
-mkdir -p $(DESTDIR)$(gsincludedir)
$(INSTALL_PROGRAM) $(GSSOC) $(DESTDIR)$(bindir)/$(GSSOC_XENAME)
$(INSTALL_PROGRAM) $(GSSOX) $(DESTDIR)$(bindir)/$(GSSOX_XENAME)
- $(INSTALL_PROGRAM) $(BINDIR)/$(GS_SONAME_MAJOR_MINOR) $(DESTDIR)$(libdir)/$(GS_SONAME_MAJOR_MINOR)
- $(RM_) $(DESTDIR)$(libdir)/$(GS_SONAME)
- ln -s $(GS_SONAME_MAJOR_MINOR) $(DESTDIR)$(libdir)/$(GS_SONAME)
- $(RM_) $(DESTDIR)$(libdir)/$(GS_SONAME_MAJOR)
- ln -s $(GS_SONAME_MAJOR_MINOR) $(DESTDIR)$(libdir)/$(GS_SONAME_MAJOR)
+ @if test "$(MINGW_BUILD)" = "1" ; then \
+ $(INSTALL_PROGRAM) $(BINDIR)/$(GS_SONAME_MAJOR) $(DESTDIR)$(bindir)/$(GS_SONAME_MAJOR) ; \
+ $(INSTALL_PROGRAM) $(BINDIR)/$(GS_SONAME_LINK).dll.a $(DESTDIR)$(libdir)/$(GS_SONAME_LINK).dll.a ; \
+ else \
+ $(INSTALL_PROGRAM) $(BINDIR)/$(GS_SONAME_MAJOR) $(DESTDIR)$(libdir)/$(GS_SONAME_MAJOR) ; \
+ $(RM_) $(DESTDIR)$(libdir)/$(GS_SONAME) ; \
+ ln -s $(GS_SONAME_MAJOR) $(DESTDIR)$(libdir)/$(GS_SONAME) ; \
+ $(RM_) $(DESTDIR)$(libdir)/$(GS_SONAME_MAJOR) ; \
+ ln -s $(GS_SONAME_MAJOR) $(DESTDIR)$(libdir)/$(GS_SONAME_MAJOR_MINOR) ; \
+ fi
+ $(INSTALL_DATA) $(GLSRCDIR)/gserrors.h $(DESTDIR)$(gsincludedir)gserrors.h
$(INSTALL_DATA) $(PSSRC)iapi.h $(DESTDIR)$(gsincludedir)iapi.h
$(INSTALL_DATA) $(PSSRC)ierrors.h $(DESTDIR)$(gsincludedir)ierrors.h
$(INSTALL_DATA) $(GLSRC)gserrors.h $(DESTDIR)$(gsincludedir)gserrors.h
diff --git a/base/unix-gcc.mak b/base/unix-gcc.mak
index 1111111..2222222 100644
--- a/base/unix-gcc.mak
+++ b/base/unix-gcc.mak
@@ -79,7 +79,7 @@ INSTALL_PROGRAM = $(INSTALL) -m 755
INSTALL_DATA = $(INSTALL) -m 644
INSTALL_SHARED =
-prefix = /usr/local
+prefix = /usr
exec_prefix = ${prefix}
bindir = ${exec_prefix}/bin
scriptdir = $(bindir)
@@ -98,7 +98,7 @@ gsdatadir = $(gsdir)/$(GS_DOT_VERSION)
gssharedir = ${exec_prefix}/lib/ghostscript/$(GS_DOT_VERSION)
gsincludedir = ${prefix}/include/ghostscript/
-docdir=$(gsdatadir)/doc
+docdir=$(gsdatadir)/doc/ghostscript-$(GS_DOT_VERSION)
exdir=$(gsdatadir)/examples
GS_DOCDIR=$(docdir)
diff --git a/base/unixhead.mak b/base/unixhead.mak
index 1111111..2222222 100644
--- a/base/unixhead.mak
+++ b/base/unixhead.mak
@@ -22,7 +22,12 @@
# Define the platform name. For a "stock" System V platform,
# use sysv_ instead of unix_.
-GSPLATFORM=unix_
+# select platform: unix or mingw
+ifeq ($(MINGW_BUILD), 1)
+ GSPLATFORM=mingw_
+else
+ GSPLATFORM=unix_
+endif
# Define the syntax for command, object, and executable files.
@@ -65,3 +70,9 @@ CONFLDTR=-ol
# Define the compilation rules and flags.
BEGINFILES=
+
+ifeq ($(MINGW_BUILD), 1)
+ MINGW_FONTPATH_PATCH_OR_EMPTY_COMMAND=$(SH) $(GLSRCDIR)/mingw-fp.sh $(gconfigd_h)
+else
+ MINGW_FONTPATH_PATCH_OR_EMPTY_COMMAND=
+endif
diff --git a/configure.ac b/configure.ac
index 1111111..2222222 100644
--- a/configure.ac
+++ b/configure.ac
@@ -187,6 +187,26 @@ case `uname` in
SET_DT_SONAME="so"
fi
;;
+ MINGW*)
+ MINGW_BUILD=1
+ MINGW_PLATFORM=`uname`
+ MINGW_XTLIBS="-lwinspool"
+
+ # inner MINGW case statement: 32/64 bits
+ case $MINGW_PLATFORM in
+ MINGW32*)
+ MINGW_PLATFORM_BITS=32
+ ;;
+ MINGW64*)
+ MINGW_PLATFORM_BITS=64
+ ;;
+ esac
+
+ AC_SUBST(MINGW_BUILD)
+ AC_SUBST(MINGW_PLATFORM)
+ AC_SUBST(MINGW_PLATFORM_BITS)
+ AC_SUBST(MINGW_XTLIBS)
+ ;;
esac
AC_SUBST(SET_DT_SONAME)
@@ -1521,12 +1541,41 @@ AC_SUBST(JPXDIR)
AC_SUBST(SHARE_JPX)
AC_SUBST(JPXDEVS)
+dnl checks for MinGW shared object name and gdi must precede the gtk checks
+dnl check whether MinGW should use the MSVC dll names
+AC_ARG_WITH([winlib-names], AC_HELP_STRING([--with-winlib-names],
+ [MSys/MinGW only: dll and executable names should be gsdll32.dll (gsdll64.dll), gswin32.exe (gswin64.exe), and gswin32c.exe (gswin64c.exe)]),
+ [], [with_winlib_names=no])
+if test "x$with_winlib_names" = "xyes"; then
+ MINGW_WITH_WINLIB_NAMES=1
+fi
+
+dnl check whether MinGW should use the gdi-based (dwmain.c, dwmainc.c) front end
+AC_ARG_WITH([gdi], AC_HELP_STRING([--with-gdi],
+ [MSys/MinGW only: use the gdi-based Shared Object loaders (dwmain.c & dwmainc.c; implies --with-winlib-names=yes): not yet implemented]),
+ [], [with_gdi=no])
+if test "x$with_gdi" = "xyes"; then
+ MINGW_WITH_WINLIB_NAMES=1
+ MINGW_WITH_GDI=1
+ # SOC_LOADER value will be set after the initial gtk test
+fi
+
+AC_SUBST(MINGW_WITH_WINLIB_NAMES)
+AC_SUBST(MINGW_WITH_GDI)
+
dnl check if we can/should build the gtk loader
AC_ARG_ENABLE([gtk], AC_HELP_STRING([--disable-gtk],
[Do not build the gtk loader]))
SOC_CFLAGS=""
SOC_LIBS=""
-SOC_LOADER=""
+SOC_LOADER="" # default may not be set before the gtk+-2.0 test
+SOC_LOADER_PLAIN=""
+
+if test "x$with_gdi" = "xyes"; then
+ AC_MSG_WARN([the gdi front end under MSys/MinGW is not yet implemented])
+ enable_gtk=yes # try to use gtk+ instead
+fi
+
if test "x$enable_gtk" != "xno"; then
# Try GTK+ 3.x first...
if test "x$PKGCONFIG" != x; then
@@ -1559,9 +1608,15 @@ if test "x$SOC_LOADER" = "x"; then
SOC_LOADER="dxmainc.c"
fi
+dnl set default SOC_LOADER_PLAIN as necessary
+if test "x$SOC_LOADER_PLAIN" = x; then
+ SOC_LOADER_PLAIN="dxmainc.c"
+fi
+
AC_SUBST(SOC_CFLAGS)
AC_SUBST(SOC_LIBS)
AC_SUBST(SOC_LOADER)
+AC_SUBST(SOC_LOADER_PLAIN)
dnl look for omni implementation
AC_ARG_WITH([omni], AC_HELP_STRING([--with-omni],
@@ -2103,6 +2158,12 @@ case `uname` in
DYNAMIC_LDFLAGS="-shared -Wl,-brtl,-G -fPIC"
SO_LIB_EXT=".so"
;;
+ MINGW*)
+ DYNAMIC_CFLAGS="-fPIC"
+ DYNAMIC_LDFLAGS="-fPIC -shared"
+ DYNAMIC_LIBS=""
+ DYNANIC_LIB_EXT="dll"
+ ;;
esac
AC_ARG_ENABLE([dynamic], AC_HELP_STRING([--enable-dynamic],
@@ -2175,6 +2236,20 @@ if test "x$datadir" = 'x${prefix}/share'; then
fi
dnl Fix "fontpath" variable...
+if test $MINGW_BUILD = 1; then
+ # Add a reference to the Windows Fonts directory.
+ # This must take place priot to the test below,
+ # as it is also our way to avoid inclusion
+ # of the various unix font directories.
+ # Since gs uses here a colon as delimiter,
+ # we must refer to %windir% as /c/Windows
+ if test "x$fontpath" = "x"; then
+ fontpath="/c/Windows/Fonts"
+ else
+ fontpath="${fontpath}:/c/Windows/Fonts"
+ fi
+fi
+
if test "x$fontpath" = "x"; then
# These font directories are used by various Linux distributions...
fontpath="$datadir/fonts/default/ghostscript"
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Boris Nagaev <bnagaev@gmail.com>
Date: Sat, 16 Jul 2016 13:05:54 +0200
Subject: [PATCH] import patch libspectre.patch from MINGW-packages
Source: https://git.io/vKz18
diff --git a/psi/iapi.h b/psi/iapi.h
index 1111111..2222222 100644
--- a/psi/iapi.h
+++ b/psi/iapi.h
@@ -246,6 +246,7 @@ GSDLLEXPORT int GSDLLAPI gsapi_init_with_args(void *instance,
int argc, char **argv);
#ifdef __WIN32__
+#include <stddef.h>
GSDLLEXPORT int GSDLLAPI gsapi_init_with_argsA(void *instance,
int argc, char **argv);
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Boris Nagaev <bnagaev@gmail.com>
Date: Sat, 16 Jul 2016 13:13:22 +0200
Subject: [PATCH] import patch ghostscript-sys-zlib.patch from MINGW-packages
Source: https://git.io/vKz1D
diff --git a/configure.ac b/configure.ac
index 1111111..2222222 100644
--- a/configure.ac
+++ b/configure.ac
@@ -912,7 +912,7 @@ AC_MSG_CHECKING([for local zlib source])
dnl zlib is needed for language level 3, and libpng
# we must define ZLIBDIR regardless because png.mak does a -I$(ZLIBDIR)
# this seems a harmless default
-ZLIBDIR=src
+ZLIBDIR=$includedir
AUX_SHARED_ZLIB=
if test -d $srcdir/zlib; then
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: darealshinji <djcj@gmx.de>
Date: Sat, 16 Jul 2016 13:15:57 +0200
Subject: [PATCH] further changes for MXE
diff --git a/Makefile.in b/Makefile.in
index 1111111..2222222 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -110,6 +110,9 @@ docdir=$(gsdatadir)/doc
exdir=$(gsdatadir)/examples
GS_DOCDIR=$(docdir)
+# Are we cross-compiling?
+CROSS_COMPILING=@CROSS_COMPILING@
+
# Choose whether to compile the .ps initialization files into the executable.
# See gs.mak for details.
@@ -184,7 +187,7 @@ XPS=@XPS@
GPDL=@GPDL@
XE=@EXEEXT@
-XEAUX=@EXEEXT@
+XEAUX=@EXEEXTAUX@
PCL_XPS_TARGETS=@PCL_TARGET@ @XPS_TARGET@ @GPDL_TARGET@
@@ -369,7 +372,7 @@ RANLIB=@RANLIB@
# Define the name of the C compiler (target and host (AUX))
CC=@CC@
-CCAUX=@CC@
+CCAUX=@CCAUX@
# Define the name of the linker for the final link step.
# Normally this is the same as the C compiler.
@@ -379,6 +382,7 @@ CCAUXLD=$(CCAUX)
# Define the default gcc flags.
GCFLAGS=@CPPFLAGS@ @GCFLAGS@ @CFLAGS@
+GCFLAGS_AUX=@GCFLAGS@
# Define the added flags for standard, debugging, profiling
# and shared object builds.
@@ -442,7 +446,11 @@ LDFLAGS_SO=@DYNAMIC_LDFLAGS@
# (Libraries required by individual drivers are handled automatically.)
EXTRALIBS=$(XTRALIBS) @LIBS@ @MINGW_XTLIBS@ @DYNAMIC_LIBS@ @FONTCONFIG_LIBS@ @FT_LIBS@ @JPX_AUTOCONF_LIBS@
+ifeq ($(CROSS_COMPILING),yes)
+AUXEXTRALIBS=$(XTRALIBS) -lz
+else
AUXEXTRALIBS=$(XTRALIBS) @LIBS@ @MINGW_XTLIBS@ @DYNAMIC_LIBS@ @FONTCONFIG_LIBS@ @FT_LIBS@ @JPX_AUTOCONF_LIBS@ @AUX_SHARED_ZLIB@
+endif
# Define the standard libraries to search at the end of linking.
# Most platforms require -lpthread for the POSIX threads library;
@@ -492,10 +500,10 @@ SYNC=@SYNC@
RM=rm -f
# ------ Dynamic loader options ------- #
-SOC_CFLAGS = @SOC_CFLAGS@
-SOC_LIBS = @SOC_LIBS@
-SOC_LOADER = @SOC_LOADER@
-SOC_LOADER_PLAIN = @SOC_LOADER_PLAIN@
+SOC_CFLAGS = @SOC_CFLAGS@
+SOC_LIBS = @SOC_LIBS@
+SOC_LOADER = @SOC_LOADER@
+SOC_LOADER_PLAIN = @SOC_LOADER_PLAIN@
# on virtually every Unix-a-like system, this is "so",
# but Apple just had to be different, so it's now set
@@ -646,16 +654,15 @@ AK=
CCFLAGS=$(GENOPT) $(CAPOPT) $(CFLAGS)
CC_=$(CC) $(CCFLAGS)
-
ifeq ($(MINGW_BUILD), 1)
# adding -lz to the compilation flags seems to be an error:
- # if not always, then at least under MSys/MinGW,
+ # if not always, then at least under MSys/MinGW,
# compiled against the system's zlib,
# and having no zlib sub-folder (see also: unixaux.mak)
- CCAUX_=$(CCAUX) $(CFLAGS)
+ CCAUX_=$(CCAUX) -I"@TARGET_INCLUDE@" $(GCFLAGS_AUX)
else
CCAUX_=$(CCAUX) $(CFLAGS) @AUX_SHARED_ZLIB@
-endif
+endif
CC_LEAF=$(CC_)
# note gcc can't use -fomit-frame-pointer with -pg.
diff --git a/base/gp_mswin.h b/base/gp_mswin.h
index 1111111..2222222 100644
--- a/base/gp_mswin.h
+++ b/base/gp_mswin.h
@@ -56,7 +56,7 @@ extern int is_spool(const char *queue);
#endif /* !defined(RC_INVOKED) */
-// in gp_mswin.c, mswin_popen is called
+// in gp_mswin.c, mswin_popen is called
// before it is implemented, so we must
// provide a prototype (at least with GCC) to
// avoid implicit definition with the wrong return type
diff --git a/base/gp_unix.c b/base/gp_unix.c
index 1111111..2222222 100644
--- a/base/gp_unix.c
+++ b/base/gp_unix.c
@@ -13,6 +13,9 @@
CA 94903, U.S.A., +1(415)492-9861, for further information.
*/
+#if defined(__WIN32__) && !defined(METRO)
+#include "windows_.h"
+#endif
/* Unix-specific routines for Ghostscript */
@@ -442,3 +445,11 @@ void gp_enumerate_fonts_free(void *enum_state)
}
#endif
}
+
+#if defined(__WIN32__) && !defined(METRO)
+/* include gp_local_arg_encoding_get_codepoint for MinGW cross-builds */
+#ifndef GP_LAEGC_INCLUDED
+# define GP_LAEGC_INCLUDED
+#endif
+#include "gp_win32.c"
+#endif
diff --git a/base/gp_win32.c b/base/gp_win32.c
index 1111111..2222222 100644
--- a/base/gp_win32.c
+++ b/base/gp_win32.c
@@ -13,6 +13,7 @@
CA 94903, U.S.A., +1(415)492-9861, for further information.
*/
+#ifndef GP_LAEGC_INCLUDED
/* Common platform-specific routines for MS-Windows WIN32 */
/* originally hacked from gp_msdos.c by Russell Lang */
@@ -131,6 +132,8 @@ const char gp_null_file_name[] = "nul";
/* Define the name that designates the current directory. */
const char gp_current_directory_name[] = ".";
+#endif /* GP_LAEGC_INCLUDED */
+
/* A function to decode the next codepoint of the supplied args from the
* local windows codepage, or -1 for EOF.
*/
diff --git a/base/lib.mak b/base/lib.mak
index 1111111..2222222 100644
--- a/base/lib.mak
+++ b/base/lib.mak
@@ -76,7 +76,7 @@ stdpre_h=$(GLSRC)stdpre.h $(stdpn_h)
stdint__h=$(GLSRC)stdint_.h $(std_h)
$(GLGEN)arch.h : $(GENARCH_XE)
- $(EXP)$(GENARCH_XE) $(GLGEN)arch.h $(TARGET_ARCH_FILE)
+ test -f $@ || $(GENARCH_XE) $(GLGEN)arch.h $(TARGET_ARCH_FILE)
# Platform interfaces
diff --git a/base/unix-aux.mak b/base/unix-aux.mak
index 1111111..2222222 100644
--- a/base/unix-aux.mak
+++ b/base/unix-aux.mak
@@ -69,7 +69,7 @@ $(GLOBJ)gp_sysv.$(OBJ): $(GLSRC)gp_sysv.c $(stdio__h) $(time__h) $(AK)\
$(UNIX_AUX_MAK) $(MAKEDIRS)
$(GLCC) $(GLO_)gp_sysv.$(OBJ) $(C_) $(GLSRC)gp_sysv.c
-# the MINGW platform / build environment, joining unix for the ride
+# the MINGW platform / build environment, joining unix for the ride
mingw__=$(GLOBJ)gp_wgetv.$(OBJ) $(GLOBJ)gp_wpapr.$(OBJ) $(GLOBJ)gp_win32.$(OBJ) $(GLOBJ)gp_mswin.$(OBJ) $(GLOBJ)gp_ntfs.$(OBJ) $(GLOBJ)gp_stdia.$(OBJ) $(GLOBJ)gp_wutf8.$(OBJ) $(GLOBJ)gp_nxpsprn.$(OBJ)
$(GLGEN)mingw_.dev: $(mingw__) $(GLD)nosync.dev $(GLD)smd5.dev
$(SETMOD) $(GLGEN)mingw_ $(mingw__) -include $(GLD)nosync
@@ -98,6 +98,11 @@ $(GENHT_XE): $(GLSRC)genht.c $(AK) $(GENHT_DEPS) $(UNIX_AUX_MAK) $(MAKEDIRS)
# To get GS to use the system zlib, you remove/hide the gs/zlib directory
# which means that the mkromfs build can't find the zlib source it needs.
# So it's split into two targets, one using the zlib source directly.....
+ifeq ($(CROSS_COMPILING),yes)
+MKROMFS_OBJS_0=$(MKROMFS_ZLIB_OBJS) $(AUX)gpmisc.$(OBJ) $(AUX)gp_getnv.$(OBJ) \
+ $(AUX)gscdefs.$(OBJ) $(AUX)gp_unix.$(OBJ) $(AUX)gp_unifs.$(OBJ) $(AUX)gp_unifn.$(OBJ) \
+ $(AUX)gp_stdia.$(OBJ) $(AUX)gsutil.$(OBJ) $(AUX)memento.$(OBJ)
+else
ifeq ($(MINGW_BUILD), 1)
MKROMFS_OBJS_0=$(MKROMFS_ZLIB_OBJS) $(AUX)gpmisc.$(OBJ) $(AUX)gp_getnv.$(OBJ) \
$(AUX)gscdefs.$(OBJ) $(AUX)gp_ntfs.$(OBJ) $(AUX)gp_mswin.$(OBJ) \
@@ -107,13 +112,20 @@ else
$(AUX)gscdefs.$(OBJ) $(AUX)gp_unix.$(OBJ) $(AUX)gp_unifs.$(OBJ) $(AUX)gp_unifn.$(OBJ) \
$(AUX)gp_stdia.$(OBJ) $(AUX)gsutil.$(OBJ) $(AUX)memento.$(OBJ)
endif
+endif
$(MKROMFS_XE)_0: $(GLSRC)mkromfs.c $(MKROMFS_COMMON_DEPS) $(MKROMFS_OBJS_0) $(UNIX_AUX_MAK) $(MAKEDIRS)
- $(CCAUX_) $(GENOPT) $(CFLAGS) $(I_)$(GLSRCDIR)$(_I) $(I_)$(GLOBJ)$(_I) $(I_)$(ZSRCDIR)$(_I) $(GLSRC)mkromfs.c $(O_)$(MKROMFS_XE)_0 $(MKROMFS_OBJS_0) $(AUXEXTRALIBS)
+ $(CCAUX_) $(GENOPT) $(I_)$(GLSRCDIR)$(_I) $(I_)$(GLOBJ)$(_I) $(GLSRC)mkromfs.c $(O_)$(MKROMFS_XE)_0 $(MKROMFS_OBJS_0) $(AUXEXTRALIBS)
# .... and one using the zlib library linked via the command line
# (here two, MINGW has a different set of dependencies,
# most notably gp_ntfs and gp_wutf8)
+ifeq ($(CROSS_COMPILING),yes)
+MKROMFS_OBJS_1=$(AUX)gscdefs.$(OBJ) \
+ $(AUX)gpmisc.$(OBJ) $(AUX)gp_getnv.$(OBJ) \
+ $(AUX)gp_unix.$(OBJ) $(AUX)gp_unifs.$(OBJ) $(AUX)gp_unifn.$(OBJ) \
+ $(AUX)gp_stdia.$(OBJ) $(AUX)gsutil.$(OBJ)
+else
ifeq ($(MINGW_BUILD), 1)
MKROMFS_OBJS_1=$(GLOBJ)gp_ntfs.$(OBJ) $(GLOBJ)gp_wutf8.$(OBJ) \
$(GLOBJ)gpmisc.$(OBJ) $(GLOBJ)gp_wgetv.$(OBJ) $(GLOBJ)gscdefs.$(OBJ)
@@ -123,9 +135,10 @@ else
$(AUX)gp_unix.$(OBJ) $(AUX)gp_unifs.$(OBJ) $(AUX)gp_unifn.$(OBJ) \
$(AUX)gp_stdia.$(OBJ) $(AUX)gsutil.$(OBJ)
endif
+endif
$(MKROMFS_XE)_1: $(GLSRC)mkromfs.c $(MKROMFS_COMMON_DEPS) $(MKROMFS_OBJS_1) $(UNIX_AUX_MAK) $(MAKEDIRS)
- $(CCAUX_) $(GENOPT) $(CFLAGS) $(I_)$(GLSRCDIR)$(_I) $(I_)$(GLOBJ)$(_I) $(I_)$(ZSRCDIR)$(_I) $(GLSRC)mkromfs.c $(O_)$(MKROMFS_XE)_1 $(MKROMFS_OBJS_1) $(AUXEXTRALIBS)
+ $(CCAUX_) $(GENOPT) $(I_)$(GLSRCDIR)$(_I) $(I_)$(GLOBJ)$(_I) $(GLSRC)mkromfs.c $(O_)$(MKROMFS_XE)_1 $(MKROMFS_OBJS_1) $(AUXEXTRALIBS)
$(MKROMFS_XE): $(MKROMFS_XE)_$(SHARE_ZLIB) $(UNIX_AUX_MAK) $(MAKEDIRS)
$(CP_) $(MKROMFS_XE)_$(SHARE_ZLIB) $(MKROMFS_XE)
diff --git a/base/unix-dll.mak b/base/unix-dll.mak
index 1111111..2222222 100644
--- a/base/unix-dll.mak
+++ b/base/unix-dll.mak
@@ -54,7 +54,8 @@ endif
GSSOX_XE=$(BINDIR)/$(GSSOX_XENAME)
GSSOX=$(BINDIR)/$(GSSOX_XENAME)
-# shared library: handle unix and mingw library names
+# shared library
+# handle unix and mingw library names
ifeq ($(MINGW_BUILD), 1)
ifeq ($(MINGW_WITH_WINLIB_NAMES), 1)
GS_SONAME_BASE=gsdll$(MINGW_PLATFORM_BITS)
@@ -210,7 +211,6 @@ install-so-subtarget: so-subtarget
$(RM_) $(DESTDIR)$(libdir)/$(GS_SONAME_MAJOR) ; \
ln -s $(GS_SONAME_MAJOR) $(DESTDIR)$(libdir)/$(GS_SONAME_MAJOR_MINOR) ; \
fi
- $(INSTALL_DATA) $(GLSRCDIR)/gserrors.h $(DESTDIR)$(gsincludedir)gserrors.h
$(INSTALL_DATA) $(PSSRC)iapi.h $(DESTDIR)$(gsincludedir)iapi.h
$(INSTALL_DATA) $(PSSRC)ierrors.h $(DESTDIR)$(gsincludedir)ierrors.h
$(INSTALL_DATA) $(GLSRC)gserrors.h $(DESTDIR)$(gsincludedir)gserrors.h
diff --git a/base/unixhead.mak b/base/unixhead.mak
index 1111111..2222222 100644
--- a/base/unixhead.mak
+++ b/base/unixhead.mak
@@ -25,7 +25,7 @@
# select platform: unix or mingw
ifeq ($(MINGW_BUILD), 1)
GSPLATFORM=mingw_
-else
+else
GSPLATFORM=unix_
endif
diff --git a/configure.ac b/configure.ac
index 1111111..2222222 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,6 +24,9 @@ AC_PREREQ(2.63)
AC_LANG(C)
AC_CONFIG_SRCDIR(psi/gs.c)
+AC_CANONICAL_HOST
+AC_CANONICAL_BUILD
+
dnl Inherit compiler flags from the environment...
CFLAGS="${CFLAGS:=}"
CPPFLAGS="${CPPFLAGS:=}"
@@ -106,7 +109,7 @@ AC_PROG_RANLIB
#AC_PROG_INSTALL
dnl pkg-config is used for several tests now...
-AC_PATH_PROG(PKGCONFIG, pkg-config)
+AC_PATH_TARGET_TOOL(PKGCONFIG, pkg-config)
dnl --------------------------------------------------
dnl Allow excluding the contributed drivers
@@ -117,8 +120,8 @@ AC_ARG_ENABLE([contrib], AC_HELP_STRING([--disable-contrib],
CONTRIBINCLUDE="include $srcdir/contrib/contrib.mak"
INSTALL_CONTRIB="install-contrib-extras"
-case `uname` in
- MINGW*|MSYS*)
+case $host in
+ *-mingw*)
AC_MSG_WARN([disabling contrib devices])
enable_contrib=no
;;
@@ -146,28 +149,23 @@ dnl --------------------------------------------------
CC_OPT_FLAGS_TO_TRY="-O"
SET_DT_SONAME="-soname="
+MINGW_BUILD=0
-case `uname` in
- Linux*|GNU*)
+case $host in
+ *-linux*|*-gnu*|*bsd*)
if test $ac_cv_prog_gcc = yes; then
CC_OPT_FLAGS_TO_TRY="-O2"
CC_DBG_FLAGS_TO_TRY="-gdwarf-2 -g3 -O0"
fi
;;
- *BSD)
- if test $ac_cv_prog_gcc = yes; then
- CC_OPT_FLAGS_TO_TRY="-O2"
- CC_DBG_FLAGS_TO_TRY="-gdwarf-2 -g3 -O0"
- fi
- ;;
- Darwin*)
+ *-darwin*)
if test $ac_cv_prog_gcc = yes; then
CC_OPT_FLAGS_TO_TRY="-O2"
CC_DBG_FLAGS_TO_TRY="-gdwarf-2 -g3 -O0"
fi
SET_DT_SONAME=""
;;
- SunOS)
+ *-sunos*|*-solaris*)
CC_OPT_FLAGS_TO_TRY="-O2"
# the trailing space is required!
if test $ac_cv_prog_gcc = no; then
@@ -180,33 +178,32 @@ case `uname` in
CC_DBG_FLAGS_TO_TRY="-g -O0"
fi
;;
- AIX)
+ *-aix*)
if test $ac_cv_prog_gcc = yes; then
CC_OPT_FLAGS_TO_TRY="-O2"
CC_DBG_FLAGS_TO_TRY="-gdwarf-2 -g3 -O0"
SET_DT_SONAME="so"
fi
;;
- MINGW*)
- MINGW_BUILD=1
- MINGW_PLATFORM=`uname`
- MINGW_XTLIBS="-lwinspool"
-
- # inner MINGW case statement: 32/64 bits
- case $MINGW_PLATFORM in
- MINGW32*)
- MINGW_PLATFORM_BITS=32
- ;;
- MINGW64*)
- MINGW_PLATFORM_BITS=64
- ;;
- esac
-
- AC_SUBST(MINGW_BUILD)
- AC_SUBST(MINGW_PLATFORM)
- AC_SUBST(MINGW_PLATFORM_BITS)
- AC_SUBST(MINGW_XTLIBS)
- ;;
+ *-mingw*)
+ MINGW_BUILD=1
+ MINGW_XTLIBS="-lwinspool"
+ # inner MINGW case statement: 32/64 bits
+ case $host in
+ i?86-*)
+ MINGW_PLATFORM=MINGW32
+ MINGW_PLATFORM_BITS=32
+ ;;
+ x86_64-*)
+ MINGW_PLATFORM=MINGW64
+ MINGW_PLATFORM_BITS=64
+ ;;
+ esac
+ AC_SUBST(MINGW_BUILD)
+ AC_SUBST(MINGW_PLATFORM)
+ AC_SUBST(MINGW_PLATFORM_BITS)
+ AC_SUBST(MINGW_XTLIBS)
+ ;;
esac
AC_SUBST(SET_DT_SONAME)
@@ -227,10 +224,16 @@ fi
ARCH_CONF_HEADER=
-case `uname` in
- Darwin*)
+case $host in
+ *-darwin*)
ARCH_CONF_HEADER="\$(GLSRCDIR)/../arch/osx-x86-x86_64-ppc-gcc.h"
;;
+ i?86-*-mingw*)
+ ARCH_CONF_HEADER="\$(GLSRCDIR)/../arch/windows-x86-msvc.h"
+ ;;
+ x86_64-*-mingw*)
+ ARCH_CONF_HEADER="\$(GLSRCDIR)/../arch/windows-x64-msvc.h"
+ ;;
*)
ARCH_CONF_HEADER=
;;
@@ -342,8 +345,8 @@ dnl --------------------------------------------------
OBJDIR_BSDMAKE_WORKAROUND=obj
-case `uname` in
- *BSD)
+case $host in
+ *bsd*)
OBJDIR_BSDMAKEWORKAOROUND="notobj"
;;
esac
@@ -513,8 +516,8 @@ AC_ARG_ENABLE([threading], AC_HELP_STRING([--disable-threading],
# if you haven't got pread/pwrite, we can't use multithreading
if test "x$HAVE_PREAD_PWRITE" != "x"; then
if test "$enable_threading" != "no"; then
- case `uname` in
- MINGW*|MSYS*)
+ case $host in
+ *-mingw*)
AC_MSG_WARN([disabling support for pthreads......])
;;
*)
@@ -1251,8 +1254,8 @@ dnl look for IJS implementation
AC_ARG_WITH([ijs], AC_HELP_STRING([--without-ijs],
[disable IJS driver support]))
-case `uname` in
- MINGW*|MSYS*)
+case $host in
+ *-mingw*)
AC_MSG_WARN([disabling the ijs device])
with_ijs=no
;;
@@ -1311,11 +1314,11 @@ if test x$with_luratech != xno; then
SHARE_JBIG2=0
JBIG2DIR=$srcdir/luratech/ldf_jb2
- case `uname` in
- Darwin*)
+ case $host in
+ *-darwin*)
JBIG2_AUTOCONF_CFLAGS="-DUSE_LDF_JB2 -DMAC -DMAC_OS_X_BUILD"
;;
- AIX)
+ *-aix*)
if test $ac_cv_prog_gcc = yes; then
JBIG2_AUTOCONF_CFLAGS="-DUSE_LDF_JB2 -fsigned-char -DLINUX"
else
@@ -1433,11 +1436,11 @@ if test x$with_luratech != xno; then
SHARE_JPX=0
JPXDIR=$srcdir/luratech/lwf_jp2
- case `uname` in
- Darwin*)
+ case $host in
+ *-darwin*)
JPX_AUTOCONF_CFLAGS="-DUSE_LWF_JP2 -DMAC -DMAC_OS_X_BUILD"
;;
- AIX)
+ *-aix*)
if test $ac_cv_prog_gcc = yes; then
JPX_AUTOCONF_CFLAGS="-DUSE_LWF_JP2 -fsigned-char -DLINUX"
else
@@ -1568,7 +1571,7 @@ AC_ARG_ENABLE([gtk], AC_HELP_STRING([--disable-gtk],
[Do not build the gtk loader]))
SOC_CFLAGS=""
SOC_LIBS=""
-SOC_LOADER="" # default may not be set before the gtk+-2.0 test
+SOC_LOADER=""
SOC_LOADER_PLAIN=""
if test "x$with_gdi" = "xyes"; then
@@ -2111,8 +2114,8 @@ SO_LIB_EXT=".so"
DLL_EXT=""
SO_LIB_VERSION_SEPARATOR="."
-case `uname` in
- Linux*|GNU*)
+case $host in
+ *-linux*|*-gnu*|*bsd*)
DYNAMIC_CFLAGS="-fPIC"
DYNAMIC_LDFLAGS="-shared -Wl,\$(LD_SET_DT_SONAME)\$(LDFLAGS_SO_PREFIX)\$(GS_SONAME_MAJOR)"
if test $ac_cv_prog_gcc = yes; then
@@ -2123,25 +2126,20 @@ case `uname` in
fi
SO_LIB_EXT=".so"
;;
- MINGW*|MSYS*)
- DYNAMIC_CFLAGS=""
+ *-mingw*)
+ DYNAMIC_LIBS=""
+ DYNAMIC_CFLAGS="-DGSDLLEXPORT=\"__declspec(dllexport)\""
DYNAMIC_LDFLAGS="-shared -Wl,--out-implib=\$(BINDIR)/lib\$(GS_SO_BASE).dll.a -Wl,--export-all-symbols -Wl,--enable-auto-import"
SO_LIB_EXT=""
DLL_EXT=".dll"
SO_LIB_VERSION_SEPARATOR="-"
;;
- *BSD)
- DYNAMIC_CFLAGS="-fPIC"
- DYNAMIC_LDFLAGS="-shared -Wl,\$(LD_SET_DT_SONAME)\$(LDFLAGS_SO_PREFIX)\$(GS_SONAME_MAJOR)"
- DYNAMIC_LIBS=""
- SO_LIB_EXT=".so"
- ;;
- Darwin*)
+ *-darwin*)
DYNAMIC_LDFLAGS="-dynamiclib -install_name \$(GS_SONAME_MAJOR_MINOR)"
DYNAMIC_LIBS=""
SO_LIB_EXT=".dylib"
;;
- SunOS)
+ *-sunos*|*-solaris*)
if test $ac_cv_prog_gcc = yes; then
DYNAMIC_CFLAGS="-fPIC"
else
@@ -2152,26 +2150,20 @@ case `uname` in
DYNAMIC_LIBS=""
SO_LIB_EXT=".so"
;;
- AIX)
+ *-aix*)
DYNAMIC_CFLAGS="-fPIC"
GCFLAGS="-Wl,-brtl $GCFLAGS"
DYNAMIC_LDFLAGS="-shared -Wl,-brtl,-G -fPIC"
SO_LIB_EXT=".so"
;;
- MINGW*)
- DYNAMIC_CFLAGS="-fPIC"
- DYNAMIC_LDFLAGS="-fPIC -shared"
- DYNAMIC_LIBS=""
- DYNANIC_LIB_EXT="dll"
- ;;
esac
AC_ARG_ENABLE([dynamic], AC_HELP_STRING([--enable-dynamic],
[Enable dynamically loaded drivers]),
[
if test "x$enable_dynamic" != xno; then
- case `uname` in
- Linux*|GNU*)
+ case $host in
+ *-linux*)
INSTALL_SHARED="install-shared"
if test "x$X_DEVS" != x; then
DYNAMIC_DEVS="\$(GLOBJDIR)/X11.so"
@@ -2183,21 +2175,21 @@ AC_ARG_ENABLE([dynamic], AC_HELP_STRING([--enable-dynamic],
OPT_CFLAGS="$DYNAMIC_CFLAGS $OPT_CFLAGS"
DBG_CFLAGS="$DYNAMIC_CFLAGS $DBG_CFLAGS"
;;
- *BSD)
+ *bsd*)
DYNAMIC_DEVS="\$(GLOBJDIR)/X11.so"
DYNAMIC_FLAGS="-DGS_DEVS_SHARED -DGS_DEVS_SHARED_DIR=\\\"\$(gssharedir)\\\""
X11_DEVS=""
OPT_CFLAGS="$DYNAMIC_CFLAGS $OPT_CFLAGS"
DBG_CFLAGS="$DYNAMIC_CFLAGS $DBG_CFLAGS"
;;
- Darwin*)
+ *darwin*)
INSTALL_SHARED="install-shared"
DYNAMIC_FLAGS="-DGS_DEVS_SHARED -DGS_DEVS_SHARED_DIR=\\\"\$(gssharedir)\\\""
X11_DEVS=""
OPT_CFLAGS="$DYNAMIC_CFLAGS $OPT_CFLAGS"
DBG_CFLAGS="$DYNAMIC_CFLAGS $DBG_CFLAGS"
;;
- SunOS)
+ *-sunos*|*-solaris*)
DYNAMIC_DEVS="\$(GLOBJDIR)/X11.so"
DYNAMIC_FLAGS="-DGS_DEVS_SHARED -DGS_DEVS_SHARED_DIR=\\\"\$(gssharedir)\\\""
OPT_CFLAGS="$DYNAMIC_CFLAGS $OPT_CFLAGS"
@@ -2316,8 +2308,8 @@ dnl --------------------------------------------------
dnl disable the memory header ID code on SPARC
dnl --------------------------------------------------
-case `uname -a` in
- *sparc*)
+case $host in
+ sparc*)
GCFLAGS="$GCFLAGS -DGS_USE_MEMORY_HEADER_ID=0"
;;
esac
@@ -2513,8 +2505,8 @@ AC_SUBST(SUB_MAKE_OPTION)
# mingw, add the same prefix as the VS build uses
# --------------------------------------------------
AUXDIRPOSTFIX=""
-case `uname` in
- MINGW*|MSYS*)
+case $host in
+ *-mingw*)
AUXDIRPOSTFIX="_"
CFLAGS="-DGS_NO_UTF8=1 $CFLAGS"
;;
@@ -2533,8 +2525,8 @@ AC_ARG_WITH([exe-ext], AC_HELP_STRING([--with-exe-ext=EXT],
if test "x"$with_exe_ext != "x"; then
EXEEXT="$with_exe_ext"
else
- case `uname` in
- MINGW*|MSYS*)
+ case $host in
+ *-mingw*)
EXEEXT=".exe"
;;
esac
@@ -2543,6 +2535,36 @@ fi
AC_SUBST(EXEEXT)
dnl --------------------------------------------------
+dnl AUX and cross compiling
+dnl --------------------------------------------------
+EXEEXTAUX="$EXEEXT"
+CROSS_COMPILING=no
+
+AC_ARG_VAR(CCAUX, [auxilliary C compiler])
+
+if test "$cross_compiling" = yes ; then
+ CROSS_COMPILING=yes
+ case $build in
+ *-mingw*)
+ EXEEXTAUX=".exe"
+ ;;
+ *)
+ EXEEXTAUX=""
+ ;;
+ esac
+ if test "x$CCAUX" = "x" ; then
+ CCAUX="gcc"
+ fi
+else
+ if test "x$CCAUX" = "x" ; then
+ CCAUX="\$(CC)"
+ fi
+fi
+
+AC_SUBST(EXEEXTAUX)
+AC_SUBST(CROSS_COMPILING)
+
+dnl --------------------------------------------------
dnl Do substitutions
dnl --------------------------------------------------
SRCDIR="$srcdir"
diff --git a/ijs/ijs_exec_unix.c b/ijs/ijs_exec_unix.c
index 1111111..2222222 100644
--- a/ijs/ijs_exec_unix.c
+++ b/ijs/ijs_exec_unix.c
@@ -22,6 +22,12 @@
* SOFTWARE.
**/
+#ifdef __WIN32__
+
+#include "ijs_exec_win.c"
+
+#else
+
#include "unistd_.h"
#include <stdio.h>
#include <stdlib.h>
@@ -101,3 +107,5 @@ ijs_exec_server(const char *server_cmd, int *pfd_to, int *pfd_from,
return 0;
}
+
+#endif /* __WIN32__ */
diff --git a/psi/iapi.h b/psi/iapi.h
index 1111111..2222222 100644
--- a/psi/iapi.h
+++ b/psi/iapi.h
@@ -68,6 +68,11 @@ extern "C" {
# define GSDLLEXPORT
# endif
# endif
+# ifdef __MINGW32__
+/* export stdcall functions as "name" instead of "_name@ordinal" */
+# undef GSDLLAPI
+# define GSDLLAPI
+# endif
# ifndef GSDLLAPI
# define GSDLLAPI __stdcall
# endif
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Boris Nagaev <bnagaev@gmail.com>
Date: Tue, 19 Jul 2016 23:58:16 +0300
Subject: [PATCH] fix noncontribmakefiles if srcdir!=dstdir
See https://github.com/mxe/mxe/pull/1382#issuecomment-233653542
diff --git a/configure.ac b/configure.ac
index 1111111..2222222 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2054,7 +2054,7 @@ if test x$enable_threadsafe = xyes; then
NTS_EXCLUDES=`echo "$NTS_EXCLUDES" | tr " " "\n" | sort | uniq | tr "\n" " "`
fi # x$enable_threadsafe = xyes
-noncontribmakefiles=`find $srcdir -name '*.mak' -print | grep -v '^\./contrib/'`
+noncontribmakefiles=`find $srcdir -name '*.mak' -print | grep -v '/contrib/'`
# No need to include opvp/oprp driver without iconv/libiconv.
if test -n "$P_DEVS0"; then
|