This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
d5de2f9e06ce88c6c69ef150f39d307f94731b0e
[metaconfig.git] / U / perl / d_procselfexe.U
1 ?MAKE:d_procselfexe procselfexe: \
2         Oldconfig Setvar rm ls contains issymlink d_readlink
3 ?MAKE:  -pick add $@ %<
4 ?S:d_procselfexe:
5 ?S:     Defined if $procselfexe is symlink to the absolute
6 ?S:     pathname of the executing program.
7 ?S:.
8 ?S:procselfexe:
9 ?S:     If d_procselfexe is defined, $procselfexe is the filename
10 ?S:     of the symbolic link pointing to the absolute pathname of
11 ?S:     the executing program.
12 ?S:.
13 ?C:HAS_PROCSELFEXE:
14 ?C:     This symbol is defined if PROCSELFEXE_PATH is a symlink
15 ?C:     to the absolute pathname of the executing program.
16 ?C:.
17 ?C:PROCSELFEXE_PATH:
18 ?C:     If HAS_PROCSELFEXE is defined this symbol is the filename
19 ?C:     of the symbolic link pointing to the absolute pathname of
20 ?C:     the executing program.
21 ?C:.
22 ?H:#$d_procselfexe HAS_PROCSELFEXE      /**/
23 ?H:?%<:#if defined(HAS_PROCSELFEXE) && !defined(PROCSELFEXE_PATH)
24 ?H:?%<:#define PROCSELFEXE_PATH $procselfexe    /**/
25 ?H:?%<:#endif
26 ?H:.
27 ?LINT: set d_procselfexe
28 : Check if exe is symlink to abs path of executing program
29 echo " "
30 procselfexe=''
31 val="$undef"
32 case "$d_readlink" in
33 "$define")
34         if $issymlink /proc/self/exe ; then
35                 $ls -l /proc/self/exe > reflect
36                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
37                         echo "You have Linux-like /proc/self/exe."
38                         procselfexe='"/proc/self/exe"'
39                         val="$define"
40                 fi
41         fi
42         if $issymlink /proc/curproc/file ; then
43                 $ls -l /proc/curproc/file > reflect
44                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
45                         echo "You have BSD-like /proc/curproc/file."
46                         procselfexe='"/proc/curproc/file"'
47                         val="$define"
48                 fi
49         fi
50         ;;
51 esac
52 $rm -f reflect
53 set d_procselfexe
54 eval $setvar
55