Add Configure option -Dmksymlinks which will create a symlink
Jarkko Hietaniemi [Thu, 21 Dec 2000 15:37:57 +0000 (15:37 +0000)]
forest if the current/build differs from the source directory.
TODO: mkdir -p is not portable.

p4raw-id: //depot/perl@8218

Configure

index b655e62..4897703 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -20,7 +20,7 @@
 
 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
 #
-# Generated on Tue Dec 19 20:00:06 EET 2000 [metaconfig 3.0 PL70]
+# Generated on Thu Dec 21 17:16:36 EET 2000 [metaconfig 3.0 PL70]
 # (with additional metaconfig patches by perlbug@perl.org)
 
 cat >c1$$ <<EOF
@@ -909,6 +909,7 @@ stdchar=''
 d_stdio_stream_array=''
 stdio_stream_array=''
 sysman=''
+testsyml=''
 trnl=''
 uidformat=''
 uidsign=''
@@ -2168,6 +2169,86 @@ else
 fi
 $rm -f blurfl sym
 
+: determine whether symbolic links are supported
+echo " "
+case "$lns" in
+*"ln -s")
+       echo "Checking how to test for symbolic links..." >&4
+       $lns blurfl sym
+       if $test "X$testsyml" = X; then
+               if $test -h sym 2>/dev/null; then
+                       testsyml=-h
+               fi
+       fi
+       if $test "X$testsyml" = X; then
+               if $test -L sym 2>/dev/null; then
+                       testsyml=-L
+               fi
+       fi
+       if $test "X$testsyml" != X; then
+               echo "You can test for symbolic links with $testsyml." >&4
+       else
+               echo "I do not know how you can test for symbolic links." >&4
+       fi
+       $rm -f blurfl sym
+       ;;
+*)     echo "No symbolic links, so not testing for their testing..." >&4
+       ;;
+esac
+echo " "
+
+
+case "$mksymlinks" in
+$define|true|[yY]*)
+       case "$src" in
+       ''|'.') echo "Cannot create symlinks in the original directory." >&4
+               exit 1
+               ;;
+       *)      case "$lns:$testsyml" in
+               *"ln -s:-"?)
+                       echo "Creating the symbolic links..." >&4
+                       echo "(First creating the subdirectories...)" >&4
+                       cd ..
+                       awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
+                               read directory
+                               test -z "$directory" && break
+                               mkdir -p $directory
+                       done
+                       # Sanity check 1.
+                       if test ! -d t/base; then
+                               echo "Failed to create the subdirectories.  Aborting." >&4
+                               exit 1
+                       fi
+                       echo "(Then creating the symlinks...)" >&4
+                       awk '{print $1}' $src/MANIFEST | while true; do
+                               read filename
+                               test -z "$filename" && break
+                               if test -f $filename; then
+                                       if test $testsyml $filename; then
+                                               rm -f $filename
+                                       fi
+                               fi
+                               if test -f $filename; then
+                                       echo "$filename already exists, not symlinking."
+                               else
+                                       ln -s $src/$filename $filename
+                               fi
+                       done
+                       # Sanity check 2.
+                       if test ! -f t/base/commonsense.t; then
+                               echo "Failed to create the symlinks.  Aborting." >&4
+                               exit 1
+                       fi
+                       cd UU
+                       ;;
+               *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
+                       ;;
+               esac
+               ;;
+       esac
+       ;;
+esac
+
 : see whether [:lower:] and [:upper:] are supported character classes
 echo " "
 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
@@ -16405,6 +16486,7 @@ tar='$tar'
 tbl='$tbl'
 tee='$tee'
 test='$test'
+testsyml='$testsyml'
 timeincl='$timeincl'
 timetype='$timetype'
 touch='$touch'