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