This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add the files from dist/meta to perl's repo
[metaconfig.git] / dist / U / issymlink.U
1 ?RCS: $Id: issymlink.U 1 2006-08-24 12:32:52Z rmanfredi $
2 ?RCS:
3 ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
4 ?RCS: 
5 ?RCS: You may redistribute only under the terms of the Artistic Licence,
6 ?RCS: as specified in the README file that comes with the distribution.
7 ?RCS: You may reuse parts of this distribution only within the terms of
8 ?RCS: that same Artistic Licence; a copy of which may be found at the root
9 ?RCS: of the source tree for dist 4.0.
10 ?RCS: 
11 ?RCS: Original Author: Andy Dougherty <doughera@lafcol.lafayette.edu>
12 ?RCS:
13 ?RCS: $Log: lns.U,v $
14 ?RCS: Revision 3.0.1.1  1994/06/20  07:05:52  ram
15 ?RCS: patch30: created by ADO
16 ?RCS:
17 ?MAKE:issymlink: lns test rm
18 ?MAKE:  -pick add $@ %<
19 ?S:issymlink:
20 ?S:     This variable holds the test command to test for a symbolic link
21 ?S:     (if they are supported).  Typical values include 'test -h' and
22 ?S:     'test -L'.
23 ?S:.
24 ?T:pth p
25 ?LINT:change PATH test
26 : determine whether symbolic links are supported
27 echo " "
28 case "$lns" in
29 *"ln"*" -s")
30         echo "Checking how to test for symbolic links..." >&4
31         $lns blurfl sym
32         if $test "X$issymlink" = X; then
33 ?X:
34 ?X: In some AIX 4 versions the (ksh) builtin test (-h) is broken.
35 ?X:
36                 case "$newsh" in
37                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
38                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
39                 esac
40                 if test $? = 0; then
41                         issymlink="test -h"
42                 else
43                         echo "Your builtin 'test -h' may be broken." >&4
44                         case "$test" in
45                         /*)     ;;
46                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
47                                 for p in $pth
48                                 do
49                                         if test -f "$p/$test"; then
50                                                 test="$p/$test"
51                                                 break
52                                         fi
53                                 done
54                                 ;;
55                         esac
56                         case "$test" in
57                         /*)
58                                 echo "Trying external '$test -h'." >&4
59                                 issymlink="$test -h"
60                                 if $test ! -h sym >/dev/null 2>&1; then
61                                         echo "External '$test -h' is broken, too." >&4
62                                         issymlink=''
63                                 fi
64                                 ;;
65                         *)      issymlink='' ;;
66                         esac
67                 fi              
68         fi
69         if $test "X$issymlink" = X; then
70                 if $test -L sym 2>/dev/null; then
71                         issymlink="$test -L"
72                         echo "The builtin '$test -L' worked." >&4
73                 fi
74         fi
75         if $test "X$issymlink" != X; then
76                 echo "You can test for symbolic links with '$issymlink'." >&4
77         else
78                 echo "I do not know how you can test for symbolic links." >&4
79         fi
80         $rm -f blurfl sym
81         ;;
82 *)      echo "No symbolic links, so not testing for their testing..." >&4
83         ;;
84 esac
85