summaryrefslogtreecommitdiffstats
path: root/src/qt-1-win32.patch
blob: fa20a720a42c7a57d794f8fc495eac82a296fd36 (plain)
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
This file is part of mingw-cross-env.
See doc/index.html for further information.

This patch has been taken from:
http://qt.gitorious.org/qt/qt/merge_requests/654

diff -Naur a/config.tests/unix/compile.test b/config.tests/unix/compile.test
--- a/config.tests/unix/compile.test	2010-05-04 02:43:26.000000000 +0200
+++ b/config.tests/unix/compile.test	2010-05-27 21:38:19.426555345 +0200
@@ -66,7 +66,7 @@
 
 test -r Makefile && $MAKE distclean >/dev/null 2>&1
 
-"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "LIBS*=$LFLAGS" "LIBS+=$MAC_ARCH_LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile"
+"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "CONFIG-=debug_and_release" "LIBS*=$LFLAGS" "LIBS+=$MAC_ARCH_LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile"
 
 if [ "$VERBOSE" = "yes" ]; then
     $MAKE
@@ -74,7 +74,7 @@
     $MAKE >/dev/null 2>&1
 fi
 
-[ -x "$EXE" ] && SUCCESS=yes
+[ -x "$EXE" ] || [ -x "${EXE}.exe" ] && SUCCESS=yes
 
 # done
 if [ "$SUCCESS" != "yes" ]; then
diff -Naur a/config.tests/unix/getaddrinfo/getaddrinfotest.cpp b/config.tests/unix/getaddrinfo/getaddrinfotest.cpp
--- a/config.tests/unix/getaddrinfo/getaddrinfotest.cpp	2010-05-04 02:43:26.000000000 +0200
+++ b/config.tests/unix/getaddrinfo/getaddrinfotest.cpp	2010-05-27 21:38:19.426555345 +0200
@@ -42,9 +42,16 @@
 /* Sample program for configure to test for getaddrinfo on the unix
      platform. we check for all structures and functions required. */
 
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef __MINGW32__
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#else
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netdb.h>
+#endif
 
 int main()
 {
diff -Naur a/config.tests/unix/iconv/iconv.pro b/config.tests/unix/iconv/iconv.pro
--- a/config.tests/unix/iconv/iconv.pro	2010-05-04 02:43:26.000000000 +0200
+++ b/config.tests/unix/iconv/iconv.pro	2010-05-27 21:38:21.538554930 +0200
@@ -1,3 +1,3 @@
 SOURCES = iconv.cpp
 CONFIG -= qt dylib app_bundle
-mac:LIBS += -liconv
+mac|win32-g++*:LIBS += -liconv
diff -Naur a/config.tests/unix/ipv6/ipv6test.cpp b/config.tests/unix/ipv6/ipv6test.cpp
--- a/config.tests/unix/ipv6/ipv6test.cpp	2010-05-04 02:43:26.000000000 +0200
+++ b/config.tests/unix/ipv6/ipv6test.cpp	2010-05-27 21:38:21.874554938 +0200
@@ -46,9 +46,14 @@
 #define _HPUX_SOURCE
 #endif
 
+#ifdef __MINGW32__
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#else
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
+#endif
 
 int main()
 {
diff -Naur a/config.tests/unix/odbc/odbc.cpp b/config.tests/unix/odbc/odbc.cpp
--- a/config.tests/unix/odbc/odbc.cpp	2010-05-04 02:43:26.000000000 +0200
+++ b/config.tests/unix/odbc/odbc.cpp	2010-05-27 21:38:22.007563215 +0200
@@ -38,7 +38,9 @@
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
-
+#ifdef __MINGW32__
+#include <windows.h>
+#endif
 #include <sql.h>
 #include <sqlext.h>
 
diff -Naur a/config.tests/unix/odbc/odbc.pro b/config.tests/unix/odbc/odbc.pro
--- a/config.tests/unix/odbc/odbc.pro	2010-05-04 02:43:26.000000000 +0200
+++ b/config.tests/unix/odbc/odbc.pro	2010-05-27 21:38:22.214837283 +0200
@@ -1,4 +1,5 @@
 SOURCES = odbc.cpp
 CONFIG -= qt dylib
 mac:CONFIG -= app_bundle
-LIBS += -lodbc
+win32-g++*:LIBS += -lodbc32
+else:LIBS += -lodbc
diff -Naur a/config.tests/x11/opengl/opengl.pro b/config.tests/x11/opengl/opengl.pro
--- a/config.tests/x11/opengl/opengl.pro	2010-05-04 02:43:26.000000000 +0200
+++ b/config.tests/x11/opengl/opengl.pro	2010-05-27 21:38:22.214837283 +0200
@@ -7,4 +7,5 @@
 }
 
 CONFIG -= qt
-LIBS += -lGL -lGLU
+win32-g++*:LIBS += -lopengl32
+else:LIBS += -lGL -lGLU
diff -Naur a/configure b/configure
--- a/configure	2010-05-04 02:43:19.000000000 +0200
+++ b/configure	2010-05-27 21:38:22.255542166 +0200
@@ -607,7 +607,7 @@
 rm -f "$outpath/config.tests/.qmake.cache"
 cp "$QMAKE_VARS_FILE" "$outpath/config.tests/.qmake.cache"
 
-QMakeVar add styles "cde mac motif plastique cleanlooks windows"
+QMakeVar add styles "cde mac motif plastique cleanlooks windows windowsxp windowsvista"
 QMakeVar add decorations "default windows styled"
 QMakeVar add mouse-drivers "pc"
 if [ "$UNAME_SYSTEM" = "Linux" ] ; then
@@ -781,6 +781,7 @@
 l_FLAGS=
 QCONFIG_FLAGS=
 XPLATFORM=              # This seems to be the QMAKESPEC, like "linux-g++"
+XPLATFORM_MINGW=no      # Whether target platform is MinGW (win32-g++*)
 PLATFORM=$QMAKESPEC
 QT_CROSS_COMPILE=no
 OPT_CONFIRM_LICENSE=no
@@ -1324,7 +1325,9 @@
         fi
 	;;
     arch)
-        if [ "$PLATFORM_MAC" = "yes" ]; then
+        # if this is a Mac then "windows" probably means
+        # we are cross-compiling for MinGW
+        if [ "$PLATFORM_MAC" = "yes" ] && [ "$VAL" != "windows" ]; then
             CFG_MAC_ARCHS="$CFG_MAC_ARCHS $VAL"
         else
             CFG_ARCH=$VAL
@@ -1442,6 +1445,7 @@
         ;;
     xplatform)
         XPLATFORM="$VAL"
+        case `basename "$XPLATFORM"` in win32-g++*) XPLATFORM_MINGW=yes;; esac
         ;;
     debug-and-release)
         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
@@ -2584,6 +2588,8 @@
         #PLATFORM=solaris-g++
         PLATFORM=solaris-cc
         #PLATFORM=solaris-cc64
+        # But, since it's known to work, default to  g++ to target win32-g++
+        [ "$XPLATFORM_MINGW" = "yes" ] && PLATFORM="solaris-g++"
         PLATFORM_NOTES="
             - Also available for Solaris: solaris-g++ solaris-cc-64
         "
@@ -2653,6 +2659,9 @@
 fi
 
 [ -z "$XPLATFORM" ] && XPLATFORM="$PLATFORM"
+
+case `basename "$XPLATFORM"` in win32-g++*) XPLATFORM_MINGW=yes;; esac
+
 if [ -d "$PLATFORM" ]; then
   QMAKESPEC="$PLATFORM"
 else
@@ -2914,6 +2923,8 @@
         CFG_ARCH="$CFG_EMBEDDED"
         ;;
     esac
+elif [ "$XPLATFORM_MINGW" = "yes" ]; then
+    [ -z "$CFG_ARCH" ] && CFG_ARCH="windows"
 elif [ "$PLATFORM_MAC" = "yes" ] || [ -z "$CFG_ARCH" ]; then
     CFG_ARCH=$CFG_HOST_ARCH
 fi
@@ -4841,6 +4852,7 @@
                 if "$WHICH" pg_config >/dev/null 2>&1; then
                     QT_CFLAGS_PSQL=`pg_config --includedir 2>/dev/null`
                     QT_LFLAGS_PSQL=`pg_config --libdir 2>/dev/null`
+                    QT_LFLAGS_PSQL="$QT_LFLAGS_PSQL $PSQL_LIBS"
                 fi
                 [ -z "$QT_CFLAGS_PSQL" ] || QT_CFLAGS_PSQL="-I$QT_CFLAGS_PSQL"
                 [ -z "$QT_LFLAGS_PSQL" ] || QT_LFLAGS_PSQL="-L$QT_LFLAGS_PSQL"
@@ -4865,7 +4877,7 @@
         ;;
         odbc)
             if [ "$CFG_SQL_odbc" != "no" ]; then
-                if [ "$PLATFORM_MAC" != "yes" ] && "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/odbc "ODBC" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
+                if [ "$PLATFORM_MAC" != "yes" ] || [ "$XPLATFORM_MINGW" = "yes" ] && "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/odbc "ODBC" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
                     if [ "$CFG_SQL_odbc" = "auto" ]; then
                         CFG_SQL_odbc=plugin
                     fi
@@ -5202,7 +5214,10 @@
 
     # Auto-detect GStreamer support (needed for both Phonon & QtMultimedia)
     if [ "$CFG_PHONON" != "no" -o "$CFG_MEDIASERVICES" != "no" ]; then
-        if [ "$CFG_GLIB" = "yes" -a "$CFG_GSTREAMER" != "no" ]; then
+        if [ "$XPLATFORM_MINGW" = "yes" ]; then
+            echo "Will build Phonon for win32-g++"
+            CFG_PHONON=yes
+        elif [ "$CFG_GLIB" = "yes" -a "$CFG_GSTREAMER" != "no" ]; then
             if [ -n "$PKG_CONFIG" ]; then
                 QT_CFLAGS_GSTREAMER=`$PKG_CONFIG --cflags gstreamer-0.10 gstreamer-plugins-base-0.10 2>/dev/null`
                 QT_LIBS_GSTREAMER=`$PKG_CONFIG --libs gstreamer-0.10 gstreamer-plugins-base-0.10 2>/dev/null`
@@ -5320,8 +5335,9 @@
     fi
 
     # Check we actually have X11 :-)
-    "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xlib "XLib" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
-    if [ $? != "0" ]; then
+    if [ "$XPLATFORM_MINGW" = "yes" ]; then
+        echo "Skipping XLib test for win32-g++"
+    elif ! "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xlib "XLib" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
         echo "Basic XLib functionality test failed!"
         echo " You might need to modify the include and library search paths by editing"
         echo " QMAKE_INCDIR_X11 and QMAKE_LIBDIR_X11 in ${XQMAKESPEC}."
@@ -5510,6 +5526,8 @@
     fi
 
     # auto-detect FontConfig support
+    # not used on win32 even if present
+    [ "$XPLATFORM_MINGW" = "yes" ] && CFG_FONTCONFIG=no
     if [ "$CFG_FONTCONFIG" != "no" ]; then
     if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists fontconfig --exists freetype2 2>/dev/null; then
         QT_CFLAGS_FONTCONFIG=`$PKG_CONFIG --cflags fontconfig --cflags freetype2 2>/dev/null`
@@ -5835,6 +5853,8 @@
 # freetype support
 [ "x$CFG_EMBEDDED" != "xno" ] && CFG_LIBFREETYPE="$CFG_QWS_FREETYPE"
 [ "x$PLATFORM_MAC" = "xyes" ] && CFG_LIBFREETYPE=no
+# not used on win32 even if present
+[ "$XPLATFORM_MINGW" = "yes" ] && CFG_LIBFREETYPE=no
 if [ "$CFG_LIBFREETYPE" = "auto" ]; then
     if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/freetype "FreeType" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
         CFG_LIBFREETYPE=system
@@ -5844,7 +5864,9 @@
 fi
 
 if [ "$CFG_ENDIAN" = "auto" ]; then
-    if [ "$PLATFORM_MAC" = "yes" ]; then
+    if [ "$XPLATFORM_MINGW" = "yes" ]; then
+        CFG_ENDIAN="Q_LITTLE_ENDIAN"
+    elif [ "$PLATFORM_MAC" = "yes" ]; then
 	true #leave as auto
     elif [ "$XPLATFORM" = "symbian-sbsv2" ]; then
         CFG_ENDIAN="Q_LITTLE_ENDIAN"
@@ -6170,6 +6192,11 @@
     fi
 fi
 
+if [ "$CFG_LARGEFILE" != "yes" ] && [ "$XPLATFORM_MINGW" = "yes" ]; then
+    echo "Warning: largefile support cannot be disabled for win32."
+    CFG_LARGEFILE="yes"
+fi
+
 #-------------------------------------------------------------------------------
 # ask for all that hasn't been auto-detected or specified in the arguments
 #-------------------------------------------------------------------------------
@@ -6272,6 +6299,9 @@
     fi
 fi
 
+# but disable Cocoa if cross-building for mingw
+[ "$XPLATFORM_MINGW" = "yes" ] && CFG_MAC_COCOA="no"
+
 # set the global Mac deployment target. This is overridden on an arch-by-arch basis
 # in some cases, see code further down
 case "$PLATFORM,$CFG_MAC_COCOA" in
@@ -6410,7 +6440,7 @@
 QMakeVar set MOC_DIR ".moc/$QMAKE_OUTDIR"
 QMakeVar set RCC_DIR ".rcc/$QMAKE_OUTDIR"
 QMakeVar set UI_DIR ".uic/$QMAKE_OUTDIR"
-if [ "$CFG_LARGEFILE" = "yes" ]; then
+if [ "$CFG_LARGEFILE" = "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
     QMAKE_CONFIG="$QMAKE_CONFIG largefile"
 fi
 if [ "$CFG_STL" = "no" ]; then
@@ -6526,7 +6556,7 @@
 fi
 
 
-if [ "x$PLATFORM_MAC" = "xyes" ] && [ "$XPLATFORM" != "win32-g++" ]; then
+if [ "x$PLATFORM_MAC" = "xyes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
     #On Mac we implicitly link against libz, so we
     #never use the 3rdparty stuff.
     [ "$CFG_ZLIB" = "yes" ] && CFG_ZLIB="system"
@@ -6665,6 +6695,12 @@
     QTCONFIG_CONFIG="$QTCONFIG_CONFIG exceptions"
 fi
 
+if [ "$XPLATFORM_MINGW" = "yes" ]; then
+    # mkspecs/features/win32/default_pre.prf sets "no-rtti".
+    # Follow default behavior of configure.exe by overriding with "rtti".
+    QTCONFIG_CONFIG="$QTCONFIG_CONFIG rtti"
+fi
+
 if [ "$CFG_ALSA" = "yes" ]; then
     QT_CONFIG="$QT_CONFIG alsa"
 fi
@@ -7263,7 +7299,7 @@
 echo '/* Compile time features */' >>"$outpath/src/corelib/global/qconfig.h.new"
 [ '!' -z "$LicenseKeyExt" ] && echo "#define QT_PRODUCT_LICENSEKEY \"$LicenseKeyExt\"" >>"$outpath/src/corelib/global/qconfig.h.new"
 
-if [ "$CFG_LARGEFILE" = "yes" ]; then
+if [ "$CFG_LARGEFILE" = "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then
     echo "#define QT_LARGEFILE_SUPPORT 64" >>"$outpath/src/corelib/global/qconfig.h.new"
 fi
 
@@ -7600,7 +7636,7 @@
 EOF
 
 # Ensure we can link to uninistalled libraries
-if linkerSupportsFlag -rpath-link "$outpath/lib"; then
+if [ "$XPLATFORM_MINGW" != "yes" ] && linkerSupportsFlag -rpath-link "$outpath/lib"; then
     echo "QMAKE_LFLAGS    += -Wl,-rpath-link,\$\$QT_BUILD_TREE/lib" >> "$CACHEFILE.tmp"
 fi
 
@@ -8137,7 +8173,9 @@
         [ "$IN_ROOT" = "no" ] && continue
 
         case $a in
-        *winmain/winmain.pro) continue ;;
+        *winmain/winmain.pro)
+            [ "$XPLATFORM_MINGW" = "yes" ] || continue
+            SPEC=$XQMAKESPEC ;;
         *s60main/s60main.pro) continue ;;
         *examples/activeqt/*) continue ;;
         */qmake/qmake.pro) continue ;;
diff -Naur a/doc/doc.pri b/doc/doc.pri
--- a/doc/doc.pri	2010-05-04 02:43:14.000000000 +0200
+++ b/doc/doc.pri	2010-05-27 21:38:22.258562193 +0200
@@ -5,9 +5,9 @@
 DOCS_GENERATION_DEFINES =
 GENERATOR = $$QT_BUILD_TREE/bin/qhelpgenerator
 
-win32:!win32-g++ {
+win32:!win32-g++* {
     unixstyle = false
-} else :win32-g++:isEmpty(QMAKE_SH) {
+} else :win32-g++*:isEmpty(QMAKE_SH) {
     unixstyle = false
 } else {
     unixstyle = true
@@ -36,7 +36,7 @@
                     $$GENERATOR doc-build/html-qt_zh_CN/qt.qhp -o doc/qch/qt_zh_CN.qch \
                )
 
-win32-g++:isEmpty(QMAKE_SH) {
+win32-g++*:isEmpty(QMAKE_SH) {
 	QT_DOCUMENTATION = $$replace(QT_DOCUMENTATION, "/", "\\\\")
 	QT_ZH_CN_DOCUMENTATION = $$replace(QT_ZH_CN_DOCUMENTATION, "/", "\\\\")
 }
diff -Naur a/examples/activeqt/activeqt.pro b/examples/activeqt/activeqt.pro
--- a/examples/activeqt/activeqt.pro	2010-05-04 02:43:18.000000000 +0200
+++ b/examples/activeqt/activeqt.pro	2010-05-27 21:38:22.258562193 +0200
@@ -11,7 +11,7 @@
 
 # For now only the contain examples with mingw, for the others you need
 # an IDL compiler
-win32-g++|wince*:SUBDIRS = webbrowser
+win32-g++*|wince*:SUBDIRS = webbrowser
 
 # install
 target.path = $$[QT_INSTALL_EXAMPLES]/activeqt
diff -Naur a/mkspecs/win32-g++-cross/qmake.conf b/mkspecs/win32-g++-cross/qmake.conf
--- a/mkspecs/win32-g++-cross/qmake.conf	1970-01-01 01:00:00.000000000 +0100
+++ b/mkspecs/win32-g++-cross/qmake.conf	2010-05-27 21:38:22.258562193 +0200
@@ -0,0 +1,112 @@
+#
+# qmake configuration for win32-g++-cross
+#
+# Written for MinGW cross building on Unix
+#
+
+MAKEFILE_GENERATOR	= MINGW
+TEMPLATE		= app
+CONFIG			+= qt warn_on release link_prl copy_dir_files debug_and_release debug_and_release_target precompile_header
+QT			+= core gui
+DEFINES			+= UNICODE QT_LARGEFILE_SUPPORT
+QMAKE_COMPILER_DEFINES  += __GNUC__ WIN32
+
+QMAKE_EXT_OBJ           = .o
+QMAKE_EXT_RES           = _res.o
+
+QMAKE_CC		= i686-pc-mingw32-gcc
+QMAKE_LEX		= flex
+QMAKE_LEXFLAGS		=
+QMAKE_YACC		= byacc
+QMAKE_YACCFLAGS		= -d
+QMAKE_CFLAGS		= -pipe -isystem /usr/i686-pc-mingw32/include
+QMAKE_CFLAGS_DEPS	= -M
+QMAKE_CFLAGS_WARN_ON	= -Wall
+QMAKE_CFLAGS_WARN_OFF	= -w
+QMAKE_CFLAGS_RELEASE	= -O2
+QMAKE_CFLAGS_DEBUG	= -g
+QMAKE_CFLAGS_YACC	= -Wno-unused -Wno-parentheses
+
+QMAKE_CXX		= i686-pc-mingw32-g++
+QMAKE_CXXFLAGS		= $$QMAKE_CFLAGS
+QMAKE_CXXFLAGS_DEPS	= $$QMAKE_CFLAGS_DEPS
+QMAKE_CXXFLAGS_WARN_ON	= $$QMAKE_CFLAGS_WARN_ON
+QMAKE_CXXFLAGS_WARN_OFF	= $$QMAKE_CFLAGS_WARN_OFF
+QMAKE_CXXFLAGS_RELEASE	= $$QMAKE_CFLAGS_RELEASE
+QMAKE_CXXFLAGS_DEBUG	= $$QMAKE_CFLAGS_DEBUG
+QMAKE_CXXFLAGS_YACC	= $$QMAKE_CFLAGS_YACC
+QMAKE_CXXFLAGS_THREAD	= $$QMAKE_CFLAGS_THREAD
+QMAKE_CXXFLAGS_RTTI_ON	= -frtti
+QMAKE_CXXFLAGS_RTTI_OFF	= -fno-rtti
+QMAKE_CXXFLAGS_EXCEPTIONS_ON = -fexceptions -mthreads
+QMAKE_CXXFLAGS_EXCEPTIONS_OFF = -fno-exceptions
+
+QMAKE_INCDIR		=
+QMAKE_INCDIR_QT		= $$[QT_INSTALL_HEADERS]
+QMAKE_LIBDIR_QT		= $$[QT_INSTALL_LIBS]
+
+QMAKE_RUN_CC		= $(CC) -c $(CFLAGS) $(INCPATH) -o $obj $src
+QMAKE_RUN_CC_IMP	= $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+QMAKE_RUN_CXX		= $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $obj $src
+QMAKE_RUN_CXX_IMP	= $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+
+QMAKE_LINK		= i686-pc-mingw32-g++
+QMAKE_LINK_C		= i686-pc-mingw32-gcc
+QMAKE_LFLAGS		= -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc
+QMAKE_LFLAGS_EXCEPTIONS_ON = -mthreads -Wl
+QMAKE_LFLAGS_EXCEPTIONS_OFF =
+QMAKE_LFLAGS_RELEASE	= -Wl,-s
+QMAKE_LFLAGS_DEBUG	=
+QMAKE_LFLAGS_CONSOLE	= -Wl,-subsystem,console
+QMAKE_LFLAGS_WINDOWS	= -Wl,-subsystem,windows
+QMAKE_LFLAGS_DLL        = -shared
+QMAKE_LINK_OBJECT_MAX	= 10
+QMAKE_LINK_OBJECT_SCRIPT= object_script
+
+
+QMAKE_LIBS		=
+QMAKE_LIBS_CORE         = -lkernel32 -luser32 -lshell32 -luuid -lole32 -ladvapi32 -lws2_32
+QMAKE_LIBS_GUI          = -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lws2_32 -lole32 -luuid -luser32 -ladvapi32
+QMAKE_LIBS_NETWORK      = -lws2_32
+QMAKE_LIBS_OPENGL       = -lopengl32 -lglu32 -lgdi32 -luser32
+QMAKE_LIBS_COMPAT       = -ladvapi32 -lshell32 -lcomdlg32 -luser32 -lgdi32 -lws2_32
+QMAKE_LIBS_QT_ENTRY     = -lmingw32 -lqtmain
+
+QMAKE_SH		= bash
+
+!isEmpty(QMAKE_SH) {
+    MINGW_IN_SHELL      = 1
+	QMAKE_DIR_SEP		= /
+	QMAKE_COPY		= cp
+	QMAKE_COPY_DIR		= cp -r
+	QMAKE_MOVE		= mv
+	QMAKE_DEL_FILE		= rm -f
+	QMAKE_MKDIR		= mkdir -p
+	QMAKE_DEL_DIR		= rmdir
+	QMAKE_SYMBOLIC_LINK	= ln -s
+    QMAKE_CHK_DIR_EXISTS = test -d
+} else {
+	QMAKE_COPY		= copy /y
+	QMAKE_COPY_DIR		= xcopy /s /q /y /i
+	QMAKE_MOVE		= move
+	QMAKE_DEL_FILE		= del
+	QMAKE_MKDIR		= mkdir
+	QMAKE_DEL_DIR		= rmdir
+    QMAKE_CHK_DIR_EXISTS	= if not exist
+}
+
+#QMAKE_IDC		= i686-pc-mingw32-idc
+QMAKE_MOC		= i686-pc-mingw32-moc
+QMAKE_RCC		= i686-pc-mingw32-rcc
+QMAKE_UIC		= i686-pc-mingw32-uic
+
+#QMAKE_IDL		= midl
+QMAKE_AR		= i686-pc-mingw32-ar
+QMAKE_LIB		= i686-pc-mingw32-ar -ru
+QMAKE_RC		= i686-pc-mingw32-windres
+QMAKE_ZIP		= zip -r -9
+
+QMAKE_STRIP		= i686-pc-mingw32-strip
+QMAKE_STRIPFLAGS_LIB 	+= --strip-unneeded
+PKG_CONFIG		= i686-pc-mingw32-pkg-config
+load(qt_config)
diff -Naur a/mkspecs/win32-g++-cross/qplatformdefs.h b/mkspecs/win32-g++-cross/qplatformdefs.h
--- a/mkspecs/win32-g++-cross/qplatformdefs.h	1970-01-01 01:00:00.000000000 +0100
+++ b/mkspecs/win32-g++-cross/qplatformdefs.h	2010-05-27 21:38:22.258562193 +0200
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the qmake spec of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "../win32-g++/qplatformdefs.h"
diff -Naur a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp
--- a/qmake/generators/metamakefile.cpp	2010-05-04 02:43:18.000000000 +0200
+++ b/qmake/generators/metamakefile.cpp	2010-05-27 21:38:22.258562193 +0200
@@ -501,9 +501,18 @@
         *host_mode = Option::HOST_UNIX_MODE;
         *target_mode = Option::TARG_UNIX_MODE;
 #endif
-    } else if (gen == "MSVC.NET" || gen == "MINGW" || gen == "BMAKE") {
+    } else if (gen == "MSVC.NET" || gen == "BMAKE") {
         *host_mode = Option::HOST_WIN_MODE;
         *target_mode = Option::TARG_WIN_MODE;
+    } else if (gen == "MINGW") {
+#if defined(Q_OS_MAC)
+        *host_mode = Option::HOST_MACX_MODE;
+#elif defined(Q_OS_UNIX)
+        *host_mode = Option::HOST_UNIX_MODE;
+#else
+        *host_mode = Option::HOST_WIN_MODE;
+#endif
+        *target_mode = Option::TARG_WIN_MODE;
     } else if (gen == "PROJECTBUILDER" || gen == "XCODE") {
         *host_mode = Option::HOST_MACX_MODE;
         *target_mode = Option::TARG_MACX_MODE;
diff -Naur a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp
--- a/qmake/generators/win32/mingw_make.cpp	2010-05-04 02:43:18.000000000 +0200
+++ b/qmake/generators/win32/mingw_make.cpp	2010-05-27 21:38:22.258562193 +0200
@@ -371,7 +371,12 @@
 	    ar_script_file += "." + var("BUILD_NAME");
 	}
 	createArObjectScriptFile(ar_script_file, var("DEST_TARGET"), project->values("OBJECTS"));
-        objectsLinkLine = "ar -M < " + ar_script_file;
+        QString ar_cmd = "ar";
+        if (!var("QMAKE_AR").isEmpty()) {
+            //Use the specified ar command, but strip off options
+            ar_cmd = var("QMAKE_AR").section(" ", 0, 0);
+        }
+        objectsLinkLine = ar_cmd + " -M < " + ar_script_file;
     } else {
         QString ld_script_file = var("QMAKE_LINK_OBJECT_SCRIPT") + "." + var("TARGET");
 	if (!var("BUILD_NAME").isEmpty()) {
diff -Naur a/src/3rdparty/javascriptcore/WebKit.pri b/src/3rdparty/javascriptcore/WebKit.pri
--- a/src/3rdparty/javascriptcore/WebKit.pri	2010-05-04 02:43:22.000000000 +0200
+++ b/src/3rdparty/javascriptcore/WebKit.pri	2010-05-27 21:38:22.274561960 +0200
@@ -36,7 +36,7 @@
             win32-*|wince* {
                 CONFIG(debug, debug|release):build_pass: QTWEBKITLIBNAME = $${QTWEBKITLIBNAME}d
                 QTWEBKITLIBNAME = $${QTWEBKITLIBNAME}$${QT_MAJOR_VERSION}
-                win32-g++: LIBS += -l$$QTWEBKITLIBNAME
+                win32-g++*: LIBS += -l$$QTWEBKITLIBNAME
                 else: LIBS += $${QTWEBKITLIBNAME}.lib
             } else {
                 LIBS += -lQtWebKit
diff -Naur a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro
--- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro	2010-05-04 02:43:19.000000000 +0200
+++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro	2010-05-27 21:38:22.290562843 +0200
@@ -38,7 +38,7 @@
 }
 
 # Pick up 3rdparty libraries from INCLUDE/LIB just like with MSVC
-win32-g++ {
+win32-g++* {
     TMPPATH            = $$quote($$(INCLUDE))
     QMAKE_INCDIR_POST += $$split(TMPPATH,";")
     TMPPATH            = $$quote($$(LIB))
diff -Naur a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro
--- a/src/3rdparty/webkit/WebCore/WebCore.pro	2010-05-04 02:43:21.000000000 +0200
+++ b/src/3rdparty/webkit/WebCore/WebCore.pro	2010-05-27 21:38:22.294554998 +0200
@@ -100,7 +100,7 @@
 }
 
 # Pick up 3rdparty libraries from INCLUDE/LIB just like with MSVC
-win32-g++ {
+win32-g++* {
     TMPPATH            = $$quote($$(INCLUDE))
     QMAKE_INCDIR_POST += $$split(TMPPATH,";")
     TMPPATH            = $$quote($$(LIB))
@@ -2904,7 +2904,7 @@
     CONFIG += no_debug_info
 }
 
-!win32-g++:win32:contains(QMAKE_HOST.arch, x86_64):{
+!win32-g++*:win32:contains(QMAKE_HOST.arch, x86_64):{
     asm_compiler.commands = ml64 /c
     asm_compiler.commands +=  /Fo ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN}
     asm_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)}
diff -Naur a/src/3rdparty/webkit/WebKit/qt/Api/DerivedSources.pro b/src/3rdparty/webkit/WebKit/qt/Api/DerivedSources.pro
--- a/src/3rdparty/webkit/WebKit/qt/Api/DerivedSources.pro	2010-05-04 02:43:22.000000000 +0200
+++ b/src/3rdparty/webkit/WebKit/qt/Api/DerivedSources.pro	2010-05-27 21:38:22.302562912 +0200
@@ -12,7 +12,7 @@
 ESCAPE = ""
 win32-msvc*|symbian {
     ESCAPE = "^"
-} else:win32-g++:isEmpty(QMAKE_SH) {
+} else:win32-g++*:isEmpty(QMAKE_SH) {
     # MinGW's make will run makefile commands using sh, even if make
     #  was run from the Windows shell, if it finds sh in the path.
     ESCAPE = "^"
diff -Naur a/src/3rdparty/webkit/WebKit.pri b/src/3rdparty/webkit/WebKit.pri
--- a/src/3rdparty/webkit/WebKit.pri	2010-05-04 02:43:22.000000000 +0200
+++ b/src/3rdparty/webkit/WebKit.pri	2010-05-27 21:38:22.302562912 +0200
@@ -24,7 +24,7 @@
             win32-*|wince* {
                 CONFIG(debug, debug|release):build_pass: QTWEBKITLIBNAME = $${QTWEBKITLIBNAME}d
                 QTWEBKITLIBNAME = $${QTWEBKITLIBNAME}$${QT_MAJOR_VERSION}
-                win32-g++: LIBS += -l$$QTWEBKITLIBNAME
+                win32-g++*: LIBS += -l$$QTWEBKITLIBNAME
                 else: LIBS += $${QTWEBKITLIBNAME}.lib
             } else {
                 LIBS += -lQtWebKit
diff -Naur a/src/activeqt/container/container.pro b/src/activeqt/container/container.pro
--- a/src/activeqt/container/container.pro	2010-05-04 02:43:26.000000000 +0200
+++ b/src/activeqt/container/container.pro	2010-05-27 21:38:22.302562912 +0200
@@ -19,7 +19,7 @@
 
 LIBS    += -lole32 -loleaut32
 !wince*:LIBS    += -luser32 -lgdi32 -ladvapi32
-win32-g++:LIBS += -luuid
+win32-g++*:LIBS += -luuid
 
 HEADERS =   ../control/qaxaggregated.h \
             qaxbase.h \
diff -Naur a/src/activeqt/control/control.pro b/src/activeqt/control/control.pro
--- a/src/activeqt/control/control.pro	2010-05-04 02:43:26.000000000 +0200
+++ b/src/activeqt/control/control.pro	2010-05-27 21:38:22.302562912 +0200
@@ -18,11 +18,11 @@
 QTDIR_build:DESTDIR  = $$QT_BUILD_TREE\lib
 
 DEFINES	+= QAX_SERVER
-win32-g++:DEFINES += QT_NEEDS_QMAIN
+win32-g++*:DEFINES += QT_NEEDS_QMAIN
 win32-borland:DEFINES += QT_NEEDS_QMAIN
 
 LIBS    += -luser32 -lole32 -loleaut32 -lgdi32
-win32-g++:LIBS += -luuid
+win32-g++*:LIBS += -luuid
 
 HEADERS =   qaxaggregated.h \
             qaxbindable.h \
diff -Naur a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
--- a/src/corelib/tools/tools.pri	2010-05-04 02:43:25.000000000 +0200
+++ b/src/corelib/tools/tools.pri	2010-05-27 21:38:22.314563610 +0200
@@ -106,8 +106,8 @@
         ../3rdparty/zlib/uncompr.c \
         ../3rdparty/zlib/zutil.c
 } else:!contains(QT_CONFIG, no-zlib) {
-   unix:LIBS_PRIVATE += -lz
-#  win32:LIBS += libz.lib
+    unix|win32-g++*:LIBS_PRIVATE += -lz
+    win32:!win32-g++*:LIBS += zdll.lib
 }
 
 DEFINES += HB_EXPORT=Q_CORE_EXPORT
diff -Naur a/src/gui/image/image.pri b/src/gui/image/image.pri
--- a/src/gui/image/image.pri	2010-05-04 02:43:24.000000000 +0200
+++ b/src/gui/image/image.pri	2010-05-27 21:38:22.318555136 +0200
@@ -93,12 +93,12 @@
     SOURCES += image/qpnghandler.cpp
 
     contains(QT_CONFIG, system-png) {
-        unix:LIBS_PRIVATE  += -lpng
-        win32:LIBS += libpng.lib
+        unix|win32-g++*:LIBS_PRIVATE += -lpng
+        win32:!win32-g++*:LIBS += libpng.lib
     } else {
 	DEFINES *= QT_USE_BUNDLED_LIBPNG
         !isEqual(QT_ARCH, i386):!isEqual(QT_ARCH, x86_64):DEFINES += PNG_NO_ASSEMBLER_CODE
-        INCLUDEPATH  += ../3rdparty/libpng ../3rdparty/zlib
+        INCLUDEPATH += ../3rdparty/libpng
         SOURCES += ../3rdparty/libpng/png.c \
           ../3rdparty/libpng/pngerror.c \
           ../3rdparty/libpng/pngget.c \
@@ -115,6 +115,10 @@
           ../3rdparty/libpng/pngwtran.c \
           ../3rdparty/libpng/pngwutil.c
     }
+    contains(QT_CONFIG, system-zlib) {
+        unix|win32-g++*:LIBS_PRIVATE += -lz
+        win32:!win32-g++*:LIBS += zdll.lib
+    }
 } else {
     DEFINES *= QT_NO_IMAGEFORMAT_PNG
 }
diff -Naur a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri
--- a/src/gui/painting/painting.pri	2010-05-04 02:43:25.000000000 +0200
+++ b/src/gui/painting/painting.pri	2010-05-27 21:38:22.322562585 +0200
@@ -232,7 +232,7 @@
         IWMMXT_SOURCES += painting/qdrawhelper_iwmmxt.cpp
     }
 
-    win32-g++|!win32:!*-icc* {
+    win32-g++*|!win32:!*-icc* {
         mmx {
             mmx_compiler.commands = $$QMAKE_CXX -c -Winline
 
@@ -401,9 +401,9 @@
 }
 
 contains(QT_CONFIG, zlib) {
-   INCLUDEPATH += ../3rdparty/zlib
+    INCLUDEPATH += ../3rdparty/zlib
 } else:!contains(QT_CONFIG, no-zlib) {
-   unix:LIBS_PRIVATE += -lz
-#  win32:LIBS += libz.lib
+    unix|win32-g++*:LIBS_PRIVATE += -lz
+    win32:!win32-g++*:LIBS += zdll.lib
 }
 
diff -Naur a/src/network/access/access.pri b/src/network/access/access.pri
--- a/src/network/access/access.pri	2010-05-04 02:43:25.000000000 +0200
+++ b/src/network/access/access.pri	2010-05-27 21:38:22.322562585 +0200
@@ -59,8 +59,8 @@
 
 #zlib support
 contains(QT_CONFIG, zlib) {
-   INCLUDEPATH += ../3rdparty/zlib
+    INCLUDEPATH += ../3rdparty/zlib
 } else:!contains(QT_CONFIG, no-zlib) {
-   unix:LIBS_PRIVATE += -lz
-#  win32:LIBS += libz.lib
+    unix|win32-g++*:LIBS_PRIVATE += -lz
+    win32:!win32-g++*:LIBS += zdll.lib
 }
diff -Naur a/src/network/ssl/ssl.pri b/src/network/ssl/ssl.pri
--- a/src/network/ssl/ssl.pri	2010-05-04 02:43:25.000000000 +0200
+++ b/src/network/ssl/ssl.pri	2010-05-27 21:38:22.322562585 +0200
@@ -34,6 +34,7 @@
     # Include Qt's default CA bundle
     RESOURCES += network.qrc
 
-    # Add optional SSL libs
+    # Add optional SSL libs, but not accidently system zlib
+    !contains(QT_CONFIG, system-zlib):OPENSSL_LIBS -= -lz
     LIBS_PRIVATE += $$OPENSSL_LIBS
 }
diff -Naur a/src/plugins/imageformats/jpeg/jpeg.pro b/src/plugins/imageformats/jpeg/jpeg.pro
--- a/src/plugins/imageformats/jpeg/jpeg.pro	2010-05-04 02:43:25.000000000 +0200
+++ b/src/plugins/imageformats/jpeg/jpeg.pro	2010-05-27 21:38:22.322562585 +0200
@@ -22,8 +22,8 @@
 }
 
 contains(QT_CONFIG, system-jpeg) {
-        unix:LIBS += -ljpeg
-        win32:LIBS += libjpeg.lib
+        unix|win32-g++*:LIBS += -ljpeg
+        win32:!win32-g++*:LIBS += libjpeg.lib
 }
 !contains(QT_CONFIG, system-jpeg) {
 	INCLUDEPATH += ../../../3rdparty/libjpeg
diff -Naur a/src/plugins/imageformats/mng/mng.pro b/src/plugins/imageformats/mng/mng.pro
--- a/src/plugins/imageformats/mng/mng.pro	2010-05-04 02:43:25.000000000 +0200
+++ b/src/plugins/imageformats/mng/mng.pro	2010-05-27 21:38:22.322562585 +0200
@@ -14,8 +14,8 @@
 }
 
 contains(QT_CONFIG, system-mng) {
-        unix:LIBS += -lmng
-        win32:LIBS += libmng.lib
+        unix|win32-g++*:LIBS += -lmng
+        win32:!win32-g++*:LIBS += libmng.lib
 }
 !contains(QT_CONFIG, system-mng) {
         DEFINES += MNG_BUILD_SO
@@ -44,10 +44,11 @@
 }
 
 contains(QT_CONFIG, system-zlib) {
-        LIBS += -lz
+    unix|win32-g++*:LIBS_PRIVATE += -lz
+    win32:!win32-g++*:LIBS += zdll.lib
 }
 !contains(QT_CONFIG, system-zlib) {
-        INCLUDEPATH +=  ../../../3rdparty/zlib
+    INCLUDEPATH +=  ../../../3rdparty/zlib
 }
 
 QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/imageformats
diff -Naur a/src/plugins/imageformats/tiff/tiff.pro b/src/plugins/imageformats/tiff/tiff.pro
--- a/src/plugins/imageformats/tiff/tiff.pro	2010-05-04 02:43:25.000000000 +0200
+++ b/src/plugins/imageformats/tiff/tiff.pro	2010-05-27 21:38:22.322562585 +0200
@@ -8,8 +8,13 @@
            qtiffhandler.cpp
 
 contains(QT_CONFIG, system-tiff) {
-        unix:LIBS += -ltiff
-        win32:LIBS += libtiff.lib
+        unix|win32-g++*:LIBS += -ltiff
+        win32:!win32-g++*:LIBS += libtiff.lib
+
+        contains(QT_CONFIG, system-jpeg) {
+                unix|win32-g++*:LIBS += -ljpeg
+                win32:!win32-g++*:LIBS += libjpeg.lib
+        }
 }
 !contains(QT_CONFIG, system-tiff) {
 	INCLUDEPATH += ../../../3rdparty/libtiff/libtiff
@@ -64,10 +69,11 @@
 }
 
 contains(QT_CONFIG, system-zlib) {
-        LIBS += -lz
+    unix|win32-g++*:LIBS_PRIVATE += -lz
+    win32:!win32-g++*:LIBS += zdll.lib
 }
 !contains(QT_CONFIG, system-zlib) {
-        INCLUDEPATH +=  ../../../3rdparty/zlib
+    INCLUDEPATH +=  ../../../3rdparty/zlib
 }
 
 QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/imageformats
diff -Naur a/src/plugins/sqldrivers/psql/psql.pro b/src/plugins/sqldrivers/psql/psql.pro
--- a/src/plugins/sqldrivers/psql/psql.pro	2010-05-04 02:43:25.000000000 +0200
+++ b/src/plugins/sqldrivers/psql/psql.pro	2010-05-27 21:38:22.322562585 +0200
@@ -4,7 +4,7 @@
 SOURCES		= main.cpp \
 		  ../../../sql/drivers/psql/qsql_psql.cpp
 
-unix|win32-g++: {
+unix|win32-g++*: {
     !isEmpty(QT_LFLAGS_PSQL) {
         !contains(QT_CONFIG, system-zlib): QT_LFLAGS_PSQL -= -lz
         !static:LIBS *= $$QT_LFLAGS_PSQL
@@ -13,6 +13,6 @@
     !contains(LIBS, .*pq.*):LIBS *= -lpq
 }
 
-win32:!win32-g++:!contains(LIBS, .*pq.* ) LIBS *= -llibpq -lws2_32 -ladvapi32
+win32:!win32-g++*:!contains(LIBS, .*pq.* ) LIBS *= -llibpq -lws2_32 -ladvapi32
 
 include(../qsqldriverbase.pri)
diff -Naur a/src/plugins/sqldrivers/tds/main.cpp b/src/plugins/sqldrivers/tds/main.cpp
--- a/src/plugins/sqldrivers/tds/main.cpp	2010-05-04 02:43:25.000000000 +0200
+++ b/src/plugins/sqldrivers/tds/main.cpp	2010-05-27 21:38:22.322562585 +0200
@@ -47,6 +47,7 @@
 #define _WINSCARD_H_
 #include <windows.h>
 #endif
+#define Q_USE_SYBASE
 #include "../../../sql/drivers/tds/qsql_tds.h"
 
 QT_BEGIN_NAMESPACE
diff -Naur a/src/plugins/sqldrivers/tds/tds.pro b/src/plugins/sqldrivers/tds/tds.pro
--- a/src/plugins/sqldrivers/tds/tds.pro	2010-05-04 02:43:25.000000000 +0200
+++ b/src/plugins/sqldrivers/tds/tds.pro	2010-05-27 21:38:22.322562585 +0200
@@ -6,8 +6,9 @@
 		  ../../../sql/drivers/tds/qsql_tds.cpp
 
 unix:!contains( LIBS, .*sybdb.* ):LIBS 	*= -lsybdb
+win32-g++*:LIBS *=  -lsybdb -liconv -lws2_32
 
-win32 {
+win32:!win32-g++* {
     !win32-borland:LIBS *= -lNTWDBLIB
     win32-borland:LIBS 	*= $(BCB)/lib/PSDK/NTWDBLIB.LIB
 }
diff -Naur a/src/qbase.pri b/src/qbase.pri
--- a/src/qbase.pri	2010-05-04 02:43:26.000000000 +0200
+++ b/src/qbase.pri	2010-05-27 21:38:22.322562585 +0200
@@ -85,7 +85,6 @@
 }
 
 win32 {
-    CONFIG += zlib
     INCLUDEPATH += tmp
     !static: DEFINES+=QT_MAKEDLL
 }
diff -Naur a/src/sql/drivers/drivers.pri b/src/sql/drivers/drivers.pri
--- a/src/sql/drivers/drivers.pri	2010-05-04 02:43:24.000000000 +0200
+++ b/src/sql/drivers/drivers.pri	2010-05-27 21:38:22.326563679 +0200
@@ -6,7 +6,7 @@
     HEADERS +=      drivers/psql/qsql_psql.h
     SOURCES +=      drivers/psql/qsql_psql.cpp
 
-    unix|win32-g++ {
+    unix|win32-g++* {
         !static:!isEmpty(QT_LFLAGS_PSQL) {
             !contains(QT_CONFIG, system-zlib): QT_LFLAGS_PSQL -= -lz
             !static:LIBS *= $$QT_LFLAGS_PSQL
@@ -15,7 +15,7 @@
         !contains(LIBS, .*pq.*):LIBS *= -lpq
     }
 
-    win32:!win32-g++:!contains(LIBS, .*pq.* ) LIBS *= -llibpq -lws2_32 -ladvapi32
+    win32:!win32-g++*:!contains(LIBS, .*pq.* ) LIBS *= -llibpq -lws2_32 -ladvapi32
 }
 
 contains(sql-drivers, mysql) {
@@ -35,8 +35,8 @@
     }
 
     win32:!contains(LIBS, .*mysql.*):!contains(LIBS, .*mysqld.*) {
-        !win32-g++:LIBS     *= -llibmysql    
-	win32-g++:LIBS	    *= -lmysql
+        !win32-g++*:LIBS     *= -llibmysql    
+	win32-g++*:LIBS	    *= -lmysql
     }    
 }
 
diff -Naur a/src/sql/drivers/tds/qsql_tds.cpp b/src/sql/drivers/tds/qsql_tds.cpp
--- a/src/sql/drivers/tds/qsql_tds.cpp	2010-05-04 02:43:24.000000000 +0200
+++ b/src/sql/drivers/tds/qsql_tds.cpp	2010-05-27 21:38:22.326563679 +0200
@@ -47,7 +47,8 @@
 #else
 #define Q_USE_SYBASE
 #endif
-
+//Force SYBASE because we use FreeTDS
+#define Q_USE_SYBASE
 #include "qsql_tds.h"
 
 #include <qvariant.h>
diff -Naur a/src/sql/drivers/tds/qsql_tds.h b/src/sql/drivers/tds/qsql_tds.h
--- a/src/sql/drivers/tds/qsql_tds.h	2010-05-04 02:43:24.000000000 +0200
+++ b/src/sql/drivers/tds/qsql_tds.h	2010-05-27 21:38:22.326563679 +0200
@@ -48,7 +48,8 @@
 
 #ifdef Q_OS_WIN32
 #define WIN32_LEAN_AND_MEAN
-#define DBNTWIN32 // indicates 32bit windows dblib
+//#define DBNTWIN32 // indicates 32bit windows dblib
+#include <winsock2.h>
 #include <QtCore/qt_windows.h>
 #include <sqlfront.h>
 #include <sqldb.h>
diff -Naur a/src/svg/svg.pro b/src/svg/svg.pro
--- a/src/svg/svg.pro	2010-05-04 02:43:25.000000000 +0200
+++ b/src/svg/svg.pro	2010-05-27 21:38:22.326563679 +0200
@@ -44,7 +44,8 @@
 
 #zlib support
 contains(QT_CONFIG, zlib) {
-   INCLUDEPATH += ../3rdparty/zlib
+    INCLUDEPATH += ../3rdparty/zlib
 } else:!contains(QT_CONFIG, no-zlib) {
-   unix:LIBS_PRIVATE += -lz
+    unix|win32-g++*:LIBS_PRIVATE += -lz
+    win32:!win32-g++*:LIBS += zdll.lib
 }
diff -Naur a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro
--- a/src/tools/bootstrap/bootstrap.pro	2010-05-04 02:43:25.000000000 +0200
+++ b/src/tools/bootstrap/bootstrap.pro	2010-05-27 21:38:22.326563679 +0200
@@ -109,6 +109,9 @@
         ../3rdparty/zlib/trees.c \
         ../3rdparty/zlib/uncompr.c \
         ../3rdparty/zlib/zutil.c
+} else:!contains(QT_CONFIG, no-zlib) {
+    unix|win32-g++*:LIBS_PRIVATE += -lz
+    win32:!win32-g++*:LIBS += zdll.lib
 }
 
 lib.CONFIG = dummy_install
diff -Naur a/src/winmain/winmain.pro b/src/winmain/winmain.pro
--- a/src/winmain/winmain.pro	2010-05-04 02:43:25.000000000 +0200
+++ b/src/winmain/winmain.pro	2010-05-27 21:38:22.326563679 +0200
@@ -8,10 +8,10 @@
 CONFIG	-= qt shared
 
 win32 {
-	win32-g++:DEFINES += QT_NEEDS_QMAIN
+	win32-g++*:DEFINES += QT_NEEDS_QMAIN
 	win32-borland:DEFINES += QT_NEEDS_QMAIN
 	SOURCES		= qtmain_win.cpp
-	CONFIG		+= png zlib
+	CONFIG		+= png
 	CONFIG		-= jpeg
 	INCLUDEPATH	+= tmp $$QMAKE_INCDIR_QT/QtCore
 }
diff -Naur a/tools/activeqt/testcon/testcon.pro b/tools/activeqt/testcon/testcon.pro
--- a/tools/activeqt/testcon/testcon.pro	2010-05-04 02:43:18.000000000 +0200
+++ b/tools/activeqt/testcon/testcon.pro	2010-05-27 21:38:22.330555204 +0200
@@ -16,6 +16,6 @@
 win32-borland {
     QMAKE_POST_LINK = -midl $$QT_SOURCE_TREE/tools/activeqt/testcon/testcon.idl
 } else {
-    !win32-g++:QMAKE_POST_LINK = midl $$QT_SOURCE_TREE/tools/activeqt/testcon/testcon.idl && move testcon.tlb $(TARGETDIR)
+    !win32-g++*:QMAKE_POST_LINK = midl $$QT_SOURCE_TREE/tools/activeqt/testcon/testcon.idl && move testcon.tlb $(TARGETDIR)
 
 }
diff -Naur a/tools/assistant/lib/fulltextsearch/fulltextsearch.pro b/tools/assistant/lib/fulltextsearch/fulltextsearch.pro
--- a/tools/assistant/lib/fulltextsearch/fulltextsearch.pro	2010-05-04 02:43:17.000000000 +0200
+++ b/tools/assistant/lib/fulltextsearch/fulltextsearch.pro	2010-05-27 21:38:22.330555204 +0200
@@ -29,7 +29,7 @@
 CONFIG(exceptions_off) {
     CONFIG -= exceptions_off
     CONFIG += exceptions
-    !win32|win32-g++ {
+    !win32|win32-g++* {
         QMAKE_CFLAGS -= -fno-exceptions
         QMAKE_CXXFLAGS -= -fno-exceptions
         QMAKE_LFLAGS -= -fno-exceptions
diff -Naur a/tools/configure/configure.pro b/tools/configure/configure.pro
--- a/tools/configure/configure.pro	2010-05-04 02:43:18.000000000 +0200
+++ b/tools/configure/configure.pro	2010-05-27 21:38:22.330555204 +0200
@@ -8,7 +8,7 @@
 
 win32 : LIBS += -lole32 -ladvapi32
 win32-msvc.net | win32-msvc2* : QMAKE_CXXFLAGS += /EHsc
-win32-g++ : LIBS += -luuid
+win32-g++* : LIBS += -luuid
 
 win32-msvc* {
     QMAKE_CFLAGS_RELEASE -= -MD
diff -Naur a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro
--- a/tools/qdoc3/qdoc3.pro	2010-05-04 02:43:17.000000000 +0200
+++ b/tools/qdoc3/qdoc3.pro	2010-05-27 21:38:22.330555204 +0200
@@ -115,9 +115,9 @@
 
 ### Documentation for qdoc3 ###
 
-win32:!win32-g++ {
+win32:!win32-g++* {
     unixstyle = false
-} else :win32-g++:isEmpty(QMAKE_SH) {
+} else :win32-g++*:isEmpty(QMAKE_SH) {
     unixstyle = false
 } else {
     unixstyle = true
diff -Naur a/tools/qvfb/qvfb.pro b/tools/qvfb/qvfb.pro
--- a/tools/qvfb/qvfb.pro	2010-05-04 02:43:18.000000000 +0200
+++ b/tools/qvfb/qvfb.pro	2010-05-27 21:38:22.330555204 +0200
@@ -42,12 +42,14 @@
 }
 
 contains(QT_CONFIG, system-png) {
-	LIBS += -lpng
+    unix|win32-g++*:LIBS_PRIVATE += -lpng
+    win32:!win32-g++*:LIBS += libpng.lib
 } else {
 	INCLUDEPATH     += $$QT_SOURCE_TREE/src/3rdparty/libpng
 }
 contains(QT_CONFIG, system-zlib) {
-	LIBS += -lz
+    unix|win32-g++*:LIBS_PRIVATE += -lz
+    win32:!win32-g++*:LIBS += zdll.lib
 } else {
 	INCLUDEPATH     += $$QT_SOURCE_TREE/src/3rdparty/zlib
 }