summaryrefslogtreecommitdiffstats
path: root/admin/acinclude.m4.in
blob: 0b48d916887e9c1aeebe1c8bcc0a47674875e6bc (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
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
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
dnl # // ##################################################################################################################
dnl # // ## Initialization
dnl # // ##################################################################################################################

AC_DEFUN([AC_SS_INIT_VARIABLES],
[
	SS_BUILD_FLAGS=""
	SS_BUILD_NUMBER=""

	dnl # // X Stuff

	SS_X_INCDIR=""
	SS_X_LIBDIR=""
	SS_X_LDFLAGS=""
	SS_X_CPPFLAGS=""

	dnl # // Qt Stuff

	SS_QT3_GENERAL_DIR=""
	SS_QT3_INCDIR=""
	SS_QT3_LIBDIR=""
	SS_QT3_MOC=""

	dnl # // KDE Stuff

	SS_KDE_REQUESTED="no"
	SS_KDE_GENERAL_DIR=""
	SS_KDE_INCDIR=""
	SS_KDE_LIBDIR=""
	SS_KDE_SERVICESDIR=""
	SS_KDE_ICONS32DIR=""

	dnl # // Perl stuff
	
	SS_PERL_ENABLE="no"
	SS_PERL_CCFLAGS=""
	SS_PERL_LDFLAGS=""
	SS_PERL_BINARY="true"
	

	dnl # // CXXFLAGS, will be set by AC_SS_CXXFLAGS

	dnl # CXXFLAGS=""

	dnl Build flags:
	dnl g     - Debug version
	dnl h     - Memory checks
	dnl m     - Memory profiling
	dnl s     - System memmove
	dnl S     - splash screen
	dnl o     = openssl support
	dnl b     - Big channels
	dnl x     - ix86 asm
	dnl T     - tips
	dnl c     - crypt
	dnl I     - IPC
	dnl G     - GSM codec
	dnl 8     - local 8 bit
	dnl A     - dcc sound audio support
	dnl a     - ignore sigalarm
	dnl i     - ipv6
	dnl B     - big endian
	dnl k     - KDE
	dnl p     - pseudo transparency
	dnl e	  - Esound daemon support
	dnl r     - Arts daemon support
	dnl f	  - Audiofile support
	dnl P     - profiling support
	dnl p     - perl scripting support
])

dnl # // ##################################################################################################################
dnl # // ## OUTPUT MACROS
dnl # // ##################################################################################################################
AC_DEFUN([AC_CROSS_COLOR],
[

	TPUT=0
	PRINTF=0
	COLOR=0
	IFS_OLD=$IFS
	IFS=":"

	for i in $PATH; do
		if test -x "$i/tput"; then
			TPUT=1
		fi
	done

	type printf >/dev/null 2>&1 && PRINTF=1

	for i in $PATH; do
		if test -x "$i/printf"; then
			PRINTF=1
		fi
	done

	if test "$TPUT" = "1" -o "$PRINTF" = "1"; then
		COLOR=1
	fi

	if test "$COLOR" = 1; then
		if test "$TPUT" = "1"; then
			if test "$1" = "1"; then
				tput bold
			else
				tput sgr0
			fi
			if test "$2" != ""; then
				tput setaf $2
			fi
		elif test "$PRINTF" = "1"; then
			if test "$2" != ""; then
				printf "\033\1330$1;3$2m"
			fi
		fi
	fi

	IFS=$IFS_OLD
])

AC_DEFUN([AC_SS_HEADER],
[
	AC_CROSS_COLOR([1],[2])
	echo "################################################################################"
	echo "### $1"
	echo "################################################################################"
	AC_CROSS_COLOR([0],[9])
])

AC_DEFUN([AC_SS_SECTION],
[
	AC_CROSS_COLOR([1],[3])
	echo "### $1"
	AC_CROSS_COLOR([0],[9])
])

AC_DEFUN([AC_SS_SET_REDINK],
[
	AC_CROSS_COLOR([1],[1])
])

AC_DEFUN([AC_SS_SET_GREENINK],
[
	AC_CROSS_COLOR([1],[2])
])

AC_DEFUN([AC_SS_SET_NORMALINK],
[
	AC_CROSS_COLOR([0],[9])
])

dnl # // ##################################################################################################################
dnl # // ## FILE LOOKUP MACROS
dnl # // ##################################################################################################################

AC_DEFUN([AC_SS_FIND_FILE_PATH],
[
	$3="FAILED"
	for a_dir in $2; do
		for a_file in $1; do
			if test -r "$a_dir/$a_file"; then
				$3=$(echo "$a_dir" | sed -e 's/\/\.\//\//g' | sed -e 's/\/\//\//g' | sed -e 's/\/\.\//\//g' | sed -e 's/\/\//\//g')
				break 2
			fi
		done
	done	
])

AC_DEFUN([AC_SS_FIND_FILE_PATH_EXT],
[
	$4="FAILED"

	for a_dir in $2; do
		for a_semidir in $3; do
			for a_file in $1; do
				if test -r "$a_dir/$a_semidir/$a_file"; then
					$4=$(echo "$a_dir/$a_semidir" | sed -e 's/\/\.\//\//g' | sed -e 's/\/\//\//g' | sed -e 's/\/\.\//\//g' | sed -e 's/\/\//\//g')
					break 3
				fi
			done
		done
	done
])

dnl # // ##################################################################################################################
dnl # // ## BASIC COMPILER FLAGS
dnl # // ##################################################################################################################


AC_DEFUN([AC_SS_CXXFLAGS_DEBUG_SYMBOLS],
[
	dnl # // Checks if the --with-debug-symbols option has been passed to configure
	dnl # // adds -g to SS_CXXFLAGS
	dnl # // adds g to SS_BUILD_FLAGS

	AC_MSG_CHECKING([if you want the debug symbols])

	SS_LOCAL_ADD_DEBUG_SYMBOLS=""

	AC_ARG_ENABLE(debug,
		AC_HELP_STRING([--enable-debug],[Compile an executable suitable for debugging]),
		[SS_LOCAL_ADD_DEBUG_SYMBOLS="true"])

	if test -n "$SS_LOCAL_ADD_DEBUG_SYMBOLS"; then
		AC_MSG_RESULT([yes])
		if test -n "$SS_CXXFLAGS"; then
			SS_CXXFLAGS="$SS_CXXFLAGS -g"
		else
			SS_CXXFLAGS="-g"
		fi
		SS_BUILD_FLAGS="g$SS_BUILD_FLAGS"
	else
		AC_MSG_RESULT([no])
	fi	
])

AC_DEFUN([AC_SS_CXXFLAGS_PIPES],
[
	dnl # // Checks if the --with-pipes option has been passed to configure
	dnl # // adds -pipe to CXXFLAGS

	AC_MSG_CHECKING([if you want to use pipes for compilation])

	SS_LOCAL_USE_PIPES=""
	AC_ARG_ENABLE(pipes,
		AC_HELP_STRING([--enable-pipes],[Use pipes instead of files for the compilation]),
		[SS_LOCAL_USE_PIPES="true"])

	if test -n "$SS_LOCAL_USE_PIPES"; then
		AC_MSG_RESULT([yes])
		if test -n "$SS_CXXFLAGS"; then
			SS_CXXFLAGS="$SS_CXXFLAGS -pipe"
		else
			SS_CXXFLAGS="-pipe"
		fi
	else
		AC_MSG_RESULT([no])
	fi
])


AC_DEFUN([AC_SS_CXXFLAGS_PROFILING],
[
	AC_MSG_CHECKING([if you want the profiling information])

	SS_LOCAL_ADD_PROFILING=""

	AC_ARG_ENABLE(profiling,
		AC_HELP_STRING([--enable-profiling],[Compile an executable suitable for profiling]),
		[SS_LOCAL_ADD_PROFILING="true"])

	if test -n "$SS_LOCAL_ADD_PROFILING"; then
		AC_MSG_RESULT([yes])
		if test -n "$SS_CXXFLAGS"; then
			SS_CXXFLAGS="$SS_CXXFLAGS -pg"
		else
			SS_CXXFLAGS="-pg"
		fi
		if test -n "$SS_LDFLAGS"; then
			SS_LDFLAGS="$SS_LDFLAGS -pg"
		else
			SS_LDFLAGS="-pg"
		fi
		SS_BUILD_FLAGS="P$SS_BUILD_FLAGS"
	else
		AC_MSG_RESULT([no])
	fi	
])

AC_DEFUN([AC_SS_CXXFLAGS_FNORTTI],
[
	AC_MSG_CHECKING([if you want to use -fno-rtti])

	SS_LOCAL_FNORTTI=""
	AC_ARG_ENABLE(fno-rtti,
		AC_HELP_STRING([--enable-fno-rtti],[Disable runtime type information (dangerous)]),
		SS_LOCAL_FNORTTI="true")

	if test -n "$SS_LOCAL_FNORTTI"; then
		AC_MSG_RESULT([yes])
		if test -n "$SS_CXXFLAGS"; then
			SS_CXXFLAGS="$SS_CXXFLAGS -fno-rtti"
		else
			SS_CXXFLAGS="-fno-rtti"
		fi
	else
		AC_MSG_RESULT([no])
	fi
])

AC_DEFUN([AC_SS_CXXFLAGS_ANSI],
[
	SS_ANSI_COMPILATION=""
	AC_MSG_CHECKING([if you want a strict ansi compilation])
	AC_ARG_ENABLE(ansi,
		AC_HELP_STRING([--enable-ansi],[Strict ansi compilation (might not compile)]),
		SS_ANSI_COMPILATION="true")

	if test -n "$SS_ANSI_COMPILATION"; then
		AC_MSG_RESULT([yes])
		if test -n "$SS_CXXFLAGS"; then
			SS_CXXFLAGS="$SS_CXXFLAGS -ansi"
		else
			SS_CXXFLAGS="-ansi"
		fi
	else
		AC_MSG_RESULT([no])
	fi
])


AC_DEFUN([AC_SS_CXXFLAGS_WALL],
[
	SS_WALL_COMPILATION=""
	AC_MSG_CHECKING([if you want gcc to be paranoic])
	AC_ARG_ENABLE(wall,
		AC_HELP_STRING([--enable-wall],[Make gcc be paranoic (might not compile)]),
		SS_WALL_COMPILATION="true")

	if test -n "$SS_WALL_COMPILATION"; then
		AC_MSG_RESULT([yes])
		if test -n "$SS_CXXFLAGS"; then
			SS_CXXFLAGS="$SS_CXXFLAGS -Wall"
		else
			SS_CXXFLAGS="-Wall"
		fi
	else
		AC_MSG_RESULT([no])
	fi
])


AC_DEFUN([AC_SS_CXXFLAGS_PEDANTIC],
[
	SS_PEDANTIC_COMPILATION=""
	AC_MSG_CHECKING([if you want a strict ansi compilation])

	AC_ARG_ENABLE(pedantic,
		AC_HELP_STRING([--enable-pedantic],[Pedantic compilation (might not compile)]),
		SS_PEDANTIC_COMPILATION="true")

	if test -n "$SS_PEDANTIC_COMPILATION"; then
		AC_MSG_RESULT([yes])
		if test -n "$SS_CXXFLAGS"; then
			SS_CXXFLAGS="$SS_CXXFLAGS -pedantic"
		else
			SS_CXXFLAGS="-pedantic"
		fi
	else
		AC_MSG_RESULT([no])
	fi
])

AC_DEFUN([AC_SS_CXXFLAGS_OPTIMISATION],
[
	AC_MSG_CHECKING([for the optimisation level])

	SS_LOCAL_OPTIMISATION=""
	AC_ARG_ENABLE(optimisation,
		AC_HELP_STRING([--enable-optimisation=N],[Use optimisation level N when compiling]),
			SS_LOCAL_OPTIMISATION="$enableval")

	if test -n "$SS_LOCAL_OPTIMISATION"; then
		AC_MSG_RESULT([using -O$SS_LOCAL_OPTIMISATION])
		if test -n "$SS_CXXFLAGS"; then
			SS_CXXFLAGS="$SS_CXXFLAGS -O$SS_LOCAL_OPTIMISATION"
		else
			SS_CXXFLAGS="-O$SS_LOCAL_OPTIMISATION"
		fi
		SS_BUILD_FLAGS="$SS_LOCAL_OPTIMISATION$SS_BUILD_FLAGS"
	else
		AC_MSG_RESULT([using no optimisation flag])
	fi
])



AC_DEFUN([AC_SS_CXXFLAGS],
[
	SS_CXXFLAGS=""

	AC_SS_CXXFLAGS_DEBUG_SYMBOLS
	AC_SS_CXXFLAGS_PROFILING
	AC_SS_CXXFLAGS_PIPES
	AC_SS_CXXFLAGS_OPTIMISATION
	AC_SS_CXXFLAGS_FNORTTI
	AC_SS_CXXFLAGS_ANSI
	AC_SS_CXXFLAGS_PEDANTIC
	AC_SS_CXXFLAGS_WALL

	if test -n "$SS_CXXFLAGS"; then
		if test -n "$CXXFLAGS"; then
			CXXFLAGS="$CXXFLAGS $SS_CXXFLAGS"
		else
			CXXFLAGS="$SS_CXXFLAGS"
		fi
	fi
])


dnl ###################################################################################################################
dnl ### HEADERS AND FUNCTIONS
dnl ###################################################################################################################

AC_DEFUN([AC_SS_HEADER_CHECKS],
[
	SS_HAS_OSS_SUPPORT="false"
	AC_CHECK_HEADER(strings.h)
	AC_CHECK_HEADERS(linux/soundcard.h sys/soundcard.h soundcard.h,SS_HAS_OSS_SUPPORT="true")

	if test "$SS_HAS_OSS_SUPPORT" = "true"; then
		AC_DEFINE([COMPILE_OSS_SUPPORT], 1, [define if you want to enable OSS sound support])
	fi

])

AC_DEFUN([AC_SS_FUNCTION_CHECKS],
[
	SS_HAVE_IPV6_FUNCTIONS="true"

	AC_CHECK_FUNCS(getenv strerror)
	AC_CHECK_FUNCS(inet_ntoa inet_aton)
	AC_CHECK_FUNCS(setenv unsetenv putenv)
	AC_CHECK_FUNCS(gmtime_r localtime_r)

	AC_CHECK_FUNC(inet_ntop,SS_HAVE_IPV6_FUNCTIONS="true",SS_HAVE_IPV6_FUNCTIONS="false")
	AC_CHECK_FUNC(inet_pton,SS_HAVE_IPV6_FUNCTIONS="true",SS_HAVE_IPV6_FUNCTIONS="false")
	AC_CHECK_FUNC(getaddrinfo,SS_HAVE_IPV6_FUNCTIONS="true",SS_HAVE_IPV6_FUNCTIONS="false")

	AC_CHECK_FUNCS(getnameinfo)
])



dnl ###################################################################################################################
dnl ### MISC OPTIONS
dnl ###################################################################################################################


AC_DEFUN([AC_SS_MISC_OPTIONS],
[
	AC_MSG_CHECKING([if you want the memory profiling])
	AC_ARG_WITH(memory-profile, [  --with-memory-profile   Compile the memory profile],SS_COMPILE_MEMORY_PROFILE="true")
	if test "$SS_COMPILE_MEMORY_PROFILE" = "true"; then
		AC_MSG_RESULT(yes)
		AC_DEFINE([COMPILE_MEMORY_PROFILE], 1, [define if you want the gcc memory profile])
		SS_BUILD_FLAGS="m$SS_BUILD_FLAGS"
	else
		AC_MSG_RESULT(no)
	fi

	AC_MSG_CHECKING([how to waste your time])
	AC_MSG_RESULT(by performing senseless checks)

	AC_MSG_CHECKING([if you want memory checking in malloc])
	AC_ARG_WITH(memory-checks, [  --with-memory-checks    Enable malloc memory checks],SS_COMPILE_MEMORY_CHECKS="true")
	if test "$SS_COMPILE_MEMORY_CHECKS" = "true"; then
		AC_MSG_RESULT(yes)
		AC_DEFINE([COMPILE_MEMORY_CHECKS], 1, [define if you want the memory checks])
		SS_BUILD_FLAGS="h$SS_BUILD_FLAGS"
	else
		AC_MSG_RESULT(no)
	fi


	AC_MSG_CHECKING([if you want to use system memmove])
	AC_ARG_WITH(system-memmove, [  --without-system-memmove   Do not use system memmove and memcpy],SS_DO_NOT_USE_SYSTEM_MEMMOVE="true")
	if test "$SS_DO_NOT_USE_SYSTEM_MEMMOVE" = "true"; then
		AC_MSG_RESULT(no)
	else
		AC_DEFINE([COMPILE_WITH_SYSTEM_MEMMOVE], 1, [define if you trust your memmove() function])
		AC_MSG_RESULT(yes)
		SS_BUILD_FLAGS="s$SS_BUILD_FLAGS"
	fi

	AC_MSG_CHECKING([if you want to optimize for big channels])
	AC_ARG_WITH(big-channels, [  --with-big-channels     Optimize for big irc channels],SS_OPTIMIZE_BIG_CHANNELS="true")
	if test "$SS_OPTIMIZE_BIG_CHANNELS" = "true"; then
		AC_MSG_RESULT(yes: using 349 as dict size)
		AC_DEFINE_UNQUOTED([AVERAGE_CHANNEL_USERS],349, [define this to the number of average channel users])
		SS_BUILD_FLAGS="b$SS_BUILD_FLAGS"
	else
		AC_MSG_RESULT(no: using 101 as dict size)
		AC_DEFINE_UNQUOTED([AVERAGE_CHANNEL_USERS],101, [define this to the number of average channel users])
	fi

	AC_MSG_CHECKING([if you want ix86 assembly optimisations])
	AC_ARG_WITH(ix86-asm, [  --with-ix86-asm         Compile ix86 assembly optimisations],SS_COMPILE_ix86_ASM="true")
	if test "$SS_COMPILE_ix86_ASM" = "true"; then
		AC_MSG_RESULT(yes)
		AC_MSG_CHECKING(target system CPU)
		if test "$target_cpu" = "i386"; then
			AC_MSG_RESULT(i386 : compiling asm code)
		else
			if test "$target_cpu" = "i486"; then
				AC_MSG_RESULT(i486 : compiling asm code)
			else
				if test "$target_cpu" = "i586"; then
					AC_MSG_RESULT(i586 : compiling asm code)
				else
					if test "$target_cpu" = "i686"; then
						AC_MSG_RESULT(i686 : compiling asm code)
					else
						AC_MSG_RESULT($target_cpu , no i386 optimisations)
						unset SS_COMPILE_ix86_ASM
					fi
				fi
			fi
		fi

		if test "$SS_COMPILE_ix86_ASM" = "true"; then
			AC_DEFINE([COMPILE_ix86_ASM], 1, [define if you want the i386 asm code])
			SS_BUILD_FLAGS="x$SS_BUILD_FLAGS"
		fi
	else
		AC_MSG_RESULT(no)
	fi

	AC_PATH_PROG(SS_MSGFMT,msgfmt,":",$PATH:/bin:/usr/bin:/bin:/usr/local/bin:/usr/X11R6/bin:/usr/lib/qt/bin:/usr/local/qt/bin:/usr/X11R6/qt/bin:/usr/qt/bin:/usr/build/qt/bin)
	if test -z "SS_MSGFMT"; then
		SS_MSGFMT=":"
	fi
	AC_SUBST(SS_MSGFMT)

	AC_MSG_CHECKING([if you want the DCC VOICE sound support])
	AC_ARG_WITH(dcc-sound,[  --without-dcc-sound     Do not compile the DCC VOICE sound support],SS_NO_SOUND="true")
	if test "$SS_NO_SOUND" = "true"; then
		AC_MSG_RESULT(no)
		AC_DEFINE([COMPILE_DISABLE_DCC_VOICE], 1, [define if you want to disable DCC VOICE sound support])
	else
		AC_MSG_RESULT(yes)
		SS_BUILD_FLAGS="A$SS_BUILD_FLAGS"
	fi

	SS_BUILD_FLAGS="T$SS_BUILD_FLAGS"
	AC_DEFINE([COMPILE_INFO_TIPS], 1, [define if you want the info tips to be compiled in])

	AC_MSG_CHECKING([if you want to disable the ipV6 support])
	AC_ARG_WITH(ipv6-support,[  --without-ipv6-support  Do not compile the IpV6 support],SS_NOIPV6_SUPPORT="true")
	if test "$SS_NOIPV6_SUPPORT" = "true"; then
		AC_MSG_RESULT(yes)
	else
		AC_MSG_RESULT(no)
	fi

	AC_MSG_CHECKING([if you want to disable the cryptography support])
	AC_ARG_WITH(crypt-support,[  --without-crypt-support Do not compile the cryptography support],SS_NOCRYPT_SUPPORT="true")
	if test "$SS_NOCRYPT_SUPPORT" = "true"; then
		AC_MSG_RESULT(yes)
	else
		AC_MSG_RESULT(no)
		AC_DEFINE([COMPILE_CRYPT_SUPPORT], 1, [define if you want to compile the crypt support])
		SS_BUILD_FLAGS="c$SS_BUILD_FLAGS"
	fi

	AC_MSG_CHECKING([if you want to disable the X bell support])
	AC_ARG_WITH(x-bell,[  --without-x-bell        Disable the X bell support],SS_NO_X_BELL="true")
	if test "$SS_NO_X_BELL" = "true"; then
		AC_MSG_RESULT(yes)
		AC_DEFINE([COMPILE_NO_X_BELL], 1, [define if you want to disable the X bell support])
	else
		AC_MSG_RESULT(no)
	fi

	AC_DEFINE([COMPILE_NEW_KVS], 1, [define if you want to enable the new KVS parser])
	AC_DEFINE([COMPILE_ONLY_NEW_KVS], 1, [define if you want to use only the new KVS parser])

	AC_MSG_CHECKING([if you want to link to the embedded version of qt])
	AC_ARG_WITH(qt-embedded,[  --with-qt-embedded      Link to qt-embedded (see INSTALL)],SS_QT3_EMBEDDED="true")
	if test "$SS_QT3_EMBEDDED" = "true"; then
		AC_MSG_RESULT(yes)
		SS_BUILD_FLAGS="E$SS_BUILD_FLAGS"
	else
		AC_MSG_RESULT(no)
	fi


	AC_MSG_CHECKING([if you want to disable inter-process communication])
	AC_ARG_WITH(ipc,[  --without-ipc           Disable inter-process communication support],SS_NO_IPC="true")
	if test "$SS_NO_IPC" = "true"; then
		AC_MSG_RESULT(yes)
		SS_BUILD_FLAGS="I$SS_BUILD_FLAGS"
		AC_DEFINE([COMPILE_NO_IPC], 1, [define this if you want to disable the inter-process communication support])
	else
		AC_MSG_RESULT(no)
	fi

	AC_MSG_CHECKING([if you want to explicitly disable the gsm codec support])
	AC_ARG_WITH(gsm,[  --without-gsm           Disable gsm codec support],SS_NO_GSM="true")
	if test "$SS_NO_GSM" = "true"; then
		AC_MSG_RESULT(yes)
	else
		AC_DEFINE([COMPILE_USE_GSM], 1, [define if you have libgsm and want the GSM code to be compiled])
		SS_BUILD_FLAGS="G$SS_BUILD_FLAGS"
		AC_MSG_RESULT(no)
	fi


	AC_MSG_CHECKING([if you want to ignore SIGALARM])
	AC_ARG_WITH(ignore-sigalarm, [  --with-ignore-sigalarm  Ignore SIGALARM in all threads],SS_IGNORE_SIGALARM="true")
	if test "$SS_IGNORE_SIGALARM" = "true"; then
		AC_MSG_RESULT(yes)
		AC_DEFINE([COMPILE_IGNORE_SIGALARM], 1, [define this if you want to ignore the SIGALARM signal])
		SS_BUILD_FLAGS="a$SS_BUILD_FLAGS"
	else
		AC_MSG_RESULT(no)
	fi

	AC_MSG_CHECKING([if you want the pseudo-transparency support])
	AC_ARG_WITH(transparency,  [  --without-transparency  Do NOT compile the pseudo-transparency support],SS_NO_PSEUDO_TRANSPARENCY="true")
	if test "$SS_NO_PSEUDO_TRANSPARENCY" = "true"; then
		AC_MSG_RESULT(no)
	else
		AC_MSG_RESULT(yes)
		AC_DEFINE([COMPILE_PSEUDO_TRANSPARENCY], 1, [define if you have the KDE support and want the pseudo transparency])
		SS_BUILD_FLAGS="p$SS_BUILD_FLAGS"
	fi

	AC_ARG_WITH(pizza,[  --with-pizza            Use this when hungry],SS_PIZZA="true")

])


dnl ###################################################################################################################
dnl ### DYNAMIC LABELS
dnl ###################################################################################################################

AC_DEFUN([AC_SS_CHECK_DYNAMIC_LABELS],
[
	AC_MSG_CHECKING([if the compiler supports dynamic labels])
	AC_ARG_WITH(dyn-labels, [  --without-dyn-labels    Disable usage of the dynamic label jumps],SS_DISABLE_DYNAMIC_LABELS="true")
	if test "$SS_DISABLE_DYNAMIC_LABELS" = "true"; then
		AC_MSG_RESULT("no: trusting you")
	else
		AC_TRY_RUN([
				int main(int argc,char ** argv)
				{
					int retVal = 10;
					void * label = &&action4;
					goto action2;
					action1:
						retVal -= 4;
						label = &&endofcode;
						goto *label;
					action2:
						retVal -= 5;
						goto *label;
					action3:
						retVal += 40;
					action4:
						retVal -= 1;
						label = &&action1;
						goto *label;
					endofcode:
						return retVal;
				}
			],SS_DISABLE_DYNAMIC_LABELS="false",SS_DISABLE_DYNAMIC_LABELS="true",SS_DISABLE_DYNAMIC_LABELS="true")

		if test "$SS_DISABLE_DYNAMIC_LABELS" = "true"; then
			AC_MSG_RESULT("no")
		else
			AC_MSG_RESULT("yes")
			AC_DEFINE([COMPILE_USE_DYNAMIC_LABELS], 1, [define if your compiler supports gotos do dynamic labels])
		fi
	fi
])

dnl ###################################################################################################################
dnl ### BIG_ENDIAN
dnl ###################################################################################################################

AC_DEFUN([AC_SS_CHECK_BIG_ENDIAN],
[
	AC_MSG_CHECKING([if this system is big endian])
	AC_TRY_RUN([
			int main(int argc,char ** argv)
			{
				int nl;
				unsigned char * nlc;
				nl = 0x12CAFE34;
				nlc = (unsigned char *)(&nl);
				if((nlc[0] == 0x12) && (nlc[1] == 0xCA) && (nlc[2] == 0xFE) && (nlc[3] == 0x34))return 0;
				return 1;
			}
		],SS_BIG_ENDIAN_MACHINE="true",SS_BIG_ENDIAN_MACHINE="false",SS_BIG_ENDIAN_MACHINE="false")

	dnl # This will fail if we're cross compiling...

	if test "$SS_BIG_ENDIAN_MACHINE" = "true"; then
		AC_MSG_RESULT([yes])
		SS_BUILD_FLAGS="B$SS_BUILD_FLAGS"
		AC_DEFINE([BIG_ENDIAN_MACHINE_BYTE_ORDER], 1, [define this if you are on a big endian machine])
	else
		AC_MSG_RESULT([no])
	fi
])

dnl ###################################################################################################################
dnl ### DLOPEN
dnl ###################################################################################################################


AC_DEFUN([AC_SS_CHECK_DL],
[
	AC_MSG_CHECKING([for dlopen capabilities])

	SS_LINK_TO_LIBDL="no"

	SS_SAVE_LIBS="$LIBS"
	LIBS="-rdynamic"
	AC_TRY_LINK([
			#include <dlfcn.h>
		],[
			/* sparc-unknown-openbsd3.0 hack */
			#ifndef RTLD_NOW
				#define RTLD_NOW RTLD_LAZY
			#endif
			dlopen("/lib/libc.so.6",RTLD_NOW);
		],
			eval "SS_DLOPEN_OK=yes"
		,
			eval "SS_DLOPEN_OK=no"
		)
	LIBS="$SS_SAVE_LIBS"

	if test "$SS_DLOPEN_OK" = "yes"; then
		AC_MSG_RESULT([builtin in libc])
	else

		SS_SAVE_LIBS="$LIBS"
		LIBS="-rdynamic -ldl"
		AC_TRY_LINK([
				#include <dlfcn.h>
			],[
				/* sparc-unknown-openbsd3.0 hack */
				#ifndef RTLD_NOW
					#define RTLD_NOW RTLD_LAZY
				#endif
				dlopen("/usr/lib/libdl.so",RTLD_NOW);
			],
				eval "SS_DLOPEN_OK=yes",
				eval "SS_DLOPEN_OK=no"
			)
		LIBS="$SS_SAVE_LIBS"

		if test "$SS_DLOPEN_OK" = "yes"; then
			SS_LINK_TO_LIBDL="yes"
			AC_MSG_RESULT([external in libdl])
		else
			AC_MSG_RESULT([FAILED])
			AC_SS_SET_REDINK
			echo "################################################################################"
			echo "### CONFIGURE ERROR:"
			echo "###  No dlopen capabilities found."
			echo "###  It looks that your system has no interface to the dynamic linker ?"
			echo "###  If you're on linux, you either miss libdl , or the linker is not"
			echo "###  able to find it. Make sure that libdl is in /lib or /usr/lib."
			echo "###  If you're sure you have libdl, make sure you have also g++ installed."
			echo "###  If you're not on linux, please drop a mail to pragma at kvirc dot net"
			echo "###  describing your system and I'll try to fix it."
			echo "################################################################################"
			AC_SS_SET_NORMALINK
			AC_MSG_ERROR(["This was fatal...aborting"])
		fi
	fi
])


dnl ###################################################################################################################
dnl ### PERL
dnl ###################################################################################################################


AC_DEFUN([AC_SS_CHECK_PERL],
[
	SS_PERL_ENABLE="yes"
	SS_PERL_CCFLAGS=""
	SS_PERL_LDFLAGS=""
	SS_PERL_BINARY="true"
	SS_PERL_RESULT_MESSAGE=""

	AC_ARG_ENABLE(perl,AC_HELP_STRING([--enable-perl],[Enable perl scripting support (default=detect)]),eval "SS_PERL_ENABLE=$enableval")

	if test "$SS_PERL_ENABLE" = "yes"; then
		AC_PATH_PROG(SS_PERL_BINARY,perl,":",$PATH:/bin:/usr/bin:/bin:/usr/local/bin:/usr/X11R6/bin:/usr/lib/qt/bin:/usr/local/qt/bin:/usr/X11R6/qt/bin:/usr/qt/bin:/usr/build/qt/bin)
		if test -z "SS_PERL_BINARY"; then
			SS_PERL_RESULT_MESSAGE="disabled: can't find the perl binary"
			SS_PERL_ENABLE="no"
			SS_PERL_BINARY="true"
		fi
	else
		SS_PERL_RESULT_MESSAGE="disabled by user"
	fi
	
	if test "$SS_PERL_ENABLE" = "yes"; then
		AC_MSG_CHECKING([if perl il compiled with MULTIPLICITY option])
		SS_PERL_TEMP=$($SS_PERL_BINARY -V | grep MULTIPLICITY)
		if test -z "$SS_PERL_TEMP"; then
			AC_MSG_RESULT([no])
			SS_PERL_ENABLE="no"
			SS_PERL_BINARY="true"
			SS_PERL_RESULT_MESSAGE="disabled: MULTIPLICITY not defined"
		fi
	fi

	if test "$SS_PERL_ENABLE" = "yes"; then
		AC_MSG_CHECKING([for the system perl directory])
		SS_PERL_DIR=$($SS_PERL_BINARY -MConfig -e 'print $Config{archlib}')
		SS_PERL_DIR="$SS_PERL_DIR/CORE"
		AC_MSG_RESULT([got $SS_PERL_DIR])
		AC_MSG_CHECKING([for the perl ccflags])
		SS_PERL_CCFLAGS=$($SS_PERL_BINARY -MConfig -e 'print $Config{ccflags}')
		AC_MSG_RESULT([got $SS_PERL_CCFLAGS])
		AC_MSG_CHECKING([for the perl ldflags])
		SS_PERL_LDFLAGS=$($SS_PERL_BINARY -MExtUtils::Embed -e ldopts)
		AC_MSG_RESULT([got $SS_PERL_LDFLAGS])

		AC_MSG_CHECKING([if we can compile a perl application])
		SS_SAVED_LIBS="$LIBS"
		SS_SAVED_CFLAGS="$CFLAGS"
		SS_SAVED_CCFLAGS="$CCFLAGS"
		SS_SAVED_LDFLAGS="$LDFLAGS"
		SS_SAVED_CXXFLAGS="$CXXFLAGS"
		SS_SAVED_CPPFLAGS="$CPPFLAGS"

		LIBS="$SS_PERL_LDFLAGS"
		LDFLAGS="$LIBS"
		CFLAGS="$SS_PERL_CCFLAGS -I$SS_PERL_DIR"
		CCFLAGS="$CFLAGS"
		CXXFLAGS="$CFLAGS"
		CPPFLAGS="$CFLAGS"

		AC_TRY_LINK([
					#include <EXTERN.h>
					#include <perl.h>
					#include <XSUB.h>

					extern "C" void boot_DynaLoader(pTHX_ CV* cv);

					extern "C" void xs_init(pTHX)
					{
						char * file = __FILE__;
						newXS("DynaLoader::boot_DynaLoader",boot_DynaLoader,file);
					}
					
			],[
					PerlInterpreter *my_perl;
					my_perl = perl_alloc();
					perl_construct(my_perl);
					perl_parse(my_perl,xs_init, 0, 0, (char **)NULL);
					perl_run(my_perl);
					perl_destruct(my_perl);
					perl_free(my_perl);
			],
				eval "SS_PERL_ENABLE=yes",
				eval "SS_PERL_ENABLE=no"
			)

		SS_PERL_LDFLAGS="$LDFLAGS"
		SS_PERL_CCFLAGS="$CCFLAGS"

		LIBS="$SS_SAVED_LIBS"
		CFLAGS="$SS_SAVED_CFLAGS"
		LDFLAGS="$SS_SAVED_LDFLAGS"
		CXXFLAGS="$SS_SAVED_CXXFLAGS"
		CPPFLAGS="$SS_SAVED_CPPFLAGS"
		CCFLAGS="$SS_SAVED_CCFLAGS"

		if test "$SS_PERL_ENABLE" = "yes"; then
			AC_MSG_RESULT([seems ok])
			AC_DEFINE([COMPILE_PERL_SUPPORT], 1, [define if you have perl and want the perl scripting support in kvirc])
			SS_BUILD_FLAGS="p$SS_BUILD_FLAGS"
			SS_PERL_RESULT_MESSAGE="enabled"
		else
			AC_MSG_RESULT([seems broken])
			SS_PERL_RESULT_MESSAGE="disabled: failed to compile the test program"
			SS_PERL_LDFLAGS=""
			SS_PERL_CCFLAGS=""
		fi
	fi

	AC_SUBST(SS_PERL_CCFLAGS)
	AC_SUBST(SS_PERL_LDFLAGS)
	AC_SUBST(SS_PERL_BINARY)

	AC_MSG_CHECKING([for perl scripting support])
	AC_MSG_RESULT([$SS_PERL_RESULT_MESSAGE])
])

dnl ###################################################################################################################
dnl ### OPENSSL
dnl ###################################################################################################################


AC_DEFUN([AC_SS_CHECK_OPENSSL],
[
	SS_LINK_TO_LIBSSL="false"
	SS_SSL_RESULT_MESSAGE=""
	SS_ENABLE_SSL_SUPPORT="yes"

	AC_ARG_ENABLE(ssl,AC_HELP_STRING([--disable-ssl],[Disable OpenSSL support]),eval "SS_ENABLE_SSL_SUPPORT=$enableval")

	if test "$SS_ENABLE_SSL_SUPPORT" = "yes"; then
		AC_MSG_CHECKING([If we can compile and link a small SSL test application])
		SS_SAVED_LIBS="$LIBS"
		LIBS="-lcrypto -lssl"
		AC_TRY_LINK([
				#include <openssl/ssl.h>
			],[
				SSL_new(0);
			],
				eval "SS_ENABLE_SSL_SUPPORT=yes",
				eval "SS_ENABLE_SSL_SUPPORT=no"
			)
		LIBS="$SS_SAVED_LIBS"
		if test "$SS_ENABLE_SSL_SUPPORT" = "yes"; then
			AC_MSG_RESULT([yes])

			AC_CHECK_HEADER(openssl/ssl.h,SS_DUMMY="yes",SS_ENABLE_SSL_SUPPORT="no")
			AC_CHECK_HEADER(openssl/err.h,SS_DUMMY="yes",SS_ENABLE_SSL_SUPPORT="no")
			AC_CHECK_HEADER(openssl/asn1.h,SS_DUMMY="yes",SS_ENABLE_SSL_SUPPORT="no")
			AC_CHECK_HEADER(openssl/evp.h,SS_DUMMY="yes",SS_ENABLE_SSL_SUPPORT="no")

			if test "$SS_ENABLE_SSL_SUPPORT" = "yes"; then
				AC_DEFINE([COMPILE_SSL_SUPPORT], 1, [define if you have openssl and want the ssl support in kvirc])
				SS_LINK_TO_LIBSSL="true"
				SS_BUILD_FLAGS="o$SS_BUILD_FLAGS"
				SS_SSL_RESULT_MESSAGE="enabled"
			else
				SS_SSL_RESULT_MESSAGE="disabled: missing header files"
			fi
		else
			AC_MSG_RESULT([no])
			SS_SSL_RESULT_MESSAGE="disabled: failed to compile the test program"
		fi
	else
		SS_SSL_RESULT_MESSAGE="disabled by user"
	fi

	AC_MSG_CHECKING([for secure connections support])
	AC_MSG_RESULT([$SS_SSL_RESULT_MESSAGE])
])


dnl ###################################################################################################################
dnl ### ESD
dnl ###################################################################################################################

AC_DEFUN([AC_SS_CHECK_ESD],
[
	SS_LINK_TO_LIBESD="false"
	SS_DISABLE_ESD_SUPPORT="true"
	SS_SAVED_LIBS=$LIBS
	LIBS="$LIBS -lesd"
	AC_CHECK_LIB(esd,esd_play_file,SS_DISABLE_ESD_SUPPORT="false")
	LIBS="$SS_SAVED_LIBS"

	if test "$SS_DISABLE_ESD_SUPPORT" = "false"; then
		SS_DISABLE_ESD_SUPPORT="true"
		AC_CHECK_HEADER(esd.h,SS_DISABLE_ESD_SUPPORT="false")
	fi

	AC_MSG_CHECKING([for Esound daemon support])
	AC_ARG_WITH(esd-support, [  --without-esd-support   Disable Esound daemon support],SS_DISABLE_ESD_SUPPORT="true")

	if test "$SS_DISABLE_ESD_SUPPORT" = "true"; then
		AC_MSG_RESULT(disabled by user)
	else
		AC_MSG_RESULT(yes: have libs and headers)
		AC_DEFINE([COMPILE_ESD_SUPPORT], 1, [define if you want to enable the Esound daemon support])
		SS_LINK_TO_LIBESD="true"
		SS_BUILD_FLAGS="e$SS_BUILD_FLAGS"
	fi

])

dnl ###################################################################################################################
dnl ### ZLIB
dnl ###################################################################################################################

AC_DEFUN([AC_SS_CHECK_ZLIB],
[
	SS_LINK_TO_LIBZLIB="no"
	SS_DISABLE_ZLIB_SUPPORT="true"
	SS_SAVED_LIBS=$LIBS
	LIBS="$LIBS -lz"
	AC_CHECK_LIB(z,gzopen,SS_DISABLE_ZLIB_SUPPORT="false")
	LIBS="$SS_SAVED_LIBS"

	if test "$SS_DISABLE_ZLIB_SUPPORT" = "false"; then
		SS_DISABLE_ZLIB_SUPPORT="true"
		AC_CHECK_HEADER(zlib.h,SS_DISABLE_ZLIB_SUPPORT="false")
	fi

	AC_MSG_CHECKING([for GZip support])
	AC_ARG_WITH(zlib-support, [  --without-zlib-support   Disable ZLIB support],SS_DISABLE_ZLIB_SUPPORT="true")

	if test "$SS_DISABLE_ZLIB_SUPPORT" = "true"; then
		AC_MSG_RESULT(disabled by user)
	else
		AC_MSG_RESULT(yes: have libs and headers)
		AC_DEFINE([COMPILE_ZLIB_SUPPORT], 1, [define if you want to enable the ZLib library support])
		SS_LINK_TO_LIBZ="yes"
		SS_BUILD_FLAGS="Z$SS_BUILD_FLAGS"
	fi
])

dnl ###################################################################################################################
dnl ### XSS
dnl ###################################################################################################################

AC_DEFUN([AC_SS_CHECK_XSS],
[
	SS_LINK_TO_XSS="no"
	SS_COMPILE_XSS_SUPPORT="false"
	SS_SAVED_LIBS=$LIBS
	LIBS="$LIBS -lXss"
	AC_CHECK_LIB(Xss,XScreenSaverAllocInfo,SS_COMPILE_XSS_SUPPORT="true")
	LIBS="$SS_SAVED_LIBS"

	AC_MSG_CHECKING([for Xss support])

	if test "$SS_COMPILE_XSS_SUPPORT" = "false"; then
		AC_MSG_RESULT(disabled)
	else
		AC_MSG_RESULT(yes: lib is ok)
		AC_DEFINE([COMPILE_XSS_SUPPORT], 1, [define if you want to enable the ZLib library support])
		SS_LINK_TO_XSS="yes"
		SS_BUILD_FLAGS="$SS_BUILD_FLAGS"
	fi
])

dnl ###################################################################################################################
dnl ### Audiofile library
dnl ###################################################################################################################

AC_DEFUN([AC_SS_CHECK_AUDIOFILE],
[
	SS_LINK_TO_LIBAUDIOFILE="false"
	SS_DISABLE_AUDIOFILE_SUPPORT="true"
	SS_SAVED_LIBS=$LIBS
	LIBS="$LIBS -laudiofile"
	AC_CHECK_LIB(audiofile,afOpenFile,SS_DISABLE_AUDIOFILE_SUPPORT="false")

	if test "$SS_DISABLE_AUDIOFILE_SUPPORT" = "false"; then
		SS_DISABLE_AUDIOFILE_SUPPORT="true"
		AC_CHECK_LIB(audiofile,afGetVirtualFrameSize,SS_DISABLE_AUDIOFILE_SUPPORT="false")
	fi

	LIBS="$SS_SAVED_LIBS"

	if test "$SS_DISABLE_AUDIOFILE_SUPPORT" = "false"; then
		SS_DISABLE_AUDIOFILE_SUPPORT="true"
		AC_CHECK_HEADER(audiofile.h,SS_DISABLE_AUDIOFILE_SUPPORT="false")
	fi

	AC_MSG_CHECKING([for audiofile support])

	if test "$SS_DISABLE_AUDIOFILE_SUPPORT" = "true"; then
		AC_MSG_RESULT(missing header or libs or wrong version)
	else

		if test "$SS_HAS_OSS_SUPPORT" = "false"; then
			SS_DISABLE_AUDIOFILE_SUPPORT="true"
			AC_MSG_RESULT(no oss support at all)
		else
			AC_ARG_WITH(af-support, [  --without-af-support    Disable Audiofile library for playing files to OSS support], SS_DISABLE_AUDIOFILE_SUPPORT="true")

			if test "$SS_DISABLE_AUDIOFILE_SUPPORT" = "true"; then
				AC_MSG_RESULT(disabled by user)
			else
				AC_MSG_RESULT(yes: have libs and headers)
				AC_DEFINE([COMPILE_AUDIOFILE_SUPPORT], 1, [define if you want to enable the Audiofile library support])
				SS_LINK_TO_LIBAUDIOFILE="true"
				SS_BUILD_FLAGS="f$SS_BUILD_FLAGS"
			fi
		fi
	fi
])

dnl ###################################################################################################################
dnl ### ARTS
dnl ###################################################################################################################


AC_DEFUN([AC_SS_CHECK_ARTS],
[
	SS_LINK_TO_LIBARTS="false"
	SS_DISABLE_ARTS_SUPPORT="false"

	AC_MSG_CHECKING([if Arts support is requested])
	AC_ARG_WITH(arts-support, [  --without-arts-support   Disable Arts daemon support],SS_DISABLE_ARTS_SUPPORT="true")

	if test "$SS_KDE_REQUESTED" = "yes"; then
		if test "$SS_DISABLE_ARTS_SUPPORT" = "true"; then
			AC_MSG_RESULT(disabled by user)
		else
			AC_MSG_RESULT([yes])
			AC_MSG_CHECKING(if we can compile a simple Arts application)
			AC_LANG_CPLUSPLUS
			ss_save_CPPFLAGS="$CPPFLAGS"
			ss_save_CXXFLAGS="$CXXFLAGS"
			ss_save_LDFLAGS="$LDFLAGS"
			ss_save_LIBS="$LIBS"
			CPPFLAGS="-I$SS_X_INCDIR -I$SS_QT3_INCDIR -I$SS_KDE_INCDIR $CPPFLAGS $X_CFLAGS"
			CXXFLAGS="-O2 -Wall $CXXFLAGS"
			LIBS="-L$SS_KDE_LIBDIR -L$SS_X_LIBDIR $SS_X_LDFLAGS $SS_X_LIBLINK -L$SS_QT3_LIBDIR $LIBS -lsoundserver_idl -ltdecore -l$SS_TQTLIB_NAME -Wl,-rpath $SS_KDE_LIBDIR"
			if test "$SS_LINK_TO_LIBDL" = "yes"; then
				LIBS="$LIBS -ldl";
			fi
			LDFLAGS="-s $LDFLAGS"
			AC_TRY_LINK([
				#include <arts/soundserver.h>
			],[
				Arts::Dispatcher * d = new Arts::Dispatcher();
				Arts::SimpleSoundServer *server = new Arts::SimpleSoundServer(Arts::Reference("global:Arts_SimpleSoundServer"));
			],
			SS_ARTS_LINKED_OK="TRUE",
			SS_ARTS_LINKED_OK="FALSE"
			)
			if test "$SS_ARTS_LINKED_OK" = "FALSE"; then
				AC_MSG_RESULT(failed)
			else
				AC_MSG_RESULT(success)
				AC_DEFINE([COMPILE_ARTS_SUPPORT], 1, [define if you want to enable the Arts daemon support])
				SS_LINK_TO_LIBARTS="true"
				SS_BUILD_FLAGS="r$SS_BUILD_FLAGS"
			fi
			LIBS="$ss_save_LIBS"
			LDFLAGS="$ss_save_LDFLAGS"
			CXXFLAGS="$ss_save_CXXFLAGS"
			CPPFLAGS="$ss_save_CPPFLAGS"
		fi
	else
		SS_DISABLE_ARTS_SUPPORT="true"
		AC_MSG_RESULT([no KDE so no Arts])
	fi
])
		

dnl ###################################################################################################################
dnl ### INTERFACE ADDRESS STUFF
dnl ###################################################################################################################

AC_DEFUN([AC_SS_CHECK_IFADDR_STUFF],
[
	AC_MSG_CHECKING([if we can get interface addresses])

	AC_TRY_LINK([
			#include <stdio.h>
			#include <sys/ioctl.h>
			#include <net/if.h>
			#include <netinet/in.h>
			#include <arpa/inet.h>
			#include <string.h>
		],[
			struct ifreq ifr;
			int ret;
			struct sockaddr * sa;
			ret = IFNAMSIZ;
			ret = ioctl(ret,SIOCGIFADDR,&ifr);
			if(ifr.ifr_name != 0)sa = (struct sockaddr *)&(ifr.ifr_addr);
		],
			eval "SS_DISABLE_IFADDR=false"
		,
			eval "SS_DISABLE_IFADDR=true"
	)

	if test "$SS_DISABLE_IFADDR" = "true"; then
		AC_MSG_RESULT("no")
	else
		AC_MSG_RESULT("yes")
		AC_DEFINE([COMPILE_GET_INTERFACE_ADDRESS], 1, [define if you have the SIOCGIFADDR ioctl and the related headers])
	fi
])

dnl ###################################################################################################################
dnl ### PTHREAD
dnl ###################################################################################################################

AC_DEFUN([AC_SS_CHECK_THREAD_STUFF],
[
	SS_THREAD_LIBLINK=""

	AC_MSG_CHECKING([if you want to use the solaris lthread])
	SS_DO_IT="false"
	AC_ARG_WITH(solaris-lthread,      [  --with-solaris-lthread  Use the Solaris native libthread],SS_DO_IT="true")
	if test "$SS_DO_IT" = "true"; then
		AC_MSG_RESULT(yes)
		SS_THREAD_LIBLINK="-lthread"
		AC_DEFINE([COMPILE_THREADS_USE_SOLARIS_LIBTHREAD], 1, [define if you want to use the solaris libthread])
	else
		AC_MSG_RESULT(no)

		AC_MSG_CHECKING([if you want to use freebsd native pthread support])
		SS_DO_IT="false"

		AC_ARG_WITH(freebsd-pthread,      [  --with-freebsd-pthread  Use the FreeBSD native libc_r for threading],SS_DO_IT="true")
		if test "$SS_DO_IT" = "true"; then
			AC_MSG_RESULT(yes)
			SS_THREAD_LIBLINK="-pthread"
			AC_DEFINE([COMPILE_THREADS_USE_POSIX], 1, [define if you want to use the pthreads library])
		else
			AC_MSG_RESULT(no..using lpthread)
			SS_THREAD_LIBLINK="-lpthread"
			AC_DEFINE([COMPILE_THREADS_USE_POSIX], 1, [define if you want to use the pthreads library])
		fi

		AC_MSG_CHECKING([if your pthread implementation works])
		SS_DO_IT="false"
		AC_ARG_WITH(no-pthread-check,      [  --with-no-pthread-check Do not check if pthreads stuff compiles],SS_DO_IT="true")

		if test "$SS_DO_IT" = "true"; then
			AC_MSG_RESULT(yes, trusting you)
		else
			SS_SAVE_LIBS="$LIBS"
			LIBS="$SS_THREAD_LIBLINK"
			AC_TRY_LINK([
					#include <pthread.h>
				],[
					pthread_mutex_lock(0);
				],
					eval "SS_PTHREAD_OK=yes"
				,
					eval "SS_PTHREAD_OK=no"
				)
			LIBS="$SS_SAVE_LIBS"
	
			if test "$SS_PTHREAD_OK" = "yes"; then
				AC_MSG_RESULT(yes, it seems to)
			else
				AC_MSG_RESULT(["FAILED"])
				AC_SS_SET_REDINK
				if test "$SS_THREAD_LIBLINK" = "-pthread"; then
					echo "################################################################################"
					echo "### CONFIGURE ERROR:"
					echo "###  Failed to compile the pthread test program."
					echo "###  You have specified to use the native FreeBSD libc_r for threading"
					echo "###  but it looks that this does not work."
					echo "###  Make sure that you have libc_r floating around your system"
					echo "###  and that the -pthread special gcc flag works."
					echo "###  (You need to use the native FreeBSD gcc compiler for this to work)"
					echo "################################################################################"
				else
					echo "################################################################################"
					echo "### CONFIGURE ERROR:"
					echo "###  Failed to compile the pthread test program."
					echo "###  It looks that you either don't have libpthread installed or"
					echo "###  it is not reachable by the linker."
					echo "###  Make sure that libpthread is in /lib or /usr/lib."
					echo "###  If you're on solaris you might try the --with-solaris-lthread"
					echo "###  configure option. If you're on FreeBSD you should use"
					echo "###  --with-freebsd-pthread."
					echo "###  Good luck :)"
					echo "################################################################################"
				fi
				AC_SS_SET_NORMALINK
				AC_MSG_ERROR(["This was fatal...aborting"])
			fi
		fi
	fi
])

dnl ###################################################################################################################
dnl ### X
dnl ###################################################################################################################


AC_DEFUN([AC_SS_FIND_X],
[
	SS_DISABLE_X_SUPPORT="false"

	AC_MSG_CHECKING([if you want to ignore X at all])
	AC_ARG_ENABLE(x-support, [  --disable-x-support   Ignore X Windows completely],SS_DISABLE_X_SUPPORT="true")

	if test $SS_DISABLE_X_SUPPORT = "true"; then
		AC_DEFINE([COMPILE_NO_X], 1, [define if you want to ignore X Windows completely])
 		SS_X_INCDIR="/usr/include"
		SS_X_LIBDIR="/usr/lib"
		SS_X_LDFLAGS=""
		SS_X_CPPFLAGS=""
		SS_X_LIBLINK=""
		AC_MSG_RESULT(yes)
	else
		AC_MSG_RESULT(no, proceeding with checks)
		AC_PATH_XTRA
	
		if test -n "$no_x"; then
			AC_SS_SET_REDINK
			echo "################################################################################"
			echo "### CONFIGURE ERROR:"
			echo "### Can not find the X libraries."
			echo "### Make sure that X is installed on your system and try to run configure again,"
			echo "### this time passing the --x-includes and --x-libraries options."
			echo "### You may also take a look at the config.log file in this directory,"
			echo "### that will tell you which checks have failed and maybe more about the"
			echo "### reason of the failure."
			echo "###"
			echo "### If you use an environment that does not require X support such as Qt-Mac"
			echo "### you may try to rerun configure with --disable-x-support"
			echo "################################################################################"
			AC_SS_SET_NORMALINK
			AC_MSG_ERROR([This was a fatal one...aborting])
		else
			# Set the X include and lib dir
	 		SS_X_INCDIR="$x_includes"
			SS_X_LIBDIR="$x_libraries"
			SS_X_LIBLINK="-lX11 -lXext"
	
			if test -z "$SS_X_INCDIR"; then
				# Ops... X headers not found ?
				AC_TRY_COMPILE([
						#include <X11/Xlib.h>
					],[
						Display * d = XOpenDisplay(0);
						XCloseDisplay(d);
					],
						eval "ss_x_incdir_found=yes"
					,
						eval "ss_x_incdir_found=no"
					)
	
				if test "$ss_x_incdir_found" = "no"; then
					AC_SS_SET_REDINK
					echo "################################################################################"
					echo "### CONFIGURE ERROR:"
					echo "### Can not find the X headers."
					echo "### Possible reasons:"
					echo "###   1) You miss the X server development files (Xlib.h for example)"
					echo "###"
					echo "###   2) Autoconf/Automake wasn't able to find the headers"
					echo "###      for some ugly reason."
					echo "###"
					echo "### You might try looking for a file named Xlib.h in your hard-drive"
					echo "### and try passing the --x-includes option to ./configure"
					echo "### Remember that if you find Xlib.h in /somepath/include/X11/Xlib.h"
					echo "### Then you must pass --x-includes=/somepath/include to ./configure"
					echo "### For example, my Xlib.h is in /usr/X11R6/include/X11/Xlib.h"
					echo "### then i would try: ./configure --x-includes=/usr/X11R6/include"
					echo "### If you can't find Xlib.h on your hard drive then install the X-devel"
					echo "### package from your distribution."
					echo "### If Xlib.h is there and --x-includes doesn't help, well , there is something"
					echo "### wrong with X , autoconf or automake."
					echo "### You may also take a look at the config.log file in this directory,"
					echo "### that will tell you which checks have failed and maybe more about the"
					echo "### reason of the failure."
					echo "###"
					echo "### If you use an environment that does not require X support such as Qt-Mac"
					echo "### you may try to rerun configure with --disable-x-support"
					echo "################################################################################"
					AC_SS_SET_NORMALINK
					AC_MSG_ERROR([This was a fatal one...aborting])
				else
					# We can compile X programs without any additional path... use a dummy include path then
					# Should we print a warning ?
					SS_X_INCDIR="/usr/include"
				fi
			fi
	
	
			if test -z "$SS_X_LIBDIR"; then
				# Ops... X libs not found ?
				SS_SAVE_LIBS="$LIBS"
				SS_SAVE_CFLAGS="$CFLAGS"
				SS_SAVE_CPPFLAGS="$CPPFLAGS"
				SS_SAVE_CXXFLAGS="$CXXFLAGS"
	
				CFLAGS="-I$SS_X_INCDIR"
				CPPFLAGS="$CFLAGS"
				CXXFLAGS="$CFLAGS"
				LIBS="$SS_X_LIBLINK"
				AC_TRY_LINK([
						#include <X11/Xlib.h>
					],[
						Display * d = XOpenDisplay(0);
						XCloseDisplay(d);
					],
						eval "ss_x_libdir_found=yes"
					,
						eval "ss_x_libdir_found=no"
					)
				LIBS="$SS_SAVE_LIBS"
				CFLAGS="$SS_SAVE_CFLAGS"
				CPPFLAGS="$SS_SAVE_CPPFLAGS"
				CXXFLAGS="$SS_SAVE_CXXFLAGS"
	
				if test "$ss_x_libdir_found" = "no"; then
					AC_SS_SET_REDINK
					echo "################################################################################"
					echo "### CONFIGURE ERROR:"
					echo "### Can not find the X libraries."
					echo "### Possible reasons:"
					echo "###   1) You have no X server : KVIrc can't run on this system"
					echo "###"
					echo "###   2) Autoconf/Automake wasn't able to find the libraries"
					echo "###      for some ugly reason."
					echo "###"
					echo "### You might try looking for a file named libX11.so in your hard-drive"
					echo "### and try passing the --x-libraries option to ./configure"
					echo "### Remember that if you find libX11.so in /somepath/lib/libX11.so"
					echo "### Then you must pass --x-libraries=/somepath/lib to ./configure"
					echo "### For example, my libX11.so is in /usr/X11R6/lib/libX11.so"
					echo "### then i would try: ./configure --x-libraries=/usr/X11R6/lib"
					echo "### If you can't find libX11.so on your hard drive then install the X server"
					echo "### package from your distribution."
					echo "### If libX11.so is there and --x-libraries doesn't help, well , there is something"
					echo "### wrong with X , autoconf or automake."
					echo "### You may also take a look at the config.log file in this directory,"
					echo "### that will tell you which checks have failed and maybe more about the"
					echo "### reason of the failure."
					echo "###"
					echo "### If you use an environment that does not require X support such as Qt-Mac"
					echo "### you may try to rerun configure with --disable-x-support"
					echo "################################################################################"
					AC_SS_SET_NORMALINK
					AC_MSG_ERROR([This was a fatal one...aborting])
				else
					# We can link X programs without any additional path... use a dummy lib path then
					# Should we print a warning ?
					SS_X_LIBDIR="/usr/lib"
				fi
			fi

			# Add any extra libs needed
			SS_X_LDFLAGS=""

			if test -n "$X_PRE_LIBS"; then
				SS_X_LDFLAGS="$X_PRE_LIBS $SS_X_LDFLAGS"
			fi

			if test -n "$X_EXTRA_LIBS"; then
				SS_X_LDFLAGS="$SS_X_LDFLAGS $X_EXTRA_LIBS"
			fi

			if test -n "$X_LIBS"; then
				SS_X_LDFLAGS="$SS_X_LDFLAGS $X_LIBS"
			fi
	
			# Add any extra gcc flags
			SS_X_CPPFLAGS=$X_CFLAGS
		fi
	fi
])

dnl ###################################################################################################################
dnl ### QT
dnl ###################################################################################################################

AC_DEFUN([AC_SS_FIND_QT],
[
	AC_ARG_ENABLE(qt-check,
			AC_HELP_STRING([--disable-qt-check],[Do not check if Qt and X compile]),
			SS_CHECK_QTX_COMPILE="$withval",SS_CHECK_QTX_COMPILE="NOTGIVEN")

	AC_ARG_ENABLE(qt4,
			AC_HELP_STRING([--enable-qt4],[Enable WORK IN PROGRESS Qt4 support]),
			SS_USE_QT4="$withval",SS_USE_QT4="no")
	
	if test "$SS_USE_QT4" = "no"; then

		AC_SS_FIND_QT3_NAME
		AC_SS_FIND_QT3_GENERAL_DIR
		AC_SS_FIND_QT3_LIBRARY_DIR
		AC_SS_FIND_QT3_INCLUDE_DIR
		AC_SS_FIND_QT3_MOC
		AC_SS_FIND_QT3_MT

	 	if test "$SS_CHECK_QTX_COMPILE" = "NOTGIVEN"; then
			AC_SS_ENSURE_CAN_COMPILE_X_AND_QT3
		fi
	else
		
		AC_SS_FIND_QT4_GENERAL_DIR
		AC_SS_FIND_QT4_LIBRARY_DIR
		AC_SS_FIND_QT4_INCLUDE_DIR
		AC_SS_FIND_QT4_MOC


	 	if test "$SS_CHECK_QTX_COMPILE" = "NOTGIVEN"; then
			AC_SS_ENSURE_CAN_COMPILE_X_AND_QT4
		fi

	fi
])

AC_DEFUN([AC_SS_FIND_QT3_NAME],
[
	AC_MSG_CHECKING([for the Qt library name])
	AC_ARG_WITH(qt-name,[  --with-qt-name=NAME     Use NAME instead of \"qt\" as Qt library name],SS_TQTLIB_NAME="$withval",SS_TQTLIB_NAME="qt")
	AC_MSG_RESULT("$SS_TQTLIB_NAME")
])

AC_DEFUN([AC_SS_FIND_QT3_GENERAL_DIR],
[
	AC_MSG_CHECKING([for the general Qt3.x directory])

	ss_qt_general_test_dirs="/usr/local /usr /usr/X11R6 /usr/lib /opt /opt/kde /kde /usr/kde /usr/build /usr/src /usr/local/lib /"
	ss_qt_general_test_dirs="$ss_qt_general_test_dirs /usr/local/kde /usr/opt/kde"

	if test -n "$HOME"; then
		ss_qt_general_test_dirs="$ss_qt_general_test_dirs $HOME $HOME/lib"
	fi

	if test -n "$TQTDIR"; then
		ss_qt_general_test_dirs="$TQTDIR $ss_qt_general_test_dirs"
	fi

	ss_qt_general_test_path_suffix="qt$SS_QT3_MAJOR_VERSION_REQUIRED.$SS_QT3_MINOR_VERSION_REQUIRED.$SS_QT3_PATCH_LEVEL_REQUIRED"
	ss_qt_general_test_path_suffix="$ss_qt_general_test_path_suffix qt.$SS_QT3_MAJOR_VERSION_REQUIRED.$SS_QT3_MINOR_VERSION_REQUIRED.$SS_QT3_PATCH_LEVEL_REQUIRED"
	ss_qt_general_test_path_suffix="$ss_qt_general_test_path_suffix qt.$SS_QT3_MAJOR_VERSION_REQUIRED$SS_QT3_MINOR_VERSION_REQUIRED$SS_QT3_PATCH_LEVEL_REQUIRED"
	ss_qt_general_test_path_suffix="$ss_qt_general_test_path_suffix qt-$SS_QT3_MAJOR_VERSION_REQUIRED.$SS_QT3_MINOR_VERSION_REQUIRED.$SS_QT3_PATCH_LEVEL_REQUIRED"
	ss_qt_general_test_path_suffix="$ss_qt_general_test_path_suffix qt-$SS_QT3_MAJOR_VERSION_REQUIRED$SS_QT3_MINOR_VERSION_REQUIRED$SS_QT3_PATCH_LEVEL_REQUIRED"
	ss_qt_general_test_path_suffix="$ss_qt_general_test_path_suffix qt$SS_QT3_MAJOR_VERSION_REQUIRED.$SS_QT3_MINOR_VERSION_REQUIRED"
	ss_qt_general_test_path_suffix="$ss_qt_general_test_path_suffix qt.$SS_QT3_MAJOR_VERSION_REQUIRED.$SS_QT3_MINOR_VERSION_REQUIRED"
	ss_qt_general_test_path_suffix="$ss_qt_general_test_path_suffix qt.$SS_QT3_MAJOR_VERSION_REQUIRED$SS_QT3_MINOR_VERSION_REQUIRED"
	ss_qt_general_test_path_suffix="$ss_qt_general_test_path_suffix qt-$SS_QT3_MAJOR_VERSION_REQUIRED.$SS_QT3_MINOR_VERSION_REQUIRED"
	ss_qt_general_test_path_suffix="$ss_qt_general_test_path_suffix qt-$SS_QT3_MAJOR_VERSION_REQUIRED$SS_QT3_MINOR_VERSION_REQUIRED"
	ss_qt_general_test_path_suffix="$ss_qt_general_test_path_suffix qt$SS_QT3_MAJOR_VERSION_REQUIRED"
	ss_qt_general_test_path_suffix="$ss_qt_general_test_path_suffix qt.$SS_QT3_MAJOR_VERSION_REQUIRED"
	ss_qt_general_test_path_suffix="$ss_qt_general_test_path_suffix qt-$SS_QT3_MAJOR_VERSION_REQUIRED"
	ss_qt_general_test_path_suffix="$ss_qt_general_test_path_suffix lib"
	ss_qt_general_test_path_suffix="$ss_qt_general_test_path_suffix qt ."

	AC_SS_FIND_FILE_PATH_EXT($SS_TQT3_GENERAL_FILE_TO_SEARCH,$ss_qt_general_test_dirs,$ss_qt_general_test_path_suffix,SS_QT3_GENERAL_DIR)
	if test "$SS_QT3_GENERAL_DIR" = "FAILED"; then
		AC_SS_FIND_FILE_PATH_EXT($SS_QT3_GENERAL_FILE_TO_SEARCH,$ss_qt_general_test_dirs,$ss_qt_general_test_path_suffix,SS_QT3_GENERAL_DIR)
		if test "$SS_QT3_GENERAL_DIR" = "FAILED"; then
			AC_MSG_RESULT([failed...continuing with normal checks])
			unset SS_QT3_GENERAL_DIR
		else
			AC_MSG_RESULT([Seems to be $SS_QT3_GENERAL_DIR])
		fi
	else
		AC_MSG_RESULT([Seems to be $SS_QT3_GENERAL_DIR])
	fi
])

AC_DEFUN([AC_SS_FIND_QT4_GENERAL_DIR],
[
	AC_MSG_CHECKING([for the general Qt4.x directory])

	ss_qt_general_test_dirs="/usr/local /usr /usr/X11R6 /usr/lib /opt /opt/kde /kde /usr/kde /usr/build /usr/src /usr/local/lib /"
	ss_qt_general_test_dirs="$ss_qt_general_test_dirs /usr/local/kde /usr/opt/kde /usr/lib/qt4 /usr/local/lib/qt4"

	if test -n "$HOME"; then
		ss_qt_general_test_dirs="$ss_qt_general_test_dirs $HOME $HOME/lib"
	fi

	if test -n "$TQTDIR"; then
		ss_qt_general_test_dirs="$TQTDIR $ss_qt_general_test_dirs"
	fi

	ss_qt_general_test_path_suffix="qt$SS_QT4_MAJOR_VERSION_REQUIRED.$SS_QT4_MINOR_VERSION_REQUIRED.$SS_QT4_PATCH_LEVEL_REQUIRED"
	ss_qt_general_test_path_suffix="$ss_qt_general_test_path_suffix qt.$SS_QT4_MAJOR_VERSION_REQUIRED.$SS_QT4_MINOR_VERSION_REQUIRED.$SS_QT4_PATCH_LEVEL_REQUIRED"
	ss_qt_general_test_path_suffix="$ss_qt_general_test_path_suffix qt.$SS_QT4_MAJOR_VERSION_REQUIRED$SS_QT4_MINOR_VERSION_REQUIRED$SS_QT4_PATCH_LEVEL_REQUIRED"
	ss_qt_general_test_path_suffix="$ss_qt_general_test_path_suffix qt-$SS_QT4_MAJOR_VERSION_REQUIRED.$SS_QT4_MINOR_VERSION_REQUIRED.$SS_QT4_PATCH_LEVEL_REQUIRED"
	ss_qt_general_test_path_suffix="$ss_qt_general_test_path_suffix qt-$SS_QT4_MAJOR_VERSION_REQUIRED$SS_QT4_MINOR_VERSION_REQUIRED$SS_QT4_PATCH_LEVEL_REQUIRED"
	ss_qt_general_test_path_suffix="$ss_qt_general_test_path_suffix qt$SS_QT4_MAJOR_VERSION_REQUIRED.$SS_QT4_MINOR_VERSION_REQUIRED"
	ss_qt_general_test_path_suffix="$ss_qt_general_test_path_suffix qt.$SS_QT4_MAJOR_VERSION_REQUIRED.$SS_QT4_MINOR_VERSION_REQUIRED"
	ss_qt_general_test_path_suffix="$ss_qt_general_test_path_suffix qt.$SS_QT4_MAJOR_VERSION_REQUIRED$SS_QT4_MINOR_VERSION_REQUIRED"
	ss_qt_general_test_path_suffix="$ss_qt_general_test_path_suffix qt-$SS_QT4_MAJOR_VERSION_REQUIRED.$SS_QT4_MINOR_VERSION_REQUIRED"
	ss_qt_general_test_path_suffix="$ss_qt_general_test_path_suffix qt-$SS_QT4_MAJOR_VERSION_REQUIRED$SS_QT4_MINOR_VERSION_REQUIRED"
	ss_qt_general_test_path_suffix="$ss_qt_general_test_path_suffix qt$SS_QT4_MAJOR_VERSION_REQUIRED"
	ss_qt_general_test_path_suffix="$ss_qt_general_test_path_suffix qt.$SS_QT4_MAJOR_VERSION_REQUIRED"
	ss_qt_general_test_path_suffix="$ss_qt_general_test_path_suffix qt-$SS_QT4_MAJOR_VERSION_REQUIRED"
	ss_qt_general_test_path_suffix="$ss_qt_general_test_path_suffix lib"
	ss_qt_general_test_path_suffix="$ss_qt_general_test_path_suffix qt ."

	AC_SS_FIND_FILE_PATH_EXT($SS_QT4_GENERAL_FILE_TO_SEARCH,$ss_qt_general_test_dirs,$ss_qt_general_test_path_suffix,SS_QT4_GENERAL_DIR)
	if test "$SS_QT4_GENERAL_DIR" = "FAILED"; then
		AC_MSG_RESULT([failed...continuing with normal checks])
		unset SS_QT4_GENERAL_DIR
	else
		AC_MSG_RESULT([Seems to be $SS_QT4_GENERAL_DIR])
	fi
])


AC_DEFUN([AC_SS_FIND_QT3_INCLUDE_DIR],
[
	AC_ARG_WITH(qt-include-dir,[  --with-qt-include-dir   path to the Qt 3.x headers ],SS_QT3_INCDIR="$withval",SS_QT3_INCDIR="NOTGIVEN")
	if test "$SS_QT3_INCDIR" = "NOTGIVEN"; then

		AC_MSG_CHECKING([for the Qt 3.x header files])

		ss_qt_include_test_dirs="$SS_QT3_GENERAL_DIR/include /include /usr/include /usr/local/include /usr/qt/include /usr/local/qt/include /usr/X11R6/include /usr/lib/qt/include /usr/lib/qt /usr/include/X11"
		test -n "$TQTDIR" && ss_qt_include_test_dirs="$TQTDIR/include $TQTDIR $ss_qt_include_test_dirs"
		ss_qt_include_test_dirs="$ss_qt_include_test_dirs /usr/include/qt /usr/include/tqt3 /usr/include/qt3 /usr/local/include/qt /include/qt /usr/X11R6/include/qt /usr/build/qt/include"
		ss_qt_include_test_dirs="$ss_qt_include_test_dirs /usr/include/tqt$SS_QT3_MAJOR_VERSION_REQUIRED /usr/include/qt$SS_QT3_MAJOR_VERSION_REQUIRED /usr/include/qt-$SS_QT3_MAJOR_VERSION_REQUIRED /usr/local/include/qt$SS_QT3_MAJOR_VERSION_REQUIRED"
		ss_qt_include_test_dirs="$ss_qt_include_test_dirs /include/tqt$SS_QT3_MAJOR_VERSION_REQUIRED /include/qt$SS_QT3_MAJOR_VERSION_REQUIRED /usr/X11R6/include/qt$SS_QT3_MAJOR_VERSION_REQUIRED"
		ss_qt_include_test_dirs="$ss_qt_include_test_dirs /usr/include/X11/qt$SS_QT3_MAJOR_VERSION_REQUIRED /opt/qt /opt/kde/qt"

		AC_SS_FIND_FILE_PATH($SS_TQT3_INCLUDE_FILE_TO_SEARCH,$ss_qt_include_test_dirs,SS_QT3_INCDIR)

		if test "$SS_QT3_INCDIR" = "FAILED"; then
			AC_SS_FIND_FILE_PATH($SS_QT3_INCLUDE_FILE_TO_SEARCH,$ss_qt_include_test_dirs,SS_QT3_INCDIR)
		fi

		if test "$SS_QT3_INCDIR" = "FAILED"; then

			dnl HACK HACK HACK

			ss_qt_include_test_dirs="$SS_QT4_GENERAL_DIR/include /include /usr/include /usr/local/include /usr/qt/include /usr/include/qt4 /usr/qt4/include /usr/local/qt/include /usr/X11R6/include /usr/lib/qt/include /usr/lib/qt /usr/include/X11"
			test -n "$TQTDIR" && ss_qt_include_test_dirs="$TQTDIR/include $TQTDIR $ss_qt_include_test_dirs"
			ss_qt_include_test_dirs="$ss_qt_include_test_dirs /usr/include/qt /usr/include/qt4 /usr/local/include/qt /include/qt /usr/X11R6/include/qt /usr/build/qt/include"
			ss_qt_include_test_dirs="$ss_qt_include_test_dirs /usr/include/qt$SS_QT4_MAJOR_VERSION_REQUIRED /usr/include/qt-$SS_QT4_MAJOR_VERSION_REQUIRED /usr/local/include/qt$SS_QT4_MAJOR_VERSION_REQUIRED"
			ss_qt_include_test_dirs="$ss_qt_include_test_dirs /include/qt$SS_QT4_MAJOR_VERSION_REQUIRED /usr/X11R6/include/qt$SS_QT4_MAJOR_VERSION_REQUIRED"
			ss_qt_include_test_dirs="$ss_qt_include_test_dirs /usr/include/X11/qt$SS_QT4_MAJOR_VERSION_REQUIRED /opt/qt /opt/kde/qt"

			AC_SS_FIND_FILE_PATH($SS_QT4_INCLUDE_FILE_TO_SEARCH,$ss_qt_include_test_dirs,SS_QT4_INCDIR)

			SS_QT3_INCDIR="$SS_QT4_INCDIR -I/usr/include/tqt -include tqt.h"
			AC_MSG_RESULT([TQt4 detected--Qt4 found in $SS_QT3_INCDIR])

dnl			AC_MSG_RESULT([FAILED])
dnl			AC_SS_SET_REDINK
dnl			echo "################################################################################"
dnl			echo "### CONFIGURE ERROR:"
dnl			echo "### Can not find the qt 3.x header files."
dnl			echo "### Make sure that qt is correctly installed on your system,"
dnl			echo "### and the qt version is the one requested by this version of kvirc."
dnl			echo "### Try to run configure again, this time passing the --with-qt-include-dir"
dnl			echo "### option (see ./configure --help)."
dnl			echo "### You may also take a look at the config.log file in this directory,"
dnl			echo "### that will tell you which check has failed and maybe more about the reason"
dnl			echo "### of the failure."
dnl			echo "### If you're feeling that this may be a bug in this configure script"
dnl			echo "### and want to report this to me , please include your configure script,"
dnl			echo "### the config.log file as well as the complete configure output."
dnl			echo "################################################################################"
dnl			AC_SS_SET_NORMALINK
dnl			AC_MSG_ERROR([This was a fatal one...aborting])
		else
			SS_QT3_INCDIR="$SS_QT3_INCDIR -I/usr/include/tqt -include tqt.h"

			AC_MSG_RESULT([found in $SS_QT3_INCDIR])
		fi

	else
		AC_MSG_RESULT([using user supplied path for the Qt 3.x include files $SS_QT3_INCDIR])
		SS_QT3_INCDIR="$SS_QT3_INCDIR -I/usr/include/tqt -include tqt.h"
	fi
])


AC_DEFUN([AC_SS_FIND_QT4_INCLUDE_DIR],
[
	AC_ARG_WITH(qt4-include-dir,[  --with-qt4-include-dir   path to the Qt 4.x headers ],SS_QT4_INCDIR="$withval",SS_QT4_INCDIR="NOTGIVEN")
	if test "$SS_QT4_INCDIR" = "NOTGIVEN"; then

		AC_MSG_CHECKING([for the Qt 4.x header files])

		ss_qt_include_test_dirs="$SS_QT4_GENERAL_DIR/include /include /usr/include /usr/local/include /usr/qt/include /usr/include/qt4 /usr/qt4/include /usr/local/qt/include /usr/X11R6/include /usr/lib/qt/include /usr/lib/qt /usr/include/X11"
		test -n "$TQTDIR" && ss_qt_include_test_dirs="$TQTDIR/include $TQTDIR $ss_qt_include_test_dirs"
		ss_qt_include_test_dirs="$ss_qt_include_test_dirs /usr/include/qt /usr/include/qt4 /usr/local/include/qt /include/qt /usr/X11R6/include/qt /usr/build/qt/include"
		ss_qt_include_test_dirs="$ss_qt_include_test_dirs /usr/include/qt$SS_QT4_MAJOR_VERSION_REQUIRED /usr/include/qt-$SS_QT4_MAJOR_VERSION_REQUIRED /usr/local/include/qt$SS_QT4_MAJOR_VERSION_REQUIRED"
		ss_qt_include_test_dirs="$ss_qt_include_test_dirs /include/qt$SS_QT4_MAJOR_VERSION_REQUIRED /usr/X11R6/include/qt$SS_QT4_MAJOR_VERSION_REQUIRED"
		ss_qt_include_test_dirs="$ss_qt_include_test_dirs /usr/include/X11/qt$SS_QT4_MAJOR_VERSION_REQUIRED /opt/qt /opt/kde/qt"

		AC_SS_FIND_FILE_PATH($SS_QT4_INCLUDE_FILE_TO_SEARCH,$ss_qt_include_test_dirs,SS_QT4_INCDIR)

		if test "$SS_QT4_INCDIR" = "FAILED"; then
			AC_MSG_RESULT([FAILED])
			AC_SS_SET_REDINK
			echo "################################################################################"
			echo "### CONFIGURE ERROR:"
			echo "### Can not find the qt 4.x header files."
			echo "### Make sure that qt is correctly installed on your system,"
			echo "### and the qt version is the one requested by this version of kvirc."
			echo "### Try to run configure again, this time passing the --with-qt4-include-dir"
			echo "### option (see ./configure --help)."
			echo "### You may also take a look at the config.log file in this directory,"
			echo "### that will tell you which check has failed and maybe more about the reason"
			echo "### of the failure."
			echo "### If you're feeling that this may be a bug in this configure script"
			echo "### and want to report this to me , please include your configure script,"
			echo "### the config.log file as well as the complete configure output."
			echo "################################################################################"
			AC_SS_SET_NORMALINK
			AC_MSG_ERROR([This was a fatal one...aborting])
		else
			AC_MSG_RESULT([found in $SS_QT4_INCDIR])
		fi

	else
		AC_MSG_RESULT([using user supplied path for the Qt 4.x include files $SS_QT4_INCDIR])
	fi
	
	SS_QT4_INCDIRECTORIES="-I$SS_QT4_INCDIR -I$SS_QT4_INCDIR/Qt/ -I$SS_QT4_INCDIR/QtCore/ -I$SS_QT4_INCDIR/QtGui/";
])


AC_DEFUN([AC_SS_FIND_QT3_LIBRARY_DIR],
[
	AC_ARG_WITH(qt-library-dir,[  --with-qt-library-dir   path to the Qt 3.x library ],SS_QT3_LIBDIR="$withval",SS_QT3_LIBDIR="NOTGIVEN")
	if test "$SS_QT3_LIBDIR" = "NOTGIVEN"; then
		AC_MSG_CHECKING([for the Qt library])

		ss_qt_library_test_dirs="$SS_QT3_GENERAL_DIR/lib /lib /usr/lib /usr/local/lib /usr/qt/lib /usr/local/qt/lib /usr/X11R6/lib /usr/lib/qt/lib /usr/lib/qt /usr/local/lib/qt/lib"
		test -n "$TQTDIR" && ss_qt_library_test_dirs="$TQTDIR/lib $TQTDIR $ss_qt_library_test_dirs"
		ss_qt_library_test_dirs="$ss_qt_library_test_dirs /usr/local/lib/qt /usr/X11R6/lib/qt /usr/build/qt/lib /opt/lib /opt/qt/lib"

		ss_qt_libs_to_find="lib$SS_TQTLIB_NAME-mt.so.$SS_QT3_MAJOR_VERSION_REQUIRED.$SS_QT3_MINOR_VERSION_REQUIRED.$SS_QT3_PATCH_LEVEL_REQUIRED"
		ss_qt_libs_to_find="$ss_qt_libs_to_find lib$SS_TQTLIB_NAME-mt.so.$SS_QT3_MAJOR_VERSION_REQUIRED.$SS_QT3_MINOR_VERSION_REQUIRED"
		ss_qt_libs_to_find="$ss_qt_libs_to_find lib$SS_TQTLIB_NAME-mt.so.$SS_QT3_MAJOR_VERSION_REQUIRED"
		ss_qt_libs_to_find="$ss_qt_libs_to_find lib$SS_TQTLIB_NAME-mt.so"
		ss_qt_libs_to_find="$ss_qt_libs_to_find lib$SS_TQTLIB_NAME.so.$SS_QT3_MAJOR_VERSION_REQUIRED.$SS_QT3_MINOR_VERSION_REQUIRED.$SS_QT3_PATCH_LEVEL_REQUIRED"
		ss_qt_libs_to_find="$ss_qt_libs_to_find lib$SS_TQTLIB_NAME.so.$SS_QT3_MAJOR_VERSION_REQUIRED.$SS_QT3_MINOR_VERSION_REQUIRED"
		ss_qt_libs_to_find="$ss_qt_libs_to_find lib$SS_TQTLIB_NAME.so.$SS_QT3_MAJOR_VERSION_REQUIRED"
		ss_qt_libs_to_find="$ss_qt_libs_to_find lib$SS_TQTLIB_NAME.so"
		ss_qt_libs_to_find="$ss_qt_libs_to_find lib$SS_TQTLIB_NAME-mt.$SS_QT3_MAJOR_VERSION_REQUIRED.$SS_QT3_MINOR_VERSION_REQUIRED.$SS_QT3_PATCH_LEVEL_REQUIRED.dylib"
		ss_qt_libs_to_find="$ss_qt_libs_to_find lib$SS_TQTLIB_NAME-mt.$SS_QT3_MAJOR_VERSION_REQUIRED.$SS_QT3_MINOR_VERSION_REQUIRED.dylib"
		ss_qt_libs_to_find="$ss_qt_libs_to_find lib$SS_TQTLIB_NAME-mt.$SS_QT3_MAJOR_VERSION_REQUIRED.dylib"
		ss_qt_libs_to_find="$ss_qt_libs_to_find lib$SS_TQTLIB_NAME-mt.dylib"
		ss_qt_libs_to_find="$ss_qt_libs_to_find lib$SS_TQTLIB_NAME.$SS_QT3_MAJOR_VERSION_REQUIRED.$SS_QT3_MINOR_VERSION_REQUIRED.$SS_QT3_PATCH_LEVEL_REQUIRED.dylib"
		ss_qt_libs_to_find="$ss_qt_libs_to_find lib$SS_TQTLIB_NAME.$SS_QT3_MAJOR_VERSION_REQUIRED.$SS_QT3_MINOR_VERSION_REQUIRED.dylib"
		ss_qt_libs_to_find="$ss_qt_libs_to_find lib$SS_TQTLIB_NAME.$SS_QT3_MAJOR_VERSION_REQUIRED.dylib"
		ss_qt_libs_to_find="$ss_qt_libs_to_find lib$SS_TQTLIB_NAME.dylib"
		ss_qt_libs_to_find="$ss_qt_libs_to_find lib$SS_TQTLIB_NAME-mt.a"
		ss_qt_libs_to_find="$ss_qt_libs_to_find lib$SS_TQTLIB_NAME.a"

		AC_SS_FIND_FILE_PATH($ss_qt_libs_to_find,$ss_qt_library_test_dirs,SS_QT3_LIBDIR)

		if test "$SS_QT3_LIBDIR" = "FAILED"; then

			dnl HACK HACK HACK

			AC_MSG_CHECKING([for the Qt 4.x libraries])

			ss_qt_library_test_dirs="$SS_QT4_GENERAL_DIR/lib /lib /usr/lib /usr/local/lib /usr/qt/lib /usr/local/qt/lib /usr/X11R6/lib /usr/lib/qt/lib /usr/lib/qt /usr/local/lib/qt/lib"
			test -n "$TQTDIR" && ss_qt_library_test_dirs="$TQTDIR/lib $TQTDIR $ss_qt_library_test_dirs"
			ss_qt_library_test_dirs="$ss_qt_library_test_dirs /usr/local/lib/qt /usr/X11R6/lib/qt /usr/build/qt/lib /opt/lib /opt/qt/lib"
			ss_qt_library_test_dirs="$ss_qt_library_test_dirs /usr/lib/qt4 /usr/local/lib/qt4 /usr/X11R6/lib/qt4"
			ss_qt_library_test_dirs="$ss_qt_library_test_dirs /usr/build/qt4/lib /opt/qt4/lib"

			ss_qt_libs_to_find="libQtCore.so.$SS_QT4_MAJOR_VERSION_REQUIRED.$SS_QT4_MINOR_VERSION_REQUIRED.$SS_QT4_PATCH_LEVEL_REQUIRED"
			ss_qt_libs_to_find="$ss_qt_libs_to_find libQtCore.so.$SS_QT4_MAJOR_VERSION_REQUIRED.$SS_QT4_MINOR_VERSION_REQUIRED"
			ss_qt_libs_to_find="$ss_qt_libs_to_find libQtCore.so.$SS_QT4_MAJOR_VERSION_REQUIRED"
			ss_qt_libs_to_find="$ss_qt_libs_to_find libQtCore.so"
			ss_qt_libs_to_find="$ss_qt_libs_to_find libQtCore.so.$SS_QT4_MAJOR_VERSION_REQUIRED.$SS_QT4_MINOR_VERSION_REQUIRED.dylib"
			ss_qt_libs_to_find="$ss_qt_libs_to_find libQtCore.so.$SS_QT4_MAJOR_VERSION_REQUIRED.dylib"
			ss_qt_libs_to_find="$ss_qt_libs_to_find libQtCore.so.dylib"
			ss_qt_libs_to_find="$ss_qt_libs_to_find libQtCore.so.a"

			AC_SS_FIND_FILE_PATH($ss_qt_libs_to_find,$ss_qt_library_test_dirs,SS_QT4_LIBDIR)

			SS_QT3_LIBDIR="$SS_QT4_LIBDIR"
			SS_TQTLIB_NAME="tqt"
			AC_MSG_RESULT([TQt4 detected--Qt4 found in $SS_QT3_LIBDIR])

dnl			AC_MSG_RESULT([FAILED])
dnl			AC_SS_SET_REDINK
dnl			echo "################################################################################"
dnl			echo "### CONFIGURE ERROR:"
dnl			echo "### Can not find the qt 3.x library file."
dnl			echo "### Make sure that qt is correctly installed on your system,"
dnl			echo "### and the qt version is the one requested by this version of kvirc."
dnl			echo "### (Usually a greater version is OK too)"
dnl			echo "### Try to run configure again, this time passing the --with-qt-library-dir"
dnl			echo "### option (see ./configure --help)."
dnl			echo "### You may also take a look at the config.log file in this directory,"
dnl			echo "### that will tell you which check has failed and maybe more about the reason"
dnl			echo "### of the failure."
dnl			echo "### If you're feeling that this may be a bug in this configure script"
dnl			echo "### and want to report this to me , please include your configure script,"
dnl			echo "### the config.log file as well as the complete configure output."
dnl			echo "################################################################################"
dnl			AC_SS_SET_NORMALINK
dnl			AC_MSG_ERROR([This was a fatal one...aborting])
		else
			AC_MSG_RESULT([TQt3 found in $SS_QT3_LIBDIR])
		fi
	else
		AC_MSG_RESULT([using user supplied path for the Qt library $SS_QT3_LIBDIR])
	fi
])


AC_DEFUN([AC_SS_FIND_QT4_LIBRARY_DIR],
[
	AC_ARG_WITH(qt4-library-dir,[  --with-qt4-library-dir  path to the Qt 4.x library ],SS_QT4_LIBDIR="$withval",SS_QT4_LIBDIR="NOTGIVEN")
	if test "$SS_QT4_LIBDIR" = "NOTGIVEN"; then
		AC_MSG_CHECKING([for the Qt 4.x libraries])

		ss_qt_library_test_dirs="$SS_QT4_GENERAL_DIR/lib /lib /usr/lib /usr/local/lib /usr/qt/lib /usr/local/qt/lib /usr/X11R6/lib /usr/lib/qt/lib /usr/lib/qt /usr/local/lib/qt/lib"
		test -n "$TQTDIR" && ss_qt_library_test_dirs="$TQTDIR/lib $TQTDIR $ss_qt_library_test_dirs"
		ss_qt_library_test_dirs="$ss_qt_library_test_dirs /usr/local/lib/qt /usr/X11R6/lib/qt /usr/build/qt/lib /opt/lib /opt/qt/lib"
		ss_qt_library_test_dirs="$ss_qt_library_test_dirs /usr/lib/qt4 /usr/local/lib/qt4 /usr/X11R6/lib/qt4"
		ss_qt_library_test_dirs="$ss_qt_library_test_dirs /usr/build/qt4/lib /opt/qt4/lib"

		ss_qt_libs_to_find="libQtCore.so.$SS_QT4_MAJOR_VERSION_REQUIRED.$SS_QT4_MINOR_VERSION_REQUIRED.$SS_QT4_PATCH_LEVEL_REQUIRED"
		ss_qt_libs_to_find="$ss_qt_libs_to_find libQtCore.so.$SS_QT4_MAJOR_VERSION_REQUIRED.$SS_QT4_MINOR_VERSION_REQUIRED"
		ss_qt_libs_to_find="$ss_qt_libs_to_find libQtCore.so.$SS_QT4_MAJOR_VERSION_REQUIRED"
		ss_qt_libs_to_find="$ss_qt_libs_to_find libQtCore.so"
		ss_qt_libs_to_find="$ss_qt_libs_to_find libQtCore.so.$SS_QT4_MAJOR_VERSION_REQUIRED.$SS_QT4_MINOR_VERSION_REQUIRED.dylib"
		ss_qt_libs_to_find="$ss_qt_libs_to_find libQtCore.so.$SS_QT4_MAJOR_VERSION_REQUIRED.dylib"
		ss_qt_libs_to_find="$ss_qt_libs_to_find libQtCore.so.dylib"
		ss_qt_libs_to_find="$ss_qt_libs_to_find libQtCore.so.a"

		AC_SS_FIND_FILE_PATH($ss_qt_libs_to_find,$ss_qt_library_test_dirs,SS_QT4_LIBDIR)

		if test "$SS_QT4_LIBDIR" = "FAILED"; then
			AC_MSG_RESULT([FAILED])
			AC_SS_SET_REDINK
			echo "################################################################################"
			echo "### CONFIGURE ERROR:"
			echo "### Can not find the qt 4.x library files."
			echo "### Make sure that qt is correctly installed on your system,"
			echo "### and the qt version is the one requested by this version of kvirc."
			echo "### (Usually a greater version is OK too)"
			echo "### Try to run configure again, this time passing the --with-qt4-library-dir"
			echo "### option (see ./configure --help)."
			echo "### You may also take a look at the config.log file in this directory,"
			echo "### that will tell you which check has failed and maybe more about the reason"
			echo "### of the failure."
			echo "### If you're feeling that this may be a bug in this configure script"
			echo "### and want to report this to me , please include your configure script,"
			echo "### the config.log file as well as the complete configure output."
			echo "################################################################################"
			AC_SS_SET_NORMALINK
			AC_MSG_ERROR([This was a fatal one...aborting])
		else
			AC_MSG_RESULT([found in $SS_QT4_LIBDIR])
		fi
	else
		AC_MSG_RESULT([using user supplied path for the Qt 4.x library $SS_QT4_LIBDIR])
	fi
])


AC_DEFUN([AC_SS_FIND_QT3_MOC],
[	
	AC_ARG_WITH(qt-moc,[  --with-qt-moc           filename of the Qt 3.x meta object compiler ],SS_QT3_MOC="$withval",SS_QT3_MOC="NOTGIVEN")

 	if test "$SS_QT3_MOC" = "NOTGIVEN"; then
		AC_MSG_CHECKING([for the Qt 3.x tmoc])

 		unset SS_QT3_MOC
		ss_moc_test_dirs="$TQTDIR/bin $PATH /usr/bin /bin /usr/local/bin /usr/X11R6/bin /usr/lib/qt/bin /usr/local/qt/bin /usr/X11R6/qt/bin /usr/qt/bin /usr/build/qt/bin"
		if test -n "$SS_QT3_GENERAL_DIR"; then
			ss_moc_test_dirs="$SS_QT3_GENERAL_DIR/bin $ss_moc_test_dirs"
		fi

		AC_SS_FIND_FILE_PATH(tmoc,$ss_moc_test_dirs,SS_QT3_MOC)

		if test "$SS_QT3_MOC" = "FAILED"; then
			AC_MSG_RESULT([FAILED])
			AC_SS_SET_REDINK
			echo "################################################################################"
			echo "### CONFIGURE ERROR:"
			echo "### The Qt meta object compiler can not be found."
			echo "### Make sure that qt is correctly installed on your system, it is on your path,"
			echo "### and the qt version is the one requested by this version of kvirc."
			echo "### Try to run configure again, this time passing the --with-qt-moc"
			echo "### option (see ./configure --help)."
			echo "### You may also take a look at the config.log file in this directory,"
			echo "### that will tell you which check has failed and maybe more about the reason"
			echo "### of the failure."
			echo "### If you're feeling that this may be a bug in this configure script"
			echo "### and want to report this to me , please include your configure script,"
			echo "### the config.log file as well as the complete configure output."
			echo "################################################################################"
			AC_SS_SET_NORMALINK
			AC_MSG_ERROR([This was a fatal one...aborting])
		else
			SS_QT3_MOC="$SS_QT3_MOC/tmoc"
			AC_MSG_RESULT([found as $SS_QT3_MOC])
		fi
	else
		AC_MSG_RESULT([trusting you: using $SS_QT3_MOC])
 	fi
])


AC_DEFUN([AC_SS_FIND_QT4_MOC],
[	
	AC_ARG_WITH(qt4-moc,[  --with-qt4-moc          filename of the Qt 4.x meta object compiler ],SS_QT4_MOC="$withval",SS_QT4_MOC="NOTGIVEN")

 	if test "$SS_QT4_MOC" = "NOTGIVEN"; then
		AC_MSG_CHECKING([for the Qt 4.x moc])

 		unset SS_QT4_MOC
		ss_moc_test_dirs="$TQTDIR/bin $PATH /usr/bin /bin /usr/local/bin /usr/X11R6/bin /usr/lib/qt/bin /usr/local/qt/bin /usr/X11R6/qt/bin /usr/qt/bin /usr/build/qt/bin"
		if test -n "$SS_QT4_GENERAL_DIR"; then
			ss_moc_test_dirs="$SS_QT4_GENERAL_DIR/bin $ss_moc_test_dirs"
		fi

		AC_SS_FIND_FILE_PATH(moc,$ss_moc_test_dirs,SS_QT4_MOC)

		if test "$SS_QT4_MOC" = "FAILED"; then
			AC_MSG_RESULT([FAILED])
			AC_SS_SET_REDINK
			echo "################################################################################"
			echo "### CONFIGURE ERROR:"
			echo "### The Qt 4.x meta object compiler can not be found."
			echo "### Make sure that qt is correctly installed on your system, it is on your path,"
			echo "### and the qt version is the one requested by this version of kvirc."
			echo "### In particular you should make sure that the moc compiler is NOT the one"
			echo "### shipped with Qt 3.x."
			echo "### Try to run configure again, this time passing the --with-qt4-moc"
			echo "### option (see ./configure --help)."
			echo "### You may also take a look at the config.log file in this directory,"
			echo "### that will tell you which check has failed and maybe more about the reason"
			echo "### of the failure."
			echo "### If you're feeling that this may be a bug in this configure script"
			echo "### and want to report this to me , please include your configure script,"
			echo "### the config.log file as well as the complete configure output."
			echo "################################################################################"
			AC_SS_SET_NORMALINK
			AC_MSG_ERROR([This was a fatal one...aborting])
		else
			SS_QT4_MOC="$SS_QT4_MOC/moc"
			AC_MSG_RESULT([found as $SS_QT4_MOC])
		fi
	else
		AC_MSG_RESULT([trusting you: using $SS_QT4_MOC])
 	fi
])


AC_DEFUN([AC_SS_FIND_QT3_MT],
[
	AC_ARG_ENABLE(qt-mt,[  --disable-qt-mt         ignore the threaded version of Qt],SS_QT3_NOMT="$withval",SS_QT3_NOMT="NOTGIVEN")

	AC_MSG_CHECKING([for the multithreaded version of Qt])

	if test "$SS_QT3_NOMT" = "NOTGIVEN"; then
		ss_qt_libs_to_find="lib$SS_TQTLIB_NAME-mt.so.$SS_QT3_MAJOR_VERSION_REQUIRED.$SS_QT3_MINOR_VERSION_REQUIRED.$SS_QT3_PATCH_LEVEL_REQUIRED"
		ss_qt_libs_to_find="$ss_qt_libs_to_find lib$SS_TQTLIB_NAME-mt.so.$SS_QT3_MAJOR_VERSION_REQUIRED.$SS_QT3_MINOR_VERSION_REQUIRED"
		ss_qt_libs_to_find="$ss_qt_libs_to_find lib$SS_TQTLIB_NAME-mt.so.$SS_QT3_MAJOR_VERSION_REQUIRED"
		ss_qt_libs_to_find="$ss_qt_libs_to_find lib$SS_TQTLIB_NAME-mt.so"
		ss_qt_libs_to_find="$ss_qt_libs_to_find lib$SS_TQTLIB_NAME-mt.$SS_QT3_MAJOR_VERSION_REQUIRED.$SS_QT3_MINOR_VERSION_REQUIRED.$SS_QT3_PATCH_LEVEL_REQUIRED.dylib"
		ss_qt_libs_to_find="$ss_qt_libs_to_find lib$SS_TQTLIB_NAME-mt.$SS_QT3_MAJOR_VERSION_REQUIRED.$SS_QT3_MINOR_VERSION_REQUIRED.dylib"
		ss_qt_libs_to_find="$ss_qt_libs_to_find lib$SS_TQTLIB_NAME-mt.$SS_QT3_MAJOR_VERSION_REQUIRED.dylib"
		ss_qt_libs_to_find="$ss_qt_libs_to_find lib$SS_TQTLIB_NAME-mt.dylib"
		ss_qt_libs_to_find="$ss_qt_libs_to_find lib$SS_TQTLIB_NAME-mt.a"

		AC_SS_FIND_FILE_PATH($ss_qt_libs_to_find,$SS_QT3_LIBDIR,SS_QTMTLIBDIR)
		if test "$SS_QTMTLIBDIR" = "FAILED"; then
			AC_MSG_RESULT([not found])
		else
			AC_MSG_RESULT([seems to be available])
			SS_TQTLIB_NAME="$SS_TQTLIB_NAME-mt"
		fi
	else
		AC_MSG_RESULT([disabled by user])
	fi
])

AC_DEFUN([AC_SS_ENSURE_CAN_COMPILE_X_AND_QT3],
[
	
		AC_MSG_CHECKING([if we can compile an X-Qt 3.x application])
		AC_LANG_CPLUSPLUS
		ss_save_CPPFLAGS="$CPPFLAGS"
		ss_save_CXXFLAGS="$CXXFLAGS"
		ss_save_LDFLAGS="$LDFLAGS"
		ss_save_LIBS="$LIBS"
		if test -n "$SS_X_INCDIR"; then
			CPPFLAGS="-I$SS_X_INCDIR"
		else
			CPPFLAGS=""
		fi
		CPPFLAGS="$CPPFLAGS -I$SS_QT3_INCDIR"
		CXXFLAGS="-O2 -Wall -I/usr/include/tqt -include tqt.h $CXXFLAGS"
		if test -n "$SS_X_LIBDIR"; then
			LIBS="-L$SS_X_LIBDIR"
		else
			LIBS=""
		fi
		LIBS="$LIBS -L$SS_QT3_LIBDIR -l$SS_TQTLIB_NAME"
		if test -n "$SS_X_LDFLAGS"; then
			LIBS="$LIBS $SS_X_LDFLAGS"
		fi
		if test -n "$SS_X_LIBLINK"; then
			LIBS="$LIBS $SS_X_LIBLINK"
		fi
		LDFLAGS="-s $LDFLAGS"
		AC_TRY_LINK([
			#include <tqglobal.h>
			],[return 0; ],SS_QTX_LINKED_OK="TRUE",SS_QTX_LINKED_OK="FALSE")
		if test "$SS_QTX_LINKED_OK" = "FALSE"; then
			AC_MSG_RESULT([FAILED]);
			AC_SS_SET_REDINK
			echo "################################################################################"
			echo "### CONFIGURE ERROR:"
			echo "### Failed to compile the Qt library test program."
			echo "### This may be a bad sign :)"
			echo "### First of all, make sure that qt is correctly installed on your system,"
			echo "### and the qt version is the one requested by this version of kvirc."
			echo "### Ensure that you have only one copy of qt visible at a time."
			echo "### You may also take a look at the config.log file in this directory,"
			echo "### that will tell you which check has failed and maybe more about the reason"
			echo "### of the failure."
			echo "### The CPPFLAGS used were:"
			for a_flag in $CPPFLAGS ; do
				echo "###   $a_flag"
			done
			echo "### The CXXFLAGS used were:"
			for a_flag in $CXXFLAGS ; do
				echo "###   $a_flag"
			done
			echo "### The LIBS used were:"
			for a_flag in $LIBS ; do
				echo "###   $a_flag"
			done
			echo "### The LDFLAGS used were:"
			for a_flag in $LDFLAGS ; do
				echo "###   $a_flag"
			done
			echo "### If you're sure that qt is correctly installed , you may force configure"
			echo "### to skip this check and try to compile kvirc anyway."
			echo "### Try using the --without-qt-check option."
			echo "### If you're feeling that this may be a bug in this configure script"
			echo "### and want to report this to me , please include your configure script,"
			echo "### the config.log file as well as the complete configure output."
			echo "################################################################################"
			AC_SS_SET_NORMALINK
			AC_MSG_ERROR([This was a fatal one...aborting])
		fi
		LIBS="$ss_save_LIBS"
		LDFLAGS="$ss_save_LDFLAGS"
		CXXFLAGS="$ss_save_CXXFLAGS"
		CPPFLAGS="$ss_save_CPPFLAGS"
		AC_MSG_RESULT([success])
])


AC_DEFUN([AC_SS_ENSURE_CAN_COMPILE_X_AND_QT4],
[
	
		AC_MSG_CHECKING([if we can compile an X-Qt 4.x application])
		AC_LANG_CPLUSPLUS
		ss_save_CPPFLAGS="$CPPFLAGS"
		ss_save_CXXFLAGS="$CXXFLAGS"
		ss_save_LDFLAGS="$LDFLAGS"
		ss_save_LIBS="$LIBS"
		if test -n "$SS_X_INCDIR"; then
			CPPFLAGS="-I$SS_X_INCDIR"
		else
			CPPFLAGS=""
		fi
		CPPFLAGS="$CPPFLAGS $SS_QT4_INCDIRECTORIES"
		CXXFLAGS="-O2 -Wall $CXXFLAGS"
		if test -n "$SS_X_LIBDIR"; then
			LIBS="-L$SS_X_LIBDIR"
		else
			LIBS=""
		fi
		LIBS="$LIBS -L$SS_QT4_LIBDIR -lQtCore"
		if test -n "$SS_X_LDFLAGS"; then
			LIBS="$LIBS $SS_X_LDFLAGS"
		fi
		if test -n "$SS_X_LIBLINK"; then
			LIBS="$LIBS $SS_X_LIBLINK"
		fi
		LDFLAGS="-s $LDFLAGS"
		AC_TRY_LINK([
			#include <qglobal.h>
			#if (TQT_VERSION < 0x040000)
				#error "Bad qt version: too old"
			#endif
			],[return 0; ],SS_QTX_LINKED_OK="TRUE",SS_QTX_LINKED_OK="FALSE")
		if test "$SS_QTX_LINKED_OK" = "FALSE"; then
			AC_MSG_RESULT([FAILED]);
			AC_SS_SET_REDINK
			echo "################################################################################"
			echo "### CONFIGURE ERROR:"
			echo "### Failed to compile the Qt 4.x library test program."
			echo "### This may be a bad sign :)"
			echo "### First of all, make sure that qt is correctly installed on your system,"
			echo "### and the qt version is the one requested by this version of kvirc."
			echo "### Ensure that you have only one copy of qt visible at a time."
			echo "### You may also take a look at the config.log file in this directory,"
			echo "### that will tell you which check has failed and maybe more about the reason"
			echo "### of the failure."
			echo "### The CPPFLAGS used were:"
			for a_flag in $CPPFLAGS ; do
				echo "###   $a_flag"
			done
			echo "### The CXXFLAGS used were:"
			for a_flag in $CXXFLAGS ; do
				echo "###   $a_flag"
			done
			echo "### The LIBS used were:"
			for a_flag in $LIBS ; do
				echo "###   $a_flag"
			done
			echo "### The LDFLAGS used were:"
			for a_flag in $LDFLAGS ; do
				echo "###   $a_flag"
			done
			echo "### If you're sure that qt is correctly installed , you may force configure"
			echo "### to skip this check and try to compile kvirc anyway."
			echo "### Try using the --without-qt-check option."
			echo "### If you're feeling that this may be a bug in this configure script"
			echo "### and want to report this to me , please include your configure script,"
			echo "### the config.log file as well as the complete configure output."
			echo "################################################################################"
			AC_SS_SET_NORMALINK
			AC_MSG_ERROR([This was a fatal one...aborting])
		fi
		LIBS="$ss_save_LIBS"
		LDFLAGS="$ss_save_LDFLAGS"
		CXXFLAGS="$ss_save_CXXFLAGS"
		CPPFLAGS="$ss_save_CPPFLAGS"
		AC_MSG_RESULT([success])
])


dnl ###################################################################################################################
dnl ### KDE
dnl ###################################################################################################################

AC_DEFUN([AC_SS_FIND_KDE],
[
	AC_SS_CHECK_IF_KDE_IS_REQUESTED
	if test "$SS_KDE_REQUESTED" = "yes"; then
		AC_SS_FIND_KDE_GENERAL_DIR
		if test "$SS_KDE_REQUESTED" = "yes"; then
			AC_SS_FIND_KDE_SERVICES_DIR
			AC_SS_FIND_KDE_LIBRARY_DIR
			if test "$SS_KDE_REQUESTED" = "yes"; then
				AC_SS_FIND_KDE_INCLUDE_DIR
				if test "$SS_KDE_REQUESTED" = "yes"; then
					AC_SS_ENSURE_CAN_COMPILE_X_QT3_AND_KDE
				fi
			fi
		fi
	fi
])

AC_DEFUN([AC_SS_CHECK_IF_KDE_IS_REQUESTED],
[
 	AC_MSG_CHECKING([if KDE support is requested])
	if test "$SS_USE_QT4" = "no"; then
		SS_KDE_REQUESTED="yes"
		AC_ARG_WITH(kde-support,[  --without-kde-support      Disable the KDE support even if it is detected ],SS_KDE_REQUESTED="$withval")
		if test "$SS_KDE_REQUESTED" = "yes"; then
			AC_MSG_RESULT([yes])
		else
			AC_MSG_RESULT([no])
		fi
	else
		SS_KDE_REQUESTED="no"
		AC_MSG_RESULT([unsupported with qt 4.x])
	fi
])

AC_DEFUN([AC_SS_FIND_KDE_GENERAL_DIR],
[
	AC_MSG_CHECKING([for the general KDE directory])
	ss_kde_general_test_dirs="/usr /usr/local /usr /usr/local /usr/build /usr/X11R6 /opt /usr/opt /usr/lib /usr/lib /usr/src /usr/lib /usr/local/lib"
	if test -n "$HOME"; then
		ss_kde_general_test_dirs="$ss_kde_general_test_dirs $HOME $HOME/lib"
	fi
	if test -n "$TDEDIR"; then
		ss_kde_general_test_dirs="$TDEDIR $ss_kde_general_test_dirs"
	fi
	ss_kde_general_test_path_suffix="trinity tde TDE kde kde3.0 kde3 KDE Kde KDE3 kde3 ."

	AC_SS_FIND_FILE_PATH_EXT($SS_KDE_GENERAL_FILE_TO_SEARCH,$ss_kde_general_test_dirs,$ss_kde_general_test_path_suffix,SS_KDE_GENERAL_DIR)

	if test "$SS_KDE_GENERAL_DIR" = "FAILED"; then
		AC_MSG_RESULT([failed...continuing with normal checks])
		unset SS_KDE_GENERAL_DIR
	else
		AC_MSG_RESULT([Seems to be $SS_KDE_GENERAL_DIR])
	fi
])


AC_DEFUN([AC_SS_FIND_KDE_SERVICES_DIR],
[
	AC_ARG_WITH(kde-services-dir,[  --with-kde-services-dir path to the KDE protocol services dir ],SS_KDE_SERVICESDIR="$withval",SS_KDE_SERVICESDIR="NOTGIVEN")
	if test "$SS_KDE_SERVICESDIR" = "NOTGIVEN"; then

		AC_MSG_CHECKING([for KDE services directory])

		ss_kde_services_test_dirs="/usr/share/services /usr/local/share/services /usr/kde/share/services /usr/local/kde/share/services /usr/X11R6/share/services /opt/kde/share/services /usr/lib/kde/share/services"
		test -n "$TDEDIR" && ss_kde_services_test_dirs="$TDEDIR/share/services $ss_kde_services_test_dirs"
		ss_kde_services_test_dirs="$ss_kde_services_test_dirs /usr/share/kde/services"
		test -n "$SS_KDE_GENERAL_DIR" && ss_kde_services_test_dirs="$SS_KDE_GENERAL_DIR/share/services $ss_kde_services_test_dirs"

		AC_SS_FIND_FILE_PATH("http.protocol",$ss_kde_services_test_dirs,SS_KDE_SERVICESDIR)

		if test "$SS_KDE_SERVICESDIR" = "FAILED"; then
			SS_KDE_SERVICESDIR=""
			AC_MSG_RESULT([unknown])
		else
			AC_MSG_RESULT([found in $SS_KDE_SERVICESDIR])
		fi

	else
		AC_MSG_RESULT([using user supplied path for the KDE services dir $SS_KDE_SERVICESDIR])
	fi
])


AC_DEFUN([AC_SS_FIND_KDE_INCLUDE_DIR],
[
	AC_ARG_WITH(kde-include-dir,[  --with-kde-include-dir  path to the KDE headers ],SS_KDE_INCDIR="$withval",SS_KDE_INCDIR="NOTGIVEN")
	if test "$SS_KDE_INCDIR" = "NOTGIVEN"; then

		AC_MSG_CHECKING([for KDE header files])

		ss_kde_include_test_dirs="/include /usr/include /usr/local/include /usr/kde/include /usr/local/kde/include /usr/X11R6/include /opt/kde/include /usr/lib/kde/include /usr/lib/kde /usr/include/X11"
		test -n "$TDEDIR" && ss_kde_include_test_dirs="$TDEDIR/include $TDEDIR $ss_kde_include_test_dirs"
		ss_kde_include_test_dirs="$ss_kde_include_test_dirs /usr/include/tde /usr/local/include/tde /include/tde /usr/X11R6/include/tde /usr/build/kde/include"
		ss_kde_include_test_dirs="$ss_kde_include_test_dirs /usr/include/tde2 /usr/local/include/tde2 /include/tde2 /usr/X11R6/include/tde2 /usr/include/X11/kde2"
		test -n "$SS_KDE_GENERAL_DIR" && ss_kde_include_test_dirs="$SS_KDE_GENERAL_DIR/include $ss_kde_include_test_dirs"
		test -n "$SS_KDE_GENERAL_DIR" && ss_kde_include_test_dirs="`$SS_KDE_GENERAL_DIR/bin/tde-config --expandvars --install include` $ss_kde_include_test_dirs"

		AC_SS_FIND_FILE_PATH($SS_KDE_INCLUDE_FILE_TO_SEARCH,$ss_kde_include_test_dirs,SS_KDE_INCDIR)

		if test "$SS_KDE_INCDIR" = "FAILED"; then
			AC_MSG_RESULT("FAILED")
			SS_KDE_REQUESTED="no"
			SS_KDE_INCDIR=""
		else
			AC_MSG_RESULT([found in $SS_KDE_INCDIR])
		fi

	else
		AC_MSG_RESULT([using user supplied path for the KDE include files $SS_KDE_INCDIR])
	fi

	if test -z "$SS_KDE_GENERAL_DIR"; then
		# Set it.... we need it :)...
		SS_KDE_GENERAL_DIR=`echo $SS_KDE_INCDIR | sed -e 's/\/include\$//'`
	fi
])

AC_DEFUN([AC_SS_FIND_KDE_LIBRARY_DIR],
[
	AC_ARG_WITH(kde-library-dir,[  --with-kde-library-dir  path to the KDE libraries ],SS_KDE_LIBDIR="$withval",SS_KDE_LIBDIR="NOTGIVEN")
	if test "$SS_KDE_LIBDIR" = "NOTGIVEN"; then
		AC_MSG_CHECKING([for the KDE libraries])

		ss_kde_library_test_dirs="/lib /usr/lib /usr/local/lib /usr/kde/lib /opt/kde/lib /opt/lib /usr/opt/kde/lib /usr/local/kde/lib /usr/X11R6/lib /usr/lib/kde/lib /usr/lib/kde /usr/local/lib/kde/lib"
		test -n "$TDEDIR" && ss_kde_library_test_dirs="$TDEDIR/lib $TDEDIR $ss_kde_library_test_dirs"
		ss_kde_library_test_dirs="$ss_kde_library_test_dirs /usr/local/lib/kde /usr/X11R6/lib/kde /usr/build/kde/lib"
		if test -n "$SS_KDE_GENERAL_DIR"; then
			ss_kde_library_test_dirs="$SS_KDE_GENERAL_DIR/lib $ss_kde_library_test_dirs"
		fi


		AC_SS_FIND_FILE_PATH(libtdecore.so.6 libtdecore.so.5 libtdecore.so.4 libtdecore.so.3 libtdecore.so,$ss_kde_library_test_dirs,SS_KDE_LIBDIR)
		if test "$SS_KDE_LIBDIR" = "FAILED"; then
			AC_SS_FIND_FILE_PATH(libtdecore.so.8 libtdecore.so.7 libtdecore.so.4.0.0 libtdecore.so.4.1.0 libtdecore.so.4.2.0 ,$ss_kde_library_test_dirs,SS_KDE_LIBDIR)
			if test "$SS_KDE_LIBDIR" = "FAILED"; then
				# Try the senseless too
				AC_SS_FIND_FILE_PATH(libtdecore.so.4.0.0 libtdecore.so.4.1.0 libtdecore.so.4.2.0 libtdecore.so.4.3.0,$ss_kde_library_test_dirs,SS_KDE_LIBDIR)
				if test "$SS_KDE_LIBDIR" = "FAILED"; then
					AC_SS_FIND_FILE_PATH(libtdecore.so.4.4.0 libtdecore.so.4.5.0 libtdecore.so.4.6.0 libtdecore.so.4.7.0 libtdecore.a,$ss_kde_library_test_dirs,SS_KDE_LIBDIR)
				fi
			fi
		fi

		if test "$SS_KDE_LIBDIR" = "FAILED"; then
			AC_MSG_RESULT("FAILED")
			SS_KDE_REQUESTED="no"
			SS_KDE_LIBDIR=""
		else
			AC_MSG_RESULT([found in $SS_KDE_LIBDIR])
		fi
	else
		AC_MSG_RESULT([using user supplied path for the KDE libraries $SS_KDE_LIBDIR])
	fi

	if test -z "$SS_KDE_GENERAL_DIR"; then
		# Set it.... we need it :)...
		SS_KDE_GENERAL_DIR=`echo $SS_KDE_LIBDIR | sed -e 's/\/lib\$//'`
	fi
])

AC_DEFUN([AC_SS_ENSURE_CAN_COMPILE_X_QT3_AND_KDE],
[
	AC_ARG_WITH(kde-check,[  --without-kde-check     Do not check if Qt,KDE and X compile ],SS_CHECK_QTX_COMPILE="$withval",SS_CHECK_KQTX_COMPILE="yes")
  	if test "$SS_CHECK_KQTX_COMPILE" = "yes"; then
		AC_MSG_CHECKING(if we can compile an X-Qt-KDE application)
		AC_LANG_CPLUSPLUS
		ss_save_CPPFLAGS="$CPPFLAGS"
		ss_save_CXXFLAGS="$CXXFLAGS"
		ss_save_LDFLAGS="$LDFLAGS"
		ss_save_LIBS="$LIBS"
		if test -n "$SS_X_INCDIR"; then
			CPPFLAGS="-I$SS_X_INCDIR"
		else
			CPPFLAGS=""
		fi
		CPPFLAGS="$CPPFLAGS -I$SS_X_INCDIR -I$SS_QT3_INCDIR -I$SS_KDE_INCDIR"
		CXXFLAGS="-O2 -Wall $CXXFLAGS"
		if test -n "$SS_X_LIBDIR"; then
			LIBS="-L$SS_X_LIBDIR"
		else
			LIBS=""
		fi
		if test -n "$SS_X_LDFLAGS"; then
			LIBS="$SS_X_LDFLAGS $LIBS"
		fi
		if test -n "$SS_X_LIBLINK"; then
			LIBS="$LIBS $SS_X_LIBLINK"
		fi
		LIBS="-L$SS_KDE_LIBDIR -L$SS_QT3_LIBDIR -ltdecore -l$SS_TQTLIB_NAME $LIBS -Wl,-rpath $SS_KDE_LIBDIR"
		if test "$SS_LINK_TO_LIBDL" = "yes"; then
			LIBS="$LIBS -ldl";
		fi
		LDFLAGS="-s $LDFLAGS"
		AC_TRY_LINK([
				#include "kapp.h"
				#include "twin.h"
			],[
				int a = KWin::currentDesktop();
				TDEApplication app(a,0,"kvirc");
			],
			SS_KQTX_LINKED_OK="TRUE",
			SS_KQTX_LINKED_OK="FALSE"
		)
		if test "$SS_KQTX_LINKED_OK" = "FALSE"; then
			AC_MSG_RESULT(failed)
			AC_MSG_ERROR([This was a fatal one...aborting])			
		else
			AC_MSG_RESULT(success)
		fi
		LIBS="$ss_save_LIBS"
		LDFLAGS="$ss_save_LDFLAGS"
		CXXFLAGS="$ss_save_CXXFLAGS"
		CPPFLAGS="$ss_save_CPPFLAGS"
	fi
])






AC_DEFUN([AC_SS_CHECK_OTHER_LIBS],
[
	SS_OTHER_LIBDIRS=""
	SS_OTHER_LIBLINK=""
	SS_OTHER_INCDIRS=""


	AC_MSG_CHECKING([if you want to link to libresolv])
	SS_DO_IT="false"
	AC_ARG_WITH(libresolv,      [  --with-libresolv        Link to libresolv],SS_DO_IT="true")
	if test "$SS_DO_IT" = "true"; then
		AC_MSG_RESULT(yes)
		SS_OTHER_LIBLINK="$SS_OTHER_LIBLINK -lresolv"
	else
		AC_MSG_RESULT(no)
	fi

	AC_MSG_CHECKING([if you want to link to libsocket])
	SS_DO_IT="false"
	AC_ARG_WITH(libsocket,      [  --with-libsocket        Link to libsocket],SS_DO_IT="true")
	if test "$SS_DO_IT" = "true"; then
		AC_MSG_RESULT(yes)
		SS_OTHER_LIBLINK="$SS_OTHER_LIBLINK -lsocket"
	else
		AC_MSG_RESULT(no)
	fi

	AC_MSG_CHECKING([if you want to link to libnsl])
	SS_DO_IT="false"
	AC_ARG_WITH(libnsl,         [  --with-libnsl           Link to libnsl],SS_DO_IT="true")
	if test "$SS_DO_IT" = "true"; then
		AC_MSG_RESULT(yes)
		SS_OTHER_LIBLINK="$SS_OTHER_LIBLINK -lnsl"
	else
		AC_MSG_RESULT(no)
	fi

	AC_MSG_CHECKING([if you want to link to libcompat])
	SS_DO_IT="false"
	AC_ARG_WITH(libnsl,         [  --with-libcompat        Link to libcompat],SS_DO_IT="true")
	if test "$SS_DO_IT" = "true"; then
		AC_MSG_RESULT(yes)
		SS_OTHER_LIBLINK="$SS_OTHER_LIBLINK -lcompat"
	else
		AC_MSG_RESULT(no)
	fi

	AC_MSG_CHECKING([if you want to link to other libraries])
	SS_DO_IT="false"
	AC_ARG_WITH(other-libs,     [  --with-other-libs=...   Link to the specified libraries],SS_DO_IT="$withval")
	if test "$SS_DO_IT" != "false"; then
		AC_MSG_RESULT([yes])
		SS_OTHER_LIBLINK="$SS_OTHER_LIBLINK $SS_DO_IT"
	else
		AC_MSG_RESULT([no])
	fi

	AC_MSG_CHECKING([if you want to add other library search paths])
	SS_DO_IT="false"
	AC_ARG_WITH(other-ldirs,    [  --with-other-ldirs=...  Add the specified library paths],SS_DO_IT="$withval")
	if test "$SS_DO_IT" != "false"; then
		AC_MSG_RESULT([yes])
		SS_OTHER_LIBDIRS="$SS_OTHER_LIBDIRS $SS_DO_IT"
	else
		AC_MSG_RESULT([no])
	fi

	AC_MSG_CHECKING([if you want to add other include search paths])
	SS_DO_IT="false"
	AC_ARG_WITH(other-idirs,    [  --with-other-idirs=...  Add the specified include search paths],SS_DO_IT="$withval")
	if test "$SS_DO_IT" != "false"; then
		AC_MSG_RESULT([yes])
		SS_OTHER_INCDIRS="$SS_OTHER_INCDIRS $SS_DO_IT"
	else
		AC_MSG_RESULT([no])
	fi

])



AC_DEFUN([AC_SS_FINAL_CONFIG],
[
	AC_MSG_CHECKING([if we finally have to compile the IpV6 support])

	if test "$SS_NOIPV6_SUPPORT" = "true"; then
		AC_MSG_RESULT([no: disabled by user])
	else
		if test "$SS_HAVE_IPV6_FUNCTIONS" = "true"; then
			AC_MSG_RESULT([yes])
			AC_DEFINE([COMPILE_IPV6_SUPPORT], 1, [define if you want the IpV6 support])
			SS_BUILD_FLAGS="i$SS_BUILD_FLAGS"
		else
			AC_MSG_RESULT([no: the system lacks support])
		fi
	fi

	dnl # // Toplevel source directory

	SS_TOPSRCDIR=`pwd`

	AC_SUBST(SS_TOPSRCDIR)

	SS_CPPFLAGS="-D_REENTRANT -DREENTRANT"
	if test -n "$SS_X_CPPFLAGS"; then
		SS_CPPFLAGS="$SS_CPPFLAGS $SS_X_CPPFLAGS"
	fi

	if test "$SS_USE_QT4" = "no"; then
		SS_INCDIRS="-I$SS_QT3_INCDIR -I$SS_X_INCDIR"
	else
		AC_DEFINE([COMPILE_USE_QT4], 1, [define if you want to compile the Qt 4.x support])
		SS_INCDIRS="$SS_QT4_INCDIRECTORIES -I$SS_X_INCDIR"
		SS_CPPFLAGS="$SS_CPPFLAGS -DQT3_SUPPORT"
	fi

	if test -n "$SS_X_INCDIR"; then
		SS_INCDIRS="$SS_INCDIRS -I$SS_X_INCDIR"
	fi

	if test -n "$SS_X_LDFLAGS"; then
		SS_LDFLAGS="$SS_X_LDFLAGS"
	else
		SS_LDFLAGS=""
	fi

	if test "$SS_USE_QT4" = "no"; then
		SS_RPATH="-rpath $SS_QT3_LIBDIR -rpath $libdir"
	else
		SS_RPATH="-rpath $SS_QT4_LIBDIR -rpath $libdir"
	fi

	if test -n "$SS_X_LIBDIR"; then
		SS_RPATH="$SS_RPATH -rpath $SS_X_LIBDIR"
	fi

	if test "$SS_USE_QT4" = "no"; then
		SS_LIBDIRS="-L$SS_TOPSRCDIR/src/kvilib/build/ -L$SS_QT3_LIBDIR"
	else
		SS_LIBDIRS="-L$SS_TOPSRCDIR/src/kvilib/build/ -L$SS_QT4_LIBDIR"	
	fi

	if test -n "$SS_X_LIBDIR"; then
		SS_LIBDIRS="$SS_LIBDIRS -L$SS_X_LIBDIR"
	fi

	if test "$SS_USE_QT4" = "no"; then
		SS_LIBLINK="-l$SS_TQTLIB_NAME"
	else
		#if test -n "SS_LOCAL_ADD_DEBUG_SYMBOLS"; then
		#	SS_LIBLINK="-lQtCore_debug -lQtGui_debug -lQt3Support_debug"
		#else
		
			SS_LIBLINK="-lQtCore -lQtGui -lQt3Support"
			
		#fi
	fi
	
	if test -n "$SS_X_LIBLINK"; then
		SS_LIBLINK="$SS_LIBLINK $SS_X_LIBLINK"
	fi
	SS_LIBLINK="$SS_LIBLINK $SS_THREAD_LIBLINK"
	if test "$SS_LINK_TO_LIBSSL" = "true"; then
		SS_LIBLINK="$SS_LIBLINK -lssl -lcrypto"
	fi
	if test "$SS_LINK_TO_LIBESD" = "true"; then
		SS_LIBLINK="$SS_LIBLINK -lesd"
	fi
	if test "$SS_LINK_TO_LIBARTS" = "true"; then
		SS_LIBLINK="$SS_LIBLINK -lsoundserver_idl"
	fi
	if test "$SS_LINK_TO_LIBAUDIOFILE" = "true"; then
		SS_LIBLINK="$SS_LIBLINK -laudiofile -lm"
	fi

	if test "$SS_LOCAL_8BIT" = "true"; then
		SS_CPPFLAGS="$SS_CPPFLAGS -DQT3_NO_ASCII_CAST -DQT3_NO_COMPAT"
	fi

	if test "$SS_QT3_EMBEDDED" = "true"; then
		SS_CPPFLAGS="$SS_CPPFLAGS -DQWS"
	fi

	if test "$SS_KDE_REQUESTED" = "yes"; then
		SS_INCDIRS="$SS_INCDIRS -I$SS_KDE_INCDIR"
		SS_RPATH="$SS_RPATH -rpath $SS_KDE_LIBDIR"
		SS_LIBDIRS="$SS_LIBDIRS -L$SS_KDE_LIBDIR"
		SS_LIBLINK="-ltdecore -ltdeui -ltdeparts -lDCOP -ltdefx -ltdeio $SS_LIBLINK"
		AC_DEFINE([COMPILE_TDE_SUPPORT], 1, [define if you want to compile the TDE support])
		AC_DEFINE_UNQUOTED([TDE_DIR], "$SS_KDE_GENERAL_DIR", [contain path to TDE if compiled with the TDE support])
		AC_DEFINE_UNQUOTED([TDE_LIBDIR], "$SS_KDE_LIBDIR", [contain path to TDE libs if compiled with the TDE support])
		SS_BUILD_FLAGS="k$SS_BUILD_FLAGS"
	else
		AC_DEFINE_UNQUOTED([TDE_DIR], "", [contain path to TDE if compiled with the TDE support])
		AC_DEFINE_UNQUOTED([TDE_LIBDIR], "", [contain path to TDE libs if compiled with the TDE support])
	fi

	if test -n "$SS_OTHER_LIBLINK"; then
		SS_LIBLINK="$SS_LIBLINK $SS_OTHER_LIBLINK"
	fi

	if test -n "$SS_OTHER_LIBDIRS"; then
		SS_LIBDIRS="$SS_LIBDIRS $SS_OTHER_LIBDIRS"
		SS_OTHER_LIBDIRS=`echo "$SS_OTHER_LIBDIRS" | sed -e s/-L//g`
		SS_RPATH="$SS_RPATH -rpath $SS_OTHER_LIBDIRS"
	fi

	if test -n "$SS_OTHER_INCDIRS"; then
		SS_INCDIRS="$SS_INCDIRS $SS_OTHER_INCDIRS"
	fi

	if test "$SS_LINK_TO_LIBDL" = "yes"; then
		SS_LIBLINK="$SS_LIBLINK -ldl"
	fi
	
	if test "$SS_LINK_TO_LIBZ" = "yes"; then
		SS_LIBLINK="$SS_LIBLINK -lz"
	fi
	if test "$SS_LINK_TO_XSS" = "yes"; then
		SS_LIBLINK="$SS_LIBLINK -lXss"
	fi

	AC_SUBST(SS_CPPFLAGS)
	AC_SUBST(SS_INCDIRS)
	AC_SUBST(SS_LDFLAGS)
	AC_SUBST(SS_RPATH)
	AC_SUBST(SS_LIBDIRS)
	AC_SUBST(SS_LIBLINK)
	
	if test "$SS_USE_QT4" = "no"; then
		SS_QT_MOC=$SS_QT3_MOC
		SS_QT_MOC_FLAGS=""
	else
		SS_QT_MOC=$SS_QT4_MOC
		SS_QT_MOC_FLAGS="-DCOMPILE_USE_QT4"
	fi
	
	AC_SUBST(SS_QT_MOC)
	AC_SUBST(SS_QT_MOC_FLAGS)

 	build_date=`date -u`

	if test -z "$build_date"; then
		build_date=`date`
	fi

	if test -z "$build_date"; then
		build_date="unknown"
	fi

	AC_DEFINE_UNQUOTED([BUILD_DATE],"$build_date", [this is the build date (configure date rather)])

	dnl # Let's sort the build flags

	SS_AUX_CHARS="a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9"

	buid_flags=""

	for achar in $SS_AUX_CHARS; do
		tmp_val=`echo "$SS_BUILD_FLAGS" | grep $achar`
		if test "$tmp_val"; then
			build_flags="$build_flags$achar"
		fi
	done
	
	SS_DIRTAG=`echo $VERSION | cut -d . -f 1,2`
	
	AC_DEFINE_UNQUOTED([VERSION_BRANCH], "$SS_DIRTAG", [MAJOR.MINOR part of version])
	AC_DEFINE_UNQUOTED([BUILD_FLAGS],"$target_cpu-$build_flags", [these are the build flags])

	globalkvircdir="\${datadir}/kvirc/$SS_DIRTAG"
	AC_SUBST(globalkvircdir)

	configdir="\${globalkvircdir}/config"
	AC_SUBST(configdir)

	picsdir="\${globalkvircdir}/pics"
	AC_SUBST(picsdir)

	helpdir="\${globalkvircdir}/help/en"
	AC_SUBST(helpdir)

	pluglibdir="\${libdir}/kvirc/$SS_DIRTAG/modules"
	AC_SUBST(pluglibdir)

	modulelibdir="\${libdir}/kvirc/$SS_DIRTAG/modules"
	AC_SUBST(modulelibdir)

	defscriptdir="\${globalkvircdir}/defscript"
	AC_SUBST(defscriptdir)
	
	themedir="\${globalkvircdir}/themes"
	AC_SUBST(themedir)

	msgcolorsdir="\${globalkvircdir}/msgcolors"
	AC_SUBST(msgcolorsdir)

	if test -z "$mandir"; then
		mandir="\${exec_prefix}/man/man1"
	fi
	AC_SUBST(mandir)


	licensedir="\${globalkvircdir}/license"
	AC_SUBST(licensedir)

	if test -n "$SS_KDE_SERVICESDIR"; then
		kdeservicesdir="$SS_KDE_SERVICESDIR"
	else
		kdeservicesdir="\${exec_prefix}/share/kvirc/$SS_DIRTAG/protocols"
	fi
	AC_SUBST(kdeservicesdir)

	if test "$SS_KDE_REQUESTED" = "yes"; then
		iconapps16datadir="$SS_KDE_GENERAL_DIR/share/icons/hicolor/16x16/apps"
		iconapps32datadir="$SS_KDE_GENERAL_DIR/share/icons/hicolor/32x32/apps"
		iconapps48datadir="$SS_KDE_GENERAL_DIR/share/icons/hicolor/48x48/apps"
		iconapps64datadir="$SS_KDE_GENERAL_DIR/share/icons/hicolor/64x64/apps"
		iconapps128datadir="$SS_KDE_GENERAL_DIR/share/icons/hicolor/128x128/apps"
		iconappsscalabledatadir="$SS_KDE_GENERAL_DIR/share/icons/hicolor/scalable/apps"
		iconmime16datadir="$SS_KDE_GENERAL_DIR/share/icons/hicolor/16x16/mimetypes"
		iconmime32datadir="$SS_KDE_GENERAL_DIR/share/icons/hicolor/32x32/mimetypes"
		iconmime48datadir="$SS_KDE_GENERAL_DIR/share/icons/hicolor/48x48/mimetypes"
		iconmime64datadir="$SS_KDE_GENERAL_DIR/share/icons/hicolor/64x64/mimetypes"
		iconmime128datadir="$SS_KDE_GENERAL_DIR/share/icons/hicolor/128x128/mimetypes"
		iconmimescalabledatadir="$SS_KDE_GENERAL_DIR/share/icons/hicolor/scalable/mimetypes"
		applnkdir="$SS_KDE_GENERAL_DIR/share/applnk/Internet"
		mimelnkdir="$SS_KDE_GENERAL_DIR/share/mimelnk/text"
	else
		iconapps16datadir="\${exec_prefix}/share/kvirc/$SS_DIRTAG/icons/16x16"
		iconapps32datadir="\${exec_prefix}/share/kvirc/$SS_DIRTAG/icons/32x32"
		iconapps48datadir="\${exec_prefix}/share/kvirc/$SS_DIRTAG/icons/48x48"
		iconapps64datadir="\${exec_prefix}/share/kvirc/$SS_DIRTAG/icons/64x64"
		iconapps128datadir="\${exec_prefix}/share/kvirc/$SS_DIRTAG/icons/128x128"
		iconappsscalabledatadir="\${exec_prefix}/share/kvirc/$SS_DIRTAG/icons/scalable"
		iconmime16datadir="\${exec_prefix}/share/kvirc/$SS_DIRTAG/icons/16x16"
		iconmime32datadir="\${exec_prefix}/share/kvirc/$SS_DIRTAG/icons/32x32"
		iconmime48datadir="\${exec_prefix}/share/kvirc/$SS_DIRTAG/icons/48x48"
		iconmime64datadir="\${exec_prefix}/share/kvirc/$SS_DIRTAG/icons/64x64"
		iconmime128datadir="\${exec_prefix}/share/kvirc/$SS_DIRTAG/icons/128x128"
		iconmimescalabledatadir="\${exec_prefix}/share/kvirc/$SS_DIRTAG/icons/scalable"
		applnkdir="\${exec_prefix}/share/kvirc/$SS_DIRTAG/applnk"
		mimelnkdir="\${exec_prefix}/share/kvirc/$SS_DIRTAG/mimelnk"
	fi
	AC_SUBST(iconapps16datadir)
	AC_SUBST(iconapps32datadir)
	AC_SUBST(iconapps48datadir)
	AC_SUBST(iconapps64datadir)
	AC_SUBST(iconapps128datadir)
	AC_SUBST(iconappsscalabledatadir)
	AC_SUBST(iconmime16datadir)
	AC_SUBST(iconmime32datadir)
	AC_SUBST(iconmime48datadir)
	AC_SUBST(iconmime64datadir)
	AC_SUBST(iconmime128datadir)
	AC_SUBST(iconmimescalabledatadir)
	AC_SUBST(applnkdir)
	AC_SUBST(mimelnkdir)

	localedir="\${globalkvircdir}/locale"
	AC_SUBST(localedir)

	headersdir="\${exec_prefix}/include/kvirc/$VERSION"
	AC_SUBST(headersdir)


	configmodulesdir="\${globalkvircdir}/config/modules"
	AC_SUBST(configmodulesdir)


	topdir=`pwd`
	AC_SUBST(topdir)

	AC_SS_HEADER([Configuration status:])
	AC_SS_SET_GREENINK
	echo "### The kvirc binary will be installed in:"
	echo "###   $bindir"
	echo "### The libraries will be installed in:"
	echo "###   $libdir"
	echo "### Modules will be installed in:"
	echo "###   $pluglibdir"
	AC_SS_SET_NORMALINK
	AC_SS_HEADER([Take a look at the paths above just to be sure that they're correct])
])

dnl just a wrapper to clean up configure.in
AC_DEFUN([KVIRC_PROG_LIBTOOL],
[
	AM_PROG_LIBTOOL

	LIBTOOL_SHELL="/bin/sh ./libtool"
	#  LIBTOOL="$LIBTOOL --silent"

	AC_ARG_ENABLE(objprelink, [  --enable-objprelink     prelink apps (experimental, needs objprelink in path)],
	kvirc_use_objprelink=$enableval, kvirc_use_objprelink=no)
	if test "x$kvirc_use_objprelink" = "xyes"; then
		echo Patching libtool to run objprelink.
		mv libtool libtool.orig
		cat > libtool <<\EOF
#! /bin/sh

ALREADYPRELINKED=""

for n
do
	case $n in
		*.o) k=$n
			if test -r $k; then
				ISELF=`file $k | grep ELF`
				if test -n "$ISELF"; then
					ALREADY=`echo $ALREADYPRELINKED | grep "!!!$k"`
					if test -z "$ALREADY"; then
						echo objprelink $k
						objprelink $k
						ALREADYPRELINKED="$ALREADYPRELINKED !!!$k"
					fi
				fi
			fi
			;;
		*.lo) k=$n
			if test -r $k; then
				ISELF=`file $k | grep ELF`
				if test -n "$ISELF"; then
					ALREADY=`echo $ALREADYPRELINKED | grep "!!!$k"`
					if test -z "$ALREADY"; then
						echo objprelink $k
						objprelink $k
						ALREADYPRELINKED="$ALREADYPRELINKED !!!$k"
					fi
				fi
			fi
			ASHORTNAME=`echo $n | sed -e 's/\.lo$//'`
			k=".libs/$ASHORTNAME.o"
			if test -r $k; then
				ISELF=`file $k | grep ELF`
				if test -n "$ISELF"; then
					ALREADY=`echo $ALREADYPRELINKED | grep "!!!$k"`
					if test -z "$ALREADY"; then
						echo objprelink $k
						objprelink $k
						ALREADYPRELINKED="$ALREADYPRELINKED !!!$k"
					fi
				fi
			fi
			k=".libs/$ASHORTNAME.lo"
			if test -r $k; then
				ISELF=`file $k | grep ELF`
				if test -n "$ISELF"; then
					ALREADY=`echo $ALREADYPRELINKED | grep "!!!$k"`
					if test -z "$ALREADY"; then
						echo objprelink $k
						objprelink $k
						ALREADYPRELINKED="$ALREADYPRELINKED !!!$k"
					fi
				fi
			fi
			k="$ASHORTNAME.o"
			if test -r $k; then
				ISELF=`file $k | grep ELF`
				if test -n "$ISELF"; then
					ALREADY=`echo $ALREADYPRELINKED | grep "!!!$k"`
					if test -z "$ALREADY"; then
						echo objprelink $k
						objprelink $k
						ALREADYPRELINKED="$ALREADYPRELINKED !!!$k"
					fi
				fi
			fi
			;;
	esac
done

EOF
		cat >> libtool libtool.orig
		rm libtool.orig
		chmod a+x libtool
	fi
])