If available, use 'readlink -f' to resolve symlinks in apu-config.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr-util/branches/APU_0_9_BRANCH@59127 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/CHANGES b/CHANGES
index ac52804..f6d8e6b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,8 @@
Changes with APR-util 0.9.5
+ *) If available, use 'readlink -f' to resolve symlinks in apu-config.
+ [Justin Erenkrantz]
+
*) Fix corrupt output from the apr_xlate_* interfaces on AIX 4.x.
[Joe Orton]
diff --git a/apu-config.in b/apu-config.in
index 1f933f8..a570838 100644
--- a/apu-config.in
+++ b/apu-config.in
@@ -82,14 +82,20 @@
fi
# If we have the realpath program, use it to resolve symlinks.
# Otherwise, being in a symlinked dir may result in incorrect output.
+REALPATH=
if test -x "`which realpath 2>/dev/null`"; then
- thisdir="`realpath $thisdir`"
- if test -d "$APU_SOURCE_DIR"; then
- APU_SOURCE_DIR="`realpath $APU_SOURCE_DIR`"
- fi
- if test -n "$tmpbindir"; then
- tmpbindir="`realpath $tmpbindir`"
- fi
+ REALPATH=realpath
+elif test -x "`which readlink 2>/dev/null`"; then
+ REALPATH="readlink -f"
+fi
+if test -n "$REALPATH"; then
+ thisdir="`$REALPATH $thisdir`"
+ if test -d "$APU_SOURCE_DIR"; then
+ APR_SOURCE_DIR="`$REALPATH $APU_SOURCE_DIR`"
+ fi
+ if test -n "$tmpbindir"; then
+ tmpbindir="`$REALPATH $tmpbindir`"
+ fi
fi
if test "$tmpbindir" = "$thisdir"; then
location=installed