This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Policy patch from Andy for installation directories,
[perl5.git] / Policy_sh.SH
CommitLineData
2000072c 1case $CONFIGDOTSH 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
693762b4
AD
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.
85364e4e
MB
13#
14# The idea here is to distill in one place the common site-wide
15# "policy" answers (such as installation directories) that are
dc45a647 16# to be "sticky". If you keep the file Policy.sh around in
85364e4e
MB
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.
dc45a647 20#
85364e4e 21
dc45a647
MB
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.
85364e4e 25
dc45a647 26#Site-specific values:
85364e4e 27
dc45a647
MB
28case "\$perladmin" in
29'') perladmin='$perladmin' ;;
30esac
31
5f578af9 32# Installation prefixes. Allow a Configure -D override. You
dc45a647
MB
33# may wish to reinstall perl under a different prefix, perhaps
34# in order to test a different configuration.
9e80d8f4
JH
35# For an explanation of the installation directories, see the
36# INSTALL file section on "Installation Directories".
dc45a647
MB
37case "\$prefix" in
38'') prefix='$prefix' ;;
39esac
5f578af9
AD
40case "\$siteprefix" in
41'') siteprefix='$siteprefix' ;;
42esac
43case "\$vendorprefix" in
44'') vendorprefix='$vendorprefix' ;;
45esac
46
47# Where installperl puts things.
48case "\$installprefix" in
49'') installprefix='$installprefix' ;;
50esac
85364e4e
MB
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.
c4f23d77 55# privlibexp is the same, except any '~' the user gave to Configure
85364e4e 56# is expanded to the user's home directory. This is figured
dc45a647 57# out automatically by Configure, so you don't have to include it here.
85364e4e
MB
58# installprivlib is for systems (such as those running AFS) that
59# need to distinguish between the place where things
5f578af9
AD
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#
9e80d8f4
JH
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#
5f578af9 74# See Porting/Glossary for the definitions of these names, and see the
9e80d8f4 75# INSTALL file for further explanation and some examples.
dc45a647
MB
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.
693762b4 80#
3a6175e1 81# WARNING: Be especially careful about architecture-dependent and
dc45a647
MB
82# version-dependent names, particularly if you reuse this file for
83# different versions of perl.
693762b4
AD
84
85!GROK!THIS!
86
5f578af9
AD
87for var in \
88 bin scriptdir privlib archlib man1dir man3dir html1dir html3dir \
89 sitebin sitescriptdir sitelib sitearch \
90 siteman1dir siteman3dir sitehtml1dir sitehtml3dir \
91 vendorbin vendorscript vendorlib vendorarch \
92 vendorman1 vendorman3 vendorhtml1 vendorhtml3
93do
dc45a647
MB
94
95 case "$var" in
5f578af9
AD
96
97 # Directories for the core perl components
dc45a647
MB
98 bin) dflt=$prefix/bin ;;
99 # The scriptdir test is more complex, but this is probably usually ok.
c4f23d77
AD
100 scriptdir)
101 if $test -d $prefix/script; then
102 dflt=$prefix/script
103 else
104 dflt=$bin
105 fi
106 ;;
dc45a647
MB
107 privlib)
108 case "$prefix" in
3a6175e1
AD
109 *perl*) dflt=$prefix/lib/$version ;;
110 *) dflt=$prefix/lib/$package/$version ;;
bfb7748a
AD
111 esac
112 ;;
5f578af9
AD
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
9e80d8f4 125 # Directories for site-specific add-on files
5f578af9
AD
126 sitebin) dflt=$siteprefix/bin ;;
127 # The scriptdir test is more complex, but this is probably usually ok.
128 sitescriptdir)
129 if $test -d $siteprefix/script; then
130 dflt=$siteprefix/script
131 else
132 dflt=$sitebin
133 fi
bfb7748a
AD
134 ;;
135 sitelib)
5f578af9 136 case "$siteprefix" in
ba04bae9
JH
137 *perl*) dflt=$prefix/lib/site_perl/$version ;;
138 *) dflt=$prefix/lib/$package/site_perl/$version ;;
dc45a647
MB
139 esac
140 ;;
ba04bae9 141 sitearch) dflt="$sitelib/$archname" ;;
dc45a647 142
5f578af9
AD
143 siteman1dir) dflt="$siteprefix/man/man1" ;;
144 siteman3dir) dflt="$siteprefix/man/man3" ;;
145 # We don't know what to do with these yet.
146 sitehtml1dir) dflt='' ;;
147 sitehtm31dir) dflt='' ;;
148
9e80d8f4
JH
149 # Directories for vendor-supplied add-on files
150 # These are all usually empty.
5f578af9
AD
151 vendor*)
152 if test X"$vendorprefix" = X""; then
153 dflt=''
154 else
155 case "$var" in
156 vendorbin) dflt=$vendorprefix/bin ;;
157
158 # The scriptdir test is more complex,
159 # but this is probably usually ok.
160 vendorscriptdir)
161 if $test -d $vendorprefix/script; then
162 dflt=$vendorprefix/script
163 else
164 dflt=$vendorbin
165 fi
166 ;;
167 vendorlib)
168 case "$vendorprefix" in
ba04bae9
JH
169 *perl*) dflt=$prefix/lib/vendor_perl/$version ;;
170 *) dflt=$prefix/lib/$package/vendor_perl/$version ;;
5f578af9
AD
171 esac
172 ;;
ba04bae9 173 vendorarch) dflt="$vendorlib/$archname" ;;
dc45a647 174
5f578af9
AD
175 vendorman1dir) dflt="$vendorprefix/man/man1" ;;
176 vendorman3dir) dflt="$vendorprefix/man/man3" ;;
177 # We don't know what to do with these yet.
178 vendorhtml1dir) dflt='' ;;
179 vendorhtm31dir) dflt='' ;;
180
181 esac # End of vendorprefix != ''
182 fi
183 ;;
dc45a647
MB
184 esac
185
186 eval val="\$$var"
187 if test X"$val" = X"$dflt"; then
188 echo "# $var='$dflt'"
189 else
190 echo "# Preserving custom $var"
dc45a647
MB
191 echo "$var='$val'"
192 fi
193
194done >> Policy.sh
693762b4
AD
195
196$spitshell <<!GROK!THIS! >>Policy.sh
197
dc45a647 198# Lastly, you may add additional items here. For example, to set the
693762b4
AD
199# pager to your local favorite value, uncomment the following line in
200# the original Policy_sh.SH file and re-run sh Policy_sh.SH.
dc45a647
MB
201#
202# pager='$pager'
693762b4
AD
203#
204# A full Glossary of all the config.sh variables is in the file
205# Porting/Glossary.
85364e4e
MB
206
207!GROK!THIS!
3a6175e1
AD
208
209#Credits:
210# The original design for this Policy.sh file came from Wayne Davison,
211# maintainer of trn.
212# This version for Perl5.004_61 originally written by
9e80d8f4 213# Andy Dougherty <doughera@lafayette.edu>.
3a6175e1 214# This file may be distributed under the same terms as Perl itself.