rosfran@253: dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR)
rosfran@253: dnl
rosfran@253: dnl example
rosfran@253: dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
rosfran@253: dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local
rosfran@253: 
rosfran@253: AC_DEFUN([AS_AC_EXPAND],
rosfran@253: [
rosfran@253:   EXP_VAR=[$1]
rosfran@253:   FROM_VAR=[$2]
rosfran@253: 
rosfran@253:   dnl first expand prefix and exec_prefix if necessary
rosfran@253:   prefix_save=$prefix
rosfran@253:   exec_prefix_save=$exec_prefix
rosfran@253: 
rosfran@253:   dnl if no prefix given, then use /usr/local, the default prefix
rosfran@253:   if test "x$prefix" = "xNONE"; then
rosfran@253:     prefix=$ac_default_prefix
rosfran@253:   fi
rosfran@253:   dnl if no exec_prefix given, then use prefix
rosfran@253:   if test "x$exec_prefix" = "xNONE"; then
rosfran@253:     exec_prefix=$prefix
rosfran@253:   fi
rosfran@253: 
rosfran@253:   full_var="$FROM_VAR"
rosfran@253:   dnl loop until it doesn't change anymore
rosfran@253:   while true; do
rosfran@253:     new_full_var="`eval echo $full_var`"
rosfran@253:     if test "x$new_full_var"="x$full_var"; then break; fi
rosfran@253:     full_var=$new_full_var
rosfran@253:   done
rosfran@253: 
rosfran@253:   dnl clean up
rosfran@253:   full_var=$new_full_var
rosfran@253:   AC_SUBST([$1], "$full_var")
rosfran@253: 
rosfran@253:   dnl restore prefix and exec_prefix
rosfran@253:   prefix=$prefix_save
rosfran@253:   exec_prefix=$exec_prefix_save
rosfran@253: ])