On Thu, Mar 07, 2002 at 03:38:59PM +0000, Thom May wrote:
> By way of replying to myself, here's the patches.
> It creates a new macro in ac_common.m4 in apr, APR_STRIP_PREFIX, and uses
> that to generate a relative path.
>
> This is integrated into confgure.in to give a relative path for
> sysconfigdir.
>
> Cheers,
> -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 15:34:27 -0000
> @@ -577,3 +577,16 @@
> $1=$cur
> ])
>
> +dnl removes ${prefix} from the valuable of a variable
> +dnl giving a relative path rather than an absolute one.
> +dnl
> +dnl Example:
> +dnl
> +dnl foo=${prefix}/bar
> +dnl APR_STRIP_PREFIX(baz, $foo)
> +dnl $baz is now "bar"
> +AC_DEFUN(APR_STRIP_PREFIX,[
> +abs=$2
> +rel=`echo $abs|sed -e 's#${prefix}/\(.*\)#\1#' -e 's#^/\(.*\)#\1#'`
> +$1=$rel
> +])
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 no idea if that would work, or if you can do orig=$$1)
-aaron