File: make.probe

package info (click to toggle)
ksh 93u+20120801-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 14,024 kB
  • ctags: 16,568
  • sloc: ansic: 174,389; sh: 31,795; makefile: 1,038; cpp: 10
file content (2242 lines) | stat: -rw-r--r-- 47,941 bytes parent folder | download | duplicates (4)
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
:
### this script contains archaic constructs that work with all sh variants ###
# Glenn Fowler
# AT&T Research
#
# @(#)make.probe (AT&T Research) 2011-06-01
#
# C probe for make
#
# NOTE: C.probe must be included or .'d here
#

cc_dll_def=-D_BLD_DLL

probe_ar_arflags="-Xany"
probe_arflags="-xar"
probe_ccs="strip size nm ld ar" # longest to shortest
probe_debug="-g"
probe_dll="'-G 0' -Wc,dll,exportall,longname,rent -Wc,exportall -dynamic $cc_dll_def"
probe_export_dynamic="-rdynamic -export-dynamic -Wl,-export-dynamic -Wl,-E -bexpall -force_flat_namespace"
probe_gcc_optimize="-O2"
probe_gcc_version="*[Gg][Cc][Cc]*"
probe_include_local="'-ignore-source-dir -iquote' -iquote -I-"
probe_ldlazy='-zlazyload -znolazyload -Wl,-zlazyload -Wl,-znolazyload'
probe_ldlib="LD_LIBRARY_PATH LIBPATH LPATH"
probe_ldmap="'-Wl,-M' '-Qoption ld -M' '-Wl,-m' '-m'"
probe_ldorigin="-Wl,-z,origin"
probe_ldrecord='-zrecord -zignore -Wl,-zrecord -Wl,-zignore'
probe_ldrunpath="-Wl,-R, -R -Wl,-rpath, -L"
probe_ldstrip="'-s -mr' -Wl,-s"
probe_lib="a lib"
probe_lib_append="/usr/lib/pa1.1"
probe_lib_all_undef="-all -notall -all -none -Bwhole-archive -Bno-whole-archive -whole-archive -no-whole-archive -Wl,-whole-archive -Wl,-no-whole-archive -all_load '' -Wl,-zallextract -Wl,-zdefaultextract +forceload +noforceload"
probe_lib_multiple="-Wl,-zmuldefs"
probe_libdir="shlib lib"
probe_nmflags="'' -p -B"
probe_optimize="-O"
probe_pic="-Kpic -KPIC -fpic -fPIC -pic -PIC +z +Z"
probe_no_protect="'-fno-stack-protector -fno-stack-protector-all' -GS-"
probe_readonly="-R -Krodata -xMerge -Wa,-r"
probe_shared="'' -G -b -c -shared -Wl,dll"
probe_shared_name="-Wl,-soname= -h"
probe_shared_nostart="-nostartfiles"
probe_shared_registry='"-update_registry $probe_shared_registry_file"'
probe_shared_registry_file='registry.ld'
probe_shared_registry_path="\$(LIBDIR)/$probe_shared_registry_file"
probe_strict="'-ansi -pedantic' '-ansi -strict' -strict -ansi"
probe_stripflags="'-f -s' -f -s"
probe_unresolved="'-expect_unresolved \"*\"'"
probe_warn="-Wall -fullwarn -w3 '-A -A' +w1"

echo '#pragma pp:version' > libpp.$src
echo '#define dDflag on' > dDflag.$src
echo 'int main(){return 0;}' > doti.$src
echo 'int code(){return 0;} int main(){return code();}' > export.$src
echo '#include <stdio.h>' > imstd.$src
echo '#include "_i_.h"' > imusr.$src
echo 'int x;' > _i_.h
mkdir im
echo '(' > im/stdio.h
echo '#include "implc_x.h"
int main(){f(1);return 0;}' > implc.$src
echo 'template <class T> void f(T){}' > implc_x.$src
echo 'template <class T> void f(T);' > implc_x.h
echo 'extern int NotalL(){return(0);}' > notall.$src
echo '#include <stdio.h>
extern int i;
int i = 1;
extern int f(){return(!i);}
int main(){FILE* fp=stdin;return(f());}' > pic.$src
echo 'class x {int n;} m;' > plusplus.$src
echo 'int prefix(){return 0;}' > prefix.$src
echo 'template<class T> int gt(T a, T b);
template<class T> int gt(T a, T b) { return a > b; }
int main () { return gt(2,1); }' > ptr.$src
echo 'int main(){return 0;}' > require.$src
echo '#if mips && !sgi || __CYGWIN__
( /* some systems choke on this probe */
#else
#if test_const
#define CONST const
#else
#define CONST
#endif
CONST char x[]={1,2,3,4,5,6,7,8,9,0};
int main(){*(char*)x=0; return x[0];}
#endif' > readonly.$src
# NOTE:	sfclose() defined on uwin, not defined on all other systems
echo 'extern int sfclose(); extern int ShareD(){return(sfclose());}' > shared.$src
echo '#define g(a,b) a ## b
volatile int a;
const int g(x,y)=1;
extern int c(int);' > stdc.$src
echo 'extern int f(); int main() { return f(); }' > sovmain.$src
echo 'int f() { return 0; }' > sovlib.$src
echo '#include <stdio.h>
int i;
int main(){int j;j = i * 10;return j;}' > strip.$src
echo 'template <class T> void f(T){}
int main(){f(1);return 0;}' > toucho.$src
echo '#if defined(__STDC__) || defined(__cplusplus)
extern type call(int);
#endif
int main() {call(0);return(0);}' > tstlib.$src
echo 'int main(){return 0;}' > warn.$src
echo 'int f(){return 0;}' > warn1.$src
echo 'int f(){}' > warn2.$src
echo 'int f(){int i; return 0;}' > warn3.$src
echo 'int f(){int i; return i;}' > warn4.$src
echo 'int f(){return g();}' > warn5.$src
warn_enum="1 2 3 4 5"

chmod -w *.$src

ar_arflags=
arflags=
cc_dll=
cc_pic=
cc_PIC=
dDflag=
debug=
dialect=
dll_dir='$(LIBDIR)'
dll_libraries=
dll_variants=
doti=
exectype=
export_dynamic=
gnu=
implicitc=
include_local=
lddynamic=
ldlazy=
ldnolazy=
ldnorecord=
ldorigin=
ldrecord=
ldrunpath=
ldscript=
ldstatic=
ldstrip=
Lflag=
lib_dll=
lib_all=
lib_undef=
libpath=
libpp=
makeoptions=
nmedit=
nmflags=
no_protect=
optimize=
plusplus=
prefix_archive=lib
prefix_dynamic=
prefix_shared=lib
ptrcopy=
ptrimplicit=
ptrmkdir=
readonly=
repository=
require=
runpath=
shared=
shared_name=
shared_registry=
shellmagic=
soversion=
stdc=
strict=
stripflags=
symprefix=
toucho=
warn=

set $probe_lib
lib=$1

d=
for f in $stdinclude $usrinclude
do	case $f in
	-I*)	;;
	*)	d="$d $f" ;;
	esac
done
stdinclude=$d

set x $cc
cc_dir=`echo $2 | sed -e 's,/*[^/]*$,,'`
for c in $probe_ccs
do	if	$executable $cc_dir/$c
	then	x=$cc_dir/$c
	else	x=$c
	fi
	eval $c='$x'
done
ld_dir=
rm -f doti.$obj
if	$cc -c doti.$src
then	eval set x $probe_verbose
	shift
	for o
	do	$cc $o doti.$obj
		$cc $o doti.$obj -lF0oB@r
	done 2>&1 | sed -e 's/^[+ 	]*//' -e 's/[ 	].*//' -e '/^\//!d' -e 's/:$//' -e '/ld[a-zA-Z0-9.]*$/!d' -e 's,///*,/,g' > t
	for i in `cat t`
	do	rm -f t.$obj
		if test -x $i && $i -r -o t.$obj doti.$obj && test -f t.$obj
		then	case $ld in
			ld)	ld=$i ;;
			esac
			ld_dir=`echo $i | sed 's,/[^/]*$,,'`
			break
		fi
	done
fi
IFS=:
set x $PATH
IFS=$ifs
path=$*
m=
for c in $probe_ccs
do	eval o='$'$c
	case $o in
	$c)	;;
	*)	continue ;;
	esac
	C='${c}'
	for x in $cc_dir $ld_dir
	do	cd $x
		for p in "${C}" "${C}[!a-zA-Z]*" "*[!a-zA-Z]${C}" "*[!a-zA-Z]${C}[!a-zA-Z]*"
		do	eval set x $p
			case $# in
			2)	if	$executable $2
				then	case $2 in
					*$c*$c*);;
					*)	m=$p
						break 3
						;;
					esac
				fi
				;;
			esac
		done
	done
done
cd $tmpdir
for c in $probe_ccs
do	eval o='$'$c
	case $o in
	$c)	;;
	*)	continue ;;
	esac
	for x in $cc_dir $ld_dir
	do	if	$executable $x/$c
		then	eval $c='$x/$c'
			continue 2
		fi
		case $m in
		?*)	eval set x $x/$m
			case $# in
			2)	if	$executable $2
				then	eval $c='$2'
					continue 2
				fi
				;;
			esac
			;;
		esac
	done
	for x in $path
	do	if	$executable $x/$c
		then	eval $c='$x/$c'
			break
		fi
	done
done
dld=$cc

rm -f dynamic.$exe
if	$cc -o dynamic.$exe dynamic.$obj && $executable dynamic.$exe
then	mkdir mylib
	echo > mylib/libc.$lib
	eval set x $probe_ldlib
	while	:
	do	shift
		case $# in
		0)	break ;;
		esac
		rm -f dynamic.$exe
		if	eval $1=./mylib '$'cc -o dynamic.$exe dynamic.$obj
		then	:
		else	libpath=$1
			break
		fi
	done
fi
test `$cc -E libpp.$src | grep -c '^#pragma pp:version "libpp '` -eq 1 && libpp=1
$cc -E doti.$src > doti.i && $cc -c doti.i && test -s doti.$obj && doti=1
if	$cc -c imusr.$src
then	eval set x $probe_include_local
	while	:
	do	shift
		case $# in
		0)	break ;;
		esac
		if	$cc -c $1 imusr.$src
		then	: "$1 should skip \"_i_.h\" in ."
		elif	$cc -c imstd.$src
		then	if	$cc -c -Iim imstd.$src
			then	: '-Idir should find <stdio.h> in dir'
			elif	$cc -c $1 -Iim imstd.$src
			then	: "$1 -Idir should find <stdio.h> in dir"
			elif	$cc -c -Iim $1 imstd.$src
			then	include_local=$1
				break
			else	: "-Idir $1 should skip <stdio.h> in dir"
			fi
		else	: should find stdio.h
		fi
	done
else	: 'should find "_i_.h" in .'
fi

if	$cc -c pic.$src 2>e
then	e=`wc -l e`
	s=`$size pic.$obj; wc pic.$obj`
	eval set x $probe_pic
	shift
	while	:
	do	case $# in
		0|1)	break ;;
		esac
		pic=$1
		shift
		PIC=$1
		shift
		rm -f pic.$obj
		$cc $pic -c pic.$src 2>e && test -f pic.$obj || continue
		$cc $pic -o pic.$exe pic.$obj && test -f pic.$exe || {
			rm -f pic.$exe
			$cc -o pic.$exe pic.$obj && test -f pic.$exe && continue
		}
		case `wc -l e` in
		$e)	;;
		*)	continue ;;
		esac
		case $pic in
		???*)	m=`echo " $pic" | sed -e 's/^ [-+]//g' -e 's/./-& /g' -e 's/[-+] //g'`
			rm -f pic.$obj pic1.$exe
			if	$cc $m -c pic.$src 2>e && test -f pic.$obj &&
				$cc -o pic1.$exe pic.$obj && test -f pic1.$exe
			then	case `wc -l e` in
				$e)	cc_pic=$m
					break
					;;
				esac
			fi
			cc_pic=$pic
			break
			;;
		*)	case `$size pic.$obj; wc pic.$obj` in
			$s)	;;
			*)	cc_pic=$pic
				break
				;;
			esac
			;;
		esac
	done
	# this works around gcc 2.95 sun4 -fpic a.out core dump after exit
	case $hosted:$cc_pic in
	1:?*)   if	./pic.$exe
		then	# this catches lynxos.ppc gcc that dumps -fpic and not -mshared
			echo 'static int* f() { static int v; return &v; }
int main() { f(); return 0; }' > picok.$src
			$cc $cc_pic -o picok.$exe picok.$src && ./picok.$exe || cc_pic=
		else	cc_pic=
		fi
		;;
	esac
	case $cc_pic in
	?*)	rm -f pic.$obj
		if	$cc $PIC -c pic.$src 2>e && test -f pic.$obj
		then	cc_PIC=$PIC
		else	cc_PIC=$cc_pic
		fi
		;;
	*)	eval set x $probe_dll
		while	:
		do	shift
			case $# in
			0)	break ;;
			esac
			rm -f pic.$obj pic.$exe
			$cc $1 -c pic.$src 2>e && test -f pic.$obj || continue
			$cc $1 -o pic.$exe pic.$obj && test -f pic.$exe || {
				rm -f pic.$exe
				$cc -o pic.$exe pic.$obj && test -f pic.$exe && continue
			}
			case $1 in
			-Wc,*exportall*)
				# get specific since sgi gets this far too
				rm -f pic.$exe pic.x
				$cc -Wl,dll -o pic.$exe pic.$obj || continue
				test -f pic.$exe || continue
				test -f pic.x || continue
				cc_dll="-D_SHARE_EXT_VARS $1"
				so=.x
				sd=.dll
				dld=$cc
				shared=-Wl,dll
				prefix_shared=
				probe_sd=
				probe_shared=
				#unused# lddynamic=-Bdynamic
				#unused# ldstatic=-Bstatic
				lib_dll=SYMBOL
				break
				;;
			esac
			case `wc -l e` in
			$e)	cc_dll=$1
				break
				;;
			esac
		done
		;;
	esac
fi

$cc -c plusplus.$src && plusplus=1
$cc -E -dD dDflag.$src > t
case `grep '#define[ 	][ 	]*dDflag[ 	][ 	]*on' t` in
?*)	dDflag=1 ;;
esac
case `grep '#define.*_GNUC_' t` in
?*)	gnu=1 ;;
esac
case $plusplus in
"")	$cc -c stdc.$src && stdc=1 ;;
*)	mkdir ptr
	cd ptr
	$cc -c ../ptr.$src &
	NFS_locks_are_botched=$!
	cd ..
	if	$cc -c require.$src && $cc require.$obj
	then	set x `$cc require.$obj 2>&1`
		d=
		while	:
		do	shift
			case $# in
			0)	break ;;
			esac
			case $1 in
			-l*)	d="$d $1" ;;
			esac
		done
		for f in ++
		do	if $cc require.$obj -l$f
			then	set x `$cc require.$obj -l$f 2>&1`
				r=
				while	:
				do	shift
					case $# in
					0)	break ;;
					esac
					case $1 in
					-l*)	case " $d $r " in
						*" "$1" "*)	;;
						*)		r="$r $1" ;;
						esac
					esac
				done
				case $r in
				?*)	require="$require $f"
					echo '' $r > req.$f
					;;
				esac
			fi
		done
	fi
	cd ptr
	for i in *
	do	if	test -d $i
		then	repository=$i
			break
		fi
	done
	cd ..
	kill -9 $NFS_locks_are_botched
	rm -rf ptr
	case $repository in
	*?)	mkdir ptr
		cd ptr
		i=PTR
		case $repository in
		$i)	i=$i$i ;;
		esac
		$cc -ptr$i -c ../ptr.$src &
		NFS_locks_are_botched=$!
		cd ..
		sleep 5
		if	test -d ptr/$i/$repository
		then	ptrimplicit=1
		fi
		kill -9 $NFS_locks_are_botched
		rm -rf ptr
		;;
	esac
	$cc -o implc implc.$src && $executable implc && implicitc=1
	if	$cc -c toucho.$src && test -f toucho.$obj
	then	o=`ls -l toucho.$obj`
		if	$cc -o toucho toucho.$obj && $executable toucho
		then	n=`ls -l touch.$obj`
			case $n in
			"$o")	;;
			*)	toucho=1 ;;
			esac
		fi
	fi
	;;
esac

if	$cc -c pic.$src
then	eval set x $probe_nmflags
	while	:
	do	shift
		case $# in
		0)	break ;;
		esac
		case `$nm $1 pic.$obj | grep -c '[0123456789][ 	][ 	]*T[ 	][ 	]*[_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz]'` in
		0)	;;
		*)	nmflags=$1
			break
			;;
		esac
	done
	case $# in
	0)	case `$nm -gh pic.$obj | grep -c '|\.*[TtDdBbC][EeAaSsOo][XxTtSsMm]'` in
		0)	;;
		*)	nmflags=-gh
			nmedit="-e '/\.*[TtDdBbC][EeAaSsOo][XxTtSsMm]/!d' -e 's/[| 	].*//'"
			;;
		esac
		;;
	*)	nmedit="-e '/[ 	]T[ 	][ 	]*[_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz]/!d' -e 's/.*[ 	]T[ 	][ 	]*//'"
		;;
	esac
fi

if	$cc -c doti.$src
then	eval set x $probe_stripflags
	while	:
	do	shift
		case $# in
		0)	break ;;
		esac
		if	$strip $1 doti.$obj
		then	stripflags=$1
			break
		fi
	done
fi

rm -f export.$obj export.exe
if	$cc -c export.$src
then	lm=
	if	$cc -o export.exe export.$obj -lm 2>e && lm=-lm ||
		$cc -o export.exe export.$obj 2>e
	then	z=`wc -c < export.exe; $size export.exe 2>/dev/null`
		eval set x $probe_export_dynamic
		while	:
		do	shift
			case $# in
			0)	break ;;
			esac
			rm -f export.exe
			if	$cc -o export.exe $1 export.$obj $lm 2>f && $executable export.exe
			then	y=`wc -c < export.exe; $size export.exe 2>/dev/null`
				case $y in
				$z)	;;
				*)	if	cmp -s e f
					then	export_dynamic=$1
						break
					fi
					;;
				esac
			fi
		done
	fi
fi
rm -f export.$obj export.exe

rm -f strip.exe
if	$cc -o strip.exe strip.$src
then	z=`wc -c < strip.exe`
	eval set x $probe_ldstrip
	while	:
	do	shift
		case $# in
		0)	break ;;
		esac
		rm -f strip.exe
		if	$cc -o strip.exe $1 strip.$src
		then	case `wc -c < strip.exe` in
			$z)	;;
			*)	ldstrip=$1
				break
				;;
			esac
		fi
	done
fi

rm -f strip.exe strip.$obj
if	$cc -c strip.$src && $cc -o strip.exe strip.$obj 2>e
then	eval set x x $probe_ldlazy
	while	:
	do	shift
		shift
		case $# in
		0)	break ;;
		esac
		rm -f strip.$exe
		$cc -o strip.$exe $1 strip.$obj $2 2>f && test -f strip.$exe || continue
		cmp -s e f || continue
		ldlazy=$1
		ldnolazy=$2
		break
	done
	eval set x x $probe_ldrecord
	while	:
	do	shift
		shift
		case $# in
		0)	break ;;
		esac
		rm -f strip.$exe
		$cc -o strip.$exe $1 strip.$obj $2 2>f && test -f strip.$exe || continue
		cmp -s e f || continue
		ldrecord=$1
		ldnorecord=$2
		break
	done
fi

case $cc_dll:$cc_pic:$so:$dynamic:$static in
::::|$cc_dll_def::::)
	: last chance dynamic checks
	while	:
	do
		echo '__declspec(dllexport) int fun() { return 0; }' > exp.$src
		if	$cc -c $cc_dll_def exp.$src
		then	rm -f xxx.dll xxx.lib
			if	$cc -shared -Wl,--enable-auto-image-base -Wl,--out-implib=xxx.lib -o xxx.dll exp.$obj &&
				test -f xxx.lib -a -f xxx.dll
			then
				: cygwin
				cc_dll=$cc_dll_def
				dll_dir='$(BINDIR)'
				sd=.dll
				so=.dll.a
				ldscript=".def .exp .ign .res"
				lib_dll=option
				lib_all=-Wl,-whole-archive
				lib_undef=-Wl,-no-whole-archive
				dld=$cc
				shared='-shared -Wl,--enable-auto-image-base -Wl,--out-implib=$(<:N=*'$so')'
				prefix_dynamic=cyg
				prefix_shared=lib
				break
			fi
		fi
		break
	done
	;;
*)	if	$cc -c $cc_dll $cc_pic shared.$src && $cc -c $cc_dll $cc_pic notall.$src
	then	for xx in "$cc" "$ld"
		do	eval set x $probe_shared
			while	:
			do	shift
				case $# in
				0)	break ;;
				esac
				rm -f xxx$dll
				# UNDENT ...

	if	$xx $1 -o xxx$dll shared.$obj 2>e && test -r xxx$dll
	then	if	test -s e && egrep -i 'unknown|invalid|option' e > /dev/null
		then	continue
		fi
		case `PATH=/bin:/usr/bin:$PATH file xxx$dll` in
		*lib*|*obj*|*shared*)
			;;
		"")	$executable xxx$dll || continue
			;;
		*ELF*|*elf*)
			$executable xxx$dll || continue
			case `strings xxx$dll | sed -e 's,.*[ |],,' | sort -u | egrep -i '^([._](dynamic|dynstr|dynsym))$'` in
			[012])	continue ;;
			esac
			;;
		*archive*not*stripped*|*data*dynamic*not*stripped*)
			$executable xxx$dll || continue
			;;
		*)	continue
			;;
		esac
		dld=$xx
		shared=$1
		# does -nostartfiles make sense for C?
		case $plusplus in
		'')	z=`wc -c < xxx$dll`
			eval set x $probe_shared_nostart
			while	:
			do	shift
				case $# in
				0)	break ;;
				esac
				rm -f xxx$dll
				if	$dld $shared $1 -o xxx$dll shared.$obj 2>e && test -r xxx$dll
				then	case `wc -c < xxx$dll` in
					$z)	;;
					*)	if	test -s e
						then	case `cat e` in
							*[Ee][Rr][Rr][Oo][Rr]*|*[Ww][Aa][Rr][Nn][Ii][Nn][Gg]*|*[Oo][Pp][Tt][Ii][Oo][Nn]*)
								continue
								;;
							esac
						fi
						case $shared in
						'')	shared=$1 ;;
						*)	shared="$shared $1" ;;
						esac
						break
						;;
					esac
				fi
			done
			;;
		esac
		case $cc_dll in
		"")	cc_dll=$cc_dll_def ;;
		esac
		eval set x x $probe_sd
		while	:
		do	shift
			shift
			case $# in
			[01])	break ;;
			esac
			rm -f xxx xxx$1 xxx$2
			if	$dld $shared -o xxx shared.$obj 2>e
			then	if	test -f xxx$1 -a \( -f xxx$2 -o "$cc_dll" = "$cc_dll_def" \)
				then	sd=$1
					so=$2
					lddynamic=-Bdynamic
					ldstatic=-Bstatic
					break 2
				elif	test -f xxx -a -f xxx$2
				then	sd=$1
					so=$2
					break 2
				else	case $so in
					'')	so=$1 ;;
					esac
					break
				fi
			fi
		done
		rm -f libxxx.$lib
		$ar cr libxxx.$lib shared.$obj
		ranlib libxxx.$lib
		eval set x x $probe_lib_all_undef
		rm -f xxx$dll
		if	$dld $shared -o xxx$dll libxxx.$lib && test -r xxx$dll
		then	if	$nm $nmflags xxx$dll | grep ShareD
			then	lib_dll=OPTION
				set x x
			fi
		fi
		while	:
		do	shift
			shift
			case $# in
			0|1)	break ;;
			esac
			rm -f xxx$dll
			if	$dld $shared -o xxx$dll $1 libxxx.$lib $2 && test -r xxx$dll
			then	if	$nm $nmflags xxx$dll | grep ShareD
				then	lib_dll=option
					lib_all=$1
					lib_undef=$2
					break
				fi
			fi
			case $2 in
			?*)	if	$dld $shared -o xxx$dll $1 libxxx.$lib && test -r xxx$dll
				then	if	$nm $nmflags xxx$dll | grep ShareD
					then	lib_dll=option
						lib_all=$1
						break
					fi
				fi
				;;
			esac
		done
		case $lib_dll in
		OPTION)	lib_dll=option
			;;
		option)	case $lib_undef in
			"")	rm -f libyyy.$lib
				$ar cr libyyy.$lib notall.$obj
				ranlib libyyy.$lib
				$cc -c prefix.$src
				eval set x x $probe_lib_all_undef
				while	:
				do	shift
					shift
					case $# in
					0|1)	break ;;
					esac
					rm -f xxx$dll
					if	$dld $shared -o xxx$dll prefix.$obj $lib_all libxxx.$lib $2 libyyy.$lib && test -r xxx$dll
					then	rm -f t
						$nm $nmflags xxx$dll > t
						case `grep -c ShareD t`:`grep -c NotalL t` in
						0:*)	;;
						*:0)	lib_undef=$2
							break
							;;
						esac
					fi
				done
				;;
			esac
			case $lib_undef in
			"")	eval set x $probe_lib_multiple
				rm -f libyyy.$lib
				cp libxxx.$lib libyyy.$lib
				rm -f xxx$dll
				if	$dld $shared -o xxx$dll prefix.$obj $lib_all libxxx.$lib libyyy.$lib && test -r xxx$dll
				then	:
				else	while	:
					do	shift
						case $# in
						0)	break ;;
						esac
						rm -f xxx$dll
						if	$dld $shared -o xxx$dll prefix.$obj $lib_all $1 libxxx.$lib libyyy.$lib && test -r xxx$dll
						then	rm -f t
							$nm $nmflags xxx$dll > t
							case `grep -c ShareD t` in
							0)	;;
							*)	lib_all="$lib_all $1"
								break
								;;
							esac
						fi
					done
				fi
				lib_dll=symbol
				;;
			esac
			;;
		*)	lib_dll=symbol
			;;
		esac
		case `cat e` in
		?*)	eval set x $probe_unresolved
			while	:
			do	shift
				case $# in
				0)	break ;;
				esac
				rm -f xxx$dll
				if	eval '$dld $shared' $1 '-o xxx$dll shared.$obj 2>e && test -r xxx$dll'
				then	case `cat e` in
					"")	shared="$shared $1"; break ;;
					esac
				fi
			done
			;;
		esac
		r=
		eval set x $probe_shared_registry
		while	:
		do	shift
			r=x$r
			case $# in
			0)	break ;;
			esac
			rm -f xxx$dll
			if	eval \$dld \$shared -o xxx\$dll $1 shared.\$obj &&
				test -r xxx$dll -a -r $probe_shared_registry_file
			then	probe_shared_registry_file='$(CC.SHARED.REGISTRY.PATH)'
				eval set x $probe_shared_registry
				i=
				while	:
				do	shift
					i=x$i
					case $i in
					$r)	break ;;
					esac
				done
				shared_registry=$1
			fi
		done
		break 2
	fi

				# ... INDENT
			done
		done
	fi
	case $so in
	?*)	rm -f xxx*
		if	$dld $shared -g -o xxx shared.$obj 2>e
		then	set x $probe_sdb
			while	:
			do	shift
				case $1 in
				0)	break ;;
				esac
				if	test -f xxx$1
				then	sdb=$1
					break
				fi
			done
		fi
		if	$cc -c require.$src
		then	p='
/usr/proberun/lib:/local/runprobe/lib
'
			eval set x $probe_ldrunpath
			while	:
			do	shift
				case $# in
				0)	break ;;
				esac
				rm -f require.exe
				if	$cc -o require.exe $1"$p" require.$obj &&
					grep -c /proberun/ require.exe >/dev/null &&
					grep -c /runprobe/ require.exe > /dev/null
				then	ldrunpath=$1
					eval set x $probe_ldorigin
					while	:
					do	shift
						case $# in
						0)	break ;;
						esac
						rm -f origin.exe
						if	$cc -o origin.exe $1 $ldrunpath'$ORIGIN' require.$obj
						then	if	./origin.exe > /dev/null 2>&1
							then	ldorigin="$1 $ldrunpath"'\$ORIGIN/$(BINDIR:P=R=$(DLLDIR))'
							fi
							break
						fi
					done
					break
				fi
			done
		fi
		rm -f libxxx$so
		if	$cc -c sovmain.$src &&
			$cc -c $cc_dll $cc_pic sovlib.c &&
			$dld $shared -o libxxx$so sovlib.$obj &&
			$cc -o sovmain.$exe -L. sovmain.$obj -lxxx
		then	rm -f sovmain.$exe
			mv libxxx$so libxxx$so.5.6
			if	$cc -o sovmain.$exe -L. sovmain.$obj -lxxx
			then	soversion=1
			fi
		fi
		rm -f doti.$obj
		std64=/lib64
		lcl64=/usr/local/lib64
		if	test -d $std64 -a -d $lcl64 && $cc -c doti.$src
		then	for i in `cd $lcl64; ls *$so 2>/dev/null | sed 's/lib\([^.]*\).*/\1/'`
			do	if	$cc -o runpath.$exe doti.$obj -l$i >/dev/null 2>&1
				then	LD_LIBRARY_PATH= ./runpath.$exe >/dev/null 2>&1 && continue
					if	LD_LIBRARY_PATH=$lcl64 ./runpath.$exe >/dev/null 2>&1
					then	runpath=$lcl64
						break
					elif	LD_LIBRARY_PATH=$std64 ./runpath.$exe >/dev/null 2>&1
					then	runpath=$std64
						break
					elif	LD_LIBRARY_PATH=$lcl64:$std64 ./runpath.$exe >/dev/null 2>&1
					then	runpath=$lcl64:$std64
						break
					fi
				fi
			done
		fi
		;;
	esac
	;;
esac

rm -f shared.$obj
if	$cc -c shared.$src
then	eval set x $probe_ar_arflags
	while	:
	do	shift
		case $# in
		0)	break ;;
		esac
		rm -f libxxx.$lib
		if	$ar $1 r libxxx.$lib shared.$obj && $ar $1 t libxxx.$lib 2>&1 | grep shared.$obj >/dev/null
		then	ar_arflags=$1
			break
		fi
	done
	eval set x $probe_arflags
	while	:
	do	shift
		case $# in
		0)	break ;;
		esac
		rm -f libxxx.$lib
		if	$cc $1 -o libxxx.$lib shared.$obj && $ar t libxxx.$lib 2>&1 | grep shared.$obj >/dev/null
		then	arflags=$1
			break
		fi
	done
fi

case $shared in
-G)	case $cc_dll in
	"")	cc_dll=$cc_dll_def ;;
	esac
	;;
*)	case $lib_dll in
	symbol)	echo 'extern int f();
	int main() { f(); return 0; }' > main.$src
		echo '#include <stdio.h>
	int f() { printf("hello world"); return 0; }' > member.$src
		if	$cc -c main.$src && $cc -c member.$src
		then	echo f > lib.exp
			rm -f lib.$obj main.exe
			if	$ld -o lib.$obj -L: -bexport:lib.exp -berok -bmodtype:SRE -T512 -H512 -lm -lc member.$obj && $cc -o main.exe main.$obj lib.$obj
			then	dld=$ld
				shared='-T512 -H512 -L$(LIBDIR): -berok -bmodtype:SRE'
				lib_dll=export
				dll_libraries='-lm -lc'
				ldscript=.exp
				case $cc_dll in
				"")	cc_dll=$cc_dll_def ;;
				esac
				case $so in
				"")	so=.$obj ;;
				esac
			fi
		fi
		;;
	esac
	;;
esac
case $shared in
?*)	if	$cc -c $cc_dll $cc_pic shared.$src
	then	eval set x $probe_shared_name
		while	:
		do	shift
			case $# in
			0)	break ;;
			esac
			rm -f xxx$dll
			if	$dld $shared ${1}libfoo.1.2 -o xxx$dll shared.$obj 2>e && test -r xxx$dll
			then	shared_name=$1
				break
			fi
		done
	fi
	;;
esac
case " $cc_dll " in
*" $cc_dll_def "*)
	;;
"  ")	;;
*)	cc_dll="$cc_dll_def $cc_dll"
	;;
esac

case $hosttype in
win32.*|cygwin.*|os2.*)
	Lflag=1
	;;
*)	if	$cc -c doti.$src
	then	if	$cc -L. doti.$obj -lc >/dev/null
		then	case $cc_dll in
			'')	;;
			*)	Lflag=1 ;;
			esac
		fi
	fi
	;;
esac

case $lib_dll in
option)	case $hosttype in
	linux.*)	dll_libraries=-lc ;;
	esac
	;;
SYMBOL)	lib_dll=symbol
	;;
symbol)	echo "#include <stdio.h>
extern int fun()
{
	puts(\"fun\");
	return 0;
}" > dllib.$src
	echo "extern int fun();
int
main()
{
	return fun();
}" > dlmain.$src
	pwd=`pwd`
	while	:
	do
		if	$cc -c $cc_dll $cc_pic dlmain.$src &&
			$cc -c $cc_dll $cc_pic dllib.$src
		then	rm -f libxxx$so
			if	$dld $shared -o libxxx$so dllib.$obj &&
				chmod 555 libxxx$so
			then	rm -f dlmain.$exe
				if	$cc -o dlmain.$exe dlmain.$obj $pwd/libxxx$so &&
					(./dlmain.$exe) >/dev/null 2>&1
				then	break
				fi
			fi
			rm -f libxxx$so dlmain.$exe
			if	$dld $shared -o libxxx$so dllib.$obj -lm -lc &&
				chmod 555 libxxx$so &&
				$cc -o dlmain.$exe dlmain.$obj $pwd/libxxx$so &&
				(./dlmain.$exe) >/dev/null 2>&1
			then	dll_libraries='-lm -lc'
			fi
		fi
		break
	done
	# the dll_libraries probe is still lame
	case $dll_libraries in
	'')	case $hosttype in
		sco.*|sol*.*|sun*)	;;
		*)			dll_libraries='-lm -lc' ;;
		esac
		;;
	esac
	;;
esac

stdlib=
a=`$cc -print-multi-directory 2>/dev/null`
case $a in
.)	;;
*)	for d in `$cc -print-search-dirs 2>/dev/null | sed -e '/^libraries:/!d' -e 's/.*=//' | tr : '\n' | grep /lib/`
	do	if	[ -d ${d}${a} ]
		then	stdlib="$stdlib ${d}${a}"
		else	case $d in
			*/lib/)	d=`echo '' $d | sed -e 's,/$,,'`
				if	[ -d ${d}${a} ]
				then	stdlib="$stdlib ${d}${a}"
				fi
				;;
			esac
		fi
	done
	;;
esac
case $stdlib in
'')	stdlib=`$cc -v doti.$src 2>&1 |
		sed 's/  */\n/g' |
		sed -e '/^-L/!d' -e 's/^-L//' |
		while read dir
		do	if	test -d "$dir"
			then	(cd "$dir"; pwd)
			fi
		done`
	;;
*)	eval set x $probe_verbose
	shift
	for o in "$@"
	do	stdlib="$stdlib "`$cc $o doti.$src 2>&1 |
		sed 's/  */\n/g' |
		sed -e '/^-L/!d' -e '/\/lib64$/!d' -e 's/^-L//'`
	done
	;;
esac
case $stdlib in
?*)	keepstdlib=1
	o=$stdlib
	stdlib=
	for dir in $o
	do	case " $stdlib " in
		*" $o "*) continue ;;
		esac
		case $dir in
		/usr/lib64)
			i=/usr/local/lib64
			a=/lib64
			;;
		/lib64) i=/usr/local/lib64
			a=/usr/lib64
			;;
		/usr/lib)
			i=/usr/local/lib
			a=/lib
			;;
		lib)	i=/usr/local/lib
			a=/usr/lib
			;;
		*)	i=
			a=
			;;
		esac
		if	test "" != "$i" -a -d "$i"
		then	case " $o " in
			*" $i "*)
				;;
			*)	stdlib="$stdlib $i"
				;;
			esac
		fi
		stdlib="$stdlib $dir"
		if	test "" != "$a" -a -d "$a"
		then	case " $o " in
			*" $a "*)
				;;
			*)	stdlib="$stdlib $a"
				;;
			esac
		fi
	done
	case $hosted in
	1)	case " $stdlib " in
		*" /usr/lib "*)
			;;
		*)	case " $stdlib " in
			*" /usr/local/lib "*)
				;;
			*)	stdlib="$stdlib /usr/local/lib"
				;;
			esac
			stdlib="$stdlib /usr/lib"
			;;
		esac
		case " $stdlib " in
		*" /lib "*)
			;;
		*)	stdlib="$stdlib /lib"
			;;
		esac
	esac
	;;
*)	keepstdlib=0
	case $dir in
	*/arch/$hosttype/lib/*)
		notlib=`echo $dir | sed "s,/arch/$hosttype/lib/.*,/arch/$hosttype/lib,"`
		;;
	*)	notlib=////
		;;
	esac
	tstlib=
	implib=
	if	$cc -c hosted.$src
	then	for f in `(
			eval set x $probe_verbose
			while	:
			do	shift
				case $# in
				0)	break ;;
				esac
				$cc $1 hosted.$obj
			done
			) 2>&1 | sed -e 's/[ 	:]/\\
	/g' -e 's/-L//g' -e 's/^P,//' -e "s/[\"']//g" -e 's,^[\\\\/]*[\\\\/],/,' | sed -e '/^\$/d' -e '/^[-+]/d' -e '/^[^\\\\\\/]/d' -e '/[\\\\\\/]tmp[\\\\\\/]/d' -e 's/:\$//' -e 's,//*$,,'`
		do	case " $tstlib $implib " in
			*" $f "*)	continue ;;
			esac
			case $f in
			$notlib)	continue ;;
			esac
			if	test -d $f
			then	tstlib="$tstlib $f"
			elif	test -f $f
			then	d=`echo $f | sed -e 's,[\\\\/]*[^\\\\/]*\$,,'`
				case " $tstlib $implib " in
				*" $d "*)	continue ;;
				esac
				case $d in
				*[\\/]usr[\\/]lib)
					x=$d
					d="`echo $d | sed -e 's,[\\\\/][\\\\/]*usr[\\\\/]lib\$,/lib,'`"
					case " $tstlib $implib " in
					*" $d "*)	;;
					*)		implib="$implib $d" ;;
					esac
					implib="$implib $x"
					;;
				*[\\/]lib)
					implib="$implib $d"
					d="`echo $d | sed -e 's,[\\\\/][\\\\/]*lib\$,/usr/lib,'`"
					case " $tstlib $implib " in
					*" $d "*)	;;
					*)		implib="$implib $d" ;;
					esac
					;;
				*)	implib="$implib $d"
					;;
				esac
			fi
		done
	fi
	tstlib="$tstlib $implib"
	if	$cc -Dtype=void -Dcall=exit -c tstlib.$src && mv tstlib.$obj tst.$obj
	then	case $plusplus in
		'')	probe_lxx= ;;
		esac
		l=
		for sym in $probe_l $probe_lxx
		do	case $l in
			"")	l=$sym; continue ;;
			esac
			rm -f tstlib.$exe
			if	$cc -o tstlib.$exe tst.$obj -l$l
			then	eval set x $probe_ldmap
				while	:
				do	shift
					case $# in
					0)	break ;;
					esac
					d=`$cc -Dtype=int -Dcall=$sym $static $1 tstlib.$src -l$l 2>&1 | sed -e '/[\\\\\\/].*[\\\\\\/]lib[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+]*\.[^\\\\\\/]*\$/!d' -e 's,^[^\\\\\/]*,,' -e 's,[\\\\\\/]lib[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+]*\.[^\\\\\\/]*\$,,' -e '/^[\\\\\\/]/!d' | sort -u`
					case $d in
					?*)	tstlib="$tstlib $d" ;;
					esac
				done
			fi
			l=
		done
	fi
	libstd=
	libset=
	stdlibroot="/ /usr/"
	for d in $tstlib
	do	case $d in
		[\\/]lib|[\\/]usr[\\/]lib)
			;;
		*)	case " $stdlib " in
			*\ $d\ *)
				;;
			*)	if	ls $d ${PREROOT+$PREROOT/../$d} > tmp.tmp && test -s tmp.tmp
				then	for i in $probe_lib $obj
					do	if	grep -i "\\.$i\$" tmp.tmp >/dev/null
						then	case " $probe_lib_append " in
							*\ $d\ *)
								libstd="$libstd $d"
								;;
							*)	stdlib="$stdlib $d"
								case $d in
								/usr/lib|/usr/lib/*)
									;;
								/usr/lib?*)
									e=`echo $d | sed -e 's,/usr,,'`
									g=`echo $d/libc.* $e/libc.*`
									case "$e $g " in
									*".* "*);;
									*)	stdlib="$stdlib $e"
										stdlibroot=
										;;
									esac
									;;
								esac
								;;
							esac
							case $libset in
							"")	case $i in
								$obj)	;;
								*)	libset=1
									lib=$i
									;;
								esac
								;;
							esac
							break
						fi
					done
				fi
				;;
			esac
			;;
		esac
	done
	for d in `$ld --verbose 2>&1 | sed -e '/SEARCH_DIR/!d' -e 's/[ 	][ 	][ 	]*/ /g' -e 's/SEARCH_DIR(\([^ ]*\));/\1/g' -e 's, //[^ ]*,,' -e 's,",,g'`
	do	if	test -d $d
		then	case " $stdlib $libstd " in
			*\ ${d}\ *)
				;;
			*)	libstd="$libstd $d"
				;;
			esac
		fi
	done
	case $hosted in
	"")	tstlib= ;;
	*)	tstlib="$stdlibroot /usr/ccs/ /usr/local/" ;;
	esac
	case $stdlibroot in
	?*)	d=
		for f in $stdinclude
		do	f=`echo $f | sed -e 's,[^\\\\/]*\$,,'`
			d="$d $f"
		done
		tstlib="$d $tstlib"
		;;
	esac
	$cc -c doti.$src > all.tmp
	for f in $probe_libdir
	do	for d in $stdlib $libstd $tstlib
		do	if	test -d ${d}${f}
			then	ls ${d}${f} ${PREROOT:+$PREROOT/../${d}${f}} |
				while read i
				do	for j in ${d}${f}/${i} ${PREROOT:+$PREROOT/../${d}${f}/${i}}
					do	if	test -f $j -a -r $j -a -s $j
						then	echo $i
							break
						fi
					done
				done > tmp.tmp
				if	test -s tmp.tmp
				then	if	egrep -i "^${prefix_archive}[abcdefghijklmnopqrstuvwxyz0123456789_][abcdefghijklmnopqrstuvwxyz0123456789_]*\\.$lib\$" tmp.tmp >lib.tmp ||
						egrep -i "\\.$obj\$" tmp.tmp >/dev/null ||
						egrep -i "^${prefix_shared}[abcdefghijklmnopqrstuvwxyz0123456789_][abcdefghijklmnopqrstuvwxyz0123456789_]*\\$so(.[0-9]+)*\$" tmp.tmp >>lib.tmp
					then	if	test -s lib.tmp
						then	sed -e "s,.*/,," -e 's,^'${prefix_archive}'\(.*\)\.'$lib'$,\1,g' -e 's,^'${prefix_shared}'\(.*\)\'$so'[.0-9]*,\1,g' lib.tmp | sort -u > tmp.tmp
							xs=`sort all.tmp all.tmp tmp.tmp | uniq -u`
							case $xs in
							'')	continue ;;
							esac
							ok=0
							for x in $xs
							do	case $x in
								*_p)	continue ;; # linux gcc known to hang for -lc_p
								esac
								if	$cc -o doti.$exe doti.$obj -l$x 2>e
								then	ok=1
								else	if	test -s e && egrep -i ":.*[ 	](find|found|locate|search|-l$x)[ 	]" e > /dev/null
									then	if	egrep -i ":.*[ 	](access|permission)[ 	]" e
										then	: maybe
										else	ok=0
											break
										fi
									fi
									case $Lflag in
									1)	if	$cc -L${d}${f} -o doti.$exe doti.$obj -l$x
										then	ok=0
											break
										fi
										;;
									esac
								fi
							done
							case $ok in
							0)	continue ;;
							esac
							sort -u all.tmp tmp.tmp > lib.tmp
							mv lib.tmp all.tmp
						fi
						case " $stdlib $libstd " in
						*" ${d}${f} "*)
							;;
						*)	if	test -d ${d}${f}/fsoft
							then	stdlib="$stdlib ${d}${f}/"'$(FLOAT_OPTION)'
							fi
							stdlib="$stdlib ${d}${f}"
							;;
						esac
					fi
				fi
			fi
		done
	done
	stdlib="$stdlib $libstd"
	case $stdlib in
	*/shlib*)
		dy=
		st=
		for i in $stdlib $libstd
		do	case $i in
			*/shlib)	dy="$dy $i" ;;
			*)		st="$st $i" ;;
			esac
		done
		for i in /var
		do	if	test -d $i/shlib
			then	dy="$dy $i/shlib"
			fi
		done
		stdlib="$dy $st"
		;;
	esac
	;;
esac

if	$cc -c prefix.$src
then	eval set x $probe_symprefix
	while	:
	do	shift
		case $# in
		0)	break ;;
		esac
		if	$nm $nmflags prefix.$obj | grep -c ${1}prefix >/dev/null
		then	symprefix=$1
			break
		fi
	done
fi

if	$cc -c warn.$src 2>e && test -f warn.$obj
then	e=`wc -c < e`

	eval set x $probe_debug
	while	:
	do	shift
		case $# in
		0)	break ;;
		esac
		rm -f warn.$obj
		$cc $1 -c warn.$src 2>e && test -f warn.$obj || continue
		case `wc -c < e` in
		$e)	debug=$1; break ;;
		esac
	done

	eval set x $probe_no_protect
	while	:
	do	shift
		case $# in
		0)	break ;;
		esac
		rm -f warn.$obj
		$cc $1 -c warn.$src 2>e && test -f warn.$obj || continue
		case `wc -c < e` in
		$e)	no_protect=$1; break ;;
		esac
	done

	case $version_string in
	$probe_gcc_version)	probe_optimize="$probe_gcc_optimize $probe_optimize" ;;
	esac
	eval set x $probe_optimize
	while	:
	do	shift
		case $# in
		0)	break ;;
		esac
		rm -f warn.$obj
		$cc $1 -c warn.$src 2>e && test -f warn.$obj || continue
		case `wc -c < e` in
		$e)	optimize=$1; break ;;
		esac
	done

	eval set x $probe_strict
	while	:
	do	shift
		case $# in
		0)	break ;;
		esac
		rm -f warn.$obj
		$cc $1 -c warn.$src 2>e && test -f warn.$obj || continue
		n=`wc -c < e`
		if	test $n -ge $e
		then	strict=$1
			break
		fi
	done

	$cc -c warn1.$src 2>e
	o=`wc -c < e`
	eval set x $probe_warn
	while	:
	do	shift
		case $# in
		0)	break ;;
		esac
		rm -f warn.$obj warn.$exe
		$cc -o warn.$exe $1 warn.$src 2>e && test -f warn.$exe || continue
		n=`wc -c < e`
		for i in $warn_enum
		do	rm -f warn$i.$obj
			$cc -c $1 warn$i.$src 2>e && test -f warn$i.$obj || continue
			n=`wc -c < e`
			if	test $n -gt $o
			then	warn=$1
				break 2
			fi
		done
	done

fi

while	:
do	case $hosted in
	1)	rm -f readonly.$exe
		eval set x '""' $probe_readonly
		while	:
		do	shift
			case $# in
			0)	break ;;
			esac
			for co in '' -Dtest_const
			do	rm -f readonly.$exe
				if	$cc -o readonly.$exe $co $1 readonly.$src && $executable readonly.$exe
				then	if	./readonly.$exe >/dev/null 2>&1
					then	:
					else	readonly=$1
						break 3
					fi
				fi
			done
		done
		rm -f readonly.$exe readonly.s
		if	$cc -S readonly.$src && test -f readonly.s
		then	if	sed	-e 's/^\([ 	]*[.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$:]*[ 	]*\.*\)data/\1text/' \
					-e 's/^\([ 	]*[.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$:]*[ 	]*\.*\)zero[ 	][ 	]*/\1set	.,.+/' \
					-e 's/^\([ 	]*[.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$:]*[ 	]*\.*\)space[ 	][ 	]*1/\1byte 0/' \
					-e 's/^\([ 	]*[.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$:]*[ 	]*\.*\)space[ 	][ 	]*2/\1byte 0,0/' \
					-e 's/^\([ 	]*[.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$:]*[ 	]*\.*\)space[ 	][ 	]*3/\1byte 0,0,0/' \
					-e 's/^\([ 	]*[.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$:]*[ 	]*\.*\)space[ 	][ 	]*4/\1byte 0,0,0,0/' \
					readonly.s > ro.s && $cc -o readonly.$exe ro.s && $executable readonly.$exe
			then	if	./readonly.$exe >/dev/null 2>&1
				then	:
				else	readonly='-S.data'
					break
				fi
			fi
			rm -f readonly.$exe
			if	sed	-e 's/^\([ 	]*[.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$:]*[ 	]*\.*\)idat/\1code/' \
					-e 's/^\([ 	]*[.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$:]*[ 	]*\.*\)zero[ 	][ 	]*/\1set	.,.+/' \
					-e 's/^\([ 	]*[.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$:]*[ 	]*\.*\)space[ 	][ 	]*1/\1byte 0/' \
					-e 's/^\([ 	]*[.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$:]*[ 	]*\.*\)space[ 	][ 	]*2/\1byte 0,0/' \
					-e 's/^\([ 	]*[.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$:]*[ 	]*\.*\)space[ 	][ 	]*3/\1byte 0,0,0/' \
					-e 's/^\([ 	]*[.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$:]*[ 	]*\.*\)space[ 	][ 	]*4/\1byte 0,0,0,0/' \
					readonly.s > ro.s && $cc -o readonly.$exe ro.s && $executable readonly.$exe
			then	if	./readonly.$exe >/dev/null 2>&1
				then	:
				else	readonly='-S.idat'
					break
				fi
			fi
			if	sed	-e 's/^\([ 	]*[.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$:]*[ 	]*\.*\)data/\1rdata/' \
					readonly.s > ro.s && $cc -o readonly.$exe ro.s && $executable readonly.$exe
			then	if	./readonly.$exe >/dev/null 2>&1
				then	:
				else	readonly='-S.rdata'
					break
				fi
			fi
		fi
		;;
	esac
	break
done

case $stdc in
?*)	dialect="$dialect ANSI" ;;
esac
case $plusplus in
?*)	dialect="$dialect C++" ;;
esac
case $hosted in
"")	dialect="$dialect CROSS" ;;
esac
case $doti in
?*)	dialect="$dialect DOTI" ;;
esac
case $gnu in
?*)	dialect="$dialect GNU" ;;
esac
case $so:$dynamic:$static in
::)	;;
*)	dialect="$dialect DYNAMIC"
	case $soversion in
	?*)	dialect="$dialect VERSION" ;;
	esac
	;;
esac
case $implicitc in
?*)	dialect="$dialect IMPLICITC" ;;
esac
case $ptrcopy in
?*)	dialect="$dialect PTRCOPY" ;;
esac
case $ptrimplicit in
?*)	dialect="$dialect PTRIMPLICIT" ;;
esac
case $ptrmkdir in
?*)	dialect="$dialect PTRMKDIR" ;;
esac
case $libpp in
?*)	dialect="$dialect LIBPP" ;;
esac
case $toucho in
?*)	dialect="$dialect TOUCHO" ;;
esac
case $dDflag in
?*)	dialect="$dialect -dD" ;;
esac
# 2005-05-25 use $(CC.INCLUDE.LOCAL) instead
case $include_local in
?*)	dialect="$dialect -I-" ;;
esac
case $Lflag in
?*)	dialect="$dialect -L" ;;
esac

ppcmd='$(CPP)'
ppdir='$(CPP:D)'
eval ppopt='"'$ppopt'"'
eval ppenv='"'$ppenv'"'

set x "" .$exe
shift
exe=
for i
do	rm -f require$i
done
if	$cc -o require require.$src
then	for i
	do	if	$executable require$i
		then	exe=$i
			break
		fi
	done
fi
case $sa:$sd:$so in
::?*)	eval set x $probe_sa
	while	:
	do	shift
		case $# in
		0)	break ;;
		esac
		for i in $stdlib
		do	eval j="'" $i/lib*$1 "'"
			case $j in
			" $i/lib*$1 ")
				eval j="'" $i/lib*$1.[0123456789]* "'"
				case $j in
				" $i/lib*$1.[0123456789]* ")
					continue
					;;
				esac
				;;
			esac
			sa=$1
			lddynamic=-Bdynamic
			ldstatic=-Bstatic
			break 2
		done
	done
	;;
esac
case $ldscript in
"")	case $so in
	.lib)	ldscript=".def .exp" ;;
	*)	ldscript=".ld" ;;
	esac
	;;
esac
case $hosttype in
'')		hosttype=unknown ;;
sgi.mips3)	dll_variants='sgi.mips2:o32:-mips2 sgi.mips4:64:-mips4' ;;
sgi.mips4)	dll_variants='sgi.mips2:o32:-mips2 sgi.mips3:n32:-mips3' ;;
esac

case $hosted in
"")	ccnative=`echo $cc | sed -e 's,.*/,,'`
	ccs=$ccnative
	for c in cc gcc
	do	case " $ccs " in
		*" $c "*)	;;
		*)		ccs="$ccs $c" ;;
		esac
	done
	for p in $path
	do	for c in $ccs
		do	if	$executable $p/$c
			then	rm -f native.$exe
				if	$p/$c -o native.$exe doti.$src && ./native.$exe
				then	ccnative=$p/$c
					exectype=`package CC="$ccnative" || $SHELL -c "package CC='$ccnative'"`
					case $exectype in
					*[Uu][Ss][Aa][Gg][Ee]:*)
						exectype=`PATH=$_probe_PATH; export PATH; package CC="$ccnative" || $SHELL -c "package CC='$ccnative'"`
						;;
					esac
					break 2
				fi
			fi
		done
	done
	;;
*)	ccnative=$cc
	exectype=$hosttype
	;;
esac

# runtime shared lib exported symbol resolution

case $cc_dll:$shared in
:|:*|*:);;
*)	cat > cmd.c <<'!'
#include <stdio.h>
#include <dlfcn.h>
typedef int (*Lib_f)(int**, int**, int**);
int	gbl_def = 1;
int	gbl_ref = 1;
int	gbl_ext;
int main(int argc, char** argv)
{
	void*	dll;
	Lib_f	lib;
	int*	def;
	int*	ref;
	int*	ext;

	if (!(dll = dlopen(*++argv, RTLD_LAZY)))
		fprintf(stderr, "library not found\n");
	else if (!((lib = (Lib_f)dlsym(dll, "lib"))) && !(lib = (Lib_f)dlsym(dll, "_lib")))
		fprintf(stderr, "symbol not found\n");
	else if ((*lib)(&def, &ref, &ext))
		fprintf(stderr, "function failed\n");
	else if (def == &gbl_def && ref == &gbl_ref && ext == &gbl_ext)
		printf("ALL\n");
	else if (ref == &gbl_ref && ext == &gbl_ext)
		printf("REF\n");
	else if (ext == &gbl_ext)
		printf("EXT\n");
	return 0;
}
!
	cat > lib.c <<'!'
int	gbl_def = 1;
int	gbl_ref;
int	gbl_ext;
int lib(int** def, int** ref, int** ext)
{
	*def = &gbl_def;
	*ref = &gbl_ref;
	*ext = &gbl_ext;
	return 0;
}
!
	if	$cc -c $cc_dll $cc_pic cmd.c &&
		$cc -c $cc_dll $cc_pic lib.c && {
			$cc $cc_dll $export_dynamic -o cmd.exe cmd.o ||
			$cc $cc_dll $export_dynamic -o cmd.exe cmd.o -ldl
		} &&
		$dld $shared -o libgbl.dll lib.o
	then	x=`./cmd.exe ./libgbl.dll`
		case $x in
		?*)	dialect="$dialect EXPORT=$x" ;;
		esac
	else	case $sd:$hosttype in
		.dll:*win*)	dialect="$dialect EXPORT=DLL" ;;
		esac
	fi
	;;
esac

# shellmagic defined if installed shell scripts need magic

echo ': got magic :
echo ok' > ok
chmod +x ok
case `(eval ./ok | /bin/sh) 2>/dev/null` in
ok)	;;
*)	echo '#!/bin/env sh
: got magic :
echo ok' > ok
	chmod +x ok
	case `(eval ./ok | /bin/sh) 2>/dev/null` in
	ok)	shellmagic='$("#")!/bin/env sh'
		;;
	*)	for i in /emx/bin/bash.exe /emx/bin/sh.exe
		do	if	test -x $i
			then	shellmagic='$("#")!'$i
				break
			fi
		done
		;;
	esac
	;;
esac

#
# path cleanup
#

for i in ar ccnative dld ld nm size stdinclude stdlib strip 
do	eval o='$'$i
	v=$o
	case $v in
	*//*)	v=`echo $v | sed 's,///*,/,g'` ;;
	esac
	if	(test . -ef "`pwd`")
	then	k=
		for x in $v
		do	case $x in
			*/../*|*/..)
				case $x in
				/*)	a=/ ;;
				*)	a= ;;
				esac
				IFS=/
				set '' $x
				IFS=$ifs
				r=
				for d
				do	r="$d $r"
				done
				p=
				g=
				for d in $r
				do	case $d in
					..)	g="$g $d" ;;
					*)	case $g in
						'')	case $p in
							'')	p=$d ;;
							*)	p=$d/$p ;;
							esac
							;;
						*)	set $g
							shift
							g=$*
							;;
						esac
						;;
					esac
				done
				case $a in
				'')	for d in $g
					do	p=$d/$p
					done
					;;
				*)	p=$a$p
					;;
				esac
				case $p in
				/)	continue ;;
				esac
				test $x -ef $p && x=$p
				;;
			esac
			k="$k $x"
		done
		set '' $k
		shift
		v=$1
		case $# in
		0)	;;
		*)	shift
			while	:
			do	case $# in
				0)	break ;;
				esac
				k=
				for d
				do	for j in $v
					do	test $d -ef $j && continue 2
					done
					k="$k $d"
				done
				set '' $k
				case $# in
				1)	break ;;
				esac
				shift
				v="$v $1"
				shift
			done
			;;
		esac
	fi
	case $v in
	$o)	;;
	*)	eval $i='$'v ;;
	esac
done

case $keepstdlib in
1)	;;
*)	#
	# favor lib64 over lib
	#
	case $hosttype in
	*64|*[!0-9]64[!a-zA-Z0-9]*)
		o=$stdlib
		stdlib=
		for i in $o
		do	case " $stdlib " in
			*" $i "*)
				continue
				;;
			esac
			case $i in
			*64)	stdlib="$stdlib $i"
				continue
				;;
			esac
			case " $o " in
			*" ${i}64 "*)
				case " $stdlib " in
				*" ${i}64 "*)
					;;
				*)	stdlib="$stdlib ${i}64"
					;;
				esac
				;;
			esac
			stdlib="$stdlib $i"
		done
		;;
	esac
	;;
esac

#
# set up for local override
#

CC_VERSION_STAMP=$version_stamp
CC_VERSION_STRING=$version_string
CC_CC=$cc
CC_NATIVE=$ccnative
CC_EXECTYPE=$exectype
CC_HOSTTYPE=$hosttype
CC_ALTPP_FLAGS=$ppopt
CC_ALTPP_ENV=$ppenv
CC_AR=$ar
CC_AR_ARFLAGS=$ar_arflags
CC_ARFLAGS=$arflags
CC_DEBUG=$debug
CC_DIALECT=$dialect
CC_PICBIG=$cc_PIC
CC_PICSMALL=$cc_pic
CC_PIC=$CC_PICBIG
CC_DLL_ONLY=$cc_dll
case $CC_DLL_ONLY in
'')	CC_DLLBIG=
	CC_DLLSMALL=
	CC_DLL=
	;;
*)	CC_DLLBIG="$CC_DLL_ONLY $CC_PICBIG"
	CC_DLLSMALL="$CC_DLL_ONLY $CC_PICSMALL"
	CC_DLL="$CC_DLL_ONLY $CC_PICBIG"
	;;
esac
CC_DLL_DIR=$dll_dir
CC_DLL_LIBRARIES=$dll_libraries
CC_DLL_VARIANTS=$dll_variants
CC_DYNAMIC=$dynamic
CC_EXPORT_DYNAMIC=$export_dynamic
CC_INCLUDE_LOCAL=$include_local
CC_LD=$ld
CC_LD_DYNAMIC=$lddynamic
CC_LD_LAZY=$ldlazy
CC_LD_NOLAZY=$ldnolazy
CC_LD_ORIGIN=
CC_LD_RECORD=$ldrecord
CC_LD_NORECORD=$ldnorecord
CC_LD_RUNPATH=$ldrunpath
CC_LD_STATIC=$ldstatic
CC_LD_STRIP=$ldstrip
CC_LIB_DLL=$lib_dll
CC_LIB_ALL=$lib_all
CC_LIB_UNDEF=$lib_undef
CC_MAKE_OPTIONS=$makeoptions
CC_NM=$nm
CC_NMEDIT=$nmedit
CC_NMFLAGS=$nmflags
CC_NOPROTECT=$no_protect
CC_OPTIMIZE=$optimize
CC_READONLY=$readonly
CC_REPOSITORY=$repository
CC_REQUIRE=$require
CC_RUNPATH=$runpath
CC_SHARED=$shared
CC_SHARED_LD=$dld
CC_SHARED_NAME=$shared_name
CC_SHARED_REGISTRY=$shared_registry
CC_SHARED_REGISTRY_PATH=$probe_shared_registry_path
CC_SHELLMAGIC=$shellmagic
CC_SIZE=$size
CC_STATIC=$static
CC_STDINCLUDE=$stdinclude
CC_STDLIB=$stdlib
CC_STRICT=$strict
CC_STRIP=$strip
CC_STRIP_FLAGS=$stripflags
CC_PREFIX_ARCHIVE=$prefix_archive
CC_PREFIX_DYNAMIC=$prefix_dynamic
CC_PREFIX_SHARED=$prefix_shared
CC_PREFIX_SYMBOL=$symprefix
CC_SUFFIX_ARCHIVE=.$lib
CC_SUFFIX_COMMAND=$suffix_command
CC_SUFFIX_DEBUG=$sdb
CC_SUFFIX_DYNAMIC=$sd
CC_SUFFIX_LD=$ldscript
CC_SUFFIX_OBJECT=.$obj
CC_SUFFIX_SHARED=$so
CC_SUFFIX_SOURCE=.$src
CC_SUFFIX_STATIC=$sa
CC_VERSION=$version_flags
CC_WARN=$warn
CC_ATTRIBUTES=$ATTRIBUTES

exec >&3

#
# check for local override
# all CC_* but { CC_CC CC_VERSION_STAMP CC_VERSION_STRING } may be modified
# additional CC.* may be printed on stdout
#

if	test -f "$dir/probe.lcl"
then	. "$dir/probe.lcl"
fi

#
# the payoff
#

case $version_stamp in
?*)	echo "# $version_stamp" ;;
esac
echo CC.CC = $cc
echo CC.NATIVE = $CC_NATIVE
echo CC.EXECTYPE = $CC_EXECTYPE
echo CC.HOSTTYPE = $CC_HOSTTYPE
echo CC.ALTPP.FLAGS = $CC_ALTPP_FLAGS
echo CC.ALTPP.ENV = $CC_ALTPP_ENV
echo CC.AR = $CC_AR
echo CC.AR.ARFLAGS = $CC_AR_ARFLAGS
echo CC.ARFLAGS = $CC_ARFLAGS
echo CC.DEBUG = $CC_DEBUG
echo CC.DIALECT = $CC_DIALECT
echo CC.DLLBIG = $CC_DLLBIG
echo CC.DLLSMALL = $CC_DLLSMALL
echo CC.DLL = $CC_DLL
echo CC.DLL.DEF = $cc_dll_def
echo CC.DLL.DIR = $CC_DLL_DIR
echo CC.DLL.LIBRARIES = $CC_DLL_LIBRARIES
echo CC.DLL.VARIANTS = $CC_DLL_VARIANTS
echo CC.DYNAMIC = $CC_DYNAMIC
echo CC.EXPORT.DYNAMIC = $CC_EXPORT_DYNAMIC
echo CC.INCLUDE.LOCAL = $CC_INCLUDE_LOCAL
#
# 2004-02-14 release workaround
#
case $CC_SHARED_LD in
$CC_CC)	echo if LDSHARED
	echo CC.LD = $CC_LD
	echo else
	echo CC.LD = $CC_CC
	echo end
	;;
*)	echo CC.LD = $CC_LD
	;;
esac
echo CC.LD.DYNAMIC = $CC_LD_DYNAMIC
echo CC.LD.LAZY = $CC_LD_LAZY
echo CC.LD.NOLAZY = $CC_LD_NOLAZY
echo CC.LD.ORIGIN = $CC_LD_ORIGIN
echo CC.LD.RECORD = $CC_LD_RECORD
echo CC.LD.NORECORD = $CC_LD_NORECORD
echo CC.LD.RUNPATH = $CC_LD_RUNPATH
echo CC.LD.STATIC = $CC_LD_STATIC
echo CC.LD.STRIP = $CC_LD_STRIP
echo CC.LIB.DLL = $CC_LIB_DLL
echo CC.LIB.ALL = $CC_LIB_ALL
echo CC.LIB.UNDEF = $CC_LIB_UNDEF
echo CC.MAKE.OPTIONS = $CC_MAKE_OPTIONS
echo CC.NM = $CC_NM
case $CC_NMEDIT in
?*)	CC_NMEDIT=" $CC_NMEDIT" ;;
esac
echo CC.NMEDIT ="$CC_NMEDIT"
echo CC.NMFLAGS = $CC_NMFLAGS
echo CC.NOPROTECT = $CC_NOPROTECT
echo CC.OPTIMIZE = $CC_OPTIMIZE
echo CC.PICBIG = $CC_PICBIG
echo CC.PICSMALL = $CC_PICSMALL
echo CC.PIC = $CC_PIC
echo CC.READONLY = $CC_READONLY
echo CC.REPOSITORY = $CC_REPOSITORY
for f in $CC_REQUIRE
do	echo CC.REQUIRE.$f =`cat req.$f`
done
echo CC.RUNPATH = $CC_RUNPATH
echo CC.SHARED = $CC_SHARED
echo CC.SHARED.LD = $CC_SHARED_LD
echo CC.SHARED.NAME = $CC_SHARED_NAME
echo CC.SHARED.REGISTRY = $CC_SHARED_REGISTRY
echo CC.SHARED.REGISTRY.PATH = $CC_SHARED_REGISTRY_PATH
echo CC.SHELLMAGIC = $CC_SHELLMAGIC
echo CC.SIZE = $CC_SIZE
echo CC.STATIC = $CC_STATIC
echo CC.STDINCLUDE = $CC_STDINCLUDE
echo CC.STDLIB = $CC_STDLIB
echo CC.STRICT = $CC_STRICT
echo CC.STRIP = $CC_STRIP
echo CC.STRIP.FLAGS = $CC_STRIP_FLAGS
echo CC.PREFIX.ARCHIVE = $CC_PREFIX_ARCHIVE
echo CC.PREFIX.DYNAMIC = $CC_PREFIX_DYNAMIC
echo CC.PREFIX.SHARED = $CC_PREFIX_SHARED
echo CC.PREFIX.SYMBOL = $CC_PREFIX_SYMBOL
echo CC.SUFFIX.ARCHIVE = $CC_SUFFIX_ARCHIVE
echo CC.SUFFIX.COMMAND = $CC_SUFFIX_COMMAND
echo CC.SUFFIX.DEBUG = $CC_SUFFIX_DEBUG
echo CC.SUFFIX.DYNAMIC = $CC_SUFFIX_DYNAMIC
echo CC.SUFFIX.LD = $CC_SUFFIX_LD
echo CC.SUFFIX.OBJECT = $CC_SUFFIX_OBJECT
echo CC.SUFFIX.SHARED = $CC_SUFFIX_SHARED
echo CC.SUFFIX.SOURCE = $CC_SUFFIX_SOURCE
echo CC.SUFFIX.STATIC = $CC_SUFFIX_STATIC
echo CC.VERSION = $CC_VERSION
case $CC_VERSION_STRING in
*\"*)	i=`echo " $CC_VERSION_STRING" | sed -e 's,",\\\\",g' -e 's,^ ,,' -e 's,.*,"&",'` ;;
*\'*)	i=\"$CC_VERSION_STRING\" ;;
*)	i=$CC_VERSION_STRING ;;
esac
cat <<!
CC.VERSION.STRING = $i
!
echo CC.WARN = $CC_WARN

for i in $CC_ATTRIBUTES
do	eval echo CC.$i = \$$i
done