[win32] integrate mainline
[p5sagit/p5-mst-13.2.git] / Policy_sh.SH
1 case $CONFIG 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 #Credits:
23 #   The original design for this Policy.sh file came from Wayne Davison,
24 #   maintainer of trn.
25 #   This version for Perl5.004_61 originally written by
26 #   Andy Dougherty <doughera@lafcol.lafayette.edu>.
27 #   This file may be distributed under the same terms as Perl itself.
28
29 #  Allow Configure command-line overrides; usually these won't be
30 #  needed, but something like -Dprefix=/test/location can be quite
31 #  useful for testing out new versions.
32
33 #Site-specific values:
34
35 case "\$perladmin" in
36 '') perladmin='$perladmin' ;;
37 esac
38
39 # Installation prefix.  Allow a Configure -D override.  You
40 # may wish to reinstall perl under a different prefix, perhaps
41 # in order to test a different configuration.
42 case "\$prefix" in
43 '') prefix='$prefix' ;;
44 esac
45
46 # Installation directives.  Note that each one comes in three flavors.
47 # For example, we have privlib, privlibexp, and installprivlib.
48 # privlib is for private (to perl) library files.
49 # privlibexp is the same, except any '~' the user gave to Configure
50 #     is expanded to the user's home directory.  This is figured
51 #     out automatically by Configure, so you don't have to include it here.
52 # installprivlib is for systems (such as those running AFS) that
53 #     need to distinguish between the place where things
54 #     get installed and where they finally will reside.
55
56 # In each case, if your previous value was the default, leave it commented
57 # out.  That way, if you override prefix, all of these will be
58 # automatically adjusted.
59 #
60 # NOTE:  Be especially careful about architecture-dependent and
61 # version-dependent names, particularly if you reuse this file for
62 # different versions of perl.
63
64 !GROK!THIS!
65
66 if test 0 -eq "$subversion"; then
67     version=`LC_ALL=C; export LC_ALL; \
68     echo $baserev $patchlevel |
69         $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
70 else
71     version=`LC_ALL=C; export LC_ALL; \
72         echo $baserev $patchlevel $subversion | \
73         $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
74 fi
75
76 for var in bin scriptdir privlib archlib \
77         man1dir man3dir sitelib sitearch \
78         installbin installscript installprivlib installarchlib \
79         installman1dir installman3dir installsitelib installsitearch \
80         man1ext man3ext; do
81         
82     case "$var" in
83     bin)        dflt=$prefix/bin ;;
84     # The scriptdir test is more complex, but this is probably usually ok.
85     scriptdir)
86         if $test -d $prefix/script; then
87             dflt=$prefix/script
88         else
89             dflt=$bin
90         fi
91         ;;
92     privlib)
93         case "$prefix" in
94         *perl*) dflt=$prefix/lib ;;
95         *)      dflt=$prefix/lib/$package ;;
96         esac
97         ;;
98     archlib)    dflt="$privlib/$archname/$version" ;;
99     sitelib)    dflt="$privlib/site_perl" ;;
100     sitearch)   dflt="$sitelib/$archname" ;;
101     man1dir)    dflt="$prefix/man/man1" ;;
102     man3dir)
103         case "$prefix" in
104         *perl*) dflt=`echo $man1dir |
105                     sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'` ;;
106         *)      dflt=$privlib/man/man3 ;;
107         esac
108         ;;
109
110     # Can we assume all sed's have greedy matching?
111     man1ext)    dflt=`echo $man1dir | sed -e 's!.*man!!' -e 's!^\.!!'` ;;
112     man3ext)    dflt=`echo $man3dir | sed -e 's!.*man!!' -e 's!^\.!!'` ;;
113
114     # It might be possible to fool these next tests.  Please let
115     # me know if they don't work right for you.
116     installbin)         dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;;
117     installscript)      dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;;
118     installprivlib)     dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
119     installarchlib)     dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;;
120     installsitelib)     dflt=`echo $sitelibexp | sed 's#^/afs/#/afs/.#'`;;
121     installsitearch)    dflt=`echo $sitearchexp | sed 's#^/afs/#/afs/.#'`;;
122     installman1dir)     dflt=`echo $man1direxp | sed 's#^/afs/#/afs/.#'`;;
123     installman3dir)     dflt=`echo $man3direxp | sed 's#^/afs/#/afs/.#'`;;
124     esac
125     
126     eval val="\$$var"
127     if test X"$val" = X"$dflt"; then
128         echo "# $var='$dflt'"
129     else
130         echo "# Preserving custom $var"
131         echo "$var='$val'"
132     fi
133
134 done >> Policy.sh
135
136 $spitshell <<!GROK!THIS! >>Policy.sh
137
138 #  Lastly, you may add additional items here.  For example, to set the
139 #  pager to your local favorite value, uncomment the following line in
140 #  the original Policy_sh.SH file and re-run   sh Policy_sh.SH.
141 #
142 #  pager='$pager'
143 #
144 #  A full Glossary of all the config.sh variables is in the file
145 #  Porting/Glossary.
146
147 !GROK!THIS!