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