This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
new perldelta
[perl5.git] / Policy_sh.SH
old mode 100644 (file)
new mode 100755 (executable)
index b953046..1c99255
@@ -1,4 +1,6 @@
-case $CONFIGDOTSH in
+#!/bin/sh
+
+case $PERL_CONFIG_SH in
 '') . ./config.sh ;;
 esac
 echo "Extracting Policy.sh (with variable substitutions)"
 '') . ./config.sh ;;
 esac
 echo "Extracting Policy.sh (with variable substitutions)"
@@ -7,18 +9,33 @@ $startsh
 #
 #  This file was produced by running the Policy_sh.SH script, which
 #  gets its values from config.sh, which is generally produced by
 #
 #  This file was produced by running the Policy_sh.SH script, which
 #  gets its values from config.sh, which is generally produced by
-#  running Configure.  The Policy.sh file gets overwritten each time
-#  Configure is run.  Any variables you add to Policy.sh will be lost
-#  unless you copy Policy.sh somewhere else before running Configure.
+#  running Configure.  
 #
 #  The idea here is to distill in one place the common site-wide
 #  "policy" answers (such as installation directories) that are
 #  to be "sticky".  If you keep the file Policy.sh around in
 #  the same directory as you are building Perl, then Configure will
 #  (by default) load up the Policy.sh file just before the
 #
 #  The idea here is to distill in one place the common site-wide
 #  "policy" answers (such as installation directories) that are
 #  to be "sticky".  If you keep the file Policy.sh around in
 #  the same directory as you are building Perl, then Configure will
 #  (by default) load up the Policy.sh file just before the
-#  platform-specific hints file.
+#  platform-specific hints file and rewrite it at the end.
+#
+#   The sequence of events is as follows:
+#   A:  If you are NOT re-using an old config.sh:
+#   1.  At start-up, Configure loads up the defaults from the
+#      os-specific  hints/osname_osvers.sh file and any previous
+#      Policy.sh file.
+#   2.  At the end, Configure runs Policy_sh.SH, which creates
+#      Policy.sh, overwriting a previous Policy.sh if necessary.
+#
+#   B: If you are re-using an old config.sh:
+#   1.  At start-up, Configure loads up the defaults from config.sh, 
+#      ignoring any previous Policy.sh file.
+#   2.  At the end, Configure runs Policy_sh.SH, which creates
+#      Policy.sh, overwriting a previous Policy.sh if necessary.
+#
+#  Thus the Policy.sh file gets overwritten each time
+#  Configure is run.  Any variables you add to Policy.sh will be lost
+#  unless you copy Policy.sh somewhere else before running Configure.
 #
 #
-
 #  Allow Configure command-line overrides; usually these won't be
 #  needed, but something like -Dprefix=/test/location can be quite
 #  useful for testing out new versions.
 #  Allow Configure command-line overrides; usually these won't be
 #  needed, but something like -Dprefix=/test/location can be quite
 #  useful for testing out new versions.
@@ -37,16 +54,37 @@ esac
 case "\$prefix" in
 '') prefix='$prefix' ;;
 esac
 case "\$prefix" in
 '') prefix='$prefix' ;;
 esac
+
+# By default, the next three are the same as \$prefix.  
+# If the user changes \$prefix, and previously \$siteprefix was the
+# same as \$prefix, then change \$siteprefix as well.
+# Use similar logic for \$vendorprefix and \$installprefix.
+
 case "\$siteprefix" in
 case "\$siteprefix" in
-'') siteprefix='$siteprefix' ;;
+'') if test "$siteprefix" = "$prefix"; then
+       siteprefix="\$prefix"
+    else
+       siteprefix='$siteprefix'
+    fi
+    ;;
 esac
 case "\$vendorprefix" in
 esac
 case "\$vendorprefix" in
-'') vendorprefix='$vendorprefix' ;;
+'') if test "$vendorprefix" = "$prefix"; then
+       vendorprefix="\$prefix"
+    else
+       vendorprefix='$vendorprefix'
+    fi
+    ;;
 esac
 
 # Where installperl puts things.
 case "\$installprefix" in
 esac
 
 # Where installperl puts things.
 case "\$installprefix" in
-'') installprefix='$installprefix' ;;
+'') if test "$installprefix" = "$prefix"; then
+       installprefix="\$prefix"
+    else
+       installprefix='$installprefix'
+    fi
+    ;;
 esac
 
 # Installation directives.  Note that each one comes in three flavors.
 esac
 
 # Installation directives.  Note that each one comes in three flavors.
@@ -84,12 +122,22 @@ esac
 
 !GROK!THIS!
 
 
 !GROK!THIS!
 
+# Set the following variables.  Mention them here so metaconfig
+# includes the appropriate code in Configure
+#   $bin $scriptdir $privlib $archlib 
+#      $man1dir $man3dir $html1dir $html3dir 
+#   $sitebin $sitescript $sitelib $sitearch 
+#      $siteman1dir $siteman3dir $sitehtml1dir $sitehtml3dir
+#   $vendorbin $vendorscript $vendorlib $vendorarch
+#      $vendorman1dir $vendorman3dir $vendorhtml1dir $vendorhtml3dir
+
 for var in \
 for var in \
-       bin scriptdir privlib archlib man1dir man3dir html1dir html3dir \
-       sitebin sitescriptdir sitelib sitearch \
+       bin scriptdir privlib archlib man1dir man3dir man1ext man3ext \
+       html1dir html3dir \
+       sitebin sitescript sitelib sitearch \
                siteman1dir siteman3dir sitehtml1dir sitehtml3dir \
        vendorbin vendorscript vendorlib vendorarch \
                siteman1dir siteman3dir sitehtml1dir sitehtml3dir \
        vendorbin vendorscript vendorlib vendorarch \
-               vendorman1 vendorman3 vendorhtml1 vendorhtml3
+               vendorman1dir vendorman3dir vendorhtml1dir vendorhtml3dir
 do
        
     case "$var" in
 do
        
     case "$var" in
@@ -120,12 +168,11 @@ do
 
     # We don't know what to do with these yet.
     html1dir)  dflt='' ;;
 
     # We don't know what to do with these yet.
     html1dir)  dflt='' ;;
-    htm31dir)  dflt='' ;;
+    html3dir)  dflt='' ;;
 
     # Directories for site-specific add-on files
     sitebin)   dflt=$siteprefix/bin ;;
 
     # Directories for site-specific add-on files
     sitebin)   dflt=$siteprefix/bin ;;
-    # The scriptdir test is more complex, but this is probably usually ok.
-    sitescriptdir)
+    sitescript)
        if $test -d $siteprefix/script; then
            dflt=$siteprefix/script
        else
        if $test -d $siteprefix/script; then
            dflt=$siteprefix/script
        else
@@ -140,11 +187,11 @@ do
        ;;
     sitearch)  dflt="$sitelib/$archname" ;;
 
        ;;
     sitearch)  dflt="$sitelib/$archname" ;;
 
-    siteman1dir)       dflt="$siteprefix/man/man1" ;;
-    siteman3dir)       dflt="$siteprefix/man/man3" ;;
+    siteman1dir) dflt="$siteprefix/man/man1" ;;
+    siteman3dir) dflt="$siteprefix/man/man3" ;;
     # We don't know what to do with these yet.
     sitehtml1dir)      dflt='' ;;
     # We don't know what to do with these yet.
     sitehtml1dir)      dflt='' ;;
-    sitehtm31dir)      dflt='' ;;
+    sitehtml3dir)      dflt='' ;;
     
     # Directories for vendor-supplied add-on files
     # These are all usually empty.
     
     # Directories for vendor-supplied add-on files
     # These are all usually empty.
@@ -154,10 +201,7 @@ do
        else
            case "$var" in
            vendorbin)  dflt=$vendorprefix/bin ;;
        else
            case "$var" in
            vendorbin)  dflt=$vendorprefix/bin ;;
-
-           # The scriptdir test is more complex, 
-           # but this is probably usually ok.
-           vendorscriptdir)
+           vendorscript)
                if $test -d $vendorprefix/script; then
                    dflt=$vendorprefix/script
                else
                if $test -d $vendorprefix/script; then
                    dflt=$vendorprefix/script
                else
@@ -176,7 +220,7 @@ do
            vendorman3dir)      dflt="$vendorprefix/man/man3" ;;
            # We don't know what to do with these yet.
            vendorhtml1dir)     dflt='' ;;
            vendorman3dir)      dflt="$vendorprefix/man/man3" ;;
            # We don't know what to do with these yet.
            vendorhtml1dir)     dflt='' ;;
-           vendorhtm31dir)     dflt='' ;;
+           vendorhtml3dir)     dflt='' ;;
 
            esac  # End of vendorprefix != ''
        fi
 
            esac  # End of vendorprefix != ''
        fi