Mercurial > audlegacy
annotate m4/as-ac-expand.m4 @ 4806:563b6f48acd9
Move one line to fix dependency generation.
author | Jonathan Schleifer <js-audacious@webkeks.org> |
---|---|
date | Sat, 01 Nov 2008 20:09:43 +0100 |
parents | c942eaef7bc6 |
children |
rev | line source |
---|---|
4315
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
1 dnl as-ac-expand.m4 0.2.0 |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
2 dnl autostars m4 macro for expanding directories using configure's prefix |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
3 dnl thomas@apestaart.org |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
4 |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
5 dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR) |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
6 dnl example |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
7 dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir) |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
8 dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
9 |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
10 AC_DEFUN([AS_AC_EXPAND], |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
11 [ |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
12 EXP_VAR=[$1] |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
13 FROM_VAR=[$2] |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
14 |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
15 dnl first expand prefix and exec_prefix if necessary |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
16 prefix_save=$prefix |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
17 exec_prefix_save=$exec_prefix |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
18 |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
19 dnl if no prefix given, then use /usr/local, the default prefix |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
20 if test "x$prefix" = "xNONE"; then |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
21 prefix="$ac_default_prefix" |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
22 fi |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
23 dnl if no exec_prefix given, then use prefix |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
24 if test "x$exec_prefix" = "xNONE"; then |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
25 exec_prefix=$prefix |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
26 fi |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
27 |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
28 full_var="$FROM_VAR" |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
29 dnl loop until it doesn't change anymore |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
30 while true; do |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
31 new_full_var="`eval echo $full_var`" |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
32 if test "x$new_full_var" = "x$full_var"; then break; fi |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
33 full_var=$new_full_var |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
34 done |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
35 |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
36 dnl clean up |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
37 full_var=$new_full_var |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
38 AC_SUBST([$1], "$full_var") |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
39 |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
40 dnl restore prefix and exec_prefix |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
41 prefix=$prefix_save |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
42 exec_prefix=$exec_prefix_save |
c942eaef7bc6
Implement session management.
Ivan N. Zlatev <contact@i-nz.net>
parents:
diff
changeset
|
43 ]) |