summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjorton <jorton@13f79535-47bb-0310-9956-ffa450edef68>2004-06-14 15:43:40 +0000
committerjorton <jorton@13f79535-47bb-0310-9956-ffa450edef68>2004-06-14 15:43:40 +0000
commit638d6b7278e9bd1151fef691455799df2c3f8f78 (patch)
tree39bc1872f78ed6701f4fcb09663c18fcd8ef550c
parent7100d1bf3c4a679c1a8d5fbba33831045ab8cd42 (diff)
downloadlibapr-util-638d6b7278e9bd1151fef691455799df2c3f8f78.tar.gz
Remove "location detection" from apu-config:
* configure.in: Substitute APU_CONFIG_LOCATION as "build" or "source" appropriately. * apu-config.in: Set location to @APU_CONFIG_LOCATION@ rather than using fragile pwd/realpath guesswork. * Makefile.in (apu-config.out): New target. (install): Install apu-config.out instead of apu-config. PR: 8867 (episode two) git-svn-id: http://svn.apache.org/repos/asf/apr/apr-util/trunk@59052 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--.cvsignore1
-rw-r--r--Makefile.in9
-rw-r--r--apu-config.in37
-rw-r--r--configure.in5
4 files changed, 19 insertions, 33 deletions
diff --git a/.cvsignore b/.cvsignore
index 50a96b3a..b3a7f82f 100644
--- a/.cvsignore
+++ b/.cvsignore
@@ -14,6 +14,7 @@ exports.c
export_vars.h
export_vars.sh
apu-config
+apu-config.out
Debug
Release
LibD
diff --git a/Makefile.in b/Makefile.in
index 439702d5..e5945f2a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -27,7 +27,7 @@ TARGETS = $(TARGET_LIB) aprutil.exp export_vars.h
CLEAN_SUBDIRS = test
-CLEAN_TARGETS = exports.c export_vars.h aprutil.exp .make.dirs
+CLEAN_TARGETS = exports.c export_vars.h aprutil.exp .make.dirs apu-config.out
DISTCLEAN_TARGETS = config.cache config.log config.status libtool \
include/private/apu_config.h include/private/apu_private.h \
include/private/apu_select_dbm.h include/apr_ldap.h include/apu.h \
@@ -46,8 +46,11 @@ includedir=@includedir@
top_srcdir=@abs_srcdir@
top_blddir=@abs_builddir@
+# Create apu-config script suitable for the install tree
+apu-config.out: apu-config
+ sed 's,^\(location=\).*$$,\1installed,' < apu-config > $@
-install: $(TARGET_LIB)
+install: $(TARGET_LIB) apu-config.out
if [ ! -d $(DESTDIR)$(includedir) ]; then \
@APR_SOURCE_DIR@/build/mkdir.sh $(DESTDIR)$(includedir); \
fi;
@@ -71,7 +74,7 @@ install: $(TARGET_LIB)
if [ ! -d $(DESTDIR)$(bindir) ]; then \
@APR_SOURCE_DIR@/build/mkdir.sh $(DESTDIR)$(bindir); \
fi;
- $(LIBTOOL) --mode=install cp apu-config $(DESTDIR)$(bindir)
+ $(LIBTOOL) --mode=install cp apu-config.out $(DESTDIR)$(bindir)/apu-config
chmod 755 $(DESTDIR)$(bindir)/apu-config
$(TARGET_LIB): $(OBJECTS)
diff --git a/apu-config.in b/apu-config.in
index 1f933f8c..39196416 100644
--- a/apu-config.in
+++ b/apu-config.in
@@ -37,6 +37,9 @@ APU_BUILD_DIR="@abs_builddir@"
APR_XML_EXPAT_OLD="@APR_XML_EXPAT_OLD@"
APU_DB_VERSION="@apu_db_version@"
+# NOTE: the following line is modified during 'make install': alter with care!
+location=@APU_CONFIG_LOCATION@
+
show_usage()
{
cat << EOF
@@ -73,32 +76,6 @@ if test $# -eq 0; then
exit 1
fi
-thisdir="`dirname $0`"
-thisdir="`cd $thisdir && pwd`"
-if test -d $bindir; then
- tmpbindir="`cd $bindir && pwd`"
-else
- tmpbindir=""
-fi
-# 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`"
- if test -d "$APU_SOURCE_DIR"; then
- APU_SOURCE_DIR="`realpath $APU_SOURCE_DIR`"
- fi
- if test -n "$tmpbindir"; then
- tmpbindir="`realpath $tmpbindir`"
- fi
-fi
-if test "$tmpbindir" = "$thisdir"; then
- location=installed
-elif test "$APU_SOURCE_DIR" = "$thisdir"; then
- location=source
-else
- location=build
-fi
-
if test "$location" = "installed"; then
LA_FILE="$libdir/lib${APRUTIL_LIBNAME}.la"
@@ -106,7 +83,7 @@ if test "$location" = "installed"; then
LDFLAGS=`echo "$LDFLAGS" | sed -e "s $APU_BUILD_DIR/xml/expat $prefix g"`
INCLUDES=`echo "$INCLUDES" | sed -e "s $APU_BUILD_DIR/xml/expat $prefix g" -e "s -I$prefix/lib g"`
else
- LA_FILE="$thisdir/lib${APRUTIL_LIBNAME}.la"
+ LA_FILE="$APU_BUILD_DIR/lib${APRUTIL_LIBNAME}.la"
fi
flags=""
@@ -141,7 +118,7 @@ while test $# -gt 0; do
flags="$APU_SOURCE_DIR/include"
else
# this is for VPATH builds
- flags="$thisdir/include $APU_SOURCE_DIR/include"
+ flags="$APU_BUILD_DIR/include $APU_SOURCE_DIR/include"
fi
echo $flags
exit 0
@@ -153,7 +130,7 @@ while test $# -gt 0; do
flags="$flags -I$APU_SOURCE_DIR/include $INCLUDES"
else
# this is for VPATH builds
- flags="$flags -I$thisdir/include -I$APU_SOURCE_DIR/include $INCLUDES"
+ flags="$flags -I$APU_BUILD_DIR/include -I$APU_SOURCE_DIR/include $INCLUDES"
fi
;;
--ldflags)
@@ -172,7 +149,7 @@ while test $# -gt 0; do
### avoid using -L if libdir is a "standard" location like /usr/lib
flags="$flags -L$libdir -l$APRUTIL_LIBNAME"
else
- flags="$flags -L$thisdir -l$APRUTIL_LIBNAME"
+ flags="$flags -L$APU_BUILD_DIR -l$APRUTIL_LIBNAME"
fi
;;
--link-libtool)
diff --git a/configure.in b/configure.in
index 20277928..53f7e513 100644
--- a/configure.in
+++ b/configure.in
@@ -28,8 +28,13 @@ abs_builddir=`pwd`
if test "$abs_builddir" != "$abs_srcdir"; then
USE_VPATH=1
+ APU_CONFIG_LOCATION=build
+else
+ APU_CONFIG_LOCATION=source
fi
+AC_SUBST(APU_CONFIG_LOCATION)
+
AC_CANONICAL_SYSTEM
dnl