libgnomevfs2-mythtv/m4/as-expand.m4
author rosfran
Thu Jan 11 17:36:33 2007 +0000 (2007-01-11)
branchtrunk
changeset 262 91a24122e3ae
permissions -rwxr-xr-x
[svn r263] Fixed bug inserted on gmyth_socket_try_connect, which throws a NULL pointer error.
melunko@38
     1
dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR)
melunko@38
     2
dnl
melunko@38
     3
dnl example
melunko@38
     4
dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
melunko@38
     5
dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local
melunko@38
     6
melunko@38
     7
AC_DEFUN([AS_AC_EXPAND],
melunko@38
     8
[
melunko@38
     9
  EXP_VAR=[$1]
melunko@38
    10
  FROM_VAR=[$2]
melunko@38
    11
melunko@38
    12
  dnl first expand prefix and exec_prefix if necessary
melunko@38
    13
  prefix_save=$prefix
melunko@38
    14
  exec_prefix_save=$exec_prefix
melunko@38
    15
melunko@38
    16
  dnl if no prefix given, then use /usr/local, the default prefix
melunko@38
    17
  if test "x$prefix" = "xNONE"; then
melunko@38
    18
    prefix=$ac_default_prefix
melunko@38
    19
  fi
melunko@38
    20
  dnl if no exec_prefix given, then use prefix
melunko@38
    21
  if test "x$exec_prefix" = "xNONE"; then
melunko@38
    22
    exec_prefix=$prefix
melunko@38
    23
  fi
melunko@38
    24
melunko@38
    25
  full_var="$FROM_VAR"
melunko@38
    26
  dnl loop until it doesn't change anymore
melunko@38
    27
  while true; do
melunko@38
    28
    new_full_var="`eval echo $full_var`"
melunko@38
    29
    if test "x$new_full_var"="x$full_var"; then break; fi
melunko@38
    30
    full_var=$new_full_var
melunko@38
    31
  done
melunko@38
    32
melunko@38
    33
  dnl clean up
melunko@38
    34
  full_var=$new_full_var
melunko@38
    35
  AC_SUBST([$1], "$full_var")
melunko@38
    36
melunko@38
    37
  dnl restore prefix and exec_prefix
melunko@38
    38
  prefix=$prefix_save
melunko@38
    39
  exec_prefix=$exec_prefix_save
melunko@38
    40
])