summaryrefslogtreecommitdiff
path: root/configure.com
blob: ccb66bd262fb63d6f2f02d5cc7ed3b3398c8d4c0 (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
$ sav_ver = 'F$VERIFY(0)'
$! SET VERIFY
$!
$! For example, if you unpacked perl into: [USER.PERL5_00n...] then you will 
$! want to cd into the tree and execute Configure:
$!
$! $ SET DEFAULT [USER.PERL5_xxx]
$! $ @Configure 
$!
$! or
$!
$! $ SET DEFAULT [USER.PERL5_xxx]
$! $ @Configure "-des"
$!
$! That's it. If you get into a bind trying to build perl on VMS then 
$! definitely read through the README.VMS file.
$! Beyond that send email to vmsperl@perl.org
$!
$! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$!
$! send suggestions to: 
$!  Dan Sugalski <dan@sidhe.org>
$! Thank you!!!!
$!
$! Adapted and converted from Larry Wall & Andy Dougherty's
$! "Configure generated by metaconfig 3.0 PL60." by Peter Prymmer
$! (a Bourne sh[ell] script for configuring the installation of perl 
$! on non-VMS systems) in the perl5.002|3 epoch (spring/summer 1996)
$! with much valuable help from Charles Bailey & 
$! the whole VMSPerl crew.
$! Extended and messed about with by Dan Sugalski
$!
$! SET NOVERIFY
$ sav_ver = F$VERIFY(sav_ver)
$!
$! VMS-isms we will need:
$ echo = "write sys$output "
$ cat  = "type"
$ gcc_symbol = "gcc"
$ ans = ""
$ macros = ""
$ use_vmsdebug_perl = "n"
$ use_debugging_perl = "Y"
$ use_64bitint = "n"
$ C_Compiler_Replace = "CC="
$ Thread_Live_Dangerously = "MT="
$ use_two_pot_malloc = "N"
$ use_pack_malloc = "N"
$ use_debugmalloc = "N"
$ d_secintgenv = "N"
$ cc_flags = ""
$ use_multiplicity = "N"
$ vms_default_directory_name = F$ENVIRONMENT("DEFAULT")
$ max_allowed_dir_depth = 3  ! e.g. [A.B.PERL5_00n] not [A.B.C.PERL5_00n]
$! max_allowed_dir_depth = 2  ! e.g. [FOO.PERL5_00n] not [FOO.BAR.PERL5_00n]
$!
$ vms_filcnt = F$GETJPI ("","FILCNT")
$!
$!: compute my invocation name
$ me = F$ENVIRONMENT("PROCEDURE")
$!
$! Many null statements (begin with colon ':') in the Bourne shell version of
$! this script serve as comments/placeholders. I have retained some of the ones
$! that will help you compare this .COM file to the sh version - as well as
$! leave placeholders for future improvements to this .COM file.
$! sfn = VMS "skipped for now"
$!
$!: Proper PATH separator                              !sfn
$!: Proper PATH setting                                !sfn
$!: Sanity checks                                      !sfn "Say '@''$me''"
$!: On HP-UX, large Configure scripts may exercise a bug in /bin/sh !sfn
$!: Configure runs within the UU subdirectory          !->after find MANIFEST
$!   <big long list of default values (mostly null)>
$!: We must find out about Eunice early                !(?)
$!: list of known cpp symbols, sorted alphabetically   !sfn
$!   al = al + "..."
$!: default library list                               !sfn
$!   <no hints files in use (yet?)>
$!: Extra object files, if any, needed on this platform. !sfn
$!: Possible local include directories to search.      !sfn
$!: Set locincpth to "" in a hint file to defeat local include searches. !sfn
$!locincpth="/usr/local/include /opt/local/include /usr/gnu/include" !sfn
$!locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
$!: no include file wanted by default                  !sfn
$!inclwanted=''                                        !sfn
$!: Possible local library directories to search.      !sfn
$!loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib" !sfn
$!loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib" !sfn
$!: general looking path for locating libraries        !sfn
$!glibpth="/lib/pa1.1 /usr/shlib /usr/lib/large /lib /usr/lib" !sfn
$!glibpth="$glibpth $xlibpth /lib/large /usr/lib/small /lib/small" !sfn
$!glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/shlib" !sfn
$!: Private path used by Configure to find libraries.  Its value !sfn
$!: is prepended to libpth. This variable takes care of special !sfn
$!: machines, like the mips.  Usually, it should be empty. !sfn
$!plibpth=''                                           !sfn
$!: full support for void wanted by default            !sfn
$!defvoidused=15                                       !sfn
$!: List of libraries we want.                         !sfn
$!libswanted='net socket inet nsl nm ndbm gdbm dbm db malloc dl' !sfn
$!libswanted="$libswanted dld ld sun m c cposix posix ndir dir crypt" !sfn
$!libswanted="$libswanted ucb bsd BSD PW x"            !sfn
$!: We probably want to search /usr/shlib before most other libraries. !sfn
$!: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist. !sfn
$!glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'` !sfn
$!glibpth="/usr/shlib $glibpth"                        !sfn
$!: Do not use vfork unless overridden by a hint file. !sfn
$!usevfork=false                                       !sfn
$!: script used to extract .SH files with variable substitutions !sfn
$!: produce awk script to parse command line options   !sfn
$!sfn (assume no sed awk) see below
$!: process the command line options         
$!
$!: set up default values
$ fastread=""
$ reuseval="false"
$ maniskip = "false"
$ config_sh=""
$ alldone=""
$ error=""
$ silent=""
$ extractsh=""
$ override=""
$ knowitall=""
$ Using_Dec_C = ""
$ Using_Vax_C = ""
$ Using_Gnu_C = ""
$ Dec_C_Version = ""
$ use_threads = "F"
$!
$!: option parsing
$ IF (P1 .NES. "")
$ THEN            !one or more switches was thrown
$   i = 1
$   bang = 0
$Param_loop:
$   IF (P'i'.NES."") THEN bang = bang + 1
$   i = i + 1
$   IF (i.LT.9) THEN GOTO Param_loop !DCL allows P1..P8
$!
$   i = 1
$Opt_loop:
$   IF (F$EXTRACT(0,1,P'i') .EQS. "-") THEN P'i' = P'i' - "-"
$   IF (F$EXTRACT(0,1,P'i') .EQS. "/") THEN P'i' = P'i' - "/"
$Remove_quotation_mark:
$   P'i' = P'i' - """"
$   IF F$LOCATE("""",P'i') .LT. F$LENGTH(P'i') THEN GOTO Remove_quotation_mark
$   gotopt      = "f" !"alse"
$   gotshortopt = "f" !"alse"
$   IF (F$EXTRACT(0,1,P'i') .EQS. "d")
$   THEN
$     fastread    = "yes"
$     gotopt      = "t" !"rue"
$     P'i'        = P'i' - "d"
$     gotshortopt = "t" !"rue"
$   ENDIF
$   IF (F$EXTRACT(0,1,P'i') .EQS. "e")
$   THEN
$     alldone = "cont"
$     gotopt = "t"
$     P'i' = P'i' - "e"
$     gotshortopt = "t"
$   ENDIF
$   IF (F$EXTRACT(0,1,P'i') .EQS. "f") !"-f")
$   THEN
$     P'i' = P'i' - "f"
$     config_sh = P'i'
$     IF (F$SEARCH(config_sh).NES."")
$     THEN
$       test_config_sh = F$FILE_ATTRIBUTES(config_sh,"PRO")
$       IF (F$LOCATE("R",test_config_sh).NE.F$LENGTH(test_config_sh)) 
$       THEN
$         CONTINUE !at this point check UIC && if test allows...
$                  !to be continued ?
$       ELSE
$         echo "''me': cannot read config file ''config_sh'."
$         error="true"
$       ENDIF
$     ELSE
$       echo "''me': cannot read config file ''config_sh'."
$       error="true"
$     ENDIF
$     gotopt = "t"
$   ENDIF
$   IF (F$EXTRACT(0,1,P'i') .EQS. "h")
$   THEN
$     error = "true"
$     gotopt = "t"
$     P'i' = P'i' - "h"
$     gotshortopt = "t"
$   ENDIF
$   IF (F$EXTRACT(0,1,P'i') .EQS. "m")
$   THEN
$     maniskip = "true"
$     gotopt = "t"
$     P'i' = P'i' - "m"
$     gotshortopt = "t"
$   ENDIF
$   IF (F$EXTRACT(0,1,P'i') .EQS. "r")
$   THEN
$     reuseval = "true"
$     gotopt = "t"
$     P'i' = P'i' - "r"
$     gotshortopt = "t"
$   ENDIF
$   IF (F$EXTRACT(0,1,P'i') .EQS. "s")
$   THEN
$     silent = "true"
$     gotopt = "t"
$     P'i' = P'i' - "s"
$     gotshortopt = "t"
$   ENDIF
$   IF (F$EXTRACT(0,1,P'i') .EQS. "E") !"-E")
$   THEN
$     alldone = "exit"
$     gotopt = "t"
$   ENDIF
$   IF (F$EXTRACT(0,1,P'i') .EQS. "K") !"-K")
$   THEN
$     knowitall = "true"
$     gotopt = "t"
$     P'i' = P'i' - "K"
$     gotshortopt = "t"
$   ENDIF
$   IF (F$EXTRACT(0,1,P'i') .EQS. "O")
$   THEN
$     override = "true"
$     gotopt = "t"
$     P'i' = P'i' - "O"
$     gotshortopt = "t"
$   ENDIF
$   IF (F$EXTRACT(0,1,P'i') .EQS. "S") !"-S")
$   THEN
$     extractsh = "true" !VMS?
$     gotopt = "t"
$     P'i' = P'i' - "S"
$     gotshortopt = "t"
$   ENDIF
$   IF (F$EXTRACT(0,1,P'i') .EQS. "D") !"-D")
$   THEN
$     P'i' = P'i' - "D"
$!Hmm.. this part needs work
$!       P'i'
$     IF (F$LOCATE("=",P'i') .EQ. F$LENGTH(P'i'))
$     THEN
$       P'i' = "define"
$     ELSE 
$       IF (F$LOCATE("=",P'i') .EQ. (F$LENGTH(P'i') - 1))
$       THEN
$         me = F$PARSE(me,,,"NAME") + F$PARSE(me,,,"TYPE")
$         echo "''me': use '-Usymbol=val' not '-Dsymbol='."
$         echo "''me': ignoring -D",P'i'
$       ELSE
$!Hmm.. this part needs work
$!           'F$EXTRACT(0,F$LOCATE("=",P'i'),P'i')' = -
$! 'F$EXTRACT(F$LOCATE("=",P'i'),P'i'),F$LENGTH(P'i'),P'i')'
$       ENDIF
$     ENDIF
$     ECHO "P''i' =>",P'i',"<="  !Diag
$     gotopt = "t"
$   ENDIF
$   IF (F$EXTRACT(0,1,P'i') .EQS. "U") !"-U")
$   THEN
$     P'i' = P'i' - "U"
$     IF (F$LOCATE("=",P'i') .EQ. F$LENGTH(P'i'))
$     THEN
$       P'i' = ""
$     ELSE 
$       IF (F$LOCATE("=",P'i') .LT. (F$LENGTH(P'i') - 1))
$       THEN
$         me = F$PARSE(me,,,"NAME") + F$PARSE(me,,,"TYPE")
$         echo "''me': use '-Dsymbol=val' not '-Usymbol=val'."
$         echo "''me': ignoring -U",P'i'
$       ELSE
$         P'i' = "undef"
$       ENDIF
$     ENDIF
$     ECHO "P''i' =>",P'i',"<="  !Diag
$     gotopt = "t"
$   ENDIF
$   IF (F$EXTRACT(0,1,P'i') .EQS. "V")
$   THEN
$     me = F$PARSE(me,,,"NAME") + F$PARSE(me,,,"TYPE")
$     echo "''me' generated by an unknown version of EDT."
$     STOP
$     EXIT !0
$   ENDIF
$   IF .NOT.gotopt 
$   THEN
$     echo "''me': unknown option ",P'i'
$     error = "true"
$   ENDIF
$   IF (F$LENGTH(P'i').GT.0).AND.(gotshortopt) THEN i = i - 1 !clustered switch
$   i = i + 1 
$   IF (i .LT. (bang + 1)) THEN GOTO Opt_loop
$!
$ ENDIF  ! (P1 .NES. "")
$!
$ IF (error)
$ THEN
$   me = F$PARSE(me,,,"DIRECTORY")+ F$PARSE(me,,,"NAME")
$   echo "Usage: @''me' [-dehmrEKOSV] [-fconfig.sh] [-Dsymbol] [-Dsymbol=value]"
$   echo "                [-Usymbol]  [-Usymbol=]"
$   TYPE SYS$INPUT
 "-d" : use defaults for all answers.
 "-e" : go on without questioning past the production of config.sh.    *
 "-f" : specify an alternate default configuration file.
 "-h" : print this help message and exit (with an error status).
 "-m" : skip the MANIFEST check to see that all files are present
 "-r" : reuse C symbols value if possible (skips costly nm extraction).*
 "-s" : silent mode, only echoes questions and essential information.
 -"D" : define symbol to have some value:                              *
         -"Dsymbol"         symbol gets the value 'define'
         -"Dsymbol=value"   symbol gets the value 'value'
  -E  : stop at the end of questions, after having produced config.sh. *
  -K  : do not use unless you know what you are doing.
  -O  : let -D and -U override definitions from loaded configuration file. *
  -S  : perform variable substitutions on all .SH files (can mix with -f) *
 -"U" : undefine symbol:                                               *
         -"Usymbol"    symbol gets the value 'undef'
         -"Usymbol="   symbol gets completely empty
  -V  : print version number and exit (with a zero status).
$   echo "%Config-I-VMS, lower case switches must be enclosed"
$   echo "-Config-I-VMS, in double quotation marks, e.g.:"
$   echo "-Config-I-VMS,   @Configure ""-des"""
$   echo "-Config-I-VMS, * indicates switch may not be fully implemented for VMS."
$   SET DEFAULT 'vms_default_directory_name' !be kind rewind
$   STOP
$   EXIT 3 ! $STATUS = "%X00000003" (informational)
$ ENDIF
$!
$ GOTO Check_silence
$!
$Shut_up:
$ STDOUT = F$TRNLNM("SYS$OUTPUT")
$ DEFINE SYS$OUTPUT "_NLA0:"
$ echo4 = "write STDOUT "
$ cat4 = "TYPE/OUTPUT=''STDOUT'"
$ open/write STDOUT 'STDOUT'
$ RETURN
$!
$Check_silence:
$ IF (silent) 
$ THEN
$   GOSUB Shut_up
$ ELSE
$   echo4 = "write SYS$OUTPUT "
$   cat4 = "TYPE"
$ ENDIF
$!
$!: run the defines and the undefines, if any, but leave the file out there...
$! Unfortunately Configure.COM in DCL is not yet set up to do this - 
$! maybe someday
$!
$!: set package name
$ package = "perl5"
$!
$!: Eunice requires " " instead of "", can you believe it
$ echo ""
$!: Here we go...
$ echo "Beginning of configuration questions for ''package'."
$ echo ""
$!
$!: Some greps do not return status, grrr.
$ contains = "SEARCH"
$!
$!: first determine how to suppress newline on echo command !cant DCL is record oriented
$! echo "Checking ''echo' to see how to suppress newlines..."
$! echo "giving up..."
$! echo "The star should be here-->*"
$!
$!: Now test for existence of everything in MANIFEST
$ echo ""
$ echo4 "First let's make sure your kit is complete.  Checking..."
$ manifestfound = "" 
$ miss_list = "" 
$! Here I assume we are in the [foo.PERL5xxx.VMS...] tree
$! because the search routine simply does set def [-] if necessary.
$ file_2_find = "MANIFEST" !I hope this one is not in [foo.PERL5xxx.VMS...] 
$Research_manifest:
$ manifestfound = F$SEARCH(file_2_find)
$ IF (manifestfound .EQS. "")
$ THEN
$   IF F$PARSE(F$ENVIRONMENT("DEFAULT"),,,"DIRECTORY",).NES."[000000]"
$   THEN
$     SET DEFAULT [-]
$     GOTO Research_manifest
$   ELSE
$     echo ""
$     echo "There is no MANIFEST file.  I hope your kit is complete !"
$     miss_list = ""
$     GOTO Beyond_manifest
$   ENDIF
$ ELSE
$! MANIFEST. has been found and we have set def'ed there - 
$! time to bail out before it's too late.
$ tmp = f$extract(1,3,f$edit(f$getsyi("VERSION"),"TRIM,COLLAPSE"))
$ IF (tmp .GES. "7.2") .AND. (F$GETSYI("HW_MODEL") .GE. 1024) THEN GOTO Beyond_depth_check
$   IF (F$ELEMENT(max_allowed_dir_depth,".",F$ENVIRONMENT("Default")).nes.".")
$   THEN
$     TYPE SYS$INPUT:
%Config-E-VMS, ERROR:
 Sorry! It apears as though your perl build sub-directory is already too
 deep into the VMS file system. Please try moving stuff into a shallower 
 directory (or altering the "max_allowed_dir_depth" parameter).
$     echo4 "ABORTING..."
$     SET DEFAULT 'vms_default_directory_name' !be kind rewind
$     STOP
$     EXIT !2 !$STATUS = "%X00000002" (error)
$   ENDIF
$Beyond_depth_check:
$!
$! after finding MANIFEST let's create (but not yet enter) the UU subdirectory
$!
$   IF (manifestfound .NES. "")
$   THEN
$     IF ( F$SEARCH("UU.DIR").EQS."" )
$     THEN
$       CREATE/DIRECTORY [.UU]
$     ELSE
$       IF ( F$SEARCH("[.UU]*.*").NES."" ) THEN DELETE/NOLOG [.UU]*.*;*
$     ENDIF
$!: Configure runs within the UU subdirectory
$     SET DEFAULT [.UU]
$!
$! a little redundancy never hurt anybody?
$     file_2_find = "[-]" + file_2_find
$     manifestfound = F$SEARCH(file_2_find)
$!
$     OPEN/WRITE MISSING MISSING.
$!change to "FALSE" if you wish to skip the manifest search 
$!(which after all is rather slow in DCL :-)
$     IF (maniskip)
$     THEN
$       echo "Skipping MANIFEST check as requested"
$     ELSE
$!
$       OPEN/READ CONFIG 'manifestfound'
$Read_loop_manifest:
$       READ/END_OF_FILE = Done_manifest CONFIG line
$! This algorithm turns "foo/bar/baz.c" into "[.foo.bar]baz.c"
$! pvhp@lns62.lns.cornell.edu 10-JUN-1996 20:31:46
$! 2-MAR-1998 15:46:11 Improved to turn "foo/bar/baz.c.buz"
$! into "[.foo.bar]baz.c_buz as happens with vmstar and unzip
$       line = F$EDIT(line,"TRIM, COMPRESS")
$       file_2_find = F$EXTRACT(0,F$LOCATE(" ",line),line) 
$       IF F$LOCATE("/",file_2_find) .NE. F$LENGTH(file_2_find) 
$       THEN 
$Re_strip_line_manifest:
$         loca = F$LOCATE("/",file_2_find)
$         ante = F$EXTRACT(0,loca,file_2_find)
$         post = F$EXTRACT(loca,F$LENGTH(file_2_find),file_2_find)
$         test_this = ante + "." + (post - "/")
$         IF F$LOCATE("/",test_this) .NE. F$LENGTH(test_this)
$         THEN 
$           file_2_find = ante + "." + (post - "/")
$           GOTO Re_strip_line_manifest
$         ELSE
$           file_2_find = ante + "]" + (post - "/")
$         ENDIF
$           file_2_find = "[-."+file_2_find
$       ELSE
$         file_2_find = "[-]" + file_2_find
$       ENDIF
$!
$       dirname = F$EXTRACT(0,F$LOCATE("]",file_2_find),file_2_find) + "]"
$       file_2_find = file_2_find - dirname
$       dots = 0
$Dot_loop:
$       dot_ele = F$ELEMENT(dots,".",file_2_find)
$       IF dot_ele .EQS. "." THEN GOTO Eo_dot_loop
$       IF dots .eq. 0
$       THEN basename = f$extract(0,f$locate(".",file_2_find),file_2_find) + "."
$       ELSE basename = basename + dot_ele + "_"
$       ENDIF
$       dots = dots + 1
$       GOTO dot_loop
$Eo_dot_loop:
$       IF (((f$length(file_2_find)+1) .eq. f$length(basename)) .and. -
             (f$extract(f$length(basename)-1,1,basename) .eqs. "_")) THEN -
          basename = f$extract(0,f$length(basename)-1,basename)
$       file_2_find = dirname + basename
$!
$       found = F$SEARCH(file_2_find)
$       IF (found .EQS. "" .AND. dots .GT. 2)
$       THEN
$! 17-DEC-1999 Improved to turn "[.foo.bar]baz.c_buz" into
$! "[.foo.bar]baz_c.buz" to cover unzipped archives and put
$! "[.foo.bar]baz.c_buz,baz_c.buz" into missing list if neither is found.
$         basename[f$locate(".",basename),1] := _
$         dot_ele = F$ELEMENT(dots - 1,"_",basename)
$         basename = -
            f$extract(0,f$length(basename)-(f$length(dot_ele)+1),basename) -
              + "." + dot_ele
$         found = F$SEARCH(dirname + basename)
$         file_2_find = file_2_find + "," + basename
$       ENDIF
$       IF (found .EQS. "")
$       THEN
$         WRITE MISSING file_2_find
$         IF ((F$LENGTH(miss_list)+F$LENGTH(file_2_find)).LT.250)
$         THEN
$           miss_list = miss_list + "," + file_2_find
$         ENDIF
$       ENDIF
$       GOTO Read_loop_manifest
$Done_manifest:
$       CLOSE CONFIG
$     ENDIF  !"TRUE"
$     CLOSE MISSING
$   ENDIF ! (manifestfound .NES. "")
$Beyond_manifest:
$   IF (miss_list .NES. "")
$   THEN
$     echo "Some of the files not found include:"
$     cat4 MISSING.
$   ENDIF
$   IF ((miss_list .NES. "").OR.(manifestfound .EQS. ""))
$   THEN
$     TYPE SYS$INPUT:

THIS PACKAGE SEEMS TO BE INCOMPLETE.

You have the option of continuing the configuration process, despite the
distinct possibility that your kit is damaged, by typing 'y'es.  If you
do, don't blame me if something goes wrong.  I advise you to type 'n'o
and contact the author (sugalskd@ous.edu).

$     READ SYS$COMMAND/PROMPT="Continue? [n] " ans
$     IF ans
$     THEN
$       echo4 "Continuing..."
$     ELSE
$       echo4 "ABORTING..."
$       GOTO Clean_up
$     ENDIF
$   ELSE
$     echo4 "Looks good..."
$     DELETE/NOLOG MISSING.;
$   ENDIF ! (miss_list .NES. "")
$ ENDIF   ! (manifestfound .EQS. "") ELSE 
$!
$! after finding MANIFEST (see above)
$!: Configure runs within the UU subdirectory 
$!
$!: compute the number of columns on the terminal for proper question formatting
$! (sfn, will assume 80-ish)
$!
$!: set up the echo used in my read              !sfn
$!: now set up to do reads with possible shell escape and default assignment !sfn
$ GOTO Beyond_myread
$!
$myread:
$ ans = ""
$ If (fastread)
$ Then
$   echo4 "''rp'"
$ Else
$   If (silent)
$   Then
$     READ SYS$COMMAND/PROMPT="''rp'" ans
$   Else
$     echo ""
$     READ SYS$COMMAND/PROMPT="''rp'" ans
$   Endif
$ Endif
$ RETURN
$!
$Beyond_myread:
$!
$!: create .config dir to save info across Configure sessions
$ IF ( F$SEARCH("[-]CONFIG.DIR").EQS."" )
$ THEN
$   CREATE/DIRECTORY [-.CONFIG]
$   OPEN/WRITE CONFIG [-.CONFIG]README.
$   WRITE CONFIG -
      "This directory created by Configure to save information that should"
$   WRITE CONFIG -
      "persist across sessions."
$   WRITE CONFIG ""
$   WRITE CONFIG -
      "You may safely delete it if you wish."
$   CLOSE CONFIG
$ ENDIF
$!
$!: general instructions
$ needman = "true"
$ firsttime = "true"
$ user = F$EDIT(F$GETJPI("","USERNAME"),"TRIM,COLLAPSE")
$ IF .NOT.(F$SEARCH("[-.CONFIG]INSTRUCT.").EQS."")
$ THEN
$   messages = F$ENVIRONMENT("MESSAGE")
$   SET MESSAGE/NOFAC/NOSEV/NOIDENT/NOTEXT
$   contains /NOOUTPUT [-.CONFIG]INSTRUCT. 'user'
$   IF .NOT.($status.EQ.%X08D78053)
$   THEN
$     firsttime=""
$     dflt = "n"
$     rp = "Would you like to see the instructions? [''dflt'] "
$     GOSUB myread
$     if .NOT.ans THEN needman=""
$   ENDIF
$   SET MESSAGE 'messages'
$ ENDIF
$ if (fastread.AND.silent.AND.(alldone.eqs."cont")) THEN needman=""
$!
$ IF (needman)
$ THEN
$   TYPE SYS$INPUT:

This installation shell script will examine your system and ask you questions
to determine how the perl5 package should be installed. If you get
stuck on a question, you may use a ^C or ^Y shell escape to STOP this
process, edit something, then restart this process as you just did.
Many of the questions will have default answers in square
brackets; typing carriage return will give you the default.

$   READ SYS$COMMAND/PROMPT="Type carriage return to continue " ans
$   TYPE SYS$INPUT:

In a hurry? You may run '@Configure "-d"'.  This will bypass nearly all
the questions and use the computed defaults (or the previous answers provided 
there was already a config.sh file). Type '@Configure "-h"' for a list of 
options.

$   READ SYS$COMMAND/PROMPT="Type carriage return to continue " ans
$   TYPE SYS$INPUT:

Much effort has been expended to ensure that this shell script will
run on any VMS system.  If despite that it blows up on yours, your
best bet is to edit Configure.com and @ it again.  Whatever problems
you have with Configure.com, let me (sugalskd@ous.edu) know how I blew
it.

$!This installation script affects things in two ways:
$!
$!1) it may do direct variable substitutions on some of the files included
$!   in this kit.
$!2) it builds a config.h file for inclusion in C programs.  You may edit
$!   any of these files as the need arises after running this script.
$!
$!If you make a mistake on a question, there is no easy way to back up to it
$!currently.
$!
$   READ SYS$COMMAND/PROMPT="Type carriage return to continue " ans
$   IF (F$SEARCH("[-.CONFIG]INSTRUCT.").EQS."")
$   THEN
$     OPEN/WRITE CONFIG [-.CONFIG]INSTRUCT.
$     WRITE CONFIG user 
$     CLOSE CONFIG
$   ENDIF
$ ENDIF  !(needman .EQS. "true")
$!
$!: see if sh knows # comments             !sfn
$ sharpbang = "$ "
$!: figure out how to guarantee sh startup !sfn
$!: find out where common programs are     !sfn
$!loclist="awk/cat/comm/cp/echo/expr/find/grep/ln/ls/mkdir/rm/sed/sort/touch/tr/uniq"
$!trylist="Mcc/byacc/cpp/csh/date/egrep/less/line/more/nroff/perl/pg/sendmail/test/uname"
$! echo "I don't know where '$file' is, and my life depends on it."
$! echo "Go find a public domain implementation or fix your PATH setting!"
$! echo ""
$! echo "Don't worry if any of the following aren't found..."
$!: determine whether symbolic links are supported !sfn
$!: see whether [:lower:] and [:upper:] are supported character classes !sfn
$!: set up the translation script tr, must be called with ./tr of course !sfn
$!
$!: Try to determine whether config.sh was made on this system
$!: Get old answers from old config file if Configure was run on the
$!: same system, otherwise use the hints.
$ config_sh_es = "''config_sh'/[-]config.sh/[-.vms]config.vms/"
$ i = 0
$ max = 3
$Config_sh_look:
$ config_sh = F$ELEMENT(i,"/",config_sh_es)
$ i = i + 1
$ IF (config_sh.NES."/").AND.(config_sh.NES."")
$ THEN
$   configshfound = F$SEARCH(config_sh)
$   IF (configshfound.NES."") THEN GOTO Config_sh_found
$ ENDIF
$ IF (i.LT.max) THEN GOTO Config_sh_look
$ IF (configshfound.EQS."") THEN GOTO Beyond_config_sh
$Config_sh_found:
$ echo ""
$ echo "Fetching default answers from ''config_sh'..."
$!we actually do not have "hints/" for VMS
$!     TYPE SYS$INPUT:
$!
$!First time through, eh?  I have some defaults handy for the following systems:
$!
$!     echo "     ","VMS_VAX"
$!     echo "     ","VMS_AXP"
$!        : Now look for a hint file osname_osvers, unless one has been
$!        : specified already.
$!     TYPE SYS$INPUT:
$!
$!You may give one or more space-separated answers, or "none" if appropriate.
$!If your OS version has no hints, DO NOT give a wrong version -- say "none".
$!
$!     READ SYS$COMMAND/PROMPT="Which of these apply, if any? " ans
$!
$Beyond_config_sh:
$!
$!: Restore computed paths          !sfn
$!
$! genconfig.pl has "osname='VMS'"
$ osname = F$EDIT(F$GETSYI("NODE_SWTYPE"),"COLLAPSE") 
$! %Config-I-VMS, a necessary error trap (could be PC running VCL)
$!
$ IF (osname .NES. "VMS")
$ THEN
$   echo4 "Hmm.. I wonder what ''osname' is (?)"
$   TYPE SYS$INPUT:

%Config-E-VMS, ERROR:

           Err, you do not appear to be running VMS!
 This procedure is intended to Configure the building of Perl for VMS.

$   READ SYS$COMMAND/PROMPT="Continue anyway? [n] " ans
$   IF ans
$   THEN
$     echo4 "Continuing..."
$   ELSE
$     echo4 "ABORTING..."
$     SET DEFAULT 'vms_default_directory_name' !be kind rewind
$     STOP
$     EXIT 2 !$STATUS = "%X00000002" (error)
$   ENDIF
$ ELSE           !we are on VMS huzzah!
$   IF .NOT.silent 
$   THEN TYPE SYS$INPUT:

Configure uses the operating system name and version to set some defaults.
The default value is probably right if the name rings a bell. Otherwise,
since spelling matters for me, either accept the default or answer "none"
to leave it blank.
$   ENDIF
$   rp = "Operating system name? [''osname'] "
$   GOSUB myread
$   IF ans.nes.""
$   THEN
$     IF (ans.NES.osname) !.AND.knowitall
$     THEN
$       echo4 "I'll go with ''osname' anyway..."
$     ENDIF
$   ENDIF
$ ENDIF !(osname .NES./.EQS. "VMS")
$!
$!: who configured the system
$! see 'user' above.
$ cf_by = F$EDIT(user,"LOWERCASE")
$! cf_time = F$CVTIME()                 !superceded by procedure below
$ osvers = F$GETSYI("VERSION")
$!
$! Peter Prymmer has seen:
$!  "SYS$TIMEZONE_DIFFERENTIAL" = "-46800"  (sic)
$!  "SYS$TIME_ZONE" = "EDT"
$!
$! Charles Lane recommended:
$!  "SYS$TIMEZONE_DIFFERENTIAL" = "-14400"
$!  "NEWS_TIMEZONE" = "-0500"
$!  "ST_TIMEZONE" = "EDT"
$!  "JAN_TIME_ZONE" = "EST  "
$!  "MULTINET_TIMEZONE" = "EST"
$!  "DAYLIGHT_SAVINGS"  = "1"
$!
$! Charles Bailey recommends (in ANU NEWS Doc Jan 1995):
$!   "PMDF_Timezone"
$!   "Multinet_Timezone"
$!   "TCPware_Timezone"
$!   "WIN$Time_Zone"
$!
$! This snippet o' DCL returns a string in default Unix `date` format,
$! and it will prompt to set SYS$TIMEZONE_DIFFERENTIAL.
$! Peter Prymmer pvhp@lns62.lns.cornell.edu
$!
$ MIN_TZO = -840  !units are minutes here
$ MAX_TZO =  840
$!
$ wkday  = F$EXTRACT(0,3,F$CVTIME(,,"WEEKDAY"))
$ monn   = F$CVTIME(,,"MONTH")
$ mday   = F$EXTRACT(8,2,F$CVTIME(,,"DATE"))
$ hour   = F$CVTIME(,,"HOUR")
$ min    = F$CVTIME(,,"MINUTE")
$ sec    = F$CVTIME(,,"SECOND")
$ year   = F$CVTIME(,,"YEAR")
$!
$ months = "/Jan/Feb/Mar/Apr/May/Jun/Jul/Aug/Sep/Oct/Nov/Dec/"
$ i = 0
$Mon_loop:
$ i = i + 1
$ mon = F$ELEMENT(i,"/",months)
$ IF i.LT.monn THEN GOTO Mon_loop
$!
$ tzneedset = "t"
$ systz = F$TRNLNM("SYS$TIMEZONE_DIFFERENTIAL")
$ IF systz.NES.""
$ THEN
$   tzhour = F$INTEGER(systz)/3600
$   tzmins = F$INTEGER(systz)/60
$   tzminrem = tzmins - tzhour*60
$   IF tzminrem.lt.0 THEN tzminrem = -1*tzminrem  !keeps !2ZL happy
$   IF tzhour.ge.0 
$   THEN signothetime = "+" 
$     IF tzhour.EQ.0.AND.tzminrem.EQ.0 
$     THEN direction = "on GMT/"
$     ELSE direction = "east of "
$     ENDIF
$   ELSE signothetime = "-"
$     tzhour = -1*tzhour                          !keeps !UL happy
$     direction = "west of "
$   ENDIF
$   echo ""
$   echo "%Config-I-VMS,"
$   echo "According to the setting of your ""SYS$TIMEZONE_DIFFERENTIAL"" (= ''systz')"
$   IF tzminrem.ne.0
$   THEN
$     tzspan = "''tzhour' hours & ''tzminrem' minutes"
$   ELSE
$     tzspan = "''tzhour' hours"
$   ENDIF
$   dflt = "y"
$   echo "Your system is ''tzspan' ''direction'UTC in England."
$   rp = "%Config-I-VMS, (''systz') Is this UTC Time Zone Offset correct? [''dflt'] "
$   GOSUB myread
$   IF ans.OR.(ans.EQS."") 
$   THEN 
$     tzneedset = "f"
$     tzd = systz
$     GOTO Beyond_TimeZone
$   ENDIF
$ ELSE
$   echo ""
$   echo4 "%Config-I-VMS,"
$   echo4 """SYS$TIMEZONE_DIFFERENTIAL"" does not appear to be DEFINEd on your system"
$ ENDIF
$!
$TZSet:
$ echo ""
$ echo "Please tell me in hh:mm form what time offset from GMT/UTC in England"
$ echo "you are.  As an example Eastern (US) Standard Time is -5:00 offset, but"
$ echo "Eastern Daylight Time (summer) is -4:00 offset."
$ dflt = "0:00"
$ rp = "Enter the Time Zone offset: [''dflt'] "
$ GOSUB myread
$ ans = F$Edit(ans,"collapse,trim,uncomment,upcase")
$ IF ans.EQS."" THEN ans = dflt
$ tzhour   = F$ELEMENT(0,":","''ans'") !first
$ IF tzhour.EQS."" THEN tzhour = 0
$ tzhour   = F$INTEGER(tzhour)
$ tzminrem = F$ELEMENT(1,":","''ans'") !second
$ IF tzminrem.NES."" 
$ THEN 
$   tzminrem = F$INTEGER(tzminrem)
$   IF F$EXTRACT(0,1,"''ans'") .EQS. "-" THEN tzminrem = tzminrem * -1
$ ELSE 
$   tzminrem = 0
$ ENDIF
$ tzmins = tzhour*60 + tzminrem
$ tzd = F$STRING(tzmins*60)
$ IF tzhour .GE. 0 
$ THEN
$   signothetime = "+" 
$ ELSE
$   tzhour = -1*tzhour       !keeps !UL happy
$   signothetime = "-"
$ ENDIF
$ IF (tzmins.GT.MAX_TZO).OR.(tzmins.LT.MIN_TZO)
$ THEN
$   echo ""
$   echo "%Config-W-VMS-TIMERANGE, Response must be in the range -14:00 to 14:00."
$   goto TZSet
$ ENDIF
$!
$Beyond_TimeZone:
$ tz = f$fao("UTC!AS!UL:!2ZL",signothetime,tzhour,tzminrem)
$ cf_time = "''wkday' ''mon' ''mday' ''hour':''min':''sec' ''tz' ''year'"
$!
$!: determine the architecture name  
$! genconfig.pl has either archname='VMS_AXP' or 'VMS_VAX'
$!
$ IF (F$GETSYI("HW_MODEL") .LT. 1024)
$ THEN 
$   archname = "VMS_VAX"
$   otherarch = "an Alpha"
$ ELSE
$   archname = "VMS_AXP"
$   otherarch = "a VAX"
$ ENDIF
$ rp = "What is your architecture name? [''archname'] "
$ GOSUB myread
$ IF ans.NES.""
$ THEN
$   ans = F$EDIT(ans,"COLLAPSE, UPCASE")
$   IF (ans.NES.archname) !.AND.knowitall
$   THEN
$     echo4 "I'll go with ''archname' anyway..."
$   ENDIF
$ ENDIF
$ dflt = "n"
$ rp = "Will you be sharing your PERL_ROOT with ''otherarch'? [''dflt'] "
$ GOSUB myread
$ if ans.NES.""
$ THEN
$   ans = F$EXTRACT(0,1,F$EDIT(ans,"COLLAPSE, UPCASE"))
$ ENDIF
$ IF (ans.NES."Y")
$ THEN
$   sharedperl = "N"
$ ELSE
$   sharedperl = "Y"
$   IF (archname.EQS."VMS_AXP")
$   THEN
$     macros = macros + """AXE=1"","
$   ENDIF
$ ENDIF
$!
$!: is AFS running?                       !sfn
$!: decide how portable to be.  Allow command line overrides. !sfn
$!: set up shell script to do ~ expansion !sfn
$!: expand filename                       !sfn
$!: now set up to get a file name         !sfn
$!
$ vms_skip_install = "true"
$ dflt = "y"
$! echo ""
$ rp = "%Config-I-VMS, Do you wish to skip the """"where install"""" questions? [''dflt'] "
$ GOSUB myread
$ IF (.NOT.ans).AND.(ans.NES."") THEN vms_skip_install = "false"
$ prefix = F$ENVIRONMENT("DEFAULT") - ".UU]" + "]"
$ prefix = f$parse(prefix,,,,"NO_CONCEAL") - "][" - ".;"
$ prefix = prefix - "]" + ".]"
$ IF (.NOT.vms_skip_install)
$ THEN
$!: determine root of directory hierarchy where package will be installed.
$   dflt = "default"
$   IF .NOT.silent 
$   THEN 
$     echo ""
$     echo "By default, ''package' will be installed in ''dflt'/bin, manual"
$     echo "pages under ''dflt'/man, etc..., i.e. with ''dflt' as prefix for"
$     echo "all installation directories. Typically set to /usr/local, but you"
$     echo "may choose /usr if you wish to install ''package' among your system
$   ENDIF
$   IF .NOT.silent 
$   THEN TYPE SYS$INPUT:
binaries. If you wish to have binaries under /bin but manual pages
under /usr/local/man, that's ok: you will be prompted separately
for each of the installation directories, the prefix being only used
to set the defaults.
$   ENDIF
$   dflt = prefix
$   rp = "Installation prefix to use? [ ''dflt' ] "
$   GOSUB myread
$   IF ans.NES.""
$   THEN 
$     prefix = ans
$     IF F$LOCATE(".]",ans) .EQ. F$LENGTH(ans) THEN prefix = prefix - "]" + ".]"
$   ELSE 
$     prefix = dflt
$   ENDIF
$!
$!: set the prefixit variable, to compute a suitable default value
$!
$!: determine where private library files go
$!: Usual default is /usr/local/lib/perl5.  Also allow things like 
$!: /opt/perl/lib, since /opt/perl/lib/perl5 would be redundant.
$   IF .NOT.silent 
$   THEN TYPE SYS$INPUT:

There are some auxiliary files for perl5 that need to be put into a
private library directory that is accessible by everyone.
$   ENDIF
$   dflt = prefix - ".]" + ".LIB]"
$   rp = "Pathname where the private library files will reside? " 
$   rp = F$FAO("!AS!/!AS",rp,"[ ''dflt' ] ")
$   GOSUB myread
$   IF ans.NES.""
$   THEN privlib = ans
$   ELSE privlib = dflt
$   ENDIF
$!
$ ENDIF !%Config-I-VMS, skip "where install" questions
$!
$!: set the base revision
$ baserev="5"
$!: get the patchlevel
$ echo ""
$ echo4 "Getting the current patchlevel..." !>&4
$ patchlevel_h = F$SEARCH("[-]patchlevel.h")
$ IF (patchlevel_h.NES."")
$ THEN
$   got_patch = "false"
$   got_sub   = "false"
$   OPEN/READONLY CONFIG 'patchlevel_h' 
$Patchlevel_h_loop:
$   READ/END_Of_File=Close_patch CONFIG line
$   IF ((F$LOCATE("#define PERL_VERSION",line).NE.F$LENGTH(line)).AND.(.NOT.got_patch))
$   THEN
$     line = F$EDIT(line,"COMPRESS, TRIM")
$     patchlevel = F$ELEMENT(2," ",line)
$     got_patch = "true"
$   ENDIF
$   IF ((F$LOCATE("#define PERL_SUBVERSION",line).NE.F$LENGTH(line)).AND.(.NOT.got_sub))
$   THEN
$     line = F$EDIT(line,"COMPRESS, TRIM")
$     subversion = F$ELEMENT(2," ",line)
$     got_sub = "true"
$   ENDIF
$   IF (.NOT.got_patch).OR.(.NOT.got_sub) THEN GOTO Patchlevel_h_loop
$Close_patch:
$   CLOSE CONFIG
$   ELSE
$     patchlevel="0"
$     subversion="0"
$ ENDIF
$ echo "(You have ''package' ''baserev' PL''patchlevel' sub''subversion'.)"
$! This whole thing needs replacing w/ F$FAO() calls:
$ patchlevel = F$INTEGER(patchlevel)
$ IF patchlevel.LT.10
$ THEN patchlevel = "00" + F$STRING(patchlevel)
$ ELSE patchlevel = "0" + F$STRING(patchlevel)
$ ENDIF
$ subversion = F$INTEGER(subversion)
$ IF subversion.GT.0
$ THEN
$   IF subversion.LT.10
$   THEN subversion = "0" + F$STRING(subversion)
$   ELSE subversion = F$STRING(subversion)
$   ENDIF
$ ELSE subversion = ""
$ ENDIF
$!
$ version = baserev + "_" + patchlevel + "_" + subversion
$!
$ IF (.NOT.vms_skip_install)
$ THEN
$!: set the prefixup variable, to restore leading tilda escape !sfn
$!: set the prefixup variable, to restore leading tilde escape !sfn
$!
$!: determine where public architecture dependent libraries go
$   IF (.NOT.silent) 
$   THEN 
$     echo ""
$     echo "''package' contains architecture-dependent library files.  If you are"
$   ENDIF
$   IF (.NOT.silent) 
$   THEN TYPE SYS$INPUT:
sharing libraries in a heterogeneous environment, you might store
these files in a separate location.  Otherwise, you can just include
them with the rest of the public library files.
$   ENDIF
$   dflt = privlib - "]" + "." + archname + "." + version + "]"
$   rp = "Where do you want to put the public architecture-dependent libraries? "
$   rp = F$FAO("!AS!/!AS",rp,"[ ''dflt' ] ")
$   GOSUB myread
$   IF ans.NES.""
$   THEN archlib = ans
$   ELSE archlib = dflt
$   ENDIF
$!
$!: set up the script used to warn in case of inconsistency !sfn
$!: function used to set $1 to $val                         !sfn
$!
$ ENDIF !%Config-I-VMS, skip "where install" questions
$! This quotation from Configure has to be included on VMS:
$ TYPE SYS$INPUT:

There is, however, a strange, musty smell in the air that reminds me of
something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
$ CONTINUE
$ IF (.NOT.vms_skip_install)
$ THEN
$!: it so happens the Eunice I know will not run shell scripts in Unix format
$!
$!: see if setuid scripts can be secure           !sfn
$!: now see if they want to do setuid emulation   !sfn
$!
$!: determine where site specific libraries go.
$   IF .NOT.silent 
$   THEN TYPE SYS$INPUT:

The installation process will also create a directory for
site-specific extensions and modules.  Some users find it convenient
to place all local files in this directory rather than in the main
distribution directory.
$   ENDIF
$   dflt = privlib - "]" + ".SITE_PERL]"
$   rp = "Pathname for the site-specific library files? "
$   rp = F$FAO("!AS!/!AS",rp,"[ ''dflt' ] ")
$   GOSUB myread
$   IF ans.NES.""
$   THEN sitelib = ans
$   ELSE sitelib = dflt
$   ENDIF
$!
$!: determine where site specific architecture-dependent libraries go.
$   IF .NOT.silent 
$   THEN TYPE SYS$INPUT:

The installation process will also create a directory for
architecture-dependent site-specific extensions and modules.
$   ENDIF
$   dflt = sitelib - "]" + "." + archname + "]"
$   rp = "Pathname for the site-specific architecture-dependent library files? "
$   rp = F$FAO("!AS!/!AS",rp,"[ ''dflt' ] ")
$   GOSUB myread
$   IF ans.NES.""
$   THEN sitearch = ans
$   ELSE sitearch = dflt
$   ENDIF
$!
$!: determine where old public architecture dependent libraries might be
$!
$!: determine where public executables go
$   dflt = prefix - ".]" + ".BIN]"
$   rp = "Pathname where the public executables will reside? "
$   rp = F$FAO("!AS!/!AS",rp,"[ ''dflt' ] ")
$   GOSUB myread
$   IF ans.NES.""
$   THEN bin = ans
$   ELSE bin = dflt
$   ENDIF
$!
$!: determine where manual pages are on this system
$!: What suffix to use on installed man pages
$!: see if we can have long filenames
$!: determine where library module manual pages go
$!: What suffix to use on installed man pages
$!: see what memory models we can support
$!
$ ENDIF !%Config-I-VMS, skip "where install" questions
$!
$!: see if we need a special compiler
$! cc_list = "cc/vaxc|cc/decc|gcc" !%Config-I-VMS, compiler symbols/commands
$!
$ nocc = "f"
$ vms_cc_dflt = ""
$ vms_cc_available = ""
$!
$ OPEN/WRITE CONFIG ccvms.c
$ WRITE CONFIG "#include <stdlib.h>"  !DECC is sooo picky
$ WRITE CONFIG "#include <stdio.h>"
$ WRITE CONFIG "int main() {"
$ WRITE CONFIG "#ifdef __DECC"
$ WRITE CONFIG "        printf(""/DECC\n"");"
$ WRITE CONFIG "#else"
$ WRITE CONFIG "        printf(""/VAXC\n"");"
$ WRITE CONFIG "#endif"
$ WRITE CONFIG "        exit(0);"
$ WRITE CONFIG "}"
$ CLOSE CONFIG
$!
$! DEFINE SYS$ERROR _NLA0:
$! DEFINE SYS$OUTPUT _NLA0:
$ cc/NoObj/list=ccvms.lis ccvms.c
$ tmp = $status
$! DEASSIGN SYS$OUTPUT
$! DEASSIGN SYS$ERROR
$ IF (silent) THEN GOSUB Shut_up
$! echo "%Config-I-VMS, After cc compile $status = >''tmp'<" !diagnostic
$!
$ IF tmp.NE.%X10B90001
$ THEN 
$  IF tmp.NE.%X10000001
$  THEN 
$    nocc = "t"  !%X10000001 is return from gcc
$    GOTO Gcc_initial_check
$  ENDIF
$ ENDIF
$!
$ GOSUB List_Parse
$ IF .NOT.silent THEN echo ""
$ echo "%Config-I-VMS, Default ""cc"" is ''line' ''archsufx' ''F$GETSYI("VERSION")'" 
$ IF F$LOCATE("VAX",line).NE.F$LENGTH(line) 
$ THEN 
$   vms_cc_dflt = "/vaxc"
$   vms_cc_available = vms_cc_available + "cc/vaxc "
$   IF .NOT.silent
$   THEN 
$     echo "%Config-I-VMS, Will try cc/decc..."
$   ENDIF
$   DEFINE SYS$ERROR _NLA0:
$   DEFINE SYS$OUTPUT _NLA0:
$   SET NOON
$   cc/decc/NoObj/list=ccvms.lis ccvms.c
$   tmp = $status
$   DEASSIGN SYS$OUTPUT
$   DEASSIGN SYS$ERROR
$   SET ON
$   IF (silent) THEN GOSUB Shut_up
$   IF tmp.NE.%X10B90001
$   THEN
$     echo "%Config-I-VMS, Apparently you don't have that one."
$   ELSE
$     GOSUB List_parse
$     echo "%Config-I-VMS, You also have: ''line' ''archsufx' ''F$GETSYI("VERSION")'"
$     vms_cc_available = vms_cc_available + "cc/decc "
$   ENDIF
$ ELSE
$   IF (F$LOCATE("DEC",line).NE.F$LENGTH(line)).or.(F$LOCATE("Compaq",line).NE.F$LENGTH(line))
$   THEN 
$     vms_cc_dflt = "/decc"
$     vms_cc_available = vms_cc_available + "cc/decc "
$     echo "%Config-I-VMS, Will try cc/vaxc..."
$     DEFINE SYS$ERROR _NLA0:
$     DEFINE SYS$OUTPUT _NLA0:
$     SET NOON
$     cc/vaxc/NoObj/list=ccvms.lis ccvms.c
$     tmp = $status
$     DEASSIGN SYS$OUTPUT
$     DEASSIGN SYS$ERROR
$     SET ON
$     IF (silent) THEN GOSUB Shut_up
$     IF tmp.NE.%X10B90001
$     THEN
$       echo "%Config-I-VMS, Apparently you don't have that one."
$     ELSE
$       GOSUB List_parse
$       echo "%Config-I-VMS, You also have: ''line' ''archsufx' ''F$GETSYI("VERSION")'"
$       vms_cc_available = vms_cc_available + "cc/vaxc "
$     ENDIF
$   ENDIF
$ ENDIF
$!
$Gcc_initial_check:
$ echo "%Config-I-VMS, Checking for Gcc"
$ OPEN/WRITE CONFIG gccvers.lis
$ DEFINE SYS$ERROR CONFIG
$ DEFINE SYS$OUTPUT CONFIG
$ 'gcc_symbol'/noobj/version _nla0:
$ tmp = $status
$ DEASSIGN SYS$OUTPUT
$ DEASSIGN SYS$ERROR
$ IF (silent) THEN GOSUB Shut_up
$ CLOSE CONFIG
$ IF (tmp.NE.%X10000001).and.(tmp.ne.%X00030001)
$ THEN
$   echo "%Config-I-VMS, Symbol ""''gcc_symbol'"" is not defined. I guess you don't have it."
$   goto cc_cleanup
$ ENDIF
$ OPEN/READ CONFIG gccvers.lis
$GCC_List_Read:
$ READ/END_OF_FILE=GCC_List_End CONFIG line
$ GOTO GCC_List_Read
$GCC_List_End:
$ CLOSE CONFIG
$ echo line
$ vms_cc_available = vms_cc_available + "''gcc_symbol' "
$ DELETE/NOLOG/NOCONFIRM gccvers.lis;
$!
$CC_Cleanup:
$ DELETE/NOLOG/NOCONFIRM ccvms.*;
$CC_Desired:
$!: see if we need a special compiler
$! echo ""
$ echo "%Config-I-VMS, available compiler(s):"
$ echo "( ''vms_cc_available')"
$ IF .NOT.nocc 
$ THEN
$   dflt = "cc''vms_cc_dflt'"  !-> "cc" in case first compile went OK
$ ELSE
$   dflt = gcc_symbol
$ ENDIF
$ rp = "Use which C compiler? [''dflt'] "
$ GOSUB myread
$ IF ans.NES.""
$ THEN
$   ans = F$EDIT(ans,"TRIM, COMPRESS, LOWERCASE")
$   Mcc = ans
$   IF (F$LOCATE("dec",ans).NE.F$LENGTH(ans)).or.(F$LOCATE("compaq",ans).NE.F$LENGTH(ans))
$   THEN
$     Mcc = "cc/decc"
$     Using_Dec_C = "Yes"
$     C_COMPILER_Replace = "CC=cc=''Mcc'"
$   ENDIF
$   IF F$LOCATE("vax",ans).NE.F$LENGTH(ans)
$   THEN
$     Mcc = "cc/vaxc"
$     Using_Vax_C = "Yes"
$     C_COMPILER_Replace = "CC=cc=''Mcc'"
$   ENDIF
$   IF Mcc.NES.dflt
$   THEN
$     IF (F$LOCATE("dec",dflt).NE.F$LENGTH(dflt)).or(F$LOCATE("compaq",dflt).NE.F$LENGTH(dflt))
$     THEN 
$       C_COMPILER_Replace = "CC=cc=''Mcc'"
$     ELSE
$       Using_Dec_C = "Yes"
$       IF F$LOCATE("vax",dflt).NE.F$LENGTH(dflt) 
$       THEN
$         C_COMPILER_Replace = "CC=cc=''Mcc'"
$       ENDIF
$     ENDIF
$   ELSE
$     IF Mcc .EQS. "cc/decc"
$     THEN
$       Using_Dec_C = "Yes"
$       C_COMPILER_Replace = "CC=cc=''Mcc'"
$     ENDIF
$   ENDIF
$ ELSE 
$   Mcc = dflt
$   IF Mcc .EQS. "cc/decc"
$   THEN
$     Using_Dec_C = "Yes"
$     C_COMPILER_Replace = "CC=cc=''Mcc'"
$   ENDIF
$   IF Mcc .EQS. "cc/vaxc"
$   THEN
$     Using_Vax_C = "Yes"
$     C_COMPILER_Replace = "CC=cc=''Mcc'"
$   ENDIF
$   IF Mcc .EQS. "gcc"
$   THEN
$     Using_Gnu_C = "Yes"
$     C_COMPILER_Replace = "CC=cc=''Mcc'"
$   ENDIF
$ ENDIF
$Decc_Version_check:
$ IF "''Using_Dec_C'".EQS."Yes"
$ THEN
$   echo ""
$   echo4 "Checking for Dec C's version number..." !>&4
$   OPEN/WRITE CONFIG deccvers.c
$   WRITE CONFIG "#include <stdlib.h>"  !DECC is sooo picky
$   WRITE CONFIG "#include <stdio.h>"
$   WRITE CONFIG "int main() {"
$   WRITE CONFIG "#ifdef __DECC"
$   WRITE CONFIG "#ifdef __DECC_VER"
$   WRITE CONFIG "        printf(""%i\n"", __DECC_VER);"
$   WRITE CONFIG "#else"
$   WRITE CONFIG "        printf(""%i\n"", ""1"");"
$   WRITE CONFIG "#endif"
$   WRITE CONFIG "#endif"
$   WRITE CONFIG "        exit(0);"
$   WRITE CONFIG "}"
$   CLOSE CONFIG
$   DEFINE SYS$ERROR _NLA0:
$   DEFINE SYS$OUTPUT _NLA0:
$   'Mcc' deccvers.c
$   tmp = $status
$   DEASSIGN SYS$ERROR _NLA0:
$   DEASSIGN SYS$OUTPUT _NLA0:
$   IF (silent) THEN GOSUB Shut_up
$   DEFINE SYS$ERROR _NLA0:
$   DEFINE SYS$OUTPUT _NLA0:
$   link deccvers.obj
$   tmp = $status
$   DEASSIGN SYS$ERROR
$   DEASSIGN SYS$OUTPUT
$   IF (silent) THEN GOSUB Shut_up
$   OPEN/WRITE CONFIG deccvers.out
$   DEFINE SYS$ERROR CONFIG
$   DEFINE SYS$OUTPUT CONFIG
$   mcr []deccvers.exe
$   tmp = $status
$   CLOSE CONFIG
$   DEASSIGN SYS$OUTPUT
$   DEASSIGN SYS$ERROR
$   IF (silent) THEN GOSUB Shut_up
$   OPEN/READ CONFIG deccvers.out
$   READ/END_OF_FILE=Dec_c_cleanup CONFIG line
$Dec_c_cleanup:
$   CLOSE CONFIG
$!   DELETE/NOLOG/NOCONFIRM deccvers.*;
$   echo "You are using Dec C ''line'"
$   Dec_C_Version = line
$   Dec_C_Version = Dec_C_Version + 0
$   if Dec_C_Version.ge.60200000 THEN CC_FLAGS = CC_FLAGS + "/NOANSI_ALIAS"
$ ENDIF
$Vaxc_Invoke_check:
$ IF "''Using_Vax_C'".EQS."Yes"
$ THEN
$   echo ""
$   echo4 "Checking to see how to invoke Vax C..."
$   OPEN/WRITE CONFIG vaxcchk.c
$   WRITE CONFIG "#include <stdio.h>"
$   WRITE CONFIG "int main() {"
$   WRITE CONFIG "        printf(""%i\n"", ""1"");"
$   WRITE CONFIG "        exit(0);"
$   WRITE CONFIG "}"
$   CLOSE CONFIG
$   DEFINE SYS$ERROR _NLA0:
$   DEFINE SYS$OUTPUT _NLA0:
$   SET NOON
$   cc/vaxc/NoObj vaxcchk.c
$   tmp = $status
$   DEASSIGN SYS$OUTPUT
$   DEASSIGN SYS$ERROR
$   SET ON
$   IF (silent) THEN GOSUB Shut_up
$   IF tmp.NE.%X10B90001
$   THEN
$     Mcc = "cc"
$   ELSE
$     Mcc = "cc/vaxc"
$   ENDIF
$Vax_c_cleanup:
$   DELETE/NOLOG/NOCONFIRM vaxcchk.*;
$ ENDIF
$Gcc_check:
$ if "''using_gnu_c'" .eqs. "Yes"
$ THEN
$ vaxcrtl_olb = F$SEARCH("SYS$LIBRARY:VAXCRTL.OLB")
$ vaxcrtl_exe = F$SEARCH("SYS$SHARE:VAXCRTL.EXE")
$ gcclib_olb  = F$SEARCH("GNU_CC:[000000]GCCLIB.OLB")
$ IF gcclib_olb .EQS. "" 
$ THEN 
$! These objects/libs come w/ gcc 2.7.2 for AXP:
$   tmp = F$SEARCH("GNU_CC:[000000]libgcc2.olb")
$   IF tmp .NES. "" then gcclib_olb = tmp
$   tmp = F$SEARCH("GNU_CC:[000000]libgcclib.olb")
$   IF tmp .NES. "" 
$   THEN 
$     IF gcclib_olb .EQS. "" 
$     THEN gcclib_olb = tmp
$     ELSE gcclib_olb = gcclib_olb + "/lib," + tmp
$     ENDIF
$   ENDIF
$   tmp = F$SEARCH("SYS$LIBRARY:VAXCRTL.OLB")
$   IF tmp .NES. "" 
$   THEN 
$     IF gcclib_olb .EQS. "" 
$     THEN gcclib_olb = tmp
$     ELSE gcclib_olb = gcclib_olb + "/lib," + tmp
$     ENDIF
$   ENDIF
$   tmp = F$SEARCH("GNU_CC:[000000]crt0.obj")
$   IF tmp .NES. "" 
$   THEN 
$     IF gcclib_olb .EQS. "" 
$     THEN gcclib_olb = tmp
$     ELSE gcclib_olb = gcclib_olb + "/lib," + tmp
$     ENDIF
$   ENDIF
$   IF gcclib_olb .EQS. vaxcrtl_olb THEN gcclib_olb = "" !goofy order of axplibs
$ ELSE
$   gcclib_olb = gcclib_olb + "/lib"
$ ENDIF
$ IF   gcclib_olb .NES. "" .AND. -
     (vaxcrtl_olb .NES. "" .OR. -
      vaxcrtl_exe .NES. "" )
$ THEN
$   echo ""
$   echo4 "Checking for GNU cc in disguise and/or its version number..." !>&4
$   OPEN/WRITE CONFIG gccvers.c
$   WRITE CONFIG "#include <stdlib.h>"  !DECC is sooo picky
$   WRITE CONFIG "#include <stdio.h>"
$   WRITE CONFIG "int main() {"
$   WRITE CONFIG "#ifdef __GNUC__"
$   WRITE CONFIG "#ifdef __VERSION__"
$   WRITE CONFIG "        printf(""%s\n"", __VERSION__);"
$   WRITE CONFIG "#else"
$   WRITE CONFIG "        printf(""%s\n"", ""1"");"
$   WRITE CONFIG "#endif"
$   WRITE CONFIG "#endif"
$   WRITE CONFIG "        exit(0);"
$   WRITE CONFIG "}"
$   CLOSE CONFIG
$   DEFINE SYS$ERROR _NLA0:
$   DEFINE SYS$OUTPUT _NLA0:
$   'Mcc' gccvers.c
$   tmp = $status
$   DEASSIGN SYS$ERROR _NLA0:
$   DEASSIGN SYS$OUTPUT _NLA0:
$   IF (silent) THEN GOSUB Shut_up
$   DEFINE SYS$ERROR _NLA0:
$   DEFINE SYS$OUTPUT _NLA0:
$   IF vaxcrtl_exe .EQS. ""
$   THEN 
$     IF F$LOCATE("VAXCRTL",gcclib_olb).NE.F$LENGTH(gcclib_olb)
$     THEN 
$       link gccvers.obj,'gcclib_olb',SYS$LIBRARY:VAXCRTL/Library
$       tmp = $status
$     ELSE
$       link gccvers.obj,'gcclib_olb'
$       tmp = $status
$     ENDIF
$   ELSE
$     OPEN/WRITE CONFIG GCCVERS.OPT
$     WRITE CONFIG "SYS$SHARE:VAXCRTL/SHARE"
$     CLOSE CONFIG
$     link gccvers.obj,GCCVERS.OPT/OPT,'gcclib_olb'
$     tmp = $status
$   ENDIF
$   DEASSIGN SYS$ERROR
$   DEASSIGN SYS$OUTPUT
$   IF (silent) THEN GOSUB Shut_up
$   OPEN/WRITE CONFIG gccvers.out
$   DEFINE SYS$ERROR CONFIG
$   DEFINE SYS$OUTPUT CONFIG
$   mcr []gccvers.exe
$   tmp = $status
$   CLOSE CONFIG
$   DEASSIGN SYS$OUTPUT
$   DEASSIGN SYS$ERROR
$   IF (silent) THEN GOSUB Shut_up
$   OPEN/READ CONFIG gccvers.out
$   READ/END_OF_FILE=Gcc_cleanup CONFIG line
$Gcc_cleanup:
$   CLOSE CONFIG
$   DELETE/NOLOG/NOCONFIRM gccvers.*;
$   IF F$LOCATE("GNU C version ",line).NE.F$LENGTH(line)
$   THEN 
$     echo "You are not using GNU cc."
$     GOTO Host_name
$   ELSE 
$     echo "You are using GNU cc ''line'"
$     Using_Gnu_C = "Yes"
$     C_COMPILER_Replace = "CC=cc=''Mcc'"
$     GOTO Include_dirs
$   ENDIF
$ ENDIF
$endif
$ GOTO Host_name
$!
$List_Parse:
$ OPEN/READ CONFIG ccvms.lis
$ READ CONFIG line
$ IF (F$GETSYI("HW_MODEL") .LT. 1024)
$ THEN
$   read CONFIG line
$   archsufx = "VAX"
$ ELSE
$   archsufx = "AXP"
$ ENDIF
$ CLOSE CONFIG
$ line = F$EDIT(line,"TRIM,COMPRESS")
$ line = line - "Page 1"           ! occurs at end all compilers
$ line = line - "CCVMS "           ! filename appears w/ VAXC
$ line = line - "Source Listing "  ! Seen w/ AXP DECC
$ tmp = F$EXTRACT(0,20,line)       !timestamp, e.g. "30-JUL-1996 21:12:54 "
$ line = line - tmp
$ line = F$EDIT(line,"TRIM")       !bit redundant but we're in no big hurry
$ DELETE/NOLOG/NOCONFIRM ccvms.lis;
$ RETURN
$!
$Include_dirs:
$!: What should the include directory be ?
$ dflt = gcclib_olb 
$ rp = "Where are the include files you want to use? "
$ IF f$length( rp + "[''dflt'] " ).gt.76
$ THEN rp = F$FAO("!AS!/!AS",rp,"[''dflt'] ")
$ ELSE rp = rp + "[''dflt'] "
$ ENDIF
$ GOSUB myread
$ usrinc = ans
$!
$!: see if we have to deal with yellow pages, now NIS.
$!: now get the host name
$Host_name:
$ echo ""
$ echo4 "Figuring out host name..." !>&4
$ myhostname = ""
$  IF myhostname.eqs."" THEN myhostname = F$TRNLNM("ARPANET_HOST_NAME")
$  IF myhostname.eqs."" THEN myhostname = F$TRNLNM("INTERNET_HOST_NAME")
$  IF myhostname.eqs."" THEN myhostname = F$TRNLNM("MULTINET_HOST_NAME")
$  IF myhostname.eqs."" THEN myhostname = F$TRNLNM("UCX$INET_HOST_NAME")
$  IF myhostname.eqs."".and. -
      F$TRNLNM("UCX$INET_HOST") .nes. "" .and. -
      F$TRNLNM("UCX$INET_DOMAIN") .nes. "" THEN - 
     myhostname = F$TRNLNM("UCX$INET_HOST") + "." + F$TRNLNM("UCX$INET_DOMAIN") 
$  IF myhostname.eqs."" THEN myhostname = F$TRNLNM("TCPWARE_DOMAINNAME")
$  IF myhostname.eqs."" THEN myhostname = F$TRNLNM("NEWS_ADDRESS")
$  IF myhostname.eqs."" THEN myhostname = F$TRNLNM("SYS$NODE") - "::"
$  IF myhostname.eqs."" THEN myhostname = F$EDIT(F$GETSYI("SCSNODE"),"TRIM")
$!: you do not want to know about this
$!: verify guess
$ rp = "Your host name appears to be """"''myhostname'"""". Right? "
$ GOSUB myread
$ IF (.not.ans).and.(ans.NES."")
$   THEN 
$     READ SYS$COMMAND/PROMPT= - 
 "Please type the (one word) name of your host: " ans
$     myhostname = ans
$ ENDIF
$!: translate upper to lower if necessary
$ myhostname = F$EDIT(myhostname,"COLLAPSE")
$ mylowhostname = F$EDIT(myhostname," LOWERCASE")
$ IF mylowhostname.NES.myhostname
$ THEN
$   echo "(Normalizing case in your host name)"
$   myhostname = mylowhostname
$ ENDIF
$!
$ fp = F$LOCATE(".",myhostname)
$ mydomain = F$EXTRACT(fp,(F$LENGTH(myhostname)-fp)+1,myhostname)
$ IF mydomain.NES.""  !no periods in DECnet names like "MYDECNODE::"
$ THEN
$   rp = "What is your domain name? [''mydomain'] "
$   GOSUB myread
$   IF ans .nes. "" THEN mydomain = ans
$!: translate upper to lower if necessary
$   mydomain = F$EDIT(mydomain,"COLLAPSE")
$   mylowdomain = F$EDIT(mydomain," LOWERCASE")
$   IF mylowdomain.NES.mydomain
$   THEN
$     echo "(Normalizing case in your domain name)"
$     mydomain = mylowdomain
$   ENDIF
$ ENDIF
$ myhostname = myhostname - mydomain
$ echo "(Trimming domain name from host name--host name is now ''myhostname')"
$ IF .NOT.silent 
$ THEN TYPE SYS$INPUT:

I need to get your e-mail address in Internet format if possible, i.e.
something like user@host.domain. Please answer accurately since I have
no easy means to double check it. The default value provided below
is most probably close to the reality but may not be valid from outside
your organization...
$ ENDIF
$ dflt = "''cf_by'@''myhostname'"+"''mydomain'"
$ rp = "What is your e-mail address? [''dflt'] "
$ GOSUB myread
$ IF ans .nes. ""
$ THEN cf_email = ans
$ ELSE cf_email = dflt
$ ENDIF
$!
$ IF .NOT.silent 
$ THEN TYPE SYS$INPUT:

If you or somebody else will be maintaining perl at your site, please
fill in the correct e-mail address here so that they may be contacted
if necessary. Currently, the "perlbug" program included with perl
will send mail to this address in addition to perlbug@perl.com. You may
enter "none" for no administrator.
$ ENDIF
$ dflt = "''cf_email'"
$ rp = "Perl administrator e-mail address [''dflt'] "
$ GOSUB myread
$ IF ans .nes. ""
$ THEN perladmin = ans
$ ELSE perladmin = dflt
$ ENDIF
$!
$!: determine where public executable scripts go
$!: determine perl absolute location
$!: figure out how to guarantee perl startup
$!
$!: see how we invoke the C preprocessor
$! echo ""
$! echo4 "Now, how can we feed standard input to your C preprocessor..." !>&4
$!: Set private lib path
$!: Now check and see which directories actually exist, avoiding duplicates
$!: determine optimize, if desired, or use for debug flag also
$!: We will not override a previous value, but we might want to
$!: augment a hint file
$!: the following weeds options from ccflags that are of no interest to cpp
$!: flags used in final linking phase
$!: Try to guess additional flags to pick up local libraries.
$!: coherency check
$! echo ""
$! echo4 "Checking your choice of C compiler and flags for coherency..." !>&4
$!: compute shared library extension
$!: Looking for optional libraries
$!: see if nm is to be used to determine whether a symbol is defined or not
$!: get list of predefined functions in a handy place
$!: see if we have sigaction
$!: see whether socketshr exists
$ IF (F$SEARCH(F$PARSE("SocketShr","Sys$Share:.Exe")).NES."")
$ THEN
$   has_socketshr     = "T"
$   echo ""
$   echo4 "Hmm... Looks like you have SOCKETSHR's Berkeley networking support."
$ endif
$ if (Dec_C_Version .ge. 50200000)
$ THEN
$   Has_Dec_C_Sockets = "T"
$   echo ""
$   echo4 "Hmm... Looks like you've got Dec C's Berkeley networking support."
$ ENDIF
$ ! Hey, we've got both. Default to Dec C, then, since it's better
$ if ("''Has_socketshr'".eq."T") .or.("''has_dec_c_sockets'".eq."T")
$ THEN
$   echo ""
$   echo "You've got sockets available. Which socket stack do you want to"
$   echo "build into perl?"
$   if "''has_dec_c_sockets'".eqs."T"
$   THEN
$     dflt = "DECC"
$   else
$     dflt = "SOCKETSHR"
$   endif
$   rp = "Choose socket stack (NONE"
$   if "''has_socketshr'".eqs."T" THEN rp = rp + ",SOCKETSHR"
$   if "''has_dec_c_sockets'".eqs."T" THEN rp = rp + ",DECC"
$   rp = rp + ") [''dflt'] "
$   GOSUB myread
$   IF "''ans'".eqs."" THEN ans = "''dflt'"
$   has_dec_c_sockets = "F"
$   has_socketshr = "F"
$   ans = F$EDIT(ans,"TRIM,COMPRESS,LOWERCASE")
$   IF ans.eqs."decc" then has_dec_c_sockets = "T"
$   IF ans.eqs."socketshr" then has_socketshr = "T"
$ endif
$!
$!
$! Ask if they want to build with VMS_DEBUG perl
$ echo ""
$ echo "Perl can be built to run under the VMS debugger."
$ echo "You should only select this option if you are debugging"
$ echo "perl itself.  This can be a useful feature if you are "
$ echo "embedding perl in a program."
$ dflt = "n"
$ rp = "Build a VMS-DEBUG version of Perl? [''dflt'] "
$ GOSUB myread
$ IF ans.eqs."" then ans = dflt
$ IF F$EXTRACT(0, 1, F$EDIT(ans,"COLLAPSE,UPCASE")) .eqs. "Y"
$ THEN
$   use_vmsdebug_perl = "Y"
$   macros = macros + """__DEBUG__=1"","
$ ELSE
$   use_vmsdebug_perl = "N"
$ ENDIF
$!
$! Ask if they want to build with MULTIPLICITY
$ echo ""
$ echo "The perl interpreter engine can be built in a way that makes it
$ echo "possible for a program that embeds perl into it (and yes, you can
$ echo "do that--it's pretty keen) to have multiple perl interpreters active
$ echo "at once. There is some performance overhead, however, so you
$ echo "probably don't want to choose this unless you're going to be doing
$ echo "funky perl embedding."
$ dflt = "n"
$ rp = "Build with MULTIPLICITY? [''dflt'] "
$ GOSUB myread
$ if ans.eqs."" then ans = dflt
$ IF F$EXTRACT(0, 1, F$EDIT(ans,"COLLAPSE,UPCASE")) .eqs. "Y"
$ THEN
$   use_multiplicity="Y"
$ ELSE
$   use_multiplicity="N"
$ ENDIF
$!
$! Ask if they want to build with 64-bit support
$ if (Archname.eqs."VMS_AXP").and.("''f$extract(1,3, f$getsyi(""version""))'".ges."7.1")
$ THEN
$   echo ""
$   echo "This version of perl has experimental support for building with
$   echo "64 bit integers and 128 bit floating point variables. This gives
$   echo "a much larger range for perl's mathematical operations. (Note that
$   echo "does *not* enable 64-bit fileops at the moment, as Dec C doesn't
$   echo "do that yet)"
$   dflt = use_64bitint
$   rp = "Build with 64 bit integers and 128 bit floating point variable? [''dflt'] "
$   GOSUB myread
$   if ans.eqs."" then ans = dflt
$   if (f$extract(0, 1, "''ans'").eqs."Y").or.(f$extract(0, 1, "''ans'").eqs."y")
$   THEN
$     use_64bitint="Y"
$   ELSE
$     use_64bitint="N"
$   ENDIF
$ ENDIF
$!
$! Ask about threads, if appropriate
$ if (Using_Dec_C.eqs."Yes")
$ THEN
$   echo ""
$   echo "This version of Perl can be built with threads. While really nifty,
$   echo "they are a beta feature, and there is a speed penalty for perl
$   echo "programs if you build with threads *even if you don't use them*
$   dflt = "n"
$   rp = "Build with threads? [''dflt'] "
$   GOSUB myread
$   if ans.eqs."" then ans = dflt
$   if (f$extract(0, 1, "''ans'").eqs."Y").or.(f$extract(0, 1, "''ans'").eqs."y")
$   THEN
$     use_threads="T"
$     ! Are they on VMS 7.1 on an alpha?
$     if (Archname.eqs."VMS_AXP").and.("''f$extract(1,3, f$getsyi(""version""))'".ges."7.1")
$     THEN
$       echo ""
$       echo "Threaded perl can be linked to use multiple kernel threads
$       echo "and system upcalls on VMS 7.1+ on Alpha systems. This feature
$       echo "allows multiple threads to execute simultaneously on an SMP
$       echo "system as well as preventing a single thread from blocking
$       echo "all the threads in a program, even on a single-processor
$       echo "machine. Unfortunately this feature isn't safe on an
$       echo "unpatched 7.1 system. (Several OS patches were required when
$       echo "this procedure was written)
$       dflt = "n"
$       rp = "Enable multiple kernel threads and upcalls? [''dflt'] "
$       gosub myread
$       if ans.eqs."" then ans="''dflt'"
$       if f$extract(0, 1, f$edit(ans,"TRIM,COMPRESS,UPCASE")).eqs."Y"
$       THEN
$         Thread_Live_Dangerously = "MT=MT=1"
$       ENDIF
$     ENDIF
$   ENDIF
$ ENDIF
$!
$! Ask whether they want to use secure logical translation when tainting
$ echo ""
$ echo "As Perl starts up, it checks several logical names, such as"
$ echo "PERL5LIB and PERL_ENV_TABLES, which allow you to modify aspects"
$ echo "of its behavior.  For additional security, you may limit this"
$ echo "process to executive- and kernel-mode translation when tainting"
$ echo "is enabled.  In this case, logical names normally skipped when"
$ echo "tainting is enabled (e.g. PERL5OPTS) are translated as well."
$ echo "If you do not choose to do this, the usual order of access modes"
$ echo "is used for logical name translation."
$ echo ""
$ echo "This restriction does not apply to the %ENV hash or to implicit"
$ echo "logical name translation during parsing of file specifications;"
$ echo "these always use the normal sequence of access modes for logical"
$ echo "name translation."
$ dflt = "n"
$ rp = "Use secure logical name translation? [''dflt'] "
$ GOSUB myread
$ if ans.eqs."" then ans="''dflt'"
$ d_secintgenv = f$extract(0, 1, f$edit(ans,"TRIM,COMPRESS,UPCASE"))
$!
$! Ask whether they want to default filetypes
$ echo ""
$ echo "When you pass the name of a program to Perl on the command line,"
$ echo "it generally doesn't supply any defaults unless the -S command"
$ echo "line switch is specified.  In keeping with the VMS tradition of"
$ echo "default file types, however, you can configure Perl to try default"
$ echo "file types of nothing, .pl, and .com, in that order (e.g. typing"
$ echo """$ perl foo"" would cause Perl to look for foo., then foo.pl, and"
$ echo "finally foo.com)."
$ dflt = "n"
$ rp = "Always use default file types? [''dflt'] "
$ GOSUB myread
$ if ans.eqs."" then ans="''dflt'"
$ d_alwdeftype = f$extract(0, 1, f$edit(ans,"COLLAPSE,UPCASE"))
$!
$! Ask if they want to use perl's memory allocator
$ echo ""
$ echo "Perl has a built-in memory allocator that's tuned for perl's
$ echo "normal memory usage. It's oftentimes better than the standard
$ echo "system memory allocator. It also has the advantage of providing
$ echo "memory allocation statistics, if you choose to enable them.
$ dflt = "n"
$ rp = "Build with perl's memory allocator? [''dflt'] "
$ GOSUB myread
$ if ans.eqs."" then ans="''dflt'"
$ mymalloc = f$extract(0, 1, f$edit(ans,"COLLAPSE,UPCASE"))
$ if mymalloc.eqs."Y"
$ THEN
$   if use_debugging_perl.eqs."Y"
$   THEN
$     echo ""
$     echo "Perl can keep statistics on memory usage if you choose to use
$     echo "them. This is useful for debugging, but does have some
$     echo "performance overhead.
$     dflt = "n"
$     rp = "Do you want the debugging memory allocator? [''dflt'] "
$     gosub myread
$     if ans.eqs."" then ans="''dflt'"
$     use_debugmalloc = f$extract(0, 1, f$edit(ans, "COLLAPSE,UPCASE"))
$   ENDIF
$   ! Check which memory allocator we want
$   echo ""
$   echo "There are currently three different memory allocators: the
$   echo "default (which is a pretty good general-purpose memory manager),
$   echo "the TWO_POT allocator (which is optimized to save memory for
$   echo "larger allocations), and PACK_MALLOC (which is optimized to save
$   echo "memory for smaller allocations). They're all good, but if your
$   echo "usage tends towards larger chunks use TWO_POT, otherwise use
$   echo "PACK_MALLOC."
$   dflt = "DEFAULT"
$   rp = "Memory allocator (DEFAULT, TWO_POT, PACK_MALLOC) [''dflt'] "
$   GOSUB myread
$   if ans.eqs."" then ans = "''dflt'"
$   if ans.eqs."TWO_POT" then use_two_pot_malloc = "Y"
$   if ans.eqs."PACK_MALLOC" then use_pack_malloc = "Y"
$ ENDIF
$!
$! Ask for their default list of extensions to build
$ echo ""
$ echo "It's time to specify which modules you want to build into
$ echo "perl. Most of these are standard and should be chosen, though
$ echo "you might, for example, want to build GDBM_File instead of
$ echo "SDBM_File if you have the GDBM library built on your machine.
$ echo "Whatever you do, make sure the re module is first or things will
$ echo "break badly"
$ echo "
$ echo "Which modules do you want to build into perl?"
$! dflt = "Fcntl Errno File::Glob IO Opcode Byteloader Devel::Peek Devel::DProf Data::Dumper attrs re VMS::Stdio VMS::DCLsym B SDBM_File"
$ dflt = "re Fcntl Errno File::Glob IO Opcode Devel::Peek Devel::DProf Data::Dumper attrs VMS::Stdio VMS::DCLsym B SDBM_File"
$ if Using_Dec_C.eqs."Yes"
$ THEN
$   dflt = dflt + " POSIX"
$   if Use_Threads.eqs."T"
$   THEN
$     dflt = dflt + " Thread"
$   ENDIF
$ ENDIF
$ rp = "[''dflt'] "
$ GOSUB myread
$ if ans.eqs."" then ans = "''dflt'"
$ extensions = "''ans'"
$ perl_known_extensions = "''dflt'"
$!
$! %Config-I-VMS, determine build/make utility here (make gmake mmk mms)
$ echo ""
$ echo "%Config-I-VMS, Checking your ""make"" utilities..."
$! If the 'build' that you use is not here add it and it's test
$! switch to the _END_ of these strings (and increment max_build)
$! (e.g. builders = builders + "/FOOMAKE" 
$!       probers  = probers + " -fooVersionSwitch"
$! ) & please let me know about it.
$ builders = "IMAKE/GNUMAKE/MGMAKE/GMAKE/MAKE/MMS/MMK"
$ probers  = "-f Makefile. -v!-f Makefile. -v!-f Makefile. -v!-f Makefile. -v!-f Makefile. -v!/IDENT!/IDENT"
$ max_build = 7
$!
$ orig_dflt = "MMK"
$ default_set = ""
$ ok_builders = ""
$ OPEN/WRITE/ERROR=Open_error CONFIG Makefile.
$ WRITE CONFIG "dont_make_anything_yet:"
$ WRITE CONFIG F$FAO("!_")
$ CLOSE CONFIG
$ n = 0
$ messages = F$ENVIRONMENT("MESSAGE")
$Build_probe:
$ build = F$ELEMENT(n,"/",builders)
$ probe  = F$ELEMENT(n,"!",probers)
$ echo "Testing whether you have ''build' on your system..."
$ SET NOON
$ ON CONTROL_Y THEN GOTO Reenable_messages_build
$ SET MESSAGE/NOFAC/NOSEV/NOIDENT/NOTEXT
$ 'build' 'probe'
$ IF ($SEVERITY .EQ. 1)
$ THEN 
$   echo "OK."
$   IF (build .EQS. orig_dflt) 
$   THEN 
$     default_set = "TRUE"
$     dflt = build
$   ENDIF
$   ok_builders = ok_builders + " " + build
$   IF (.NOT. default_set) THEN dflt = build
$ ELSE 
$   echo "Nope."
$ ENDIF
$Reenable_messages_build:
$ SET MESSAGE 'messages'
$ SET ON
$ n = n + 1
$ IF (n .LT. max_build) THEN GOTO Build_probe
$!
$ echo ""
$ IF (ok_builders .NES. "") 
$ THEN
$   echo "Here is the list of builders you can apparently use:"
$   echo "(",ok_builders," )"
$   rp = "Which """"make"""" utility do you wish to use [''dflt']? "
$   GOSUB myread
$   ans = F$EDIT(ans,"TRIM, COMPRESS")
$   ans = F$EXTRACT(0,F$LOCATE(" ",ans),ans) !throw out "-f Makefile." here
$   IF (ans .EQS. "") 
$   THEN build = dflt
$   ELSE build = ans
$   ENDIF
$ ELSE
$   TYPE SYS$INPUT:

%Config-E-VMS, ERROR:
 Well this looks pretty serious. Perl5 cannot be compiled without a "make"
 utility of some sort and after checking my "builders" list I cannot find
 the symbol or command you use on your system to compile programs.

$   READ SYS$COMMAND/PROMPT="%Config-I-VMS, Which ""MMS"" do you use? " ans
$   ans = F$EDIT(ans,"TRIM, COMPRESS")
$   ans = F$EXTRACT(0,F$LOCATE(" ",ans),ans) !throw out "-f Makefile." here
$   IF (ans .EQS. "") 
$   THEN build = dflt
$     echo "I don't know where 'make' is, and my life depends on it."
$     echo "Go find a make program or fix your DCL$PATH setting!"
$     echo "ABORTING..."
$     SET DEFAULT 'vms_default_directory_name' !be kind rewind
$     STOP
$     EXIT 2 !$STATUS = "%X00000002" (error)
$   ELSE 
$     build = ans
$   ENDIF
$ ENDIF
$!
$ DELETE/NOLOG Makefile.;
$ GOTO Beyond_open
$Open_error:
$ TYPE SYS$INPUT:

 There seems to be trouble. I just tried to create a file in
$ echo4 'F$ENVIRONMENT("DEFAULT")'
$ TYPE SYS$INPUT:
 but was unsuccessful. I am stopping now. Please check that directories'
 PROTECTION bits. I will leave you in the directory where you started
 Configure.com
$ echo4 "ABORTING..."
$ GOTO Clean_up
$ STOP
$ EXIT
$!
$Beyond_open:
$! echo " Very well I will proceed with ""''build'"""
$ make = F$EDIT(build,"UPCASE")
$!
$!: locate the preferred pager for this system
$!pagers = "most|more|less|type/page"
$!rp='What pager is used on your system?'
$!
$! update [.vms]config.vms here
$!
$! update makefile here
$! echo4 "Updating makefile..."
$!
$ IF (make .EQS. "MMS").OR.(make .EQS. "MMK")
$ THEN 
$   makefile    = "" 		 !wrt MANIFEST dir
$   UUmakefile  = "DESCRIP.MMS"  !wrt CWD dir
$   DEFmakefile = "DESCRIP.MMS"  !wrt DEF dir (?)
$ ELSE
$   makefile    = " -f [.VMS]Makefile." !wrt MANIFEST dir
$   UUmakefile  = "[-.VMS]Makefile."    !wrt CWD dir
$   DEFmakefile = "[-.VMS]Makefile."    !wrt DEF dir (?)
$ ENDIF
$!
$ IF macros.NES."" 
$ THEN 
$   tmp = F$LENGTH(macros)
$   macros = F$EXTRACT(0,(tmp-1),macros) !miss trailing comma
$   macros = "/macro=(" + macros  + ")"
$ ENDIF
$!
$! Invoke the subconfig piece
$!
$ echo ""
$ echo4 "Checking the C run-time library"
$ dflt = F$ENVIRONMENT("DEFAULT")
$ SET DEFAULT [-.vms]
$ @subconfigure
$ SET DEFAULT 'dflt
$!
$!  Warn of dangerous symbols or logical names
$!
$Bad_environment: SUBROUTINE
$   Bad_env = ""
$   IF p2 .eqs. "SYMBOL"
$   THEN
$     IF f$type('p1) .nes. "" THEN  Bad_env := SYMBOL
$   ELSE
$     IF f$trnlnm(p1) .nes. "" THEN Bad_env := LOGICAL
$   ENDIF
$   IF Bad_env .eqs. "SYMBOL" .or. Bad_env .eqs. "LOGICAL"
$   THEN
$     IF f$search("config.msg") .nes. ""
$     THEN
$       OPEN/APPEND CONFIG config.msg
$     ELSE
$       OPEN/WRITE CONFIG config.msg
$     ENDIF
$     IF Bad_env .eqs. "SYMBOL"
$     THEN
$       WRITE CONFIG ""
$       WRITE CONFIG "Symbol name ''p1' found in environment as " + &p1
$       WRITE CONFIG " delete before building ''package' via:"
$       WRITE CONFIG "     $ DELETE/SYMBOL/GLOBAL ''p1'"
$       IF f$locate("""",&p1) .ge. f$length(&p1)
$       THEN
$       WRITE CONFIG " after building, testing, and installing ''package'
$       WRITE CONFIG " restore the symbol with:"
$       WRITE CONFIG "     $ ''p1' == """ + &p1 + """"
$       ENDIF
$     ENDIF
$     IF Bad_env .eqs. "LOGICAL"
$     THEN
$       WRITE CONFIG ""
$       WRITE CONFIG "Logical name ''p1' found in environment as " + f$trnlnm(p1)
$       WRITE CONFIG " deassign before building ''package'"
$     ENDIF
$     CLOSE CONFIG
$     Bad_env = ""
$   ENDIF
$ EXIT
$ ENDSUBROUTINE ! Bad_environment
$ echo ""
$ echo4 "%Config-I-VMS, Checking for dangerous pre-existing global symbols and logical names."
$ CALL Bad_environment "TMP"
$ CALL Bad_environment "LIB"
$ CALL Bad_environment "T"
$ CALL Bad_environment "FOO"
$ CALL Bad_environment "EXT"
$ CALL Bad_environment "TEST" "SYMBOL"
$ IF f$search("config.msg") .eqs. "" THEN echo "OK."
$!
$! %Config-I-VMS, write perl_setup.com here
$!
$ echo ""
$ echo4 "%Config-I-VMS, The perl_setup.com file is now being written..."
$ file_2_find = "[-]perl_setup.com"
$ OPEN/WRITE CONFIG 'file_2_find'
$ WRITE CONFIG "$!"
$ WRITE CONFIG "$! Perl_Setup.com    ''cf_time'"
$ IF cf_email.NES.perladmin
$ THEN
$ WRITE CONFIG "$! perl configured by ''cf_email'"
$ ELSE
$ WRITE CONFIG "$! This perl configured & administered by ''perladmin'"
$ ENDIF
$ WRITE CONFIG "$!"
$ prefix = prefix - "000000."
$ IF F$LOCATE(".]",prefix) .EQ. F$LENGTH(prefix) THEN -
    prefix = prefix - "]" + ".]" 
$ WRITE CONFIG "$ define/translation=concealed Perl_Root ''prefix'"
$ write config "$ ext = "".exe"""
$ if sharedperl .eqs. "Y"
$ then
$   write config "$ if f$getsyi(""ARCH_NAME"") .nes. ""VAX"" then ext = "".AXE"""
$ endif
$ IF use_vmsdebug_perl .eqs. "Y"
$ then
$   WRITE CONFIG "$ dbgperl :== $Perl_Root:[000000]dbgPerl'ext'"
$   WRITE CONFIG "$ perl    :== $Perl_Root:[000000]ndbgPerl'ext'"
$   WRITE CONFIG "$ define dbgPerlShr Perl_Root:[000000]dbgPerlShr'ext'"
$ else
$   WRITE CONFIG "$ perl :== $Perl_Root:[000000]Perl'ext'"
$   WRITE CONFIG "$ define PerlShr Perl_Root:[000000]PerlShr'ext'"
$ endif
$ WRITE CONFIG "$ define/nolog pod2text Perl_Root:[lib.pod]pod2text.com"
$ WRITE CONFIG "$ define/nolog pod2html Perl_Root:[lib.pod]pod2html.com"
$ WRITE CONFIG "$ define/nolog pod2man  Perl_Root:[lib.pod]pod2man.com"
$!
$ IF (tzneedset)
$ THEN
$ WRITE CONFIG "$ define SYS$TIMEZONE_DIFFERENTIAL ''tzd'"
$ ELSE    !leave in but commented out (in case setting was from perl :-)
$ WRITE CONFIG "$! define SYS$TIMEZONE_DIFFERENTIAL ''tzd'"
$ ENDIF
$ WRITE CONFIG "$!"
$ WRITE CONFIG "$! Symbols for commonly used scripts:"
$ WRITE CONFIG "$!"
$ WRITE CONFIG "$ Perldoc  == ""'"+"'Perl' Perl_Root:[lib.pod]Perldoc.com -t"""
$ WRITE CONFIG "$ pod2text == ""'"+"'Perl' pod2text"""
$ WRITE CONFIG "$ pod2html == ""'"+"'Perl' pod2html"""
$ WRITE CONFIG "$!pod2man  == ""'"+"'Perl' pod2man"""
$ WRITE CONFIG "$!Perlbug  == ""'"+"'Perl' Perl_Root:[lib]Perlbug.com"""
$ WRITE CONFIG "$!c2ph == ""'"+"'Perl' c2ph"""
$ WRITE CONFIG "$!h2ph == ""'"+"'Perl' h2ph"""
$ WRITE CONFIG "$!h2xs == ""'"+"'Perl' h2xs"""
$ CLOSE CONFIG
$!
$ echo  ""
$ echo  "%Config-I-VMS, The file can be found at:"
$ echo4 "-Config-I-VMS, ''F$SEARCH(file_2_find)'"
$ echo  "-Config-I-VMS, Add that file (or an @ call to it) to your [SY]LOGIN.COM"
$ echo  "-Config-I-VMS, when you are satisfied with a successful compilation,"
$ echo  "-Config-I-VMS, testing, and installation of your perl."
$ echo  ""
$!
$!figure out where we "are" by parsing 'vms_default_directory_name' 
$!
$ set_def_command = ""
$ dflt = F$ENVIRONMENT("DEFAULT") - ".UU]" 
$ tmp = vms_default_directory_name - dflt - "]"
$ i = 0
$ IF tmp .EQS. "" THEN GOTO Beyond_set_def_loop
$Set_def_loop:
$ tmp1 = F$ELEMENT(i,".",tmp)
$ IF tmp1 .EQS. "." THEN GOTO Beyond_set_def_loop
$ IF i .EQ. 0 
$ THEN set_def_command = "set default [-"
$ ELSE set_def_command = set_def_command + "-"
$ ENDIF
$ i = i + 1
$ GOTO Set_def_loop
$Beyond_set_def_loop:
$ IF set_def_command.NES.""
$ THEN
$   set_def_command = set_def_command - "-" + "]"
$   echo4 ""
$   echo4 "In order to build ''package' you must now issue the commands:"
$   echo4 ""
$   echo4 " ''set_def_command'"
$ ELSE
$   echo4 ""
$   echo4 "In order to build ''package' you must now issue the command:"
$   echo4 ""
$ ENDIF
$ echo4 " ''make'''makefile'", macros
$ echo4 ""
$!
$ IF ( F$SEARCH("config.msg").NES."" ) 
$ THEN
$   echo "Hmm.  I also noted the following information while running:"
$   echo ""
$   type config.msg
$   SET PROTECTION=(SYSTEM:RWED,OWNER:RWED) config.msg
$   DELETE/NOLOG/NOCONFIRM config.msg;
$ ENDIF
$!
$Clean_up:
$ IF (silent)
$ THEN
$   DEASSIGN SYS$OUTPUT
$!   DEASSIGN SYS$ERROR
$ ENDIF
$ IF F$GETJPI("","FILCNT").NE.vms_filcnt THEN CLOSE CONFIG
$ IF F$GETJPI("","FILCNT").NE.vms_filcnt 
$ THEN WRITE SYS$ERROR "%Config-W-VMS, WARNING: There is a file still open"
$ ENDIF
$ dflt = F$ENVIRONMENT("DEFAULT")
$ IF F$LOCATE("UU]",dflt).EQS.(F$LENGTH(dflt)-3)
$ THEN
$   IF ( F$SEARCH("[]*.*").NES."" ) THEN DELETE/NOLOG/NOCONFIRM []*.*;*
$   SET DEFAULT [-]
$   SET PROTECTION=(SYSTEM:RWED,OWNER:RWED) UU.DIR
$   DELETE/NOLOG/NOCONFIRM UU.DIR;
$ ENDIF
$ SET DEFAULT 'vms_default_directory_name' !be kind rewind
$ STOP
$ EXIT
$!: End of Configure