blob: d6c9e33060aa8b828347bcda9f8b8ef17d7f61de [file] [log] [blame]
Andreas Huber538f6172010-11-08 11:13:04 -08001dnl as-ac-expand.m4 0.2.0
2dnl autostars m4 macro for expanding directories using configure's prefix
3dnl thomas@apestaart.org
4
5dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR)
6dnl example
7dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
8dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local
9
10AC_DEFUN([AS_AC_EXPAND],
11[
12 EXP_VAR=[$1]
13 FROM_VAR=[$2]
14
15 dnl first expand prefix and exec_prefix if necessary
16 prefix_save=$prefix
17 exec_prefix_save=$exec_prefix
18
19 dnl if no prefix given, then use /usr/local, the default prefix
20 if test "x$prefix" = "xNONE"; then
21 prefix="$ac_default_prefix"
22 fi
23 dnl if no exec_prefix given, then use prefix
24 if test "x$exec_prefix" = "xNONE"; then
25 exec_prefix=$prefix
26 fi
27
28 full_var="$FROM_VAR"
29 dnl loop until it doesn't change anymore
30 while true; do
31 new_full_var="`eval echo $full_var`"
32 if test "x$new_full_var" = "x$full_var"; then break; fi
33 full_var=$new_full_var
34 done
35
36 dnl clean up
37 full_var=$new_full_var
38 AC_SUBST([$1], "$full_var")
39
40 dnl restore prefix and exec_prefix
41 prefix=$prefix_save
42 exec_prefix=$exec_prefix_save
43])