This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
metaconfig unit change for #13216.
[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 ?LINT: set procselfexe
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                         break
41                 fi
42         fi
43         if $issymlink /proc/curproc/file ; then
44                 $ls -l /proc/curproc/file > reflect
45                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
46                         echo "You have BSD-like /proc/curproc/file."
47                         procselfexe='"/proc/curproc/file"'
48                         val="$define"
49                         break
50                 fi
51         fi
52         ;;
53 esac
54 $rm reflect
55 set d_procselfexe
56 eval $setvar
57