This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
e5073df344ce1449b7a947edf899512334a5e765
[metaconfig.git] / U / perl / issymlink.U
1 ?RCS: $Id: lns.U,v 3.0.1.1 1994/06/20 07:05:52 ram Exp $
2 ?RCS:
3 ?RCS: Copyright (c) 1991-1993, 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 3.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
26 ?LINT:change test
27 ?LINT:extern newsh
28 ?LINT:extern _exe
29 : determine whether symbolic links are supported
30 echo " "
31 case "$lns" in
32 *"ln"*" -s")
33         echo "Checking how to test for symbolic links..." >&4
34         $lns blurfl sym
35         if $test "X$issymlink" = X; then
36 ?X:
37 ?X: In some AIX 4 versions the (ksh) builtin test (-h) is broken.
38 ?X:
39                 case "$newsh" in
40                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
41                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
42                 esac
43                 if test $? = 0; then
44                         issymlink="test -h"
45                 else
46                         echo "Your builtin 'test -h' may be broken." >&4
47                         case "$test" in
48                         /*)     ;;
49                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
50                                 for p in $pth
51                                 do
52                                         if test -f "$p/$test"; then
53                                                 test="$p/$test"
54                                                 break
55                                         fi
56                                 done
57                                 ;;
58                         esac
59                         case "$test" in
60                         /*)
61                                 echo "Trying external '$test -h'." >&4
62                                 issymlink="$test -h"
63                                 if $test ! -h sym >/dev/null 2>&1; then
64                                         echo "External '$test -h' is broken, too." >&4
65                                         issymlink=''
66                                 fi
67                                 ;;
68                         *)      issymlink='' ;;
69                         esac
70                 fi              
71         fi
72         if $test "X$issymlink" = X; then
73                 if $test -L sym 2>/dev/null; then
74                         issymlink="$test -L"
75                         echo "The builtin '$test -L' worked." >&4
76                 fi
77         fi
78         if $test "X$issymlink" != X; then
79                 echo "You can test for symbolic links with '$issymlink'." >&4
80         else
81                 echo "I do not know how you can test for symbolic links." >&4
82         fi
83         $rm -f blurfl sym
84         ;;
85 *)      echo "No symbolic links, so not testing for their testing..." >&4
86         ;;
87 esac
88 echo " "
89