You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by aa...@apache.org on 2002/02/28 03:54:01 UTC
cvs commit: apr/build apr_common.m4
aaron 02/02/27 18:54:01
Modified: build apr_common.m4
Log:
Add a new m4 function APR_EXPAND_VAR that will iteratively
interpolate the contents of a variable, such as $sysconfdir,
for use in a borne script.
Revision Changes Path
1.23 +22 -0 apr/build/apr_common.m4
Index: apr_common.m4
===================================================================
RCS file: /home/cvs/apr/build/apr_common.m4,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- apr_common.m4 12 Nov 2001 01:16:00 -0000 1.22
+++ apr_common.m4 28 Feb 2002 02:54:01 -0000 1.23
@@ -554,4 +554,26 @@
done
])
+dnl Iteratively interpolate the contents of the second argument
+dnl until interpolation offers no new result. Then assign the
+dnl final result to $1.
+dnl
+dnl Example:
+dnl
+dnl foo=1
+dnl bar='${foo}/2'
+dnl baz='${bar}/3'
+dnl APR_EXPAND_VAR(fraz, $baz)
+dnl $fraz is now "1/2/3"
+dnl
+AC_DEFUN(APR_EXPAND_VAR,[
+last=
+cur=$2
+while test "x$cur" != "x$last";
+do
+ last=$cur
+ cur=`eval "echo $cur"`
+done
+$1=$cur
+])