summaryrefslogtreecommitdiffstats
path: root/src/qt-win32.patch
blob: b1ae8721930b7325fa2f56dd55fa671d6d759e7f (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
Copyright (C) 2009  Mark Brand
                    Volker Grabsch
                    Martin Lambers

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject
to the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

diff --git a/configure b/configure
index 146ba82..d521e2c 100755
--- a/configure
+++ b/configure
@@ -591,7 +591,7 @@ mkdir -p "$outpath/config.tests"
 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
@@ -717,6 +717,7 @@ CFG_MMX=auto
 CFG_3DNOW=auto
 CFG_SSE=auto
 CFG_SSE2=auto
+CFG_RTTI=auto
 CFG_REDUCE_RELOCATIONS=no
 CFG_IPV6=auto
 CFG_NAS=no
@@ -4424,7 +4425,10 @@ fi # Build qmake
 #-------------------------------------------------------------------------------
 
 # detect availability of float math.h functions
-if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/floatmath "floatmath" $L_FLAGS $I_FLAGS $l_FLAGS; then
+if [ "$XPLATFORM" = "win32-g++" ]; then
+    echo "Using FLOATMATH for win32-g++ target"
+    CFG_USE_FLOATMATH=yes
+elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/floatmath "floatmath" $L_FLAGS $I_FLAGS $l_FLAGS; then
     CFG_USE_FLOATMATH=yes
 else
     CFG_USE_FLOATMATH=no
@@ -4432,7 +4436,10 @@ fi
 
 # detect mmx support
 if [ "${CFG_MMX}" = "auto" ]; then
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mmx "mmx" $L_FLAGS $I_FLAGS $l_FLAGS "-mmmx"; then
+    if [ "$XPLATFORM" = "win32-g++" ]; then
+      echo "Using MMX for win32-g++ target"
+      CFG_MMX=yes
+    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/mmx "mmx" $L_FLAGS $I_FLAGS $l_FLAGS "-mmmx"; then
 	CFG_MMX=yes
     else
 	CFG_MMX=no
@@ -4441,7 +4448,10 @@ fi
 
 # detect 3dnow support
 if [ "${CFG_3DNOW}" = "auto" ]; then
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/3dnow "3dnow" $L_FLAGS $I_FLAGS $l_FLAGS "-m3dnow"; then
+    if [ "$XPLATFORM" = "win32-g++" ]; then
+        echo "Using SSE for win32-g++ target"
+        CFG_3DNOW=yes
+    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/3dnow "3dnow" $L_FLAGS $I_FLAGS $l_FLAGS "-m3dnow"; then
 	CFG_3DNOW=yes
     else
 	CFG_3DNOW=no
@@ -4450,7 +4460,10 @@ fi
 
 # detect sse support
 if [ "${CFG_SSE}" = "auto" ]; then
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse "sse" $L_FLAGS $I_FLAGS $l_FLAGS "-msse"; then
+    if [ "$XPLATFORM" = "win32-g++" ]; then
+        echo "Using SSE for win32-g++ target"
+        CFG_SSE=yes
+    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse "sse" $L_FLAGS $I_FLAGS $l_FLAGS "-msse"; then
 	CFG_SSE=yes
     else
 	CFG_SSE=no
@@ -4459,13 +4472,26 @@ fi
 
 # detect sse2 support
 if [ "${CFG_SSE2}" = "auto" ]; then
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse2 "sse2" $L_FLAGS $I_FLAGS $l_FLAGS "-msse2"; then
+    if [ "$XPLATFORM" = "win32-g++" ]; then
+      echo "Using SSE2 for win32-g++ target"
+      CFG_SSE2=yes
+    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sse2 "sse2" $L_FLAGS $I_FLAGS $l_FLAGS "-msse2"; then
        CFG_SSE2=yes
     else
        CFG_SSE2=no
     fi
 fi
 
+# detect rtti support
+if [ "${CFG_RTTI}" = "auto" ]; then
+    if [ "$XPLATFORM" = "win32-g++" ]; then
+      echo "Using RTTI for win32-g++ target"
+      CFG_RTTI=yes
+    else
+      CFG_RTTI=no
+    fi
+fi
+
 # check iWMMXt support
 if [ "$CFG_IWMMXT" = "yes" ]; then
     "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/iwmmxt "iwmmxt" $L_FLAGS $I_FLAGS $l_FLAGS "-mcpu=iwmmxt"
@@ -4491,7 +4517,10 @@ if [ "$CFG_ZLIB" = "no" ]; then
     ZLIB_FORCED=yes
 fi
 if [ "$CFG_ZLIB" = "auto" ]; then
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/zlib "zlib" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
+    if [ "$XPLATFORM" = "win32-g++" ]; then
+       echo "We cannot test for system ZLIB since we are cross building for win32-g++, so we assume it is there."
+       CFG_ZLIB=system
+    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/zlib "zlib" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
        CFG_ZLIB=system
     else
        CFG_ZLIB=yes
@@ -4508,7 +4537,10 @@ if [ "$CFG_JPEG" = "auto" ]; then
 fi
 # detect jpeg
 if [ "$CFG_LIBJPEG" = "auto" ]; then
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libjpeg "libjpeg" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
+    if [ "$XPLATFORM" = "win32-g++" ]; then
+       echo "We cannot test for system LIBJPEG since we are cross building for win32-g++, so we assume it is there."
+       CFG_LIBJPEG=system
+    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libjpeg "libjpeg" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
        CFG_LIBJPEG=system
     else
        CFG_LIBJPEG=qt
@@ -4535,7 +4567,10 @@ fi
 
 # detect tiff
 if [ "$CFG_LIBTIFF" = "auto" ]; then
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libtiff "libtiff" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
+    if [ "$XPLATFORM" = "win32-g++" ]; then
+        echo "We cannot test for system LIBTIFF since we are cross building for win32-g++, so we assume it is there."
+        CFG_LIBTIFF=system
+    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libtiff "libtiff" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
         CFG_LIBTIFF=system
     else
         CFG_LIBTIFF=qt
@@ -4552,7 +4587,10 @@ if [ "$CFG_MNG" = "auto" ]; then
 fi
 # detect mng
 if [ "$CFG_LIBMNG" = "auto" ]; then
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libmng "libmng" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
+    if [ "$XPLATFORM" = "win32-g++" ]; then
+       echo "We cannot test for system LIBMNG since we are cross building for win32-g++, so we assume it is there."
+       CFG_LIBMNG=system
+    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libmng "libmng" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
        CFG_LIBMNG=system
     else
        CFG_LIBMNG=qt
@@ -4561,7 +4599,10 @@ fi
 
 # detect png
 if [ "$CFG_LIBPNG" = "auto" ]; then
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libpng "libpng" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
+    if [ "$XPLATFORM" = "win32-g++" ]; then
+       echo "We cannot test for system LIBPNG since we are cross building for win32-g++, so we assume it is there."
+       CFG_LIBPNG=system
+    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/libpng "libpng" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
        CFG_LIBPNG=system
     else
        CFG_LIBPNG=qt
@@ -4628,7 +4669,11 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do
             fi
             ;;
         psql)
-            if [ "$CFG_SQL_psql" != "no" ]; then
+            if [ "$XPLATFORM" = "win32-g++" ]; then
+                echo "We cannot test for PostgreSQL support since we are cross building for win32-g++, so we assume it is there."
+                CFG_SQL_psql=plugin
+                QT_LFLAGS_PSQL="-lpq -lsecur32 `$PKG_CONFIG --libs openssl`"
+            elif [ "$CFG_SQL_psql" != "no" ]; then
                 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`
@@ -4656,7 +4701,10 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do
         ;;
         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 [ "$XPLATFORM" = "win32-g++" ]; then
+                    echo "We cannot test for ODBC support since we are cross building for win32-g++, so we assume it is there."
+                    CFG_SQL_odbc=plugin
+                elif [ "$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 [ "$CFG_SQL_odbc" = "auto" ]; then
                         CFG_SQL_odbc=plugin
                     fi
@@ -4701,7 +4749,12 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do
             ;;
         tds)
             if [ "$CFG_SQL_tds" != "no" ]; then
-                if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/tds "TDS" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
+                if [ "$XPLATFORM" = "win32-g++" ]; then
+                    echo "We cannot test for TDS since we are cross building for win32-g++, so we assume it is there."
+                    if [ "CFG_SQL_tds" = "auto" ]; then
+                        CFG_SQL_tds=plugin
+                    fi
+                elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/tds "TDS" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
                     if [ "$CFG_SQL_tds" = "auto" ]; then
                         CFG_SQL_tds=plugin
                     fi
@@ -4783,7 +4836,13 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do
                         QT_CFLAGS_SQLITE=`$PKG_CONFIG --cflags sqlite3 2>/dev/null`
                         QT_LFLAGS_SQLITE=`$PKG_CONFIG --libs sqlite3 2>/dev/null`
                     fi
-                    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sqlite "SQLite" $QT_LFLAGS_SQLITE $L_FLAGS $QT_CFLAGS_SQLITE $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
+                    if [ "$XPLATFORM" = "win32-g++" ]; then
+                        echo "We cannot test for system sqlite since we are cross building for win32-g++, so we assume it is there."
+                        if [ "$CFG_SQL_sqlite" = "auto" ]; then
+                            CFG_SQL_sqlite=plugin
+                        fi
+                        QMAKE_CONFIG="$QMAKE_CONFIG system-sqlite"
+                    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/sqlite "SQLite" $QT_LFLAGS_SQLITE $L_FLAGS $QT_CFLAGS_SQLITE $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
                         if [ "$CFG_SQL_sqlite" = "auto" ]; then
                             CFG_SQL_sqlite=plugin
                         fi
@@ -4854,7 +4913,9 @@ fi
 
 # auto-detect iconv(3) support
 if [ "$CFG_ICONV" != "no" ]; then
-    if [ "$PLATFORM_QWS" = "yes" ]; then
+    if [ "$XPLATFORM" = "win32-g++" ]; then
+        CFG_ICONV=no
+    elif [ "$PLATFORM_QWS" = "yes" ]; then
 	CFG_ICONV=no
     elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" "$OPT_VERBOSE" "$relpath" "$outpath" "config.tests/unix/iconv" "POSIX iconv" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
         CFG_ICONV=yes
@@ -5014,7 +5075,9 @@ if [ "$PLATFORM_X11" = "yes" ]; 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}."
-        exit 1
+echo NOTICE: This is a specially modifed configure script!
+echo For our purposes we do not want X11.
+#        exit 1
     fi
 
     # auto-detect OpenGL support (es1 = OpenGL ES 1.x Common, es1cl = ES 1.x common lite, es2 = OpenGL ES 2.x)
@@ -5088,7 +5151,9 @@ if [ "$PLATFORM_X11" = "yes" ]; then
             echo " You might need to modify the include and library search paths by editing"
             echo " QMAKE_INCDIR_OPENGL, QMAKE_LIBDIR_OPENGL and QMAKE_LIBS_OPENGL in"
             echo " ${XQMAKESPEC}."
-            exit 1
+echo NOTICE: This is a specially modifed configure script!
+echo For our purposes we do not want the OpenGL functionality test.
+#            exit 1
         fi
         case "$PLATFORM" in
         hpux*)
@@ -5589,7 +5654,10 @@ if [ "$CFG_DOUBLEFORMAT" = "auto" ]; then
 fi
 
 HAVE_STL=no
-if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/stl "STL" $L_FLAGS $I_FLAGS $l_FLAGS; then
+if [ "$XPLATFORM" = "win32-g++" ]; then
+    echo "Using STL for win32-g++ target"
+    HAVE_STL=yes
+elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/stl "STL" $L_FLAGS $I_FLAGS $l_FLAGS; then
     HAVE_STL=yes
 fi
 
@@ -5611,7 +5679,10 @@ fi
 
 # find if the platform supports IPv6
 if [ "$CFG_IPV6" != "no" ]; then
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ipv6 "IPv6" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
+    if [ "$XPLATFORM" = "win32-g++" ]; then
+        echo "Using IPV6 for win32-g++ target"
+        CFG_IPV6=yes
+    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/ipv6 "IPv6" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
         CFG_IPV6=yes
     else
         if [ "$CFG_IPV6" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
@@ -5725,7 +5796,10 @@ fi
 
 # find if the platform supports X/Open Large File compilation environment
 if [ "$CFG_LARGEFILE" != "no" ]; then
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/largefile "X/Open Large File" $L_FLAGS $I_FLAGS $l_FLAGS; then
+    if [ "$XPLATFORM" = "win32-g++" ]; then
+        echo "Using LARGEFILE for win32-g++ target"
+        CFG_LARGEFILE=yes
+    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/largefile "X/Open Large File" $L_FLAGS $I_FLAGS $l_FLAGS; then
         CFG_LARGEFILE=yes
     else
         if [ "$CFG_LARGEFILE" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
@@ -5742,7 +5816,9 @@ fi
 
 # detect OpenSSL
 if [ "$CFG_OPENSSL" != "no" ]; then
-    if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/openssl "OpenSSL" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
+    if [ "$XPLATFORM" = "win32-g++" ]; then
+        echo "We cannot test for system CFG_OPENSSL since we are cross building for win32-g++, so we assume it is there."
+    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/openssl "OpenSSL" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
         if [ "$CFG_OPENSSL" = "auto" ]; then
             CFG_OPENSSL=yes
         fi
@@ -6087,6 +6163,7 @@ fi
 [ "$CFG_3DNOW" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG 3dnow"
 [ "$CFG_SSE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse"
 [ "$CFG_SSE2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse2"
+[ "$CFG_RTTI" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG rtti"
 [ "$CFG_IWMMXT" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG iwmmxt"
 [ "$PLATFORM_MAC" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG $CFG_MAC_ARCHS"
 if [ "$CFG_IPV6" = "yes" ]; then
@@ -6167,11 +6244,12 @@ else
     QT_CONFIG="$QT_CONFIG freetype"
 fi
 
-if [ "x$PLATFORM_MAC" = "xyes" ]; then
-    #On Mac we implicitly link against libz, so we
-    #never use the 3rdparty stuff.
-    [ "$CFG_ZLIB" = "yes" ] && CFG_ZLIB="system"
-fi
+# We're cross compiling, so we respect the user setting.
+#if [ "x$PLATFORM_MAC" = "xyes" ]; then
+#    #On Mac we implicitly link against libz, so we
+#    #never use the 3rdparty stuff.
+#    [ "$CFG_ZLIB" = "yes" ] && CFG_ZLIB="system"
+#fi
 if [ "$CFG_ZLIB" = "yes" ]; then
     QT_CONFIG="$QT_CONFIG zlib"
 elif [ "$CFG_ZLIB" = "system" ]; then
@@ -7102,7 +7180,7 @@ fi
 
 cat >>"$QTCONFIG.tmp" <<EOF
 #configuration
-CONFIG += $QTCONFIG_CONFIG
+CONFIG += $QMAKE_CONFIG $QTCONFIG_CONFIG
 QT_ARCH = $CFG_ARCH
 QT_EDITION = $Edition
 QT_CONFIG += $QT_CONFIG
@@ -7194,7 +7272,7 @@ fi
 if [ '!' -z "$OPENSSL_LIBS" ]; then
     echo "OPENSSL_LIBS = $OPENSSL_LIBS" >> "$CACHEFILE.tmp"
 elif [ "$CFG_OPENSSL" = "linked" ]; then
-    echo "OPENSSL_LIBS = -lssl -lcrypto" >> "$CACHEFILE.tmp"
+    echo "OPENSSL_LIBS = `$PKG_CONFIG --libs openssl`" >> "$CACHEFILE.tmp"
 fi
 
 #dump in the SDK info
@@ -7375,7 +7453,7 @@ fi
 echo "Declarative module .. $CFG_DECLARATIVE"
 echo "STL support ......... $CFG_STL"
 echo "PCH support ......... $CFG_PRECOMPILE"
-echo "MMX/3DNOW/SSE/SSE2..  ${CFG_MMX}/${CFG_3DNOW}/${CFG_SSE}/${CFG_SSE2}"
+echo "MMX/3DNOW/SSE/SSE2/RTTI..  ${CFG_MMX}/${CFG_3DNOW}/${CFG_SSE}/${CFG_SSE2}/${CFG_RTTI}"
 if [ "${CFG_ARCH}" = "arm" ]; then
     echo "iWMMXt support ...... ${CFG_IWMMXT}"
 fi
@@ -7688,7 +7766,11 @@ for file in .projects .projects.3; do
         [ "$IN_ROOT" = "no" ] && continue
 
         case $a in
-        *winmain/winmain.pro) continue ;;
+        *winmain/winmain.pro)
+            case "$XPLATFORM" in
+            win32*) SPEC=$XQMAKESPEC ;;
+            *) continue ;;
+            esac ;;
         *s60main/s60main.pro) continue ;;
         *examples/activeqt/*) continue ;;
         */qmake/qmake.pro) continue ;;
diff --git a/mkspecs/win32-g++/qmake.conf b/mkspecs/win32-g++/qmake.conf
index b282f69..fb65805 100644
--- a/mkspecs/win32-g++/qmake.conf
+++ b/mkspecs/win32-g++/qmake.conf
@@ -3,23 +3,31 @@
 #
 # Written for MinGW
 #
+load(qt_config)
 
 MAKEFILE_GENERATOR	= MINGW
 TEMPLATE		= app
 CONFIG			+= qt warn_on release link_prl copy_dir_files debug_and_release debug_and_release_target precompile_header
+CONFIG			+= windows win32
+CONFIG			-= freetype
+QT_CONFIG		-= freetype
 QT			+= core gui
 DEFINES			+= UNICODE QT_LARGEFILE_SUPPORT
+DEFINES			-= QT_LARGEFILE_SUPPORT
+DEFINES			+= QT_TABLET QT_SESSIONMANAGER QT_NO_DIRECT3D QT_NO_CODECS
 QMAKE_COMPILER_DEFINES  += __GNUC__ WIN32
 
 QMAKE_EXT_OBJ           = .o
 QMAKE_EXT_RES           = _res.o
 
-QMAKE_CC		= gcc
+QMAKE_CC		= HOSTPLATFORMPREFIX-gcc
 QMAKE_LEX		= flex
 QMAKE_LEXFLAGS		=
 QMAKE_YACC		= byacc
 QMAKE_YACCFLAGS		= -d
 QMAKE_CFLAGS		=
+QMAKE_CFLAGS		+= -isystem HOSTPLATFORMINCLUDE
+QMAKE_CFLAGS		+= -pipe
 QMAKE_CFLAGS_DEPS	= -M
 QMAKE_CFLAGS_WARN_ON	= -Wall
 QMAKE_CFLAGS_WARN_OFF	= -w
@@ -27,7 +35,7 @@ QMAKE_CFLAGS_RELEASE	= -O2
 QMAKE_CFLAGS_DEBUG	= -g
 QMAKE_CFLAGS_YACC	= -Wno-unused -Wno-parentheses
 
-QMAKE_CXX		= g++
+QMAKE_CXX		= HOSTPLATFORMPREFIX-g++
 QMAKE_CXXFLAGS		= $$QMAKE_CFLAGS
 QMAKE_CXXFLAGS_DEPS	= $$QMAKE_CFLAGS_DEPS
 QMAKE_CXXFLAGS_WARN_ON	= $$QMAKE_CFLAGS_WARN_ON
@@ -42,6 +50,7 @@ QMAKE_CXXFLAGS_EXCEPTIONS_ON = -fexceptions -mthreads
 QMAKE_CXXFLAGS_EXCEPTIONS_OFF = -fno-exceptions
 
 QMAKE_INCDIR		=
+QMAKE_INCDIR		+= .
 QMAKE_INCDIR_QT		= $$[QT_INSTALL_HEADERS]
 QMAKE_LIBDIR_QT		= $$[QT_INSTALL_LIBS]
 
@@ -50,8 +59,8 @@ 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		= g++
-QMAKE_LINK_C		= gcc
+QMAKE_LINK		= HOSTPLATFORMPREFIX-g++
+QMAKE_LINK_C		= HOSTPLATFORMPREFIX-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 =
@@ -72,15 +81,18 @@ 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		= xcopy /s /q /y /i
+	QMAKE_COPY_DIR		= cp -r
 	QMAKE_MOVE		= mv
 	QMAKE_DEL_FILE		= rm
-	QMAKE_MKDIR		= mkdir
+	QMAKE_MKDIR		= mkdir -p
 	QMAKE_DEL_DIR		= rmdir
+	QMAKE_SYMBOLIC_LINK	= ln -s
     QMAKE_CHK_DIR_EXISTS = test -d
 } else {
 	QMAKE_COPY		= copy /y
@@ -92,15 +104,16 @@ QMAKE_LIBS_QT_ENTRY     = -lmingw32 -lqtmain
     QMAKE_CHK_DIR_EXISTS	= if not exist
 }
 
-QMAKE_MOC		= $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}moc.exe
-QMAKE_UIC		= $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}uic.exe
-QMAKE_IDC		= $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}idc.exe
+#QMAKE_IDC		= HOSTPLATFORMPREFIX-idc
+QMAKE_MOC		= HOSTPLATFORMPREFIX-moc
+QMAKE_RCC		= HOSTPLATFORMPREFIX-rcc
+QMAKE_UIC		= HOSTPLATFORMPREFIX-uic
 
-QMAKE_IDL		= midl
-QMAKE_LIB		= ar -ru
-QMAKE_RC		= windres
+#QMAKE_IDL		= midl
+QMAKE_LIB		= HOSTPLATFORMPREFIX-ar -ru
+QMAKE_RC		= HOSTPLATFORMPREFIX-windres
 QMAKE_ZIP		= zip -r -9
 
-QMAKE_STRIP		= strip
+QMAKE_STRIP		= HOSTPLATFORMPREFIX-strip
 QMAKE_STRIPFLAGS_LIB 	+= --strip-unneeded
-load(qt_config)
+PKG_CONFIG		= HOSTPLATFORMPREFIX-pkg-config
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index 3406e41..e171584 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -96,8 +96,8 @@ contains(QT_CONFIG, zlib) {
         ../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 --git a/src/gui/image/image.pri b/src/gui/image/image.pri
index b67be55..6642ae3 100644
--- a/src/gui/image/image.pri
+++ b/src/gui/image/image.pri
@@ -93,11 +93,11 @@ SOURCES += \
     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 {
         !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 @@ SOURCES += \
           ../3rdparty/libpng/pngwutil.c \
           ../3rdparty/libpng/pnggccrd.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 --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri
index 628a109..351b559 100644
--- a/src/gui/painting/painting.pri
+++ b/src/gui/painting/painting.pri
@@ -380,9 +380,9 @@ symbian {
 }
 
 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 --git a/src/network/access/access.pri b/src/network/access/access.pri
index edc1b63..558ecd2 100644
--- a/src/network/access/access.pri
+++ b/src/network/access/access.pri
@@ -57,8 +57,8 @@ SOURCES += access/qftp.cpp \
 
 #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 --git a/src/network/ssl/ssl.pri b/src/network/ssl/ssl.pri
index 72ea80f..c5a5833 100644
--- a/src/network/ssl/ssl.pri
+++ b/src/network/ssl/ssl.pri
@@ -35,5 +35,12 @@ symbian {
     RESOURCES += network.qrc
 
     # Add optional SSL libs
+    !contains(QT_CONFIG, system-zlib):contains(OPENSSL_LIBS, -lz) {
+        #Use the zlib in QtCore
+        #-lz probably came from pkg-config which does not know about QtCore
+        OPENSSL_LIBS -= -lz
+        OPENSSL_LIBS += -lQtCore4
+    }
     LIBS_PRIVATE += $$OPENSSL_LIBS
+
 }
diff --git a/src/plugins/imageformats/jpeg/jpeg.pro b/src/plugins/imageformats/jpeg/jpeg.pro
index ebc79cc..30a19c6 100644
--- a/src/plugins/imageformats/jpeg/jpeg.pro
+++ b/src/plugins/imageformats/jpeg/jpeg.pro
@@ -20,8 +20,8 @@ symbian: {
 }
 
 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 --git a/src/plugins/imageformats/mng/mng.pro b/src/plugins/imageformats/mng/mng.pro
index de7dfa7..46c84c4 100644
--- a/src/plugins/imageformats/mng/mng.pro
+++ b/src/plugins/imageformats/mng/mng.pro
@@ -14,8 +14,8 @@ symbian: {
 }
 
 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-mng) {
 }
 
 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 --git a/src/plugins/imageformats/tiff/tiff.pro b/src/plugins/imageformats/tiff/tiff.pro
index 312f99c..29d36f4 100644
--- a/src/plugins/imageformats/tiff/tiff.pro
+++ b/src/plugins/imageformats/tiff/tiff.pro
@@ -8,8 +8,13 @@ SOURCES += main.cpp \
            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
@@ -62,10 +67,11 @@ contains(QT_CONFIG, system-tiff) {
 }
 
 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 --git a/src/plugins/sqldrivers/psql/psql.pro b/src/plugins/sqldrivers/psql/psql.pro
index 29fbada..1879060 100644
--- a/src/plugins/sqldrivers/psql/psql.pro
+++ b/src/plugins/sqldrivers/psql/psql.pro
@@ -4,18 +4,15 @@ HEADERS		= ../../../sql/drivers/psql/qsql_psql.h
 SOURCES		= main.cpp \
 		  ../../../sql/drivers/psql/qsql_psql.cpp
 
-unix: {
+unix|win32-g++: {
     !isEmpty(QT_LFLAGS_PSQL) {
-        LIBS *= $$QT_LFLAGS_PSQL
+        !contains(QT_CONFIG, system-zlib):contains(QT_LFLAGS_PSQL, -lz):QT_LFLAGS_PSQL -= -lz
+        !static:LIBS *= $$QT_LFLAGS_PSQL
         QMAKE_CXXFLAGS *= $$QT_CFLAGS_PSQL
     }
     !contains(LIBS, .*pq.*):LIBS *= -lpq
 }
 
-win32:!contains(LIBS, .*pq.* ) {
-    !win32-g++:LIBS    *= -llibpq       
-    win32-g++:LIBS *= -lpq	
-    LIBS    *= -lws2_32 -ladvapi32
-}
+win32:!win32-g++:!contains(LIBS, .*pq.* ) LIBS *= -llibpq -lws2_32 -ladvapi32
 
 include(../qsqldriverbase.pri)
diff --git a/src/plugins/sqldrivers/tds/main.cpp b/src/plugins/sqldrivers/tds/main.cpp
index 33c1d78..e5af5a6 100644
--- a/src/plugins/sqldrivers/tds/main.cpp
+++ b/src/plugins/sqldrivers/tds/main.cpp
@@ -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 --git a/src/plugins/sqldrivers/tds/tds.pro b/src/plugins/sqldrivers/tds/tds.pro
index 08a166b..f66d5b7 100644
--- a/src/plugins/sqldrivers/tds/tds.pro
+++ b/src/plugins/sqldrivers/tds/tds.pro
@@ -6,8 +6,9 @@ SOURCES		= main.cpp \
 		  ../../../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 --git a/src/qbase.pri b/src/qbase.pri
index 6428130..4b1407b 100644
--- a/src/qbase.pri
+++ b/src/qbase.pri
@@ -85,7 +85,6 @@ win32-borland {
 }
 
 win32 {
-    CONFIG += zlib
     INCLUDEPATH += tmp
     !static: DEFINES+=QT_MAKEDLL
 }
diff --git a/src/sql/drivers/drivers.pri b/src/sql/drivers/drivers.pri
index 184eca9..9959ddd 100644
--- a/src/sql/drivers/drivers.pri
+++ b/src/sql/drivers/drivers.pri
@@ -6,19 +6,16 @@ contains(sql-drivers, psql) {
     HEADERS +=      drivers/psql/qsql_psql.h
     SOURCES +=      drivers/psql/qsql_psql.cpp
 
-    unix {
-        !isEmpty(QT_LFLAGS_PSQL) {
-            LIBS *= $$QT_LFLAGS_PSQL
+    unix|win32-g++ {
+        !static:!isEmpty(QT_LFLAGS_PSQL) {
+            !contains(QT_CONFIG, system-zlib):contains(QT_LFLAGS_PSQL, -lz):QT_LFLAGS_PSQL -= -lz
+            !static:LIBS *= $$QT_LFLAGS_PSQL
             QMAKE_CXXFLAGS *= $$QT_CFLAGS_PSQL
         }
         !contains(LIBS, .*pq.*):LIBS *= -lpq
     }
 
-    win32 {
-	!win32-g++:!contains( LIBS, .*pq.* ):LIBS *= -llibpq
-    	win32-g++:!contains( LIBS, .*pq.* ):LIBS *= -lpq
-        LIBS *= -lws2_32 -ladvapi32
-    }
+    win32:!win32-g++:!contains(LIBS, .*pq.* ) LIBS *= -llibpq -lws2_32 -ladvapi32
 }
 
 contains(sql-drivers, mysql) {
diff --git a/src/sql/drivers/tds/qsql_tds.cpp b/src/sql/drivers/tds/qsql_tds.cpp
index ab1c283..b3c89d0 100644
--- a/src/sql/drivers/tds/qsql_tds.cpp
+++ b/src/sql/drivers/tds/qsql_tds.cpp
@@ -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 --git a/src/sql/drivers/tds/qsql_tds.h b/src/sql/drivers/tds/qsql_tds.h
index ab2b808..31c3178 100644
--- a/src/sql/drivers/tds/qsql_tds.h
+++ b/src/sql/drivers/tds/qsql_tds.h
@@ -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 --git a/src/svg/svg.pro b/src/svg/svg.pro
index d2a4227..0d3ef83 100644
--- a/src/svg/svg.pro
+++ b/src/svg/svg.pro
@@ -44,7 +44,8 @@ symbian:TARGET.UID3=0x2001B2E2
 
 #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 --git a/src/tools/bootstrap/bootstrap.pri b/src/tools/bootstrap/bootstrap.pri
index b4f9b2f..b005c8a 100644
--- a/src/tools/bootstrap/bootstrap.pri
+++ b/src/tools/bootstrap/bootstrap.pri
@@ -52,8 +52,8 @@ hpux-acc*|hpuxi-acc* {
     LIBS += -lbootstrap
 }
 !contains(QT_CONFIG, zlib):!contains(QT_CONFIG, no-zlib) {
-   unix:LIBS += -lz
-#  win32:LIBS += libz.lib
+    unix|win32-g++:LIBS_PRIVATE += -lz
+    win32:!win32-g++:LIBS += zdll.lib
 }
 win32:LIBS += -luser32
 
diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro
index 1f81a6c..0570a28 100644
--- a/src/tools/bootstrap/bootstrap.pro
+++ b/src/tools/bootstrap/bootstrap.pro
@@ -108,6 +108,9 @@ contains(QT_CONFIG, zlib) {
         ../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 --git a/src/winmain/winmain.pro b/src/winmain/winmain.pro
index bc322b9..f1fec05 100644
--- a/src/winmain/winmain.pro
+++ b/src/winmain/winmain.pro
@@ -11,7 +11,7 @@ win32 {
 	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 --git a/tools/qvfb/qvfb.pro b/tools/qvfb/qvfb.pro
index dde7e8d..556dbcb 100644
--- a/tools/qvfb/qvfb.pro
+++ b/tools/qvfb/qvfb.pro
@@ -42,12 +42,14 @@ contains(QT_CONFIG, opengl) {
 }
 
 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
 }