Attempt to (re-?)import enough of gdb's configuration files for

./configure to work.
This commit is contained in:
bde 1997-03-16 17:37:16 +00:00
parent d3bb4185d0
commit 410254a3c8
10 changed files with 6358 additions and 0 deletions

599
contrib/gdb/config.guess vendored Executable file
View File

@ -0,0 +1,599 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 93, 94, 95, 1996 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Written by Per Bothner <bothner@cygnus.com>.
# The master version of this file is at the FSF in /home/gd/gnu/lib.
#
# 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).
#
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 8/24/94.)
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
PATH=$PATH:/.attbin ; export PATH
fi
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
trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
alpha:OSF1:[VX]*:*)
# After 1.2, OSF1 uses "V1.3" for uname -r.
# After 4.x, OSF1 uses "X4.x" for uname -r.
echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VX]//'`
exit 0 ;;
alpha:OSF1:*:*)
# 1.2 uses "1.2" for uname -r.
echo alpha-dec-osf${UNAME_RELEASE}
exit 0 ;;
21064:Windows_NT:50:3)
echo alpha-dec-winnt3.5
exit 0 ;;
Amiga*:UNIX_System_V:4.0:*)
echo m68k-cbm-sysv4
exit 0;;
amiga:NetBSD:*:*)
echo m68k-cbm-netbsd${UNAME_RELEASE}
exit 0 ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit 0;;
Pyramid*:OSx*:*:*)
if test "`(/bin/universe) 2>/dev/null`" = att ; then
echo pyramid-pyramid-sysv3
else
echo pyramid-pyramid-bsd
fi
exit 0 ;;
sun4*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit 0 ;;
i86pc:SunOS:5.*:*)
echo i386-unknown-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:*:*)
case "`/usr/bin/arch -k`" in
Series*|S4*)
UNAME_RELEASE=`uname -v`
;;
esac
# Japanese Language versions have a version number like `4.1.3-JL'.
echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
exit 0 ;;
sun3*:SunOS:*:*)
echo m68k-sun-sunos${UNAME_RELEASE}
exit 0 ;;
atari*:NetBSD:*:*)
echo m68k-atari-netbsd${UNAME_RELEASE}
exit 0 ;;
sun3*:NetBSD:*:*)
echo m68k-sun-netbsd${UNAME_RELEASE}
exit 0 ;;
mac68k:NetBSD:*:*)
echo m68k-apple-netbsd${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:*:4*:UMIPS)
echo mips-mips-riscos4sysv
exit 0 ;;
mips:*:5*:RISCos)
echo mips-mips-riscos${UNAME_RELEASE}
exit 0 ;;
Night_Hawk:Power_UNIX:*:*)
echo powerpc-harris-powerunix
exit 0 ;;
m88k:CX/UX:7*:*)
echo m88k-harris-cxux7
exit 0 ;;
m88k:*:4*:R4*)
echo m88k-motorola-sysv4
exit 0 ;;
m88k:*:3*:R3*)
echo m88k-motorola-sysv3
exit 0 ;;
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`uname -p`
if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88100 ] ; then
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
-o ${TARGET_BINARY_INTERFACE}x = x ] ; then
echo m88k-dg-dgux${UNAME_RELEASE}
else
echo m88k-dg-dguxbcs${UNAME_RELEASE}
fi
else echo i586-dg-dgux${UNAME_RELEASE}
fi
exit 0 ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
echo m88k-dolphin-sysv3
exit 0 ;;
M88*:*:R3*:*)
# Delta 88k system running SVR3
echo m88k-motorola-sysv3
exit 0 ;;
XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
echo m88k-tektronix-sysv3
exit 0 ;;
Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
echo m68k-tektronix-bsd
exit 0 ;;
*:IRIX*:*:*)
echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
exit 0 ;;
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
i[34]86:AIX:*:*)
echo i386-ibm-aix
exit 0 ;;
*:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
sed 's/^ //' << EOF >dummy.c
#include <sys/systemcfg.h>
main()
{
if (!__power_pc())
exit(1);
puts("powerpc-ibm-aix3.2.5");
exit(0);
}
EOF
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
echo rs6000-ibm-aix3.2.5
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
echo rs6000-ibm-aix3.2.4
else
echo rs6000-ibm-aix3.2
fi
exit 0 ;;
*:AIX:*:4)
if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then
IBM_ARCH=rs6000
else
IBM_ARCH=powerpc
fi
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
else
IBM_REV=4.${UNAME_RELEASE}
fi
echo ${IBM_ARCH}-ibm-aix${IBM_REV}
exit 0 ;;
*:AIX:*:*)
echo rs6000-ibm-aix
exit 0 ;;
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
echo romp-ibm-bsd4.4
exit 0 ;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
exit 0 ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
echo rs6000-bull-bosx
exit 0 ;;
DPX/2?00:B.O.S.:*:*)
echo m68k-bull-sysv3
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/[3478]??:HP-UX:*:*)
case "${UNAME_MACHINE}" in
9000/31? ) HP_ARCH=m68000 ;;
9000/[34]?? ) HP_ARCH=m68k ;;
9000/7?? | 9000/8?[679] ) HP_ARCH=hppa1.1 ;;
9000/8?? ) HP_ARCH=hppa1.0 ;;
esac
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
exit 0 ;;
3050*:HI-UX:*:*)
sed 's/^ //' << EOF >dummy.c
#include <unistd.h>
int
main ()
{
long cpu = sysconf (_SC_CPU_VERSION);
/* The order matters, because CPU_IS_HP_MC68K erroneously returns
true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
results, however. */
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 if (CPU_IS_HP_MC68K (cpu))
puts ("m68k-hitachi-hiuxwe2");
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?[79]:4.3bsd:*:* )
echo hppa1.1-hp-bsd
exit 0 ;;
9000/8??:4.3bsd:*:*)
echo hppa1.0-hp-bsd
exit 0 ;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
echo hppa1.1-hp-osf
exit 0 ;;
hp8??:OSF1:*:*)
echo hppa1.0-hp-osf
exit 0 ;;
parisc*:Lites*:*:*)
echo hppa1.1-hp-lites
exit 0 ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
exit 0 ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit 0 ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
echo c34-convex-bsd
exit 0 ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
echo c38-convex-bsd
exit 0 ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd
exit 0 ;;
CRAY*X-MP:*:*:*)
echo xmp-cray-unicos
exit 0 ;;
CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE}
exit 0 ;;
CRAY*C90:*:*:*)
echo c90-cray-unicos${UNAME_RELEASE}
exit 0 ;;
CRAY-2:*:*:*)
echo cray2-cray-unicos
exit 0 ;;
hp3[0-9][05]:NetBSD:*:*)
echo m68k-hp-netbsd${UNAME_RELEASE}
exit 0 ;;
i[34]86:BSD/386:*:* | *:BSD/OS:*:*)
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit 0 ;;
*:FreeBSD:*:*)
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit 0 ;;
*:NetBSD:*:*)
echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
exit 0 ;;
i*:CYGWIN*:*)
echo i386-unknown-cygwin32
exit 0 ;;
p*:CYGWIN*:*)
echo powerpcle-unknown-cygwin32
exit 0 ;;
*:GNU:*:*)
echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit 0 ;;
*:Linux:*:*)
# The BFD linker knows what the default object file format is, so
# first see if it will tell us.
ld_help_string=`ld --help 2>&1`
if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i[345]86"; then
echo "${UNAME_MACHINE}-unknown-linux" ; exit 0
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i[345]86linux"; then
echo "${UNAME_MACHINE}-unknown-linuxaout" ; exit 0
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i[345]86coff"; then
echo "${UNAME_MACHINE}-unknown-linuxcoff" ; exit 0
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68kelf"; then
echo "${UNAME_MACHINE}-unknown-linux" ; exit 0
elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68klinux"; then
echo "${UNAME_MACHINE}-unknown-linuxaout" ; exit 0
elif test "${UNAME_MACHINE}" = "alpha" ; then
echo alpha-unknown-linux ; exit 0
else
# Either a pre-BFD a.out linker (linuxoldld) or one that does not give us
# useful --help. Gcc wants to distinguish between linuxoldld and linuxaout.
test ! -d /usr/lib/ldscripts/. \
&& echo "${UNAME_MACHINE}-unknown-linuxoldld" && exit 0
# Determine whether the default compiler is a.out or elf
cat >dummy.c <<EOF
main(argc, argv)
int argc;
char *argv[];
{
#ifdef __ELF__
printf ("%s-unknown-linux\n", argv[1]);
#else
printf ("%s-unknown-linuxaout\n", argv[1]);
#endif
return 0;
}
EOF
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
fi ;;
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
# are messed up and put the nodename in both sysname and nodename.
i[34]86:DYNIX/ptx:4*:*)
echo i386-sequent-sysv4
exit 0 ;;
i[34]86:*:4.*:* | i[34]86:SYSTEM_V: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 test -f /usr/options/cb.name; then
UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
echo ${UNAME_MACHINE}-unknown-isc$UNAME_REL
elif /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
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586
echo ${UNAME_MACHINE}-unknown-sco$UNAME_REL
else
echo ${UNAME_MACHINE}-unknown-sysv32
fi
exit 0 ;;
Intel:Mach:3*:*)
echo i386-unknown-mach3
exit 0 ;;
paragon:*:*:*)
echo i860-intel-osf1
exit 0 ;;
i860:*:4.*:*) # i860-SVR4
if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
else # Add other i860-SVR4 vendors below as they are discovered.
echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
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:3.0 | 3[34]??,*:*:4.0:3.0)
uname -p 2>/dev/null | grep 86 >/dev/null \
&& echo i486-ncr-sysv4.3 && exit 0 ;;
3[34]??:*:4.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.[23]*:*)
echo m68k-lynx-lynxos${UNAME_RELEASE}
exit 0 ;;
mc68030:UNIX_System_V:4.*:*)
echo m68k-atari-sysv4
exit 0 ;;
i[34]86:LynxOS:2.[23]*:*)
echo i386-lynx-lynxos${UNAME_RELEASE}
exit 0 ;;
TSUNAMI:LynxOS:2.[23]*:*)
echo sparc-lynx-lynxos${UNAME_RELEASE}
exit 0 ;;
rs6000:LynxOS:2.[23]*:*)
echo rs6000-lynx-lynxos${UNAME_RELEASE}
exit 0 ;;
RM*:SINIX-*:*:*)
echo mips-sni-sysv4
exit 0 ;;
*:SINIX-*:*:*)
if uname -p 2>/dev/null >/dev/null ; then
UNAME_MACHINE=`(uname -p) 2>/dev/null`
echo ${UNAME_MACHINE}-sni-sysv4
else
echo ns32k-sni-sysv
fi
exit 0 ;;
mc68*:A/UX:*:*)
echo m68k-apple-aux${UNAME_RELEASE}
exit 0 ;;
R3000:*System_V*:*:*)
if [ -d /usr/nec ]; then
echo mips-nec-sysv${UNAME_RELEASE}
else
echo mips-unknown-sysv${UNAME_RELEASE}
fi
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
#ifdef _SEQUENT_
# include <sys/types.h>
# include <sys/utsname.h>
#endif
main ()
{
#if defined (sony)
#if defined (MIPSEB)
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
I don't know.... */
printf ("mips-sony-bsd\n"); exit (0);
#else
#include <sys/param.h>
printf ("m68k-sony-newsos%s\n",
#ifdef NEWSOS4
"4"
#else
""
#endif
); 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)
#if !defined (__ARCHITECTURE__)
#define __ARCHITECTURE__ "m68k"
#endif
int version;
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
printf ("%s-next-nextstep%s\n", __ARCHITECTURE__, version==2 ? "2" : "3");
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__)
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_)
struct utsname un;
uname(&un);
if (strncmp(un.version, "V2", 2) == 0) {
printf ("i386-sequent-ptx2\n"); exit (0);
}
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
printf ("i386-sequent-ptx1\n"); exit (0);
}
printf ("i386-sequent-ptx\n"); exit (0);
#endif
#if defined (vax)
#if !defined (ultrix)
printf ("vax-dec-bsd\n"); exit (0);
#else
printf ("vax-dec-ultrix\n"); exit (0);
#endif
#endif
#if defined (alliant) && defined (i860)
printf ("i860-alliant-bsd\n"); exit (0);
#endif
exit (1);
}
EOF
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
rm -f dummy.c dummy
# Apollos put the system type in the environment.
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
# Convex versions that predate uname can use getsysinfo(1)
if [ -x /usr/convex/getsysinfo ]
then
case `getsysinfo -f cpu_type` in
c1*)
echo c1-convex-bsd
exit 0 ;;
c2*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit 0 ;;
c34*)
echo c34-convex-bsd
exit 0 ;;
c38*)
echo c38-convex-bsd
exit 0 ;;
c4*)
echo c4-convex-bsd
exit 0 ;;
esac
fi
#echo '(Unable to guess system type)' 1>&2
exit 1

1110
contrib/gdb/config.sub vendored Executable file

File diff suppressed because it is too large Load Diff

1303
contrib/gdb/configure vendored Executable file

File diff suppressed because it is too large Load Diff

763
contrib/gdb/configure.in Normal file
View File

@ -0,0 +1,763 @@
##############################################################################
## This file is a shell script fragment that supplies the information
## necessary to tailor a template configure script into the configure
## script appropriate for this directory. For more information, check
## any existing configure script.
## Be warned, there are two types of configure.in files. There are those
## used by Autoconf, which are macros which are expanded into a configure
## script by autoconf. The other sort, of which this is one, is executed
## by Cygnus configure.
## For more information on these two systems, check out the documentation
## for 'Autoconf' (autoconf.texi) and 'Configure' (configure.texi).
##############################################################################
### To add a new directory to the tree, first choose whether it is a target
### or a host dependent tool. Then put it into the appropriate list
### (library or tools, host or target), doing a dependency sort. For
### example, gdb requires that byacc (or bison) be built first, so it is in
### the ${host_tools} list after byacc and bison.
# these libraries are used by various programs built for the host environment
#
host_libs="mmalloc libiberty opcodes bfd readline gash tcl tk tclX"
if [ "${enable_gdbgui}" = "yes" ] ; then
host_libs="${host_libs} libgui"
fi
# these tools are built for the host environment
#
host_tools="byacc flex bison binutils ld gas gcc gdb make patch
prms send-pr gprof gdbtest tgas etc expect dejagnu sim
m4 autoconf ispell grep diff rcs cvs fileutils shellutils
textutils wdiff find emacs emacs19 uudecode hello tar gzip indent
recode release sed utils"
# these libraries are built for the target environment, and are built after
# the host libraries and the host tools (which may be a cross compiler)
#
target_libs="target-libiberty target-libgloss target-newlib target-libio target-librx target-libstdc++ target-libg++"
# these tools are built using the target libs, and are intended to run only
# in the target environment
#
# note: any program that *uses* libraries that are in the "target_libs"
# list belongs in this list. those programs are also very likely
# candidates for the "native_only" list which follows
#
target_tools="target-examples target-groff"
################################################################################
## These two lists are of directories that are to be removed from the
## ${configdirs} list for either cross-compilations or for native-
## compilations. For example, it doesn't make that much sense to
## cross-compile Emacs, nor is it terribly useful to compile target-libiberty in
## a native environment.
# directories to be built in the native environment only
#
native_only="autoconf cvs emacs emacs19 fileutils find grep gzip hello
indent ispell m4 rcs recode sed shellutils tar textutils gash
uudecode wdiff gprof target-groff"
# directories to be built in a cross environment only
#
cross_only="target-libiberty target-libgloss target-newlib"
## All tools belong in one of the four categories, and are assigned above
## We assign ${configdirs} this way to remove all embedded newlines. This
## is important because configure will choke if they ever get through.
## ${configdirs} is directories we build using the host tools.
## ${target_configdirs} is directories we build using the target tools.
#
configdirs=`echo ${host_libs} ${host_tools}`
target_configdirs=`echo ${target_libs} ${target_tools}`
################################################################################
srctrigger=move-if-change
srcname="gnu development package"
# This gets set non-empty for some net releases of packages.
appdirs=""
# per-host:
# Work in distributions that contain no compiler tools, like Autoconf.
if [ -d ${srcdir}/config ]; then
case "${host}" in
m68k-hp-hpux*) host_makefile_frag=config/mh-hp300 ;;
m68k-apollo-sysv*) host_makefile_frag=config/mh-apollo68 ;;
m68k-apollo-bsd*) host_makefile_frag=config/mh-a68bsd ;;
m68k-*-linux*) host_makefile_frag=config/mh-linux ;;
m88k-dg-dgux*) host_makefile_frag=config/mh-dgux ;;
m88k-harris-cxux*) host_makefile_frag=config/mh-cxux ;;
m88k-motorola-sysv*) host_makefile_frag=config/mh-delta88;;
mips*-dec-ultrix*) host_makefile_frag=config/mh-decstation ;;
mips*-nec-sysv4*) host_makefile_frag=config/mh-necv4 ;;
mips*-sgi-irix[56]*) host_makefile_frag=config/mh-irix5 ;;
mips*-sgi-irix4*) host_makefile_frag=config/mh-irix4 ;;
mips*-sgi-irix3*) host_makefile_frag=config/mh-sysv ;;
mips*-*-sysv4*) host_makefile_frag=config/mh-sysv4 ;;
mips*-*-sysv*) host_makefile_frag=config/mh-riscos ;;
i[345]86-ncr-sysv4.3) host_makefile_frag=config/mh-ncrsvr43 ;;
i[345]86-ncr-sysv4*) host_makefile_frag=config/mh-ncr3000 ;;
i[345]86-*-sco3.2v5*) host_makefile_frag=config/mh-sysv ;;
i[345]86-*-sco*) host_makefile_frag=config/mh-sco ;;
i[345]86-*-isc*) host_makefile_frag=config/mh-sysv ;;
i[345]86-*-linux*) host_makefile_frag=config/mh-linux ;;
i[345]86-*-solaris2*) host_makefile_frag=config/mh-sysv4 ;;
i[345]86-*-aix*) host_makefile_frag=config/mh-aix386 ;;
i[345]86-*-go32*) host_makefile_frag=config/mh-go32 ;;
vax-*-ultrix2*) host_makefile_frag=config/mh-vaxult2 ;;
*-*-solaris2*) host_makefile_frag=config/mh-solaris ;;
m68k-sun-sunos*) host_makefile_frag=config/mh-sun3 ;;
*-hp-hpux[78]*) host_makefile_frag=config/mh-hpux8 ;;
*-hp-hpux*) host_makefile_frag=config/mh-hpux ;;
*-*-hiux*) host_makefile_frag=config/mh-hpux ;;
rs6000-*-lynxos*) host_makefile_frag=config/mh-lynxrs6k ;;
*-*-lynxos*) host_makefile_frag=config/mh-lynxos ;;
*-*-sysv4*) host_makefile_frag=config/mh-sysv4 ;;
*-*-sysv*) host_makefile_frag=config/mh-sysv ;;
esac
fi
# If we aren't going to be using gcc, see if we can extract a definition
# of CC from the fragment.
if [ -z "${CC}" -a "${build}" = "${host}" ]; then
IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
found=
for dir in $PATH; do
test -z "$dir" && dir=.
if test -f $dir/gcc; then
found=yes
break
fi
done
IFS="$save_ifs"
if [ -z "${found}" -a -n "${host_makefile_frag}" -a -f "${srcdir}/${host_makefile_frag}" ]; then
xx=`sed -n -e 's/^[ ]*CC[ ]*=[ ]*\(.*\)$/\1/p' < ${srcdir}/${host_makefile_frag}`
if [ -n "${xx}" ] ; then
CC=$xx
fi
fi
fi
# We default to --with-shared on platforms where -fpic is meaningless.
# Well, we don't yet, but we will.
if false && [ "${host}" = "${target}" ] && [ x${enable_shared} = x ]; then
case "${target}" in
alpha-dec-osf*) enable_shared=yes ;;
mips-sgi-irix5*) enable_shared=yes ;;
*) enable_shared=no ;;
esac
fi
if [ x${enable_shared} = xyes ]; then
waugh=
case "${host}" in
hppa*) waugh=config/mh-papic ;;
i[345]86-*) waugh=config/mh-x86pic ;;
sparc64-*) waugh=config/mh-sparcpic ;;
*) waugh=config/mh-${host_cpu}pic ;;
esac
if [ -f ${srcdir}/${waugh} ]; then
if [ -n "${host_makefile_frag}" ] ; then
cat ${srcdir}/${host_makefile_frag} > mh-frag
cat ${srcdir}/${waugh} >> mh-frag
host_makefile_frag=mh-frag
else
host_makefile_frag=${waugh}
fi
fi
fi
# per-target:
case "${target}" in
v810*) target_makefile_frag=config/mt-v810 ;;
i[345]86-*-netware*) target_makefile_frag=config/mt-netware ;;
powerpc-*-netware*) target_makefile_frag=config/mt-netware ;;
esac
skipdirs=
gasdir=gas
use_gnu_ld=
use_gnu_as=
# some tools are so dependent upon X11 that if we're not building with X,
# it's not even worth trying to configure, much less build, that tool.
case ${with_x} in
yes | "") # the default value for this tree is that X11 is available
;;
no)
skipdirs="${skipdirs} tk gash"
;;
*)
echo "*** bad value \"${with_x}\" for -with-x flag; ignored" 1>&2
;;
esac
# Some tools are only suitable for building in a "native" situation.
# Those are added when we have a host==target configuration. For cross
# toolchains, we add some directories that should only be useful in a
# cross-compiler.
is_cross_compiler=
if [ x"${host}" = x"${target}" ] ; then
# when doing a native toolchain, don't build the targets
# that are in the 'cross only' list
skipdirs="${skipdirs} ${cross_only}"
is_cross_compiler=no
target_subdir=.
else
# similarly, don't build the targets in the 'native only'
# list when building a cross compiler
skipdirs="${skipdirs} ${native_only}"
is_cross_compiler=yes
target_subdir=${target_alias}
if [ ! -d ${target_subdir} ] ; then
if mkdir ${target_subdir} ; then true
else
echo "'*** could not make ${PWD=`pwd`}/${target_subdir}" 1>&2
exit 1
fi
fi
fi
copy_dirs=
# Handle --with-headers=XXX. The contents of the named directory are
# copied to $(tooldir)/sys-include.
if [ x"${with_headers}" != x ]; then
if [ x${is_cross_compiler} = xno ]; then
echo 1>&2 '***' --with-headers is only supported when cross compiling
exit 1
fi
case "${exec_prefixoption}" in
"") x=${prefix} ;;
*) x=${exec_prefix} ;;
esac
copy_dirs="${copy_dirs} ${with_headers} $x/${target_alias}/sys-include"
fi
# Handle --with-libs=XXX. Multiple directories are permitted. The
# contents are copied to $(tooldir)/lib.
if [ x"${with_libs}" != x ]; then
if [ x${is_cross_compiler} = xno ]; then
echo 1>&2 '***' --with-libs is only supported when cross compiling
exit 1
fi
# Copy the libraries in reverse order, so that files in the first named
# library override files in subsequent libraries.
case "${exec_prefixoption}" in
"") x=${prefix} ;;
*) x=${exec_prefix} ;;
esac
for l in ${with_libs}; do
copy_dirs="$l $x/${target_alias}/lib ${copy_dirs}"
done
fi
# If both --with-headers and --with-libs are specified, default to
# --without-newlib.
if [ x"${with_headers}" != x ] && [ x"${with_libs}" != x ]; then
if [ x"${with_newlib}" = x ]; then
with_newlib=no
fi
fi
# Recognize --with-newlib/--without-newlib.
if [ x${with_newlib} = xno ]; then
skipdirs="${skipdirs} target-newlib"
elif [ x${with_newlib} = xyes ]; then
skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
fi
# Default to using --with-stabs for certain targets.
if [ x${with_stabs} = x ]; then
case "${target}" in
mips*-*-* | alpha*-*-osf* | i[345]86*-*-sysv4* | i[345]86*-*-unixware*)
with_stabs=yes;
withoptions="${withoptions} --with-stabs"
;;
esac
fi
# Handle ${copy_dirs}
set fnord ${copy_dirs}
shift
while [ $# != 0 ]; do
if [ -f $2/COPIED ] && [ x"`cat $2/COPIED`" = x"$1" ]; then
:
else
echo Copying $1 to $2
# Use the install script to create the directory and all required
# parent directories.
if [ -d $2 ]; then
:
else
echo >config.temp
${srcdir}/install.sh -c -m 644 config.temp $2/COPIED
fi
# Copy the directory, assuming we have tar.
# FIXME: Should we use B in the second tar? Not all systems support it.
(cd $1; tar -cf - .) | (cd $2; tar -xpf -)
# It is the responsibility of the user to correctly adjust all
# symlinks. If somebody can figure out how to handle them correctly
# here, feel free to add the code.
echo $1 > $2/COPIED
fi
shift; shift
done
# Configure extra directories which are host specific
case "${host}" in
i[345]86-*-go32*)
configdirs="$configdirs dosrel" ;;
esac
# Remove more programs from consideration, based on the host or
# target this usually means that a port of the program doesn't
# exist yet.
noconfigdirs=""
case "${host}" in
i[345]86-*-vsta)
noconfigdirs="tcl expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff"
;;
i[345]86-*-go32)
noconfigdirs="tcl tk expect dejagnu make texinfo bison patch flex byacc send-pr gprof uudecode dejagnu diff"
;;
*-*-cygwin32)
noconfigdirs="patch diff make tk tcl expect dejagnu cvs autoconf texinfo bison send-pr gprof rcs"
;;
ppc*-*-pe)
noconfigdirs="patch diff make tk tcl expect dejagnu cvs autoconf texinfo bison send-pr gprof rcs"
;;
esac
case "${target}" in
*-*-netware)
noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-librx target-newlib target-libiberty"
;;
*-*-vxworks*)
noconfigdirs="$noconfigdirs target-newlib"
;;
alpha-dec-osf*)
# ld works, but does not support shared libraries. emacs doesn't
# work. newlib is not 64 bit ready. I'm not sure about fileutils or grep.
# gas doesn't generate exception information.
noconfigdirs="$noconfigdirs gas ld emacs fileutils grep target-newlib"
;;
alpha*-*-*)
# newlib is not 64 bit ready
noconfigdirs="$noconfigdirs target-newlib"
;;
arm-*-pe*)
;;
arm-*-riscix*)
noconfigdirs="$noconfigdirs ld"
;;
h8300*-*-* | \
h8500-*-*)
noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-libio target-librx"
;;
hppa*-*-*elf* | \
hppa*-*-lites*)
# Do configure ld/binutils/gas for this case.
;;
hppa*-*-*)
# HP's C compiler doesn't handle Emacs correctly (but on BSD and Mach
# cc is gcc, and on any system a user should be able to link cc to
# whatever they want. FIXME, emacs emacs19).
case "${CC}" in
"" | cc*) noconfigdirs="$noconfigdirs emacs emacs19" ;;
*) ;;
esac
noconfigdirs="$noconfigdirs ld shellutils"
;;
i[345]86-*-go32)
# but don't build gdb
noconfigdirs="$noconfigdirs gdb target-libg++ target-libstdc++ target-libio target-librx"
;;
*-*-cygwin32)
# make/glob's configure uses some AC_TRY_RUN type tests
target_configdirs="$target_configdirs target-winsup"
noconfigdirs="$noconfigdirs tcl tk expect make"
# always build newlib.
skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
# Can't build gdb for cygwin32 if not native.
case "${host}:${build}" in
*-*-cygwin32 | *-*-cygwin32:*-*-cygwin32) ;; # keep gdb
*) noconfigdirs="$noconfigdirs gdb"
esac
;;
i[345]86-*-pe)
noconfigdirs="$noconfigdirs target-libg++ target-libstdc++ target-libio target-librx"
;;
i[345]86-*-sco3.2v5*)
# The linker does not yet know about weak symbols in COFF,
# and is not configured to handle mixed ELF and COFF.
noconfigdirs="$noconfigdirs gprof ld"
;;
i[345]86-*-sco*)
noconfigdirs="$noconfigdirs gprof"
;;
i[345]86-*-solaris2*)
# The linker does static linking correctly, but the Solaris C library
# has bugs such that some important functions won't work when statically
# linked. (See man pages for getpwuid, for example.)
noconfigdirs="$noconfigdirs ld"
;;
i[345]86-*-sysv4*)
# The SYSV4 C compiler doesn't handle Emacs correctly
case "${CC}" in
"" | cc*) noconfigdirs="$noconfigdirs emacs emacs19" ;;
*) ;;
esac
# but that's okay since emacs doesn't work anyway
noconfigdirs="$noconfigdirs emacs emacs19"
;;
powerpc-*-aix*)
# copied from rs6000-*-* entry
noconfigdirs="$noconfigdirs gprof cvs"
;;
powerpc*-*-winnt* | powerpc*-*-pe* | ppc*-*-pe)
target_configdirs="$target_configdirs target-winsup"
noconfigdirs="$noconfigdirs gdb tcl tk make expect"
# always build newlib.
skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
;;
rs6000-*-lynxos*)
# The CVS server code doesn't work on the RS/6000
# Newlib makes problems for libg++ in crosses.
noconfigdirs="$noconfigdirs target-newlib gprof cvs"
;;
rs6000-*-*)
noconfigdirs="$noconfigdirs gprof"
;;
m68k-apollo-*)
noconfigdirs="$noconfigdirs ld binutils gprof"
;;
mips*-*-irix5*)
# The GNU linker does not support shared libraries.
# emacs is emacs 18, which does not work on Irix 5 (emacs19 does work)
noconfigdirs="$noconfigdirs ld gprof emacs"
;;
mips*-dec-bsd*)
noconfigdirs="$noconfigdirs gprof"
;;
mips*-*-bsd*)
noconfigdirs="$noconfigdirs gprof"
;;
mips*-*-*)
noconfigdirs="$noconfigdirs gprof"
;;
romp-*-*)
noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes"
;;
sh-*-*)
case "${host}" in
i[345]86-*-vsta) ;; # don't add gprof back in
i[345]86-*-go32) ;; # don't add gprof back in
*) skipdirs=`echo " ${skipdirs} " | sed -e 's/ gprof / /'` ;;
esac
;;
sparc-*-sunos4*)
if [ x${is_cross_compiler} != xno ] ; then
noconfigdirs="$noconfigdirs gdb gdbtest target-newlib"
else
use_gnu_ld=no
fi
;;
v810-*-*)
noconfigdirs="$noconfigdirs bfd binutils gas gcc gdb ld target-libio target-libg++ target-libstdc++ opcodes"
;;
vax-*-vms)
noconfigdirs="$noconfigdirs bfd binutils gdb ld target-newlib opcodes"
;;
vax-*-*)
noconfigdirs="$noconfigdirs target-newlib"
;;
*-*-lynxos*)
# Newlib makes problems for libg++ in crosses.
noconfigdirs="$noconfigdirs target-newlib"
;;
*-*-macos* | \
*-*-mpw*)
# Macs want a resource compiler.
configdirs="$configdirs grez"
;;
esac
# targets that need a second pass
case "${target}" in
*-gm-magic*)
noconfigdirs="$noconfigdirs libgloss"
;;
esac
# If we are building a Canadian Cross, discard tools that can not be built
# using a cross compiler. FIXME: These tools should be fixed.
if [ "${build}" != "${host}" ]; then
noconfigdirs="$noconfigdirs expect dejagnu make texinfo diff"
fi
# Make sure we don't let GNU ld be added if we didn't want it.
if [ x$with_gnu_ld = xno ]; then
use_gnu_ld=no
noconfigdirs="$noconfigdirs ld"
fi
# Make sure we don't let GNU as be added if we didn't want it.
if [ x$with_gnu_as = xno ]; then
use_gnu_as=no
noconfigdirs="$noconfigdirs gas"
fi
# Remove the entries in $skipdirs and $noconfigdirs from $configdirs and
# $target_configdirs.
# If we have the source for $noconfigdirs entries, add them to $notsupp.
notsupp=""
for dir in . $skipdirs $noconfigdirs ; do
dirname=`echo $dir | sed -e s/target-//g`
if [ $dir != . ] && echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
configdirs=`echo " ${configdirs} " | sed -e "s/ ${dir} / /"`
if [ -r $srcdir/$dirname/configure ] \
|| [ -r $srcdir/$dirname/configure.in ]; then
if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
true
else
notsupp="$notsupp $dir"
fi
fi
fi
if [ $dir != . ] && echo " ${target_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
target_configdirs=`echo " ${target_configdirs} " | sed -e "s/ ${dir} / /"`
if [ -r $srcdir/$dirname/configure ] \
|| [ -r $srcdir/$dirname/configure.in ]; then
if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
true
else
notsupp="$notsupp $dir"
fi
fi
fi
done
# Sometimes the tools are distributed with libiberty but with no other
# libraries. In that case, we don't want to build target-libiberty.
if [ -n "${target_configdirs}" ]; then
others=
for i in `echo ${target_configdirs} | sed -e s/target-//g` ; do
if [ "$i" != "libiberty" ]; then
if [ -r $srcdir/$i/configure ] || [ -r $srcdir/$i/configure.in ]; then
others=yes;
break;
fi
fi
done
if [ -z "${others}" ]; then
target_configdirs=
fi
fi
# Deconfigure all subdirectories, in case we are changing the
# configuration from one where a subdirectory is supported to one where it
# is not.
if [ -z "${norecursion}" -a -n "${configdirs}" ]; then
for i in `echo ${configdirs} | sed -e s/target-//g` ; do
rm -f $i/Makefile
done
fi
if [ -z "${norecursion}" -a -n "${target_configdirs}" ]; then
for i in `echo ${target_configdirs} | sed -e s/target-//g` ; do
rm -f ${target_subdir}/$i/Makefile
done
fi
# Produce a warning message for the subdirs we can't configure.
# This isn't especially interesting in the Cygnus tree, but in the individual
# FSF releases, it's important to let people know when their machine isn't
# supported by the one or two programs in a package.
if [ -n "${notsupp}" ] && [ -z "${norecursion}" ]; then
# If $appdirs is non-empty, at least one of those directories must still
# be configured, or we error out. (E.g., if the gas release supports a
# specified target in some subdirs but not the gas subdir, we shouldn't
# pretend that all is well.)
if [ -n "$appdirs" ]; then
for dir in $appdirs ; do
if [ -r $dir/Makefile.in ]; then
if echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
appdirs=""
break
fi
if echo " ${target_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
appdirs=""
break
fi
fi
done
if [ -n "$appdirs" ]; then
echo "*** This configuration is not supported by this package." 1>&2
exit 1
fi
fi
# Okay, some application will build, or we don't care to check. Still
# notify of subdirs not getting built.
echo "*** This configuration is not supported in the following subdirectories:" 1>&2
echo " ${notsupp}" 1>&2
echo " (Any other directories should still work fine.)" 1>&2
fi
# Set with_gnu_as and with_gnu_ld as appropriate.
#
# This is done by determining whether or not the appropriate directory
# is available, and by checking whether or not specific configurations
# have requested that this magic not happen.
#
# The command line options always override the explicit settings in
# configure.in, and the settings in configure.in override this magic.
#
# If the default for a toolchain is to use GNU as and ld, and you don't
# want to do that, then you should use the --without-gnu-as and
# --without-gnu-ld options for the configure script.
if [ x${use_gnu_as} = x ] ; then
if [ x${with_gnu_as} != xno ] && echo " ${configdirs} " | grep " ${gasdir} " > /dev/null 2>&1 && [ -d ${srcdir}/${gasdir} ] ; then
with_gnu_as=yes
withoptions="$withoptions --with-gnu-as"
fi
fi
if [ x${use_gnu_ld} = x ] ; then
if [ x${with_gnu_ld} != xno ] && echo " ${configdirs} " | grep " ld " > /dev/null 2>&1 && [ -d ${srcdir}/ld ] ; then
with_gnu_ld=yes
withoptions="$withoptions --with-gnu-ld"
fi
fi
if [ x${enable_shared} = xyes ]; then
case "${target}" in
hppa*) target_makefile_frag=config/mt-papic ;;
i[345]86-*) target_makefile_frag=config/mt-x86pic ;;
*) target_makefile_frag=config/mt-${target_cpu}pic ;;
esac
fi
# post-target:
# Make sure that the compiler is able to generate an executable. If it
# can't, we are probably in trouble. We don't care whether we can run the
# executable--we might be using a cross compiler--we only care whether it
# can be created. At this point the main configure script has set CC.
echo "int main () { return 0; }" > conftest.c
${CC} -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c
if [ $? = 0 ] && [ -s conftest ]; then
:
else
echo 1>&2 "*** The command '${CC} -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c' failed."
echo 1>&2 "*** You must set the environment variable CC to a working compiler."
rm -f conftest*
exit 1
fi
rm -f conftest*
# The Solaris /usr/ucb/cc compiler does not appear to work.
case "${host}" in
sparc-sun-solaris2*)
if [ "`/usr/bin/which ${CC-cc}`" = "/usr/ucb/cc" ] ; then
could_use=
[ -d /opt/SUNWspro/bin ] && could_use="/opt/SUNWspro/bin"
if [ -d /opt/cygnus/bin ] ; then
if [ "$could_use" = "" ] ; then
could_use="/opt/cygnus/bin"
else
could_use="$could_use or /opt/cygnus/bin"
fi
fi
if [ "$could_use" = "" ] ; then
echo "Warning: compilation may fail because you're using"
echo "/usr/ucb/cc. You should change your PATH or CC "
echo "variable and rerun configure."
else
echo "Warning: compilation may fail because you're using"
echo "/usr/ucb/cc, when you should use the C compiler from"
echo "$could_use. You should change your"
echo "PATH or CC variable and rerun configure."
fi
fi
;;
esac
# If --enable-shared was set, we must set LD_LIBRARY_PATH so that the
# binutils tools will find libbfd.so.
if [ "${enable_shared}" = "yes" ]; then
sed -e 's/^SET_LIB_PATH[ ]*=.*$/SET_LIB_PATH = $(REALLY_SET_LIB_PATH)/' \
Makefile > Makefile.tem
rm -f Makefile
mv -f Makefile.tem Makefile
case "${host}" in
*-*-hpux*)
sed -e 's/RPATH_ENVVAR[ ]*=.*$/RPATH_ENVVAR = SHLIB_PATH/' \
Makefile > Makefile.tem
rm -f Makefile
mv -f Makefile.tem Makefile
;;
esac
fi
# Record target_configdirs and the configure arguments in Makefile.
target_configdirs=`echo "${target_configdirs}" | sed -e 's/target-//g'`
targargs=`echo "${arguments}" | \
sed -e 's/--norecursion//' \
-e 's/--cache[a-z-]*=[^ ]*//' \
-e 's/--ho[a-z-]*=[^ ]*//' \
-e 's/--ta[a-z-]*=[^ ]*//'`
# Passing a --with-cross-host argument lets the target libraries know
# whether they are being built with a cross-compiler or being built
# native. However, it would be better to use other mechanisms to make the
# sorts of decisions they want to make on this basis. Please consider
# this option to be deprecated. FIXME.
if [ x${is_cross_compiler} = xyes ]; then
targargs="--with-cross-host=${host_alias} ${targargs}"
fi
targargs="--host=${target_alias} ${targargs}"
sed -e "s:^TARGET_CONFIGDIRS[ ]*=.*$:TARGET_CONFIGDIRS = ${target_configdirs}:" \
-e "s%^CONFIG_ARGUMENTS[ ]*=.*$%CONFIG_ARGUMENTS = ${targargs}%" \
-e "s%^TARGET_SUBDIR[ ]*=.*$%TARGET_SUBDIR = ${target_subdir}%" \
Makefile > Makefile.tem
rm -f Makefile
mv -f Makefile.tem Makefile
#
# Local Variables:
# fill-column: 131
# End:
#

236
contrib/gdb/install.sh Executable file
View File

@ -0,0 +1,236 @@
#!/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}"
transformbasename=""
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

15
contrib/gdb/move-if-change Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
if
test -r $2
then
if
cmp $1 $2 > /dev/null
then
echo $2 is unchanged
rm -f $1
else
mv -f $1 $2
fi
else
mv -f $1 $2
fi

View File

@ -0,0 +1,7 @@
/* config.in. Generated automatically from configure.in by autoheader. */
/* Define if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H

1538
contrib/gdb/opcodes/configure vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,216 @@
AC_PREREQ(2.0)
AC_INIT(z8k-dis.c)
# configure.in script for the opcodes library.
# Copyright (C) 1995, 1996 Free Software Foundation, Inc.
# Written by Cygnus Support.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
AC_ARG_ENABLE(targets,
[ --enable-targets alternative target configurations],
[case "${enableval}" in
yes | "") AC_ERROR(enable-targets option must specify target names or 'all')
;;
no) enable_targets= ;;
*) enable_targets=$enableval ;;
esac])dnl
AC_ARG_ENABLE(shared,
[ --enable-shared build shared opcodes library],
[case "${enableval}" in
yes) shared=true ;;
no) shared=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for opcodes shared option]) ;;
esac])dnl
AC_ARG_ENABLE(commonbfdlib,
[ --enable-commonbfdlib build shared BFD/opcodes/libiberty library],
[case "${enableval}" in
yes) commonbfdlib=true ;;
no) commonbfdlib=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for opcodes commonbfdlib option]) ;;
esac])dnl
AC_CONFIG_HEADER(config.h:config.in)
AC_CONFIG_AUX_DIR(`cd $srcdir/..;pwd`)
AC_CANONICAL_SYSTEM
if test -z "$target" ; then
AC_MSG_ERROR(Unrecognized target system type; please check config.sub.)
fi
AC_ARG_PROGRAM
# host-specific stuff:
ALLLIBS='$(TARGETLIB)'
PICFLAG=
SHLIB=unused-shlib
SHLINK=unused-shlink
if test "${shared}" = "true"; then
ALLLIBS='$(TARGETLIB) $(SHLIB) $(SHLINK)'
PICFLAG=-fpic
if test "${commonbfdlib}" = "true"; then
changequote(,)dnl
SHLIB=../bfd/libbfd.so.`sed -e 's/[^0-9]*\([0-9.]*\).*/\1/' ${srcdir}/../bfd/VERSION`
changequote([,])dnl
SHLINK=../bfd/libbfd.so
else
changequote(,)dnl
SHLIB=libopcodes.so.`sed -e 's/[^0-9]*\([0-9.]*\).*/\1/' ${srcdir}/../bfd/VERSION`
changequote([,])dnl
SHLINK=libopcodes.so
fi
fi
AC_PROG_CC
. ${srcdir}/../bfd/configure.host
AC_SUBST(HDEFINES)
AC_CHECK_TOOL(AR, ar)
AC_CHECK_TOOL(RANLIB, ranlib, :)
AC_PROG_INSTALL
if test "${shared}" = "true"; then
if test "${GCC}" != "yes" && test "${shared_non_gcc}" != "yes"; then
AC_MSG_WARN([opcodes --enable-shared only supported when using gcc])
shared=false
ALLLIBS='$(TARGETLIB)'
PICFLAG=
SHLIB=unused-shlib
fi
fi
AC_SUBST(ALLLIBS)
AC_SUBST(PICFLAG)
AC_SUBST(SHLIB)
AC_SUBST(SHLIB_CC)
AC_SUBST(SHLIB_CFLAGS)
if test "${commonbfdlib}" = "true"; then
COMMON_SHLIB=yes
# Rebuild the shared library if libiberty or libbfd changes.
SHLIB_DEP="../libiberty/libiberty.a ../bfd/libbfd.a"
else
COMMON_SHLIB=
SHLIB_DEP=
fi
AC_SUBST(COMMON_SHLIB)
AC_SUBST(SHLIB_DEP)
AC_SUBST(SHLINK)
AC_CHECK_HEADERS(string.h strings.h)
# target-specific stuff:
# Canonicalize the secondary target names.
if test -n "$enable_targets" ; then
for targ in `echo $enable_targets | sed 's/,/ /g'`
do
result=`$ac_config_sub $targ 2>/dev/null`
if test -n "$result" ; then
canon_targets="$canon_targets $result"
else
# Allow targets that config.sub doesn't recognize, like "all".
canon_targets="$canon_targets $targ"
fi
done
fi
all_targets=false
selarchs=
for targ in $target $canon_targets
do
if test "x$targ" = "xall" ; then
all_targets=true
else
. $srcdir/../bfd/config.bfd
selarchs="$selarchs $targ_archs"
fi
done
# We don't do any links based on the target system, just makefile config.
if test x${all_targets} = xfalse ; then
# Target architecture .o files.
ta=
for arch in $selarchs
do
ad=`echo $arch | sed -e s/bfd_//g -e s/_arch//g`
archdefs="$archdefs -DARCH_$ad"
case "$arch" in
bfd_a29k_arch) ta="$ta a29k-dis.o" ;;
bfd_alliant_arch) ;;
bfd_alpha_arch) ta="$ta alpha-dis.o" ;;
bfd_arm_arch) ta="$ta arm-dis.o" ;;
bfd_convex_arch) ;;
bfd_h8300_arch) ta="$ta h8300-dis.o" ;;
bfd_h8500_arch) ta="$ta h8500-dis.o" ;;
bfd_hppa_arch) ta="$ta hppa-dis.o" ;;
bfd_i386_arch) ta="$ta i386-dis.o" ;;
bfd_i860_arch) ;;
bfd_i960_arch) ta="$ta i960-dis.o" ;;
bfd_m68k_arch) ta="$ta m68k-dis.o m68k-opc.o" ;;
bfd_m88k_arch) ta="$ta m88k-dis.o" ;;
bfd_mips_arch) ta="$ta mips-dis.o mips-opc.o" ;;
bfd_ns32k_arch) ta="$ta ns32k-dis.o" ;;
bfd_powerpc_arch) ta="$ta ppc-dis.o ppc-opc.o" ;;
bfd_pyramid_arch) ;;
bfd_romp_arch) ;;
bfd_rs6000_arch) ta="$ta ppc-dis.o ppc-opc.o" ;;
bfd_sh_arch) ta="$ta sh-dis.o" ;;
bfd_sparc_arch) ta="$ta sparc-dis.o sparc-opc.o" ;;
bfd_tahoe_arch) ;;
bfd_vax_arch) ;;
bfd_w65_arch) ta="$ta w65-dis.o" ;;
bfd_we32k_arch) ;;
bfd_z8k_arch) ta="$ta z8k-dis.o" ;;
"") ;;
*) AC_MSG_ERROR(*** unknown target architecture $arch) ;;
esac
done
# Weed out duplicate .o files.
f=""
for i in $ta ; do
case " $f " in
*" $i "*) ;;
*) f="$f $i" ;;
esac
done
ta="$f"
# And duplicate -D flags.
f=""
for i in $archdefs ; do
case " $f " in
*" $i "*) ;;
*) f="$f $i" ;;
esac
done
archdefs="$f"
BFD_MACHINES="$ta"
else # all_targets is true
archdefs=-DARCH_all
BFD_MACHINES='$(ALL_MACHINES)'
fi
AC_SUBST(archdefs)
AC_SUBST(BFD_MACHINES)
AC_OUTPUT(Makefile,
[case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac])

View File

@ -0,0 +1,571 @@
/*
This file is part of GNU Binutils.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <ansidecl.h>
#include "sysdep.h"
#include "dis-asm.h"
#define DEFINE_TABLE
#include "z8k-opc.h"
#include <setjmp.h>
typedef struct
{
/* These are all indexed by nibble number (i.e only every other entry
of bytes is used, and every 4th entry of words). */
unsigned char nibbles[24];
unsigned char bytes[24];
unsigned short words[24];
/* Nibble number of first word not yet fetched. */
int max_fetched;
bfd_vma insn_start;
jmp_buf bailout;
long tabl_index;
char instr_asmsrc[80];
unsigned long arg_reg[0x0f];
unsigned long immediate;
unsigned long displacement;
unsigned long address;
unsigned long cond_code;
unsigned long ctrl_code;
unsigned long flags;
unsigned long interrupts;
}
instr_data_s;
/* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive)
to ADDR (exclusive) are valid. Returns 1 for success, longjmps
on error. */
#define FETCH_DATA(info, nibble) \
((nibble) < ((instr_data_s *)(info->private_data))->max_fetched \
? 1 : fetch_data ((info), (nibble)))
static int
fetch_data (info, nibble)
struct disassemble_info *info;
int nibble;
{
unsigned char mybuf[20];
int status;
instr_data_s *priv = (instr_data_s *)info->private_data;
bfd_vma start;
if ((nibble % 4) != 0)
abort ();
status = (*info->read_memory_func) (priv->insn_start,
(bfd_byte *) mybuf,
nibble / 2,
info);
if (status != 0)
{
(*info->memory_error_func) (status, priv->insn_start, info);
longjmp (priv->bailout, 1);
}
{
int i;
unsigned char *p = mybuf ;
for (i = 0; i < nibble;)
{
priv->words[i] = (p[0] << 8) | p[1];
priv->bytes[i] = *p;
priv->nibbles[i++] = *p >> 4;
priv->nibbles[i++] = *p &0xf;
++p;
priv->bytes[i] = *p;
priv->nibbles[i++] = *p >> 4;
priv->nibbles[i++] = *p & 0xf;
++p;
}
}
priv->max_fetched = nibble;
return 1;
}
static char *codes[16] =
{
"f",
"lt",
"le",
"ule",
"ov/pe",
"mi",
"eq",
"c/ult",
"t",
"ge",
"gt",
"ugt",
"nov/po",
"pl",
"ne",
"nc/uge"
};
int z8k_lookup_instr PARAMS ((unsigned char*, disassemble_info *));
static void output_instr
PARAMS ((instr_data_s *, unsigned long, disassemble_info *));
static void unpack_instr PARAMS ((instr_data_s *, int, disassemble_info *));
static void unparse_instr PARAMS ((instr_data_s *));
static int
print_insn_z8k (addr, info, is_segmented)
bfd_vma addr;
disassemble_info *info;
int is_segmented;
{
instr_data_s instr_data;
info->private_data = (PTR) &instr_data;
instr_data.max_fetched = 0;
instr_data.insn_start = addr;
if (setjmp (instr_data.bailout) != 0)
/* Error return. */
return -1;
instr_data.tabl_index = z8k_lookup_instr (instr_data.nibbles, info);
if (instr_data.tabl_index > 0)
{
unpack_instr (&instr_data, is_segmented, info);
unparse_instr (&instr_data);
output_instr (&instr_data, addr, info);
return z8k_table[instr_data.tabl_index].length;
}
else
{
FETCH_DATA (info, 4);
(*info->fprintf_func) (info->stream, ".word %02x%02x",
instr_data.bytes[0], instr_data.bytes[2]);
return 2;
}
}
print_insn_z8001 (addr, info)
bfd_vma addr;
disassemble_info *info;
{
return print_insn_z8k (addr, info, 1);
}
print_insn_z8002 (addr, info)
bfd_vma addr;
disassemble_info *info;
{
return print_insn_z8k (addr, info, 0);
}
int
z8k_lookup_instr (nibbles, info)
unsigned char *nibbles;
disassemble_info *info;
{
int nibl_index, tabl_index;
int nibl_matched;
unsigned short instr_nibl;
unsigned short tabl_datum, datum_class, datum_value;
nibl_matched = 0;
tabl_index = 0;
while (!nibl_matched && z8k_table[tabl_index].name)
{
nibl_matched = 1;
for (nibl_index = 0; nibl_index < z8k_table[tabl_index].length * 2 && nibl_matched; nibl_index++)
{
if ((nibl_index % 4) == 0)
/* Fetch one word at a time. */
FETCH_DATA (info, nibl_index + 4);
instr_nibl = nibbles[nibl_index];
tabl_datum = z8k_table[tabl_index].byte_info[nibl_index];
datum_class = tabl_datum & CLASS_MASK;
datum_value = ~CLASS_MASK & tabl_datum;
switch (datum_class)
{
case CLASS_BIT:
if (datum_value != instr_nibl)
nibl_matched = 0;
break;
case CLASS_00II:
if (!((~instr_nibl) & 0x4))
nibl_matched = 0;
break;
case CLASS_01II:
if (!(instr_nibl & 0x4))
nibl_matched = 0;
break;
case CLASS_0CCC:
if (!((~instr_nibl) & 0x8))
nibl_matched = 0;
break;
case CLASS_1CCC:
if (!(instr_nibl & 0x8))
nibl_matched = 0;
break;
case CLASS_0DISP7:
if (!((~instr_nibl) & 0x8))
nibl_matched = 0;
nibl_index += 1;
break;
case CLASS_1DISP7:
if (!(instr_nibl & 0x8))
nibl_matched = 0;
nibl_index += 1;
break;
case CLASS_REGN0:
if (instr_nibl == 0)
nibl_matched = 0;
break;
case CLASS_BIT_1OR2:
if ((instr_nibl | 0x2) != (datum_value | 0x2))
nibl_matched = 0;
break;
default:
break;
}
}
if (nibl_matched)
{
return tabl_index;
}
tabl_index++;
}
return -1;
}
static void
output_instr (instr_data, addr, info)
instr_data_s *instr_data;
unsigned long addr;
disassemble_info *info;
{
int loop, loop_limit;
char tmp_str[20];
char out_str[100];
strcpy (out_str, "\t");
loop_limit = z8k_table[instr_data->tabl_index].length * 2;
FETCH_DATA (info, loop_limit);
for (loop = 0; loop < loop_limit; loop++)
{
sprintf (tmp_str, "%x", instr_data->nibbles[loop]);
strcat (out_str, tmp_str);
}
while (loop++ < 8)
{
strcat (out_str, " ");
}
strcat (out_str, instr_data->instr_asmsrc);
(*info->fprintf_func) (info->stream, "%s", out_str);
}
static void
unpack_instr (instr_data, is_segmented, info)
instr_data_s *instr_data;
int is_segmented;
disassemble_info *info;
{
int nibl_count, loop;
unsigned short instr_nibl, instr_byte, instr_word;
long instr_long;
unsigned short tabl_datum, datum_class, datum_value;
nibl_count = 0;
loop = 0;
while (z8k_table[instr_data->tabl_index].byte_info[loop] != 0)
{
FETCH_DATA (info, nibl_count + 4 - (nibl_count % 4));
instr_nibl = instr_data->nibbles[nibl_count];
instr_byte = instr_data->bytes[nibl_count];
instr_word = instr_data->words[nibl_count];
tabl_datum = z8k_table[instr_data->tabl_index].byte_info[loop];
datum_class = tabl_datum & CLASS_MASK;
datum_value = tabl_datum & ~CLASS_MASK;
switch (datum_class)
{
case CLASS_X:
instr_data->address = instr_nibl;
break;
case CLASS_BA:
instr_data->displacement = instr_nibl;
break;
case CLASS_BX:
instr_data->arg_reg[datum_value] = instr_nibl;
break;
case CLASS_DISP:
switch (datum_value)
{
case ARG_DISP16:
instr_data->displacement = instr_word;
nibl_count += 3;
break;
case ARG_DISP12:
instr_data->displacement = instr_word & 0x0fff;
nibl_count += 2;
break;
default:
break;
}
break;
case CLASS_IMM:
switch (datum_value)
{
case ARG_IMM4:
instr_data->immediate = instr_nibl;
break;
case ARG_NIM8:
instr_data->immediate = (-instr_byte);
nibl_count += 1;
break;
case ARG_IMM8:
instr_data->immediate = instr_byte;
nibl_count += 1;
break;
case ARG_IMM16:
instr_data->immediate = instr_word;
nibl_count += 3;
break;
case ARG_IMM32:
FETCH_DATA (info, nibl_count + 8);
instr_long = (instr_data->words[nibl_count] << 16)
| (instr_data->words[nibl_count + 4]);
instr_data->immediate = instr_long;
nibl_count += 7;
break;
case ARG_IMMN:
instr_data->immediate = instr_nibl - 1;
break;
case ARG_IMM4M1:
instr_data->immediate = instr_nibl + 1;
break;
case ARG_IMM_1:
instr_data->immediate = 1;
break;
case ARG_IMM_2:
instr_data->immediate = 2;
break;
case ARG_IMM2:
instr_data->immediate = instr_nibl & 0x3;
break;
default:
break;
}
break;
case CLASS_CC:
instr_data->cond_code = instr_nibl;
break;
case CLASS_CTRL:
instr_data->ctrl_code = instr_nibl;
break;
case CLASS_DA:
case CLASS_ADDRESS:
if (is_segmented)
{
if (instr_nibl & 0x8)
{
FETCH_DATA (info, nibl_count + 8);
instr_long = (instr_data->words[nibl_count] << 16)
| (instr_data->words[nibl_count + 4]);
instr_data->address = ((instr_word & 0x7f00) << 8) +
(instr_long & 0xffff);
nibl_count += 7;
}
else
{
instr_data->address = ((instr_word & 0x7f00) << 8) +
(instr_word & 0x00ff);
nibl_count += 3;
}
}
else
{
instr_data->address = instr_word;
nibl_count += 3;
}
break;
case CLASS_0CCC:
instr_data->cond_code = instr_nibl & 0x7;
break;
case CLASS_1CCC:
instr_data->cond_code = instr_nibl & 0x7;
break;
case CLASS_0DISP7:
instr_data->displacement = instr_byte & 0x7f;
nibl_count += 1;
break;
case CLASS_1DISP7:
instr_data->displacement = instr_byte & 0x7f;
nibl_count += 1;
break;
case CLASS_01II:
instr_data->interrupts = instr_nibl & 0x3;
break;
case CLASS_00II:
instr_data->interrupts = instr_nibl & 0x3;
break;
case CLASS_BIT:
/* do nothing */
break;
case CLASS_IR:
instr_data->arg_reg[datum_value] = instr_nibl;
break;
case CLASS_FLAGS:
instr_data->flags = instr_nibl;
break;
case CLASS_REG:
instr_data->arg_reg[datum_value] = instr_nibl;
break;
case CLASS_REG_BYTE:
instr_data->arg_reg[datum_value] = instr_nibl;
break;
case CLASS_REG_WORD:
instr_data->arg_reg[datum_value] = instr_nibl;
break;
case CLASS_REG_QUAD:
instr_data->arg_reg[datum_value] = instr_nibl;
break;
case CLASS_REG_LONG:
instr_data->arg_reg[datum_value] = instr_nibl;
break;
case CLASS_REGN0:
instr_data->arg_reg[datum_value] = instr_nibl;
break;
default:
break;
}
loop += 1;
nibl_count += 1;
}
}
static void
unparse_instr (instr_data)
instr_data_s *instr_data;
{
unsigned short tabl_datum, datum_class, datum_value;
int loop, loop_limit;
char out_str[80], tmp_str[25];
sprintf (out_str, "\t%s\t", z8k_table[instr_data->tabl_index].name);
loop_limit = z8k_table[instr_data->tabl_index].noperands;
for (loop = 0; loop < loop_limit; loop++)
{
if (loop)
strcat (out_str, ",");
tabl_datum = z8k_table[instr_data->tabl_index].arg_info[loop];
datum_class = tabl_datum & CLASS_MASK;
datum_value = tabl_datum & ~CLASS_MASK;
switch (datum_class)
{
case CLASS_X:
sprintf (tmp_str, "0x%0x(R%d)", instr_data->address,
instr_data->arg_reg[datum_value]);
strcat (out_str, tmp_str);
break;
case CLASS_BA:
sprintf (tmp_str, "r%d(#%x)", instr_data->arg_reg[datum_value],
instr_data->immediate);
strcat (out_str, tmp_str);
break;
case CLASS_BX:
sprintf (tmp_str, "r%d(R%d)", instr_data->arg_reg[datum_value],
instr_data->arg_reg[ARG_RX]);
strcat (out_str, tmp_str);
break;
case CLASS_DISP:
sprintf (tmp_str, "#0x%0x", instr_data->displacement);
strcat (out_str, tmp_str);
break;
case CLASS_IMM:
sprintf (tmp_str, "#0x%0x", instr_data->immediate);
strcat (out_str, tmp_str);
break;
case CLASS_CC:
sprintf (tmp_str, "%s", codes[instr_data->cond_code]);
strcat (out_str, tmp_str);
break;
case CLASS_CTRL:
sprintf (tmp_str, "0x%0x", instr_data->ctrl_code);
strcat (out_str, tmp_str);
break;
case CLASS_DA:
case CLASS_ADDRESS:
sprintf (tmp_str, "#0x%0x", instr_data->address);
strcat (out_str, tmp_str);
break;
case CLASS_IR:
sprintf (tmp_str, "@R%d", instr_data->arg_reg[datum_value]);
strcat (out_str, tmp_str);
break;
case CLASS_FLAGS:
sprintf (tmp_str, "0x%0x", instr_data->flags);
strcat (out_str, tmp_str);
break;
case CLASS_REG_BYTE:
if (instr_data->arg_reg[datum_value] >= 0x8)
{
sprintf (tmp_str, "rl%d",
instr_data->arg_reg[datum_value] - 0x8);
}
else
{
sprintf (tmp_str, "rh%d", instr_data->arg_reg[datum_value]);
}
strcat (out_str, tmp_str);
break;
case CLASS_REG_WORD:
sprintf (tmp_str, "r%d", instr_data->arg_reg[datum_value]);
strcat (out_str, tmp_str);
break;
case CLASS_REG_QUAD:
sprintf (tmp_str, "rq%d", instr_data->arg_reg[datum_value]);
strcat (out_str, tmp_str);
break;
case CLASS_REG_LONG:
sprintf (tmp_str, "rr%d", instr_data->arg_reg[datum_value]);
strcat (out_str, tmp_str);
break;
default:
break;
}
}
strcpy (instr_data->instr_asmsrc, out_str);
}