+$!: is AFS running? !sfn
+$!: decide how portable to be. Allow command line overrides. !sfn
+$!: set up shell script to do ~ expansion !sfn
+$!: expand filename !sfn
+$!: now set up to get a file name !sfn
+$!
+$ IF F$TYPE(prefix) .EQS. ""
+$ THEN
+$ prefix = F$ENVIRONMENT("DEFAULT") - ".UU]" + "]"
+$ prefix = F$PARSE(prefix,,,,"NO_CONCEAL") - "][" - "000000." - ".000000" - ".;"
+$ prefixbase = prefix - "]"
+$! Add _ROOT to make install PERL_ROOT differ from build directory.
+$ prefix = prefixbase + "_ROOT.]"
+$ ENDIF
+$ ! more redundant scrubbing of values
+$ prefix = prefix - "000000."
+$ IF F$LOCATE(".]",prefix) .EQ. F$LENGTH(prefix) THEN prefix = prefix - "]" + ".]"
+$ src = prefix
+$!: determine root of directory hierarchy where package will be installed.
+$ dflt = prefix
+$ IF .NOT.silent
+$ THEN
+$ echo ""
+$ echo "By default, ''package' will be installed in ''dflt', pod"
+$ echo "pages under ''prefixbase'.LIB.POD], etc..., i.e. with ''dflt' as prefix for"
+$ echo "all installation directories."
+$ echo "On ''osname' the prefix is used to DEFINE the ''vms_prefixup' prior to installation"
+$ echo "as well as during subsequent use of ''package' via ''packageup'_SETUP.COM."
+$ ENDIF
+$ rp = "Installation prefix to use (for ''vms_prefixup')? [ ''dflt' ] "
+$ GOSUB myread
+$ IF ans.NES.""
+$ THEN
+$ prefix = ans
+$ IF F$LOCATE(".]",ans) .EQ. F$LENGTH(ans) THEN prefix = prefix - "]" + ".]"
+$ ELSE
+$ prefix = dflt
+$ ENDIF
+$ perl_root = prefix
+$!
+$! Check here for pre-existing PERL_ROOT.
+$! -> ask if removal desired.
+$! Check here for writability of requested PERL_ROOT if it is not the default (cwd).
+$! -> recommend letting PERL_ROOT be PERL_SRC if requested PERL_ROOT is not writable.
+$!
+$ tmp = perl_root - ".]" + "]"
+$ dflt = f$parse(tmp,,,,)
+$ IF dflt .eqs. ""
+$ THEN
+$ echo4 "''tmp' does not yet exist."
+$! create/directory 'tmp'
+$ ELSE
+$ echo4 "''tmp' already exists."
+$ ENDIF
+$!
+$ vms_skip_install = "true"
+$ bool_dflt = "y"
+$! echo ""
+$ rp = "Skip the remaining """"where install"""" questions? [''bool_dflt'] "
+$ GOSUB myread
+$ IF (.NOT.ans) THEN vms_skip_install = "false"
+$ IF (.NOT.vms_skip_install)
+$ THEN
+$!
+$!: set the prefixit variable, to compute a suitable default value
+$!
+$!: determine where private library files go
+$!: Usual default is /usr/local/lib/perl5. Also allow things like
+$!: /opt/perl/lib, since /opt/perl/lib/perl5 would be redundant.
+$ IF .NOT.silent
+$ THEN
+$ TYPE SYS$INPUT:
+$ DECK
+
+There are some auxiliary files for perl5 that need to be put into a
+private library directory that is accessible by everyone.
+$ EOD
+$ ENDIF
+$ IF F$TYPE(privlib) .NES. ""
+$ THEN dflt = privlib
+$ ELSE dflt = "''vms_prefix':[lib]"
+$ ENDIF
+$ rp = "Pathname where the private library files will reside? "
+$ rp = F$FAO("!AS!/!AS",rp,"[ ''dflt' ] ")
+$ GOSUB myread
+$ privlib = ans
+$!
+$ ENDIF !%Config-I-VMS, skip remaining "where install" questions
+$!
+$ IF F$TYPE(perl_symbol) .EQS. "" THEN perl_symbol := true
+$ IF F$TYPE(perl_verb) .EQS. "" THEN perl_verb = ""
+$ IF perl_symbol
+$ THEN bool_dflt = "y"
+$ ELSE bool_dflt = "n"
+$ ENDIF
+$ IF .NOT.silent
+$ THEN
+$ echo ""
+$ echo "You may choose to write ''packageup'_SETUP.COM to assign a foreign"
+$ echo "symbol to invoke ''package', which is the usual method."
+$ echO "If you do not do so then you would need a DCL command verb at the"
+$ echo "process or the system wide level."
+$ ENDIF
+$ rp = "Invoke perl as a global symbol foreign command? [''bool_dflt'] "
+$ GOSUB myread
+$ IF (.NOT.ans) THEN perl_symbol = "false"
+$!
+$ IF (.NOT.perl_symbol)
+$ THEN
+$ IF perl_verb .EQS. "DCLTABLES"
+$ THEN bool_dflt = "n"
+$ ELSE bool_dflt = "y"
+$ ENDIF
+$ IF .NOT.silent
+$ THEN
+$ echo ""
+$ echo "Since you won't be using a symbol you must choose to put the ''packageup'"
+$ echo "verb in a per-process table or in the system wide DCLTABLES (which"
+$ echo "would require write privilege)."
+$ ENDIF
+$ rp = "Invoke perl as a per process command verb? [ ''bool_dflt' ] "
+$ GOSUB myread
+$ IF (.NOT.ans)
+$ THEN perl_verb = "DCLTABLES"
+$ ELSE perl_verb = "PROCESS"
+$ ENDIF
+$ ENDIF ! (.NOT.perl_symbol)
+$!
+$ IF (.NOT.vms_skip_install)
+$ THEN
+$!: set the prefixup variable, to restore leading tilde escape !sfn
+$!
+$!: determine where public architecture dependent libraries go
+$ IF (.NOT.silent)
+$ THEN
+$ echo ""
+$ echo "''package' contains architecture-dependent library files. If you are"
+$ ENDIF
+$ IF (.NOT.silent)
+$ THEN
+$ TYPE SYS$INPUT:
+$ DECK
+sharing libraries in a heterogeneous environment, you might store
+these files in a separate location. Otherwise, you can just include
+them with the rest of the public library files.
+$ EOD
+$ ENDIF
+$ IF F$TYPE(archlib) .NES. ""
+$ THEN dflt = archlib
+$ ELSE dflt = privlib - "]" + "." + archname + "." + version + "]"
+$ ENDIF
+$ rp = "Where do you want to put the public architecture-dependent libraries? "
+$ rp = F$FAO("!AS!/!AS",rp,"[ ''dflt' ] ")
+$ GOSUB myread
+$ archlib = ans
+$!
+$ ENDIF !%Config-I-VMS, skip "where install" questions
+$ IF (.NOT.vms_skip_install)
+$ THEN
+$!: it so happens the Eunice I know will not run shell scripts in Unix format
+$!
+$!: see if setuid scripts can be secure !sfn
+$!: now see if they want to do setuid emulation !sfn
+$!
+$!: determine where site specific libraries go.
+$ IF .NOT.silent
+$ THEN
+$ TYPE SYS$INPUT:
+$ DECK
+
+The installation process will also create a directory for
+site-specific extensions and modules. Some users find it convenient
+to place all local files in this directory rather than in the main
+distribution directory.
+$ EOD
+$ ENDIF
+$ IF F$TYPE(sitelib) .NES. ""
+$ THEN dflt = sitelib
+$ ELSE dflt = privlib - "]" + ".SITE_PERL]"
+$ ENDIF
+$ rp = "Pathname for the site-specific library files? "
+$ rp = F$FAO("!AS!/!AS",rp,"[ ''dflt' ] ")
+$ GOSUB myread
+$ sitelib = ans
+$!
+$!: determine where site specific architecture-dependent libraries go.
+$ IF .NOT.silent
+$ THEN TYPE SYS$INPUT:
+$ DECK
+
+The installation process will also create a directory for
+architecture-dependent site-specific extensions and modules.
+$ EOD
+$ ENDIF
+$ IF F$TYPE(sitearch) .NES. ""
+$ THEN dflt = sitearch
+$ ELSE dflt = sitelib - "]" + "." + archname + "]"
+$ ENDIF
+$ rp = "Pathname for the site-specific architecture-dependent library files? "
+$ rp = F$FAO("!AS!/!AS",rp,"[ ''dflt' ] ")
+$ GOSUB myread
+$ sitearch = ans
+$!
+$!: determine where old public architecture dependent libraries might be
+$!
+$!: determine where public executables go
+$ IF F$TYPE(bin) .NES. ""
+$ THEN dflt = bin
+$! ELSE dflt = prefix - ".]" + ".BIN]"
+$ ELSE dflt = "/''vms_prefix'"
+$ ENDIF
+$ rp = "Pathname where the public executables will reside? "
+$ rp = F$FAO("!AS!/!AS",rp,"[ ''dflt' ] ")
+$ GOSUB myread
+$ bin = ans
+$!
+$!: determine where add-on public executables go
+$ IF F$TYPE(sitebin) .NES. ""
+$ THEN dflt = sitebin
+$ ELSE dflt = "''vms_prefix':[bin.''archname']"
+$ ENDIF
+$ rp = "Pathname where the add-on public executables should be installed? "
+$ rp = F$FAO("!AS!/!AS",rp,"[ ''dflt' ] ")
+$ GOSUB myread
+$ sitebin = ans
+$!
+$!: determine where manual pages are on this system
+$!: What suffix to use on installed man pages
+$!: see if we can have long filenames
+$!: determine where library module manual pages go
+$!: What suffix to use on installed man pages
+$!: see what memory models we can support
+$!
+$ ELSE ! skipping "where install" questions, we must set some symbols
+$ IF F$TYPE(archlib).EQS."" THEN -
+ archlib="''vms_prefix':[lib.''archname'.''version']"
+$ IF F$TYPE(bin) .EQS. "" THEN -
+ bin="/''vms_prefix'"
+$ IF F$TYPE(privlib) .EQS. "" THEN -
+ privlib ="''vms_prefix':[lib]"
+$ IF F$TYPE(sitearch) .EQS. "" THEN -
+ sitearch="''vms_prefix':[lib.site_perl.''archname']"
+$ IF F$TYPE(sitelib) .EQS. "" THEN -
+ sitelib ="''vms_prefix':[lib.site_perl]"
+$ IF F$TYPE(sitebin) .EQS. "" THEN -
+ sitebin="''vms_prefix':[bin.''archname']"
+$ ENDIF !%Config-I-VMS, skip "where install" questions
+$!
+$! These derived locations can be set whether we've opted to
+$! skip the where install questions or not.
+$!
+$ IF F$TYPE(archlibexp) .EQS. "" THEN -
+ archlibexp="''vms_prefix':[lib.''archname'.''version']"
+$ IF F$TYPE(binexp) .EQS. "" THEN -
+ binexp ="''vms_prefix':[000000]"
+$ IF F$TYPE(builddir) .EQS. "" THEN -
+ builddir ="''vms_prefix':[000000]"
+$ IF F$TYPE(installarchlib) .EQS. "" THEN -
+ installarchlib="''vms_prefix':[lib.''archname'.''version']"
+$ IF F$TYPE(installbin) .EQS. "" THEN -
+ installbin ="''vms_prefix':[000000]"
+$ IF F$TYPE(installscript) .EQS. "" THEN -
+ installscript ="''vms_prefix':[utils]"
+$ IF F$TYPE(installman1dir) .EQS. "" THEN -
+ installman1dir ="''vms_prefix':[man.man1]"
+$ IF F$TYPE(installman3dir) .EQS. "" THEN -
+ installman3dir ="''vms_prefix':[man.man3]"
+$ IF F$TYPE(installprivlib) .EQS. "" THEN -
+ installprivlib ="''vms_prefix':[lib]"
+$ IF F$TYPE(installsitearch) .EQS. "" THEN -
+ installsitearch="''vms_prefix':[lib.site_perl.''archname']"
+$ IF F$TYPE(installsitelib) .EQS. "" THEN -
+ installsitelib ="''vms_prefix':[lib.site_perl]"
+$ IF F$TYPE(oldarchlib) .EQS. "" THEN -
+ oldarchlib="''vms_prefix':[lib.''archname']"
+$ IF F$TYPE(oldarchlibexp) .EQS. "" THEN -
+ oldarchlibexp="''vms_prefix':[lib.''archname']"
+$ IF F$TYPE(privlibexp) .EQS. "" THEN -
+ privlibexp ="''vms_prefix':[lib]"
+$ IF F$TYPE(scriptdir) .EQS. "" THEN -
+ scriptdir ="''vms_prefix':[utils]"
+$ IF F$TYPE(sitearchexp) .EQS. "" THEN -
+ sitearchexp ="''vms_prefix':[lib.site_perl.''archname']"
+$ IF F$TYPE(sitelib_stem) .EQS. "" THEN -
+ sitelib_stem ="''vms_prefix':[lib.site_perl]"
+$ IF F$TYPE(sitelibexp) .EQS. "" THEN -
+ sitelibexp ="''vms_prefix':[lib.site_perl]"
+$!
+$! determine whether to use malloc wrapping
+$ echo ""
+$ bool_dflt = "y"
+$ IF F$TYPE(usemallocwrap) .nes. ""
+$ then
+$ if .NOT. usemallocwrap .or. usemallocwrap .eqs. "undef" then bool_dflt = "n"
+$ endif
+$ rp = "Do you wish to wrap malloc calls to protect against potential overflows? [''bool_dflt'] "
+$ GOSUB myread
+$ IF ans
+$ THEN usemallocwrap = "define"
+$ ELSE usemallocwrap = "undef"
+$ ENDIF
+$!
+$! Ask if they want to use perl's memory allocator
+$ echo ""
+$ echo "Perl has a built-in memory allocator that is tuned for normal"
+$ echo "memory usage. It is oftentimes better than the standard system"
+$ echo "memory allocator. It also has the advantage of providing memory"
+$ echo "allocation statistics, if you choose to enable them."
+$ bool_dflt = "n"
+$ IF F$TYPE(usemymalloc) .nes. ""
+$ then
+$ if usemymalloc .or. usemymalloc .eqs. "define" then bool_dflt = "y"
+$ endif
+$ rp = "Do you wish to attempt to use the malloc that comes with ''package'? [''bool_dflt'] "
+$ GOSUB myread
+$ mymalloc = ans
+$ IF mymalloc
+$ THEN
+$ IF use_debugging_perl
+$ THEN
+$ echo ""
+$ echo "Perl can keep statistics on memory usage if you choose to use"
+$ echo "them. This is useful for debugging, but does have some"
+$ echo "performance overhead."
+$ bool_dflt = "n"
+$ rp = "Do you want the debugging memory allocator? [''bool_dflt'] "
+$ gosub myread
+$ use_debugmalloc = ans
+$ ENDIF
+$ ! Check which memory allocator we want
+$ echo ""
+$ echo "There are currently three different memory allocators: the"
+$ echo "default (which is a pretty good general-purpose memory manager),"
+$ echo "the TWO_POT allocator (which is optimized to save memory for"
+$ echo "larger allocations), and PACK_MALLOC (which is optimized to save"
+$ echo "memory for smaller allocations). They're all good, but if your"
+$ echo "usage tends towards larger chunks use TWO_POT, otherwise use"
+$ echo "PACK_MALLOC."
+$ dflt = "DEFAULT"
+$ rp = "Memory allocator (DEFAULT, TWO_POT, PACK_MALLOC) [''dflt'] "
+$ GOSUB myread
+$ if ans.eqs."TWO_POT" then use_two_pot_malloc = "Y"
+$ if ans.eqs."PACK_MALLOC" then use_pack_malloc = "Y"
+$ ENDIF
+$!
+$ known_extensions = ""
+$ xxx = ""
+$ OPEN/READ CONFIG 'manifestfound'
+$ext_loop:
+$ READ/END_OF_FILE=end_ext/ERROR=end_ext CONFIG line
+$ IF F$EXTRACT(0,4,line) .NES. "ext/" .AND. -
+ F$EXTRACT(0,5,line) .NES. "dist/".AND. -
+ F$EXTRACT(0,5,line) .NES. "cpan/" THEN goto ext_loop
+$ line = F$EDIT(line,"COMPRESS")
+$ line = F$ELEMENT(0," ",line)
+$ IF F$EXTRACT(0,4,line) .EQS. "ext/"
+$ THEN
+$ xxx = F$ELEMENT(1,"/",line)
+$ IF F$SEARCH("[-.ext]''xxx'.DIR;1") .EQS. "" THEN GOTO ext_loop
+$ ENDIF
+$ IF F$EXTRACT(0,5,line) .EQS. "dist/"
+$ THEN
+$ xxx = F$ELEMENT(1,"/",line)
+$ IF F$SEARCH("[-.dist]''xxx'.DIR;1") .EQS. "" THEN GOTO ext_loop
+$ ENDIF
+$ IF F$EXTRACT(0,5,line) .EQS. "cpan/"
+$ THEN
+$ xxx = F$ELEMENT(1,"/",line)
+$ IF F$SEARCH("[-.cpan]''xxx'.DIR;1") .EQS. "" THEN GOTO ext_loop
+$ ENDIF
+$ IF xxx .EQS. "DynaLoader" THEN goto ext_loop ! omit
+$!
+$! (extspec = xxx) =~ tr!-!/!
+$ extspec = ""
+$ idx = 0
+$ extension_dir_name = xxx
+$ replace_dash_with_slash:
+$ before = F$ELEMENT(idx, "-", xxx)
+$ IF before .EQS. "-" THEN goto end_replace_dash_with_slash
+$ IF extspec .NES. ""
+$ THEN
+$ extspec = extspec + "/"
+$ ENDIF
+$ extspec = extspec + before
+$ idx = idx + 1
+$ goto replace_dash_with_slash
+$
+$ end_replace_dash_with_slash:
+$
+$ xxx = known_extensions
+$ gosub may_already_have_extension
+$ IF $STATUS .EQ. 1
+$ THEN
+$ xxx = nonxs_ext
+$ gosub may_already_have_extension
+$ ENDIF
+$ IF $STATUS .EQ. 1
+$ THEN
+$ xxx = nonxs_ext2
+$ gosub may_already_have_extension
+$ ENDIF
+$ IF $STATUS .NE. 1 THEN goto ext_loop
+$ goto found_new_extension
+$!
+$ may_already_have_extension:
+$ idx = F$LOCATE(extspec, xxx)
+$ extlen = F$LENGTH(xxx)
+$ IF idx .EQ. extlen THEN return 1 ! didn't find it
+$! But "Flirble" may just be part of "Acme-Flirble". This is not
+$! bullet-proof because we may only be looking at one chunk of the
+$! existing extension list.
+$ IF idx .GT. 0 .AND. F$EXTRACT(idx - 1, 1, xxx) .NES. " "
+$ THEN
+$ xxx = F$EXTRACT(idx + F$LENGTH(extspec) + 1, extlen, xxx)
+$ GOTO may_already_have_extension
+$ ENDIF
+$! But "Foo" may just be part of "Foo-Bar" so check for equality.
+$ xxx = F$EXTRACT(idx, extlen - idx, xxx)
+$ IF F$ELEMENT(0, " ", xxx) .EQS. extspec
+$ THEN
+$ RETURN 3
+$ ELSE
+$ xxx = F$EXTRACT(F$LENGTH(extspec) + 1, extlen, xxx)
+ GOTO may_already_have_extension
+$ ENDIF
+$!
+$ found_new_extension:
+$ IF F$SEARCH("[-.ext.''extension_dir_name']*.xs") .EQS. "" .AND. F$SEARCH("[-.dist.''extension_dir_name']*.xs") .EQS. "" .AND. F$SEARCH("[-.cpan.''extension_dir_name']*.xs") .EQS. ""
+$ THEN
+$! Bit if a hack to get around the 1K buffer on older systems.
+$ IF F$LENGTH(nonxs_ext) .GT. 950
+$ THEN
+$ nonxs_ext2 = nonxs_ext2 + " ''extspec'"
+$ ELSE
+$ nonxs_ext = nonxs_ext + " ''extspec'"
+$ ENDIF
+$ ELSE
+$ known_extensions = known_extensions + " ''extspec'"
+$ ENDIF