1 ?MAKE:d_procselfexe procselfexe: \
2 Oldconfig Setvar rm ls contains issymlink d_readlink test
5 ?S: Defined if $procselfexe is symlink to the absolute
6 ?S: pathname of the executing program.
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.
14 ?C: This symbol is defined if PROCSELFEXE_PATH is a symlink
15 ?C: to the absolute pathname of the executing program.
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.
22 ?H:#$d_procselfexe HAS_PROCSELFEXE /**/
23 ?H:?%<:#if defined(HAS_PROCSELFEXE) && !defined(PROCSELFEXE_PATH)
24 ?H:?%<:#define PROCSELFEXE_PATH $procselfexe /**/
28 ?LINT: set d_procselfexe
29 : Check if there is a /proc symlink to the abs path of
30 : the executing program. We will honor hints of d_procselfexe=$undef
31 : or procselfexe being non-empty, otherwise will try to determine both
32 : if we have readlink.
33 : AmigaOS will attempt to mount proc: aka /proc, if /proc/... is
34 : referenced, and AmigaOS does not have a proc filesystem anyway.
37 if $test "X$d_procselfexe" = Xundef; then
39 elif $test "X$procselfexe" != X -a "X$procselfexe" != 'X '; then
41 elif $test "X$d_readlink" = Xdefine; then
42 : NetBSD first as /proc/self is a symlink to /proc/curproc,
43 : and it feels more tidy to avoid an extra level of symlink
44 set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
45 while test $# -gt 0; do
48 if $issymlink $try; then
50 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
51 echo "You have $type-like $try."
52 procselfexe='"'$try'"'
54 : This will break out of the loop