1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/mythtv_plugin/m4/as-expand.m4 Wed Sep 20 23:59:48 2006 +0100
1.3 @@ -0,0 +1,40 @@
1.4 +dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR)
1.5 +dnl
1.6 +dnl example
1.7 +dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
1.8 +dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local
1.9 +
1.10 +AC_DEFUN([AS_AC_EXPAND],
1.11 +[
1.12 + EXP_VAR=[$1]
1.13 + FROM_VAR=[$2]
1.14 +
1.15 + dnl first expand prefix and exec_prefix if necessary
1.16 + prefix_save=$prefix
1.17 + exec_prefix_save=$exec_prefix
1.18 +
1.19 + dnl if no prefix given, then use /usr/local, the default prefix
1.20 + if test "x$prefix" = "xNONE"; then
1.21 + prefix=$ac_default_prefix
1.22 + fi
1.23 + dnl if no exec_prefix given, then use prefix
1.24 + if test "x$exec_prefix" = "xNONE"; then
1.25 + exec_prefix=$prefix
1.26 + fi
1.27 +
1.28 + full_var="$FROM_VAR"
1.29 + dnl loop until it doesn't change anymore
1.30 + while true; do
1.31 + new_full_var="`eval echo $full_var`"
1.32 + if test "x$new_full_var"="x$full_var"; then break; fi
1.33 + full_var=$new_full_var
1.34 + done
1.35 +
1.36 + dnl clean up
1.37 + full_var=$new_full_var
1.38 + AC_SUBST([$1], "$full_var")
1.39 +
1.40 + dnl restore prefix and exec_prefix
1.41 + prefix=$prefix_save
1.42 + exec_prefix=$exec_prefix_save
1.43 +])