gmyth-stream/libgnomevfs2/m4/as-expand.m4
author renatofilho
Tue Apr 17 15:13:48 2007 +0100 (2007-04-17)
branchtrunk
changeset 557 fc93462c296d
permissions -rw-r--r--
[svn r562] fixed debian scripts
morphbr@534
     1
dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR)
morphbr@534
     2
dnl
morphbr@534
     3
dnl example
morphbr@534
     4
dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
morphbr@534
     5
dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local
morphbr@534
     6
morphbr@534
     7
AC_DEFUN([AS_AC_EXPAND],
morphbr@534
     8
[
morphbr@534
     9
  EXP_VAR=[$1]
morphbr@534
    10
  FROM_VAR=[$2]
morphbr@534
    11
morphbr@534
    12
  dnl first expand prefix and exec_prefix if necessary
morphbr@534
    13
  prefix_save=$prefix
morphbr@534
    14
  exec_prefix_save=$exec_prefix
morphbr@534
    15
morphbr@534
    16
  dnl if no prefix given, then use /usr/local, the default prefix
morphbr@534
    17
  if test "x$prefix" = "xNONE"; then
morphbr@534
    18
    prefix=$ac_default_prefix
morphbr@534
    19
  fi
morphbr@534
    20
  dnl if no exec_prefix given, then use prefix
morphbr@534
    21
  if test "x$exec_prefix" = "xNONE"; then
morphbr@534
    22
    exec_prefix=$prefix
morphbr@534
    23
  fi
morphbr@534
    24
morphbr@534
    25
  full_var="$FROM_VAR"
morphbr@534
    26
  dnl loop until it doesn't change anymore
morphbr@534
    27
  while true; do
morphbr@534
    28
    new_full_var="`eval echo $full_var`"
morphbr@534
    29
    if test "x$new_full_var"="x$full_var"; then break; fi
morphbr@534
    30
    full_var=$new_full_var
morphbr@534
    31
  done
morphbr@534
    32
morphbr@534
    33
  dnl clean up
morphbr@534
    34
  full_var=$new_full_var
morphbr@534
    35
  AC_SUBST([$1], "$full_var")
morphbr@534
    36
morphbr@534
    37
  dnl restore prefix and exec_prefix
morphbr@534
    38
  prefix=$prefix_save
morphbr@534
    39
  exec_prefix=$exec_prefix_save
morphbr@534
    40
])