40 |
# We need both 'grep' and 'sed' programs, to parse script options, |
# We need both 'grep' and 'sed' programs, to parse script options, |
41 |
# and we also need 'cat', to display help and some error messages, |
# and we also need 'cat', to display help and some error messages, |
42 |
# so ensure they are all installed, before we continue. |
# so ensure they are all installed, before we continue. |
43 |
# |
# (Again, note that we first check the status from 'type', BEFORE |
44 |
CAT=`exec 2>$NULLDEV ; set :\`type cat\` ; eval echo '$'$#` |
# we attempt to use the result, because Cygwin's 'ash' uses 'stdout' |
45 |
GREP=`exec 2>$NULLDEV ; set :\`type grep\` ; eval echo '$'$#` |
# instead of 'stderr', to display its 'not found' message). |
46 |
SED=`exec 2>$NULLDEV ; set :\`type sed\` ; eval echo '$'$#` |
# |
47 |
|
CAT=':' GREP=':' SED=':' |
48 |
|
type cat >$NULLDEV 2>&1 && CAT=`set :\`type cat\` ; eval echo '$'$#` |
49 |
|
type grep >$NULLDEV 2>&1 && GREP=`set :\`type grep\` ; eval echo '$'$#` |
50 |
|
type sed >$NULLDEV 2>&1 && SED=`set :\`type sed\` ; eval echo '$'$#` |
51 |
# |
# |
52 |
# Another fundamental requirement is the 'groff' program itself; |
# Another fundamental requirement is the 'groff' program itself; |
53 |
|
# we will first perform a PATH search to locate this; however, |
54 |
# we will prefer any version existing in a specified GROFF_BIN_DIR, |
# we will prefer any version existing in a specified GROFF_BIN_DIR, |
55 |
# or, if unspecified, the installed location of 'groff' programs; |
# or, if unspecified, the installed location of 'groff' programs; |
56 |
# (we DO NOT use a PATH search, to locate 'groff'). |
# (this will override the result of the initial PATH search). |
57 |
# |
# |
58 |
GBIN=${GROFF_BIN_DIR-"@GROFF_BIN_DIR@"} |
GROFF=':' |
59 |
GROFF=`exec 2>$NULLDEV ; set :\`type $GBIN/groff\` ; eval echo '$'$#` |
type groff >$NULLDEV 2>&1 && GROFF=`set :\`type groff\` ; eval echo '$'$#` |
60 |
|
type ${GROFF_BIN_DIR="@GROFF_BIN_DIR@"}/groff >$NULLDEV 2>&1 \ |
61 |
|
&& GROFF=`set :\`type $GROFF_BIN_DIR/groff\` ; eval echo '$'$#` |
62 |
# |
# |
63 |
# If one or more of these is missing, diagnose and bail out. |
# If one or more of these is missing, diagnose and bail out. |
64 |
# |
# |
349 |
# In order to correctly resolve 'pdfmark' references, |
# In order to correctly resolve 'pdfmark' references, |
350 |
# we need to have both the 'awk' and 'diff' programs available. |
# we need to have both the 'awk' and 'diff' programs available. |
351 |
# |
# |
352 |
NO='' |
NO='' AWK=':' |
353 |
set ${GROFF_AWK_INTERPRETER-"@GROFF_AWK_INTERPRETERS@"} |
eval set ${GROFF_AWK_INTERPRETER-"@GROFF_AWK_INTERPRETERS@"} |
354 |
while test $# -gt 0 |
while test $# -gt 0 |
355 |
do |
do |
356 |
AWK=`exec 2>$NULLDEV ; set :\`type $1\` ; eval echo '$'$#` |
type $1 >$NULLDEV 2>&1 && AWK=`set :\`type $1\` ; eval echo '$'$#` |
357 |
test "$AWK" = ":" || set "$AWK" |
test "$AWK" = ":" || set "$AWK" |
358 |
shift |
shift |
359 |
done |
done |
360 |
DIFF=`exec 2>$NULLDEV ; set :\`type diff\` ; eval echo '$'$#` |
type diff >$NULLDEV 2>&1 && DIFF=`set :\`type diff\` ; eval echo '$'$#` |
361 |
test "$AWK" = ":" && echo >&2 "$NOPROG 'awk' in PATH" && NO="$NO 'awk'" |
test "$AWK" = ":" && echo >&2 "$NOPROG 'awk' in PATH" && NO="$NO 'awk'" |
362 |
test "$DIFF" = ":" && echo >&2 "$NOPROG 'diff' in PATH" && NO="$NO 'diff'" |
test "$DIFF" = ":" && echo >&2 "$NOPROG 'diff' in PATH" && NO="$NO 'diff'" |
363 |
if test -n "$NO" |
if test -n "$NO" |
443 |
# from which the PDF output will be compiled -- but before proceding further ... |
# from which the PDF output will be compiled -- but before proceding further ... |
444 |
# let's make sure we have a GhostScript interpreter to convert them! |
# let's make sure we have a GhostScript interpreter to convert them! |
445 |
# |
# |
446 |
set ${GROFF_GHOSTSCRIPT_INTERPRETER-"@GROFF_GHOSTSCRIPT_INTERPRETERS@"} |
GS=':' |
447 |
|
eval set ${GROFF_GHOSTSCRIPT_INTERPRETER-"@GROFF_GHOSTSCRIPT_INTERPRETERS@"} |
448 |
while test $# -gt 0 |
while test $# -gt 0 |
449 |
do |
do |
450 |
GS=`exec 2>$NULLDEV ; set :\`type $1\` ; eval echo '$'$#` |
type $1 >$NULLDEV 2>&1 && GS=`set :\`type $1\` ; eval echo '$'$#` |
451 |
test "$GS" = ":" || set "$GS" |
test "$GS" = ":" || set "$GS" |
452 |
shift |
shift |
453 |
done |
done |