This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
numeric conversion of non-number in change#3378 tramples on
[perl5.git] / Policy_sh.SH
1 case $CONFIGDOTSH in
2 '') . ./config.sh ;;
3 esac
4 echo "Extracting Policy.sh (with variable substitutions)"
5 $spitshell <<!GROK!THIS! >Policy.sh
6 $startsh
7 #
8 #  This file was produced by running the Policy_sh.SH script, which
9 #  gets its values from config.sh, which is generally produced by
10 #  running Configure.  The Policy.sh file gets overwritten each time
11 #  Configure is run.  Any variables you add to Policy.sh will be lost
12 #  unless you copy Policy.sh somewhere else before running Configure.
13 #
14 #  The idea here is to distill in one place the common site-wide
15 #  "policy" answers (such as installation directories) that are
16 #  to be "sticky".  If you keep the file Policy.sh around in
17 #  the same directory as you are building Perl, then Configure will
18 #  (by default) load up the Policy.sh file just before the
19 #  platform-specific hints file.
20 #
21
22 #  Allow Configure command-line overrides; usually these won't be
23 #  needed, but something like -Dprefix=/test/location can be quite
24 #  useful for testing out new versions.
25
26 #Site-specific values:
27
28 case "\$perladmin" in
29 '') perladmin='$perladmin' ;;
30 esac
31
32 # Installation prefixes.  Allow a Configure -D override.  You
33 # may wish to reinstall perl under a different prefix, perhaps
34 # in order to test a different configuration.
35 # For an explanation of the installation directories, see the
36 # INSTALL file section on "Installation Directories".
37 case "\$prefix" in
38 '') prefix='$prefix' ;;
39 esac
40 case "\$siteprefix" in
41 '') siteprefix='$siteprefix' ;;
42 esac
43 case "\$vendorprefix" in
44 '') vendorprefix='$vendorprefix' ;;
45 esac
46
47 # Where installperl puts things.
48 case "\$installprefix" in
49 '') installprefix='$installprefix' ;;
50 esac
51
52 # Installation directives.  Note that each one comes in three flavors.
53 # For example, we have privlib, privlibexp, and installprivlib.
54 # privlib is for private (to perl) library files.
55 # privlibexp is the same, except any '~' the user gave to Configure
56 #     is expanded to the user's home directory.  This is figured
57 #     out automatically by Configure, so you don't have to include it here.
58 # installprivlib is for systems (such as those running AFS) that
59 #     need to distinguish between the place where things
60 #     get installed and where they finally will reside.  As of 5.005_6x,
61 #     this too is handled automatically by Configure based on
62 #     $installprefix, so it isn't included here either.
63 #
64 # Note also that there are three broad hierarchies of installation 
65 # directories, as discussed in the INSTALL file under 
66 # "Installation Directories":
67 #
68 #  =item Directories for the perl distribution
69 #
70 #  =item Directories for site-specific add-on files
71 #
72 #  =item Directories for vendor-supplied add-on files
73 #
74 #  See Porting/Glossary for the definitions of these names, and see the
75 #  INSTALL file for further explanation and some examples.
76
77 # In each case, if your previous value was the default, leave it commented
78 # out.  That way, if you override prefix, all of these will be
79 # automatically adjusted.
80 #
81 # WARNING:  Be especially careful about architecture-dependent and
82 # version-dependent names, particularly if you reuse this file for
83 # different versions of perl.
84
85 !GROK!THIS!
86
87 for var in \
88         bin scriptdir privlib archlib man1dir man3dir html1dir html3dir \
89         sitebin sitescript sitelib sitearch \
90                 siteman1 siteman3 sitehtml1 sitehtml3 \
91         vendorbin vendorscript vendorlib vendorarch \
92                 vendorman1 vendorman3 vendorhtml1 vendorhtml3
93 do
94         
95     case "$var" in
96
97     # Directories for the core perl components
98     bin)        dflt=$prefix/bin ;;
99     # The scriptdir test is more complex, but this is probably usually ok.
100     scriptdir)
101         if $test -d $prefix/script; then
102             dflt=$prefix/script
103         else
104             dflt=$bin
105         fi
106         ;;
107     privlib)
108         case "$prefix" in
109         *perl*) dflt=$prefix/lib/$version ;;
110         *)      dflt=$prefix/lib/$package/$version ;;
111         esac
112         ;;
113     archlib)    dflt="$privlib/$archname" ;;
114
115     man1dir)    dflt="$prefix/man/man1" ;;
116     man3dir)    dflt="$prefix/man/man3" ;;
117     # Can we assume all sed's have greedy matching?
118     man1ext)    dflt=`echo $man1dir | sed -e 's!.*man!!' -e 's!^\.!!'` ;;
119     man3ext)    dflt=`echo $man3dir | sed -e 's!.*man!!' -e 's!^\.!!'` ;;
120
121     # We don't know what to do with these yet.
122     html1dir)   dflt='' ;;
123     htm31dir)   dflt='' ;;
124
125     # Directories for site-specific add-on files
126     sitebin)    dflt=$siteprefix/bin ;;
127     sitescript)
128         if $test -d $siteprefix/script; then
129             dflt=$siteprefix/script
130         else
131             dflt=$sitebin
132         fi
133         ;;
134     sitelib)
135         case "$siteprefix" in
136         *perl*) dflt=$prefix/lib/site_perl/$version ;;
137         *)      dflt=$prefix/lib/$package/site_perl/$version ;;
138         esac
139         ;;
140     sitearch)   dflt="$sitelib/$archname" ;;
141
142     siteman1)   dflt="$siteprefix/man/man1" ;;
143     siteman3)   dflt="$siteprefix/man/man3" ;;
144     # We don't know what to do with these yet.
145     sitehtml1)  dflt='' ;;
146     sitehtm31dir)       dflt='' ;;
147     
148     # Directories for vendor-supplied add-on files
149     # These are all usually empty.
150     vendor*)
151         if test X"$vendorprefix" = X""; then
152             dflt=''
153         else
154             case "$var" in
155             vendorbin)  dflt=$vendorprefix/bin ;;
156             vendorscript)
157                 if $test -d $vendorprefix/script; then
158                     dflt=$vendorprefix/script
159                 else
160                     dflt=$vendorbin
161                 fi
162                 ;;
163             vendorlib)
164                 case "$vendorprefix" in
165                 *perl*) dflt=$prefix/lib/vendor_perl/$version ;;
166                 *)      dflt=$prefix/lib/$package/vendor_perl/$version ;;
167                 esac
168                 ;;
169             vendorarch) dflt="$vendorlib/$archname" ;;
170
171             vendorman1) dflt="$vendorprefix/man/man1" ;;
172             vendorman3) dflt="$vendorprefix/man/man3" ;;
173             # We don't know what to do with these yet.
174             vendorhtml1)        dflt='' ;;
175             vendorhtm3) dflt='' ;;
176
177             esac  # End of vendorprefix != ''
178         fi
179         ;;
180     esac
181     
182     eval val="\$$var"
183     if test X"$val" = X"$dflt"; then
184         echo "# $var='$dflt'"
185     else
186         echo "# Preserving custom $var"
187         echo "$var='$val'"
188     fi
189
190 done >> Policy.sh
191
192 $spitshell <<!GROK!THIS! >>Policy.sh
193
194 #  Lastly, you may add additional items here.  For example, to set the
195 #  pager to your local favorite value, uncomment the following line in
196 #  the original Policy_sh.SH file and re-run   sh Policy_sh.SH.
197 #
198 #  pager='$pager'
199 #
200 #  A full Glossary of all the config.sh variables is in the file
201 #  Porting/Glossary.
202
203 !GROK!THIS!
204
205 #Credits:
206 #   The original design for this Policy.sh file came from Wayne Davison,
207 #   maintainer of trn.
208 #   This version for Perl5.004_61 originally written by
209 #   Andy Dougherty <doughera@lafayette.edu>.
210 #   This file may be distributed under the same terms as Perl itself.