X-Git-Url: https://git.distorted.org.uk/~mdw/runlisp/blobdiff_plain/fb2149fc2dc1d5f4936b2af31be7c7bd02f83324..d663db3ac19da1c2cd49406d53761edac2813114:/m4/mdw-define-paths.m4 diff --git a/m4/mdw-define-paths.m4 b/m4/mdw-define-paths.m4 index d3089e6..ff5dc08 100644 --- a/m4/mdw-define-paths.m4 +++ b/m4/mdw-define-paths.m4 @@ -1,46 +1,78 @@ dnl -*-autoconf-*- -dnl --- *@-mdw_DEFINE_PATHS-@* -dnl -dnl Author: Mark Wooding -dnl -dnl Synopsis: mdw_DEFINE_PATHS(CODE) -dnl -dnl Arguments: CODE = shell script code to execute -dnl -dnl Use: Fixes up various variables so that pathname defines can be -dnl defined. Within CODE, you may use the following macros: -dnl -dnl mdw_PROG(NAME) Transformed program name -dnl -dnl mdw_PATH(PATH) Expanded path (may contain variables) -dnl -dnl mdw_DEFINE_PROG(SYMBOL, PROG) -dnl Define a symbol as a transformed -dnl program name. -dnl -dnl mdw_DEFINE_PATH(SYMBOL, NAME) -dnl Define a symbol as an expanded path +### SYNOPSIS +### +### mdw_DEFINE_PATHS(BODY) +### +### mdw_PROG(PROG) +### mdw_PATH(PATH) +### mdw_DEFINE_PROG(SYMBOL, PROG) +### mdw_DEFINE_PATH(SYMBOL, PATH) +### +### DESCRIPTION +### +### This collection of macros is useful for hardcoding pathname strings +### into binary programs. +### +### Within the BODY of `mdw_DEFINE_PATHS', a number of variables are `fixed +### up' so that they can be properly expanded. The other macros are only +### really useful within this body. +### +### `mdw_PROG' expands, in the shell, to the transformed name of the +### program PROG. +### +### `mdw_PATH' expands, in the shell, to the recursive expansion of PATH, +### which should be a string containing parameter expansions. +### +### `mdw_DEFINE_PROG' is a convenience macro which defines the preprocessor +### SYMBOL to the result of `mdw_PROG(PROG)'; similarly `mdw_DEFINE_PATH' +### defines SYMBOL to the result of `mdw_PATH(PATH)'. +### +### LICENSE +### +### Copyright (c) 2002 Mark Wooding +### +### This program is free software: you can redistribute it and/or modify it +### under the terms of the GNU General Public License as published by the +### Free Software Foundation, either version 2 of the License, or (at your +### option) any later version. +### +### This program is distributed in the hope that it will be useful, but +### WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +### General Public License for more details. +### +### You should have received a copy of the GNU General Public License along +### with this program. If not, see . +### +### As a special exception, the respective Autoconf Macro's copyright owner +### gives unlimited permission to copy, distribute and modify the configure +### scripts that are the output of Autoconf when processing the Macro. You +### need not follow the terms of the GNU General Public License when using +### or distributing such scripts, even though portions of the text of the +### Macro appear in them. The GNU General Public License (GPL) does govern +### all other use of the material that constitutes the Autoconf Macro. +### +### This special exception to the GPL applies to versions of the Autoconf +### Macro released by the Autoconf Archive. When you make and distribute a +### modified version of the Autoconf Macro, you may extend this special +### exception to the GPL to apply to your modified version as well. +# serial 1 AC_DEFUN([mdw_DEFINE_PATHS], [mdw_prefix=$prefix mdw_exec_prefix=$exec_prefix -mdw_transform=`echo "$program_transform_name"|sed 's,\\\\\\\\,\\\\,g; s,\\$\\$,$,g'` +mdw_transform=$(echo "$program_transform_name"|sed 's,\\\\\\\\,\\\\,g; s,\\$\\$,$,g') test "$prefix" = "NONE" && prefix=$ac_default_prefix test "$exec_prefix" = "NONE" && exec_prefix=$prefix $1 prefix=$mdw_prefix exec_prefix=$mdw_exec_prefix]) -AC_DEFUN([mdw_PROG], [`echo "$1"|sed "$mdw_transform"`]) -AC_DEFUN([mdw_PATH], [dnl -`t="$1"; dnl -while :; do dnl -case "$t" in dnl -*\\$[]*) t=\`eval echo "$t"\`;; dnl -*) break;; dnl -esac; done; dnl -echo "$t"`]) +AC_DEFUN([mdw_PROG], [$(echo "$1" | sed "$mdw_transform")]) +AC_DEFUN([mdw_PATH], +[$(t="$1"; dnl +while :; do case "$t" in *\$[]*) eval t=\"$t\" ;; *) break ;; esac; done; dnl +echo "$t")]) AC_DEFUN([mdw_DEFINE_PROG], - [AC_DEFINE_UNQUOTED([$1], ["mdw_PROG([$2])"], - [Program name for $2.])]) -AC_DEFUN([mdw_DEFINE_PATH], [AC_DEFINE_UNQUOTED([$1], ["mdw_PATH([$2])"], - [Pathname for $2.])]) + [AC_DEFINE_UNQUOTED([$1], ["mdw_PROG([$2])"], [Program name for $2.])]) +AC_DEFUN([mdw_DEFINE_PATH], + [AC_DEFINE_UNQUOTED([$1], ["mdw_PATH([$2])"], [Pathname for $2.])])