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