binutils-gdb/Install.in

984 lines
39 KiB
Bash
Executable File

#!/bin/sh
### Copyright (C) 1991, 1992, Cygnus Support
### All Rights Reserved.
### This really needs to nestle up snuggly to the Release notes. If you change
### this script, please be sure the release notes get coordinated too.
set -e
### this is our version number.
VERSION=cygnus-sol2-||RELNO||
### this is the default installation repository. We use this to test whether or
### not GCC_EXEC_PREFIX should be set when doing "Install test comp-tools".
#INSTALLDIR_DEFAULT=/giga/rich/tmp/installdir
INSTALLDIR_REAL=/opt
INSTALLDIR_DEFAULT=${INSTALLDIR_REAL}
### this is where we install into. (useful for testing).
INSTALLDIR=${INSTALLDIR_DEFAULT}
### where to write the log files
LOGDIR=${INSTALLDIR}/${VERSION}
### who to call in bad situations
HOTLINE="the Cygnus Support Hotline at +1 415 322 7836"
### what the release doc is called and a few sections thereof
NOTES="the Installation Notes"
CHANGING_PATHS="\"Changing the Paths\""
NO_ACCESS="\"No Access to ${INSTALLDIR}\?\""
MIGHT_WRONG="\"Some Things that Might go Wrong\""
WHY_FIXINCLUDES="Why Convert System Header Files\?"
ANOTHER_TAPE="\"Steps to install with another machine\'s tape drive\""
### for debugging
#PATH=/bin:/usr/bin ; export PATH
### default the tape device
case "${TAPE}" in
"") TAPE=||DEVdflt||
;;
*)
;;
esac # ${TAPE}
### clear and/or initialize some variables
ARCH=
TOOLS=
FTPRELEASE=no
REMOVE=no
EXTRACT=no
FIXINCLUDES=no
TESTINSTALLATION=no
INSTALLHOST=default
ERROR=
### where the binaries are in the release
#EXECDIR=${VERSION}/H-${INSTALLHOST}
EXECDIR=${VERSION}
### some tool defaults
### perhaps these should be hard coded to absolute paths instead?
TAR=tar
TARKEYS="xvvopf -"
SED=sed
MT=mt
### trigger words on the command line are:
### bin, src
### emacs, comp-tools
### -tape=/dev/device
### -installdir=/foo
### extract, fixincludes, test-installation, remove
for arg in $* ; do
case "${arg}" in
### options
-tape=* | --tape=* | --tap=* | --ta=* | --t=*)
TAPE=`echo ${arg} | ${SED} 's/-*t[a-z]*=//'`
;;
-installdir=* | --installdir=* | --installdi=* | --installd=* | --install=* | --instal=* | --insta=* | --inst=* | --ins=* | --in=* | --i=*)
INSTALLDIR=`echo ${arg} | ${SED} 's/-*i[a-z]*=//'`
# we will make it an absolute path shortly.
;;
### actions
*remove* | rm | -rm | --rm) ACTIONS="${ACTIONS} rm" ;;
*extract*) ACTIONS="${ACTIONS} extract" ;;
*fix*) ACTIONS="${ACTIONS} fix" ;;
*test*) ACTIONS="${ACTIONS} test" ;;
### hosts
*src* | *sour*) ARCH="${ARCH} src" ;;
*bin*) ARCH="${ARCH} bin" ;;
### packages
*emacs*) TOOLS="${TOOLS} emacs" ;;
*comp*) TOOLS="${TOOLS} comp" ;;
*help*) ERROR=true ;;
*)
echo '***' I do not understand the option \"${arg}\".
ERROR=true
;;
esac # ${arg}
done # arg in $*
###
###
### check for a myriad of sins
###
###
if [ ! -d "${INSTALLDIR}" ] ; then
echo '*** ' Can not cd to \"${INSTALLDIR}\" because it does not exist.
echo '*** ' Try creating it with \"mkdir ${INSTALLDIR}\" and then try running Install again.
exit 1
else
if (cd "${INSTALLDIR}") ; then
true
else
echo '*** ' Can not cd to \"${INSTALLDIR}\" because I do not have execute permission.
ls -lad ${INSTALLDIR}
echo '*** ' Please fix this and then try running Install again.
exit 1
fi # ! cd ${INSTALLDIR}
fi # ! -d ${INSTALLDIR}
# Make INSTALLDIR absolute (parts below might need it that way).
# FIXME, do they really?
# FIXME, handle pwd failure from upper dir permission
INSTALLDIR=`cd ${INSTALLDIR} ; pwd`
LOGDIR=${INSTALLDIR}/${VERSION}
case "${ERROR}" in
"")
### default tools
case "${TOOLS}" in
"") TOOLS="||BUNDLE||" ;;
*) ;;
esac # ${TOOLS}
INSTALLHOST=
### decide where we are: try arch first.
if (arch) > /dev/null 2>&1 ; then
MAYBE=`arch`
else
true
fi # (arch)
case "${MAYBE}" in
sun3) INSTALLHOST=${MAYBE}
;;
*)
### next try uname
if (uname > /dev/null) 2>&1 ; then
UNAME=`echo \`uname -s\`\`uname -m\`\`uname -r\``
else
UNAME="machine without a uname command (type of machine unknown)"
fi # (uname)
### map into names we recognize
case "${UNAME}" in
AIX*)
INSTALLHOST=rs6000
MT=tctl
;;
ULTRIXRISC) INSTALLHOST=decstation ;;
SunOSsun4*5*) INSTALLHOST=sparc-sun-solaris2 ;;
SunOSsun4*) INSTALLHOST=sun4 ;;
SunOSsun3*) INSTALLHOST=sun3 ;;
IRIX*) INSTALLHOST=iris4 ;;
*) INSTALLHOST=unknown ;;
esac # ${UNAME}
;;
esac # ${MAYBE}
### default arch
case "${ARCH}" in
"") ARCH="bin src" ;;
*) ;;
esac # ${ARCH}
### default actions
case "${ACTIONS}" in
"")
case "${FTPRELEASE}" in
"yes") ACTIONS="test" ;;
"no" ) ACTIONS="extract test" ;;
esac # ${FTPRELEASE}
### fixincludes only if comp-tools
for tool in ${TOOLS} ; do
case ${tool} in
comp)
if echo ${ARCH} | grep bin > /dev/null 2>&1 ; then
ACTIONS="${ACTIONS} fix"
fi
;;
*) ;;
esac # ${TOOLS}
done # for tool in ${TOOLS}
;;
*) ;;
esac # ${ACTIONS}
;;
*) ;;
esac # ${ERROR}
case "${ERROR}" in
"")
### if binaries are not intended for this machine
case "${INSTALLHOST}" in
"||HOSTstr||") ### binaries are intended for this machine
for action in ${ACTIONS} ; do
case ${action} in
test)
for tool in ${TOOLS} ; do
OURWD=`(cd ${INSTALLDIR}; pwd) 2>/dev/null`
DEFAULTWD=`(cd ${INSTALLDIR_REAL}; pwd) 2>/dev/null`
case ${tool} in
comp)
case "${OURWD}" in
"${DEFAULTWD}") ;;
*)
echo '***' If you want to use the compilation tools in an alternate
echo '*** ' directory, GCC_EXEC_PREFIX must be set. You probably
echo '*** ' want to set it with:
echo GCC_EXEC_PREFIX=${INSTALLDIR}/${EXECDIR}/lib/gcc-lib/||HOSTstr||/||GCCvn||/ ; export GCC_EXEC_PREFIX
GCC_EXEC_PREFIX=${INSTALLDIR}/${EXECDIR}/lib/gcc-lib/||HOSTstr||/||GCCvn||/ ; export GCC_EXEC_PREFIX
echo '*** ' This is what I will use for the installation tests.
# skip C++ msg on Solaris
case "${INSTALLHOST}" in
sparc-sun-solaris2) ;;
*)
echo '*** ' And for g++ I will use the options:
echo '*** ' -I${INSTALLDIR}/${EXECDIR}/lib/g++-include
echo '*** ' -L${INSTALLDIR}/${EXECDIR}/lib
;;
esac # ${INSTALLHOST}
echo '*** ' For further help, please refer to ${CHANGING_PATHS}
echo '*** ' in ${NOTES}.
GPLUSOPTIONS="-I${INSTALLDIR}/${EXECDIR}/lib/g++-include -L${INSTALLDIR}/${EXECDIR}/lib"
;;
esac # ${INSTALLDIR}
;;
emacs)
case "${OURWD}" in
"${DEFAULTWD}") ;;
*)
echo '***' I cannot test Emacs.
echo '*** ' The provided Emacs binary can only run from the default
echo '*** ' installation directory. If you wish to run emacs, please
echo '*** ' refer to ${CHANGING_PATHS} in ${NOTES}.
exit 1
;;
esac # ${INSTALLDIR}
;;
*) true ;;
esac # ${tool}
done # for tool in ${TOOLS}
;;
*) true ;;
esac # ${action}
done # for action in ${ACTIONS}
;;
*)
for action in ${ACTIONS} ; do
case ${action} in
rm | extract) true ;;
fix)
if echo ${TOOLS} | grep comp > /dev/null ; then
NOTFIXED="fixincludes"
if echo ${ACTIONS} | grep test > /dev/null ; then
JOINER=" or "
else
true
fi # echo ${ACTIONS}
else
# echo '***' If you only install Emacs you do not need to run fixincludes.
# ERROR=true
true
fi # echo ${TOOLS}
;;
test) NOTTESTED="the installation tests" ;;
esac # ${action}
done # for action in ${ACTIONS}
;;
esac # ${INSTALLHOST}
;;
*) ;;
esac # ${ERROR}
if [ -n "${NOTFIXED}" -o -n "${NOTTESTED}" ] ; then
case "${INSTALLHOST}" in
"||HOSTstr||") ;;
*)
echo '*** ' This machine appears to be a \"${INSTALLHOST}\".
echo '*** ' You may still run \"$0 -extract ...\" on this machine and then
echo '*** ' run the other steps on the machine on which you wish to install.
echo '*** ' You will need to do these steps separately.
echo '*** ' For more information, please refer to
echo '*** ' ${ANOTHER_TAPE} in ${NOTES}.
ERROR=true
;;
esac # ${INSTALLHOST}
fi # [ -n ${NOTFIXED -o -n ${NOTTESTED} ]
### if we can't read the tape drive...
popdir=`pwd`
if [ ! -d "${LOGDIR}" ] ; then
if mkdir ${LOGDIR}; then
true
else
echo '*** ' Can not write logs to \"${LOGDIR}\" because it does not exist.
echo '*** ' Try creating it with \"mkdir ${LOGDIR}\" and then try running Install again.
exit 1
fi
else
if [ ! -w "${LOGDIR}" ] ; then
echo '*** ' Can not write logs to \"${LOGDIR}\" because I do not have write permission.
ls -lad ${LOGDIR}
echo '*** ' Please fix this and then try running Install again.
exit 1
fi # ! -r ${LOGDIR}
fi # ! -d ${LOGDIR}
cd ${INSTALLDIR}
### There is a window here that I don't know how to handle gracefully from
### shell. If the directory DID exist and WAS executable but dissappeared
### before we could cd into it, we're kinda hosed. If you get a call about
### this, make sure the directory exists, is readable, is executable, is the
### either the default installation directory or the -installdir=directory
### given on the command line. Then ask them to just try again. A few times.
### If you get the same error every time, we've got a very strange bug. I
### can't help you.
if [ "$?" != "0" ] ; then
echo '***' Cannot cd to \"${INSTALLDIR}\". This is a problem.
echo '*** ' For further help, please refer to
echo '*** ' ${NO_ACCESS} in ${NOTES} or call
echo '*** ' ${HOTLINE}
exit 1
fi
if echo ${ACTIONS} | grep extract > /dev/null ; then
if [ -z "${ERROR}" -a ! -r "${TAPE}" ] ; then
### try checking for a relative tape path
if [ -r ${popdir}/${TAPE} ] ; then
TAPE=${popdir}/${TAPE}
echo '***' Using TAPE device \"${TAPE}\".
else
echo '***' Can not read from TAPE device, \"${TAPE}\".
cd ${popdir} ; ls -lasd ${TAPE}
echo '*** ' Try using \"./Install -tape=/dev/something ...\" to name your tape
echo '*** ' drive or refer to ${MIGHT_WRONG} in
echo '*** ' ${NOTES}.
exit 1
fi # ! -r ${popdir}/${TAPE}
fi # -z ${ERROR}
fi # extract in ${ACTIONS}
cd ${popdir}
### bail out
case "${ERROR}" in
"") ;;
*)
cat <<EOF
You may supply at least one format on the command line. Recognized formats
are:
binaries for binaries
source for source code
The default is both source and binaries.
You may also supply actions. Recognized actions are:
extract read the appropriate files from tape
fixincludes build a directory of corrected header files for comp-tools
test run a very brief verification of your installation
Default actions are extract, fixincludes, and test, although fixincludes is not
necessary for emacs.
There are two other options:
-tape=DEVICE asks Install to read the necessary files from DEVICE. The
default DEVICE is ||DEVdflt||, the ||TAPdflt||, cartridge tape
drive on most ||HOSTstr||s.
-installdir=DIRECTORY asks Install to install files into DIRECTORY.
The default DIRECTORY is ${INSTALLDIR_DEFAULT}.
No action has been taken.
EOF
exit 1
;;
esac
###
###
### build a file list
### (easy this round because we have only one package).
###
FILE_LIST=
TRIGGERS=
for arch in ${ARCH} ; do
case ${arch} in
bin)
FILE_LIST="${FILE_LIST} \
${VERSION}/Install \
${VERSION}/CYGNUS \
${EXECDIR}/lib \
${EXECDIR}/bin \
${VERSION}/include \
${VERSION}/info \
${VERSION}/lib \
${VERSION}/man"
for tool in ${TOOLS} ; do
case ${tool} in
comp) TRIGGERS="${TRIGGERS} ${EXECDIR}/bin/gcc" ;;
emacs) TRIGGERS="${TRIGGERS} ${EXECDIR}/bin/emacs" ;;
*)
echo '***' Oops. Sanity failure on triggers for binaries for ${tool}.
exit 1
;;
esac
done
;;
src)
FILE_LIST="${FILE_LIST} \
${VERSION}/Install \
${VERSION}/CYGNUS \
${VERSION}/src"
for tool in ${TOOLS} ; do
case ${tool} in
comp) TRIGGERS="${TRIGGERS} ${VERSION}/src/gcc/gcc.c" ;;
emacs) TRIGGERS="${TRIGGERS} ${VERSION}/src/emacs/src/emacs.c" ;;
*)
echo '***' Oops. Sanity failure on triggers for source for ${tool}.
exit 1
;;
esac
done
;;
*)
echo '***' Oops. Sanity failure on triggers for arch ${arch}.
;;
esac
done
###
###
### removal
###
###
if echo ${ACTIONS} | grep rm > /dev/null 2>&1 ; then
if [ ! -d "${INSTALLDIR}" ] ; then
echo '***' Cannot remove anything from \"${INSTALLDIR}\" because it does not exist.
echo '*** ' You probably do not need to remove anything.
else
popdir=`pwd`
if [ ! -d "${INSTALLDIR}" ] ; then
echo '***' Can not cd to \"${INSTALLDIR}\" because it does not exist.
echo '*** ' You probably do not need to remove anything.
exit 1
else
if [ ! -r "${INSTALLDIR}" ] ; then
echo '***' Can not cd to \"${INSTALLDIR}\" because I do not have execute permission.
ls -lad ${INSTALLDIR}
echo '*** ' Please fix this and then try running Install again. For
echo '*** ' more information, please refer to ${NO_ACCESS}
echo '*** ' in ${NOTES}.
exit 1
fi
fi
cd ${INSTALLDIR}
### see also the above note about the timing window.
if [ "$?" != "0" ] ; then
echo '***' Cannot cd to \"${INSTALLDIR}\". This is a problem.
echo '*** ' For further help, please refer to
echo '*** ' ${NO_ACCESS} in ${NOTES} or call
echo '*** ' ${HOTLINE}
exit 1
else
true
fi
if [ ! -d "${VERSION}" ] ; then
echo '***' Cannot remove anything from \"${INSTALLDIR}/${VERSION}\" because it does not exist.
echo '*** ' You probably do not need to remove anything.
exit 1
else
true
fi
echo Removing from \"${INSTALLDIR}\"...
if rm -rf ${FILE_LIST} ; then
# if neither binaries nor source are installed, remove installdir
if [ -d ${INSTALLDIR}/${EXECDIR} \
-o -d ${INSTALLDIR}/${VERSION}/src ] ; then
true
else
if rm -rf "${INSTALLDIR}/${VERSION}" ; then
true
else
if [ ! -w "${INSTALLDIR}" ] ; then
echo '***' I can not remove ${INSTALLDIR}/${VERSION}
echo '*** ' because I do not have write access to \"${INSTALLDIR}\"
echo '*** ' Please fix this and try running Install again. For more information
echo '*** ' please refer to ${NO_ACCESS} in ${NOTES}.
exit 1
else
echo '***' I do not know why I can not remove ${INSTALLDIR}/${VERSION}. This is
echo '*** ' probably not a problem.
fi
exit 1
fi
fi
echo Removed.
else
echo '***' There appears to have been a removal error.
echo '*** ' Chances are that this is not a problem, but you might try removing
echo '*** ' again.
exit 1
fi
fi
echo Cygnus Support software distribution removed!
else
true
fi # if removing
###
###
### extraction
###
###
if echo ${ACTIONS} | grep extract > /dev/null 2>&1 ; then
if [ ! -d "${INSTALLDIR}" ] ; then
echo Trying to create \"${INSTALLDIR}\"...
if mkdir ${INSTALLDIR} ; then
echo Created \"${INSTALLDIR}\".
else
echo '***' I can not make directory, \"${INSTALLDIR}\".
### attempt to diagnose...
DIR=`echo ${INSTALLDIR} | ${SED} -e 's:/[^/]*$::'`
if [ ! -d "${DIR}" ] ; then
echo '*** ' It looks as though \"${DIR}\" does not even exist.
exit 1
else
if [ ! -w "${DIR}" ] ; then
echo '*** ' It looks as though you do not have write access to \"${DIR}\".
echo '*** ' Please fix this and try running Install again. For more information
echo '*** ' please refer to ${NO_ACCESS} in ${NOTES}.
exit 1
else
echo '*** ' I do not know why I can not create \"${INSTALLDIR}\". This is a problem.
echo '*** ' Please call ${HOTLINE}
exit 1
fi # ! -w ${DIR}
fi # ! -d ${DIR}
fi # mkdir ${INSTALLDIR}
else
true
fi # ! -d ${INSTALLDIR}
cd ${INSTALLDIR}
if [ "$?" = "0" ] ; then
for trigger in ${TRIGGERS} ; do
if [ -r "${trigger}" ] ; then
echo '***' \"${INSTALLDIR}/${trigger}\" exists and I will not overwrite it.
echo '*** ' If you really want to install it again, please remove it first.
exit 1
else
true
fi # -r ${trigger}
done # for trigger
else
echo '***' I can not cd to \"${INSTALLDIR}\".
### attempt to diagnose...
if [ ! -r "${INSTALLDIR}" ] ; then
echo '*** ' It looks as though you do not have execute permission to \"${INSTALLDIR}\".
else
true
fi # ! -r ${INSTALLDIR}
echo '*** ' For further help, please refer to
echo '*** ' ${NO_ACCESS} in ${NOTES}.
exit 1
fi # status is zero
### remove redundant names from the list
echo ${FILE_LIST} ${COMMONS} ${EMACSHIBIN} | tr ' ' '
' | sort | uniq > ${LOGDIR}/extract_list
echo It will take some time for me to read the tape.
echo Verbose output will be saved in ${LOGDIR}/tar.log
echo Extracting into \"${INSTALLDIR}\"...
### make sure things come off the tape as they were written, but minus what could be a security hole.
umask 0
### using the no rewind device, so rewind and fsf to be sure.
if ${MT} -f ${TAPE} rewind > /dev/null 2>&1 ; then
if ${MT} -f ${TAPE} fsf 1 ; then
true
else
echo '***' Could not forward space tape device \"${TAPE}\".
exit 1
fi
else
if test -r ${TAPE} ; then
true
else
echo '***' Could not rewind tape device \"${TAPE}\".
exit 1
fi
fi # mt ${TAPE} rewind
if dd if=${TAPE} bs=124b | compress -d | ${TAR} ${TARKEYS} `cat ${LOGDIR}/extract_list` > ${LOGDIR}/tar.log 2>&1 && test -d ${VERSION} ; then
if [ -d ${INSTALLDIR}/${EXECDIR}/bin ] ; then
echo Extracted.
else
echo '***' The extraction has failed. The directory
echo '***' ${INSTALLDIR}/${EXECDIR}/bin was not extracted.
echo '*** ' The output from the tar command has been logged in ${LOGDIR}/tar.log
echo '*** ' I do not know how to continue until this problem has been
echo '*** ' corrected. If you do not know how to fix it either, please
echo '*** ' call ${HOTLINE}.
exit 1
fi
if (${MT} -f ${TAPE} rewind > /dev/null 2>&1) ; then
true
else
true
fi # mt rewind
else
echo '***' There appears to have been an extraction error.
echo '*** ' The output from the tar command has been logged in ${LOGDIR}/tar.log
echo '*** ' I do not know how to continue until this problem has been
echo '*** ' corrected. If you do not know how to fix it either, please
echo '*** ' call ${HOTLINE}.
exit 1
fi # dd | compress | tar ....
rm -f ${LOGDIR}/extract_list
echo Cygnus Support software distribution extracted!
else
true
fi # extraction in actions
###
###
### fixincludes
###
###
if echo ${ACTIONS} | grep fix > /dev/null 2>&1 ; then
echo Running fixincludes for ${INSTALLHOST}.
echo Verbose output will be stored in ${LOGDIR}/fixincludes.log
echo This will take some time.
LIB=${INSTALLDIR}/${EXECDIR}/lib/gcc-lib/||HOSTstr||/||GCCvn||/include ; export LIB
if mkdir ${LIB}/tmpdir && mv ${LIB}/*.h ${LIB}/tmpdir ; then
if ${INSTALLDIR}/${VERSION}/lib/fixincludes ${LIB} /usr/include ${INSTALLDIR}/${VERSION}/src/gcc > ${LOGDIR}/fixincludes.log ; then
mv ${LIB}/tmpdir/* ${LIB} && rmdir ${LIB}/tmpdir
echo Finished with fixincludes.
else
echo '***' There seems to have been a problem with fixincludes.
echo '*** ' The verbose output from the fixincludes script has been logged in
echo '*** ' ${INSTALLDIR}/${VERSION}/fixincludes.log.
echo '*** ' I do not know how to continue until this problem has been
echo '*** ' corrected. If you do not know how to fix it either, please
echo '*** ' call ${HOTLINE}.
mv ${LIB}/tmpdir/* ${LIB} && rmdir ${LIB}/tmpdir
exit 1
fi #
else
echo '***' Not able to create the temporary include dir
echo '*** ' Please ensure that write permissions for
echo '*** ' ${LIB} are allowed.
echo '*** ' Or call ${HOTLINE} for more information.
exit 1
fi
echo Fixed include files installed!
else
true
fi # fix in actions
###
###
### testing the installation
###
###
if echo ${ACTIONS} | grep test > /dev/null 2>&1 && echo ${ARCH} | grep bin > /dev/null 2>&1 ; then
popdir=`pwd`
cd ${LOGDIR}
for tool in ${TOOLS} ; do
case ${tool} in
comp)
if [ -f ${INSTALLDIR}/${EXECDIR}/bin/gcc ] ; then
cat > ${LOGDIR}/hello.c <<'e!o!f'
#include <stdio.h>
extern int printf();
int main(int argc, char **argv) {
(void) printf("hello: The compilation tools appear to be installed correctly on your %s.\n",
MACHINE);
return(0);
} /* main() */
e!o!f
if ${INSTALLDIR}/${EXECDIR}/bin/gcc -Wall -O -g \
-DMACHINE=\"${INSTALLHOST}\" ${LOGDIR}/hello.c -o ${LOGDIR}/hello ; then
if ${LOGDIR}/hello ; then
echo This is good.
else
echo '***' Hello.c fails to run. This is a problem.
echo '*** ' Please call ${HOTLINE}
exit 1
fi # ./hello
else
echo '***' Hello.c fails to compile. This is a problem.
echo '*** ' Please call ${HOTLINE}
exit 1
fi # run gcc
### now check for fixed includes.
cat > ${LOGDIR}/test-ioctl.c << 'e!o!f'
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <math.h>
double atof(const char *);
#ifdef __sun__
#include <sys/filio.h>
extern int ioctl();
extern int perror();
#endif /* __sun__ */
extern int printf();
int main(int argc, char **argv) {
#ifdef __sun__
long l;
int fd;
int retval;
if ((fd = open("/dev/tty", O_RDONLY)) == -1) {
(void) perror("test-ioctl: can't open /dev/null");
return(1);
} else if ((retval = ioctl(fd, FIONREAD, &l)) != 0) {
(void) perror("test-ioctl: ioctl failed");
(void) printf("test-ioctl: Most likely, you have not run \"Install fixincludes\" on this machine.\n");
return(2);
}
#endif /* __sun__ */
printf("test-ioctl: Ansi versions of the system header files, (the fixed includes),\n");
printf("test-ioctl: appear to be installed correctly.\n");
/* that's right. If closing /dev/tty fails, I don't want to know about it. */
return(0);
}
e!o!f
case "||HOSTstr||" in
sun3 | sun4 | decstation)
if ${INSTALLDIR}/${EXECDIR}/bin/gcc -Wall -O -g \
-DMACHINE=\"${INSTALLHOST}\" ${LOGDIR}/test-ioctl.c -o ${LOGDIR}/test-ioctl ; then
if ${LOGDIR}/test-ioctl ; then
echo This is good.
else
case "$?" in
1)
echo '***' test-ioctl.c fails to read /dev/tty. If you were running Install
echo '*** ' in batch or from a daemon, please try running it again interactively.
echo '*** ' If not, please call ${HOTLINE}
exit 1
;;
2)
echo '***' test-ioctl.c fails to ioctl.
echo '*** ' Most likely you need to run \"Install fixincludes\".
echo '*** ' Please run \"Install fixincludes\" and
echo '*** ' then try this test again. For an explanation see
echo '*** ' ${WHY_FIXINCLUDES} in ${NOTES}.
exit 1
;;
*)
echo '***' test-ioctl.c fails to run. This is a problem.
echo '*** ' Please call ${HOTLINE}
exit 1
;;
esac # $?
exit 1
fi # test-ioctl
else
### this presupposes that hello.c DID compile.
echo '***' test-ioctl.c fails to compile. This is a problem.
echo '*** ' Please call ${HOTLINE}
exit 1
fi # run gcc
;;
iris4)
if [ ! -f ${INSTALLDIR}/${EXECDIR}/lib/gcc-lib/||HOSTstr||/||GCCvn||/include/sys/cfeiroute.h ]
then
echo '***' You seem to be missing ${INSTALLDIR}/${EXECDIR}/lib/gcc-lib/||HOSTstr||/||GCCvn||/include/sys/cfeiroute.h.
echo '*** ' Most likely you need to run \"Install fixincludes\".
echo '*** ' Please run \"Install fixincludes\" and
echo '*** ' then try this test again. For an explanation see
echo '*** ' ${WHY_FIXINCLUDES} in ${NOTES}.
exit 1
fi # test fixincluded file
;;
sparc-sun-solaris2)
if [ ! -f ${INSTALLDIR}/${EXECDIR}/lib/gcc-lib/||HOSTstr||/||GCCvn||/include/ieeefp.h ]
then
echo '***' You seem to be missing ${INSTALLDIR}/${EXECDIR}/lib/gcc-lib/||HOSTstr||/||GCCvn||/include/ieeefp.h.
echo '*** ' Most likely you need to run \"Install fixincludes\".
echo '*** ' Please run \"Install fixincludes\" and
echo '*** ' then try this test again. For an explanation see
echo '*** ' ${WHY_FIXINCLUDES} in ${NOTES}.
exit 1
fi
;;
rs6000)
if [ ! -f ${INSTALLDIR}/${EXECDIR}/lib/gcc-lib/||HOSTstr||/||GCCvn||/include/piostruct.h ]
then
echo '***' You seem to be missing ${INSTALLDIR}/${EXECDIR}/lib/gcc-lib/||HOSTstr||/||GCCvn||/include/piostruct.h.
echo '*** ' Most likely you need to run \"Install fixincludes\".
echo '*** ' Please run \"Install fixincludes\" and
echo '*** ' then try this test again. For an explanation see
echo '*** ' ${WHY_FIXINCLUDES} in ${NOTES}.
exit 1
fi # test fixincluded file
;;
esac # ||HOSTstr||
else
true
fi # test if gcc present
### now check for g++.
if [ -f ${INSTALLDIR}/${EXECDIR}/bin/g++ ] ; then
cat > ${LOGDIR}/hello.C << 'e!o!f'
#include <iostream.h>
int main(int argc, char**argv)
{
char *machine = MACHINE;
cout << "hello: g++ appears to be installed correctly on your "
<< machine << ".\n";
return(0);
}
e!o!f
if ${INSTALLDIR}/${EXECDIR}/bin/gcc ${GPLUSOPTIONS} -Wall -O -g \
-DMACHINE=\"${INSTALLHOST}\" ${LOGDIR}/hello.C -o ${LOGDIR}/Hello -lg++ ; then
if ${LOGDIR}/Hello ; then
echo This is good.
else
echo '***' hello.C fails to run. This is a problem.
echo '*** ' Please call ${HOTLINE}
exit 1
fi # ./Hello
else
### this presupposes that hello.c DID compile.
echo '***' hello.C fails to compile. This is a problem.
echo '*** ' Please call ${HOTLINE}
exit 1
fi # run g++
### now check for static initialization.
cat > ${LOGDIR}/static-init.C << 'e!o!f'
#include <iostream.h>
int Three;
struct Foo {
Foo(int i) { Three = i; }
};
Foo foo(3);
int main(int argc, char**argv)
{
if (Three != 3) {
cout << "static-init: static initialization fails.\n";
return(1);
}
cout << "static-init: static initialization appears to work.\n";
return(0);
}
e!o!f
if ${INSTALLDIR}/${EXECDIR}/bin/gcc ${GPLUSOPTIONS} -Wall -O -g \
-DMACHINE=\"${INSTALLHOST}\" ${LOGDIR}/static-init.C -o ${LOGDIR}/static-init -lg++ ; then
if ${LOGDIR}/static-init ; then
echo This is good.
else
echo '***' Static initialization is not working. This is a problem.
echo '*** ' Please call ${HOTLINE}
exit 1
fi # run static-init
else
### this presupposes that it DID compile.
echo '***' static-init.c fails to compile. This is a problem.
echo '*** ' Please call ${HOTLINE}
exit 1
fi # run g++
else # no g++, so don't test it
true
fi # no g++
;;
emacs)
cat > ${LOGDIR}/hello.el <<'e!o!f'
(server-start)
(message "Emacs appears to be installed correctly.")
(kill-emacs 0)
e!o!f
if ${INSTALLDIR}/${EXECDIR}/bin/emacs -batch -l ${LOGDIR}/hello.el ; then
echo This is good.
else
echo '***' Emacs fails to run. This is a problem.
echo '*** ' Please call ${HOTLINE}
exit 1
fi
;;
src) # if anyone can tell me how to test the installation of source...
true
;;
*)
echo '***' I do not know how to test for tool \"${tool}\" because I have never
echo '*** ' heard of it. This is a problem. Please call ${HOTLINE}.
exit 1
;;
esac
done
rm -f hello* test-ioctl* static-init* Hello*
cd ${popdir}
echo Cygnus Support software distribution tested!
else
true
fi
echo Done.
exit 0
###
### Local Variables:
### comment-column: 0
### fill-column: 131
### End:
###
### End of Install