* Aaron Bannert ([EMAIL PROTECTED]) wrote :
> On Thu, Mar 07, 2002 at 03:38:59PM +0000, Thom May wrote:
> 

> I was thinking something more generic:
> 
> dnl APR_UNPREPEND_VAR(var, $to_strip)
> dnl
> AC_DEFUN(APR_UNPREPEND_VAR(,[
> orig=$$1
> to_strip=$2
> rel=`echo $orig|sed -e "s#^${to_strip}##"`
> $1=$rel
> ])
> 
I have something similar now working, but with one exception - instead of
passing a variable to strip, you just pass the name of the variable.
-Thom


Index: build/apr_common.m4
===================================================================
RCS file: /home/cvspublic/apr/build/apr_common.m4,v
retrieving revision 1.23
diff -u -u -3 -r1.23 apr_common.m4
--- build/apr_common.m4 28 Feb 2002 02:54:01 -0000      1.23
+++ build/apr_common.m4 7 Mar 2002 16:55:57 -0000
@@ -577,3 +577,17 @@
 $1=$cur
 ])
 
+dnl removes ${to_strip} from the value of a variable
+dnl giving a relative path rather than an absolute one.
+dnl
+dnl Example:
+dnl
+dnl foo=${prefix}/bar
+dnl APR_UNPREPEND_VAR(baz, $foo, prefix)
+dnl    $baz is now "bar"
+AC_DEFUN(APR_UNPREPEND_VAR,[
+to_strip="\${$3}"
+abs=$2
+rel=`echo $abs|sed -e "s#$to_strip/\(.*\)#\1#" -e "s#^/\(.*\)#\1#"`
+$1=$rel
+])



Index: configure.in
===================================================================
RCS file: /home/cvspublic/httpd-2.0/configure.in,v
retrieving revision 1.207
diff -u -u -3 -r1.207 configure.in
--- configure.in        7 Mar 2002 00:23:30 -0000       1.207
+++ configure.in        7 Mar 2002 16:54:18 -0000
@@ -443,8 +443,8 @@
 APR_EXPAND_VAR(ap_prefix, $prefix)
 AC_DEFINE_UNQUOTED(HTTPD_ROOT, "${ap_prefix}",
        [Root directory of the Apache install area])
-APR_EXPAND_VAR(ap_sysconfdir, $sysconfdir)
-AC_DEFINE_UNQUOTED(SERVER_CONFIG_FILE, "${ap_sysconfdir}/${progname}.conf",
+APR_UNPREPEND_VAR(rel_sysconfdir, $sysconfdir, prefix)
+AC_DEFINE_UNQUOTED(SERVER_CONFIG_FILE, "${rel_sysconfdir}/${progname}.conf",
        [Location of the config file, relative to the Apache root directory])
 AC_DEFINE_UNQUOTED(APACHE_MPM_DIR, "$MPM_DIR",
        [Location of the source for the current MPM])

Reply via email to