author | leo_sobral |
Wed Sep 20 23:59:48 2006 +0100 (2006-09-20) | |
branch | trunk |
changeset 2 | bd3829c2e9c9 |
permissions | -rw-r--r-- |
leo_sobral@2 | 1 |
dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR) |
leo_sobral@2 | 2 |
dnl |
leo_sobral@2 | 3 |
dnl example |
leo_sobral@2 | 4 |
dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir) |
leo_sobral@2 | 5 |
dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local |
leo_sobral@2 | 6 |
|
leo_sobral@2 | 7 |
AC_DEFUN([AS_AC_EXPAND], |
leo_sobral@2 | 8 |
[ |
leo_sobral@2 | 9 |
EXP_VAR=[$1] |
leo_sobral@2 | 10 |
FROM_VAR=[$2] |
leo_sobral@2 | 11 |
|
leo_sobral@2 | 12 |
dnl first expand prefix and exec_prefix if necessary |
leo_sobral@2 | 13 |
prefix_save=$prefix |
leo_sobral@2 | 14 |
exec_prefix_save=$exec_prefix |
leo_sobral@2 | 15 |
|
leo_sobral@2 | 16 |
dnl if no prefix given, then use /usr/local, the default prefix |
leo_sobral@2 | 17 |
if test "x$prefix" = "xNONE"; then |
leo_sobral@2 | 18 |
prefix=$ac_default_prefix |
leo_sobral@2 | 19 |
fi |
leo_sobral@2 | 20 |
dnl if no exec_prefix given, then use prefix |
leo_sobral@2 | 21 |
if test "x$exec_prefix" = "xNONE"; then |
leo_sobral@2 | 22 |
exec_prefix=$prefix |
leo_sobral@2 | 23 |
fi |
leo_sobral@2 | 24 |
|
leo_sobral@2 | 25 |
full_var="$FROM_VAR" |
leo_sobral@2 | 26 |
dnl loop until it doesn't change anymore |
leo_sobral@2 | 27 |
while true; do |
leo_sobral@2 | 28 |
new_full_var="`eval echo $full_var`" |
leo_sobral@2 | 29 |
if test "x$new_full_var"="x$full_var"; then break; fi |
leo_sobral@2 | 30 |
full_var=$new_full_var |
leo_sobral@2 | 31 |
done |
leo_sobral@2 | 32 |
|
leo_sobral@2 | 33 |
dnl clean up |
leo_sobral@2 | 34 |
full_var=$new_full_var |
leo_sobral@2 | 35 |
AC_SUBST([$1], "$full_var") |
leo_sobral@2 | 36 |
|
leo_sobral@2 | 37 |
dnl restore prefix and exec_prefix |
leo_sobral@2 | 38 |
prefix=$prefix_save |
leo_sobral@2 | 39 |
exec_prefix=$exec_prefix_save |
leo_sobral@2 | 40 |
]) |