* configure.ac: New switch for disabling -O2 (--disable-optimizations).
[cacao.git] / m4 / as-ac-expand.m4
1 dnl take from http://cvs.sourceforge.net/viewcvs.py/autostars/autostars/ac-expand/as-ac-expand.m4
2
3 dnl as-ac-expand.m4 0.2.0                                -*- autoconf -*-
4 dnl autostars m4 macro for expanding directories using configure's prefix
5
6 dnl (C) 2003, 2004, 2005 Thomas Vander Stichele <thomas at apestaart dot org>
7
8 dnl Copying and distribution of this file, with or without modification,
9 dnl are permitted in any medium without royalty provided the copyright
10 dnl notice and this notice are preserved.
11
12 dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR)
13 dnl example
14 dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
15 dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local
16
17 AC_DEFUN([AS_AC_EXPAND],
18 [
19   EXP_VAR=[$1]
20   FROM_VAR=[$2]
21
22   dnl first expand prefix and exec_prefix if necessary
23   prefix_save=$prefix
24   exec_prefix_save=$exec_prefix
25
26   dnl if no prefix given, then use /usr/local, the default prefix
27   if test "x$prefix" = "xNONE"; then
28     prefix="$ac_default_prefix"
29   fi
30   dnl if no exec_prefix given, then use prefix
31   if test "x$exec_prefix" = "xNONE"; then
32     exec_prefix=$prefix
33   fi
34
35   full_var="$FROM_VAR"
36   dnl loop until it doesn't change anymore
37   while true; do
38     new_full_var="`eval echo $full_var`"
39     if test "x$new_full_var" = "x$full_var"; then break; fi
40     full_var=$new_full_var
41   done
42
43   dnl clean up
44   full_var=$new_full_var
45   AC_SUBST([$1], "$full_var")
46
47   dnl restore prefix and exec_prefix
48   prefix=$prefix_save
49   exec_prefix=$exec_prefix_save
50 ])