This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate with Sarathy.
[perl5.git] / configure.com
1 $ sav_ver = 'F$VERIFY(0)'
2 $! SET VERIFY
3 $!
4 $! For example, if you unpacked perl into: [USER.PERL5_00n...] then you will 
5 $! want to cd into the tree and execute Configure:
6 $!
7 $! $ SET DEFAULT [USER.PERL5_xxx]
8 $! $ @Configure 
9 $!
10 $! or
11 $!
12 $! $ SET DEFAULT [USER.PERL5_xxx]
13 $! $ @Configure "-des"
14 $!
15 $! That's it. If you get into a bind trying to build perl on VMS then 
16 $! definitely read through the README.VMS file.
17 $! Beyond that send email to vmsperl@perl.org
18 $!
19 $! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 $!
21 $! send suggestions to: 
22 $!  Dan Sugalski <dan@sidhe.org>
23 $! Thank you!!!!
24 $!
25 $! Adapted and converted from Larry Wall & Andy Dougherty's
26 $! "Configure generated by metaconfig 3.0 PL60." by Peter Prymmer
27 $! (a Bourne sh[ell] script for configuring the installation of perl 
28 $! on non-VMS systems) in the perl5.002|3 epoch (spring/summer 1996)
29 $! with much valuable help from Charles Bailey & 
30 $! the whole VMSPerl crew.
31 $! Extended and messed about with by Dan Sugalski
32 $!
33 $! SET NOVERIFY
34 $ sav_ver = F$VERIFY(sav_ver)
35 $!
36 $! VMS-isms we will need:
37 $ echo = "write sys$output "
38 $ cat  = "type"
39 $ gcc_symbol = "gcc"
40 $ ans = ""
41 $ macros = ""
42 $ use_vmsdebug_perl = "n"
43 $ use_debugging_perl = "Y"
44 $ use_64bitint = "n"
45 $ C_Compiler_Replace = "CC="
46 $ Thread_Live_Dangerously = "MT="
47 $ use_two_pot_malloc = "N"
48 $ use_pack_malloc = "N"
49 $ use_debugmalloc = "N"
50 $ d_secintgenv = "N"
51 $ cc_flags = ""
52 $ use_multiplicity = "N"
53 $ vms_default_directory_name = F$ENVIRONMENT("DEFAULT")
54 $ max_allowed_dir_depth = 3  ! e.g. [A.B.PERL5_00n] not [A.B.C.PERL5_00n]
55 $! max_allowed_dir_depth = 2  ! e.g. [FOO.PERL5_00n] not [FOO.BAR.PERL5_00n]
56 $!
57 $ vms_filcnt = F$GETJPI ("","FILCNT")
58 $!
59 $!: compute my invocation name
60 $ me = F$ENVIRONMENT("PROCEDURE")
61 $!
62 $! Many null statements (begin with colon ':') in the Bourne shell version of
63 $! this script serve as comments/placeholders. I have retained some of the ones
64 $! that will help you compare this .COM file to the sh version - as well as
65 $! leave placeholders for future improvements to this .COM file.
66 $! sfn = VMS "skipped for now"
67 $!
68 $!: Proper PATH separator                              !sfn
69 $!: Proper PATH setting                                !sfn
70 $!: Sanity checks                                      !sfn "Say '@''$me''"
71 $!: On HP-UX, large Configure scripts may exercise a bug in /bin/sh !sfn
72 $!: Configure runs within the UU subdirectory          !->after find MANIFEST
73 $!   <big long list of default values (mostly null)>
74 $!: We must find out about Eunice early                !(?)
75 $!: list of known cpp symbols, sorted alphabetically   !sfn
76 $!   al = al + "..."
77 $!: default library list                               !sfn
78 $!   <no hints files in use (yet?)>
79 $!: Extra object files, if any, needed on this platform. !sfn
80 $!: Possible local include directories to search.      !sfn
81 $!: Set locincpth to "" in a hint file to defeat local include searches. !sfn
82 $!locincpth="/usr/local/include /opt/local/include /usr/gnu/include" !sfn
83 $!locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
84 $!: no include file wanted by default                  !sfn
85 $!inclwanted=''                                        !sfn
86 $!: Possible local library directories to search.      !sfn
87 $!loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib" !sfn
88 $!loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib" !sfn
89 $!: general looking path for locating libraries        !sfn
90 $!glibpth="/lib/pa1.1 /usr/shlib /usr/lib/large /lib /usr/lib" !sfn
91 $!glibpth="$glibpth $xlibpth /lib/large /usr/lib/small /lib/small" !sfn
92 $!glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/shlib" !sfn
93 $!: Private path used by Configure to find libraries.  Its value !sfn
94 $!: is prepended to libpth. This variable takes care of special !sfn
95 $!: machines, like the mips.  Usually, it should be empty. !sfn
96 $!plibpth=''                                           !sfn
97 $!: full support for void wanted by default            !sfn
98 $!defvoidused=15                                       !sfn
99 $!: List of libraries we want.                         !sfn
100 $!libswanted='net socket inet nsl nm ndbm gdbm dbm db malloc dl' !sfn
101 $!libswanted="$libswanted dld ld sun m c cposix posix ndir dir crypt" !sfn
102 $!libswanted="$libswanted ucb bsd BSD PW x"            !sfn
103 $!: We probably want to search /usr/shlib before most other libraries. !sfn
104 $!: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist. !sfn
105 $!glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'` !sfn
106 $!glibpth="/usr/shlib $glibpth"                        !sfn
107 $!: Do not use vfork unless overridden by a hint file. !sfn
108 $!usevfork=false                                       !sfn
109 $!: script used to extract .SH files with variable substitutions !sfn
110 $!: produce awk script to parse command line options   !sfn
111 $!sfn (assume no sed awk) see below
112 $!: process the command line options         
113 $!
114 $!: set up default values
115 $ fastread=""
116 $ reuseval="false"
117 $ maniskip = "false"
118 $ config_sh=""
119 $ alldone=""
120 $ error=""
121 $ silent=""
122 $ extractsh=""
123 $ override=""
124 $ knowitall=""
125 $ Using_Dec_C = ""
126 $ Using_Vax_C = ""
127 $ Using_Gnu_C = ""
128 $ Dec_C_Version = ""
129 $ use_threads = "F"
130 $!
131 $!: option parsing
132 $ IF (P1 .NES. "")
133 $ THEN            !one or more switches was thrown
134 $   i = 1
135 $   bang = 0
136 $Param_loop:
137 $   IF (P'i'.NES."") THEN bang = bang + 1
138 $   i = i + 1
139 $   IF (i.LT.9) THEN GOTO Param_loop !DCL allows P1..P8
140 $!
141 $   i = 1
142 $Opt_loop:
143 $   IF (F$EXTRACT(0,1,P'i') .EQS. "-") THEN P'i' = P'i' - "-"
144 $   IF (F$EXTRACT(0,1,P'i') .EQS. "/") THEN P'i' = P'i' - "/"
145 $Remove_quotation_mark:
146 $   P'i' = P'i' - """"
147 $   IF F$LOCATE("""",P'i') .LT. F$LENGTH(P'i') THEN GOTO Remove_quotation_mark
148 $   gotopt      = "f" !"alse"
149 $   gotshortopt = "f" !"alse"
150 $   IF (F$EXTRACT(0,1,P'i') .EQS. "d")
151 $   THEN
152 $     fastread    = "yes"
153 $     gotopt      = "t" !"rue"
154 $     P'i'        = P'i' - "d"
155 $     gotshortopt = "t" !"rue"
156 $   ENDIF
157 $   IF (F$EXTRACT(0,1,P'i') .EQS. "e")
158 $   THEN
159 $     alldone = "cont"
160 $     gotopt = "t"
161 $     P'i' = P'i' - "e"
162 $     gotshortopt = "t"
163 $   ENDIF
164 $   IF (F$EXTRACT(0,1,P'i') .EQS. "f") !"-f")
165 $   THEN
166 $     P'i' = P'i' - "f"
167 $     config_sh = P'i'
168 $     IF (F$SEARCH(config_sh).NES."")
169 $     THEN
170 $       test_config_sh = F$FILE_ATTRIBUTES(config_sh,"PRO")
171 $       IF (F$LOCATE("R",test_config_sh).NE.F$LENGTH(test_config_sh)) 
172 $       THEN
173 $         CONTINUE !at this point check UIC && if test allows...
174 $                  !to be continued ?
175 $       ELSE
176 $         echo "''me': cannot read config file ''config_sh'."
177 $         error="true"
178 $       ENDIF
179 $     ELSE
180 $       echo "''me': cannot read config file ''config_sh'."
181 $       error="true"
182 $     ENDIF
183 $     gotopt = "t"
184 $   ENDIF
185 $   IF (F$EXTRACT(0,1,P'i') .EQS. "h")
186 $   THEN
187 $     error = "true"
188 $     gotopt = "t"
189 $     P'i' = P'i' - "h"
190 $     gotshortopt = "t"
191 $   ENDIF
192 $   IF (F$EXTRACT(0,1,P'i') .EQS. "m")
193 $   THEN
194 $     maniskip = "true"
195 $     gotopt = "t"
196 $     P'i' = P'i' - "m"
197 $     gotshortopt = "t"
198 $   ENDIF
199 $   IF (F$EXTRACT(0,1,P'i') .EQS. "r")
200 $   THEN
201 $     reuseval = "true"
202 $     gotopt = "t"
203 $     P'i' = P'i' - "r"
204 $     gotshortopt = "t"
205 $   ENDIF
206 $   IF (F$EXTRACT(0,1,P'i') .EQS. "s")
207 $   THEN
208 $     silent = "true"
209 $     gotopt = "t"
210 $     P'i' = P'i' - "s"
211 $     gotshortopt = "t"
212 $   ENDIF
213 $   IF (F$EXTRACT(0,1,P'i') .EQS. "E") !"-E")
214 $   THEN
215 $     alldone = "exit"
216 $     gotopt = "t"
217 $   ENDIF
218 $   IF (F$EXTRACT(0,1,P'i') .EQS. "K") !"-K")
219 $   THEN
220 $     knowitall = "true"
221 $     gotopt = "t"
222 $     P'i' = P'i' - "K"
223 $     gotshortopt = "t"
224 $   ENDIF
225 $   IF (F$EXTRACT(0,1,P'i') .EQS. "O")
226 $   THEN
227 $     override = "true"
228 $     gotopt = "t"
229 $     P'i' = P'i' - "O"
230 $     gotshortopt = "t"
231 $   ENDIF
232 $   IF (F$EXTRACT(0,1,P'i') .EQS. "S") !"-S")
233 $   THEN
234 $     extractsh = "true" !VMS?
235 $     gotopt = "t"
236 $     P'i' = P'i' - "S"
237 $     gotshortopt = "t"
238 $   ENDIF
239 $   IF (F$EXTRACT(0,1,P'i') .EQS. "D") !"-D")
240 $   THEN
241 $     P'i' = P'i' - "D"
242 $!Hmm.. this part needs work
243 $!       P'i'
244 $     IF (F$LOCATE("=",P'i') .EQ. F$LENGTH(P'i'))
245 $     THEN
246 $       P'i' = "define"
247 $     ELSE 
248 $       IF (F$LOCATE("=",P'i') .EQ. (F$LENGTH(P'i') - 1))
249 $       THEN
250 $         me = F$PARSE(me,,,"NAME") + F$PARSE(me,,,"TYPE")
251 $         echo "''me': use '-Usymbol=val' not '-Dsymbol='."
252 $         echo "''me': ignoring -D",P'i'
253 $       ELSE
254 $!Hmm.. this part needs work
255 $!           'F$EXTRACT(0,F$LOCATE("=",P'i'),P'i')' = -
256 $! 'F$EXTRACT(F$LOCATE("=",P'i'),P'i'),F$LENGTH(P'i'),P'i')'
257 $       ENDIF
258 $     ENDIF
259 $     ECHO "P''i' =>",P'i',"<="  !Diag
260 $     gotopt = "t"
261 $   ENDIF
262 $   IF (F$EXTRACT(0,1,P'i') .EQS. "U") !"-U")
263 $   THEN
264 $     P'i' = P'i' - "U"
265 $     IF (F$LOCATE("=",P'i') .EQ. F$LENGTH(P'i'))
266 $     THEN
267 $       P'i' = ""
268 $     ELSE 
269 $       IF (F$LOCATE("=",P'i') .LT. (F$LENGTH(P'i') - 1))
270 $       THEN
271 $         me = F$PARSE(me,,,"NAME") + F$PARSE(me,,,"TYPE")
272 $         echo "''me': use '-Dsymbol=val' not '-Usymbol=val'."
273 $         echo "''me': ignoring -U",P'i'
274 $       ELSE
275 $         P'i' = "undef"
276 $       ENDIF
277 $     ENDIF
278 $     ECHO "P''i' =>",P'i',"<="  !Diag
279 $     gotopt = "t"
280 $   ENDIF
281 $   IF (F$EXTRACT(0,1,P'i') .EQS. "V")
282 $   THEN
283 $     me = F$PARSE(me,,,"NAME") + F$PARSE(me,,,"TYPE")
284 $     echo "''me' generated by an unknown version of EDT."
285 $     STOP
286 $     EXIT !0
287 $   ENDIF
288 $   IF .NOT.gotopt 
289 $   THEN
290 $     echo "''me': unknown option ",P'i'
291 $     error = "true"
292 $   ENDIF
293 $   IF (F$LENGTH(P'i').GT.0).AND.(gotshortopt) THEN i = i - 1 !clustered switch
294 $   i = i + 1 
295 $   IF (i .LT. (bang + 1)) THEN GOTO Opt_loop
296 $!
297 $ ENDIF  ! (P1 .NES. "")
298 $!
299 $ IF (error)
300 $ THEN
301 $   me = F$PARSE(me,,,"DIRECTORY")+ F$PARSE(me,,,"NAME")
302 $   echo "Usage: @''me' [-dehmrEKOSV] [-fconfig.sh] [-Dsymbol] [-Dsymbol=value]"
303 $   echo "                [-Usymbol]  [-Usymbol=]"
304 $   TYPE SYS$INPUT
305  "-d" : use defaults for all answers.
306  "-e" : go on without questioning past the production of config.sh.    *
307  "-f" : specify an alternate default configuration file.
308  "-h" : print this help message and exit (with an error status).
309  "-m" : skip the MANIFEST check to see that all files are present
310  "-r" : reuse C symbols value if possible (skips costly nm extraction).*
311  "-s" : silent mode, only echoes questions and essential information.
312  -"D" : define symbol to have some value:                              *
313          -"Dsymbol"         symbol gets the value 'define'
314          -"Dsymbol=value"   symbol gets the value 'value'
315   -E  : stop at the end of questions, after having produced config.sh. *
316   -K  : do not use unless you know what you are doing.
317   -O  : let -D and -U override definitions from loaded configuration file. *
318   -S  : perform variable substitutions on all .SH files (can mix with -f) *
319  -"U" : undefine symbol:                                               *
320          -"Usymbol"    symbol gets the value 'undef'
321          -"Usymbol="   symbol gets completely empty
322   -V  : print version number and exit (with a zero status).
323 $   echo "%Config-I-VMS, lower case switches must be enclosed"
324 $   echo "-Config-I-VMS, in double quotation marks, e.g.:"
325 $   echo "-Config-I-VMS,   @Configure ""-des"""
326 $   echo "-Config-I-VMS, * indicates switch may not be fully implemented for VMS."
327 $   SET DEFAULT 'vms_default_directory_name' !be kind rewind
328 $   STOP
329 $   EXIT 3 ! $STATUS = "%X00000003" (informational)
330 $ ENDIF
331 $!
332 $ GOTO Check_silence
333 $!
334 $Shut_up:
335 $ STDOUT = F$TRNLNM("SYS$OUTPUT")
336 $ DEFINE SYS$OUTPUT "_NLA0:"
337 $ echo4 = "write STDOUT "
338 $ cat4 = "TYPE/OUTPUT=''STDOUT'"
339 $ open/write STDOUT 'STDOUT'
340 $ RETURN
341 $!
342 $Check_silence:
343 $ IF (silent) 
344 $ THEN
345 $   GOSUB Shut_up
346 $ ELSE
347 $   echo4 = "write SYS$OUTPUT "
348 $   cat4 = "TYPE"
349 $ ENDIF
350 $!
351 $!: run the defines and the undefines, if any, but leave the file out there...
352 $! Unfortunately Configure.COM in DCL is not yet set up to do this - 
353 $! maybe someday
354 $!
355 $!: set package name
356 $ package = "perl5"
357 $!
358 $!: Eunice requires " " instead of "", can you believe it
359 $ echo ""
360 $!: Here we go...
361 $ echo "Beginning of configuration questions for ''package'."
362 $ echo ""
363 $!
364 $!: Some greps do not return status, grrr.
365 $ contains = "SEARCH"
366 $!
367 $!: first determine how to suppress newline on echo command !cant DCL is record oriented
368 $! echo "Checking ''echo' to see how to suppress newlines..."
369 $! echo "giving up..."
370 $! echo "The star should be here-->*"
371 $!
372 $!: Now test for existence of everything in MANIFEST
373 $ echo ""
374 $ echo4 "First let's make sure your kit is complete.  Checking..."
375 $ manifestfound = "" 
376 $ miss_list = "" 
377 $! Here I assume we are in the [foo.PERL5xxx.VMS...] tree
378 $! because the search routine simply does set def [-] if necessary.
379 $ file_2_find = "MANIFEST" !I hope this one is not in [foo.PERL5xxx.VMS...] 
380 $Research_manifest:
381 $ manifestfound = F$SEARCH(file_2_find)
382 $ IF (manifestfound .EQS. "")
383 $ THEN
384 $   IF F$PARSE(F$ENVIRONMENT("DEFAULT"),,,"DIRECTORY",).NES."[000000]"
385 $   THEN
386 $     SET DEFAULT [-]
387 $     GOTO Research_manifest
388 $   ELSE
389 $     echo ""
390 $     echo "There is no MANIFEST file.  I hope your kit is complete !"
391 $     miss_list = ""
392 $     GOTO Beyond_manifest
393 $   ENDIF
394 $ ELSE
395 $! MANIFEST. has been found and we have set def'ed there - 
396 $! time to bail out before it's too late.
397 $ tmp = f$extract(1,3,f$edit(f$getsyi("VERSION"),"TRIM,COLLAPSE"))
398 $ IF (tmp .GES. "7.2") .AND. (F$GETSYI("HW_MODEL") .GE. 1024) THEN GOTO Beyond_depth_check
399 $   IF (F$ELEMENT(max_allowed_dir_depth,".",F$ENVIRONMENT("Default")).nes.".")
400 $   THEN
401 $     TYPE SYS$INPUT:
402 %Config-E-VMS, ERROR:
403  Sorry! It apears as though your perl build sub-directory is already too
404  deep into the VMS file system. Please try moving stuff into a shallower 
405  directory (or altering the "max_allowed_dir_depth" parameter).
406 $     echo4 "ABORTING..."
407 $     SET DEFAULT 'vms_default_directory_name' !be kind rewind
408 $     STOP
409 $     EXIT !2 !$STATUS = "%X00000002" (error)
410 $   ENDIF
411 $Beyond_depth_check:
412 $!
413 $! after finding MANIFEST let's create (but not yet enter) the UU subdirectory
414 $!
415 $   IF (manifestfound .NES. "")
416 $   THEN
417 $     IF ( F$SEARCH("UU.DIR").EQS."" )
418 $     THEN
419 $       CREATE/DIRECTORY [.UU]
420 $     ELSE
421 $       IF ( F$SEARCH("[.UU]*.*").NES."" ) THEN DELETE/NOLOG [.UU]*.*;*
422 $     ENDIF
423 $!: Configure runs within the UU subdirectory
424 $     SET DEFAULT [.UU]
425 $!
426 $! a little redundancy never hurt anybody?
427 $     file_2_find = "[-]" + file_2_find
428 $     manifestfound = F$SEARCH(file_2_find)
429 $!
430 $     OPEN/WRITE MISSING MISSING.
431 $!change to "FALSE" if you wish to skip the manifest search 
432 $!(which after all is rather slow in DCL :-)
433 $     IF (maniskip)
434 $     THEN
435 $       echo "Skipping MANIFEST check as requested"
436 $     ELSE
437 $!
438 $       OPEN/READ CONFIG 'manifestfound'
439 $Read_loop_manifest:
440 $       READ/END_OF_FILE = Done_manifest CONFIG line
441 $! This algorithm turns "foo/bar/baz.c" into "[.foo.bar]baz.c"
442 $! pvhp@lns62.lns.cornell.edu 10-JUN-1996 20:31:46
443 $! 2-MAR-1998 15:46:11 Improved to turn "foo/bar/baz.c.buz"
444 $! into "[.foo.bar]baz.c_buz as happens with vmstar and unzip
445 $       line = F$EDIT(line,"TRIM, COMPRESS")
446 $       file_2_find = F$EXTRACT(0,F$LOCATE(" ",line),line) 
447 $       IF F$LOCATE("/",file_2_find) .NE. F$LENGTH(file_2_find) 
448 $       THEN 
449 $Re_strip_line_manifest:
450 $         loca = F$LOCATE("/",file_2_find)
451 $         ante = F$EXTRACT(0,loca,file_2_find)
452 $         post = F$EXTRACT(loca,F$LENGTH(file_2_find),file_2_find)
453 $         test_this = ante + "." + (post - "/")
454 $         IF F$LOCATE("/",test_this) .NE. F$LENGTH(test_this)
455 $         THEN 
456 $           file_2_find = ante + "." + (post - "/")
457 $           GOTO Re_strip_line_manifest
458 $         ELSE
459 $           file_2_find = ante + "]" + (post - "/")
460 $         ENDIF
461 $           file_2_find = "[-."+file_2_find
462 $       ELSE
463 $         file_2_find = "[-]" + file_2_find
464 $       ENDIF
465 $!
466 $       dirname = F$EXTRACT(0,F$LOCATE("]",file_2_find),file_2_find) + "]"
467 $       file_2_find = file_2_find - dirname
468 $       dots = 0
469 $Dot_loop:
470 $       dot_ele = F$ELEMENT(dots,".",file_2_find)
471 $       IF dot_ele .EQS. "." THEN GOTO Eo_dot_loop
472 $       IF dots .eq. 0
473 $       THEN basename = f$extract(0,f$locate(".",file_2_find),file_2_find) + "."
474 $       ELSE basename = basename + dot_ele + "_"
475 $       ENDIF
476 $       dots = dots + 1
477 $       GOTO dot_loop
478 $Eo_dot_loop:
479 $       IF (((f$length(file_2_find)+1) .eq. f$length(basename)) .and. -
480              (f$extract(f$length(basename)-1,1,basename) .eqs. "_")) THEN -
481           basename = f$extract(0,f$length(basename)-1,basename)
482 $       file_2_find = dirname + basename
483 $!
484 $       found = F$SEARCH(file_2_find)
485 $       IF (found .EQS. "" .AND. dots .GT. 2)
486 $       THEN
487 $! 17-DEC-1999 Improved to turn "[.foo.bar]baz.c_buz" into
488 $! "[.foo.bar]baz_c.buz" to cover unzipped archives and put
489 $! "[.foo.bar]baz.c_buz,baz_c.buz" into missing list if neither is found.
490 $         basename[f$locate(".",basename),1] := _
491 $         dot_ele = F$ELEMENT(dots - 1,"_",basename)
492 $         basename = -
493             f$extract(0,f$length(basename)-(f$length(dot_ele)+1),basename) -
494               + "." + dot_ele
495 $         found = F$SEARCH(dirname + basename)
496 $         file_2_find = file_2_find + "," + basename
497 $       ENDIF
498 $       IF (found .EQS. "")
499 $       THEN
500 $         WRITE MISSING file_2_find
501 $         IF ((F$LENGTH(miss_list)+F$LENGTH(file_2_find)).LT.250)
502 $         THEN
503 $           miss_list = miss_list + "," + file_2_find
504 $         ENDIF
505 $       ENDIF
506 $       GOTO Read_loop_manifest
507 $Done_manifest:
508 $       CLOSE CONFIG
509 $     ENDIF  !"TRUE"
510 $     CLOSE MISSING
511 $   ENDIF ! (manifestfound .NES. "")
512 $Beyond_manifest:
513 $   IF (miss_list .NES. "")
514 $   THEN
515 $     echo "Some of the files not found include:"
516 $     cat4 MISSING.
517 $   ENDIF
518 $   IF ((miss_list .NES. "").OR.(manifestfound .EQS. ""))
519 $   THEN
520 $     TYPE SYS$INPUT:
521
522 THIS PACKAGE SEEMS TO BE INCOMPLETE.
523
524 You have the option of continuing the configuration process, despite the
525 distinct possibility that your kit is damaged, by typing 'y'es.  If you
526 do, don't blame me if something goes wrong.  I advise you to type 'n'o
527 and contact the author (sugalskd@ous.edu).
528
529 $     READ SYS$COMMAND/PROMPT="Continue? [n] " ans
530 $     IF ans
531 $     THEN
532 $       echo4 "Continuing..."
533 $     ELSE
534 $       echo4 "ABORTING..."
535 $       GOTO Clean_up
536 $     ENDIF
537 $   ELSE
538 $     echo4 "Looks good..."
539 $     DELETE/NOLOG MISSING.;
540 $   ENDIF ! (miss_list .NES. "")
541 $ ENDIF   ! (manifestfound .EQS. "") ELSE 
542 $!
543 $! after finding MANIFEST (see above)
544 $!: Configure runs within the UU subdirectory 
545 $!
546 $!: compute the number of columns on the terminal for proper question formatting
547 $! (sfn, will assume 80-ish)
548 $!
549 $!: set up the echo used in my read              !sfn
550 $!: now set up to do reads with possible shell escape and default assignment !sfn
551 $ GOTO Beyond_myread
552 $!
553 $myread:
554 $ ans = ""
555 $ If (fastread)
556 $ Then
557 $   echo4 "''rp'"
558 $ Else
559 $   If (silent)
560 $   Then
561 $     READ SYS$COMMAND/PROMPT="''rp'" ans
562 $   Else
563 $     echo ""
564 $     READ SYS$COMMAND/PROMPT="''rp'" ans
565 $   Endif
566 $ Endif
567 $ RETURN
568 $!
569 $Beyond_myread:
570 $!
571 $!: create .config dir to save info across Configure sessions
572 $ IF ( F$SEARCH("[-]CONFIG.DIR").EQS."" )
573 $ THEN
574 $   CREATE/DIRECTORY [-.CONFIG]
575 $   OPEN/WRITE CONFIG [-.CONFIG]README.
576 $   WRITE CONFIG -
577       "This directory created by Configure to save information that should"
578 $   WRITE CONFIG -
579       "persist across sessions."
580 $   WRITE CONFIG ""
581 $   WRITE CONFIG -
582       "You may safely delete it if you wish."
583 $   CLOSE CONFIG
584 $ ENDIF
585 $!
586 $!: general instructions
587 $ needman = "true"
588 $ firsttime = "true"
589 $ user = F$EDIT(F$GETJPI("","USERNAME"),"TRIM,COLLAPSE")
590 $ IF .NOT.(F$SEARCH("[-.CONFIG]INSTRUCT.").EQS."")
591 $ THEN
592 $   messages = F$ENVIRONMENT("MESSAGE")
593 $   SET MESSAGE/NOFAC/NOSEV/NOIDENT/NOTEXT
594 $   contains /NOOUTPUT [-.CONFIG]INSTRUCT. 'user'
595 $   IF .NOT.($status.EQ.%X08D78053)
596 $   THEN
597 $     firsttime=""
598 $     dflt = "n"
599 $     rp = "Would you like to see the instructions? [''dflt'] "
600 $     GOSUB myread
601 $     if .NOT.ans THEN needman=""
602 $   ENDIF
603 $   SET MESSAGE 'messages'
604 $ ENDIF
605 $ if (fastread.AND.silent.AND.(alldone.eqs."cont")) THEN needman=""
606 $!
607 $ IF (needman)
608 $ THEN
609 $   TYPE SYS$INPUT:
610
611 This installation shell script will examine your system and ask you questions
612 to determine how the perl5 package should be installed. If you get
613 stuck on a question, you may use a ^C or ^Y shell escape to STOP this
614 process, edit something, then restart this process as you just did.
615 Many of the questions will have default answers in square
616 brackets; typing carriage return will give you the default.
617
618 $   READ SYS$COMMAND/PROMPT="Type carriage return to continue " ans
619 $   TYPE SYS$INPUT:
620
621 In a hurry? You may run '@Configure "-d"'.  This will bypass nearly all
622 the questions and use the computed defaults (or the previous answers provided 
623 there was already a config.sh file). Type '@Configure "-h"' for a list of 
624 options.
625
626 $   READ SYS$COMMAND/PROMPT="Type carriage return to continue " ans
627 $   TYPE SYS$INPUT:
628
629 Much effort has been expended to ensure that this shell script will
630 run on any VMS system.  If despite that it blows up on yours, your
631 best bet is to edit Configure.com and @ it again.  Whatever problems
632 you have with Configure.com, let me (sugalskd@ous.edu) know how I blew
633 it.
634
635 $!This installation script affects things in two ways:
636 $!
637 $!1) it may do direct variable substitutions on some of the files included
638 $!   in this kit.
639 $!2) it builds a config.h file for inclusion in C programs.  You may edit
640 $!   any of these files as the need arises after running this script.
641 $!
642 $!If you make a mistake on a question, there is no easy way to back up to it
643 $!currently.
644 $!
645 $   READ SYS$COMMAND/PROMPT="Type carriage return to continue " ans
646 $   IF (F$SEARCH("[-.CONFIG]INSTRUCT.").EQS."")
647 $   THEN
648 $     OPEN/WRITE CONFIG [-.CONFIG]INSTRUCT.
649 $     WRITE CONFIG user 
650 $     CLOSE CONFIG
651 $   ENDIF
652 $ ENDIF  !(needman .EQS. "true")
653 $!
654 $!: see if sh knows # comments             !sfn
655 $ sharpbang = "$ "
656 $!: figure out how to guarantee sh startup !sfn
657 $!: find out where common programs are     !sfn
658 $!loclist="awk/cat/comm/cp/echo/expr/find/grep/ln/ls/mkdir/rm/sed/sort/touch/tr/uniq"
659 $!trylist="Mcc/byacc/cpp/csh/date/egrep/less/line/more/nroff/perl/pg/sendmail/test/uname"
660 $! echo "I don't know where '$file' is, and my life depends on it."
661 $! echo "Go find a public domain implementation or fix your PATH setting!"
662 $! echo ""
663 $! echo "Don't worry if any of the following aren't found..."
664 $!: determine whether symbolic links are supported !sfn
665 $!: see whether [:lower:] and [:upper:] are supported character classes !sfn
666 $!: set up the translation script tr, must be called with ./tr of course !sfn
667 $!
668 $!: Try to determine whether config.sh was made on this system
669 $!: Get old answers from old config file if Configure was run on the
670 $!: same system, otherwise use the hints.
671 $ config_sh_es = "''config_sh'/[-]config.sh/[-.vms]config.vms/"
672 $ i = 0
673 $ max = 3
674 $Config_sh_look:
675 $ config_sh = F$ELEMENT(i,"/",config_sh_es)
676 $ i = i + 1
677 $ IF (config_sh.NES."/").AND.(config_sh.NES."")
678 $ THEN
679 $   configshfound = F$SEARCH(config_sh)
680 $   IF (configshfound.NES."") THEN GOTO Config_sh_found
681 $ ENDIF
682 $ IF (i.LT.max) THEN GOTO Config_sh_look
683 $ IF (configshfound.EQS."") THEN GOTO Beyond_config_sh
684 $Config_sh_found:
685 $ echo ""
686 $ echo "Fetching default answers from ''config_sh'..."
687 $!we actually do not have "hints/" for VMS
688 $!     TYPE SYS$INPUT:
689 $!
690 $!First time through, eh?  I have some defaults handy for the following systems:
691 $!
692 $!     echo "     ","VMS_VAX"
693 $!     echo "     ","VMS_AXP"
694 $!        : Now look for a hint file osname_osvers, unless one has been
695 $!        : specified already.
696 $!     TYPE SYS$INPUT:
697 $!
698 $!You may give one or more space-separated answers, or "none" if appropriate.
699 $!If your OS version has no hints, DO NOT give a wrong version -- say "none".
700 $!
701 $!     READ SYS$COMMAND/PROMPT="Which of these apply, if any? " ans
702 $!
703 $Beyond_config_sh:
704 $!
705 $!: Restore computed paths          !sfn
706 $!
707 $! genconfig.pl has "osname='VMS'"
708 $ osname = F$EDIT(F$GETSYI("NODE_SWTYPE"),"COLLAPSE") 
709 $! %Config-I-VMS, a necessary error trap (could be PC running VCL)
710 $!
711 $ IF (osname .NES. "VMS")
712 $ THEN
713 $   echo4 "Hmm.. I wonder what ''osname' is (?)"
714 $   TYPE SYS$INPUT:
715
716 %Config-E-VMS, ERROR:
717
718            Err, you do not appear to be running VMS!
719  This procedure is intended to Configure the building of Perl for VMS.
720
721 $   READ SYS$COMMAND/PROMPT="Continue anyway? [n] " ans
722 $   IF ans
723 $   THEN
724 $     echo4 "Continuing..."
725 $   ELSE
726 $     echo4 "ABORTING..."
727 $     SET DEFAULT 'vms_default_directory_name' !be kind rewind
728 $     STOP
729 $     EXIT 2 !$STATUS = "%X00000002" (error)
730 $   ENDIF
731 $ ELSE           !we are on VMS huzzah!
732 $   IF .NOT.silent 
733 $   THEN TYPE SYS$INPUT:
734
735 Configure uses the operating system name and version to set some defaults.
736 The default value is probably right if the name rings a bell. Otherwise,
737 since spelling matters for me, either accept the default or answer "none"
738 to leave it blank.
739 $   ENDIF
740 $   rp = "Operating system name? [''osname'] "
741 $   GOSUB myread
742 $   IF ans.nes.""
743 $   THEN
744 $     IF (ans.NES.osname) !.AND.knowitall
745 $     THEN
746 $       echo4 "I'll go with ''osname' anyway..."
747 $     ENDIF
748 $   ENDIF
749 $ ENDIF !(osname .NES./.EQS. "VMS")
750 $!
751 $!: who configured the system
752 $! see 'user' above.
753 $ cf_by = F$EDIT(user,"LOWERCASE")
754 $! cf_time = F$CVTIME()                 !superceded by procedure below
755 $ osvers = F$GETSYI("VERSION")
756 $!
757 $! Peter Prymmer has seen:
758 $!  "SYS$TIMEZONE_DIFFERENTIAL" = "-46800"  (sic)
759 $!  "SYS$TIME_ZONE" = "EDT"
760 $!
761 $! Charles Lane recommended:
762 $!  "SYS$TIMEZONE_DIFFERENTIAL" = "-14400"
763 $!  "NEWS_TIMEZONE" = "-0500"
764 $!  "ST_TIMEZONE" = "EDT"
765 $!  "JAN_TIME_ZONE" = "EST  "
766 $!  "MULTINET_TIMEZONE" = "EST"
767 $!  "DAYLIGHT_SAVINGS"  = "1"
768 $!
769 $! Charles Bailey recommends (in ANU NEWS Doc Jan 1995):
770 $!   "PMDF_Timezone"
771 $!   "Multinet_Timezone"
772 $!   "TCPware_Timezone"
773 $!   "WIN$Time_Zone"
774 $!
775 $! This snippet o' DCL returns a string in default Unix `date` format,
776 $! and it will prompt to set SYS$TIMEZONE_DIFFERENTIAL.
777 $! Peter Prymmer pvhp@lns62.lns.cornell.edu
778 $!
779 $ MIN_TZO = -840  !units are minutes here
780 $ MAX_TZO =  840
781 $!
782 $ wkday  = F$EXTRACT(0,3,F$CVTIME(,,"WEEKDAY"))
783 $ monn   = F$CVTIME(,,"MONTH")
784 $ mday   = F$EXTRACT(8,2,F$CVTIME(,,"DATE"))
785 $ hour   = F$CVTIME(,,"HOUR")
786 $ min    = F$CVTIME(,,"MINUTE")
787 $ sec    = F$CVTIME(,,"SECOND")
788 $ year   = F$CVTIME(,,"YEAR")
789 $!
790 $ months = "/Jan/Feb/Mar/Apr/May/Jun/Jul/Aug/Sep/Oct/Nov/Dec/"
791 $ i = 0
792 $Mon_loop:
793 $ i = i + 1
794 $ mon = F$ELEMENT(i,"/",months)
795 $ IF i.LT.monn THEN GOTO Mon_loop
796 $!
797 $ tzneedset = "t"
798 $ systz = F$TRNLNM("SYS$TIMEZONE_DIFFERENTIAL")
799 $ IF systz.NES.""
800 $ THEN
801 $   tzhour = F$INTEGER(systz)/3600
802 $   tzmins = F$INTEGER(systz)/60
803 $   tzminrem = tzmins - tzhour*60
804 $   IF tzminrem.lt.0 THEN tzminrem = -1*tzminrem  !keeps !2ZL happy
805 $   IF tzhour.ge.0 
806 $   THEN signothetime = "+" 
807 $     IF tzhour.EQ.0.AND.tzminrem.EQ.0 
808 $     THEN direction = "on GMT/"
809 $     ELSE direction = "east of "
810 $     ENDIF
811 $   ELSE signothetime = "-"
812 $     tzhour = -1*tzhour                          !keeps !UL happy
813 $     direction = "west of "
814 $   ENDIF
815 $   echo ""
816 $   echo "%Config-I-VMS,"
817 $   echo "According to the setting of your ""SYS$TIMEZONE_DIFFERENTIAL"" (= ''systz')"
818 $   IF tzminrem.ne.0
819 $   THEN
820 $     tzspan = "''tzhour' hours & ''tzminrem' minutes"
821 $   ELSE
822 $     tzspan = "''tzhour' hours"
823 $   ENDIF
824 $   dflt = "y"
825 $   echo "Your system is ''tzspan' ''direction'UTC in England."
826 $   rp = "%Config-I-VMS, (''systz') Is this UTC Time Zone Offset correct? [''dflt'] "
827 $   GOSUB myread
828 $   IF ans.OR.(ans.EQS."") 
829 $   THEN 
830 $     tzneedset = "f"
831 $     tzd = systz
832 $     GOTO Beyond_TimeZone
833 $   ENDIF
834 $ ELSE
835 $   echo ""
836 $   echo4 "%Config-I-VMS,"
837 $   echo4 """SYS$TIMEZONE_DIFFERENTIAL"" does not appear to be DEFINEd on your system"
838 $ ENDIF
839 $!
840 $TZSet:
841 $ echo ""
842 $ echo "Please tell me in hh:mm form what time offset from GMT/UTC in England"
843 $ echo "you are.  As an example Eastern (US) Standard Time is -5:00 offset, but"
844 $ echo "Eastern Daylight Time (summer) is -4:00 offset."
845 $ dflt = "0:00"
846 $ rp = "Enter the Time Zone offset: [''dflt'] "
847 $ GOSUB myread
848 $ ans = F$Edit(ans,"collapse,trim,uncomment,upcase")
849 $ IF ans.EQS."" THEN ans = dflt
850 $ tzhour   = F$ELEMENT(0,":","''ans'") !first
851 $ IF tzhour.EQS."" THEN tzhour = 0
852 $ tzhour   = F$INTEGER(tzhour)
853 $ tzminrem = F$ELEMENT(1,":","''ans'") !second
854 $ IF tzminrem.NES."" 
855 $ THEN 
856 $   tzminrem = F$INTEGER(tzminrem)
857 $   IF F$EXTRACT(0,1,"''ans'") .EQS. "-" THEN tzminrem = tzminrem * -1
858 $ ELSE 
859 $   tzminrem = 0
860 $ ENDIF
861 $ tzmins = tzhour*60 + tzminrem
862 $ tzd = F$STRING(tzmins*60)
863 $ IF tzhour .GE. 0 
864 $ THEN
865 $   signothetime = "+" 
866 $ ELSE
867 $   tzhour = -1*tzhour       !keeps !UL happy
868 $   signothetime = "-"
869 $ ENDIF
870 $ IF (tzmins.GT.MAX_TZO).OR.(tzmins.LT.MIN_TZO)
871 $ THEN
872 $   echo ""
873 $   echo "%Config-W-VMS-TIMERANGE, Response must be in the range -14:00 to 14:00."
874 $   goto TZSet
875 $ ENDIF
876 $!
877 $Beyond_TimeZone:
878 $ tz = f$fao("UTC!AS!UL:!2ZL",signothetime,tzhour,tzminrem)
879 $ cf_time = "''wkday' ''mon' ''mday' ''hour':''min':''sec' ''tz' ''year'"
880 $!
881 $!: determine the architecture name  
882 $! genconfig.pl has either archname='VMS_AXP' or 'VMS_VAX'
883 $!
884 $ IF (F$GETSYI("HW_MODEL") .LT. 1024)
885 $ THEN 
886 $   archname = "VMS_VAX"
887 $   otherarch = "an Alpha"
888 $ ELSE
889 $   archname = "VMS_AXP"
890 $   otherarch = "a VAX"
891 $ ENDIF
892 $ rp = "What is your architecture name? [''archname'] "
893 $ GOSUB myread
894 $ IF ans.NES.""
895 $ THEN
896 $   ans = F$EDIT(ans,"COLLAPSE, UPCASE")
897 $   IF (ans.NES.archname) !.AND.knowitall
898 $   THEN
899 $     echo4 "I'll go with ''archname' anyway..."
900 $   ENDIF
901 $ ENDIF
902 $ dflt = "n"
903 $ rp = "Will you be sharing your PERL_ROOT with ''otherarch'? [''dflt'] "
904 $ GOSUB myread
905 $ if ans.NES.""
906 $ THEN
907 $   ans = F$EXTRACT(0,1,F$EDIT(ans,"COLLAPSE, UPCASE"))
908 $ ENDIF
909 $ IF (ans.NES."Y")
910 $ THEN
911 $   sharedperl = "N"
912 $ ELSE
913 $   sharedperl = "Y"
914 $   IF (archname.EQS."VMS_AXP")
915 $   THEN
916 $     macros = macros + """AXE=1"","
917 $   ENDIF
918 $ ENDIF
919 $!
920 $!: is AFS running?                       !sfn
921 $!: decide how portable to be.  Allow command line overrides. !sfn
922 $!: set up shell script to do ~ expansion !sfn
923 $!: expand filename                       !sfn
924 $!: now set up to get a file name         !sfn
925 $!
926 $ vms_skip_install = "true"
927 $ dflt = "y"
928 $! echo ""
929 $ rp = "%Config-I-VMS, Do you wish to skip the """"where install"""" questions? [''dflt'] "
930 $ GOSUB myread
931 $ IF (.NOT.ans).AND.(ans.NES."") THEN vms_skip_install = "false"
932 $ prefix = F$ENVIRONMENT("DEFAULT") - ".UU]" + "]"
933 $ prefix = f$parse(prefix,,,,"NO_CONCEAL") - "][" - ".;"
934 $ prefix = prefix - "]" + ".]"
935 $ IF (.NOT.vms_skip_install)
936 $ THEN
937 $!: determine root of directory hierarchy where package will be installed.
938 $   dflt = "default"
939 $   IF .NOT.silent 
940 $   THEN 
941 $     echo ""
942 $     echo "By default, ''package' will be installed in ''dflt'/bin, manual"
943 $     echo "pages under ''dflt'/man, etc..., i.e. with ''dflt' as prefix for"
944 $     echo "all installation directories. Typically set to /usr/local, but you"
945 $     echo "may choose /usr if you wish to install ''package' among your system
946 $   ENDIF
947 $   IF .NOT.silent 
948 $   THEN TYPE SYS$INPUT:
949 binaries. If you wish to have binaries under /bin but manual pages
950 under /usr/local/man, that's ok: you will be prompted separately
951 for each of the installation directories, the prefix being only used
952 to set the defaults.
953 $   ENDIF
954 $   dflt = prefix
955 $   rp = "Installation prefix to use? [ ''dflt' ] "
956 $   GOSUB myread
957 $   IF ans.NES.""
958 $   THEN 
959 $     prefix = ans
960 $     IF F$LOCATE(".]",ans) .EQ. F$LENGTH(ans) THEN prefix = prefix - "]" + ".]"
961 $   ELSE 
962 $     prefix = dflt
963 $   ENDIF
964 $!
965 $!: set the prefixit variable, to compute a suitable default value
966 $!
967 $!: determine where private library files go
968 $!: Usual default is /usr/local/lib/perl5.  Also allow things like 
969 $!: /opt/perl/lib, since /opt/perl/lib/perl5 would be redundant.
970 $   IF .NOT.silent 
971 $   THEN TYPE SYS$INPUT:
972
973 There are some auxiliary files for perl5 that need to be put into a
974 private library directory that is accessible by everyone.
975 $   ENDIF
976 $   dflt = prefix - ".]" + ".LIB]"
977 $   rp = "Pathname where the private library files will reside? " 
978 $   rp = F$FAO("!AS!/!AS",rp,"[ ''dflt' ] ")
979 $   GOSUB myread
980 $   IF ans.NES.""
981 $   THEN privlib = ans
982 $   ELSE privlib = dflt
983 $   ENDIF
984 $!
985 $ ENDIF !%Config-I-VMS, skip "where install" questions
986 $!
987 $!: set the base revision
988 $ baserev="5"
989 $!: get the patchlevel
990 $ echo ""
991 $ echo4 "Getting the current patchlevel..." !>&4
992 $ patchlevel_h = F$SEARCH("[-]patchlevel.h")
993 $ IF (patchlevel_h.NES."")
994 $ THEN
995 $   got_patch = "false"
996 $   got_sub   = "false"
997 $   OPEN/READONLY CONFIG 'patchlevel_h' 
998 $Patchlevel_h_loop:
999 $   READ/END_Of_File=Close_patch CONFIG line
1000 $   IF ((F$LOCATE("#define PERL_VERSION",line).NE.F$LENGTH(line)).AND.(.NOT.got_patch))
1001 $   THEN
1002 $     line = F$EDIT(line,"COMPRESS, TRIM")
1003 $     patchlevel = F$ELEMENT(2," ",line)
1004 $     got_patch = "true"
1005 $   ENDIF
1006 $   IF ((F$LOCATE("#define PERL_SUBVERSION",line).NE.F$LENGTH(line)).AND.(.NOT.got_sub))
1007 $   THEN
1008 $     line = F$EDIT(line,"COMPRESS, TRIM")
1009 $     subversion = F$ELEMENT(2," ",line)
1010 $     got_sub = "true"
1011 $   ENDIF
1012 $   IF (.NOT.got_patch).OR.(.NOT.got_sub) THEN GOTO Patchlevel_h_loop
1013 $Close_patch:
1014 $   CLOSE CONFIG
1015 $   ELSE
1016 $     patchlevel="0"
1017 $     subversion="0"
1018 $ ENDIF
1019 $ echo "(You have ''package' ''baserev' PL''patchlevel' sub''subversion'.)"
1020 $! This whole thing needs replacing w/ F$FAO() calls:
1021 $ patchlevel = F$INTEGER(patchlevel)
1022 $ IF patchlevel.LT.10
1023 $ THEN patchlevel = "00" + F$STRING(patchlevel)
1024 $ ELSE patchlevel = "0" + F$STRING(patchlevel)
1025 $ ENDIF
1026 $ subversion = F$INTEGER(subversion)
1027 $ IF subversion.GT.0
1028 $ THEN
1029 $   IF subversion.LT.10
1030 $   THEN subversion = "0" + F$STRING(subversion)
1031 $   ELSE subversion = F$STRING(subversion)
1032 $   ENDIF
1033 $ ELSE subversion = ""
1034 $ ENDIF
1035 $!
1036 $ version = baserev + "_" + patchlevel + "_" + subversion
1037 $!
1038 $ IF (.NOT.vms_skip_install)
1039 $ THEN
1040 $!: set the prefixup variable, to restore leading tilda escape !sfn
1041 $!: set the prefixup variable, to restore leading tilde escape !sfn
1042 $!
1043 $!: determine where public architecture dependent libraries go
1044 $   IF (.NOT.silent) 
1045 $   THEN 
1046 $     echo ""
1047 $     echo "''package' contains architecture-dependent library files.  If you are"
1048 $   ENDIF
1049 $   IF (.NOT.silent) 
1050 $   THEN TYPE SYS$INPUT:
1051 sharing libraries in a heterogeneous environment, you might store
1052 these files in a separate location.  Otherwise, you can just include
1053 them with the rest of the public library files.
1054 $   ENDIF
1055 $   dflt = privlib - "]" + "." + archname + "." + version + "]"
1056 $   rp = "Where do you want to put the public architecture-dependent libraries? "
1057 $   rp = F$FAO("!AS!/!AS",rp,"[ ''dflt' ] ")
1058 $   GOSUB myread
1059 $   IF ans.NES.""
1060 $   THEN archlib = ans
1061 $   ELSE archlib = dflt
1062 $   ENDIF
1063 $!
1064 $!: set up the script used to warn in case of inconsistency !sfn
1065 $!: function used to set $1 to $val                         !sfn
1066 $!
1067 $ ENDIF !%Config-I-VMS, skip "where install" questions
1068 $! This quotation from Configure has to be included on VMS:
1069 $ TYPE SYS$INPUT:
1070
1071 There is, however, a strange, musty smell in the air that reminds me of
1072 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
1073 $ CONTINUE
1074 $ IF (.NOT.vms_skip_install)
1075 $ THEN
1076 $!: it so happens the Eunice I know will not run shell scripts in Unix format
1077 $!
1078 $!: see if setuid scripts can be secure           !sfn
1079 $!: now see if they want to do setuid emulation   !sfn
1080 $!
1081 $!: determine where site specific libraries go.
1082 $   IF .NOT.silent 
1083 $   THEN TYPE SYS$INPUT:
1084
1085 The installation process will also create a directory for
1086 site-specific extensions and modules.  Some users find it convenient
1087 to place all local files in this directory rather than in the main
1088 distribution directory.
1089 $   ENDIF
1090 $   dflt = privlib - "]" + ".SITE_PERL]"
1091 $   rp = "Pathname for the site-specific library files? "
1092 $   rp = F$FAO("!AS!/!AS",rp,"[ ''dflt' ] ")
1093 $   GOSUB myread
1094 $   IF ans.NES.""
1095 $   THEN sitelib = ans
1096 $   ELSE sitelib = dflt
1097 $   ENDIF
1098 $!
1099 $!: determine where site specific architecture-dependent libraries go.
1100 $   IF .NOT.silent 
1101 $   THEN TYPE SYS$INPUT:
1102
1103 The installation process will also create a directory for
1104 architecture-dependent site-specific extensions and modules.
1105 $   ENDIF
1106 $   dflt = sitelib - "]" + "." + archname + "]"
1107 $   rp = "Pathname for the site-specific architecture-dependent library files? "
1108 $   rp = F$FAO("!AS!/!AS",rp,"[ ''dflt' ] ")
1109 $   GOSUB myread
1110 $   IF ans.NES.""
1111 $   THEN sitearch = ans
1112 $   ELSE sitearch = dflt
1113 $   ENDIF
1114 $!
1115 $!: determine where old public architecture dependent libraries might be
1116 $!
1117 $!: determine where public executables go
1118 $   dflt = prefix - ".]" + ".BIN]"
1119 $   rp = "Pathname where the public executables will reside? "
1120 $   rp = F$FAO("!AS!/!AS",rp,"[ ''dflt' ] ")
1121 $   GOSUB myread
1122 $   IF ans.NES.""
1123 $   THEN bin = ans
1124 $   ELSE bin = dflt
1125 $   ENDIF
1126 $!
1127 $!: determine where manual pages are on this system
1128 $!: What suffix to use on installed man pages
1129 $!: see if we can have long filenames
1130 $!: determine where library module manual pages go
1131 $!: What suffix to use on installed man pages
1132 $!: see what memory models we can support
1133 $!
1134 $ ENDIF !%Config-I-VMS, skip "where install" questions
1135 $!
1136 $!: see if we need a special compiler
1137 $! cc_list = "cc/vaxc|cc/decc|gcc" !%Config-I-VMS, compiler symbols/commands
1138 $!
1139 $ nocc = "f"
1140 $ vms_cc_dflt = ""
1141 $ vms_cc_available = ""
1142 $!
1143 $ OPEN/WRITE CONFIG ccvms.c
1144 $ WRITE CONFIG "#include <stdlib.h>"  !DECC is sooo picky
1145 $ WRITE CONFIG "#include <stdio.h>"
1146 $ WRITE CONFIG "int main() {"
1147 $ WRITE CONFIG "#ifdef __DECC"
1148 $ WRITE CONFIG "        printf(""/DECC\n"");"
1149 $ WRITE CONFIG "#else"
1150 $ WRITE CONFIG "        printf(""/VAXC\n"");"
1151 $ WRITE CONFIG "#endif"
1152 $ WRITE CONFIG "        exit(0);"
1153 $ WRITE CONFIG "}"
1154 $ CLOSE CONFIG
1155 $!
1156 $! DEFINE SYS$ERROR _NLA0:
1157 $! DEFINE SYS$OUTPUT _NLA0:
1158 $ cc/NoObj/list=ccvms.lis ccvms.c
1159 $ tmp = $status
1160 $! DEASSIGN SYS$OUTPUT
1161 $! DEASSIGN SYS$ERROR
1162 $ IF (silent) THEN GOSUB Shut_up
1163 $! echo "%Config-I-VMS, After cc compile $status = >''tmp'<" !diagnostic
1164 $!
1165 $ IF tmp.NE.%X10B90001
1166 $ THEN 
1167 $  IF tmp.NE.%X10000001
1168 $  THEN 
1169 $    nocc = "t"  !%X10000001 is return from gcc
1170 $    GOTO Gcc_initial_check
1171 $  ENDIF
1172 $ ENDIF
1173 $!
1174 $ GOSUB List_Parse
1175 $ IF .NOT.silent THEN echo ""
1176 $ echo "%Config-I-VMS, Default ""cc"" is ''line' ''archsufx' ''F$GETSYI("VERSION")'" 
1177 $ IF F$LOCATE("VAX",line).NE.F$LENGTH(line) 
1178 $ THEN 
1179 $   vms_cc_dflt = "/vaxc"
1180 $   vms_cc_available = vms_cc_available + "cc/vaxc "
1181 $   IF .NOT.silent
1182 $   THEN 
1183 $     echo "%Config-I-VMS, Will try cc/decc..."
1184 $   ENDIF
1185 $   DEFINE SYS$ERROR _NLA0:
1186 $   DEFINE SYS$OUTPUT _NLA0:
1187 $   SET NOON
1188 $   cc/decc/NoObj/list=ccvms.lis ccvms.c
1189 $   tmp = $status
1190 $   DEASSIGN SYS$OUTPUT
1191 $   DEASSIGN SYS$ERROR
1192 $   SET ON
1193 $   IF (silent) THEN GOSUB Shut_up
1194 $   IF tmp.NE.%X10B90001
1195 $   THEN
1196 $     echo "%Config-I-VMS, Apparently you don't have that one."
1197 $   ELSE
1198 $     GOSUB List_parse
1199 $     echo "%Config-I-VMS, You also have: ''line' ''archsufx' ''F$GETSYI("VERSION")'"
1200 $     vms_cc_available = vms_cc_available + "cc/decc "
1201 $   ENDIF
1202 $ ELSE
1203 $   IF (F$LOCATE("DEC",line).NE.F$LENGTH(line)).or.(F$LOCATE("Compaq",line).NE.F$LENGTH(line))
1204 $   THEN 
1205 $     vms_cc_dflt = "/decc"
1206 $     vms_cc_available = vms_cc_available + "cc/decc "
1207 $     echo "%Config-I-VMS, Will try cc/vaxc..."
1208 $     DEFINE SYS$ERROR _NLA0:
1209 $     DEFINE SYS$OUTPUT _NLA0:
1210 $     SET NOON
1211 $     cc/vaxc/NoObj/list=ccvms.lis ccvms.c
1212 $     tmp = $status
1213 $     DEASSIGN SYS$OUTPUT
1214 $     DEASSIGN SYS$ERROR
1215 $     SET ON
1216 $     IF (silent) THEN GOSUB Shut_up
1217 $     IF tmp.NE.%X10B90001
1218 $     THEN
1219 $       echo "%Config-I-VMS, Apparently you don't have that one."
1220 $     ELSE
1221 $       GOSUB List_parse
1222 $       echo "%Config-I-VMS, You also have: ''line' ''archsufx' ''F$GETSYI("VERSION")'"
1223 $       vms_cc_available = vms_cc_available + "cc/vaxc "
1224 $     ENDIF
1225 $   ENDIF
1226 $ ENDIF
1227 $!
1228 $Gcc_initial_check:
1229 $ echo "%Config-I-VMS, Checking for Gcc"
1230 $ OPEN/WRITE CONFIG gccvers.lis
1231 $ DEFINE SYS$ERROR CONFIG
1232 $ DEFINE SYS$OUTPUT CONFIG
1233 $ 'gcc_symbol'/noobj/version _nla0:
1234 $ tmp = $status
1235 $ DEASSIGN SYS$OUTPUT
1236 $ DEASSIGN SYS$ERROR
1237 $ IF (silent) THEN GOSUB Shut_up
1238 $ CLOSE CONFIG
1239 $ IF (tmp.NE.%X10000001).and.(tmp.ne.%X00030001)
1240 $ THEN
1241 $   echo "%Config-I-VMS, Symbol ""''gcc_symbol'"" is not defined. I guess you don't have it."
1242 $   goto cc_cleanup
1243 $ ENDIF
1244 $ OPEN/READ CONFIG gccvers.lis
1245 $GCC_List_Read:
1246 $ READ/END_OF_FILE=GCC_List_End CONFIG line
1247 $ GOTO GCC_List_Read
1248 $GCC_List_End:
1249 $ CLOSE CONFIG
1250 $ echo line
1251 $ vms_cc_available = vms_cc_available + "''gcc_symbol' "
1252 $ DELETE/NOLOG/NOCONFIRM gccvers.lis;
1253 $!
1254 $CC_Cleanup:
1255 $ DELETE/NOLOG/NOCONFIRM ccvms.*;
1256 $CC_Desired:
1257 $!: see if we need a special compiler
1258 $! echo ""
1259 $ echo "%Config-I-VMS, available compiler(s):"
1260 $ echo "( ''vms_cc_available')"
1261 $ IF .NOT.nocc 
1262 $ THEN
1263 $   dflt = "cc''vms_cc_dflt'"  !-> "cc" in case first compile went OK
1264 $ ELSE
1265 $   dflt = gcc_symbol
1266 $ ENDIF
1267 $ rp = "Use which C compiler? [''dflt'] "
1268 $ GOSUB myread
1269 $ IF ans.NES.""
1270 $ THEN
1271 $   ans = F$EDIT(ans,"TRIM, COMPRESS, LOWERCASE")
1272 $   Mcc = ans
1273 $   IF (F$LOCATE("dec",ans).NE.F$LENGTH(ans)).or.(F$LOCATE("compaq",ans).NE.F$LENGTH(ans))
1274 $   THEN
1275 $     Mcc = "cc/decc"
1276 $     Using_Dec_C = "Yes"
1277 $     C_COMPILER_Replace = "CC=cc=''Mcc'"
1278 $   ENDIF
1279 $   IF F$LOCATE("vax",ans).NE.F$LENGTH(ans)
1280 $   THEN
1281 $     Mcc = "cc/vaxc"
1282 $     Using_Vax_C = "Yes"
1283 $     C_COMPILER_Replace = "CC=cc=''Mcc'"
1284 $   ENDIF
1285 $   IF Mcc.NES.dflt
1286 $   THEN
1287 $     IF (F$LOCATE("dec",dflt).NE.F$LENGTH(dflt)).or(F$LOCATE("compaq",dflt).NE.F$LENGTH(dflt))
1288 $     THEN 
1289 $       C_COMPILER_Replace = "CC=cc=''Mcc'"
1290 $     ELSE
1291 $       Using_Dec_C = "Yes"
1292 $       IF F$LOCATE("vax",dflt).NE.F$LENGTH(dflt) 
1293 $       THEN
1294 $         C_COMPILER_Replace = "CC=cc=''Mcc'"
1295 $       ENDIF
1296 $     ENDIF
1297 $   ELSE
1298 $     IF Mcc .EQS. "cc/decc"
1299 $     THEN
1300 $       Using_Dec_C = "Yes"
1301 $       C_COMPILER_Replace = "CC=cc=''Mcc'"
1302 $     ENDIF
1303 $   ENDIF
1304 $ ELSE 
1305 $   Mcc = dflt
1306 $   IF Mcc .EQS. "cc/decc"
1307 $   THEN
1308 $     Using_Dec_C = "Yes"
1309 $     C_COMPILER_Replace = "CC=cc=''Mcc'"
1310 $   ENDIF
1311 $   IF Mcc .EQS. "cc/vaxc"
1312 $   THEN
1313 $     Using_Vax_C = "Yes"
1314 $     C_COMPILER_Replace = "CC=cc=''Mcc'"
1315 $   ENDIF
1316 $   IF Mcc .EQS. "gcc"
1317 $   THEN
1318 $     Using_Gnu_C = "Yes"
1319 $     C_COMPILER_Replace = "CC=cc=''Mcc'"
1320 $   ENDIF
1321 $ ENDIF
1322 $Decc_Version_check:
1323 $ IF "''Using_Dec_C'".EQS."Yes"
1324 $ THEN
1325 $   echo ""
1326 $   echo4 "Checking for Dec C's version number..." !>&4
1327 $   OPEN/WRITE CONFIG deccvers.c
1328 $   WRITE CONFIG "#include <stdlib.h>"  !DECC is sooo picky
1329 $   WRITE CONFIG "#include <stdio.h>"
1330 $   WRITE CONFIG "int main() {"
1331 $   WRITE CONFIG "#ifdef __DECC"
1332 $   WRITE CONFIG "#ifdef __DECC_VER"
1333 $   WRITE CONFIG "        printf(""%i\n"", __DECC_VER);"
1334 $   WRITE CONFIG "#else"
1335 $   WRITE CONFIG "        printf(""%i\n"", ""1"");"
1336 $   WRITE CONFIG "#endif"
1337 $   WRITE CONFIG "#endif"
1338 $   WRITE CONFIG "        exit(0);"
1339 $   WRITE CONFIG "}"
1340 $   CLOSE CONFIG
1341 $   DEFINE SYS$ERROR _NLA0:
1342 $   DEFINE SYS$OUTPUT _NLA0:
1343 $   'Mcc' deccvers.c
1344 $   tmp = $status
1345 $   DEASSIGN SYS$ERROR _NLA0:
1346 $   DEASSIGN SYS$OUTPUT _NLA0:
1347 $   IF (silent) THEN GOSUB Shut_up
1348 $   DEFINE SYS$ERROR _NLA0:
1349 $   DEFINE SYS$OUTPUT _NLA0:
1350 $   link deccvers.obj
1351 $   tmp = $status
1352 $   DEASSIGN SYS$ERROR
1353 $   DEASSIGN SYS$OUTPUT
1354 $   IF (silent) THEN GOSUB Shut_up
1355 $   OPEN/WRITE CONFIG deccvers.out
1356 $   DEFINE SYS$ERROR CONFIG
1357 $   DEFINE SYS$OUTPUT CONFIG
1358 $   mcr []deccvers.exe
1359 $   tmp = $status
1360 $   CLOSE CONFIG
1361 $   DEASSIGN SYS$OUTPUT
1362 $   DEASSIGN SYS$ERROR
1363 $   IF (silent) THEN GOSUB Shut_up
1364 $   OPEN/READ CONFIG deccvers.out
1365 $   READ/END_OF_FILE=Dec_c_cleanup CONFIG line
1366 $Dec_c_cleanup:
1367 $   CLOSE CONFIG
1368 $!   DELETE/NOLOG/NOCONFIRM deccvers.*;
1369 $   echo "You are using Dec C ''line'"
1370 $   Dec_C_Version = line
1371 $   Dec_C_Version = Dec_C_Version + 0
1372 $   if Dec_C_Version.ge.60200000 THEN CC_FLAGS = CC_FLAGS + "/NOANSI_ALIAS"
1373 $ ENDIF
1374 $Vaxc_Invoke_check:
1375 $ IF "''Using_Vax_C'".EQS."Yes"
1376 $ THEN
1377 $   echo ""
1378 $   echo4 "Checking to see how to invoke Vax C..."
1379 $   OPEN/WRITE CONFIG vaxcchk.c
1380 $   WRITE CONFIG "#include <stdio.h>"
1381 $   WRITE CONFIG "int main() {"
1382 $   WRITE CONFIG "        printf(""%i\n"", ""1"");"
1383 $   WRITE CONFIG "        exit(0);"
1384 $   WRITE CONFIG "}"
1385 $   CLOSE CONFIG
1386 $   DEFINE SYS$ERROR _NLA0:
1387 $   DEFINE SYS$OUTPUT _NLA0:
1388 $   SET NOON
1389 $   cc/vaxc/NoObj vaxcchk.c
1390 $   tmp = $status
1391 $   DEASSIGN SYS$OUTPUT
1392 $   DEASSIGN SYS$ERROR
1393 $   SET ON
1394 $   IF (silent) THEN GOSUB Shut_up
1395 $   IF tmp.NE.%X10B90001
1396 $   THEN
1397 $     Mcc = "cc"
1398 $   ELSE
1399 $     Mcc = "cc/vaxc"
1400 $   ENDIF
1401 $Vax_c_cleanup:
1402 $   DELETE/NOLOG/NOCONFIRM vaxcchk.*;
1403 $ ENDIF
1404 $Gcc_check:
1405 $ if "''using_gnu_c'" .eqs. "Yes"
1406 $ THEN
1407 $ vaxcrtl_olb = F$SEARCH("SYS$LIBRARY:VAXCRTL.OLB")
1408 $ vaxcrtl_exe = F$SEARCH("SYS$SHARE:VAXCRTL.EXE")
1409 $ gcclib_olb  = F$SEARCH("GNU_CC:[000000]GCCLIB.OLB")
1410 $ IF gcclib_olb .EQS. "" 
1411 $ THEN 
1412 $! These objects/libs come w/ gcc 2.7.2 for AXP:
1413 $   tmp = F$SEARCH("GNU_CC:[000000]libgcc2.olb")
1414 $   IF tmp .NES. "" then gcclib_olb = tmp
1415 $   tmp = F$SEARCH("GNU_CC:[000000]libgcclib.olb")
1416 $   IF tmp .NES. "" 
1417 $   THEN 
1418 $     IF gcclib_olb .EQS. "" 
1419 $     THEN gcclib_olb = tmp
1420 $     ELSE gcclib_olb = gcclib_olb + "/lib," + tmp
1421 $     ENDIF
1422 $   ENDIF
1423 $   tmp = F$SEARCH("SYS$LIBRARY:VAXCRTL.OLB")
1424 $   IF tmp .NES. "" 
1425 $   THEN 
1426 $     IF gcclib_olb .EQS. "" 
1427 $     THEN gcclib_olb = tmp
1428 $     ELSE gcclib_olb = gcclib_olb + "/lib," + tmp
1429 $     ENDIF
1430 $   ENDIF
1431 $   tmp = F$SEARCH("GNU_CC:[000000]crt0.obj")
1432 $   IF tmp .NES. "" 
1433 $   THEN 
1434 $     IF gcclib_olb .EQS. "" 
1435 $     THEN gcclib_olb = tmp
1436 $     ELSE gcclib_olb = gcclib_olb + "/lib," + tmp
1437 $     ENDIF
1438 $   ENDIF
1439 $   IF gcclib_olb .EQS. vaxcrtl_olb THEN gcclib_olb = "" !goofy order of axplibs
1440 $ ELSE
1441 $   gcclib_olb = gcclib_olb + "/lib"
1442 $ ENDIF
1443 $ IF   gcclib_olb .NES. "" .AND. -
1444      (vaxcrtl_olb .NES. "" .OR. -
1445       vaxcrtl_exe .NES. "" )
1446 $ THEN
1447 $   echo ""
1448 $   echo4 "Checking for GNU cc in disguise and/or its version number..." !>&4
1449 $   OPEN/WRITE CONFIG gccvers.c
1450 $   WRITE CONFIG "#include <stdlib.h>"  !DECC is sooo picky
1451 $   WRITE CONFIG "#include <stdio.h>"
1452 $   WRITE CONFIG "int main() {"
1453 $   WRITE CONFIG "#ifdef __GNUC__"
1454 $   WRITE CONFIG "#ifdef __VERSION__"
1455 $   WRITE CONFIG "        printf(""%s\n"", __VERSION__);"
1456 $   WRITE CONFIG "#else"
1457 $   WRITE CONFIG "        printf(""%s\n"", ""1"");"
1458 $   WRITE CONFIG "#endif"
1459 $   WRITE CONFIG "#endif"
1460 $   WRITE CONFIG "        exit(0);"
1461 $   WRITE CONFIG "}"
1462 $   CLOSE CONFIG
1463 $   DEFINE SYS$ERROR _NLA0:
1464 $   DEFINE SYS$OUTPUT _NLA0:
1465 $   'Mcc' gccvers.c
1466 $   tmp = $status
1467 $   DEASSIGN SYS$ERROR _NLA0:
1468 $   DEASSIGN SYS$OUTPUT _NLA0:
1469 $   IF (silent) THEN GOSUB Shut_up
1470 $   DEFINE SYS$ERROR _NLA0:
1471 $   DEFINE SYS$OUTPUT _NLA0:
1472 $   IF vaxcrtl_exe .EQS. ""
1473 $   THEN 
1474 $     IF F$LOCATE("VAXCRTL",gcclib_olb).NE.F$LENGTH(gcclib_olb)
1475 $     THEN 
1476 $       link gccvers.obj,'gcclib_olb',SYS$LIBRARY:VAXCRTL/Library
1477 $       tmp = $status
1478 $     ELSE
1479 $       link gccvers.obj,'gcclib_olb'
1480 $       tmp = $status
1481 $     ENDIF
1482 $   ELSE
1483 $     OPEN/WRITE CONFIG GCCVERS.OPT
1484 $     WRITE CONFIG "SYS$SHARE:VAXCRTL/SHARE"
1485 $     CLOSE CONFIG
1486 $     link gccvers.obj,GCCVERS.OPT/OPT,'gcclib_olb'
1487 $     tmp = $status
1488 $   ENDIF
1489 $   DEASSIGN SYS$ERROR
1490 $   DEASSIGN SYS$OUTPUT
1491 $   IF (silent) THEN GOSUB Shut_up
1492 $   OPEN/WRITE CONFIG gccvers.out
1493 $   DEFINE SYS$ERROR CONFIG
1494 $   DEFINE SYS$OUTPUT CONFIG
1495 $   mcr []gccvers.exe
1496 $   tmp = $status
1497 $   CLOSE CONFIG
1498 $   DEASSIGN SYS$OUTPUT
1499 $   DEASSIGN SYS$ERROR
1500 $   IF (silent) THEN GOSUB Shut_up
1501 $   OPEN/READ CONFIG gccvers.out
1502 $   READ/END_OF_FILE=Gcc_cleanup CONFIG line
1503 $Gcc_cleanup:
1504 $   CLOSE CONFIG
1505 $   DELETE/NOLOG/NOCONFIRM gccvers.*;
1506 $   IF F$LOCATE("GNU C version ",line).NE.F$LENGTH(line)
1507 $   THEN 
1508 $     echo "You are not using GNU cc."
1509 $     GOTO Host_name
1510 $   ELSE 
1511 $     echo "You are using GNU cc ''line'"
1512 $     Using_Gnu_C = "Yes"
1513 $     C_COMPILER_Replace = "CC=cc=''Mcc'"
1514 $     GOTO Include_dirs
1515 $   ENDIF
1516 $ ENDIF
1517 $endif
1518 $ GOTO Host_name
1519 $!
1520 $List_Parse:
1521 $ OPEN/READ CONFIG ccvms.lis
1522 $ READ CONFIG line
1523 $ IF (F$GETSYI("HW_MODEL") .LT. 1024)
1524 $ THEN
1525 $   read CONFIG line
1526 $   archsufx = "VAX"
1527 $ ELSE
1528 $   archsufx = "AXP"
1529 $ ENDIF
1530 $ CLOSE CONFIG
1531 $ line = F$EDIT(line,"TRIM,COMPRESS")
1532 $ line = line - "Page 1"           ! occurs at end all compilers
1533 $ line = line - "CCVMS "           ! filename appears w/ VAXC
1534 $ line = line - "Source Listing "  ! Seen w/ AXP DECC
1535 $ tmp = F$EXTRACT(0,20,line)       !timestamp, e.g. "30-JUL-1996 21:12:54 "
1536 $ line = line - tmp
1537 $ line = F$EDIT(line,"TRIM")       !bit redundant but we're in no big hurry
1538 $ DELETE/NOLOG/NOCONFIRM ccvms.lis;
1539 $ RETURN
1540 $!
1541 $Include_dirs:
1542 $!: What should the include directory be ?
1543 $ dflt = gcclib_olb 
1544 $ rp = "Where are the include files you want to use? "
1545 $ IF f$length( rp + "[''dflt'] " ).gt.76
1546 $ THEN rp = F$FAO("!AS!/!AS",rp,"[''dflt'] ")
1547 $ ELSE rp = rp + "[''dflt'] "
1548 $ ENDIF
1549 $ GOSUB myread
1550 $ usrinc = ans
1551 $!
1552 $!: see if we have to deal with yellow pages, now NIS.
1553 $!: now get the host name
1554 $Host_name:
1555 $ echo ""
1556 $ echo4 "Figuring out host name..." !>&4
1557 $ myhostname = ""
1558 $  IF myhostname.eqs."" THEN myhostname = F$TRNLNM("ARPANET_HOST_NAME")
1559 $  IF myhostname.eqs."" THEN myhostname = F$TRNLNM("INTERNET_HOST_NAME")
1560 $  IF myhostname.eqs."" THEN myhostname = F$TRNLNM("MULTINET_HOST_NAME")
1561 $  IF myhostname.eqs."" THEN myhostname = F$TRNLNM("UCX$INET_HOST_NAME")
1562 $  IF myhostname.eqs."".and. -
1563       F$TRNLNM("UCX$INET_HOST") .nes. "" .and. -
1564       F$TRNLNM("UCX$INET_DOMAIN") .nes. "" THEN - 
1565      myhostname = F$TRNLNM("UCX$INET_HOST") + "." + F$TRNLNM("UCX$INET_DOMAIN") 
1566 $  IF myhostname.eqs."" THEN myhostname = F$TRNLNM("TCPWARE_DOMAINNAME")
1567 $  IF myhostname.eqs."" THEN myhostname = F$TRNLNM("NEWS_ADDRESS")
1568 $  IF myhostname.eqs."" THEN myhostname = F$TRNLNM("SYS$NODE") - "::"
1569 $  IF myhostname.eqs."" THEN myhostname = F$EDIT(F$GETSYI("SCSNODE"),"TRIM")
1570 $!: you do not want to know about this
1571 $!: verify guess
1572 $ rp = "Your host name appears to be """"''myhostname'"""". Right? "
1573 $ GOSUB myread
1574 $ IF (.not.ans).and.(ans.NES."")
1575 $   THEN 
1576 $     READ SYS$COMMAND/PROMPT= - 
1577  "Please type the (one word) name of your host: " ans
1578 $     myhostname = ans
1579 $ ENDIF
1580 $!: translate upper to lower if necessary
1581 $ myhostname = F$EDIT(myhostname,"COLLAPSE")
1582 $ mylowhostname = F$EDIT(myhostname," LOWERCASE")
1583 $ IF mylowhostname.NES.myhostname
1584 $ THEN
1585 $   echo "(Normalizing case in your host name)"
1586 $   myhostname = mylowhostname
1587 $ ENDIF
1588 $!
1589 $ fp = F$LOCATE(".",myhostname)
1590 $ mydomain = F$EXTRACT(fp,(F$LENGTH(myhostname)-fp)+1,myhostname)
1591 $ IF mydomain.NES.""  !no periods in DECnet names like "MYDECNODE::"
1592 $ THEN
1593 $   rp = "What is your domain name? [''mydomain'] "
1594 $   GOSUB myread
1595 $   IF ans .nes. "" THEN mydomain = ans
1596 $!: translate upper to lower if necessary
1597 $   mydomain = F$EDIT(mydomain,"COLLAPSE")
1598 $   mylowdomain = F$EDIT(mydomain," LOWERCASE")
1599 $   IF mylowdomain.NES.mydomain
1600 $   THEN
1601 $     echo "(Normalizing case in your domain name)"
1602 $     mydomain = mylowdomain
1603 $   ENDIF
1604 $ ENDIF
1605 $ myhostname = myhostname - mydomain
1606 $ echo "(Trimming domain name from host name--host name is now ''myhostname')"
1607 $ IF .NOT.silent 
1608 $ THEN TYPE SYS$INPUT:
1609
1610 I need to get your e-mail address in Internet format if possible, i.e.
1611 something like user@host.domain. Please answer accurately since I have
1612 no easy means to double check it. The default value provided below
1613 is most probably close to the reality but may not be valid from outside
1614 your organization...
1615 $ ENDIF
1616 $ dflt = "''cf_by'@''myhostname'"+"''mydomain'"
1617 $ rp = "What is your e-mail address? [''dflt'] "
1618 $ GOSUB myread
1619 $ IF ans .nes. ""
1620 $ THEN cf_email = ans
1621 $ ELSE cf_email = dflt
1622 $ ENDIF
1623 $!
1624 $ IF .NOT.silent 
1625 $ THEN TYPE SYS$INPUT:
1626
1627 If you or somebody else will be maintaining perl at your site, please
1628 fill in the correct e-mail address here so that they may be contacted
1629 if necessary. Currently, the "perlbug" program included with perl
1630 will send mail to this address in addition to perlbug@perl.com. You may
1631 enter "none" for no administrator.
1632 $ ENDIF
1633 $ dflt = "''cf_email'"
1634 $ rp = "Perl administrator e-mail address [''dflt'] "
1635 $ GOSUB myread
1636 $ IF ans .nes. ""
1637 $ THEN perladmin = ans
1638 $ ELSE perladmin = dflt
1639 $ ENDIF
1640 $!
1641 $!: determine where public executable scripts go
1642 $!: determine perl absolute location
1643 $!: figure out how to guarantee perl startup
1644 $!
1645 $!: see how we invoke the C preprocessor
1646 $! echo ""
1647 $! echo4 "Now, how can we feed standard input to your C preprocessor..." !>&4
1648 $!: Set private lib path
1649 $!: Now check and see which directories actually exist, avoiding duplicates
1650 $!: determine optimize, if desired, or use for debug flag also
1651 $!: We will not override a previous value, but we might want to
1652 $!: augment a hint file
1653 $!: the following weeds options from ccflags that are of no interest to cpp
1654 $!: flags used in final linking phase
1655 $!: Try to guess additional flags to pick up local libraries.
1656 $!: coherency check
1657 $! echo ""
1658 $! echo4 "Checking your choice of C compiler and flags for coherency..." !>&4
1659 $!: compute shared library extension
1660 $!: Looking for optional libraries
1661 $!: see if nm is to be used to determine whether a symbol is defined or not
1662 $!: get list of predefined functions in a handy place
1663 $!: see if we have sigaction
1664 $!: see whether socketshr exists
1665 $ IF (F$SEARCH(F$PARSE("SocketShr","Sys$Share:.Exe")).NES."")
1666 $ THEN
1667 $   has_socketshr     = "T"
1668 $   echo ""
1669 $   echo4 "Hmm... Looks like you have SOCKETSHR's Berkeley networking support."
1670 $ endif
1671 $ if (Dec_C_Version .ge. 50200000)
1672 $ THEN
1673 $   Has_Dec_C_Sockets = "T"
1674 $   echo ""
1675 $   echo4 "Hmm... Looks like you've got Dec C's Berkeley networking support."
1676 $ ENDIF
1677 $ ! Hey, we've got both. Default to Dec C, then, since it's better
1678 $ if ("''Has_socketshr'".eq."T") .or.("''has_dec_c_sockets'".eq."T")
1679 $ THEN
1680 $   echo ""
1681 $   echo "You've got sockets available. Which socket stack do you want to"
1682 $   echo "build into perl?"
1683 $   if "''has_dec_c_sockets'".eqs."T"
1684 $   THEN
1685 $     dflt = "DECC"
1686 $   else
1687 $     dflt = "SOCKETSHR"
1688 $   endif
1689 $   rp = "Choose socket stack (NONE"
1690 $   if "''has_socketshr'".eqs."T" THEN rp = rp + ",SOCKETSHR"
1691 $   if "''has_dec_c_sockets'".eqs."T" THEN rp = rp + ",DECC"
1692 $   rp = rp + ") [''dflt'] "
1693 $   GOSUB myread
1694 $   IF "''ans'".eqs."" THEN ans = "''dflt'"
1695 $   has_dec_c_sockets = "F"
1696 $   has_socketshr = "F"
1697 $   ans = F$EDIT(ans,"TRIM,COMPRESS,LOWERCASE")
1698 $   IF ans.eqs."decc" then has_dec_c_sockets = "T"
1699 $   IF ans.eqs."socketshr" then has_socketshr = "T"
1700 $ endif
1701 $!
1702 $!
1703 $! Ask if they want to build with VMS_DEBUG perl
1704 $ echo ""
1705 $ echo "Perl can be built to run under the VMS debugger."
1706 $ echo "You should only select this option if you are debugging"
1707 $ echo "perl itself.  This can be a useful feature if you are "
1708 $ echo "embedding perl in a program."
1709 $ dflt = "n"
1710 $ rp = "Build a VMS-DEBUG version of Perl? [''dflt'] "
1711 $ GOSUB myread
1712 $ IF ans.eqs."" then ans = dflt
1713 $ IF F$EXTRACT(0, 1, F$EDIT(ans,"COLLAPSE,UPCASE")) .eqs. "Y"
1714 $ THEN
1715 $   use_vmsdebug_perl = "Y"
1716 $   macros = macros + """__DEBUG__=1"","
1717 $ ELSE
1718 $   use_vmsdebug_perl = "N"
1719 $ ENDIF
1720 $!
1721 $! Ask if they want to build with MULTIPLICITY
1722 $ echo ""
1723 $ echo "The perl interpreter engine can be built in a way that makes it
1724 $ echo "possible for a program that embeds perl into it (and yes, you can
1725 $ echo "do that--it's pretty keen) to have multiple perl interpreters active
1726 $ echo "at once. There is some performance overhead, however, so you
1727 $ echo "probably don't want to choose this unless you're going to be doing
1728 $ echo "funky perl embedding."
1729 $ dflt = "n"
1730 $ rp = "Build with MULTIPLICITY? [''dflt'] "
1731 $ GOSUB myread
1732 $ if ans.eqs."" then ans = dflt
1733 $ IF F$EXTRACT(0, 1, F$EDIT(ans,"COLLAPSE,UPCASE")) .eqs. "Y"
1734 $ THEN
1735 $   use_multiplicity="Y"
1736 $ ELSE
1737 $   use_multiplicity="N"
1738 $ ENDIF
1739 $!
1740 $! Ask if they want to build with 64-bit support
1741 $ if (Archname.eqs."VMS_AXP").and.("''f$extract(1,3, f$getsyi(""version""))'".ges."7.1")
1742 $ THEN
1743 $   echo ""
1744 $   echo "This version of perl has experimental support for building with
1745 $   echo "64 bit integers and 128 bit floating point variables. This gives
1746 $   echo "a much larger range for perl's mathematical operations. (Note that
1747 $   echo "does *not* enable 64-bit fileops at the moment, as Dec C doesn't
1748 $   echo "do that yet)"
1749 $   dflt = use_64bitint
1750 $   rp = "Build with 64 bit integers and 128 bit floating point variable? [''dflt'] "
1751 $   GOSUB myread
1752 $   if ans.eqs."" then ans = dflt
1753 $   if (f$extract(0, 1, "''ans'").eqs."Y").or.(f$extract(0, 1, "''ans'").eqs."y")
1754 $   THEN
1755 $     use_64bitint="Y"
1756 $   ELSE
1757 $     use_64bitint="N"
1758 $   ENDIF
1759 $ ENDIF
1760 $!
1761 $! Ask about threads, if appropriate
1762 $ if (Using_Dec_C.eqs."Yes")
1763 $ THEN
1764 $   echo ""
1765 $   echo "This version of Perl can be built with threads. While really nifty,
1766 $   echo "they are a beta feature, and there is a speed penalty for perl
1767 $   echo "programs if you build with threads *even if you don't use them*
1768 $   dflt = "n"
1769 $   rp = "Build with threads? [''dflt'] "
1770 $   GOSUB myread
1771 $   if ans.eqs."" then ans = dflt
1772 $   if (f$extract(0, 1, "''ans'").eqs."Y").or.(f$extract(0, 1, "''ans'").eqs."y")
1773 $   THEN
1774 $     use_threads="T"
1775 $     ! Are they on VMS 7.1 on an alpha?
1776 $     if (Archname.eqs."VMS_AXP").and.("''f$extract(1,3, f$getsyi(""version""))'".ges."7.1")
1777 $     THEN
1778 $       echo ""
1779 $       echo "Threaded perl can be linked to use multiple kernel threads
1780 $       echo "and system upcalls on VMS 7.1+ on Alpha systems. This feature
1781 $       echo "allows multiple threads to execute simultaneously on an SMP
1782 $       echo "system as well as preventing a single thread from blocking
1783 $       echo "all the threads in a program, even on a single-processor
1784 $       echo "machine. Unfortunately this feature isn't safe on an
1785 $       echo "unpatched 7.1 system. (Several OS patches were required when
1786 $       echo "this procedure was written)
1787 $       dflt = "n"
1788 $       rp = "Enable multiple kernel threads and upcalls? [''dflt'] "
1789 $       gosub myread
1790 $       if ans.eqs."" then ans="''dflt'"
1791 $       if f$extract(0, 1, f$edit(ans,"TRIM,COMPRESS,UPCASE")).eqs."Y"
1792 $       THEN
1793 $         Thread_Live_Dangerously = "MT=MT=1"
1794 $       ENDIF
1795 $     ENDIF
1796 $   ENDIF
1797 $ ENDIF
1798 $!
1799 $! Ask whether they want to use secure logical translation when tainting
1800 $ echo ""
1801 $ echo "As Perl starts up, it checks several logical names, such as"
1802 $ echo "PERL5LIB and PERL_ENV_TABLES, which allow you to modify aspects"
1803 $ echo "of its behavior.  For additional security, you may limit this"
1804 $ echo "process to executive- and kernel-mode translation when tainting"
1805 $ echo "is enabled.  In this case, logical names normally skipped when"
1806 $ echo "tainting is enabled (e.g. PERL5OPTS) are translated as well."
1807 $ echo "If you do not choose to do this, the usual order of access modes"
1808 $ echo "is used for logical name translation."
1809 $ echo ""
1810 $ echo "This restriction does not apply to the %ENV hash or to implicit"
1811 $ echo "logical name translation during parsing of file specifications;"
1812 $ echo "these always use the normal sequence of access modes for logical"
1813 $ echo "name translation."
1814 $ dflt = "n"
1815 $ rp = "Use secure logical name translation? [''dflt'] "
1816 $ GOSUB myread
1817 $ if ans.eqs."" then ans="''dflt'"
1818 $ d_secintgenv = f$extract(0, 1, f$edit(ans,"TRIM,COMPRESS,UPCASE"))
1819 $!
1820 $! Ask whether they want to default filetypes
1821 $ echo ""
1822 $ echo "When you pass the name of a program to Perl on the command line,"
1823 $ echo "it generally doesn't supply any defaults unless the -S command"
1824 $ echo "line switch is specified.  In keeping with the VMS tradition of"
1825 $ echo "default file types, however, you can configure Perl to try default"
1826 $ echo "file types of nothing, .pl, and .com, in that order (e.g. typing"
1827 $ echo """$ perl foo"" would cause Perl to look for foo., then foo.pl, and"
1828 $ echo "finally foo.com)."
1829 $ dflt = "n"
1830 $ rp = "Always use default file types? [''dflt'] "
1831 $ GOSUB myread
1832 $ if ans.eqs."" then ans="''dflt'"
1833 $ d_alwdeftype = f$extract(0, 1, f$edit(ans,"COLLAPSE,UPCASE"))
1834 $!
1835 $! Ask if they want to use perl's memory allocator
1836 $ echo ""
1837 $ echo "Perl has a built-in memory allocator that's tuned for perl's
1838 $ echo "normal memory usage. It's oftentimes better than the standard
1839 $ echo "system memory allocator. It also has the advantage of providing
1840 $ echo "memory allocation statistics, if you choose to enable them.
1841 $ dflt = "n"
1842 $ rp = "Build with perl's memory allocator? [''dflt'] "
1843 $ GOSUB myread
1844 $ if ans.eqs."" then ans="''dflt'"
1845 $ mymalloc = f$extract(0, 1, f$edit(ans,"COLLAPSE,UPCASE"))
1846 $ if mymalloc.eqs."Y"
1847 $ THEN
1848 $   if use_debugging_perl.eqs."Y"
1849 $   THEN
1850 $     echo ""
1851 $     echo "Perl can keep statistics on memory usage if you choose to use
1852 $     echo "them. This is useful for debugging, but does have some
1853 $     echo "performance overhead.
1854 $     dflt = "n"
1855 $     rp = "Do you want the debugging memory allocator? [''dflt'] "
1856 $     gosub myread
1857 $     if ans.eqs."" then ans="''dflt'"
1858 $     use_debugmalloc = f$extract(0, 1, f$edit(ans, "COLLAPSE,UPCASE"))
1859 $   ENDIF
1860 $   ! Check which memory allocator we want
1861 $   echo ""
1862 $   echo "There are currently three different memory allocators: the
1863 $   echo "default (which is a pretty good general-purpose memory manager),
1864 $   echo "the TWO_POT allocator (which is optimized to save memory for
1865 $   echo "larger allocations), and PACK_MALLOC (which is optimized to save
1866 $   echo "memory for smaller allocations). They're all good, but if your
1867 $   echo "usage tends towards larger chunks use TWO_POT, otherwise use
1868 $   echo "PACK_MALLOC."
1869 $   dflt = "DEFAULT"
1870 $   rp = "Memory allocator (DEFAULT, TWO_POT, PACK_MALLOC) [''dflt'] "
1871 $   GOSUB myread
1872 $   if ans.eqs."" then ans = "''dflt'"
1873 $   if ans.eqs."TWO_POT" then use_two_pot_malloc = "Y"
1874 $   if ans.eqs."PACK_MALLOC" then use_pack_malloc = "Y"
1875 $ ENDIF
1876 $!
1877 $! Ask for their default list of extensions to build
1878 $ echo ""
1879 $ echo "It's time to specify which modules you want to build into
1880 $ echo "perl. Most of these are standard and should be chosen, though
1881 $ echo "you might, for example, want to build GDBM_File instead of
1882 $ echo "SDBM_File if you have the GDBM library built on your machine.
1883 $ echo "Whatever you do, make sure the re module is first or things will
1884 $ echo "break badly"
1885 $ echo "
1886 $ echo "Which modules do you want to build into perl?"
1887 $! dflt = "Fcntl Errno File::Glob IO Opcode Byteloader Devel::Peek Devel::DProf Data::Dumper attrs re VMS::Stdio VMS::DCLsym B SDBM_File"
1888 $ dflt = "re Fcntl Errno File::Glob IO Opcode Devel::Peek Devel::DProf Data::Dumper attrs VMS::Stdio VMS::DCLsym B SDBM_File"
1889 $ if Using_Dec_C.eqs."Yes"
1890 $ THEN
1891 $   dflt = dflt + " POSIX"
1892 $   if Use_Threads.eqs."T"
1893 $   THEN
1894 $     dflt = dflt + " Thread"
1895 $   ENDIF
1896 $ ENDIF
1897 $ rp = "[''dflt'] "
1898 $ GOSUB myread
1899 $ if ans.eqs."" then ans = "''dflt'"
1900 $ extensions = "''ans'"
1901 $ perl_known_extensions = "''dflt'"
1902 $!
1903 $! %Config-I-VMS, determine build/make utility here (make gmake mmk mms)
1904 $ echo ""
1905 $ echo "%Config-I-VMS, Checking your ""make"" utilities..."
1906 $! If the 'build' that you use is not here add it and it's test
1907 $! switch to the _END_ of these strings (and increment max_build)
1908 $! (e.g. builders = builders + "/FOOMAKE" 
1909 $!       probers  = probers + " -fooVersionSwitch"
1910 $! ) & please let me know about it.
1911 $ builders = "IMAKE/GNUMAKE/MGMAKE/GMAKE/MAKE/MMS/MMK"
1912 $ probers  = "-f Makefile. -v!-f Makefile. -v!-f Makefile. -v!-f Makefile. -v!-f Makefile. -v!/IDENT!/IDENT"
1913 $ max_build = 7
1914 $!
1915 $ orig_dflt = "MMK"
1916 $ default_set = ""
1917 $ ok_builders = ""
1918 $ OPEN/WRITE/ERROR=Open_error CONFIG Makefile.
1919 $ WRITE CONFIG "dont_make_anything_yet:"
1920 $ WRITE CONFIG F$FAO("!_")
1921 $ CLOSE CONFIG
1922 $ n = 0
1923 $ messages = F$ENVIRONMENT("MESSAGE")
1924 $Build_probe:
1925 $ build = F$ELEMENT(n,"/",builders)
1926 $ probe  = F$ELEMENT(n,"!",probers)
1927 $ echo "Testing whether you have ''build' on your system..."
1928 $ SET NOON
1929 $ ON CONTROL_Y THEN GOTO Reenable_messages_build
1930 $ SET MESSAGE/NOFAC/NOSEV/NOIDENT/NOTEXT
1931 $ 'build' 'probe'
1932 $ IF ($SEVERITY .EQ. 1)
1933 $ THEN 
1934 $   echo "OK."
1935 $   IF (build .EQS. orig_dflt) 
1936 $   THEN 
1937 $     default_set = "TRUE"
1938 $     dflt = build
1939 $   ENDIF
1940 $   ok_builders = ok_builders + " " + build
1941 $   IF (.NOT. default_set) THEN dflt = build
1942 $ ELSE 
1943 $   echo "Nope."
1944 $ ENDIF
1945 $Reenable_messages_build:
1946 $ SET MESSAGE 'messages'
1947 $ SET ON
1948 $ n = n + 1
1949 $ IF (n .LT. max_build) THEN GOTO Build_probe
1950 $!
1951 $ echo ""
1952 $ IF (ok_builders .NES. "") 
1953 $ THEN
1954 $   echo "Here is the list of builders you can apparently use:"
1955 $   echo "(",ok_builders," )"
1956 $   rp = "Which """"make"""" utility do you wish to use [''dflt']? "
1957 $   GOSUB myread
1958 $   ans = F$EDIT(ans,"TRIM, COMPRESS")
1959 $   ans = F$EXTRACT(0,F$LOCATE(" ",ans),ans) !throw out "-f Makefile." here
1960 $   IF (ans .EQS. "") 
1961 $   THEN build = dflt
1962 $   ELSE build = ans
1963 $   ENDIF
1964 $ ELSE
1965 $   TYPE SYS$INPUT:
1966
1967 %Config-E-VMS, ERROR:
1968  Well this looks pretty serious. Perl5 cannot be compiled without a "make"
1969  utility of some sort and after checking my "builders" list I cannot find
1970  the symbol or command you use on your system to compile programs.
1971
1972 $   READ SYS$COMMAND/PROMPT="%Config-I-VMS, Which ""MMS"" do you use? " ans
1973 $   ans = F$EDIT(ans,"TRIM, COMPRESS")
1974 $   ans = F$EXTRACT(0,F$LOCATE(" ",ans),ans) !throw out "-f Makefile." here
1975 $   IF (ans .EQS. "") 
1976 $   THEN build = dflt
1977 $     echo "I don't know where 'make' is, and my life depends on it."
1978 $     echo "Go find a make program or fix your DCL$PATH setting!"
1979 $     echo "ABORTING..."
1980 $     SET DEFAULT 'vms_default_directory_name' !be kind rewind
1981 $     STOP
1982 $     EXIT 2 !$STATUS = "%X00000002" (error)
1983 $   ELSE 
1984 $     build = ans
1985 $   ENDIF
1986 $ ENDIF
1987 $!
1988 $ DELETE/NOLOG Makefile.;
1989 $ GOTO Beyond_open
1990 $Open_error:
1991 $ TYPE SYS$INPUT:
1992
1993  There seems to be trouble. I just tried to create a file in
1994 $ echo4 'F$ENVIRONMENT("DEFAULT")'
1995 $ TYPE SYS$INPUT:
1996  but was unsuccessful. I am stopping now. Please check that directories'
1997  PROTECTION bits. I will leave you in the directory where you started
1998  Configure.com
1999 $ echo4 "ABORTING..."
2000 $ GOTO Clean_up
2001 $ STOP
2002 $ EXIT
2003 $!
2004 $Beyond_open:
2005 $! echo " Very well I will proceed with ""''build'"""
2006 $ make = F$EDIT(build,"UPCASE")
2007 $!
2008 $!: locate the preferred pager for this system
2009 $!pagers = "most|more|less|type/page"
2010 $!rp='What pager is used on your system?'
2011 $!
2012 $! update [.vms]config.vms here
2013 $!
2014 $! update makefile here
2015 $! echo4 "Updating makefile..."
2016 $!
2017 $ IF (make .EQS. "MMS").OR.(make .EQS. "MMK")
2018 $ THEN 
2019 $   makefile    = ""             !wrt MANIFEST dir
2020 $   UUmakefile  = "DESCRIP.MMS"  !wrt CWD dir
2021 $   DEFmakefile = "DESCRIP.MMS"  !wrt DEF dir (?)
2022 $ ELSE
2023 $   makefile    = " -f [.VMS]Makefile." !wrt MANIFEST dir
2024 $   UUmakefile  = "[-.VMS]Makefile."    !wrt CWD dir
2025 $   DEFmakefile = "[-.VMS]Makefile."    !wrt DEF dir (?)
2026 $ ENDIF
2027 $!
2028 $ IF macros.NES."" 
2029 $ THEN 
2030 $   tmp = F$LENGTH(macros)
2031 $   macros = F$EXTRACT(0,(tmp-1),macros) !miss trailing comma
2032 $   macros = "/macro=(" + macros  + ")"
2033 $ ENDIF
2034 $!
2035 $! Invoke the subconfig piece
2036 $!
2037 $ echo ""
2038 $ echo4 "Checking the C run-time library"
2039 $ dflt = F$ENVIRONMENT("DEFAULT")
2040 $ SET DEFAULT [-.vms]
2041 $ @subconfigure
2042 $ SET DEFAULT 'dflt
2043 $!
2044 $!  Warn of dangerous symbols or logical names
2045 $!
2046 $Bad_environment: SUBROUTINE
2047 $   Bad_env = ""
2048 $   IF p2 .eqs. "SYMBOL"
2049 $   THEN
2050 $     IF f$type('p1) .nes. "" THEN  Bad_env := SYMBOL
2051 $   ELSE
2052 $     IF f$trnlnm(p1) .nes. "" THEN Bad_env := LOGICAL
2053 $   ENDIF
2054 $   IF Bad_env .eqs. "SYMBOL" .or. Bad_env .eqs. "LOGICAL"
2055 $   THEN
2056 $     IF f$search("config.msg") .nes. ""
2057 $     THEN
2058 $       OPEN/APPEND CONFIG config.msg
2059 $     ELSE
2060 $       OPEN/WRITE CONFIG config.msg
2061 $     ENDIF
2062 $     IF Bad_env .eqs. "SYMBOL"
2063 $     THEN
2064 $       WRITE CONFIG ""
2065 $       WRITE CONFIG "Symbol name ''p1' found in environment as " + &p1
2066 $       WRITE CONFIG " delete before building ''package' via:"
2067 $       WRITE CONFIG "     $ DELETE/SYMBOL/GLOBAL ''p1'"
2068 $       IF f$locate("""",&p1) .ge. f$length(&p1)
2069 $       THEN
2070 $       WRITE CONFIG " after building, testing, and installing ''package'
2071 $       WRITE CONFIG " restore the symbol with:"
2072 $       WRITE CONFIG "     $ ''p1' == """ + &p1 + """"
2073 $       ENDIF
2074 $     ENDIF
2075 $     IF Bad_env .eqs. "LOGICAL"
2076 $     THEN
2077 $       WRITE CONFIG ""
2078 $       WRITE CONFIG "Logical name ''p1' found in environment as " + f$trnlnm(p1)
2079 $       WRITE CONFIG " deassign before building ''package'"
2080 $     ENDIF
2081 $     CLOSE CONFIG
2082 $     Bad_env = ""
2083 $   ENDIF
2084 $ EXIT
2085 $ ENDSUBROUTINE ! Bad_environment
2086 $ echo ""
2087 $ echo4 "%Config-I-VMS, Checking for dangerous pre-existing global symbols and logical names."
2088 $ CALL Bad_environment "TMP"
2089 $ CALL Bad_environment "LIB"
2090 $ CALL Bad_environment "T"
2091 $ CALL Bad_environment "FOO"
2092 $ CALL Bad_environment "EXT"
2093 $ CALL Bad_environment "TEST" "SYMBOL"
2094 $ IF f$search("config.msg") .eqs. "" THEN echo "OK."
2095 $!
2096 $! %Config-I-VMS, write perl_setup.com here
2097 $!
2098 $ echo ""
2099 $ echo4 "%Config-I-VMS, The perl_setup.com file is now being written..."
2100 $ file_2_find = "[-]perl_setup.com"
2101 $ OPEN/WRITE CONFIG 'file_2_find'
2102 $ WRITE CONFIG "$!"
2103 $ WRITE CONFIG "$! Perl_Setup.com    ''cf_time'"
2104 $ IF cf_email.NES.perladmin
2105 $ THEN
2106 $ WRITE CONFIG "$! perl configured by ''cf_email'"
2107 $ ELSE
2108 $ WRITE CONFIG "$! This perl configured & administered by ''perladmin'"
2109 $ ENDIF
2110 $ WRITE CONFIG "$!"
2111 $ prefix = prefix - "000000."
2112 $ IF F$LOCATE(".]",prefix) .EQ. F$LENGTH(prefix) THEN -
2113     prefix = prefix - "]" + ".]" 
2114 $ WRITE CONFIG "$ define/translation=concealed Perl_Root ''prefix'"
2115 $ write config "$ ext = "".exe"""
2116 $ if sharedperl .eqs. "Y"
2117 $ then
2118 $   write config "$ if f$getsyi(""ARCH_NAME"") .nes. ""VAX"" then ext = "".AXE"""
2119 $ endif
2120 $ IF use_vmsdebug_perl .eqs. "Y"
2121 $ then
2122 $   WRITE CONFIG "$ dbgperl :== $Perl_Root:[000000]dbgPerl'ext'"
2123 $   WRITE CONFIG "$ perl    :== $Perl_Root:[000000]ndbgPerl'ext'"
2124 $   WRITE CONFIG "$ define dbgPerlShr Perl_Root:[000000]dbgPerlShr'ext'"
2125 $ else
2126 $   WRITE CONFIG "$ perl :== $Perl_Root:[000000]Perl'ext'"
2127 $   WRITE CONFIG "$ define PerlShr Perl_Root:[000000]PerlShr'ext'"
2128 $ endif
2129 $ WRITE CONFIG "$ define/nolog pod2text Perl_Root:[lib.pod]pod2text.com"
2130 $ WRITE CONFIG "$ define/nolog pod2html Perl_Root:[lib.pod]pod2html.com"
2131 $ WRITE CONFIG "$ define/nolog pod2man  Perl_Root:[lib.pod]pod2man.com"
2132 $!
2133 $ IF (tzneedset)
2134 $ THEN
2135 $ WRITE CONFIG "$ define SYS$TIMEZONE_DIFFERENTIAL ''tzd'"
2136 $ ELSE    !leave in but commented out (in case setting was from perl :-)
2137 $ WRITE CONFIG "$! define SYS$TIMEZONE_DIFFERENTIAL ''tzd'"
2138 $ ENDIF
2139 $ WRITE CONFIG "$!"
2140 $ WRITE CONFIG "$! Symbols for commonly used scripts:"
2141 $ WRITE CONFIG "$!"
2142 $ WRITE CONFIG "$ Perldoc  == ""'"+"'Perl' Perl_Root:[lib.pod]Perldoc.com -t"""
2143 $ WRITE CONFIG "$ pod2text == ""'"+"'Perl' pod2text"""
2144 $ WRITE CONFIG "$ pod2html == ""'"+"'Perl' pod2html"""
2145 $ WRITE CONFIG "$!pod2man  == ""'"+"'Perl' pod2man"""
2146 $ WRITE CONFIG "$!Perlbug  == ""'"+"'Perl' Perl_Root:[lib]Perlbug.com"""
2147 $ WRITE CONFIG "$!c2ph == ""'"+"'Perl' c2ph"""
2148 $ WRITE CONFIG "$!h2ph == ""'"+"'Perl' h2ph"""
2149 $ WRITE CONFIG "$!h2xs == ""'"+"'Perl' h2xs"""
2150 $ CLOSE CONFIG
2151 $!
2152 $ echo  ""
2153 $ echo  "%Config-I-VMS, The file can be found at:"
2154 $ echo4 "-Config-I-VMS, ''F$SEARCH(file_2_find)'"
2155 $ echo  "-Config-I-VMS, Add that file (or an @ call to it) to your [SY]LOGIN.COM"
2156 $ echo  "-Config-I-VMS, when you are satisfied with a successful compilation,"
2157 $ echo  "-Config-I-VMS, testing, and installation of your perl."
2158 $ echo  ""
2159 $!
2160 $!figure out where we "are" by parsing 'vms_default_directory_name' 
2161 $!
2162 $ set_def_command = ""
2163 $ dflt = F$ENVIRONMENT("DEFAULT") - ".UU]" 
2164 $ tmp = vms_default_directory_name - dflt - "]"
2165 $ i = 0
2166 $ IF tmp .EQS. "" THEN GOTO Beyond_set_def_loop
2167 $Set_def_loop:
2168 $ tmp1 = F$ELEMENT(i,".",tmp)
2169 $ IF tmp1 .EQS. "." THEN GOTO Beyond_set_def_loop
2170 $ IF i .EQ. 0 
2171 $ THEN set_def_command = "set default [-"
2172 $ ELSE set_def_command = set_def_command + "-"
2173 $ ENDIF
2174 $ i = i + 1
2175 $ GOTO Set_def_loop
2176 $Beyond_set_def_loop:
2177 $ IF set_def_command.NES.""
2178 $ THEN
2179 $   set_def_command = set_def_command - "-" + "]"
2180 $   echo4 ""
2181 $   echo4 "In order to build ''package' you must now issue the commands:"
2182 $   echo4 ""
2183 $   echo4 " ''set_def_command'"
2184 $ ELSE
2185 $   echo4 ""
2186 $   echo4 "In order to build ''package' you must now issue the command:"
2187 $   echo4 ""
2188 $ ENDIF
2189 $ echo4 " ''make'''makefile'", macros
2190 $ echo4 ""
2191 $!
2192 $ IF ( F$SEARCH("config.msg").NES."" ) 
2193 $ THEN
2194 $   echo "Hmm.  I also noted the following information while running:"
2195 $   echo ""
2196 $   type config.msg
2197 $   SET PROTECTION=(SYSTEM:RWED,OWNER:RWED) config.msg
2198 $   DELETE/NOLOG/NOCONFIRM config.msg;
2199 $ ENDIF
2200 $!
2201 $Clean_up:
2202 $ IF (silent)
2203 $ THEN
2204 $   DEASSIGN SYS$OUTPUT
2205 $!   DEASSIGN SYS$ERROR
2206 $ ENDIF
2207 $ IF F$GETJPI("","FILCNT").NE.vms_filcnt THEN CLOSE CONFIG
2208 $ IF F$GETJPI("","FILCNT").NE.vms_filcnt 
2209 $ THEN WRITE SYS$ERROR "%Config-W-VMS, WARNING: There is a file still open"
2210 $ ENDIF
2211 $ dflt = F$ENVIRONMENT("DEFAULT")
2212 $ IF F$LOCATE("UU]",dflt).EQS.(F$LENGTH(dflt)-3)
2213 $ THEN
2214 $   IF ( F$SEARCH("[]*.*").NES."" ) THEN DELETE/NOLOG/NOCONFIRM []*.*;*
2215 $   SET DEFAULT [-]
2216 $   SET PROTECTION=(SYSTEM:RWED,OWNER:RWED) UU.DIR
2217 $   DELETE/NOLOG/NOCONFIRM UU.DIR;
2218 $ ENDIF
2219 $ SET DEFAULT 'vms_default_directory_name' !be kind rewind
2220 $ STOP
2221 $ EXIT
2222 $!: End of Configure