1#! /bin/sh 2# shdeps.sh: Generate OS dependency fixups, for `groff' shell scripts 3# 4# Copyright (C) 2004, 2005 Free Software Foundation, Inc. 5# Written by Keith Marshall (keith.d.marshall@ntlworld.com) 6# 7# Invoked only by `make', as: 8# $(SHELL) shdeps.sh "$(RT_SEP)" "$(SH_SEP)" "$(bindir)" > shdeps.sed 9# 10# This file is part of groff. 11# 12# groff is free software; you can redistribute it and/or modify it under 13# the terms of the GNU General Public License as published by the Free 14# Software Foundation; either version 2, or (at your option) any later 15# version. 16# 17# groff is distributed in the hope that it will be useful, but WITHOUT ANY 18# WARRANTY; without even the implied warranty of MERCHANTABILITY or 19# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 20# for more details. 21# 22# You should have received a copy of the GNU General Public License along 23# with groff; see the file COPYING. If not, write to the Free Software 24# Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. 25 26cat << ETX 27# shdeps.sed: Script generated automatically by \`make' -- do not modify! 28 29/^$/N 30/@GROFF_BIN_PATH_SETUP@/c\\ 31ETX 32 33if [ "$1$2" = "::" ] 34then 35 # `PATH_SEPARATOR' is `:' both at `groff' run time, and in `make', 36 # implying an implementation which is completely POSIX compliant. 37 # Simply apply the `GROFF_BIN_PATH' and `PATH_SEPARATOR' values 38 # determined by `configure', in all cases. 39 40 cat << ETX 41\\ 42GROFF_RUNTIME="\${GROFF_BIN_PATH=$3}:" 43/@PATH_SEARCH_SETUP@/d 44ETX 45 46else 47 # `PATH_SEPARATOR' is NOT always `:', 48 # which suggests an implementation for a Microsoft platform. 49 # We need to choose the `GROFF_BIN_PATH' format and `PATH_SEPARATOR' 50 # which will suit the user's choice of shell. 51 # 52 # Note that some Windows users may specify the `--prefix' path 53 # using backslash characters, instead of `/', preferred by POSIX, 54 # so we will also fix that up. 55 56 POSIX_BINDIR=`echo $3 | tr '\\\\' /` 57 cat << ETX 58# (The value required is dependent on the user's choice of shell,\\ 59# and its associated POSIX emulation capabilities.)\\ 60\\ 61case "\$OSTYPE" in\\ 62 msys)\\ 63 GROFF_RUNTIME=\${GROFF_BIN_PATH="` 64 case "$POSIX_BINDIR" in 65 [a-zA-Z]:*) 66 IFS=':' 67 set -- $POSIX_BINDIR 68 case "$2" in 69 /*) POSIX_BINDIR="/$1$2" ;; 70 *) POSIX_BINDIR="/$1/$2" ;; 71 esac 72 shift 2 73 for dir 74 do 75 POSIX_BINDIR="$POSIX_BINDIR:$dir" 76 done 77 ;; 78 esac 79 echo "$POSIX_BINDIR"`"}":" ;;\\ 80 cygwin)\\ 81 : \${GROFF_BIN_PATH="\`cygpath -w '$POSIX_BINDIR'\`"}\\ 82 GROFF_RUNTIME=\`cygpath "\$GROFF_BIN_PATH"\`":" ;;\\ 83 *)\\ 84 GROFF_RUNTIME=\${GROFF_BIN_PATH="$POSIX_BINDIR"}";" ;;\\ 85esac 86ETX 87 # On Microsoft platforms, we may also need to configure 88 # the PATH search function, used in the `pdfroff' script, 89 # to use ';', instead of ':', as the PATH_SEPARATOR. 90 91 cat << ETX 92/@PATH_SEARCH_SETUP@/c\\ 93#\\ 94# This implementation is configured for a Microsoft platform.\\ 95# Thus, the default PATH_SEPARATOR is ';', although some shells may\\ 96# use the POSIX standard ':' instead. Therefore, we need to examine\\ 97# the OSTYPE environment variable, to identify which is appropriate\\ 98# to make PATH searches work correctly.\\ 99#\\ 100 case "\$OSTYPE" in\\ 101#\\ 102 msys | cygwin)\\ 103 #\\ 104 # These emulate POSIX, and use ':'\\ 105 #\\ 106 PATH_SEPARATOR=\${PATH_SEPARATOR-':'} ;;\\ 107#\\ 108 *)\\ 109 #\\ 110 # For anything else, default to ';'\\ 111 #\\ 112 PATH_SEPARATOR=\${PATH_SEPARATOR-';'} ;;\\ 113 esac 114ETX 115 116fi 117 118# eof 119