summaryrefslogtreecommitdiff
path: root/apr-config.in
diff options
context:
space:
mode:
Diffstat (limited to 'apr-config.in')
-rw-r--r--apr-config.in29
1 files changed, 22 insertions, 7 deletions
diff --git a/apr-config.in b/apr-config.in
index bed47cacb..626d3b0e5 100644
--- a/apr-config.in
+++ b/apr-config.in
@@ -48,13 +48,28 @@ APR_LIBNAME="@APR_LIBNAME@"
# NOTE: the following line is modified during 'make install': alter with care!
location=@APR_CONFIG_LOCATION@
-# absolute path, but not installed path - we're cross compiling
-case "$0" in
- "${bindir}/"*) ;;
- "/"*) location=crosscompile;
- APR_TARGET_DIR=${0%${bindir}/apr-${APR_MAJOR_VERSION}-config} ;;
- *) ;;
-esac
+cross_compiling=@APR_CROSS_COMPILING@
+
+if test "$cross_compiling" != "no"; then
+
+ # Normalize $0 and bindir by removing consecutive '/' as the comparison
+ # and the suffix removal below might fail for semantic equal pathes.
+ # XXX: This is not perfect. On Linux we could use realpath for this purpose
+ # but realpath is not portable.
+ normalized_command=`echo $0 | tr -s /`
+ normalized_bindir=`echo ${bindir} | tr -s /`
+ # Remove trailing '/'
+ normalized_bindir=${normalized_bindir%/}
+
+ # absolute path, but not installed path - we're cross compiling
+ case "$normalized_command" in
+ "${normalized_bindir}/"*) ;;
+ "/"*) location=crosscompile;
+ APR_TARGET_DIR=${normalized_command%${normalized_bindir}/apr-${APR_MAJOR_VERSION}-config};
+ ;;
+ *) ;;
+ esac
+fi
show_usage()
{