~joh/alarm-clock/trunk

« back to all changes in this revision

Viewing changes to m4/acinclude.m4

  • Committer: joh
  • Date: 2007-11-29 22:52:57 UTC
  • Revision ID: svn-v3-trunk0:09227056-e07b-4814-8d26-2976ae7b09e1:trunk:6
Working autotoolized.

Show diffs side-by-side

added added

removed removed

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