summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-09-27 23:47:39 +0200
committerRicardo Signes <rjbs@cpan.org>2012-03-20 21:06:00 -0400
commit240f73833ca72ce53cbbfc42aa46b71189085fde (patch)
tree8a239a8e5ccdf5068c0b6242c8ae97e17743ae8a
parentfd0bc189abce5d67de2da1ecff3529b469652203 (diff)
downloadperl-240f73833ca72ce53cbbfc42aa46b71189085fde.tar.gz
In Configure, refactor the test for procselfexe into a loop.
This removes code duplication, and makes it easy to add more variants. Based on a patch from Johann 'Myrkraverk' Oskarsson.
-rwxr-xr-xConfigure29
1 files changed, 14 insertions, 15 deletions
diff --git a/Configure b/Configure
index d9911f941b..48a36508f3 100755
--- a/Configure
+++ b/Configure
@@ -16118,23 +16118,22 @@ echo " "
procselfexe=''
val="$undef"
case "$d_readlink" in
-"$define")
- if $issymlink /proc/self/exe ; then
- $ls -l /proc/self/exe > reflect
- if $contains /`basename $ls` reflect >/dev/null 2>&1; then
- echo "You have Linux-like /proc/self/exe."
- procselfexe='"/proc/self/exe"'
- val="$define"
- fi
- fi
- if $issymlink /proc/curproc/file ; then
- $ls -l /proc/curproc/file > reflect
+ "$define")
+ set Linux /proc/self/exe BSD /proc/curproc/file
+ while test $# -gt 0; do
+ type=$1; try=$2
+ shift; shift
+ if $issymlink $try; then
+ $ls -l $try > reflect
if $contains /`basename $ls` reflect >/dev/null 2>&1; then
- echo "You have BSD-like /proc/curproc/file."
- procselfexe='"/proc/curproc/file"'
- val="$define"
+ echo "You have $type-like $try."
+ procselfexe='"'$try'"'
+ val="$define"
+ : This will break out of the loop
+ set X; shift
fi
- fi
+ fi
+ done
;;
esac
$rm -f reflect