diff options
Diffstat (limited to 'support')
-rw-r--r-- | support/PORTING | 22 | ||||
-rw-r--r-- | support/SYMLINKS | 23 | ||||
-rw-r--r-- | support/bash.xbm | 59 | ||||
-rw-r--r-- | support/bashbug.sh | 84 | ||||
-rw-r--r-- | support/cat-s | 16 | ||||
-rwxr-xr-x | support/clone-bash | 95 | ||||
-rwxr-xr-x | support/cppmagic | 51 | ||||
-rwxr-xr-x | support/fixlinks | 61 | ||||
-rw-r--r-- | support/getcppsyms.c | 428 | ||||
-rwxr-xr-x | support/inpath | 19 | ||||
-rwxr-xr-x | support/install.sh | 235 | ||||
-rwxr-xr-x | support/mkdirs | 29 | ||||
-rwxr-xr-x | support/mklinks | 41 | ||||
-rwxr-xr-x | support/mkmachtype | 279 | ||||
-rwxr-xr-x | support/mksysdefs | 497 | ||||
-rwxr-xr-x | support/printenv | 11 | ||||
-rw-r--r-- | support/recho.c | 32 | ||||
-rwxr-xr-x | support/srcdir | 13 | ||||
-rwxr-xr-x | support/texi2dvi | 263 |
19 files changed, 2258 insertions, 0 deletions
diff --git a/support/PORTING b/support/PORTING new file mode 100644 index 0000000..1869472 --- /dev/null +++ b/support/PORTING @@ -0,0 +1,22 @@ +if _mkfifo cannot be found, add "-DMKFIFO_MISSING" to SYSDEP_CFLAGS in +your machine's entry in machines.h. + +If bash compiles, but hangs when executing a non-builtin, there is a +problem with the defines in your /usr/include/sys/wait.h. If you +don't have one, there is a problem in our defines. At any rate, +perhaps you have a partially POSIX system, instead of a fully +operational one. Try defining _POSIX_SOURCE just before the inclusion +of <sys/wait.h> in jobs.h, and then undefining it immediately after +the inclusion. + +Finding out if your system has something (like setpgid, for example) +You can always do "nm -o /lib/*.a | grep setpgid". If an entry for +the function appears, you have it, and you might have to link with +that library by adding "#defined REQUIRED_LIBRARIES -lfoo" to the +entry in machines.h. + +If you seem to be going around in circles, and they are related to +job control and posixness, try #undef HAVE_UNISTD_H in the entry for +your machine in machines.h. This can work by keeping unistd.h from +defining _POSIX_VERSION, which in turn prevents bash from assuming +full Posix semantics. diff --git a/support/SYMLINKS b/support/SYMLINKS new file mode 100644 index 0000000..bd36b7e --- /dev/null +++ b/support/SYMLINKS @@ -0,0 +1,23 @@ +# +# symlink map for bash source tree +# +# link name link target +# +lib/readline/doc/texindex.c ../../doc-support/texindex.c +# +lib/readline/tilde.c ../tilde/tilde.c +lib/readline/tilde.h ../tilde/tilde.h +lib/readline/posixstat.h ../posixheaders/posixstat.h +lib/readline/ansi_stdlib.h ../posixheaders/ansi_stdlib.h +lib/readline/memalloc.h ../posixheaders/memalloc.h +lib/readline/xmalloc.c ../malloc/xmalloc.c +# +lib/tilde/memalloc.h ../posixheaders/memalloc.h +# +lib/doc-support/getopt.h ../../builtins/getopt.h +# +posixstat.h lib/posixheaders/posixstat.h +ansi_stdlib.h lib/posixheaders/ansi_stdlib.h +stdc.h lib/posixheaders/stdc.h +memalloc.h lib/posixheaders/memalloc.h +filecntl.h lib/posixheaders/filecntl.h diff --git a/support/bash.xbm b/support/bash.xbm new file mode 100644 index 0000000..5c32613 --- /dev/null +++ b/support/bash.xbm @@ -0,0 +1,59 @@ +From: Simon Marshall <sm2@sequent.cc.hull.ac.uk> +Date: Wed, 8 May 91 17:15:58 +0100 +To: bug-bash@ai.mit.edu +Subject: X bitmap for bash + + Since other GNU software comes with its very own X bitmap, I + thought it was about time bash had one too & here it is! To use, + stick the stuff after my signature in a file <path>/bash.xbm. If + using a twm window manager, insert the lines: + +IconDirectory "<path>" +Icons { + "<xterm title>" "bash.xbm" +} + in your ~/.twmrc file. The <xterm title> can be a prefix, so if + you have titles "bash@machine", the prefix "bash" will do. I'm not + familiar enough with other window managers, but they should be + similar. + + If you like it, you're welcome to it... + + Simon. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#define bash_width 64 +#define bash_height 48 +static char bash_bits[] = { + 0x00, 0x60, 0x06, 0x30, 0x04, 0x00, 0x00, 0x00, 0x60, 0x98, 0x01, 0x40, + 0x03, 0x00, 0x00, 0x00, 0x19, 0x00, 0xa0, 0x80, 0x80, 0xff, 0x00, 0x00, + 0x06, 0x00, 0x1c, 0x03, 0xe1, 0x5f, 0x03, 0x00, 0x02, 0x00, 0x22, 0x0c, + 0x5d, 0xf4, 0x0e, 0x00, 0xe1, 0x02, 0x09, 0x19, 0x17, 0x91, 0x3d, 0x00, + 0xf8, 0x87, 0x40, 0x90, 0x88, 0x88, 0x6e, 0x00, 0x8e, 0x9b, 0x04, 0x62, + 0x22, 0x22, 0xd6, 0x00, 0x02, 0xee, 0x4c, 0x68, 0x44, 0x44, 0x6c, 0x01, + 0x02, 0xf8, 0xa1, 0x4a, 0x11, 0x11, 0xb1, 0x02, 0x05, 0xa0, 0x22, 0xe0, + 0x88, 0x88, 0x68, 0x03, 0x42, 0x50, 0x5d, 0x40, 0x22, 0x22, 0xa2, 0x05, + 0x11, 0x81, 0x00, 0x44, 0x44, 0x44, 0x44, 0x07, 0x02, 0x20, 0x84, 0x60, + 0x11, 0x11, 0xd1, 0x0d, 0x02, 0x0a, 0x02, 0xc0, 0x88, 0x88, 0x48, 0x0b, + 0x44, 0x40, 0x00, 0x42, 0x22, 0x22, 0xa2, 0x1d, 0x24, 0x08, 0x02, 0x64, + 0x44, 0x44, 0xc4, 0x1a, 0x08, 0x00, 0x20, 0x20, 0x11, 0x11, 0x91, 0x15, + 0x88, 0x00, 0x00, 0xe1, 0xff, 0xff, 0xff, 0x1a, 0x10, 0x08, 0x22, 0x10, + 0x00, 0x00, 0xc0, 0x15, 0x31, 0x40, 0x00, 0xf2, 0x03, 0xc0, 0xc1, 0x1a, + 0x41, 0x24, 0x48, 0x6c, 0x06, 0x80, 0xc1, 0x15, 0x82, 0x01, 0x00, 0x66, + 0x06, 0x80, 0xc1, 0x1a, 0x04, 0x22, 0x12, 0x67, 0x06, 0x80, 0xc1, 0x15, + 0x0a, 0x04, 0xe0, 0x66, 0xe6, 0xb8, 0xc7, 0x1a, 0x09, 0xf0, 0x17, 0xee, + 0xb3, 0xa5, 0xcf, 0x15, 0x30, 0x00, 0x00, 0x6e, 0x86, 0x8d, 0xcd, 0x1a, + 0x00, 0x01, 0x80, 0x67, 0xe6, 0xbd, 0xcd, 0x15, 0x00, 0x46, 0x40, 0x66, + 0xb6, 0xb1, 0xcd, 0x1a, 0x00, 0x38, 0x3c, 0x66, 0xb6, 0xa5, 0xcd, 0x15, + 0x00, 0x00, 0x02, 0xf6, 0xe3, 0x9d, 0xdd, 0x1a, 0x00, 0x04, 0x60, 0x06, + 0x00, 0x00, 0xc0, 0x15, 0x00, 0x04, 0x40, 0xfe, 0xff, 0xff, 0xff, 0x1a, + 0x00, 0x02, 0x80, 0x12, 0x11, 0x11, 0x91, 0x15, 0x00, 0x00, 0x00, 0x8a, + 0x88, 0x88, 0x88, 0x1a, 0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0xa2, 0x15, + 0x00, 0x00, 0x00, 0x46, 0x44, 0x44, 0xc4, 0x9a, 0x00, 0x00, 0x00, 0x12, + 0x11, 0x11, 0x91, 0xb5, 0x00, 0x00, 0x10, 0x8a, 0x88, 0x88, 0x88, 0xba, + 0x00, 0x00, 0x10, 0x22, 0x22, 0x22, 0xa2, 0xd5, 0x00, 0x00, 0x30, 0xc6, + 0x44, 0x44, 0xcc, 0xdf, 0x00, 0x20, 0x39, 0x96, 0x15, 0x51, 0x99, 0xf5, + 0x80, 0xf2, 0x56, 0x8b, 0x9a, 0xea, 0x9b, 0xff, 0xc1, 0xad, 0x5e, 0xaf, + 0xbb, 0xfa, 0xba, 0xdf, 0x22, 0x9b, 0xae, 0xd7, 0x54, 0x5d, 0xd7, 0xbf, + 0x3b, 0x32, 0xce, 0xff, 0xff, 0xff, 0xff, 0xab, 0xae, 0x2b, 0x59, 0xaf, + 0xd4, 0xae, 0x2e, 0xc3, 0xdd, 0x43, 0xa9, 0xd1, 0xba, 0xae, 0x2c, 0xcd}; diff --git a/support/bashbug.sh b/support/bashbug.sh new file mode 100644 index 0000000..fb5600b --- /dev/null +++ b/support/bashbug.sh @@ -0,0 +1,84 @@ +#!/bin/sh - +# +# bashbug - create a bug report and mail it to bug-bash@prep.ai.mit.edu +# +# configuration section: +# these variables are filled in by the make target in cpp-Makefile +# +MACHINE="@MACHINE@" +OS="@OS@" +CC="@CC@" +CFLAGS="@CFLAGS@" +RELEASE="@RELEASE@" +PATCHLEVEL="@PATCHLEVEL@" + +PATH=/bin:/usr/bin:usr/local/bin:$PATH +export PATH + +TEMP=/tmp/bashbug.$$ + +BUGADDR=${1-bug-bash@prep.ai.mit.edu} + +: ${EDITOR=emacs} + +trap 'rm -f $TEMP $TEMP.x; exit 1' 1 2 3 13 15 +trap 'rm -f $TEMP $TEMP.x' 0 + +UN= +if (uname) >/dev/null 2>&1; then + UN=`uname -a` +fi + +if [ -f /usr/lib/sendmail ] ; then + RMAIL="/usr/lib/sendmail" +elif [ -f /usr/sbin/sendmail ] ; then + RMAIL="/usr/sbin/sendmail" +else + RMAIL=rmail +fi + +cat > $TEMP <<EOF +From: ${USER} +To: ${BUGADDR} +Subject: [50 character or so descriptive subject here (for reference)] + +Configuration Information [Automatically generated, do not change]: +Machine: $MACHINE +OS: $OS +Compiler: $CC +Compilation CFLAGS: $CFLAGS +uname output: $UN + +Bash Version: $RELEASE +Patch Level: $PATCHLEVEL + +Description: + [Detailed description of the problem, suggestion, or complaint.] + +Repeat-By: + [Describe the sequence of events that causes the problem + to occur.] + +Fix: + [Description of how to fix the problem. If you don't know a + fix for the problem, don't include this section.] +EOF + +chmod u+w $TEMP +cp $TEMP $TEMP.x + +if $EDITOR $TEMP +then + if cmp -s $TEMP $TEMP.x + then + echo "File not changed, no bug report submitted." + exit + fi + + ${RMAIL} $BUGADDR < $TEMP || { + cat $TEMP >> $HOME/dead.bashbug + echo "$0: mail failed: report saved in $HOME/dead.bashbug" >&2 + } +fi + +exit 0 diff --git a/support/cat-s b/support/cat-s new file mode 100644 index 0000000..87ba163 --- /dev/null +++ b/support/cat-s @@ -0,0 +1,16 @@ +# This awk script is called from within Makefile to strip multiple blank +# lines from stdin. +BEGIN { newlines = 0 } +{ + if (NF == 0) + newlines = 1; + else + { + if (newlines) + { + printf "\n"; + newlines = 0; + } + print $0; + } +} diff --git a/support/clone-bash b/support/clone-bash new file mode 100755 index 0000000..89e0752 --- /dev/null +++ b/support/clone-bash @@ -0,0 +1,95 @@ +#! /bin/sh +# +# +src=src +case "$1" in +-s) shift; src=$1; shift ;; +esac + +if [ ! -d $1 ]; then + mkdir $1 +fi + +prog=`basename $0` + +echo "${prog}: creating clone of bash source tree (from $src) in $1" + +case $src in +/*) abs=yes ;; +esac + +d=${PWD-`pwd`} + +cd $1 || { echo "$0: cannot cd to $1" ; exit 1; } + +d=$d/$1 + +SUBDIRS="CWRU builtins documentation examples support tests" +LIBDIRS="malloc termcap glob readline tilde malloclib posixheaders doc-support" +CWRUDIRS="misc" + +mkdir $SUBDIRS +for i in $SUBDIRS +do + cd $i + case "$abs" in + yes) ln -s $src/$i/* . ;; + *) ln -s ../../$src/$i/* . ;; + esac + echo -n $i.. + cd .. +done +cd $d + +cd CWRU +for i in $CWRUDIRS +do + rm -f $i + mkdir $i + cd $i + case "$abs" in + yes) ln -s $src/CWRU/$i/* . ;; + *) ln -s ../../../$src/CWRU/$i/* . ;; + esac + echo -n "CWRU/$i.." + cd .. +done +cd $d + +if [ ! -d lib ] ; then + mkdir lib +fi + +cd lib +mkdir $LIBDIRS + +for i in $LIBDIRS +do + cd $i + case "$abs" in + yes) ln -s $src/lib/$i/* . ;; + *) ln -s ../../../$src/lib/$i/* . ;; + esac + echo -n "lib/$i.." + cd .. +done + +cd $d + +case "$abs" in +yes) ln -s $src/.[a-z]* . ; ln -s $src/* . 2>&1 | grep -v exists ;; +*) ln -s ../$src/.[a-z]* . ; ln -s ../$src/* . 2>&1 | grep -v exists ;; +esac + +echo -n src.. + +SPECIAL="parser-built y.tab.h y.tab.c" +for x in $SPECIAL +do + rm -f $x + cp ../$src/$x . +done + +echo special + +exit 0 diff --git a/support/cppmagic b/support/cppmagic new file mode 100755 index 0000000..b0a951c --- /dev/null +++ b/support/cppmagic @@ -0,0 +1,51 @@ +#!/bin/sh +# Return a full cpp specification, complete with system dependent flags. +# +# Syntax: cppmagic [ program-to-generate-flags [ guessed-cpp ]] +# +# If only one arg is present it is the name of a program to invoke +# which should generate -Dfoo defines. +# +# If two args are present the second arg is the name of the C +# preprocessor to use. +# +# Invoked with no args, provides a C preprocessor name and +# -traditional flag if that is appropriate. +# +# ../Makefile calls this file thusly: "cppmagic getcppsyms". +# +# Typical output: +# +# /lib/cpp -Dunix -Dm68k +# + +Cpp= + +if [ "$2" ]; then + Cpp=$2 +else + for cpp in /lib/cpp /usr/lib/cpp /usr/ccs/lib/cpp; do + if [ -f $cpp ]; then + Cpp=$cpp + fi + done + if [ "$Cpp" = "" ]; then + Cpp=cpp + fi +fi + +TRADITIONAL= +FLAGS= + +# First flag might be `-traditional' if this is Gnu Cpp. +unknown_flag=`$Cpp -traditional /dev/null 2>&1 | + egrep 'known|recognized|valid|bad|legal'` +if [ "$unknown_flag" = "" ]; then + TRADITIONAL=-traditional +fi + +if [ "$1" ]; then + FLAGS=`$1` +fi + +echo $Cpp $TRADITIONAL $FLAGS diff --git a/support/fixlinks b/support/fixlinks new file mode 100755 index 0000000..b82ca4d --- /dev/null +++ b/support/fixlinks @@ -0,0 +1,61 @@ +#! /bin/sh +# +# fixlinks - make symlinks in the bash source tree so that there is +# exactly one version of any given source file. +# +# + +SRCDIR=. +while [ $# -gt 0 ]; do + case "$1" in + -s) shift; SRCDIR=$1 ;; + -u) unfix=yes ;; + -*) echo "$0: $1: bad option" 1>&2 + echo "$0: usage: $0 [-u] [-s srcdir] [linkmap]" 1>&2 + exit 1;; + *) break ;; + esac + shift +done + +if [ ! -d $SRCDIR/builtins ]; then + echo "$0: must be run with valid -s argument or from source directory" 1>&2 + exit 1 +fi + +if [ $# -eq 0 ]; then + linkfile=$SRCDIR/support/SYMLINKS +else + linkfile=$1 +fi + +if [ ! -f "$linkfile" ]; then + echo "$0: symlink map file \`$linkfile' does not exist" + exit 1 +fi + +rm -f /tmp/z +if (ln -s /dev/null /tmp/z) >/dev/null 2>&1; then + LN="ln -s" +else + LN=ln +fi + +while read name target +do + case "$name" in + \#*) continue;; + esac + + rm -f $name + case "$unfix" in + yes) dirname=`expr "$name" ':' '^\(.*\)/[^/]*'` + [ -z "$dirname" ] && dirname=. + cp $dirname/$target $name + echo $target copied to $name ;; + *) $LN $target $name ; echo "$name -> $target" ;; + esac + +done < $linkfile + +exit 0 diff --git a/support/getcppsyms.c b/support/getcppsyms.c new file mode 100644 index 0000000..eb4c72d --- /dev/null +++ b/support/getcppsyms.c @@ -0,0 +1,428 @@ +/* getcppsyms.c - Find unique compiler symbols. */ + +/* Copyright (C) 1993 Free Software Foundation, Inc. + + This file is part of GNU Bash, the Bourne Again SHell. + + Bash 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, or (at your option) any later + version. + + Bash 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 Bash; see the file COPYING. If not, write to the Free Software + Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* Some cpp's do not define any symbols, but instead let /bin/cc do it + for them. For such machines, running this file may prove useful. It + outputs the list of symbols which /bin/cc or /lib/cpp define and which + we had the foresight to guess at. */ + +#include <stdio.h> +main () +{ +#if defined (__BSD_4_4__) + printf ("-D__BSD_4_4__"); +#endif /* __BSD_4_4__ */ +#if defined (CMU) + printf (" -DCMU"); +#endif /* CMU */ +#if defined (_COFF) + printf (" -D_COFF"); +#endif /* _COFF */ +#if defined (DGUX) + printf (" -DDGUX"); +#endif /* DGUX */ +#if defined (GOULD_PN) + printf (" -DGOULD_PN"); +#endif /* GOULD_PN */ +#if defined (MACH) + printf (" -DMACH"); +#endif /* MACH */ +#if defined (MIPSEB) + printf (" -DMIPSEB"); +#endif /* MIPSEB */ +#if defined (MIPSEL) + printf (" -DMIPSEL"); +#endif /* MIPSEL */ +#if defined (MULTIMAX) + printf (" -DMULTIMAX"); +#endif /* MULTIMAX */ +#if defined (M_UNIX) + printf (" -DM_UNIX"); +#endif /* M_UNIX */ +#if defined (M_XENIX) + printf (" -DM_XENIX"); +#endif /* M_XENIX */ +#if defined (_M_XENIX) + printf (" -D_M_XENIX"); +#endif /* _M_XENIX */ +#if defined (NeXT) + printf (" -DNeXT"); +#endif /* NeXT */ +#if defined (__PARAGON__) + printf (" -D__PARAGON__"); +#endif /* __PARAGON__ */ +#if defined (_PGC_) + printf (" -D_PGC_"); +#endif /* _PGC_ */ +#if defined (__PGC__) + printf (" -D__PGC__"); +#endif /* __PGC__ */ +#if defined (RES) + printf (" -DRES"); +#endif /* RES */ +#if defined (RISC6000) + printf (" -DRISC6000"); +#endif /* RISC6000 */ +#if defined (RT) + printf (" -DRT"); +#endif /* RT */ +#if defined (SYSTYPE_BSD) + printf (" -DSYSTYPE_BSD"); +#endif /* SYSTYPE_BSD */ +#if defined (SYSTYPE_SYSV) + printf (" -DSYSTYPE_SYSV"); +#endif /* SYSTYPE_SYSV */ +#if defined (Sun386i) + printf (" -DSun386i"); +#endif /* Sun386i */ +#if defined (Tek4132) + printf (" -DTek4132"); +#endif /* Tek4132 */ +#if defined (Tek4300) + printf (" -DTek4300"); +#endif /* Tek4300 */ +#if defined (UMAXV) + printf (" -DUMAXV"); +#endif /* UMAXV */ +#if defined (USGr4) + printf (" -DUSGr4"); +#endif /* USGr4 */ +#if defined (USGr4_2) + printf (" -DUSGr4_2"); +#endif /* USGr4_2 */ +#if defined (__SVR4_2__) + printf (" -D__SVR4_2__"); +#endif /* __SVR4_2__ */ +#if defined (Xenix286) + printf (" -DXenix286"); +#endif /* Xenix286 */ +#if defined (_AIX) + printf (" -D_AIX"); +#endif /* _AIX */ +#if defined (_AIX370) + printf (" -D_AIX370"); +#endif /* _AIX370 */ +#if defined (_IBMESA) + printf (" -D_IBMESA"); +#endif /* _IBMESA */ +#if defined (__ibmesa) + printf (" -D__ibmesa"); +#endif /* __ibmesa */ +#if defined (_U370) + printf (" -D_U370"); +#endif /* _U370 */ +#if defined (_NLS) + printf (" -D_NLS"); +#endif /* _NLS */ +#if defined (_CX_UX) + printf (" -D_CX_UX"); +#endif /* _CX_UX */ +#if defined (_IBMR2) + printf (" -D_IBMR2"); +#endif /* _IBMR2 */ +#if defined (_M88K) + printf (" -D_M88K"); +#endif /* _M88K */ +#if defined (_M88KBCS_TARGET) + printf (" -D_M88KBCS_TARGET"); +#endif /* _M88KBCS_TARGET */ +#if defined (__DGUX__) + printf (" -D__DGUX__"); +#endif /* __DGUX__ */ +#if defined (__UMAXV__) + printf (" -D__UMAXV__"); +#endif /* __UMAXV__ */ +#if defined (__m88k) + printf (" -D__m88k"); +#endif /* __m88k */ +#if defined (__uxpm__) + printf (" -DUSGr4 -Du370 -D__uxpm__"); +#endif /* __uxpm__ */ +#if defined (__uxps__) + printf (" -D__svr4__ -D__uxps__"); +#endif /* __uxps__ */ +#if defined (alliant) + printf (" -Dalliant"); +#endif /* alliant */ +#if defined (alpha) + printf (" -Dalpha"); +#endif /* alpha */ +#if defined (__alpha) + printf (" -D__alpha"); +#endif /* __alpha */ +#if defined (aix) + printf (" -Daix"); +#endif /* aix */ +#if defined (aixpc) + printf (" -Daixpc"); +#endif /* aixpc */ +#if defined (apollo) + printf (" -Dapollo"); +#endif /* apollo */ +#if defined (ardent) + printf (" -Dardent"); +#endif /* ardent */ +#if defined (att386) + printf (" -Datt386"); +#endif /* att386 */ +#if defined (att3b) + printf (" -Datt3b"); +#endif /* att3b */ +#if defined (bsd4_2) + printf (" -Dbsd4_2"); +#endif /* bsd4_2 */ +#if defined (bsd4_3) + printf (" -Dbsd4_3"); +#endif /* bsd4_3 */ +#if defined (__bsdi__) + printf (" -D__bsdi__"); +#endif /* __bsdi__ */ +#if defined (bsdi) + printf (" -Dbsdi"); +#endif /* bsdi */ +#if defined (__386BSD__) + printf (" -D__386BSD__"); +#endif /* __386BSD__ */ +#if defined (cadmus) + printf (" -Dcadmus"); +#endif /* cadmus */ +#if defined (clipper) + printf (" -Dclipper"); +#endif /* clipper */ +#if defined (concurrent) + printf (" -Dconcurrent"); +#endif /* concurrent */ +#if defined (convex) || defined (__convex__) || defined (__convexc__) +# if !defined (__GNUC__) + printf (" -pcc"); +# endif /* !__GNUC__ */ + printf (" -Dconvex"); +#endif /* convex */ +#if defined (dmert) + printf (" -Ddmert"); +#endif /* dmert */ +#if defined (gcos) + printf (" -Dgcos"); +#endif /* gcos */ +#if defined (gcx) + printf (" -Dgcx"); +#endif /* gcx */ +#if defined (gould) + printf (" -Dgould"); +#endif /* gould */ +#if defined (hbullx20) + printf (" -Dhbullx20"); +#endif /* hbullx20 */ +#if defined (hcx) + printf (" -Dhcx"); +#endif /* hcx */ +#if defined (host_mips) + printf (" -Dhost_mips"); +#endif /* host_mips */ +#if defined (hp9000) || defined (__hp9000) + printf (" -Dhp9000"); +#endif /* hp9000 || __hp9000 */ +#if defined (hp9000s200) || defined (__hp9000s200) + printf (" -Dhp9000s200"); +#endif /* hp9000s200 || __hp9000s200 */ +#if defined (hp9000s300) || defined (__hp9000s300) + printf (" -Dhp9000s300"); +#endif /* hp9000s300 || __hp9000s300 */ +#if defined (hp9000s500) || defined (__hp9000s500) + printf (" -Dhp9000s500"); +#endif /* hp9000s500 || __hp9000s500 */ +#if defined (hp9000s700) || defined (__hp9000s700) + printf (" -Dhp9000s700"); +#endif /* hp9000s700 || __hp9000s700 */ +#if defined (hp9000s800) || defined (__hp9000s800) + printf (" -Dhp9000s800"); +#endif /* hp9000s800 || __hp9000s800 */ +#if defined (hppa) || defined (__hppa) + printf (" -Dhppa"); +#endif /* hppa || __hppa */ +#if defined (hpux) || defined (__hpux) + printf (" -Dhpux"); +#endif /* hpux */ +#if defined (__hp_osf) + printf (" -D__hp_osf"); +#endif /* __hp_osf */ +#if defined (i386) + printf (" -Di386"); +#endif /* i386 */ +#if defined (__i386__) + printf (" -D__i386__"); +#endif +#if defined (__i860) + printf(" -D__i860"); +#endif /* __i860 */ +#if defined (__i860__) + printf(" -D__i860__"); +#endif /* __i860__ */ +#if defined (ibm) + printf (" -Dibm"); +#endif /* ibm */ +#if defined (ibm032) + printf (" -Dibm032"); +#endif /* ibm032 */ +#if defined (ibmrt) + printf (" -Dibmrt"); +#endif /* ibmrt */ +#if defined (interdata) + printf (" -Dinterdata"); +#endif /* interdata */ +#if defined (is68k) + printf (" -Dis68k"); +#endif /* is68k */ +#if defined (ksr1) + printf (" -Dksr1"); +#endif /* ksr1 */ +#if defined (__ksr1__) + printf (" -D__ksr1__"); +#endif /* __ksr1__ */ +#if defined (linux) + printf (" -Dlinux"); +#endif /* linux */ +#if defined (__linux__) + printf (" -D__linux__"); +#endif /* __linux__ */ +#if defined (luna88k) + printf (" -Dluna88k"); +#endif /* luna88k */ +#if defined (m68k) + printf (" -Dm68k"); +#endif /* m68k */ +#if defined (m88k) + printf (" -Dm88k"); +#endif /* m88k */ +#if defined (mc68010) + printf (" -Dmc68010"); +#endif /* mc68010 */ +#if defined (mc68020) + printf (" -Dmc68020"); +#endif /* mc68020 */ +#if defined (mc68030) + printf (" -Dmc68030"); +#endif /* mc68030 */ +#if defined (mc68040) + printf (" -Dmc68040"); +#endif /* mc68040 */ +#if defined (mc68k32) + printf (" -Dmc68k32"); +#endif /* mc68k32 */ +#if defined (mips) + printf (" -Dmips"); +#endif /* mips */ +#if defined (n16) + printf (" -Dn16"); +#endif /* n16 */ +#if defined __nonstopux + printf (" -D__nonstopux"); +#endif +#if defined (ns32000) + printf (" -Dns32000"); +#endif /* ns32000 */ +#if defined (os) + printf (" -Dos"); +#endif /* os */ +#if defined (osf) + printf (" -Dosf"); +#endif /* osf */ +#if defined (__osf__) + printf (" -D__osf__"); +#endif /* __osf__ */ +#if defined (__OSF1__) + printf(" -D__OSF1__"); +#endif /* __OSF1__ */ +#if defined (pdp11) + printf (" -Dpdp11"); +#endif /* pdp11 */ +#if defined (plexus) + printf (" -Dplexus") +#endif /* plexus */ +#if defined (pyr) + printf (" -Dpyr"); +#endif /* pyr */ +#if defined (scs) + printf (" -Dscs"); +#endif /* scs */ +#if defined (sequent) + printf (" -Dsequent"); +#endif /* sequent */ +#if defined (sgi) + printf (" -Dsgi"); +#endif /* sgi */ +#if defined (sony) + printf (" -Dsony"); +#endif /* sony */ +#if defined (sparc) + printf (" -Dsparc"); +#endif /* sparc */ +#if defined (stardent) + printf (" -Dstardent"); +#endif /* stardent */ +#if defined (sun) + printf (" -Dsun"); +#endif /* sun */ +#if defined (sun2) + printf (" -Dsun2"); +#endif /* sun2 */ +#if defined (sun3) + printf (" -Dsun3"); +#endif /* sun3 */ +#if defined (sun4) + printf (" -Dsun4"); +#endif /* sun4 */ +#if defined (__svr4__) + printf (" -D__svr4__"); +#endif /* __svr4__ */ +#if defined (tower32) + printf (" -Dtower32"); +#endif /* tower32 */ +#if defined (tss) + printf (" -Dtss"); +#endif /* tss */ +#if defined (u370) + printf (" -Du370"); +#endif /* u370 */ +#if defined (u3b) + printf (" -Du3b"); +#endif /* u3b */ +#if defined (u3b2) + printf (" -Du3b2"); +#endif /* u3b2 */ +#if defined (u3b20d) + printf (" -Du3b20d"); +#endif /* u3b20d */ +#if defined (u3b5) + printf (" -Du3b5"); +#endif /* u3b5 */ +#if defined (ultrix) + printf (" -Dultrix"); +#endif /* ultrix */ +#if defined (unix) + printf (" -Dunix"); +#endif /* unix */ +#if defined (vax) + printf (" -Dvax"); +#endif /* vax */ + + printf ("\n"); + exit (0); +} diff --git a/support/inpath b/support/inpath new file mode 100755 index 0000000..95f28bc --- /dev/null +++ b/support/inpath @@ -0,0 +1,19 @@ +#! /bin/sh +# +# Search $PATH for a file the same name as $1; return TRUE if found. +# + +command=$1 +[ -n "$command" ] || exit 1 + +set `echo $PATH | sed 's/^:/.:/ + s/::/:.:/g + s/:$/:./ + s/:/ /g'` + +while [ $# -ne 0 ] ; do + [ -f $1/$command ] && exit 0 # test -x not universal + shift +done + +exit 1 diff --git a/support/install.sh b/support/install.sh new file mode 100755 index 0000000..ea88212 --- /dev/null +++ b/support/install.sh @@ -0,0 +1,235 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5. +# +# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $ +# +# This script is compatible with the BSD install script, but was written +# from scratch. +# + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +tranformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/support/mkdirs b/support/mkdirs new file mode 100755 index 0000000..52228d1 --- /dev/null +++ b/support/mkdirs @@ -0,0 +1,29 @@ +#! /bin/sh +# +# mkdirs - a work-alike for `mkdir -p' +# +# Chet Ramey +# chet@po.cwru.edu + +for dir +do + + [ -d "$dir" ] && continue + + tomake=$dir + while [ "$dir" ]; do + # dir=${dir%/*} + # dir=`expr "$dir" ':' '^\(/.*\)/[^/]*'` + dir=`expr "$dir" ':' '^\(.*\)/[^/]*'` + tomake="$dir $tomake" + done + + for d in $tomake + do + [ -d $d ] && continue + echo mkdir $d + mkdir $d + done +done + +exit 0 diff --git a/support/mklinks b/support/mklinks new file mode 100755 index 0000000..612aa99 --- /dev/null +++ b/support/mklinks @@ -0,0 +1,41 @@ + +# Yet another script which requires an already built Bash. +# +# This makes links in the current directory to the directory specified as +# the first argument. +# + +topdir=$1 + +if [ ! "$topdir" ]; then + echo "No directory specified. Read the script $0." + exit 1 +fi + +function clone_files () +{ + local dir=$1; + local files; + + files=$(cd $dir; echo *); + + if [ ! "$files" ]; then + return 0; + fi + + for filename in $files; do + if [ -d $dir/$filename ]; then + # If the file to clone is this directory, then skip it. + if [ $(cd $dir/$filename; pwd) = $(pwd) ]; then + continue; + fi + mkdir $filename; + (cd $filename; clone_files ../$dir/$filename) + else + ln -s $dir/$filename .; + fi + done + rm -f \#* *~ .*~ *.bak .*.bak *.tmp .*.tmp *.o core a.out; +} + +clone_files $topdir diff --git a/support/mkmachtype b/support/mkmachtype new file mode 100755 index 0000000..00b7403 --- /dev/null +++ b/support/mkmachtype @@ -0,0 +1,279 @@ +#!/bin/sh +# This script attempts to guess a canonical system name. +# Copyright (C) 1992, 1993 Free Software Foundation, Inc. +# +# This file 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, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit system type (host/target name). +# +# Only a few systems have been added to this list; please add others +# (but try to keep the structure clean). +# + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + alpha:OSF1:1.*:*) + # 1.2 uses "1.2" for uname -r. + echo alpha-dec-osf${UNAME_RELEASE} + exit 0 ;; + alpha:OSF1:V1.*:*) + # 1.3 uses "V1.3" for uname -r. + echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^V//'` + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + sun4*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + echo sparc-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + mips:*:5*:RISCos) + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + echo m88k-dg-dgux${UNAME_RELEASE} + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + *:IRIX:*:*) + echo mips-sgi-irix${UNAME_RELEASE} + exit 0 ;; + i[34]86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + *:AIX:2:3) + echo rs6000-ibm-aix3.2 + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/31?:HP-UX:*:*) + echo m68000-hp-hpux + exit 0 ;; + 9000/[34]??:HP-UX:*:*) + echo m68k-hp-hpux + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/7??:HP-UX:*:* | 9000/8?7:HP-UX:*:* ) + echo hppa1.1-hp-hpux + exit 0 ;; + 9000/8??:HP-UX:*:*) + echo hppa1.0-hp-hpux + exit 0 ;; + 3050*:HI-UX:*:*) + sed 's/^ //' << EOF >dummy.c + #include <unistd.h> + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?7:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + C1*:ConvexOS:*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:*) + echo c2-convex-bsd + exit 0 ;; + CRAY*X-MP:UNICOS:*:*) + echo xmp-cray-unicos + exit 0 ;; + CRAY*Y-MP:UNICOS:*:*) + echo ymp-cray-unicos + exit 0 ;; + CRAY-2:UNICOS:*:*) + echo cray2-cray-unicos + exit 0 ;; + hp3[0-9][05]:NetBSD:*:*) + echo m68k-hp-netbsd${UNAME_RELEASE} + exit 0 ;; + i[34]86:NetBSD:*:*) + echo ${UNAME_MACHINE}-unknown-netbsd${UNAME_RELEASE} + exit 0 ;; + i[34]86:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux + exit 0 ;; + i[34]86:UNIX_SV:4.*:*) + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE} + else + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + i[34]86:*:3.2:*) + if /bin/uname -X 2>/dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + echo ${UNAME_MACHINE}-unknown-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-unknown-sysv3.2 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M680[234]0:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:*) + uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m680[234]0:LynxOS:2.2*:*) + echo m68k-lynx-lynxos${UNAME_RELEASE} + exit 0 ;; + i[34]86:LynxOS:2.2*:*) + echo i386-lynx-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.2*:*) + echo sparc-lynx-lynxos${UNAME_RELEASE} + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +cat >dummy.c <<EOF +main() +{ +#if defined (sony) +#if defined (MIPSEB) +#else + printf("m68k-sony-newsos\n"); exit(0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf("arm-acorn-riscix"); exit (0); +#endif + +#if defined(hp300) && !defined(hpux) + printf("m68k-hp-bsd\n"); exit(0); +#endif + +#if defined(NeXT) + printf("m68k-next-bsd\n"); exit(0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf("ns32k-encore-sysv\n"); exit(0); +#else +#if defined (CMU) + printf("ns32k-encore-mach\n"); exit(0); +#else + printf("ns32k-encore-bsd\n"); exit(0); +#endif +#endif +#endif + +#if defined(__386BSD__) || (defined(__bsdi__) && defined(__i386__)) + printf("i386-unknown-bsd\n"); exit(0); +#endif + +#if defined(sequent) +#if defined(i386) + printf("i386-sequent-dynix\n"); exit(0); +#endif +#if defined (ns32000) + printf("ns32k-sequent-dynix\n"); exit(0); +#endif +#endif + +#if defined(_SEQUENT_) + printf("i386-sequent-ptx\n"); exit(0); +#endif + + exit (1); +} +EOF + +${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 +rm -f dummy.c dummy + +#echo '(Unable to guess system type)' 1>&2 + +exit 1 diff --git a/support/mksysdefs b/support/mksysdefs new file mode 100755 index 0000000..37b188e --- /dev/null +++ b/support/mksysdefs @@ -0,0 +1,497 @@ +#!/bin/sh +# +# This file creates a file called "sysdefs.h" which contains CPP defines +# helping to describe the operating system features. We just take guesses +# by looking at random files. + +# Removes any inherited definitions. +SYSDEF= +MAKE_ANSI= + +while [ $# -gt 0 ]; do + case "$1" in + -s) shift; srcdir=$1; shift ;; + -i) shift; incdir="$1"; shift ;; + -A) shift; MAKE_ANSI=true ;; + *) break ;; + esac +done + +if [ -n "$1" ]; then + sysdefs=$1 +else + sysdefs=./sysdefs.h +fi + +if [ -z "$srcdir" ]; then + srcdir=. +fi + +rm -f $sysdefs + +echo "/* sysdefs.h -- #defines for your system created by $0." >>$sysdefs +echo " Do NOT EDIT this file, since any changes will disappear." >>$sysdefs +echo " Instead, edit $0, or config.h, or machines.h. */" >>$sysdefs +echo "" >>$sysdefs +echo "#if !defined (_SYSDEFS_H_)" >>$sysdefs +echo "# define _SYSDEFS_H_" >>$sysdefs + +# was if [ -f /usr/bin/uname ] || [ -f /bin/uname ] +if ( uname >/dev/null 2>&1 ) 2>/dev/null +then + UNAME=`uname` + UNAME_R=`uname -r 2>/dev/null` + UNAME_M=`uname -m 2>/dev/null` + UNAME_V=`uname -v 2>/dev/null` + UNAME_S=`uname -s 2>/dev/null` + RELEASE=`expr "$UNAME_R" : '[^0-9]*\([0-9]*\)'` + case "$RELEASE" in + "") RELEASE=0 ;; + *) RELEASE=`expr "$RELEASE" + 0` ;; + esac + LEVEL=`expr "$UNAME_R" : '[^0-9]*[0-9]*.\([0-9]*\)'` +fi + +# check for versions of SunOS and BSD/OS +case "${UNAME}${RELEASE}" in +SunOS4*) SYSDEF=SunOS4 ;; +SunOS5*) SYSDEF=SunOS5 ;; +BSD/OS2*) SYSDEF=BSDI2 ;; +esac + +# Test for NeXT +if [ -d /NextLibrary ]; then + MAKE_ANSI=true +fi + +# Intel Paragon +case "$UNAME_M" in +paragon) MAKE_ANSI=true ;; +esac + +# Test for shared libraries (this is pretty sVr4ish). +if [ -f /usr/ccs/lib/libc.so ]; then + SYSDEF=USGr4 +fi + +# Some versions of i386 SVR4.2 make `uname' equivalent to `uname -n', which +# is contrary to all other versions of uname +if [ -n "$UNAME" ] && [ "$UNAME_S" != "$UNAME" ] && [ "$UNAME_S" = UNIX_SV ]; then + UNAME=UNIX_SV +fi + +# (sound of teeth grinding...) +if [ "$UNAME" = "UNIX_SV" ] && [ "$UNAME_R" != "4.2" ] && [ "$RELEASE"."$LEVEL" = "4.2" ]; then + UNAME_R="4.2" +fi + +# another check for SVR4 on 386 or 486 machines +case "${UNAME_M}:${UNAME}:${UNAME_R}" in +i[34]86:UNIX_SV:4.*) SYSDEF=USGr4 ;; +esac + +# A check for Mips RISCos +case "$UNAME_V" in +UMIPS|RISCos) SYSDEF=RISCos_${RELEASE}_${LEVEL} ;; +esac + +# A check for Amdahl UTS +case "$UNAME" in +uts) SYSDEF=UTS ;; +esac + +# Look for an error message when trying to exec bison. If we find +# what we're looking for, then we don't have it. If we get something +# else (like an error message about no grammar file), then we have +# it. +HAVE_BISON= +if ( cd /tmp ; bison /dev/null 2>&1 >/dev/null | grep 'no input grammar' >/dev/null 2>&1 ) 2>/dev/null +then + HAVE_BISON=yes +fi + +# Try to locate ranlib. I think this is a bad idea. +if sh ${srcdir}/support/inpath ranlib; then + RANLIB_LOCATION=ranlib +elif [ -f /usr/bin/ranlib ]; then + RANLIB_LOCATION=/usr/bin/ranlib; +elif [ -f /bin/ranlib ]; then + RANLIB_LOCATION=/bin/ranlib; +elif [ -f /usr/local/bin/ranlib ]; then + RANLIB_LOCATION=/usr/local/bin/ranlib; +elif [ -f /usr/local/gnubin/ranlib ]; then + RANLIB_LOCATION=/usr/local/gnubin/ranlib; +else + RANLIB_LOCATION=: # XXX +fi + +if [ -n "${RANLIB_LOCATION}" ]; then + echo "" >>$sysdefs + echo "#if !defined (RANLIB_LOCATION)" >>$sysdefs + echo "# define RANLIB_LOCATION ${RANLIB_LOCATION}" >>$sysdefs + echo "#endif /* RANLIB_LOCATION */" >>$sysdefs +fi + +# +# Is this a Xenix system? +# +if [ -f /xenix ]; then + SYSDEF="Xenix" + case "`/bin/uname -p`" in + *286) SYSDEF="Xenix286" ;; + *386) SYSDEF="Xenix386" ;; + esac + + # make sure that `i386' is defined for machines.h + if [ "$SYSDEF" = "Xenix386" ]; then + echo "" >>$sysdefs + echo "#if !defined (i386)" >>$sysdefs + echo "# define i386" >>$sysdefs + echo "#endif /* !i386 */" >>$sysdefs + fi + + # Pass the release number of the OS through to the machine descriptions + # in machines.h. + if [ -f /etc/perms/soft ]; then + rel=`grep rel= /etc/perms/soft` + case "$rel" in + *2.2.*) XREL=XENIX_22 ;; + *2.3.*) XREL=XENIX_23 ;; + *3.2.*) XREL=XENIX_32 ;; + *) XREL= ;; + esac + + if [ "$XREL" ]; then + echo "" >>$sysdefs + echo "#if !defined ($XREL)" >>$sysdefs + echo "# define $XREL" >>$sysdefs + echo "#endif /* !$XREL */" >>$sysdefs + fi + fi +fi + +# +# Is this some kind of Sys Vish system? +# +if [ -f /unix ]; then + if [ -d /generic ]; then # This is an AIX system. + SYSDEF="aixpc" + MAKE_ANSI=true + elif [ -d /etc/conf/kconfig.d ] && [ -f /usr/include/sys/limits.h ]; then + SYSDEF="isc386" # This is a 386 running ISC? + ISCREL="ISC_$RELEASE" + echo "#if !defined ($ISCREL)" >>$sysdefs + echo "# define $ISCREL" >>$sysdefs + echo "#endif /* $ISCREL */" >>$sysdefs + elif [ -f /etc/xlc.cfg ]; then + if fgrep _IBMR2 /etc/xlc.cfg >/dev/null 2>&1; then + SYSDEF=RISC6000 + MAKE_ANSI=true + fi + elif [ -f /bin/4d -a -f /bin/uname ]; then + case "$UNAME_R" in + 3.*) SYSDEF="Irix3" ;; + 4.*) SYSDEF="Irix4" ;; + 5.*) SYSDEF="Irix5" ;; + 6.*) SYSDEF="Irix6" ;; + *) SYSDEF="Irix3" ;; + esac + elif [ -d /usr/amiga ]; then + SYSDEF="amiga" # An Amiga running V.4. + elif [ -f /bin/fxc.info ]; then + SYSDEF="alliant" + fi +fi + +# Is this a Unicos system? +if [ -f /unicos ]; then + MAKE_ANSI=true + UnicosMachine= + + # Test for the variaous flavors of Cray machines. + if [ -x /bin/cray1 ] && /bin/cray1 2>/dev/null; then + UnicosMachine=Cray1 + fi + + if [ -x /bin/cray2 ] && /bin/cray2 2>/dev/null; then + UnicosMachine=Cray2 + fi + + if [ -x /bin/crayxmp ] && /bin/crayxmp 2>/dev/null; then + UnicosMachine=CrayXMP + fi + if [ -x /bin/crayymp ] && /bin/crayymp 2>/dev/null; then + UnicosMachine=CrayYMP + fi + + if [ "$UnicosMachine" ]; then + echo "#if !defined ($UnicosMachine)" >>$sysdefs + echo "# define $UnicosMachine" >>$sysdefs + echo "#endif /* !$UnicosMachine */" >>$sysdefs + fi +fi + +# Is this (and what kind of) a HPUX system? +if [ -f /hp-ux ]; then + SYSDEF=HPUX_${RELEASE} + if [ "$RELEASE" = 6 -a "$LEVEL" -lt 2 ]; then + SYSDEF=HPUX_USG + fi +fi + +if [ "$SYSDEF" = "" ]; then + case "$UNAME_M" in + ESA) SYSDEF=AIXESA ;; + XD88*) SYSDEF=XD88 ;; + M88100) SYSDEF=M88100 ;; # Motorola Delta 88K + esac +fi + +if [ "$SYSDEF" = "" ]; then + case "$UNAME_V" in + V[0-9]*L[0-9]*) SYSDEF=UXP ;; # Fujitsu DS/90 + esac +fi + +# What release of SCO Unix is this? +if [ "$SYSDEF" = "" -a -f /bin/uname ]; then + case `/bin/uname -X 2>/dev/null | grep '^Release' 2>/dev/null` in + *3.2v4.*) SYSDEF=SCOv4 ;; + *3.2v5.*) SYSDEF=SCOv5 ;; + *) SYSDEF=SCO ;; + esac +fi + +# +# Default to cadmus for unknown SysVish systems +# +if [ -f /unix ] && [ "$SYSDEF" = "" ]; then + SYSDEF="cadmus" +fi + +if [ "$SYSDEF" != "" ]; then + echo "" >>$sysdefs + echo "#if !defined ($SYSDEF)" >>$sysdefs + echo "# define $SYSDEF" >>$sysdefs + echo "#endif /* $SYSDEF */" >>$sysdefs +fi + +# Now look for certain include files in a list of directories +# Poor substitute for autoconf + +# Add any other directories where include files are found to this list or +# create another case +if [ -n "$incdir" ]; then + dirlist="$incdir" +else + case "$SYSDEF" in + RISCos*) dirlist="/bsd43/usr/include";; + *) dirlist="/usr/include /usr/include/bsd /usr/include/ansi" ;; + esac +fi + +# Code fragment to be executed to find a particular include file. Make sure +# to set `file' to the pathname of the file you want, relative to /usr/include, +# before calling `eval $findf'. +findf=" +found=''; +for d in \$dirlist; +do + if test -f \$d/\$file; + then + found=yes; + break; + fi; +done +" + +found= +file=sys/stream.h +eval $findf +if [ -n "$found" ]; then + echo "" >>$sysdefs + echo "#if !defined (HAVE_SYS_STREAM_H)" >>$sysdefs + echo "# define HAVE_SYS_STREAM_H" >>$sysdefs + echo "#endif /* HAVE_SYS_STREAM_H */" >>$sysdefs +fi + +found= +file=sys/ptem.h +eval $findf +if [ -n "$found" ]; then + echo "" >>$sysdefs + echo "#if !defined (HAVE_SYS_PTEM_H)" >>$sysdefs + echo "# define HAVE_SYS_PTEM_H" >>$sysdefs + echo "#endif /* HAVE_SYS_PTEM_H */" >>$sysdefs +fi + +file=sys/pte.h +eval $findf +if [ -n "$found" ]; then + echo "" >>$sysdefs + echo "#if !defined (HAVE_SYS_PTE_H)" >>$sysdefs + echo "# define HAVE_SYS_PTE_H" >>$sysdefs + echo "#endif /* HAVE_SYS_PTE_H */" >>$sysdefs +fi + +file=sys/wait.h +eval $findf +if [ -n "$found" ]; then + echo "" >>$sysdefs + echo "#if !defined (HAVE_WAIT_H)" >>$sysdefs + echo "# define HAVE_WAIT_H" >>$sysdefs + echo "#endif /* HAVE_WAIT_H */" >>$sysdefs +fi + +file=sys/resource.h +eval $findf +if [ -n "$found" ]; then + echo "" >>$sysdefs + echo "#if !defined (HAVE_RESOURCE)" >>$sysdefs + echo "# define HAVE_RESOURCE" >>$sysdefs + echo "#endif /* HAVE_RESOURCE */" >>$sysdefs +fi + +file=sys/param.h +eval $findf +if [ -n "$found" ]; then + echo "" >>$sysdefs + echo "#if !defined (HAVE_SYS_PARAM)" >>$sysdefs + echo "# define HAVE_SYS_PARAM" >>$sysdefs + echo "#endif /* HAVE_SYS_PARAM */" >>$sysdefs +fi + +file=unistd.h +eval $findf +if [ -n "$found" ]; then + echo "" >>$sysdefs + echo "#if !defined (HAVE_UNISTD_H)" >>$sysdefs + echo "# define HAVE_UNISTD_H" >>$sysdefs + echo "#endif /* HAVE_UNISTD_H */" >>$sysdefs +fi + +file=stdlib.h +eval $findf +if [ -n "$found" ]; then + echo "" >>$sysdefs + echo "#if !defined (HAVE_STDLIB_H)" >>$sysdefs + echo "# define HAVE_STDLIB_H" >>$sysdefs + echo "#endif /* HAVE_STDLIB_H */" >>$sysdefs +fi + +file=limits.h +eval $findf +if [ -n "$found" ]; then + echo "" >>$sysdefs + echo "#if !defined (HAVE_LIMITS_H)" >>$sysdefs + echo "# define HAVE_LIMITS_H" >>$sysdefs + echo "#endif /* HAVE_LIMITS_H */" >>$sysdefs +fi + +file=alloca.h +eval $findf +if [ -f /usr/include/alloca.h ]; then + echo "" >>$sysdefs + echo "#if !defined (HAVE_ALLOCA_H)" >>$sysdefs + echo "# define HAVE_ALLOCA_H" >>$sysdefs + echo "#endif /* HAVE_ALLOCA_H */" >>$sysdefs +fi + +file=dirent.h +eval $findf +if [ -n "$found" ]; then + echo "" >>$sysdefs + echo "#if !defined (HAVE_DIRENT_H)" >>$sysdefs + echo "# define HAVE_DIRENT_H" >>$sysdefs + echo "#endif /* HAVE_DIRENT_H */" >>$sysdefs +fi + +file=string.h +eval $findf +if [ -n "$found" ]; then + echo "" >>$sysdefs + echo "#if !defined (HAVE_STRING_H)" >>$sysdefs + echo "# define HAVE_STRING_H" >>$sysdefs + echo "#endif /* HAVE_STRING_H */" >>$sysdefs +fi + +file=varargs.h +eval $findf +if [ -n "$found" ]; then + echo "" >>$sysdefs + echo "#if !defined (HAVE_VARARGS_H)" >>$sysdefs + echo "# define HAVE_VARARGS_H" >>$sysdefs + echo "#endif /* HAVE_VARARGS_H */" >>$sysdefs +fi + +# Does the system have a /dev/fd directory? +if [ -d /dev/fd ]; then + echo "" >>$sysdefs + echo "#if !defined (HAVE_DEV_FD)" >>$sysdefs + echo "# define HAVE_DEV_FD" >>$sysdefs + echo "#endif /* HAVE_DEV_FD */" >>$sysdefs +fi + +# Is this SVR4.2? It's subtly different from USGr4 +if [ "$UNAME" = "UNIX_SV" ] && [ "$UNAME_R" = "4.2" ]; then + echo "" >>$sysdefs + echo "#if !defined (USGr4_2)" >>$sysdefs + echo "# define USGr4_2" >>$sysdefs + echo "#endif /* USGr4_2 */" >>$sysdefs +fi + +# Is this AIX PS/2 1.3? Yuck. +if [ "$UNAME" = "AIX" ] && [ "$UNAME_V" = "1" ] && [ "$RELEASE" = "3" ]; then + case "$UNAME_M" in + i386|i486) + echo "" >>$sysdefs + echo "#if !defined (AIX_13)" >>$sysdefs + echo "# define AIX_13" >>$sysdefs + echo "#endif /* AIX_13 */" >>$sysdefs + ;; + esac +fi + +if [ -n "$HAVE_BISON" ]; then + echo "" >>$sysdefs + echo "#if !defined (HAVE_BISON)" >>$sysdefs + echo "# define HAVE_BISON" >>$sysdefs + echo "#endif /* HAVE_BISON */" >>$sysdefs +fi + +# Functions to test for a la autoconf +# getwd +# getcwd +# strchr +# strcasecmp +# getgroups +# setlinebuf +# strerror +# vfprintf +# bcopy +# getdtablesize +# setdtablesize +# alloca +# gethostname +# memmove (missing) +# mkfifo (missing) +# +# Other things to test +# opendir robustness +# dup2 working +# void sighandler +# sys_siglist[] +# uid_t, gid_t +# have_getpw_decls +# reversed setvbuf args +# int getgroups + +# If this system's cpp might not like `/**/#' in cpp-Makefile, make an +# alternate ansi-style cpp-Makefile. +if [ -n "$MAKE_ANSI" ]; then + grep -v '/\*\*/' ${srcdir}/cpp-Makefile >ansi-Makefile +fi + +# These should be the last 2 lines in this file! +echo "" >>$sysdefs +echo "#endif /* _SYSDEFS_H_ */" >>$sysdefs diff --git a/support/printenv b/support/printenv new file mode 100755 index 0000000..8aebd43 --- /dev/null +++ b/support/printenv @@ -0,0 +1,11 @@ +#! /bin/sh - + +if [ $# -eq 0 ]; then + env + exit +elif eval [ "\${$1-unset}" = "unset" ]; then + exit 1 +else + eval echo \$$1 + exit 0 +fi diff --git a/support/recho.c b/support/recho.c new file mode 100644 index 0000000..b9dc00b --- /dev/null +++ b/support/recho.c @@ -0,0 +1,32 @@ +#include <stdio.h> + +main(argc, argv) +int argc; +char **argv; +{ + register int i; + + for (i = 1; i < argc; i++) { + printf("argv[%d] = <", i); + strprint(argv[i]); + printf(">\n"); + } +} + +strprint(str) +char *str; +{ + register char *s; + int c; + + for (s = str; s && *s; s++) { + if (*s < ' ') { + putchar('^'); + putchar(*s+64); + } else if (*s == 127) { + putchar('^'); + putchar('?'); + } else + putchar(*s); + } +} diff --git a/support/srcdir b/support/srcdir new file mode 100755 index 0000000..9d8ccd7 --- /dev/null +++ b/support/srcdir @@ -0,0 +1,13 @@ +#! /bin/sh +# +# srcdir - print out the absolute pathname of the top of the bash source +# tree. Used for getting the right value to makes in subdirectories +# + +case "$1" in +'.'|./) pwd ;; +./*|..*) echo `pwd`/"$1" ;; +*) echo "$1" ;; +esac + +exit 0 diff --git a/support/texi2dvi b/support/texi2dvi new file mode 100755 index 0000000..12281e5 --- /dev/null +++ b/support/texi2dvi @@ -0,0 +1,263 @@ +#!/bin/sh +# texi2dvi -- smartly produce DVI files from texinfo sources +# +# Copyright (C) 1992, 1993 Free Software Foundation. +# +# 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, 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, you can either send email to this +# program's author (see below) or write to: +# +# Free Software Foundation, Inc. +# 675 Mass Ave. +# Cambridge, MA 02139, USA. +# +# Please send bug reports, etc. to bug-texinfo@prep.ai.mit.edu +# If possible, please send a copy of the output of the script called with +# the `--debug' option when making a bug report. +# +# Version 0.4 +# Last modified 26-Mar-93 +# + +# Please note that in the interest of general portability, some common +# bourne shell constructs were avoided because they weren't guaranteed to +# be available in some earlier implementations. I've tried to make this as +# portable as possible. +# +# Among the more interesting lossages I noticed with some bourne shells +# are: +# 1) Some don't have an `unset' builtin +# 2) In some implementations the `shift' builtin can't take a +# numerical argument. + +progname=`basename $0` + +usage="Usage: ${progname} {-D} {-h} [file1] {file2} {...} + {--debug} {--help} + + Options in braces are optional. Those in brackets are required. +" + +if test $# -eq 0 ; then + echo "${usage}" 1>&2; + exit 1 +fi + +backup_extension=".bak" +texindex="texindex" +tex="tex" +bq="\`" # To prevent hairy quoting and escaping later. +eq="'" +orig_pwd="`pwd`" + +if test "z${TEXINDEX}" != "z" ; then + texindex="${TEXINDEX}" +fi + +if test "z${TEX}" != "z" ; then + tex="${TEX}" +fi + +# Save this so we can construct a new TEXINPUTS path for each file to be +# processed. +TEXINPUTS_orig="${TEXINPUTS}" +export TEXINPUTS + +# Parse command line options + +# "unset" option variables to make sure they weren't accidentally +# exported +debug="" + +# If you add new commands be sure to change the wildcards below to make +# sure they are unambiguous (i.e. only match one possible long option) +# Be sure to show at least one instance of the full long option name to +# document what the long option is canonically called. +while test $# -gt 0 ; do + case z$1 in + z-D | z--debug | z--d* ) + debug="t" + shift + ;; + z-h | z--help | z--h* ) + echo "${usage}" 1>&2 + exit 1 + ;; + z-- ) + shift + break + ;; + z-* ) + echo "${progname}: ${bq}${1}${eq} is not a valid option." 1>&2 + echo "" 1>&2 + echo "${usage}" 1>&2 + exit 1 + ;; + * ) + break + ;; + esac +done + +# See if there are any command line args left (which will be interpreted as +# filename arguments) +if test $# -eq 0 ; then + echo "${progname}: at least one file name is required as an argument." 1>&2 + echo "" 1>&2 + echo "${usage}" 1>&2 + exit 1 +fi + +test "z${debug}" = "zt" && set -x + +# Texify files +for command_line_filename in ${1+"$@"} ; do + # Roughly equivalent to `dirname ...`, but more portable + directory="`echo ${command_line_filename} | sed 's/\/[^\/]*$//'`" + filename_texi="`basename ${command_line_filename}`" + # Strip off the last extension part (probably .texinfo or .texi) + filename_noext="`echo ${filename_texi} | sed 's/\.[^.]*$//'`" + + # If directory and file are the same, then it's probably because there's + # no pathname component. Set dirname to `.', the current directory. + if test "z${directory}" = "z${command_line_filename}" ; then + directory="." + fi + + # Source file might @include additional texinfo sources. Put `.' and + # directory where source file(s) reside in TEXINPUTS before anything + # else. `.' goes first to ensure that any old .aux, .cps, etc. files in + # ${directory} don't get used in preference to fresher files in `.'. + TEXINPUTS=".:${directory}:${TEXINPUTS_orig}" + + # "Unset" variables that might have values from previous iterations and + # which won't be completely reset later. + definite_index_files="" + + # See if file exists here. If it doesn't we're in trouble since, even + # though the user may be able to reenter a valid filename at the tex + # prompt (assuming they're attending the terminal), this script won't be + # able to find the right index files and so forth. + if test ! -r "${command_line_filename}" ; then + echo "${progname}: ${command_line_filename}: No such file or permission denied." 1>&2 + continue; + fi + + # Find all files having root filename with a two-letter extension, + # determine whether they're really index files, and save them. Foo.aux + # is actually the cross-references file, but we need to keep track of + # that too. + possible_index_files="`eval echo ${filename_noext}.?? ${filename_noext}.aux`" + for this_file in ${possible_index_files} ; do + # If file is empty, forget it. + if test ! -s "${this_file}" ; then + continue; + fi + + # Examine first character of file. If it's not a backslash or + # single quote, then it's definitely not an index or xref file. + first_character="`sed -n '1s/^\(.\).*$/\1/p;q' ${this_file}`" + if test "${first_character}" = "\\" -o "${first_character}" = "'" ; then + definite_index_files="${definite_index_files} ${this_file}" + fi + done + orig_index_files="${definite_index_files}" + orig_index_files_sans_aux="`echo ${definite_index_files} \ + | sed 's/'${filename_noext}'\.aux//; + s/^[ ]*//;s/[ ]*$//;'`" + + # Now save copies of original index files so we have some means of + # comparison later. + for index_file_to_save in ${orig_index_files} ; do + cp "${index_file_to_save}" "${index_file_to_save}${backup_extension}" + done + + # Run texindex on current index files. If they already exist, and + # after running TeX a first time the index files don't change, then + # there's no reason to run TeX again. But we won't know that if the + # index files are out of date or nonexistent. + if test "${orig_index_files_sans_aux}" ; then + ${texindex} ${orig_index_files_sans_aux} + fi + + if ${tex} ${command_line_filename} ; then # TeX run first time + definite_index_files="" + # Get list of new index files + possible_index_files="`eval echo ${filename_noext}.?? ${filename_noext}.aux`" + for this_file in ${possible_index_files} ; do + # If file is empty, forget it. + if test ! -s ${this_file} ; then + continue; + fi + + # Examine first character of file. If it's not a backslash or + # single quote, then it's definitely not an index or xref file. + first_character="`sed -n '1s/^\(.\).*$/\1/p;q' ${this_file}`" + if test "${first_character}" = "\\" -o "${first_character}" = "'" ; then + definite_index_files="${definite_index_files} ${this_file}" + fi + done + new_index_files="${definite_index_files}" + new_index_files_sans_aux="`echo ${definite_index_files} \ + | sed 's/'${filename_noext}'\.aux//; + s/^[ ]*//;s/[ ]*$//;'`" + + # If old and new list don't at least have the same file list, then one + # file or another has definitely changed. + if test "${orig_index_files}" != "${new_index_files}" ; then + index_files_changed_p=t + else + # File list is the same. We must compare each file until we find a + # difference. + index_files_changed_p="" + for this_file in ${new_index_files} ; do + # cmp -s will return nonzero exit status if files differ. + cmp -s "${this_file}" "${this_file}${backup_extension}" + if test $? -ne 0 ; then + # We only need to keep comparing until we find *one* that + # differs, because we'll have to run texindex & tex no + # matter what. + index_files_changed_p=t + break + fi + done + fi + + # If index files have changed since TeX has been run, or if the aux + # file wasn't present originally, run texindex and TeX again. + if test "${index_files_changed_p}" ; then + retval=0 + if test "${new_index_files_sans_aux}" ; then + ${texindex} ${new_index_files_sans_aux} + retval=$? + fi + if test ${retval} -eq 0 ; then + ${tex} "${command_line_filename}" + fi + fi + fi + + # Generate list of files to delete, then call rm once with the entire + # list. This is significantly faster than multiple executions of rm. + file_list="" + for file in ${orig_index_files} ; do + file_list="${file_list} ${file}${backup_extension}" + done + if test "${file_list}" ; then + rm -f ${file_list} + fi +done + +# +# eof +# |