m4/mdw-define-paths.m4: Use `$(...)' for command substitution.
[runlisp] / m4 / mdw-define-paths.m4
1 dnl -*-autoconf-*-
2
3 ### SYNOPSIS
4 ###
5 ### mdw_DEFINE_PATHS(BODY)
6 ###
7 ### mdw_PROG(PROG)
8 ### mdw_PATH(PATH)
9 ### mdw_DEFINE_PROG(SYMBOL, PROG)
10 ### mdw_DEFINE_PATH(SYMBOL, PATH)
11 ###
12 ### DESCRIPTION
13 ###
14 ### This collection of macros is useful for hardcoding pathname strings
15 ### into binary programs.
16 ###
17 ### Within the BODY of `mdw_DEFINE_PATHS', a number of variables are `fixed
18 ### up' so that they can be properly expanded. The other macros are only
19 ### really useful within this body.
20 ###
21 ### `mdw_PROG' expands, in the shell, to the transformed name of the
22 ### program PROG.
23 ###
24 ### `mdw_PATH' expands, in the shell, to the recursive expansion of PATH,
25 ### which should be a string containing parameter expansions.
26 ###
27 ### `mdw_DEFINE_PROG' is a convenience macro which defines the preprocessor
28 ### SYMBOL to the result of `mdw_PROG(PROG)'; similarly `mdw_DEFINE_PATH'
29 ### defines SYMBOL to the result of `mdw_PATH(PATH)'.
30 ###
31 ### LICENSE
32 ###
33 ### Copyright (c) 2002 Mark Wooding <mdw@distorted.org.uk>
34 ###
35 ### This program is free software: you can redistribute it and/or modify it
36 ### under the terms of the GNU General Public License as published by the
37 ### Free Software Foundation, either version 2 of the License, or (at your
38 ### option) any later version.
39 ###
40 ### This program is distributed in the hope that it will be useful, but
41 ### WITHOUT ANY WARRANTY; without even the implied warranty of
42 ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
43 ### General Public License for more details.
44 ###
45 ### You should have received a copy of the GNU General Public License along
46 ### with this program. If not, see <http://www.gnu.org/licenses/>.
47 ###
48 ### As a special exception, the respective Autoconf Macro's copyright owner
49 ### gives unlimited permission to copy, distribute and modify the configure
50 ### scripts that are the output of Autoconf when processing the Macro. You
51 ### need not follow the terms of the GNU General Public License when using
52 ### or distributing such scripts, even though portions of the text of the
53 ### Macro appear in them. The GNU General Public License (GPL) does govern
54 ### all other use of the material that constitutes the Autoconf Macro.
55 ###
56 ### This special exception to the GPL applies to versions of the Autoconf
57 ### Macro released by the Autoconf Archive. When you make and distribute a
58 ### modified version of the Autoconf Macro, you may extend this special
59 ### exception to the GPL to apply to your modified version as well.
60
61 # serial 1
62 AC_DEFUN([mdw_DEFINE_PATHS],
63 [mdw_prefix=$prefix mdw_exec_prefix=$exec_prefix
64 mdw_transform=$(echo "$program_transform_name"|sed 's,\\\\\\\\,\\\\,g; s,\\$\\$,$,g')
65 test "$prefix" = "NONE" && prefix=$ac_default_prefix
66 test "$exec_prefix" = "NONE" && exec_prefix=$prefix
67 $1
68 prefix=$mdw_prefix exec_prefix=$mdw_exec_prefix])
69
70 AC_DEFUN([mdw_PROG], [$(echo "$1"|sed "$mdw_transform")])
71 AC_DEFUN([mdw_PATH], [dnl
72 $(t="$1"; dnl
73 while :; do dnl
74 case "$t" in dnl
75 *\$[]*) t=$(eval echo "$t");; dnl
76 *) break;; dnl
77 esac; done; dnl
78 echo "$t")])
79 AC_DEFUN([mdw_DEFINE_PROG],
80 [AC_DEFINE_UNQUOTED([$1], ["mdw_PROG([$2])"],
81 [Program name for $2.])])
82 AC_DEFUN([mdw_DEFINE_PATH], [AC_DEFINE_UNQUOTED([$1], ["mdw_PATH([$2])"],
83 [Pathname for $2.])])