On my machine I used apache2 (apr 0.9.3) with a BSD-Like layout with
stow. Therefore the
apr-config and apu-config in /usr/local/bin are not actual files but
symbolic links to the actual script shell which are locate "somewhere
else" (/usr/local/stow/apache2/httpd-2.0.45/bin actually). In this
particular configuration, the ap[ur]-config --link-* commands give a
wrong path with or without realpath installed :
$ apr-config --link-ld
-L/usr/local/bin -lapr-0
$ apr-config --link-libtool
/usr/local/bin/libapr-0.la
This is because the "thisdir" variable contains /usr/local/bin so the
scripts consider apr-config to be in a "build" location rather than
"installed".
The following patches correct this problem when the realpath command is
installed.
====================
--- apr-config.in.org Fri Apr 18 10:07:48 2003
+++ apr-config.in Fri Apr 18 10:11:12 2003
@@ -121,8 +121,6 @@
exit 1
fi
-thisdir="`dirname $0`"
-thisdir="`cd $thisdir && pwd`"
if test -d $bindir; then
tmpbindir="`cd $bindir && pwd`"
else
@@ -131,11 +129,15 @@
# If we have the realpath program, use it to resolve symlinks
# Otherwise, being in a symlinked dir may result in incorrect output.
if test -x "`which realpath 2>/dev/null`"; then
- thisdir="`realpath $thisdir`"
+ thisdir="`realpath $0`"
+ thisdir="`dirname $thisdir`"
APR_SOURCE_DIR="`realpath $APR_SOURCE_DIR`"
if test -n $tmpbindir; then
tmpbindir="`realpath $tmpbindir`"
fi
+else
+ thisdir="`dirname $0`"
+ thisdir="`cd $thisdir && pwd`"
fi
if test "$tmpbindir" = "$thisdir"; then
location=installed
====================
--- apu-config.in.org Fri Apr 18 10:09:00 2003
+++ apu-config.in Fri Apr 18 10:09:45 2003
@@ -109,8 +109,6 @@
exit 1
fi
-thisdir="`dirname $0`"
-thisdir="`cd $thisdir && pwd`"
if test -d $bindir; then
tmpbindir="`cd $bindir && pwd`"
else
@@ -119,11 +117,15 @@
# If we have the realpath program, use it to resolve symlinks.
# Otherwise, being in a symlinked dir may result in incorrect output.
if test -x "`which realpath 2>/dev/null`"; then
- thisdir="`realpath $thisdir`"
+ thisdir="`realpath $0`"
+ thisdir="`dirname $thisdir`"
APU_SOURCE_DIR="`realpath $APU_SOURCE_DIR`"
if test -n $tmpbindir; then
tmpbindir="`realpath $tmpbindir`"
fi
+else
+ thisdir="`dirname $0`"
+ thisdir="`cd $thisdir && pwd`"
fi
if test "$tmpbindir" = "$thisdir"; then
location=installed
====================