xref: /openbsd/gnu/usr.bin/perl/Policy_sh.SH (revision 3d8817e4)
1case $PERL_CONFIG_SH in
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
10#  running Configure.
11#
12#  The idea here is to distill in one place the common site-wide
13#  "policy" answers (such as installation directories) that are
14#  to be "sticky".  If you keep the file Policy.sh around in
15#  the same directory as you are building Perl, then Configure will
16#  (by default) load up the Policy.sh file just before the
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.
36#
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.
40
41#Site-specific values:
42
43case "\$perladmin" in
44'') perladmin='$perladmin' ;;
45esac
46
47# Installation prefixes.  Allow a Configure -D override.  You
48# may wish to reinstall perl under a different prefix, perhaps
49# in order to test a different configuration.
50# For an explanation of the installation directories, see the
51# INSTALL file section on "Installation Directories".
52case "\$prefix" in
53'') prefix='$prefix' ;;
54esac
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
61case "\$siteprefix" in
62'') if test "$siteprefix" = "$prefix"; then
63	siteprefix="\$prefix"
64    else
65	siteprefix='$siteprefix'
66    fi
67    ;;
68esac
69case "\$vendorprefix" in
70'') if test "$vendorprefix" = "$prefix"; then
71	vendorprefix="\$prefix"
72    else
73	vendorprefix='$vendorprefix'
74    fi
75    ;;
76esac
77
78# Where installperl puts things.
79case "\$installprefix" in
80'') if test "$installprefix" = "$prefix"; then
81	installprefix="\$prefix"
82    else
83	installprefix='$installprefix'
84    fi
85    ;;
86esac
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.
91# privlibexp is the same, except any '~' the user gave to Configure
92#     is expanded to the user's home directory.  This is figured
93#     out automatically by Configure, so you don't have to include it here.
94# installprivlib is for systems (such as those running AFS) that
95#     need to distinguish between the place where things
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#
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#
110#  See Porting/Glossary for the definitions of these names, and see the
111#  INSTALL file for further explanation and some examples.
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.
116#
117# WARNING:  Be especially careful about architecture-dependent and
118# version-dependent names, particularly if you reuse this file for
119# different versions of perl.
120
121!GROK!THIS!
122
123# Set the following variables.  Mention them here so metaconfig
124# includes the appropriate code in Configure
125#   $bin $scriptdir $privlib $archlib
126#	$man1dir $man3dir $html1dir $html3dir
127#   $sitebin $sitescript $sitelib $sitearch
128#	$siteman1dir $siteman3dir $sitehtml1dir $sitehtml3dir
129#   $vendorbin $vendorscript $vendorlib $vendorarch
130#	$vendorman1dir $vendorman3dir $vendorhtml1dir $vendorhtml3dir
131
132for var in \
133	bin scriptdir privlib archlib man1dir man3dir html1dir html3dir \
134	sitebin sitescript sitelib sitearch \
135		siteman1dir siteman3dir sitehtml1dir sitehtml3dir \
136	vendorbin vendorscript vendorlib vendorarch \
137		vendorman1dir vendorman3dir vendorhtml1dir vendorhtml3dir
138do
139
140    case "$var" in
141
142    # Directories for the core perl components
143    bin)	dflt=$prefix/bin ;;
144    # The scriptdir test is more complex, but this is probably usually ok.
145    scriptdir)
146	if $test -d $prefix/script; then
147	    dflt=$prefix/script
148	else
149	    dflt=$bin
150	fi
151	;;
152    privlib)
153	case "$prefix" in
154	*perl*)	dflt=$prefix/lib/$version ;;
155	*)	dflt=$prefix/lib/$package/$version ;;
156	esac
157	;;
158    archlib)	dflt="$privlib/$archname" ;;
159
160    man1dir)	dflt="$prefix/man/man1" ;;
161    man3dir)	dflt="$prefix/man/man3" ;;
162    # Can we assume all sed's have greedy matching?
163    man1ext)	dflt=`echo $man1dir | sed -e 's!.*man!!' -e 's!^\.!!'` ;;
164    man3ext)	dflt=`echo $man3dir | sed -e 's!.*man!!' -e 's!^\.!!'` ;;
165
166    # We don't know what to do with these yet.
167    html1dir)	dflt='' ;;
168    htm31dir)	dflt='' ;;
169
170    # Directories for site-specific add-on files
171    sitebin)	dflt=$siteprefix/bin ;;
172    sitescript)
173	if $test -d $siteprefix/script; then
174	    dflt=$siteprefix/script
175	else
176	    dflt=$sitebin
177	fi
178	;;
179    sitelib)
180	case "$siteprefix" in
181	*perl*)	dflt=$prefix/lib/site_perl/$version ;;
182	*)	dflt=$prefix/lib/$package/site_perl/$version ;;
183	esac
184	;;
185    sitearch)	dflt="$sitelib/$archname" ;;
186
187    siteman1)	dflt="$siteprefix/man/man1" ;;
188    siteman3)	dflt="$siteprefix/man/man3" ;;
189    # We don't know what to do with these yet.
190    sitehtml1)	dflt='' ;;
191    sitehtm31dir)	dflt='' ;;
192
193    # Directories for vendor-supplied add-on files
194    # These are all usually empty.
195    vendor*)
196	if test X"$vendorprefix" = X""; then
197	    dflt=''
198	else
199	    case "$var" in
200	    vendorbin)	dflt=$vendorprefix/bin ;;
201	    vendorscript)
202		if $test -d $vendorprefix/script; then
203		    dflt=$vendorprefix/script
204		else
205		    dflt=$vendorbin
206		fi
207		;;
208	    vendorlib)
209		case "$vendorprefix" in
210		*perl*)	dflt=$prefix/lib/vendor_perl/$version ;;
211		*)	dflt=$prefix/lib/$package/vendor_perl/$version ;;
212		esac
213		;;
214	    vendorarch)	dflt="$vendorlib/$archname" ;;
215
216	    vendorman1)	dflt="$vendorprefix/man/man1" ;;
217	    vendorman3)	dflt="$vendorprefix/man/man3" ;;
218	    # We don't know what to do with these yet.
219	    vendorhtml1)	dflt='' ;;
220	    vendorhtm3)	dflt='' ;;
221
222	    esac  # End of vendorprefix != ''
223	fi
224	;;
225    esac
226
227    eval val="\$$var"
228    if test X"$val" = X"$dflt"; then
229	echo "# $var='$dflt'"
230    else
231	echo "# Preserving custom $var"
232	echo "$var='$val'"
233    fi
234
235done >> Policy.sh
236
237$spitshell <<!GROK!THIS! >>Policy.sh
238
239#  Lastly, you may add additional items here.  For example, to set the
240#  pager to your local favorite value, uncomment the following line in
241#  the original Policy_sh.SH file and re-run   sh Policy_sh.SH.
242#
243#  pager='$pager'
244#
245#  A full Glossary of all the config.sh variables is in the file
246#  Porting/Glossary.
247
248!GROK!THIS!
249
250#Credits:
251#   The original design for this Policy.sh file came from Wayne Davison,
252#   maintainer of trn.
253#   This version for Perl5.004_61 originally written by
254#   Andy Dougherty <doughera@lafayette.edu>.
255#   This file may be distributed under the same terms as Perl itself.
256