Commit | Line | Data |
---|---|---|
8d8abcf7 JH |
1 | ?MAKE:d_procselfexe procselfexe: \ |
2 | Oldconfig Setvar rm ls contains issymlink d_readlink | |
b8117f61 NIS |
3 | ?MAKE: -pick add $@ %< |
4 | ?S:d_procselfexe: | |
8d8abcf7 JH |
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. | |
b8117f61 NIS |
12 | ?S:. |
13 | ?C:HAS_PROCSELFEXE: | |
8d8abcf7 JH |
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. | |
b8117f61 NIS |
21 | ?C:. |
22 | ?H:#$d_procselfexe HAS_PROCSELFEXE /**/ | |
8d8abcf7 JH |
23 | ?H:?%<:#if defined(HAS_PROCSELFEXE) && !defined(PROCSELFEXE_PATH) |
24 | ?H:?%<:#define PROCSELFEXE_PATH $procselfexe /**/ | |
25 | ?H:?%<:#endif | |
b8117f61 NIS |
26 | ?H:. |
27 | ?LINT: set d_procselfexe | |
d7a2632b | 28 | : Check if exe is symlink to abs path of executing program |
b8117f61 | 29 | echo " " |
8d8abcf7 | 30 | procselfexe='' |
b8117f61 | 31 | val="$undef" |
b7a8c4c1 JH |
32 | case "$d_readlink" in |
33 | "$define") | |
b8117f61 NIS |
34 | if $issymlink /proc/self/exe ; then |
35 | $ls -l /proc/self/exe > reflect | |
2fe09f7d | 36 | if $contains /`basename $ls` reflect >/dev/null 2>&1; then |
b7a8c4c1 | 37 | echo "You have Linux-like /proc/self/exe." |
8c878e83 | 38 | procselfexe='"/proc/self/exe"' |
8d8abcf7 | 39 | val="$define" |
8d8abcf7 JH |
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." | |
8c878e83 | 46 | procselfexe='"/proc/curproc/file"' |
8d8abcf7 | 47 | val="$define" |
b8117f61 | 48 | fi |
b8117f61 | 49 | fi |
b7a8c4c1 JH |
50 | ;; |
51 | esac | |
b02ce353 | 52 | $rm -f reflect |
b8117f61 NIS |
53 | set d_procselfexe |
54 | eval $setvar | |
55 |