summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Shebs <shebs@apple.com>1999-04-27 01:33:01 +0000
committerStan Shebs <shebs@apple.com>1999-04-27 01:33:01 +0000
commitafa35469277653e5d7cc4748d535a98e9a278b5d (patch)
tree3c38d8194626ffd57af7e75caed1d1433d9e0da7
parentfe454715791b86ad488b33c1f325478803c8108c (diff)
downloadgdb-afa35469277653e5d7cc4748d535a98e9a278b5d.tar.gz
Initial revision
-rw-r--r--gdb/MAINTAINERS33
-rw-r--r--gdb/config/i386/go32.mt3
-rw-r--r--gdb/config/i386/nm-go32.h57
-rw-r--r--gdb/config/i386/tm-go32.h212
-rw-r--r--gdb/config/tic80/tic80.mt7
-rw-r--r--gdb/config/tic80/tm-tic80.h257
-rw-r--r--gdb/go32-nat.c754
-rw-r--r--gdb/tic80-tdep.c483
-rw-r--r--readline/doc/readline.01122
-rw-r--r--sim/mcore/ChangeLog14
-rw-r--r--sim/mcore/Makefile.in29
-rw-r--r--sim/mcore/config.in34
-rwxr-xr-xsim/mcore/configure3892
-rw-r--r--sim/mcore/configure.in10
-rw-r--r--sim/mcore/interp.c2133
-rw-r--r--sim/mcore/sysdep.h91
16 files changed, 9131 insertions, 0 deletions
diff --git a/gdb/MAINTAINERS b/gdb/MAINTAINERS
new file mode 100644
index 00000000000..3810c96c1b8
--- /dev/null
+++ b/gdb/MAINTAINERS
@@ -0,0 +1,33 @@
+d10v target Andrew Cagney cagney@cygnus.com
+d30v target Andrew Cagney cagney@cygnus.com
+mips target Andrew Cagney cagney@cygnus.com
+powerpc target Andrew Cagney cagney@cygnus.com
+generic arch support Andrew Cagney cagney@cygnus.com
+target vector Andrew Cagney cagney@cygnus.com
+remote.c Andrew Cagney cagney@cygnus.com
+djgpp native DJ Delorie dj@cygnus.com
+win32 host & native Chris Faylor cgf@cygnus.com
+main (main.c, top.c) Elena Zannoni ezannoni@cygnus.com
+readline Elena Zannoni ezannoni@cygnus.com
+arm target Elena Zannoni ezannoni@cygnus.com
+command interpreter Fernando Nasser fnasser@cygnus.com
+generic symtabs Jim Blandy jimb@cygnus.com
+dwarf readers Jim Blandy jimb@cygnus.com
+elf reader Jim Blandy jimb@cygnus.com
+stabs reader Jim Blandy jimb@cygnus.com
+x86 linux native Jim Blandy jimb@cygnus.com
+Scheme support Jim Blandy jimb@cygnus.com
+m32r target Michael Snyder msnyder@cygnus.com
+tracing Michael Snyder msnyder@cygnus.com
+threads Michael Snyder msnyder@cygnus.com
+breakpoint.c Michael Snyder msnyder@cygnus.com
+macos host & native Stan Shebs shebs@cygnus.com
+sds protocol Stan Shebs shebs@cygnus.com
+rdi/adp protocol Stan Shebs shebs@cygnus.com
+gdbserver Stan Shebs shebs@cygnus.com
+documentation Stan Shebs shebs@cygnus.com
+testsuite Stan Shebs shebs@cygnus.com
+language support David Taylor taylor@cygnus.com
+expression eval David Taylor taylor@cygnus.com
+defs.h David Taylor taylor@cygnus.com
+utils.c David Taylor taylor@cygnus.com
diff --git a/gdb/config/i386/go32.mt b/gdb/config/i386/go32.mt
new file mode 100644
index 00000000000..9b82c6426b4
--- /dev/null
+++ b/gdb/config/i386/go32.mt
@@ -0,0 +1,3 @@
+# Target: Intel 386 running DJGPP
+TDEPFILES= i386-tdep.o i387-tdep.o
+TM_FILE= tm-go32.h
diff --git a/gdb/config/i386/nm-go32.h b/gdb/config/i386/nm-go32.h
new file mode 100644
index 00000000000..183b60fa181
--- /dev/null
+++ b/gdb/config/i386/nm-go32.h
@@ -0,0 +1,57 @@
+/* Native definitions for Intel x86 running DJGPP.
+ Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+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. */
+
+#define NO_PTRACE_H
+
+#include "i386/nm-i386v.h"
+
+#define TARGET_HAS_HARDWARE_WATCHPOINTS
+
+#define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) 1
+
+/* After a watchpoint trap, the PC points to the instruction after the
+ one that caused the trap. Therefore we don't need to step over it.
+ But we do need to reset the status register to avoid another trap. */
+
+#define HAVE_CONTINUABLE_WATCHPOINT
+
+#define STOPPED_BY_WATCHPOINT(W) \
+ go32_stopped_by_watchpoint (inferior_pid)
+
+/* Use these macros for watchpoint insertion/removal. */
+
+#define target_insert_watchpoint(addr, len, type) \
+ go32_insert_watchpoint (inferior_pid, addr, len, 2)
+
+#define target_remove_watchpoint(addr, len, type) \
+ go32_remove_watchpoint (inferior_pid, addr, len)
+
+#define target_insert_hw_breakpoint(addr, shadow) \
+ go32_insert_hw_breakpoint(addr, shadow)
+
+#define target_remove_hw_breakpoint(addr, shadow) \
+ go32_remove_hw_breakpoint(addr, shadow)
+
+#define DECR_PC_AFTER_HW_BREAK 0
+
+#undef FLOAT_INFO
+#define FLOAT_INFO { i386_go32_float_info (); }
+
+extern void i386_go32_float_info (void);
+
diff --git a/gdb/config/i386/tm-go32.h b/gdb/config/i386/tm-go32.h
new file mode 100644
index 00000000000..84b82929ec5
--- /dev/null
+++ b/gdb/config/i386/tm-go32.h
@@ -0,0 +1,212 @@
+/* Target-dependent definitions for Intel x86 running DJGPP.
+ Copyright 1995, 1996, 1997 Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+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 "i386/tm-i386v.h"
+
+/* Number of machine registers. */
+
+#undef NUM_FREGS
+#define NUM_FREGS 15
+#undef NUM_REGS
+#define NUM_REGS (16+NUM_FREGS)
+
+/* Initializer for an array of names of registers. There should be
+ NUM_REGS strings in this initializer. */
+
+/* The order of the first 8 registers must match the compiler's
+ numbering scheme (which is the same as the 386 scheme). */
+
+#undef REGISTER_NAMES
+#define REGISTER_NAMES { "eax", "ecx", "edx", "ebx", \
+ "esp", "ebp", "esi", "edi", \
+ "eip", "eflags","cs", "ss", \
+ "ds", "es", "fs", "gs", \
+ "st0", "st1", "st2", "st3", \
+ "st4", "st5", "st6", "st7", \
+ "fctrl","fstat", "ftag", "fcs", \
+ "fopsel","fip", "fopoff" }
+
+#undef FP_REGNUM
+#define FP_REGNUM 5 /* (ebp) Contains addr of stack frame */
+#undef SP_REGNUM
+#define SP_REGNUM 4 /* (usp) Contains address of top of stack */
+#undef PS_REGNUM
+#define PS_REGNUM 9 /* (ps) Contains processor status */
+#undef PC_REGNUM
+#define PC_REGNUM 8 /* (eip) Contains program counter */
+#undef FP0_REGNUM
+#define FP0_REGNUM 16 /* Floating point register 0 */
+#undef FPC_REGNUM
+#define FPC_REGNUM 24 /* 80387 control register */
+#undef FPCWD_REGNUM
+#define FPCWD_REGNUM FPC_REGNUM
+#undef FPSWD_REGNUM
+#define FPSWD_REGNUM 25 /* 80387 status register */
+#undef FPTWD_REGNUM
+#define FPTWD_REGNUM 26 /* 80387 tag register */
+#undef FPIPO_REGNUM
+#define FPIPO_REGNUM 29 /* 80387 instruction pointer offset reg */
+#undef FPIPS_REGNUM
+#define FPIPS_REGNUM 27 /* 80387 instruction pointer selector reg */
+#undef FPOOS_REGNUM
+#define FPOOS_REGNUM 30 /* 80387 operand pointer offset reg */
+#undef FPOPS_REGNUM
+#define FPOPS_REGNUM 28 /* 80387 operand pointer selector reg */
+
+/* Total amount of space needed to store our copies of the machine's
+ register state, the array `registers'. */
+
+#undef REGISTER_BYTES
+#define REGISTER_BYTES (10*4 + 6*2 + 8*10 + 5*2 + 2*4)
+
+/* Index within `registers' of the first byte of the space for
+ register N. */
+
+#undef REGISTER_BYTE
+#define REGBYTE_0 0
+#define REGBYTE_10 (REGBYTE_0+10*4)
+#define REGBYTE_16 (REGBYTE_10+6*2)
+#define REGBYTE_24 (REGBYTE_16+8*10)
+#define REGBYTE_29 (REGBYTE_24+5*2)
+#define REGISTER_BYTE(N) (((N) < 10) ? (N) * 4 : \
+ (N) < 16 ? REGBYTE_10 +((N) - 10) * 2 : \
+ (N) < 24 ? REGBYTE_16 +((N) - 16) * 10 : \
+ (N) < 29 ? REGBYTE_24 +((N) - 24) * 2 : \
+ REGBYTE_29 + ((N) - 29) * 4)
+
+/* Number of bytes of storage in the actual machine representation
+ for register N. */
+
+#undef REGISTER_RAW_SIZE
+#define REGISTER_RAW_SIZE(N) ((N) < 10 ? 4 : (N) < 16 ? 2 : (N) < 24 ? 10 : \
+ (N) < 29 ? 2 : 4)
+
+/* Number of bytes of storage in the program's representation
+ for register N. */
+
+#undef REGISTER_VIRTUAL_SIZE
+#define REGISTER_VIRTUAL_SIZE(N) REGISTER_RAW_SIZE(N)
+
+/* Largest value REGISTER_RAW_SIZE can have. */
+
+#undef MAX_REGISTER_RAW_SIZE
+#define MAX_REGISTER_RAW_SIZE 10
+
+/* Largest value REGISTER_VIRTUAL_SIZE can have. */
+
+#undef MAX_REGISTER_VIRTUAL_SIZE
+#define MAX_REGISTER_VIRTUAL_SIZE 10
+
+/* Nonzero if register N requires conversion
+ from raw format to virtual format. */
+
+#undef REGISTER_CONVERTIBLE
+#define REGISTER_CONVERTIBLE(N) ((N) < FP0_REGNUM ? 0 :\
+ (N) < FPC_REGNUM ? 1 : 0)
+
+/* The host and target are i386 machines and the compiler supports
+ long doubles. Long doubles on the host therefore have the same
+ layout as a 387 FPU stack register. */
+
+#if defined(HAVE_LONG_DOUBLE) && defined(HOST_I386)
+#undef LD_I387
+#define LD_I387
+#endif
+
+/* Allow floating point numbers to be specified by a raw long double
+ 10 hex bytes number, e.g. 1.0 can be input as
+ 0x3fff8000000000000000 */
+
+#ifdef LD_I387
+#define HEX_LONG_DOUBLE_INPUT(base,p,len,target) \
+ ((base) == 16 && (len) == 20 \
+ && i387_hex_long_double_input ((p), (target)))
+#endif
+
+extern int i387_hex_long_double_input (char *p, long double *putithere);
+
+#undef REGISTER_CONVERT_TO_VIRTUAL
+#ifdef LD_I387
+#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \
+{ \
+ if (TYPE == REGISTER_VIRTUAL_TYPE (REGNUM)) \
+ { \
+ memcpy (TO, FROM, TYPE_LENGTH (TYPE)); \
+ } \
+ else \
+ { \
+ long double val = *((long double *)FROM); \
+ store_floating ((TO), TYPE_LENGTH (TYPE), val); \
+ } \
+}
+#else
+/* Convert data from raw format for register REGNUM in buffer FROM to
+ virtual format with type TYPE in buffer TO. */
+#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \
+{ \
+ double val; \
+ i387_to_double ((FROM), (char *)&val); \
+ store_floating ((TO), TYPE_LENGTH (TYPE), val); \
+}
+#endif
+
+extern void i387_to_double PARAMS ((char *, char *));
+
+#undef REGISTER_CONVERT_TO_RAW
+#ifdef LD_I387
+#define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \
+{ \
+ if (TYPE == REGISTER_VIRTUAL_TYPE (REGNUM)) \
+ { \
+ memcpy (TO, FROM, TYPE_LENGTH (TYPE)); \
+ } \
+ else \
+ { \
+ long double val = extract_floating ((FROM), TYPE_LENGTH (TYPE)); \
+ *((long double *)TO) = val; \
+ } \
+}
+#else
+#define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO) \
+{ \
+ double val = extract_floating ((FROM), TYPE_LENGTH (TYPE)); \
+ double_to_i387((char *)&val, (TO)); \
+}
+#endif
+
+extern void double_to_i387 PARAMS ((char *, char *));
+
+/* Return the GDB type object for the "standard" data type of data in
+ register N. */
+
+#undef REGISTER_VIRTUAL_TYPE
+#ifdef LD_I387
+#define REGISTER_VIRTUAL_TYPE(N) \
+ ((N < FP0_REGNUM) ? builtin_type_int : \
+ (N < FPC_REGNUM) ? builtin_type_long_double : builtin_type_int)
+#else
+#define REGISTER_VIRTUAL_TYPE(N) \
+ ((N < FP0_REGNUM) ? builtin_type_int : \
+ (N < FPC_REGNUM) ? builtin_type_double : builtin_type_int)
+#endif
+
+#undef TARGET_LONG_DOUBLE_BIT
+#define TARGET_LONG_DOUBLE_BIT 96
+
+#define NAMES_HAVE_UNDERSCORE
diff --git a/gdb/config/tic80/tic80.mt b/gdb/config/tic80/tic80.mt
new file mode 100644
index 00000000000..10be27e2633
--- /dev/null
+++ b/gdb/config/tic80/tic80.mt
@@ -0,0 +1,7 @@
+# Target: TI TMS320C80 (MVP) processor
+TDEPFILES= tic80-tdep.o
+TM_FILE= tm-tic80.h
+SIM_OBS = remote-sim.o
+SIM = ../sim/tic80/libsim.a
+GDBSERVER_DEPFILES= low-sim.o
+GDBSERVER_LIBS = ../../sim/tic80/libsim.a ../../bfd/libbfd.a ../../libiberty/libiberty.a -lm
diff --git a/gdb/config/tic80/tm-tic80.h b/gdb/config/tic80/tm-tic80.h
new file mode 100644
index 00000000000..e17ca95b838
--- /dev/null
+++ b/gdb/config/tic80/tm-tic80.h
@@ -0,0 +1,257 @@
+/* Parameters for execution on a TI TMS320C80 (MVP) processor.
+ Copyright 1997
+ Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+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. */
+
+#ifndef TM_TIC80_H
+#define TM_TIC80_H
+
+#ifdef __STDC__ /* Forward declare structs used in prototypes */
+struct frame_info;
+struct type;
+struct value;
+struct symbol;
+struct frame_saved_regs;
+#endif
+
+#define TARGET_BYTE_ORDER LITTLE_ENDIAN
+
+/* Define this if the C compiler puts an underscore at the front
+ of external names before giving them to the linker. */
+
+#define NAMES_HAVE_UNDERSCORE
+
+#define NUM_REGS 38
+
+#define REGISTER_NAMES \
+{ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \
+ "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15", \
+ "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", \
+ "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", \
+ "pc", "npc", \
+ "a0", "a1", "a2", "a3", \
+}
+
+/* Various dedicated register numbers
+ FIXME: Shadow updates in sim/tic80/sim-calls.c */
+
+#define SP_REGNUM 1 /* Contains address of top of stack */
+#define ARG0_REGNUM 2 /* Contains argument 1 (r3 has high word) */
+#define RET_REGNUM 2 /* Contains function return value */
+#define ARGLAST_REGNUM 12 /* Contains argument 6 (r13 has high word) */
+#define FP_REGNUM 30 /* Contains address of executing stack frame */
+#define LR_REGNUM 31 /* Contains address of caller (link register) */
+#define PC_REGNUM 32 /* Contains program counter (FIXME?) */
+#define NPC_REGNUM 33 /* Contains the next program counter (FIXME?) */
+#define A0_REGNUM 34 /* Accumulator register 0 */
+#define A3_REGNUM 37 /* Accumulator register 1 */
+
+#define R0_REGNUM 0 /* General Purpose Register 0 - for sim */
+#define Rn_REGNUM 31 /* Last General Purpose Register - for sim */
+#define An_REGNUM A3_REGNUM /* Last Accumulator register - for sim */
+
+/* Total amount of space needed to store our copies of the machine's
+ register state, the array `registers'. */
+
+#define REGISTER_BYTES (((NUM_REGS - 4) * 4) + (4 * 8))
+
+/* Index within `registers' of the first byte of the space for
+ register N. */
+
+#define REGISTER_BYTE(N) \
+ (((N) >= A0_REGNUM) ? (((N) - A0_REGNUM) * 8 + A0_REGNUM * 4) : ((N) * 4))
+
+/* Most registers are 4 bytes */
+
+#define REGISTER_SIZE 4
+
+/* Some registers are 8 bytes. */
+
+#define REGISTER_RAW_SIZE(N) \
+ (((N) >= A0_REGNUM) ? 8 : 4)
+
+/* Largest value REGISTER_RAW_SIZE can have. */
+
+#define MAX_REGISTER_RAW_SIZE (8)
+
+/* All regs are 4 bytes. */
+
+#define REGISTER_VIRTUAL_SIZE(N) (REGISTER_RAW_SIZE(N))
+
+/* Largest value REGISTER_VIRTUAL_SIZE can have. */
+
+#define MAX_REGISTER_VIRTUAL_SIZE (MAX_REGISTER_RAW_SIZE)
+
+/* Return the GDB type object for the "standard" data type
+ of data in register N. */
+
+#define REGISTER_VIRTUAL_TYPE(N) /* FIXME? */ \
+ (((N) >= A0_REGNUM) ? builtin_type_float : builtin_type_int)
+
+/* Offset from address of function to start of its code.
+ Zero on most machines. */
+
+#define FUNCTION_START_OFFSET 0
+
+/* Stack grows downward. */
+
+#define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
+
+/* Sequence of bytes for breakpoint instruction.
+ This is padded out to the size of a machine word. */
+
+#define BREAKPOINT {0x49, 0x80, 0x00, 0x00} /* FIXME! */
+
+/* Amount PC must be decremented by after a breakpoint.
+ This is often the number of bytes in BREAKPOINT
+ but not always. */
+
+#define DECR_PC_AFTER_BREAK 0 /* FIXME! */
+
+/* Discard from the stack the innermost frame, restoring all registers. */
+
+#define POP_FRAME tic80_pop_frame(get_current_frame ())
+extern struct frame_info *tic80_pop_frame PARAMS ((struct frame_info *frame));
+
+/* Return number of bytes at start of arglist that are not really args. */
+
+#define FRAME_ARGS_SKIP 0
+
+/* Set VAL to the number of args passed to frame described by FI.
+ Can set VAL to -1, meaning no way to tell. */
+/* We can't tell how many args there are */
+
+#define FRAME_NUM_ARGS(val,fi) (val = -1)
+
+#define FRAME_ARGS_SKIP 0
+#define FRAME_ARGS_ADDRESS(fi) (fi)->frame
+#define FRAME_LOCALS_ADDRESS(fi) (fi)->frame
+
+/* Define other aspects of the stack frame.
+ We keep the offsets of all saved registers, 'cause we need 'em a lot!
+ We also keep the current size of the stack frame, and the offset of
+ the frame pointer from the stack pointer (for frameless functions, and
+ when we're still in the prologue of a function with a frame) */
+
+#define EXTRA_FRAME_INFO \
+ struct frame_saved_regs fsr; \
+ int framesize; \
+ int frameoffset; \
+ int framereg;
+
+extern void tic80_init_extra_frame_info PARAMS ((struct frame_info *fi));
+#define INIT_EXTRA_FRAME_INFO(fromleaf, fi) tic80_init_extra_frame_info (fi)
+#define INIT_FRAME_PC /* Not necessary */
+
+/* Put here the code to store, into a struct frame_saved_regs,
+ the addresses of the saved registers of frame described by FRAME_INFO.
+ This includes special registers such as pc and fp saved in special
+ ways in the stack frame. sp is even more special:
+ the address we return for it IS the sp for the next frame. */
+
+#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
+ tic80_frame_find_saved_regs(frame_info, &(frame_saved_regs))
+extern void tic80_frame_find_saved_regs PARAMS ((struct frame_info *, struct frame_saved_regs *));
+
+/* Advance PC across any function entry prologue instructions
+ to reach some "real" code. */
+
+#define SKIP_PROLOGUE(pc) { (pc) = tic80_skip_prologue (pc); }
+extern CORE_ADDR tic80_skip_prologue PARAMS ((CORE_ADDR pc));
+
+/* Immediately after a function call, return the saved pc.
+ Can't always go through the frames for this because on some machines
+ the new frame is not set up until the new function executes
+ some instructions. */
+
+#define SAVED_PC_AFTER_CALL(frame) read_register (LR_REGNUM)
+
+/* Describe the pointer in each stack frame to the previous stack frame
+ (its caller). */
+
+/* FRAME_CHAIN takes a frame's nominal address
+ and produces the frame's chain-pointer. */
+
+#define FRAME_CHAIN(thisframe) (CORE_ADDR) tic80_frame_chain (thisframe)
+extern CORE_ADDR tic80_frame_chain PARAMS ((struct frame_info *));
+
+#define FRAME_SAVED_PC(FRAME) tic80_frame_saved_pc (FRAME)
+extern CORE_ADDR tic80_frame_saved_pc PARAMS ((struct frame_info *));
+
+/* Store the address of the place in which to copy the structure the
+ subroutine will return. This is called from call_function.
+
+ We store structs through a pointer passed in R2 */
+
+#define STORE_STRUCT_RETURN(STRUCT_ADDR, SP) \
+ write_register (ARG0_REGNUM, STRUCT_ADDR)
+
+/* Extract from an array REGBUF containing the (raw) register state
+ a function return value of type TYPE, and copy that, in virtual format,
+ into VALBUF. */
+
+#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
+ memcpy ((VALBUF), \
+ (char *)(REGBUF) + REGISTER_BYTE (RET_REGNUM) + \
+ ((TYPE_LENGTH (TYPE) > 4 ? 8 : 4) - TYPE_LENGTH (TYPE)), \
+ TYPE_LENGTH (TYPE))
+
+/* Write into appropriate registers a function return value
+ of type TYPE, given in virtual format. */
+
+#define STORE_RETURN_VALUE(TYPE,VALBUF) \
+ write_register_bytes(REGISTER_BYTE (RET_REGNUM) + \
+ ((TYPE_LENGTH (TYPE) > 4 ? 8:4) - TYPE_LENGTH (TYPE)),\
+ (VALBUF), TYPE_LENGTH (TYPE));
+
+
+
+/* PUSH_ARGUMENTS */
+extern CORE_ADDR tic80_push_arguments PARAMS ((int nargs,
+ struct value **args,
+ CORE_ADDR sp,
+ unsigned char struct_return,
+ CORE_ADDR struct_addr));
+
+#define PUSH_ARGUMENTS(NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR) \
+ (SP) = tic80_push_arguments (NARGS, ARGS, SP, STRUCT_RETURN, STRUCT_ADDR)
+
+/* PUSH_RETURN_ADDRESS */
+extern CORE_ADDR tic80_push_return_address PARAMS ((CORE_ADDR, CORE_ADDR));
+#define PUSH_RETURN_ADDRESS(PC, SP) tic80_push_return_address (PC, SP)
+
+/* override the standard get_saved_register function with
+ one that takes account of generic CALL_DUMMY frames */
+#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) \
+ generic_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
+
+#define USE_GENERIC_DUMMY_FRAMES 1
+#define CALL_DUMMY {0}
+#define CALL_DUMMY_LENGTH (0)
+#define CALL_DUMMY_START_OFFSET (0)
+#define CALL_DUMMY_BREAKPOINT_OFFSET (0)
+#define FIX_CALL_DUMMY(DUMMY1, STARTADDR, FUNADDR, NARGS, ARGS, TYPE, GCCP)
+#define CALL_DUMMY_LOCATION AT_ENTRY_POINT
+#define CALL_DUMMY_ADDRESS() entry_point_address ()
+
+/* generic dummy frame stuff */
+
+#define PUSH_DUMMY_FRAME generic_push_dummy_frame ()
+#define PC_IN_CALL_DUMMY(PC, SP, FP) generic_pc_in_call_dummy (PC, SP, FP)
+
+#endif /* TM_TIC80_H */
diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
new file mode 100644
index 00000000000..782d240805b
--- /dev/null
+++ b/gdb/go32-nat.c
@@ -0,0 +1,754 @@
+/* Native debugging support for Intel x86 running DJGPP.
+ Copyright 1997, 1999 Free Software Foundation, Inc.
+ Written by Robert Hoehne.
+
+This file is part of GDB.
+
+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 <fcntl.h>
+
+#include "defs.h"
+#include "frame.h" /* required by inferior.h */
+#include "inferior.h"
+#include "target.h"
+#include "wait.h"
+#include "gdbcore.h"
+#include "command.h"
+#include "floatformat.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <debug/v2load.h>
+#include <debug/dbgcom.h>
+
+extern void _initialize_go32_nat (void);
+
+struct env387
+{
+ unsigned short control;
+ unsigned short r0;
+ unsigned short status;
+ unsigned short r1;
+ unsigned short tag;
+ unsigned short r2;
+ unsigned long eip;
+ unsigned short code_seg;
+ unsigned short opcode;
+ unsigned long operand;
+ unsigned short operand_seg;
+ unsigned short r3;
+ unsigned char regs[8][10];
+};
+
+extern char **environ;
+
+#define SOME_PID 42
+
+/* FIXME add decls of all static functions here */
+
+static int prog_has_started = 0;
+
+static void
+print_387_status (unsigned short status, struct env387 *ep)
+{
+ int i;
+ int bothstatus;
+ int top;
+ int fpreg;
+
+ bothstatus = ((status != 0) && (ep->status != 0));
+ if (status != 0)
+ {
+ if (bothstatus)
+ printf_unfiltered ("u: ");
+ print_387_status_word (status);
+ }
+
+ if (ep->status != 0)
+ {
+ if (bothstatus)
+ printf_unfiltered ("e: ");
+ print_387_status_word (ep->status);
+ }
+
+ print_387_control_word (ep->control & 0xffff);
+ printf_unfiltered ("last exception: ");
+ printf_unfiltered ("opcode %s; ", local_hex_string (ep->opcode));
+ printf_unfiltered ("pc %s:", local_hex_string (ep->code_seg));
+ printf_unfiltered ("%s; ", local_hex_string (ep->eip));
+ printf_unfiltered ("operand %s", local_hex_string (ep->operand_seg));
+ printf_unfiltered (":%s\n", local_hex_string (ep->operand));
+
+ top = (ep->status >> 11) & 7;
+
+ printf_unfiltered ("regno tag msb lsb value\n");
+ for (fpreg = 0; fpreg < 8; fpreg++)
+ {
+ long double val;
+
+ printf_unfiltered ("%s %d: ", fpreg == top ? "=>" : " ", fpreg);
+
+ switch ((ep->tag >> (fpreg * 2)) & 3)
+ {
+ case 0:
+ printf_unfiltered ("valid ");
+ break;
+ case 1:
+ printf_unfiltered ("zero ");
+ break;
+ case 2:
+ printf_unfiltered ("trap ");
+ break;
+ case 3:
+ printf_unfiltered ("empty ");
+ break;
+ }
+ for (i = 0; i < 8; i++)
+ printf_unfiltered ("%02x", ep->regs[fpreg][i]);
+
+ REGISTER_CONVERT_TO_VIRTUAL (FP0_REGNUM + fpreg, builtin_type_long_double,
+ &ep->regs[fpreg], &val);
+
+ printf_unfiltered (" %LG\n", val);
+ }
+}
+
+void
+i386_go32_float_info (void)
+{
+ print_387_status (0, (struct env387 *) &npx);
+}
+
+#define r_ofs(x) ((int)(&(((TSS *)0)->x)))
+
+static struct
+{
+ int tss_ofs;
+ int size;
+}
+regno_mapping[] =
+{
+ r_ofs (tss_eax), 4,
+ r_ofs (tss_ecx), 4,
+ r_ofs (tss_edx), 4,
+ r_ofs (tss_ebx), 4,
+ r_ofs (tss_esp), 4,
+ r_ofs (tss_ebp), 4,
+ r_ofs (tss_esi), 4,
+ r_ofs (tss_edi), 4,
+ r_ofs (tss_eip), 4,
+ r_ofs (tss_eflags), 4,
+ r_ofs (tss_cs), 2,
+ r_ofs (tss_ss), 2,
+ r_ofs (tss_ds), 2,
+ r_ofs (tss_es), 2,
+ r_ofs (tss_fs), 2,
+ r_ofs (tss_gs), 2,
+ 0, 10,
+ 1, 10,
+ 2, 10,
+ 3, 10,
+ 4, 10,
+ 5, 10,
+ 6, 10,
+ 7, 10,
+ 0, 2,
+ 4, 2,
+ 8, 2,
+ 12, 4,
+ 16, 2,
+ 20, 4,
+ 24, 2
+};
+
+static struct
+ {
+ int go32_sig;
+ int gdb_sig;
+ }
+sig_map[] =
+{
+ 0, TARGET_SIGNAL_FPE,
+ 1, TARGET_SIGNAL_TRAP,
+ 2, TARGET_SIGNAL_UNKNOWN,
+ 3, TARGET_SIGNAL_TRAP,
+ 4, TARGET_SIGNAL_FPE,
+ 5, TARGET_SIGNAL_SEGV,
+ 6, TARGET_SIGNAL_ILL,
+ 7, TARGET_SIGNAL_FPE,
+ 8, TARGET_SIGNAL_SEGV,
+ 9, TARGET_SIGNAL_SEGV,
+ 10, TARGET_SIGNAL_BUS,
+ 11, TARGET_SIGNAL_SEGV,
+ 12, TARGET_SIGNAL_SEGV,
+ 13, TARGET_SIGNAL_ABRT,
+ 14, TARGET_SIGNAL_SEGV,
+ 16, TARGET_SIGNAL_FPE,
+ 31, TARGET_SIGNAL_ILL,
+ 0x75, TARGET_SIGNAL_FPE,
+ 0x79, TARGET_SIGNAL_INT,
+ 0x1b, TARGET_SIGNAL_INT,
+ -1, -1
+};
+
+static void
+go32_open (char *name, int from_tty)
+{
+ printf_unfiltered ("Use the `run' command to run go32 programs\n");
+}
+
+static void
+go32_close (int quitting)
+{
+}
+
+static void
+go32_attach (char *args, int from_tty)
+{
+ printf_unfiltered ("Use the `run' command to run go32 programs\n");
+}
+
+static void
+go32_detach (char *args, int from_tty)
+{
+}
+
+static int resume_is_step;
+
+static void
+go32_resume (int pid, int step, enum target_signal siggnal)
+ {
+ resume_is_step = step;
+ }
+
+static int
+go32_wait (int pid, struct target_waitstatus *status)
+{
+ int i;
+
+ if (resume_is_step)
+ a_tss.tss_eflags |= 0x0100;
+ else
+ a_tss.tss_eflags &= 0xfeff;
+
+ run_child ();
+
+ if (a_tss.tss_irqn == 0x21)
+ {
+ status->kind = TARGET_WAITKIND_EXITED;
+ status->value.integer = a_tss.tss_eax & 0xff;
+ }
+ else
+ {
+ status->value.sig = TARGET_SIGNAL_UNKNOWN;
+ status->kind = TARGET_WAITKIND_STOPPED;
+ for (i = 0; sig_map[i].go32_sig != -1; i++)
+ {
+ if (a_tss.tss_irqn == sig_map[i].go32_sig)
+ {
+ if ((status->value.sig = sig_map[i].gdb_sig) !=
+ TARGET_SIGNAL_TRAP)
+ status->kind = TARGET_WAITKIND_SIGNALLED;
+ break;
+ }
+ }
+ }
+ return SOME_PID;
+}
+
+static void
+go32_fetch_registers (int regno)
+{
+ /*JHW*/
+ int end_reg = regno + 1; /* just one reg initially */
+
+ if (regno < 0) /* do the all registers */
+ {
+ regno = 0; /* start at first register */
+ /* # regs in table */
+ end_reg = sizeof (regno_mapping) / sizeof (regno_mapping[0]);
+ }
+
+ for (; regno < end_reg; regno++)
+ {
+ if (regno < 16)
+ supply_register (regno,
+ (char *) &a_tss + regno_mapping[regno].tss_ofs);
+ else if (regno < 24)
+ supply_register (regno,
+ (char *) &npx.reg[regno_mapping[regno].tss_ofs]);
+ else if (regno < 31)
+ supply_register (regno,
+ (char *) &npx.reg + regno_mapping[regno].tss_ofs);
+ else
+ {
+ printf_unfiltered ("Invalid register in go32_fetch_register(%d)",
+ regno);
+ exit (1);
+ }
+ }
+}
+
+static void
+store_register (int regno)
+{
+ void *rp;
+ void *v = (void *) &registers[REGISTER_BYTE (regno)];
+
+ if (regno < 16)
+ rp = (char *) &a_tss + regno_mapping[regno].tss_ofs;
+ else if (regno < 24)
+ rp = (char *) &npx.reg[regno_mapping[regno].tss_ofs];
+ else if (regno > 31)
+ rp = (char *) &npx + regno_mapping[regno].tss_ofs;
+ else
+ {
+ printf_unfiltered ("Invalid register in store_register(%d)", regno);
+ exit (1);
+ }
+ memcpy (rp, v, regno_mapping[regno].size);
+}
+
+static void
+go32_store_registers (int regno)
+{
+ int r;
+
+ if (regno >= 0)
+ store_register (regno);
+ else
+ {
+ for (r = 0; r < sizeof (regno_mapping) / sizeof (regno_mapping[0]); r++)
+ store_register (r);
+ }
+}
+
+static void
+go32_prepare_to_store (void)
+{
+}
+
+static int
+go32_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
+ struct target_ops *target)
+{
+ if (write)
+ {
+ if (write_child (memaddr, myaddr, len))
+ {
+ return 0;
+ }
+ else
+ {
+ return len;
+ }
+ }
+ else
+ {
+ if (read_child (memaddr, myaddr, len))
+ {
+ return 0;
+ }
+ else
+ {
+ return len;
+ }
+ }
+}
+
+static void
+go32_files_info (struct target_ops *target)
+{
+ printf_unfiltered ("You are running a DJGPP V2 program\n");
+}
+
+static void
+go32_stop (void)
+{
+ normal_stop ();
+ cleanup_client ();
+ inferior_pid = 0;
+ prog_has_started = 0;
+}
+
+static void
+go32_kill_inferior (void)
+{
+ go32_stop ();
+ unpush_target (&go32_ops);
+}
+
+static void
+go32_create_inferior (char *exec_file, char *args, char **env)
+{
+ jmp_buf start_state;
+ char *cmdline;
+ char **env_save = environ;
+
+ if (prog_has_started)
+ {
+ go32_kill_inferior ();
+ }
+
+ cmdline = (char *) alloca (strlen (args) + 4);
+ cmdline[0] = strlen (args);
+ strcpy (cmdline + 1, args);
+ cmdline[strlen (args) + 1] = 13;
+
+ environ = env;
+
+ if (v2loadimage (exec_file, cmdline, start_state))
+ {
+ environ = env_save;
+ printf_unfiltered ("Load failed for image %s\n", exec_file);
+ exit (1);
+ }
+ environ = env_save;
+
+ edi_init (start_state);
+
+ inferior_pid = SOME_PID;
+ push_target (&go32_ops);
+ clear_proceed_status ();
+ insert_breakpoints ();
+ proceed ((CORE_ADDR) - 1, TARGET_SIGNAL_0, 0);
+}
+
+static void
+go32_mourn_inferior (void)
+{
+ go32_kill_inferior ();
+ generic_mourn_inferior ();
+}
+
+static int
+go32_can_run (void)
+{
+ return 1;
+}
+
+static void
+ignore (void)
+{
+}
+
+static void
+ignore2 (char *a, int b)
+{
+}
+
+/* Hardware watchpoint support. */
+
+#define DR_STATUS 6
+#define DR_CONTROL 7
+#define DR_ENABLE_SIZE 2
+#define DR_LOCAL_ENABLE_SHIFT 0
+#define DR_GLOBAL_ENABLE_SHIFT 1
+#define DR_LOCAL_SLOWDOWN 0x100
+#define DR_GLOBAL_SLOWDOWN 0x200
+#define DR_CONTROL_SHIFT 16
+#define DR_CONTROL_SIZE 4
+#define DR_RW_READ 0x3
+#define DR_RW_WRITE 0x1
+#define DR_CONTROL_MASK 0xf
+#define DR_ENABLE_MASK 0x3
+#define DR_LEN_1 0x0
+#define DR_LEN_2 0x4
+#define DR_LEN_4 0xc
+
+#define D_REGS edi.dr
+#define CONTROL D_REGS[DR_CONTROL]
+#define STATUS D_REGS[DR_STATUS]
+
+#define IS_REG_FREE(index) \
+ (!(CONTROL & (3 << (DR_ENABLE_SIZE * index))))
+
+#define LOCAL_ENABLE_REG(index) \
+ (CONTROL |= (1 << (DR_LOCAL_ENABLE_SHIFT + DR_ENABLE_SIZE * index)))
+
+#define GLOBAL_ENABLE_REG(index) \
+ (CONTROL |= (1 << (DR_GLOBAL_ENABLE_SHIFT + DR_ENABLE_SIZE * index)))
+
+#define DISABLE_REG(index) \
+ (CONTROL &= ~(3 << (DR_ENABLE_SIZE * index)))
+
+#define SET_LOCAL_EXACT() \
+ (CONTROL |= DR_LOCAL_SLOWDOWN)
+
+#define SET_GLOBAL_EXACT() \
+ (CONTROL |= DR_GLOBAL_SLOWDOWN)
+
+#define SET_BREAK(index,address) \
+ do {\
+ CONTROL &= ~(DR_CONTROL_MASK << (DR_CONTROL_SHIFT + DR_CONTROL_SIZE * index));\
+ D_REGS[index] = address;\
+ } while(0)
+
+#define SET_WATCH(index,address,rw,len) \
+ do {\
+ SET_BREAK(index,address);\
+ CONTROL |= (len | rw) << (DR_CONTROL_SHIFT + DR_CONTROL_SIZE * index);\
+ } while (0)
+
+#define WATCH_HIT(index) \
+ (\
+ (STATUS & (1 << index)) && \
+ (CONTROL & (DR_CONTROL_MASK << (DR_CONTROL_SHIFT + DR_CONTROL_SIZE * index)))\
+ )
+
+#if 0 /* use debugging macro */
+#define SHOW_DR(text) \
+do { \
+ fprintf(stderr,"%08x %08x ",edi.dr[7],edi.dr[6]); \
+ fprintf(stderr,"%08x %08x ",edi.dr[0],edi.dr[1]); \
+ fprintf(stderr,"%08x %08x ",edi.dr[2],edi.dr[3]); \
+ fprintf(stderr,"(%s)\n",#text); \
+} while (0)
+#else
+#define SHOW_DR(text) do {} while (0)
+#endif
+
+static int go32_insert_aligned_watchpoint (int pid, CORE_ADDR waddr,
+ CORE_ADDR addr, int len, int rw);
+
+static int go32_insert_nonaligned_watchpoint (int pid, CORE_ADDR waddr,
+ CORE_ADDR addr, int len, int rw);
+
+/* Insert a watchpoint. */
+
+int
+go32_insert_watchpoint (int pid, CORE_ADDR addr, int len, int rw)
+{
+ int ret = go32_insert_aligned_watchpoint (pid, addr, addr, len, rw);
+
+ SHOW_DR (insert_watch);
+ return ret;
+}
+
+static int
+go32_insert_aligned_watchpoint (int pid, CORE_ADDR waddr, CORE_ADDR addr,
+ int len, int rw)
+{
+ int i;
+ int read_write_bits, len_bits;
+
+ /* Look for a free debug register. */
+ for (i = 0; i <= 3; i++)
+ {
+ if (IS_REG_FREE (i))
+ break;
+ }
+
+ /* No more debug registers! */
+ if (i > 3)
+ return -1;
+
+ read_write_bits = ((rw & 1) ? DR_RW_READ : 0) | ((rw & 2) ? DR_RW_WRITE : 0);
+
+ if (len == 1)
+ len_bits = DR_LEN_1;
+ else if (len == 2)
+ {
+ if (addr % 2)
+ return go32_insert_nonaligned_watchpoint (pid, waddr, addr, len, rw);
+ len_bits = DR_LEN_2;
+ }
+ else if (len == 4)
+ {
+ if (addr % 4)
+ return go32_insert_nonaligned_watchpoint (pid, waddr, addr, len, rw);
+ len_bits = DR_LEN_4;
+ }
+ else
+ return go32_insert_nonaligned_watchpoint (pid, waddr, addr, len, rw);
+
+ SET_WATCH (i, addr, read_write_bits, len_bits);
+ LOCAL_ENABLE_REG (i);
+ SET_LOCAL_EXACT ();
+}
+
+static int
+go32_insert_nonaligned_watchpoint (int pid, CORE_ADDR waddr, CORE_ADDR addr,
+ int len, int rw)
+{
+ int align;
+ int size;
+ int rv = 0;
+
+ static int size_try_array[16] =
+ {
+ 1, 1, 1, 1, /* trying size one */
+ 2, 1, 2, 1, /* trying size two */
+ 2, 1, 2, 1, /* trying size three */
+ 4, 1, 2, 1 /* trying size four */
+ };
+
+ while (len > 0)
+ {
+ align = addr % 4;
+ /* Four is the maximum length for 386. */
+ size = (len > 4) ? 3 : len - 1;
+ size = size_try_array[size * 4 + align];
+ rv = go32_insert_aligned_watchpoint (pid, waddr, addr, size, rw);
+ if (rv)
+ {
+ go32_remove_watchpoint (pid, waddr, size);
+ return rv;
+ }
+ addr += size;
+ len -= size;
+ }
+ return rv;
+}
+
+/* Remove a watchpoint. */
+
+int
+go32_remove_watchpoint (int pid, CORE_ADDR addr, int len)
+{
+ int i;
+
+ for (i = 0; i <= 3; i++)
+ {
+ if (D_REGS[i] == addr)
+ {
+ DISABLE_REG (i);
+ }
+ }
+ SHOW_DR (remove_watch);
+
+ return 0;
+}
+
+/* Check if stopped by a watchpoint. */
+
+CORE_ADDR
+go32_stopped_by_watchpoint (int pid)
+{
+ int i, ret = 0;
+ int status;
+
+ status = edi.dr[DR_STATUS];
+ SHOW_DR (stopped_by);
+ for (i = 0; i <= 3; i++)
+ {
+ if (WATCH_HIT (i))
+ {
+ SHOW_DR (HIT);
+ ret = D_REGS[i];
+ }
+ }
+ /* this is a hack to GDB. If we stopped at a hardware breakpoint,
+ the stop_pc must incremented by DECR_PC_AFTER_BREAK. I tried everything
+ with the DECR_PC_AFTER_HW_BREAK, but nothing works. */
+ /* This is probably fixed by jtc's recent patch -sts 2/19/99 */
+ if (STATUS && !ret)
+ stop_pc += DECR_PC_AFTER_BREAK;
+ STATUS = 0;
+
+ return ret;
+}
+
+/* Remove a breakpoint. */
+
+int
+go32_remove_hw_breakpoint (CORE_ADDR addr, CORE_ADDR shadow)
+{
+ int i;
+ for (i = 0; i <= 3; i++)
+ {
+ if (D_REGS[i] == addr)
+ {
+ DISABLE_REG (i);
+ }
+ }
+ SHOW_DR (remove_hw);
+ return 0;
+}
+
+int
+go32_insert_hw_breakpoint (CORE_ADDR addr, CORE_ADDR shadow)
+{
+ int i;
+ int read_write_bits, len_bits;
+ int free_debug_register;
+ int register_number;
+
+ /* Look for a free debug register. */
+ for (i = 0; i <= 3; i++)
+ {
+ if (IS_REG_FREE (i))
+ break;
+ }
+
+ /* No more debug registers! */
+ if (i > 3)
+ return -1;
+
+ SET_BREAK (i, addr);
+ LOCAL_ENABLE_REG (i);
+ SHOW_DR (insert_hw);
+
+ return 0;
+}
+
+static struct target_ops go32_ops;
+
+static void
+init_go32_ops (void)
+{
+ go32_ops.to_shortname = "djgpp";
+ go32_ops.to_longname = "djgpp target process";
+ go32_ops.to_doc =
+ "Program loaded by djgpp, when gdb is used as an external debugger";
+ go32_ops.to_open = go32_open;
+ go32_ops.to_close = go32_close;
+ go32_ops.to_detach = go32_detach;
+ go32_ops.to_resume = go32_resume;
+ go32_ops.to_wait = go32_wait;
+ go32_ops.to_fetch_registers = go32_fetch_registers;
+ go32_ops.to_store_registers = go32_store_registers;
+ go32_ops.to_prepare_to_store = go32_prepare_to_store;
+ go32_ops.to_xfer_memory = go32_xfer_memory;
+ go32_ops.to_files_info = go32_files_info;
+ go32_ops.to_insert_breakpoint = memory_insert_breakpoint;
+ go32_ops.to_remove_breakpoint = memory_remove_breakpoint;
+ go32_ops.to_terminal_init = ignore;
+ go32_ops.to_terminal_inferior = ignore;
+ go32_ops.to_terminal_ours_for_output = ignore;
+ go32_ops.to_terminal_ours = ignore;
+ go32_ops.to_terminal_info = ignore2;
+ go32_ops.to_kill = go32_kill_inferior;
+ go32_ops.to_create_inferior = go32_create_inferior;
+ go32_ops.to_mourn_inferior = go32_mourn_inferior;
+ go32_ops.to_can_run = go32_can_run;
+ go32_ops.to_stop = go32_stop;
+ go32_ops.to_stratum = process_stratum;
+ go32_ops.to_has_all_memory = 1;
+ go32_ops.to_has_memory = 1;
+ go32_ops.to_has_stack = 1;
+ go32_ops.to_has_registers = 1;
+ go32_ops.to_has_execution = 1;
+ go32_ops.to_magic = OPS_MAGIC;
+}
+
+void
+_initialize_go32_nat (void)
+{
+ init_go32_ops ();
+ add_target (&go32_ops);
+}
diff --git a/gdb/tic80-tdep.c b/gdb/tic80-tdep.c
new file mode 100644
index 00000000000..0abbb80dc1a
--- /dev/null
+++ b/gdb/tic80-tdep.c
@@ -0,0 +1,483 @@
+/* Target-dependent code for the TI TMS320C80 (MVP) for GDB, the GNU debugger.
+ Copyright 1996, Free Software Foundation, Inc.
+
+This file is part of GDB.
+
+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 "defs.h"
+#include "value.h"
+#include "frame.h"
+#include "inferior.h"
+#include "obstack.h"
+#include "target.h"
+#include "bfd.h"
+#include "gdb_string.h"
+#include "gdbcore.h"
+#include "symfile.h"
+
+/* Function: frame_find_saved_regs
+ Return the frame_saved_regs structure for the frame.
+ Doesn't really work for dummy frames, but it does pass back
+ an empty frame_saved_regs, so I guess that's better than total failure */
+
+void
+tic80_frame_find_saved_regs (fi, regaddr)
+ struct frame_info *fi;
+ struct frame_saved_regs *regaddr;
+{
+ memcpy (regaddr, &fi->fsr, sizeof (struct frame_saved_regs));
+}
+
+/* Function: skip_prologue
+ Find end of function prologue. */
+
+CORE_ADDR
+tic80_skip_prologue (pc)
+ CORE_ADDR pc;
+{
+ CORE_ADDR func_addr, func_end;
+ struct symtab_and_line sal;
+
+ /* See what the symbol table says */
+
+ if (find_pc_partial_function (pc, NULL, &func_addr, &func_end))
+ {
+ sal = find_pc_line (func_addr, 0);
+
+ if (sal.line != 0 && sal.end < func_end)
+ return sal.end;
+ else
+ /* Either there's no line info, or the line after the prologue is after
+ the end of the function. In this case, there probably isn't a
+ prologue. */
+ return pc;
+ }
+
+ /* We can't find the start of this function, so there's nothing we can do. */
+ return pc;
+}
+
+/* Function: tic80_scan_prologue
+ This function decodes the target function prologue to determine:
+ 1) the size of the stack frame
+ 2) which registers are saved on it
+ 3) the offsets of saved regs
+ 4) the frame size
+ This information is stored in the "extra" fields of the frame_info. */
+
+static void
+tic80_scan_prologue (fi)
+ struct frame_info *fi;
+{
+ struct symtab_and_line sal;
+ CORE_ADDR prologue_start, prologue_end, current_pc;
+
+ /* Assume there is no frame until proven otherwise. */
+ fi->framereg = SP_REGNUM;
+ fi->framesize = 0;
+ fi->frameoffset = 0;
+
+ /* this code essentially duplicates skip_prologue,
+ but we need the start address below. */
+
+ if (find_pc_partial_function (fi->pc, NULL, &prologue_start, &prologue_end))
+ {
+ sal = find_pc_line (prologue_start, 0);
+
+ if (sal.line == 0) /* no line info, use current PC */
+ if (prologue_start != entry_point_address ())
+ prologue_end = fi->pc;
+ else
+ return; /* _start has no frame or prologue */
+ else if (sal.end < prologue_end) /* next line begins after fn end */
+ prologue_end = sal.end; /* (probably means no prologue) */
+ }
+ else
+/* FIXME */
+ prologue_end = prologue_start + 40; /* We're in the boondocks: allow for */
+ /* 16 pushes, an add, and "mv fp,sp" */
+
+ prologue_end = min (prologue_end, fi->pc);
+
+ /* Now search the prologue looking for instructions that set up the
+ frame pointer, adjust the stack pointer, and save registers. */
+
+ for (current_pc = prologue_start; current_pc < prologue_end; current_pc += 4)
+ {
+ unsigned int insn;
+ int regno;
+ int offset = 0;
+
+ insn = read_memory_unsigned_integer (current_pc, 4);
+
+ if ((insn & 0x301000) == 0x301000) /* Long immediate? */
+/* FIXME - set offset for long immediate instructions */
+ current_pc += 4;
+ else
+ {
+ offset = insn & 0x7fff; /* extract 15-bit offset */
+ if (offset & 0x4000) /* if negative, sign-extend */
+ offset = -(0x8000 - offset);
+ }
+
+ if ((insn & 0x7fd0000) == 0x590000) /* st.{w,d} reg, xx(r1) */
+ {
+ regno = ((insn >> 27) & 0x1f);
+ fi->fsr.regs[regno] = offset;
+ if (insn & 0x8000) /* 64-bit store (st.d)? */
+ fi->fsr.regs[regno+1] = offset+4;
+ }
+ else if ((insn & 0xffff8000) == 0x086c8000) /* addu xx, r1, r1 */
+ fi->framesize = -offset;
+ else if ((insn & 0xffff8000) == 0xf06c8000) /* addu xx, r1, r30 */
+ {
+ fi->framereg = FP_REGNUM; /* fp is now valid */
+ fi->frameoffset = offset;
+ break; /* end of stack adjustments */
+ }
+ else if (insn == 0xf03b2001) /* addu r1, r0, r30 */
+ {
+ fi->framereg = FP_REGNUM; /* fp is now valid */
+ fi->frameoffset = 0;
+ break; /* end of stack adjustments */
+ }
+ else
+/* FIXME - handle long immediate instructions */
+ break; /* anything else isn't prologue */
+ }
+}
+
+/* Function: init_extra_frame_info
+ This function actually figures out the frame address for a given pc and
+ sp. This is tricky on the c80 because we sometimes don't use an explicit
+ frame pointer, and the previous stack pointer isn't necessarily recorded
+ on the stack. The only reliable way to get this info is to
+ examine the prologue. */
+
+void
+tic80_init_extra_frame_info (fi)
+ struct frame_info *fi;
+{
+ int reg;
+
+ if (fi->next)
+ fi->pc = FRAME_SAVED_PC (fi->next);
+
+ /* Because zero is a valid register offset relative to SP, we initialize
+ the offsets to -1 to indicate unused entries. */
+ for (reg = 0; reg < NUM_REGS; reg++)
+ fi->fsr.regs[reg] = -1;
+
+ if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
+ {
+ /* We need to setup fi->frame here because run_stack_dummy gets it wrong
+ by assuming it's always FP. */
+ fi->frame = generic_read_register_dummy (fi->pc, fi->frame, SP_REGNUM);
+ fi->framesize = 0;
+ fi->frameoffset = 0;
+ return;
+ }
+ else
+ {
+ tic80_scan_prologue (fi);
+
+ if (!fi->next) /* this is the innermost frame? */
+ fi->frame = read_register (fi->framereg);
+ else /* not the innermost frame */
+ /* If this function uses FP as the frame register, and the function
+ it called saved the FP, get the saved FP. */
+ if (fi->framereg == FP_REGNUM &&
+ fi->next->fsr.regs[FP_REGNUM] != (unsigned) -1)
+ fi->frame = read_memory_integer (fi->next->fsr.regs[FP_REGNUM], 4);
+
+ /* Convert SP-relative offsets of saved registers to real addresses. */
+ for (reg = 0; reg < NUM_REGS; reg++)
+ if (fi->fsr.regs[reg] == (unsigned) -1)
+ fi->fsr.regs[reg] = 0; /* unused entry */
+ else
+ fi->fsr.regs[reg] += fi->frame - fi->frameoffset;
+ }
+}
+
+/* Function: find_callers_reg
+ Find REGNUM on the stack. Otherwise, it's in an active register. One thing
+ we might want to do here is to check REGNUM against the clobber mask, and
+ somehow flag it as invalid if it isn't saved on the stack somewhere. This
+ would provide a graceful failure mode when trying to get the value of
+ caller-saves registers for an inner frame. */
+
+CORE_ADDR
+tic80_find_callers_reg (fi, regnum)
+ struct frame_info *fi;
+ int regnum;
+{
+ for (; fi; fi = fi->next)
+ if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
+ return generic_read_register_dummy (fi->pc, fi->frame, regnum);
+ else if (fi->fsr.regs[regnum] != 0)
+ return read_memory_integer (fi->fsr.regs[regnum],
+ REGISTER_RAW_SIZE(regnum));
+ return read_register (regnum);
+}
+
+/* Function: frame_chain
+ Given a GDB frame, determine the address of the calling function's frame.
+ This will be used to create a new GDB frame struct, and then
+ INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC will be called for the new frame.
+ For c80, we save the frame size when we initialize the frame_info. */
+
+CORE_ADDR
+tic80_frame_chain (fi)
+ struct frame_info *fi;
+{
+ CORE_ADDR fn_start, callers_pc, fp;
+
+ /* is this a dummy frame? */
+ if (PC_IN_CALL_DUMMY(fi->pc, fi->frame, fi->frame))
+ return fi->frame; /* dummy frame same as caller's frame */
+
+ /* is caller-of-this a dummy frame? */
+ callers_pc = FRAME_SAVED_PC(fi); /* find out who called us: */
+ fp = tic80_find_callers_reg (fi, FP_REGNUM);
+ if (PC_IN_CALL_DUMMY(callers_pc, fp, fp))
+ return fp; /* dummy frame's frame may bear no relation to ours */
+
+ if (find_pc_partial_function (fi->pc, 0, &fn_start, 0))
+ if (fn_start == entry_point_address ())
+ return 0; /* in _start fn, don't chain further */
+
+ if (fi->framereg == FP_REGNUM)
+ return tic80_find_callers_reg (fi, FP_REGNUM);
+ else
+ return fi->frame + fi->framesize;
+}
+
+/* Function: pop_frame
+ Discard from the stack the innermost frame,
+ restoring all saved registers. */
+
+struct frame_info *
+tic80_pop_frame (frame)
+ struct frame_info *frame;
+{
+ int regnum;
+
+ if (PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame))
+ generic_pop_dummy_frame ();
+ else
+ {
+ for (regnum = 0; regnum < NUM_REGS; regnum++)
+ if (frame->fsr.regs[regnum] != 0)
+ write_register (regnum,
+ read_memory_integer (frame->fsr.regs[regnum], 4));
+
+ write_register (PC_REGNUM, FRAME_SAVED_PC (frame));
+ write_register (SP_REGNUM, read_register (FP_REGNUM));
+#if 0
+ if (read_register (PSW_REGNUM) & 0x80)
+ write_register (SPU_REGNUM, read_register (SP_REGNUM));
+ else
+ write_register (SPI_REGNUM, read_register (SP_REGNUM));
+#endif
+ }
+ flush_cached_frames ();
+ return NULL;
+}
+
+/* Function: frame_saved_pc
+ Find the caller of this frame. We do this by seeing if LR_REGNUM is saved
+ in the stack anywhere, otherwise we get it from the registers. */
+
+CORE_ADDR
+tic80_frame_saved_pc (fi)
+ struct frame_info *fi;
+{
+ if (PC_IN_CALL_DUMMY(fi->pc, fi->frame, fi->frame))
+ return generic_read_register_dummy (fi->pc, fi->frame, PC_REGNUM);
+ else
+ return tic80_find_callers_reg (fi, LR_REGNUM);
+}
+
+/* Function: tic80_push_return_address (pc, sp)
+ Set up the return address for the inferior function call.
+ Necessary for targets that don't actually execute a JSR/BSR instruction
+ (ie. when using an empty CALL_DUMMY) */
+
+CORE_ADDR
+tic80_push_return_address (pc, sp)
+ CORE_ADDR pc;
+ CORE_ADDR sp;
+{
+ write_register (LR_REGNUM, CALL_DUMMY_ADDRESS ());
+ return sp;
+}
+
+
+/* Function: push_arguments
+ Setup the function arguments for calling a function in the inferior.
+
+ On the TI C80 architecture, there are six register pairs (R2/R3 to R12/13)
+ which are dedicated for passing function arguments. Up to the first six
+ arguments (depending on size) may go into these registers.
+ The rest go on the stack.
+
+ Arguments that are smaller than 4 bytes will still take up a whole
+ register or a whole 32-bit word on the stack, and will be
+ right-justified in the register or the stack word. This includes
+ chars, shorts, and small aggregate types.
+
+ Arguments that are four bytes or less in size are placed in the
+ even-numbered register of a register pair, and the odd-numbered
+ register is not used.
+
+ Arguments of 8 bytes size (such as floating point doubles) are placed
+ in a register pair. The least significant 32-bit word is placed in
+ the even-numbered register, and the most significant word in the
+ odd-numbered register.
+
+ Aggregate types with sizes between 4 and 8 bytes are passed
+ entirely on the stack, and are left-justified within the
+ double-word (as opposed to aggregates smaller than 4 bytes
+ which are right-justified).
+
+ Aggregates of greater than 8 bytes are first copied onto the stack,
+ and then a pointer to the copy is passed in the place of the normal
+ argument (either in a register if available, or on the stack).
+
+ Functions that must return an aggregate type can return it in the
+ normal return value registers (R2 and R3) if its size is 8 bytes or
+ less. For larger return values, the caller must allocate space for
+ the callee to copy the return value to. A pointer to this space is
+ passed as an implicit first argument, always in R0. */
+
+CORE_ADDR
+tic80_push_arguments (nargs, args, sp, struct_return, struct_addr)
+ int nargs;
+ value_ptr *args;
+ CORE_ADDR sp;
+ unsigned char struct_return;
+ CORE_ADDR struct_addr;
+{
+ int stack_offset, stack_alloc;
+ int argreg;
+ int argnum;
+ struct type *type;
+ CORE_ADDR regval;
+ char *val;
+ char valbuf[4];
+ int len;
+ int odd_sized_struct;
+ int is_struct;
+
+ /* first force sp to a 4-byte alignment */
+ sp = sp & ~3;
+
+ argreg = ARG0_REGNUM;
+ /* The "struct return pointer" pseudo-argument goes in R0 */
+ if (struct_return)
+ write_register (argreg++, struct_addr);
+
+ /* Now make sure there's space on the stack */
+ for (argnum = 0, stack_alloc = 0;
+ argnum < nargs; argnum++)
+ stack_alloc += ((TYPE_LENGTH(VALUE_TYPE(args[argnum])) + 3) & ~3);
+ sp -= stack_alloc; /* make room on stack for args */
+
+
+ /* Now load as many as possible of the first arguments into
+ registers, and push the rest onto the stack. There are 16 bytes
+ in four registers available. Loop thru args from first to last. */
+
+ argreg = ARG0_REGNUM;
+ for (argnum = 0, stack_offset = 0; argnum < nargs; argnum++)
+ {
+ type = VALUE_TYPE (args[argnum]);
+ len = TYPE_LENGTH (type);
+ memset (valbuf, 0, sizeof (valbuf));
+ val = (char *) VALUE_CONTENTS (args[argnum]);
+
+/* FIXME -- tic80 can take doubleword arguments in register pairs */
+ is_struct = (type->code == TYPE_CODE_STRUCT);
+ odd_sized_struct = 0;
+
+ if (! is_struct)
+ {
+ if (len < 4)
+ { /* value gets right-justified in the register or stack word */
+ memcpy (valbuf + (4 - len), val, len);
+ val = valbuf;
+ }
+ if (len > 4 && (len & 3) != 0)
+ odd_sized_struct = 1; /* such structs go entirely on stack */
+ }
+ else
+ {
+ /* Structs are always passed by reference. */
+ write_register (argreg, sp + stack_offset);
+ argreg ++;
+ }
+
+ while (len > 0)
+ {
+ if (is_struct || argreg > ARGLAST_REGNUM || odd_sized_struct)
+ { /* must go on the stack */
+ write_memory (sp + stack_offset, val, 4);
+ stack_offset += 4;
+ }
+ /* NOTE WELL!!!!! This is not an "else if" clause!!!
+ That's because some things get passed on the stack
+ AND in the registers! */
+ if (!is_struct && argreg <= ARGLAST_REGNUM)
+ { /* there's room in a register */
+ regval = extract_address (val, REGISTER_RAW_SIZE(argreg));
+ write_register (argreg, regval);
+ argreg += 2; /* FIXME -- what about doubleword args? */
+ }
+ /* Store the value 4 bytes at a time. This means that things
+ larger than 4 bytes may go partly in registers and partly
+ on the stack. */
+ len -= REGISTER_RAW_SIZE(argreg);
+ val += REGISTER_RAW_SIZE(argreg);
+ }
+ }
+ return sp;
+}
+
+/* Function: tic80_write_sp
+ Because SP is really a read-only register that mirrors either SPU or SPI,
+ we must actually write one of those two as well, depending on PSW. */
+
+void
+tic80_write_sp (val)
+ CORE_ADDR val;
+{
+#if 0
+ unsigned long psw = read_register (PSW_REGNUM);
+
+ if (psw & 0x80) /* stack mode: user or interrupt */
+ write_register (SPU_REGNUM, val);
+ else
+ write_register (SPI_REGNUM, val);
+#endif
+ write_register (SP_REGNUM, val);
+}
+
+void
+_initialize_tic80_tdep ()
+{
+ tm_print_insn = print_insn_tic80;
+}
+
diff --git a/readline/doc/readline.0 b/readline/doc/readline.0
new file mode 100644
index 00000000000..c925d529cb5
--- /dev/null
+++ b/readline/doc/readline.0
@@ -0,0 +1,1122 @@
+
+
+
+READLINE(3) READLINE(3)
+
+
+NNAAMMEE
+ readline - get a line from a user with editing
+
+SSYYNNOOPPSSIISS
+ ##iinncclluuddee <<rreeaaddlliinnee..hh>>
+ ##iinncclluuddee <<hhiissttoorryy..hh>>
+
+ cchhaarr **rreeaaddlliinnee ((pprroommpptt))
+ cchhaarr **pprroommpptt;;
+
+CCOOPPYYRRIIGGHHTT
+ Readline is Copyright (C) 1989, 1991, 1993, 1995, 1996 by
+ the Free Software Foundation, Inc.
+
+DDEESSCCRRIIPPTTIIOONN
+ rreeaaddlliinnee will read a line from the terminal and return it,
+ using pprroommpptt as a prompt. If pprroommpptt is null, no prompt is
+ issued. The line returned is allocated with _m_a_l_l_o_c(3), so
+ the caller must free it when finished. The line returned
+ has the final newline removed, so only the text of the
+ line remains.
+
+ rreeaaddlliinnee offers editing capabilities while the user is
+ entering the line. By default, the line editing commands
+ are similar to those of emacs. A vi-style line editing
+ interface is also available.
+
+RREETTUURRNN VVAALLUUEE
+ rreeaaddlliinnee returns the text of the line read. A blank line
+ returns the empty string. If EEOOFF is encountered while
+ reading a line, and the line is empty, NNUULLLL is returned.
+ If an EEOOFF is read with a non-empty line, it is treated as
+ a newline.
+
+NNOOTTAATTIIOONN
+ An emacs-style notation is used to denote keystrokes.
+ Control keys are denoted by C-_k_e_y, e.g., C-n means Con-
+ trol-N. Similarly, _m_e_t_a keys are denoted by M-_k_e_y, so M-x
+ means Meta-X. (On keyboards without a _m_e_t_a key, M-_x means
+ ESC _x, i.e., press the Escape key then the _x key. This
+ makes ESC the _m_e_t_a _p_r_e_f_i_x. The combination M-C-_x means
+ ESC-Control-_x, or press the Escape key then hold the Con-
+ trol key while pressing the _x key.)
+
+ Readline commands may be given numeric _a_r_g_u_m_e_n_t_s, which
+ normally act as a repeat count. Sometimes, however, it is
+ the sign of the argument that is significant. Passing a
+ negative argument to a command that acts in the forward
+ direction (e.g., kkiillll--lliinnee) causes that command to act in
+ a backward direction. Commands whose behavior with argu-
+ ments deviates from this are noted.
+
+ When a command is described as _k_i_l_l_i_n_g text, the text
+ deleted is saved for possible future retrieval (_y_a_n_k_i_n_g).
+
+
+
+GNU 1998 Feb 19 1
+
+
+
+
+
+READLINE(3) READLINE(3)
+
+
+ The killed text is saved in a _k_i_l_l _r_i_n_g. Consecutive
+ kills cause the text to be accumulated into one unit,
+ which can be yanked all at once. Commands which do not
+ kill text separate the chunks of text on the kill ring.
+
+IINNIITTIIAALLIIZZAATTIIOONN FFIILLEE
+ Readline is customized by putting commands in an initial-
+ ization file (the _i_n_p_u_t_r_c file). The name of this file is
+ taken from the value of the IINNPPUUTTRRCC environment variable.
+ If that variable is unset, the default is _~_/_._i_n_p_u_t_r_c.
+ When a program which uses the readline library starts up,
+ the init file is read, and the key bindings and variables
+ are set. There are only a few basic constructs allowed in
+ the readline init file. Blank lines are ignored. Lines
+ beginning with a ## are comments. Lines beginning with a $$
+ indicate conditional constructs. Other lines denote key
+ bindings and variable settings. Each program using this
+ library may add its own commands and bindings.
+
+ For example, placing
+
+ M-Control-u: universal-argument
+ or
+ C-Meta-u: universal-argument
+ into the _i_n_p_u_t_r_c would make M-C-u execute the readline
+ command _u_n_i_v_e_r_s_a_l_-_a_r_g_u_m_e_n_t.
+
+ The following symbolic character names are recognized
+ while processing key bindings: _R_U_B_O_U_T, _D_E_L, _E_S_C, _L_F_D, _N_E_W_-
+ _L_I_N_E, _R_E_T, _R_E_T_U_R_N, _S_P_C, _S_P_A_C_E, and _T_A_B. In addition to
+ command names, readline allows keys to be bound to a
+ string that is inserted when the key is pressed (a _m_a_c_r_o).
+
+
+ KKeeyy BBiinnddiinnggss
+ The syntax for controlling key bindings in the _i_n_p_u_t_r_c
+ file is simple. All that is required is the name of the
+ command or the text of a macro and a key sequence to which
+ it should be bound. The name may be specified in one of
+ two ways: as a symbolic key name, possibly with _M_e_t_a_- or
+ _C_o_n_t_r_o_l_- prefixes, or as a key sequence. When using the
+ form kkeeyynnaammee:_f_u_n_c_t_i_o_n_-_n_a_m_e or _m_a_c_r_o, _k_e_y_n_a_m_e is the name
+ of a key spelled out in English. For example:
+
+ Control-u: universal-argument
+ Meta-Rubout: backward-kill-word
+ Control-o: ">&output"
+
+ In the above example, _C_-_u is bound to the function uunniivveerr--
+ ssaall--aarrgguummeenntt, _M_-_D_E_L is bound to the function bbaacckk--
+ wwaarrdd--kkiillll--wwoorrdd, and _C_-_o is bound to run the macro
+ expressed on the right hand side (that is, to insert the
+ text _>_&_o_u_t_p_u_t into the line).
+
+
+
+
+GNU 1998 Feb 19 2
+
+
+
+
+
+READLINE(3) READLINE(3)
+
+
+ In the second form, ""kkeeyysseeqq"":_f_u_n_c_t_i_o_n_-_n_a_m_e or _m_a_c_r_o, kkeeyy--
+ sseeqq differs from kkeeyynnaammee above in that strings denoting an
+ entire key sequence may be specified by placing the
+ sequence within double quotes. Some GNU Emacs style key
+ escapes can be used, as in the following example.
+
+ "\C-u": universal-argument
+ "\C-x\C-r": re-read-init-file
+ "\e[11~": "Function Key 1"
+
+ In this example, _C_-_u is again bound to the function uunnii--
+ vveerrssaall--aarrgguummeenntt. _C_-_x _C_-_r is bound to the function
+ rree--rreeaadd--iinniitt--ffiillee, and _E_S_C _[ _1 _1 _~ is bound to insert the
+ text FFuunnccttiioonn KKeeyy 11. The full set of GNU Emacs style
+ escape sequences is
+ \\CC-- control prefix
+ \\MM-- meta prefix
+ \\ee an escape character
+ \\\\ backslash
+ \\"" literal "
+ \\'' literal '
+
+ In addition to the GNU Emacs style escape sequences, a
+ second set of backslash escapes is available:
+ \\aa alert (bell)
+ \\bb backspace
+ \\dd delete
+ \\ff form feed
+ \\nn newline
+ \\rr carriage return
+ \\tt horizontal tab
+ \\vv vertical tab
+ \\_n_n_n the character whose ASCII code is the octal
+ value _n_n_n (one to three digits)
+ \\xx_n_n_n the character whose ASCII code is the hex-
+ adecimal value _n_n_n (one to three digits)
+
+ When entering the text of a macro, single or double quotes
+ should be used to indicate a macro definition. Unquoted
+ text is assumed to be a function name. In the macro body,
+ the backslash escapes described above are expanded. Back-
+ slash will quote any other character in the macro text,
+ including " and '.
+
+ BBaasshh allows the current readline key bindings to be dis-
+ played or modified with the bbiinndd builtin command. The
+ editing mode may be switched during interactive use by
+ using the --oo option to the sseett builtin command. Other
+ programs using this library provide similar mechanisms.
+ The _i_n_p_u_t_r_c file may be edited and re-read if a program
+ does not provide any other means to incorporate new bind-
+ ings.
+
+
+
+
+
+GNU 1998 Feb 19 3
+
+
+
+
+
+READLINE(3) READLINE(3)
+
+
+ VVaarriiaabblleess
+ Readline has variables that can be used to further cus-
+ tomize its behavior. A variable may be set in the _i_n_p_u_t_r_c
+ file with a statement of the form
+
+ sseett _v_a_r_i_a_b_l_e_-_n_a_m_e _v_a_l_u_e
+
+ Except where noted, readline variables can take the values
+ OOnn or OOffff. The variables and their default values are:
+
+ bbeellll--ssttyyllee ((aauuddiibbllee))
+ Controls what happens when readline wants to ring
+ the terminal bell. If set to nnoonnee, readline never
+ rings the bell. If set to vviissiibbllee, readline uses a
+ visible bell if one is available. If set to aauuddii--
+ bbllee, readline attempts to ring the terminal's bell.
+ ccoommmmeenntt--bbeeggiinn ((````##''''))
+ The string that is inserted in vvii mode when the
+ iinnsseerrtt--ccoommmmeenntt command is executed. This command
+ is bound to MM--## in emacs mode and to ## in vi com-
+ mand mode.
+ ccoommpplleettiioonn--iiggnnoorree--ccaassee ((OOffff))
+ If set to OOnn, readline performs filename matching
+ and completion in a case-insensitive fashion.
+ ccoommpplleettiioonn--qquueerryy--iitteemmss ((110000))
+ This determines when the user is queried about
+ viewing the number of possible completions gener-
+ ated by the ppoossssiibbllee--ccoommpplleettiioonnss command. It may
+ be set to any integer value greater than or equal
+ to zero. If the number of possible completions is
+ greater than or equal to the value of this vari-
+ able, the user is asked whether or not he wishes to
+ view them; otherwise they are simply listed on the
+ terminal.
+ ccoonnvveerrtt--mmeettaa ((OOnn))
+ If set to OOnn, readline will convert characters with
+ the eighth bit set to an ASCII key sequence by
+ stripping the eighth bit and prepending an escape
+ character (in effect, using escape as the _m_e_t_a _p_r_e_-
+ _f_i_x).
+ ddiissaabbllee--ccoommpplleettiioonn ((OOffff))
+ If set to OOnn, readline will inhibit word comple-
+ tion. Completion characters will be inserted into
+ the line as if they had been mapped to sseellff--iinnsseerrtt.
+ eeddiittiinngg--mmooddee ((eemmaaccss))
+ Controls whether readline begins with a set of key
+ bindings similar to _e_m_a_c_s or _v_i. eeddiittiinngg--mmooddee can
+ be set to either eemmaaccss or vvii.
+ eennaabbllee--kkeeyyppaadd ((OOffff))
+ When set to OOnn, readline will try to enable the
+ application keypad when it is called. Some systems
+ need this to enable the arrow keys.
+ eexxppaanndd--ttiillddee ((OOffff))
+ If set to oonn, tilde expansion is performed when
+
+
+
+GNU 1998 Feb 19 4
+
+
+
+
+
+READLINE(3) READLINE(3)
+
+
+ readline attempts word completion.
+ hhoorriizzoonnttaall--ssccrroollll--mmooddee ((OOffff))
+ When set to OOnn, makes readline use a single line
+ for display, scrolling the input horizontally on a
+ single screen line when it becomes longer than the
+ screen width rather than wrapping to a new line.
+ kkeeyymmaapp ((eemmaaccss))
+ Set the current readline keymap. The set of legal
+ keymap names is _e_m_a_c_s_, _e_m_a_c_s_-_s_t_a_n_d_a_r_d_, _e_m_a_c_s_-_m_e_t_a_,
+ _e_m_a_c_s_-_c_t_l_x_, _v_i_, _v_i_-_m_o_v_e_, _v_i_-_c_o_m_m_a_n_d, and _v_i_-_i_n_s_e_r_t.
+ _v_i is equivalent to _v_i_-_c_o_m_m_a_n_d; _e_m_a_c_s is equivalent
+ to _e_m_a_c_s_-_s_t_a_n_d_a_r_d. The default value is _e_m_a_c_s; the
+ value of eeddiittiinngg--mmooddee also affects the default
+ keymap.
+ mmaarrkk--ddiirreeccttoorriieess ((OOnn))
+ If set to OOnn, complete<d directory names have a
+ slash appended.
+ mmaarrkk--mmooddiiffiieedd--lliinneess ((OOffff))
+ If set to OOnn, history lines that have been modified
+ are displayed with a preceding asterisk (**).
+ mmeettaa--ffllaagg ((OOffff))
+ If set to OOnn, readline will enable eight-bit input
+ (that is, it will not strip the high bit from the
+ characters it reads), regardless of what the termi-
+ nal claims it can support.
+ oouuttppuutt--mmeettaa ((OOffff))
+ If set to OOnn, readline will display characters with
+ the eighth bit set directly rather than as a meta-
+ prefixed escape sequence.
+ pprriinntt--ccoommpplleettiioonnss--hhoorriizzoonnttaallllyy ((OOffff))
+ If set to OOnn, readline will display completions
+ with matches sorted horizontally in alphabetical
+ order, rather than down the screen.
+ sshhooww--aallll--iiff--aammbbiigguuoouuss ((OOffff))
+ This alters the default behavior of the completion
+ functions. If set to oonn, words which have more
+ than one possible completion cause the matches to
+ be listed immediately instead of ringing the bell.
+ vviissiibbllee--ssttaattss ((OOffff))
+ If set to OOnn, a character denoting a file's type as
+ reported by ssttaatt(2) is appended to the filename
+ when listing possible completions.
+
+ CCoonnddiittiioonnaall CCoonnssttrruuccttss
+ Readline implements a facility similar in spirit to the
+ conditional compilation features of the C preprocessor
+ which allows key bindings and variable settings to be per-
+ formed as the result of tests. There are four parser
+ directives used.
+
+ $$iiff The $$iiff construct allows bindings to be made based
+ on the editing mode, the terminal being used, or
+ the application using readline. The text of the
+ test extends to the end of the line; no characters
+
+
+
+GNU 1998 Feb 19 5
+
+
+
+
+
+READLINE(3) READLINE(3)
+
+
+ are required to isolate it.
+
+ mmooddee The mmooddee== form of the $$iiff directive is used
+ to test whether readline is in emacs or vi
+ mode. This may be used in conjunction with
+ the sseett kkeeyymmaapp command, for instance, to set
+ bindings in the _e_m_a_c_s_-_s_t_a_n_d_a_r_d and _e_m_a_c_s_-
+ _c_t_l_x keymaps only if readline is starting
+ out in emacs mode.
+
+ tteerrmm The tteerrmm== form may be used to include termi-
+ nal-specific key bindings, perhaps to bind
+ the key sequences output by the terminal's
+ function keys. The word on the right side
+ of the == is tested against the full name of
+ the terminal and the portion of the terminal
+ name before the first --. This allows _s_u_n to
+ match both _s_u_n and _s_u_n_-_c_m_d, for instance.
+
+ aapppplliiccaattiioonn
+ The aapppplliiccaattiioonn construct is used to include
+ application-specific settings. Each program
+ using the readline library sets the _a_p_p_l_i_c_a_-
+ _t_i_o_n _n_a_m_e, and an initialization file can
+ test for a particular value. This could be
+ used to bind key sequences to functions use-
+ ful for a specific program. For instance,
+ the following command adds a key sequence
+ that quotes the current or previous word in
+ Bash:
+
+ $$iiff bash
+ # Quote the current or previous word
+ "\C-xq": "\eb\"\ef\""
+ $$eennddiiff
+
+ $$eennddiiff This command, as seen in the previous example, ter-
+ minates an $$iiff command.
+
+ $$eellssee Commands in this branch of the $$iiff directive are
+ executed if the test fails.
+
+ $$iinncclluuddee
+ This directive takes a single filename as an argu-
+ ment and reads commands and bindings from that
+ file. For example, the following directive would
+ read _/_e_t_c_/_i_n_p_u_t_r_c:
+
+ $$iinncclluuddee _/_e_t_c_/_i_n_p_u_t_r_c
+
+SSEEAARRCCHHIINNGG
+ Readline provides commands for searching through the com-
+ mand history for lines containing a specified string.
+ There are two search modes: _i_n_c_r_e_m_e_n_t_a_l and _n_o_n_-
+
+
+
+GNU 1998 Feb 19 6
+
+
+
+
+
+READLINE(3) READLINE(3)
+
+
+ _i_n_c_r_e_m_e_n_t_a_l.
+
+ Incremental searches begin before the user has finished
+ typing the search string. As each character of the search
+ string is typed, readline displays the next entry from the
+ history matching the string typed so far. An incremental
+ search requires only as many characters as needed to find
+ the desired history entry. The Escape character is used
+ to terminate an incremental search. Control-J will also
+ terminate the search. Control-G will abort an incremental
+ search and restore the original line. When the search is
+ terminated, the history entry containing the search string
+ becomes the current line. To find other matching entries
+ in the history list, type Control-S or Control-R as appro-
+ priate. This will search backward or forward in the his-
+ tory for the next line matching the search string typed so
+ far. Any other key sequence bound to a readline command
+ will terminate the search and execute that command. For
+ instance, a _n_e_w_l_i_n_e will terminate the search and accept
+ the line, thereby executing the command from the history
+ list.
+
+ Non-incremental searches read the entire search string
+ before starting to search for matching history lines. The
+ search string may be typed by the user or be part of the
+ contents of the current line.
+
+EEDDIITTIINNGG CCOOMMMMAANNDDSS
+ The following is a list of the names of the commands and
+ the default key sequences to which they are bound. Com-
+ mand names without an accompanying key sequence are
+ unbound by default.
+
+ CCoommmmaannddss ffoorr MMoovviinngg
+ bbeeggiinnnniinngg--ooff--lliinnee ((CC--aa))
+ Move to the start of the current line.
+ eenndd--ooff--lliinnee ((CC--ee))
+ Move to the end of the line.
+ ffoorrwwaarrdd--cchhaarr ((CC--ff))
+ Move forward a character.
+ bbaacckkwwaarrdd--cchhaarr ((CC--bb))
+ Move back a character.
+ ffoorrwwaarrdd--wwoorrdd ((MM--ff))
+ Move forward to the end of the next word. Words
+ are composed of alphanumeric characters (letters
+ and digits).
+ bbaacckkwwaarrdd--wwoorrdd ((MM--bb))
+ Move back to the start of this, or the previous,
+ word. Words are composed of alphanumeric charac-
+ ters (letters and digits).
+ cclleeaarr--ssccrreeeenn ((CC--ll))
+ Clear the screen leaving the current line at the
+ top of the screen. With an argument, refresh the
+ current line without clearing the screen.
+
+
+
+GNU 1998 Feb 19 7
+
+
+
+
+
+READLINE(3) READLINE(3)
+
+
+ rreeddrraaww--ccuurrrreenntt--lliinnee
+ Refresh the current line.
+
+ CCoommmmaannddss ffoorr MMaanniippuullaattiinngg tthhee HHiissttoorryy
+ aacccceepptt--lliinnee ((NNeewwlliinnee,, RReettuurrnn))
+ Accept the line regardless of where the cursor is.
+ If this line is non-empty, add it to the history
+ list. If the line is a modified history line, then
+ restore the history line to its original state.
+ pprreevviioouuss--hhiissttoorryy ((CC--pp))
+ Fetch the previous command from the history list,
+ moving back in the list.
+ nneexxtt--hhiissttoorryy ((CC--nn))
+ Fetch the next command from the history list, mov-
+ ing forward in the list.
+ bbeeggiinnnniinngg--ooff--hhiissttoorryy ((MM--<<))
+ Move to the first line in the history.
+ eenndd--ooff--hhiissttoorryy ((MM-->>))
+ Move to the end of the input history, i.e., the
+ line currently being entered.
+ rreevveerrssee--sseeaarrcchh--hhiissttoorryy ((CC--rr))
+ Search backward starting at the current line and
+ moving `up' through the history as necessary. This
+ is an incremental search.
+ ffoorrwwaarrdd--sseeaarrcchh--hhiissttoorryy ((CC--ss))
+ Search forward starting at the current line and
+ moving `down' through the history as necessary.
+ This is an incremental search.
+ nnoonn--iinnccrreemmeennttaall--rreevveerrssee--sseeaarrcchh--hhiissttoorryy ((MM--pp))
+ Search backward through the history starting at the
+ current line using a non-incremental search for a
+ string supplied by the user.
+ nnoonn--iinnccrreemmeennttaall--ffoorrwwaarrdd--sseeaarrcchh--hhiissttoorryy ((MM--nn))
+ Search forward through the history using a non-
+ incremental search for a string supplied by the
+ user.
+ hhiissttoorryy--sseeaarrcchh--ffoorrwwaarrdd
+ Search forward through the history for the string
+ of characters between the start of the current line
+ and the current cursor position (the _p_o_i_n_t). This
+ is a non-incremental search.
+ hhiissttoorryy--sseeaarrcchh--bbaacckkwwaarrdd
+ Search backward through the history for the string
+ of characters between the start of the current line
+ and the point. This is a non-incremental search.
+ yyaannkk--nntthh--aarrgg ((MM--CC--yy))
+ Insert the first argument to the previous command
+ (usually the second word on the previous line) at
+ point (the current cursor position). With an argu-
+ ment _n, insert the _nth word from the previous com-
+ mand (the words in the previous command begin with
+ word 0). A negative argument inserts the _nth word
+ from the end of the previous command.
+
+
+
+
+GNU 1998 Feb 19 8
+
+
+
+
+
+READLINE(3) READLINE(3)
+
+
+ yyaannkk--llaasstt--aarrgg ((MM--..,, MM--__))
+ Insert the last argument to the previous command
+ (the last word of the previous history entry).
+ With an argument, behave exactly like yyaannkk--nntthh--aarrgg.
+ Successive calls to yyaannkk--llaasstt--aarrgg move back through
+ the history list, inserting the last argument of
+ each line in turn.
+
+ CCoommmmaannddss ffoorr CChhaannggiinngg TTeexxtt
+ ddeelleettee--cchhaarr ((CC--dd))
+ Delete the character under the cursor. If point is
+ at the beginning of the line, there are no charac-
+ ters in the line, and the last character typed was
+ not bound to BBddeelleettee--cchhaarr, then return EEOOFF.
+ bbaacckkwwaarrdd--ddeelleettee--cchhaarr ((RRuubboouutt))
+ Delete the character behind the cursor. When given
+ a numeric argument, save the deleted text on the
+ kill ring.
+ qquuootteedd--iinnsseerrtt ((CC--qq,, CC--vv))
+ Add the next character that you type to the line
+ verbatim. This is how to insert characters like
+ CC--qq, for example.
+ ttaabb--iinnsseerrtt ((MM--TTAABB))
+ Insert a tab character.
+ sseellff--iinnsseerrtt ((aa,, bb,, AA,, 11,, !!,, ......))
+ Insert the character typed.
+ ttrraannssppoossee--cchhaarrss ((CC--tt))
+ Drag the character before point forward over the
+ character at point. Point moves forward as well.
+ If point is at the end of the line, then transpose
+ the two characters before point. Negative argu-
+ ments don't work.
+ ttrraannssppoossee--wwoorrddss ((MM--tt))
+ Drag the word behind the cursor past the word in
+ front of the cursor moving the cursor over that
+ word as well.
+ uuppccaassee--wwoorrdd ((MM--uu))
+ Uppercase the current (or following) word. With a
+ negative argument, uppercase the previous word, but
+ do not move point.
+ ddoowwnnccaassee--wwoorrdd ((MM--ll))
+ Lowercase the current (or following) word. With a
+ negative argument, lowercase the previous word, but
+ do not move point.
+ ccaappiittaalliizzee--wwoorrdd ((MM--cc))
+ Capitalize the current (or following) word. With a
+ negative argument, capitalize the previous word,
+ but do not move point.
+
+ KKiilllliinngg aanndd YYaannkkiinngg
+ kkiillll--lliinnee ((CC--kk))
+ Kill the text from the current cursor position to
+ the end of the line.
+
+
+
+
+GNU 1998 Feb 19 9
+
+
+
+
+
+READLINE(3) READLINE(3)
+
+
+ bbaacckkwwaarrdd--kkiillll--lliinnee ((CC--xx RRuubboouutt))
+ Kill backward to the beginning of the line.
+ uunniixx--lliinnee--ddiissccaarrdd ((CC--uu))
+ Kill backward from point to the beginning of the
+ line. The killed text is saved on the kill-ring.
+ kkiillll--wwhhoollee--lliinnee
+ Kill all characters on the current line, no matter
+ where the cursor is.
+ kkiillll--wwoorrdd ((MM--dd))
+ Kill from the cursor to the end of the current
+ word, or if between words, to the end of the next
+ word. Word boundaries are the same as those used
+ by ffoorrwwaarrdd--wwoorrdd.
+ bbaacckkwwaarrdd--kkiillll--wwoorrdd ((MM--RRuubboouutt))
+ Kill the word behind the cursor. Word boundaries
+ are the same as those used by bbaacckkwwaarrdd--wwoorrdd.
+ uunniixx--wwoorrdd--rruubboouutt ((CC--ww))
+ Kill the word behind the cursor, using white space
+ as a word boundary. The word boundaries are dif-
+ ferent from bbaacckkwwaarrdd--kkiillll--wwoorrdd.
+ ddeelleettee--hhoorriizzoonnttaall--ssppaaccee ((MM--\\))
+ Delete all spaces and tabs around point.
+ kkiillll--rreeggiioonn
+ Kill the text between the point and _m_a_r_k (saved
+ cursor position). This text is referred to as the
+ _r_e_g_i_o_n.
+ ccooppyy--rreeggiioonn--aass--kkiillll
+ Copy the text in the region to the kill buffer.
+ ccooppyy--bbaacckkwwaarrdd--wwoorrdd
+ Copy the word before point to the kill buffer. The
+ word boundaries are the same as bbaacckkwwaarrdd--wwoorrdd.
+ ccooppyy--ffoorrwwaarrdd--wwoorrdd
+ Copy the word following point to the kill buffer.
+ The word boundaries are the same as ffoorrwwaarrdd--wwoorrdd.
+ yyaannkk ((CC--yy))
+ Yank the top of the kill ring into the buffer at
+ the cursor.
+ yyaannkk--ppoopp ((MM--yy))
+ Rotate the kill ring, and yank the new top. Only
+ works following yyaannkk or yyaannkk--ppoopp.
+
+ NNuummeerriicc AArrgguummeennttss
+ ddiiggiitt--aarrgguummeenntt ((MM--00,, MM--11,, ......,, MM----))
+ Add this digit to the argument already accumulat-
+ ing, or start a new argument. M-- starts a nega-
+ tive argument.
+ uunniivveerrssaall--aarrgguummeenntt
+ This is another way to specify an argument. If
+ this command is followed by one or more digits,
+ optionally with a leading minus sign, those digits
+ define the argument. If the command is followed by
+ digits, executing uunniivveerrssaall--aarrgguummeenntt again ends the
+ numeric argument, but is otherwise ignored. As a
+ special case, if this command is immediately
+
+
+
+GNU 1998 Feb 19 10
+
+
+
+
+
+READLINE(3) READLINE(3)
+
+
+ followed by a character that is neither a digit or
+ minus sign, the argument count for the next command
+ is multiplied by four. The argument count is ini-
+ tially one, so executing this function the first
+ time makes the argument count four, a second time
+ makes the argument count sixteen, and so on.
+
+ CCoommpplleettiinngg
+ ccoommpplleettee ((TTAABB))
+ Attempt to perform completion on the text before
+ point. The actual completion performed is applica-
+ tion-specific. BBaasshh, for instance, attempts com-
+ pletion treating the text as a variable (if the
+ text begins with $$), username (if the text begins
+ with ~~), hostname (if the text begins with @@), or
+ command (including aliases and functions) in turn.
+ If none of these produces a match, filename comple-
+ tion is attempted. GGddbb, on the other hand, allows
+ completion of program functions and variables, and
+ only attempts filename completion under certain
+ circumstances.
+ ppoossssiibbllee--ccoommpplleettiioonnss ((MM--??))
+ List the possible completions of the text before
+ point.
+ iinnsseerrtt--ccoommpplleettiioonnss ((MM--**))
+ Insert all completions of the text before point
+ that would have been generated by ppoossssiibbllee--ccoommppllee--
+ ttiioonnss.
+ mmeennuu--ccoommpplleettee
+ Similar to ccoommpplleettee, but replaces the word to be
+ completed with a single match from the list of pos-
+ sible completions. Repeated execution of mmeennuu--ccoomm--
+ pplleettee steps through the list of possible comple-
+ tions, inserting each match in turn. At the end of
+ the list of completions, the bell is rung and the
+ original text is restored. An argument of _n moves
+ _n positions forward in the list of matches; a nega-
+ tive argument may be used to move backward through
+ the list. This command is intended to be bound to
+ TTAABB, but is unbound by default.
+
+ KKeeyybbooaarrdd MMaaccrrooss
+ ssttaarrtt--kkbbdd--mmaaccrroo ((CC--xx (())
+ Begin saving the characters typed into the current
+ keyboard macro.
+ eenndd--kkbbdd--mmaaccrroo ((CC--xx ))))
+ Stop saving the characters typed into the current
+ keyboard macro and store the definition.
+ ccaallll--llaasstt--kkbbdd--mmaaccrroo ((CC--xx ee))
+ Re-execute the last keyboard macro defined, by mak-
+ ing the characters in the macro appear as if typed
+ at the keyboard.
+
+
+
+
+
+GNU 1998 Feb 19 11
+
+
+
+
+
+READLINE(3) READLINE(3)
+
+
+ MMiisscceellllaanneeoouuss
+ rree--rreeaadd--iinniitt--ffiillee ((CC--xx CC--rr))
+ Read in the contents of the _i_n_p_u_t_r_c file, and
+ incorporate any bindings or variable assignments
+ found there.
+ aabboorrtt ((CC--gg))
+ Abort the current editing command and ring the ter-
+ minal's bell (subject to the setting of
+ bbeellll--ssttyyllee).
+ ddoo--uuppppeerrccaassee--vveerrssiioonn ((MM--aa,, MM--bb,, MM--_x,, ......))
+ If the metafied character _x is lowercase, run the
+ command that is bound to the corresponding upper-
+ case character.
+ pprreeffiixx--mmeettaa ((EESSCC))
+ Metafy the next character typed. EESSCC ff is equiva-
+ lent to MMeettaa--ff.
+ uunnddoo ((CC--__,, CC--xx CC--uu))
+ Incremental undo, separately remembered for each
+ line.
+ rreevveerrtt--lliinnee ((MM--rr))
+ Undo all changes made to this line. This is like
+ executing the uunnddoo command enough times to return
+ the line to its initial state.
+ ttiillddee--eexxppaanndd ((MM--~~))
+ Perform tilde expansion on the current word.
+ sseett--mmaarrkk ((CC--@@,, MM--<<ssppaaccee>>))
+ Set the mark to the current point. If a numeric
+ argument is supplied, the mark is set to that posi-
+ tion.
+ eexxcchhaannggee--ppooiinntt--aanndd--mmaarrkk ((CC--xx CC--xx))
+ Swap the point with the mark. The current cursor
+ position is set to the saved position, and the old
+ cursor position is saved as the mark.
+ cchhaarraacctteerr--sseeaarrcchh ((CC--]]))
+ A character is read and point is moved to the next
+ occurrence of that character. A negative count
+ searches for previous occurrences.
+ cchhaarraacctteerr--sseeaarrcchh--bbaacckkwwaarrdd ((MM--CC--]]))
+ A character is read and point is moved to the pre-
+ vious occurrence of that character. A negative
+ count searches for subsequent occurrences.
+ iinnsseerrtt--ccoommmmeenntt ((MM--##))
+ The value of the readline ccoommmmeenntt--bbeeggiinn variable is
+ inserted at the beginning of the current line, and
+ the line is accepted as if a newline had been
+ typed. This makes the current line a shell com-
+ ment.
+ dduummpp--ffuunnccttiioonnss
+ Print all of the functions and their key bindings
+ to the readline output stream. If a numeric argu-
+ ment is supplied, the output is formatted in such a
+ way that it can be made part of an _i_n_p_u_t_r_c file.
+ dduummpp--vvaarriiaabblleess
+ Print all of the settable variables and their
+
+
+
+GNU 1998 Feb 19 12
+
+
+
+
+
+READLINE(3) READLINE(3)
+
+
+ values to the readline output stream. If a numeric
+ argument is supplied, the output is formatted in
+ such a way that it can be made part of an _i_n_p_u_t_r_c
+ file.
+ dduummpp--mmaaccrrooss
+ Print all of the readline key sequences bound to
+ macros and the strings they ouput. If a numeric
+ argument is supplied, the output is formatted in
+ such a way that it can be made part of an _i_n_p_u_t_r_c
+ file.
+ eemmaaccss--eeddiittiinngg--mmooddee ((CC--ee))
+ When in vvii editing mode, this causes a switch to
+ eemmaaccss editing mode.
+ vvii--eeddiittiinngg--mmooddee ((MM--CC--jj))
+ When in eemmaaccss editing mode, this causes a switch to
+ vvii editing mode.
+
+DDEEFFAAUULLTT KKEEYY BBIINNDDIINNGGSS
+ The following is a list of the default emacs and vi bind-
+ ings. Characters with the 8th bit set are written as
+ M-<character>, and are referred to as _m_e_t_a_f_i_e_d characters.
+ The printable ASCII characters not mentioned in the list
+ of emacs standard bindings are bound to the _s_e_l_f_-_i_n_s_e_r_t
+ function, which just inserts the given character into the
+ input line. In vi insertion mode, all characters not
+ specifically mentioned are bound to _s_e_l_f_-_i_n_s_e_r_t. Charac-
+ ters assigned to signal generation by _s_t_t_y(1) or the ter-
+ minal driver, such as C-Z or C-C, retain that function.
+ Upper and lower case _m_e_t_a_f_i_e_d characters are bound to the
+ same function in the emacs mode meta keymap. The remain-
+ ing characters are unbound, which causes readline to ring
+ the bell (subject to the setting of the bbeellll--ssttyyllee vari-
+ able).
+
+ EEmmaaccss MMooddee
+ Emacs Standard bindings
+
+ "C-@" set-mark
+ "C-A" beginning-of-line
+ "C-B" backward-char
+ "C-D" delete-char
+ "C-E" end-of-line
+ "C-F" forward-char
+ "C-G" abort
+ "C-H" backward-delete-char
+ "C-I" complete
+ "C-J" accept-line
+ "C-K" kill-line
+ "C-L" clear-screen
+ "C-M" accept-line
+ "C-N" next-history
+ "C-P" previous-history
+ "C-Q" quoted-insert
+ "C-R" reverse-search-history
+
+
+
+GNU 1998 Feb 19 13
+
+
+
+
+
+READLINE(3) READLINE(3)
+
+
+ "C-S" forward-search-history
+ "C-T" transpose-chars
+ "C-U" unix-line-discard
+ "C-V" quoted-insert
+ "C-W" unix-word-rubout
+ "C-Y" yank
+ "C-]" character-search
+ "C-_" undo
+ " " to "/" self-insert
+ "0" to "9" self-insert
+ ":" to "~" self-insert
+ "C-?" backward-delete-char
+
+ Emacs Meta bindings
+
+ "M-C-G" abort
+ "M-C-H" backward-kill-word
+ "M-C-I" tab-insert
+ "M-C-J" vi-editing-mode
+ "M-C-M" vi-editing-mode
+ "M-C-R" revert-line
+ "M-C-Y" yank-nth-arg
+ "M-C-[" complete
+ "M-C-]" character-search-backward
+ "M-space" set-mark
+ "M-#" insert-comment
+ "M-&" tilde-expand
+ "M-*" insert-completions
+ "M--" digit-argument
+ "M-." yank-last-arg
+ "M-0" digit-argument
+ "M-1" digit-argument
+ "M-2" digit-argument
+ "M-3" digit-argument
+ "M-4" digit-argument
+ "M-5" digit-argument
+ "M-6" digit-argument
+ "M-7" digit-argument
+ "M-8" digit-argument
+ "M-9" digit-argument
+ "M-<" beginning-of-history
+ "M-=" possible-completions
+ "M->" end-of-history
+ "M-?" possible-completions
+ "M-B" backward-word
+ "M-C" capitalize-word
+ "M-D" kill-word
+ "M-F" forward-word
+ "M-L" downcase-word
+ "M-N" non-incremental-forward-search-history
+ "M-P" non-incremental-reverse-search-history
+ "M-R" revert-line
+ "M-T" transpose-words
+ "M-U" upcase-word
+
+
+
+GNU 1998 Feb 19 14
+
+
+
+
+
+READLINE(3) READLINE(3)
+
+
+ "M-Y" yank-pop
+ "M-\" delete-horizontal-space
+ "M-~" tilde-expand
+ "M-C-?" backward-delete-word
+ "M-_" yank-last-arg
+
+ Emacs Control-X bindings
+
+ "C-XC-G" abort
+ "C-XC-R" re-read-init-file
+ "C-XC-U" undo
+ "C-XC-X" exchange-point-and-mark
+ "C-X(" start-kbd-macro
+ "C-X)" end-kbd-macro
+ "C-XE" call-last-kbd-macro
+ "C-XC-?" backward-kill-line
+
+
+ VVII MMooddee bbiinnddiinnggss
+ VI Insert Mode functions
+
+ "C-D" vi-eof-maybe
+ "C-H" backward-delete-char
+ "C-I" complete
+ "C-J" accept-line
+ "C-M" accept-line
+ "C-R" reverse-search-history
+ "C-S" forward-search-history
+ "C-T" transpose-chars
+ "C-U" unix-line-discard
+ "C-V" quoted-insert
+ "C-W" unix-word-rubout
+ "C-Y" yank
+ "C-[" vi-movement-mode
+ "C-_" undo
+ " " to "~" self-insert
+ "C-?" backward-delete-char
+
+ VI Command Mode functions
+
+ "C-D" vi-eof-maybe
+ "C-E" emacs-editing-mode
+ "C-G" abort
+ "C-H" backward-char
+ "C-J" accept-line
+ "C-K" kill-line
+ "C-L" clear-screen
+ "C-M" accept-line
+ "C-N" next-history
+ "C-P" previous-history
+ "C-Q" quoted-insert
+ "C-R" reverse-search-history
+ "C-S" forward-search-history
+ "C-T" transpose-chars
+
+
+
+GNU 1998 Feb 19 15
+
+
+
+
+
+READLINE(3) READLINE(3)
+
+
+ "C-U" unix-line-discard
+ "C-V" quoted-insert
+ "C-W" unix-word-rubout
+ "C-Y" yank
+ " " forward-char
+ "#" insert-comment
+ "$" end-of-line
+ "%" vi-match
+ "&" vi-tilde-expand
+ "*" vi-complete
+ "+" next-history
+ "," vi-char-search
+ "-" previous-history
+ "." vi-redo
+ "/" vi-search
+ "0" beginning-of-line
+ "1" to "9" vi-arg-digit
+ ";" vi-char-search
+ "=" vi-complete
+ "?" vi-search
+ "A" vi-append-eol
+ "B" vi-prev-word
+ "C" vi-change-to
+ "D" vi-delete-to
+ "E" vi-end-word
+ "F" vi-char-search
+ "G" vi-fetch-history
+ "I" vi-insert-beg
+ "N" vi-search-again
+ "P" vi-put
+ "R" vi-replace
+ "S" vi-subst
+ "T" vi-char-search
+ "U" revert-line
+ "W" vi-next-word
+ "X" backward-delete-char
+ "Y" vi-yank-to
+ "\" vi-complete
+ "^" vi-first-print
+ "_" vi-yank-arg
+ "`" vi-goto-mark
+ "a" vi-append-mode
+ "b" vi-prev-word
+ "c" vi-change-to
+ "d" vi-delete-to
+ "e" vi-end-word
+ "f" vi-char-search
+ "h" backward-char
+ "i" vi-insertion-mode
+ "j" next-history
+ "k" prev-history
+ "l" forward-char
+ "m" vi-set-mark
+ "n" vi-search-again
+
+
+
+GNU 1998 Feb 19 16
+
+
+
+
+
+READLINE(3) READLINE(3)
+
+
+ "p" vi-put
+ "r" vi-change-char
+ "s" vi-subst
+ "t" vi-char-search
+ "u" undo
+ "w" vi-next-word
+ "x" vi-delete
+ "y" vi-yank-to
+ "|" vi-column
+ "~" vi-change-case
+
+SSEEEE AALLSSOO
+ _T_h_e _G_n_u _R_e_a_d_l_i_n_e _L_i_b_r_a_r_y, Brian Fox and Chet Ramey
+ _T_h_e _G_n_u _H_i_s_t_o_r_y _L_i_b_r_a_r_y, Brian Fox and Chet Ramey
+ _b_a_s_h(1)
+
+FFIILLEESS
+ _~_/_._i_n_p_u_t_r_c
+ Individual rreeaaddlliinnee initialization file
+
+AAUUTTHHOORRSS
+ Brian Fox, Free Software Foundation (primary author)
+ bfox@ai.MIT.Edu
+
+ Chet Ramey, Case Western Reserve University
+ chet@ins.CWRU.Edu
+
+BBUUGG RREEPPOORRTTSS
+ If you find a bug in rreeaaddlliinnee,, you should report it. But
+ first, you should make sure that it really is a bug, and
+ that it appears in the latest version of the rreeaaddlliinnee
+ library that you have.
+
+ Once you have determined that a bug actually exists, mail
+ a bug report to _b_u_g_-_r_e_a_d_l_i_n_e@_g_n_u_._o_r_g. If you have a fix,
+ you are welcome to mail that as well! Suggestions and
+ `philosophical' bug reports may be mailed to _b_u_g_-_r_e_a_d_-
+ _l_i_n_e@_g_n_u_._o_r_g or posted to the Usenet newsgroup
+ ggnnuu..bbaasshh..bbuugg.
+
+ Comments and bug reports concerning this manual page
+ should be directed to _c_h_e_t_@_i_n_s_._C_W_R_U_._E_d_u.
+
+BBUUGGSS
+ It's too big and too slow.
+
+
+
+
+
+
+
+
+
+
+
+
+GNU 1998 Feb 19 17
+
+
diff --git a/sim/mcore/ChangeLog b/sim/mcore/ChangeLog
new file mode 100644
index 00000000000..51e976cf695
--- /dev/null
+++ b/sim/mcore/ChangeLog
@@ -0,0 +1,14 @@
+1999-04-22 Nick Clifton <nickc@cygnus.com>
+
+ * interp.c: Add tracing and verbose options.
+ Fixed trap and syscall emulations.
+
+1999-04-08 Nick Clifton <nickc@cygnus.com>
+
+ * interp.c: New file: Simulator for MCore.
+ * sysdep.h: New file: Systems definitions for MCore simulator.
+ * configure.in: New file: Configure script for MCore simulator.
+ * configure: New file: Genreated.
+ * config,in: New file: Config support.
+ * Makefile.in: New file: Meta makefile for MCore simulator.
+
diff --git a/sim/mcore/Makefile.in b/sim/mcore/Makefile.in
new file mode 100644
index 00000000000..83c8557568b
--- /dev/null
+++ b/sim/mcore/Makefile.in
@@ -0,0 +1,29 @@
+# Makefile template for Configure for the MCore sim library.
+# Copyright (C) 1990, 91, 92, 95, 96, 19, 1999 Free Software Foundation, Inc.
+# Written by Cygnus Solutions.
+#
+# 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.
+
+## COMMON_PRE_CONFIG_FRAG
+
+SIM_OBJS = interp.o sim-load.o
+SIM_EXTRA_LIBS = -lm
+SIM_EXTRA_CLEAN = mcore-clean
+
+## COMMON_POST_CONFIG_FRAG
+
+interp.o: interp.c
+
+mcore-clean:
diff --git a/sim/mcore/config.in b/sim/mcore/config.in
new file mode 100644
index 00000000000..21724bc5eac
--- /dev/null
+++ b/sim/mcore/config.in
@@ -0,0 +1,34 @@
+/* config.in. Generated automatically from configure.in by autoheader. */
+
+/* Define as the return type of signal handlers (int or void). */
+#undef RETSIGTYPE
+
+/* Define if you have the getrusage function. */
+#undef HAVE_GETRUSAGE
+
+/* Define if you have the sigaction function. */
+#undef HAVE_SIGACTION
+
+/* Define if you have the time function. */
+#undef HAVE_TIME
+
+/* Define if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* 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
+
+/* Define if you have the <sys/resource.h> header file. */
+#undef HAVE_SYS_RESOURCE_H
+
+/* Define if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define if you have the <time.h> header file. */
+#undef HAVE_TIME_H
+
+/* Define if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
diff --git a/sim/mcore/configure b/sim/mcore/configure
new file mode 100755
index 00000000000..e646fa8a499
--- /dev/null
+++ b/sim/mcore/configure
@@ -0,0 +1,3892 @@
+#! /bin/sh
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+sim_inline="-DDEFAULT_INLINE=0"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# This file is derived from `gettext.m4'. The difference is that the
+# included macros assume Cygnus-style source and build trees.
+
+# Macro to add for using GNU gettext.
+# Ulrich Drepper <drepper@cygnus.com>, 1995.
+#
+# This file file be copied and used freely without restrictions. It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
+
+# serial 3
+
+
+
+
+
+# Search path for a program which passes the given test.
+# Ulrich Drepper <drepper@cygnus.com>, 1996.
+#
+# This file file be copied and used freely without restrictions. It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
+
+# serial 1
+
+
+
+# Check whether LC_MESSAGES is available in <locale.h>.
+# Ulrich Drepper <drepper@cygnus.com>, 1995.
+#
+# This file file be copied and used freely without restrictions. It can
+# be used in projects which are not available under the GNU Public License
+# but which still want to provide support for the GNU gettext functionality.
+# Please note that the actual code is *not* freely available.
+
+# serial 1
+
+
+
+# Check to see if we're running under Cygwin32, without using
+# AC_CANONICAL_*. If so, set output variable CYGWIN32 to "yes".
+# Otherwise set it to "no".
+
+
+
+# Check to see if we're running under Win32, without using
+# AC_CANONICAL_*. If so, set output variable EXEEXT to ".exe".
+# Otherwise set it to "".
+
+
+
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.12.2
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+ac_help="$ac_help
+ --disable-nls do not use Native Language Support"
+ac_help="$ac_help
+ --with-included-gettext use the GNU gettext library included here"
+ac_help="$ac_help
+ --enable-maintainer-mode Enable developer functionality."
+ac_help="$ac_help
+ --enable-sim-bswap Use Host specific BSWAP instruction."
+ac_help="$ac_help
+ --enable-sim-cflags=opts Extra CFLAGS for use in building simulator"
+ac_help="$ac_help
+ --enable-sim-debug=opts Enable debugging flags"
+ac_help="$ac_help
+ --enable-sim-stdio Specify whether to use stdio for console input/output."
+ac_help="$ac_help
+ --enable-sim-trace=opts Enable tracing flags"
+ac_help="$ac_help
+ --enable-sim-profile=opts Enable profiling flags"
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+subdirs=
+MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
+
+ac_prev=
+for ac_option
+do
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval "$ac_prev=\$ac_option"
+ ac_prev=
+ continue
+ fi
+
+ case "$ac_option" in
+ -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) ac_optarg= ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case "$ac_option" in
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir="$ac_optarg" ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build="$ac_optarg" ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file="$ac_optarg" ;;
+
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir="$ac_optarg" ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ eval "enable_${ac_feature}=no" ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix="$ac_optarg" ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he)
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+ --cache-file=FILE cache test results in FILE
+ --help print this message
+ --no-create do not create output files
+ --quiet, --silent do not print \`checking...' messages
+ --version print the version of autoconf that created configure
+Directory and file names:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [same as prefix]
+ --bindir=DIR user executables in DIR [EPREFIX/bin]
+ --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
+ --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data in DIR
+ [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data in DIR
+ [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
+ --libdir=DIR object code libraries in DIR [EPREFIX/lib]
+ --includedir=DIR C header files in DIR [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
+ --infodir=DIR info documentation in DIR [PREFIX/info]
+ --mandir=DIR man documentation in DIR [PREFIX/man]
+ --srcdir=DIR find the sources in DIR [configure dir or ..]
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM
+ run sed PROGRAM on installed program names
+EOF
+ cat << EOF
+Host type:
+ --build=BUILD configure for building on BUILD [BUILD=HOST]
+ --host=HOST configure for HOST [guessed]
+ --target=TARGET configure for TARGET [TARGET=HOST]
+Features and packages:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --x-includes=DIR X include files are in DIR
+ --x-libraries=DIR X library files are in DIR
+EOF
+ if test -n "$ac_help"; then
+ echo "--enable and --with options recognized:$ac_help"
+ fi
+ exit 0 ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host="$ac_optarg" ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir="$ac_optarg" ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir="$ac_optarg" ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir="$ac_optarg" ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir="$ac_optarg" ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ localstatedir="$ac_optarg" ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir="$ac_optarg" ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir="$ac_optarg" ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix="$ac_optarg" ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix="$ac_optarg" ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix="$ac_optarg" ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name="$ac_optarg" ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir="$ac_optarg" ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir="$ac_optarg" ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site="$ac_optarg" ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir="$ac_optarg" ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir="$ac_optarg" ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target="$ac_optarg" ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers)
+ echo "configure generated by autoconf version 2.12.2"
+ exit 0 ;;
+
+ -with-* | --with-*)
+ ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_${ac_package}='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ eval "with_${ac_package}=no" ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes="$ac_optarg" ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries="$ac_optarg" ;;
+
+ -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+ ;;
+
+ *)
+ if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+ echo "configure: warning: $ac_option: invalid host type" 1>&2
+ fi
+ if test "x$nonopt" != xNONE; then
+ { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+ fi
+ nonopt="$ac_option"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+ exec 6>/dev/null
+else
+ exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+ case "$ac_arg" in
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c) ;;
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+ ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+ esac
+done
+
+# NLS nuisances.
+# Only set these to C if already set. These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}" = set; then LANG=C; export LANG; fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=Makefile.in
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then its parent.
+ ac_prog=$0
+ ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+ test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+ srcdir=$ac_confdir
+ if test ! -r $srcdir/$ac_unique_file; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+ else
+ { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+ fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+ if test -r "$ac_site_file"; then
+ echo "loading site script $ac_site_file"
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ echo "loading cache $cache_file"
+ . $cache_file
+else
+ echo "creating cache $cache_file"
+ > $cache_file
+fi
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+ac_exeext=
+ac_objext=o
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+ # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+ if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+ ac_n= ac_c='
+' ac_t=' '
+ else
+ ac_n=-n ac_c= ac_t=
+ fi
+else
+ ac_n= ac_c='\c' ac_t=
+fi
+
+
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:677: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # This must be in double quotes, not single quotes, because CPP may get
+ # substituted into the Makefile and "${CC-cc}" will confuse make.
+ CPP="${CC-cc} -E"
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp.
+ cat > conftest.$ac_ext <<EOF
+#line 692 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:698: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -E -traditional-cpp"
+ cat > conftest.$ac_ext <<EOF
+#line 709 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:715: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -nologo -E"
+ cat > conftest.$ac_ext <<EOF
+#line 726 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:732: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+ ac_cv_prog_CPP="$CPP"
+fi
+ CPP="$ac_cv_prog_CPP"
+else
+ ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+echo "configure:757: checking whether ${MAKE-make} sets \${MAKE}" >&5
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftestmake <<\EOF
+all:
+ @echo 'ac_maketemp="${MAKE}"'
+EOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+ eval ac_cv_prog_make_${ac_make}_set=yes
+else
+ eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftestmake
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ SET_MAKE=
+else
+ echo "$ac_t""no" 1>&6
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
+echo "configure:784: checking for POSIXized ISC" >&5
+if test -d /etc/conf/kconfig.d &&
+ grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
+then
+ echo "$ac_t""yes" 1>&6
+ ISC=yes # If later tests want to check for ISC.
+ cat >> confdefs.h <<\EOF
+#define _POSIX_SOURCE 1
+EOF
+
+ if test "$GCC" = yes; then
+ CC="$CC -posix"
+ else
+ CC="$CC -Xp"
+ fi
+else
+ echo "$ac_t""no" 1>&6
+ ISC=
+fi
+
+echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+echo "configure:805: checking for ANSI C header files" >&5
+if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 810 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:818: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ ac_cv_header_stdc=yes
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 835 "configure"
+#include "confdefs.h"
+#include <string.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "memchr" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 853 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "free" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+if test "$cross_compiling" = yes; then
+ :
+else
+ cat > conftest.$ac_ext <<EOF
+#line 874 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int main () { int i; for (i = 0; i < 256; i++)
+if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
+exit (0); }
+
+EOF
+if { (eval echo configure:885: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ :
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_header_stdc=no
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_header_stdc" 1>&6
+if test $ac_cv_header_stdc = yes; then
+ cat >> confdefs.h <<\EOF
+#define STDC_HEADERS 1
+EOF
+
+fi
+
+echo $ac_n "checking for working const""... $ac_c" 1>&6
+echo "configure:909: checking for working const" >&5
+if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 914 "configure"
+#include "confdefs.h"
+
+int main() {
+
+/* Ultrix mips cc rejects this. */
+typedef int charset[2]; const charset x;
+/* SunOS 4.1.1 cc rejects this. */
+char const *const *ccp;
+char **p;
+/* NEC SVR4.0.2 mips cc rejects this. */
+struct point {int x, y;};
+static struct point const zero = {0,0};
+/* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in an arm
+ of an if-expression whose if-part is not a constant expression */
+const char *g = "string";
+ccp = &g + (g ? g-g : 0);
+/* HPUX 7.0 cc rejects these. */
+++ccp;
+p = (char**) ccp;
+ccp = (char const *const *) p;
+{ /* SCO 3.2v4 cc rejects this. */
+ char *t;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+}
+{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+}
+{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+}
+{ /* AIX XL C 1.02.0.0 rejects this saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; };
+ struct s *b; b->j = 5;
+}
+{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+}
+
+; return 0; }
+EOF
+if { (eval echo configure:963: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_c_const=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_c_const=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_c_const" 1>&6
+if test $ac_cv_c_const = no; then
+ cat >> confdefs.h <<\EOF
+#define const
+EOF
+
+fi
+
+echo $ac_n "checking for inline""... $ac_c" 1>&6
+echo "configure:984: checking for inline" >&5
+if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+ cat > conftest.$ac_ext <<EOF
+#line 991 "configure"
+#include "confdefs.h"
+
+int main() {
+} $ac_kw foo() {
+; return 0; }
+EOF
+if { (eval echo configure:998: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_c_inline=$ac_kw; break
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+done
+
+fi
+
+echo "$ac_t""$ac_cv_c_inline" 1>&6
+case "$ac_cv_c_inline" in
+ inline | yes) ;;
+ no) cat >> confdefs.h <<\EOF
+#define inline
+EOF
+ ;;
+ *) cat >> confdefs.h <<EOF
+#define inline $ac_cv_c_inline
+EOF
+ ;;
+esac
+
+echo $ac_n "checking for off_t""... $ac_c" 1>&6
+echo "configure:1024: checking for off_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1029 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_type_off_t=yes
+else
+ rm -rf conftest*
+ ac_cv_type_off_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_off_t" 1>&6
+if test $ac_cv_type_off_t = no; then
+ cat >> confdefs.h <<\EOF
+#define off_t long
+EOF
+
+fi
+
+echo $ac_n "checking for size_t""... $ac_c" 1>&6
+echo "configure:1057: checking for size_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1062 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_type_size_t=yes
+else
+ rm -rf conftest*
+ ac_cv_type_size_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_size_t" 1>&6
+if test $ac_cv_type_size_t = no; then
+ cat >> confdefs.h <<\EOF
+#define size_t unsigned
+EOF
+
+fi
+
+# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
+# for constant arguments. Useless!
+echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
+echo "configure:1092: checking for working alloca.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1097 "configure"
+#include "confdefs.h"
+#include <alloca.h>
+int main() {
+char *p = alloca(2 * sizeof(int));
+; return 0; }
+EOF
+if { (eval echo configure:1104: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ ac_cv_header_alloca_h=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_header_alloca_h=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_header_alloca_h" 1>&6
+if test $ac_cv_header_alloca_h = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_ALLOCA_H 1
+EOF
+
+fi
+
+echo $ac_n "checking for alloca""... $ac_c" 1>&6
+echo "configure:1125: checking for alloca" >&5
+if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1130 "configure"
+#include "confdefs.h"
+
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# ifdef _MSC_VER
+# include <malloc.h>
+# define alloca _alloca
+# else
+# if HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+# ifdef _AIX
+ #pragma alloca
+# else
+# ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+# endif
+# endif
+# endif
+# endif
+#endif
+
+int main() {
+char *p = (char *) alloca(1);
+; return 0; }
+EOF
+if { (eval echo configure:1158: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ ac_cv_func_alloca_works=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_func_alloca_works=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_func_alloca_works" 1>&6
+if test $ac_cv_func_alloca_works = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_ALLOCA 1
+EOF
+
+fi
+
+if test $ac_cv_func_alloca_works = no; then
+ # The SVR3 libPW and SVR4 libucb both contain incompatible functions
+ # that cause trouble. Some versions do not even contain alloca or
+ # contain a buggy version. If you still want to use their alloca,
+ # use ar to extract alloca.o from them instead of compiling alloca.c.
+ ALLOCA=alloca.${ac_objext}
+ cat >> confdefs.h <<\EOF
+#define C_ALLOCA 1
+EOF
+
+
+echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
+echo "configure:1190: checking whether alloca needs Cray hooks" >&5
+if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1195 "configure"
+#include "confdefs.h"
+#if defined(CRAY) && ! defined(CRAY2)
+webecray
+#else
+wenotbecray
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "webecray" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_os_cray=yes
+else
+ rm -rf conftest*
+ ac_cv_os_cray=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_os_cray" 1>&6
+if test $ac_cv_os_cray = yes; then
+for ac_func in _getb67 GETB67 getb67; do
+ echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1220: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1225 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1248: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<EOF
+#define CRAY_STACKSEG_END $ac_func
+EOF
+
+ break
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+done
+fi
+
+echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
+echo "configure:1275: checking stack direction for C alloca" >&5
+if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_c_stack_direction=0
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1283 "configure"
+#include "confdefs.h"
+find_stack_direction ()
+{
+ static char *addr = 0;
+ auto char dummy;
+ if (addr == 0)
+ {
+ addr = &dummy;
+ return find_stack_direction ();
+ }
+ else
+ return (&dummy > addr) ? 1 : -1;
+}
+main ()
+{
+ exit (find_stack_direction() < 0);
+}
+EOF
+if { (eval echo configure:1302: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_c_stack_direction=1
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_c_stack_direction=-1
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_c_stack_direction" 1>&6
+cat >> confdefs.h <<EOF
+#define STACK_DIRECTION $ac_cv_c_stack_direction
+EOF
+
+fi
+
+for ac_hdr in unistd.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1327: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1332 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1337: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in getpagesize
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1366: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1371 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1394: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+echo $ac_n "checking for working mmap""... $ac_c" 1>&6
+echo "configure:1419: checking for working mmap" >&5
+if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_func_mmap_fixed_mapped=no
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1427 "configure"
+#include "confdefs.h"
+
+/* Thanks to Mike Haertel and Jim Avera for this test.
+ Here is a matrix of mmap possibilities:
+ mmap private not fixed
+ mmap private fixed at somewhere currently unmapped
+ mmap private fixed at somewhere already mapped
+ mmap shared not fixed
+ mmap shared fixed at somewhere currently unmapped
+ mmap shared fixed at somewhere already mapped
+ For private mappings, we should verify that changes cannot be read()
+ back from the file, nor mmap's back from the file at a different
+ address. (There have been systems where private was not correctly
+ implemented like the infamous i386 svr4.0, and systems where the
+ VM page cache was not coherent with the filesystem buffer cache
+ like early versions of FreeBSD and possibly contemporary NetBSD.)
+ For shared mappings, we should conversely verify that changes get
+ propogated back to all the places they're supposed to be.
+
+ Grep wants private fixed already mapped.
+ The main things grep needs to know about mmap are:
+ * does it exist and is it safe to write into the mmap'd area
+ * how to use it (BSD variants) */
+#include <sys/types.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+
+/* This mess was copied from the GNU getpagesize.h. */
+#ifndef HAVE_GETPAGESIZE
+# ifdef HAVE_UNISTD_H
+# include <unistd.h>
+# endif
+
+/* Assume that all systems that can run configure have sys/param.h. */
+# ifndef HAVE_SYS_PARAM_H
+# define HAVE_SYS_PARAM_H 1
+# endif
+
+# ifdef _SC_PAGESIZE
+# define getpagesize() sysconf(_SC_PAGESIZE)
+# else /* no _SC_PAGESIZE */
+# ifdef HAVE_SYS_PARAM_H
+# include <sys/param.h>
+# ifdef EXEC_PAGESIZE
+# define getpagesize() EXEC_PAGESIZE
+# else /* no EXEC_PAGESIZE */
+# ifdef NBPG
+# define getpagesize() NBPG * CLSIZE
+# ifndef CLSIZE
+# define CLSIZE 1
+# endif /* no CLSIZE */
+# else /* no NBPG */
+# ifdef NBPC
+# define getpagesize() NBPC
+# else /* no NBPC */
+# ifdef PAGESIZE
+# define getpagesize() PAGESIZE
+# endif /* PAGESIZE */
+# endif /* no NBPC */
+# endif /* no NBPG */
+# endif /* no EXEC_PAGESIZE */
+# else /* no HAVE_SYS_PARAM_H */
+# define getpagesize() 8192 /* punt totally */
+# endif /* no HAVE_SYS_PARAM_H */
+# endif /* no _SC_PAGESIZE */
+
+#endif /* no HAVE_GETPAGESIZE */
+
+#ifdef __cplusplus
+extern "C" { void *malloc(unsigned); }
+#else
+char *malloc();
+#endif
+
+int
+main()
+{
+ char *data, *data2, *data3;
+ int i, pagesize;
+ int fd;
+
+ pagesize = getpagesize();
+
+ /*
+ * First, make a file with some known garbage in it.
+ */
+ data = malloc(pagesize);
+ if (!data)
+ exit(1);
+ for (i = 0; i < pagesize; ++i)
+ *(data + i) = rand();
+ umask(0);
+ fd = creat("conftestmmap", 0600);
+ if (fd < 0)
+ exit(1);
+ if (write(fd, data, pagesize) != pagesize)
+ exit(1);
+ close(fd);
+
+ /*
+ * Next, try to mmap the file at a fixed address which
+ * already has something else allocated at it. If we can,
+ * also make sure that we see the same garbage.
+ */
+ fd = open("conftestmmap", O_RDWR);
+ if (fd < 0)
+ exit(1);
+ data2 = malloc(2 * pagesize);
+ if (!data2)
+ exit(1);
+ data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
+ if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_FIXED, fd, 0L))
+ exit(1);
+ for (i = 0; i < pagesize; ++i)
+ if (*(data + i) != *(data2 + i))
+ exit(1);
+
+ /*
+ * Finally, make sure that changes to the mapped area
+ * do not percolate back to the file as seen by read().
+ * (This is a bug on some variants of i386 svr4.0.)
+ */
+ for (i = 0; i < pagesize; ++i)
+ *(data2 + i) = *(data2 + i) + 1;
+ data3 = malloc(pagesize);
+ if (!data3)
+ exit(1);
+ if (read(fd, data3, pagesize) != pagesize)
+ exit(1);
+ for (i = 0; i < pagesize; ++i)
+ if (*(data + i) != *(data3 + i))
+ exit(1);
+ close(fd);
+ unlink("conftestmmap");
+ exit(0);
+}
+
+EOF
+if { (eval echo configure:1567: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_func_mmap_fixed_mapped=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_func_mmap_fixed_mapped=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6
+if test $ac_cv_func_mmap_fixed_mapped = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_MMAP 1
+EOF
+
+fi
+
+
+# autoconf.info says this should be called right after AC_INIT.
+
+
+ac_aux_dir=
+for ac_dir in `cd $srcdir;pwd`/../.. $srcdir/`cd $srcdir;pwd`/../..; do
+ if test -f $ac_dir/install-sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { echo "configure: error: can not find install-sh or install.sh in `cd $srcdir;pwd`/../.. $srcdir/`cd $srcdir;pwd`/../.." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+
+# Do some error checking and defaulting for the host and target type.
+# The inputs are:
+# configure --host=HOST --target=TARGET --build=BUILD NONOPT
+#
+# The rules are:
+# 1. You are not allowed to specify --host, --target, and nonopt at the
+# same time.
+# 2. Host defaults to nonopt.
+# 3. If nonopt is not specified, then host defaults to the current host,
+# as determined by config.guess.
+# 4. Target and build default to nonopt.
+# 5. If nonopt is not specified, then target and build default to host.
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+case $host---$target---$nonopt in
+NONE---*---* | *---NONE---* | *---*---NONE) ;;
+*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
+esac
+
+
+# Make sure we can run config.sub.
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:1640: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+ case $nonopt in
+ NONE)
+ if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+ else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+ fi ;;
+ *) host_alias=$nonopt ;;
+ esac ;;
+esac
+
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
+echo $ac_n "checking target system type""... $ac_c" 1>&6
+echo "configure:1661: checking target system type" >&5
+
+target_alias=$target
+case "$target_alias" in
+NONE)
+ case $nonopt in
+ NONE) target_alias=$host_alias ;;
+ *) target_alias=$nonopt ;;
+ esac ;;
+esac
+
+target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
+target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$target" 1>&6
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:1679: checking build system type" >&5
+
+build_alias=$build
+case "$build_alias" in
+NONE)
+ case $nonopt in
+ NONE) build_alias=$host_alias ;;
+ *) build_alias=$nonopt ;;
+ esac ;;
+esac
+
+build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
+build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$build" 1>&6
+
+test "$host_alias" != "$target_alias" &&
+ test "$program_prefix$program_suffix$program_transform_name" = \
+ NONENONEs,x,x, &&
+ program_prefix=${target_alias}-
+
+if test "$program_transform_name" = s,x,x,; then
+ program_transform_name=
+else
+ # Double any \ or $. echo might interpret backslashes.
+ cat <<\EOF_SED > conftestsed
+s,\\,\\\\,g; s,\$,$$,g
+EOF_SED
+ program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
+ rm -f conftestsed
+fi
+test "$program_prefix" != NONE &&
+ program_transform_name="s,^,${program_prefix},; $program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
+
+# sed with no file args requires a program.
+test "$program_transform_name" = "" && program_transform_name="s,x,x,"
+
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1723: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="gcc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1752: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_prog_rejected=no
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# -gt 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ set dummy "$ac_dir/$ac_word" "$@"
+ shift
+ ac_cv_prog_CC="$@"
+ fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test -z "$CC"; then
+ case "`uname -s`" in
+ *win32* | *WIN32*)
+ # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1802: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="cl"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ ;;
+ esac
+ fi
+ test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:1833: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext <<EOF
+#line 1843 "configure"
+#include "confdefs.h"
+main(){return(0);}
+EOF
+if { (eval echo configure:1847: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ ac_cv_prog_cc_works=yes
+ # If we can't run a trivial program, we are probably using a cross compiler.
+ if (./conftest; exit) 2>/dev/null; then
+ ac_cv_prog_cc_cross=no
+ else
+ ac_cv_prog_cc_cross=yes
+ fi
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+if test $ac_cv_prog_cc_works = no; then
+ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+fi
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:1867: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:1872: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.c <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1881: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ ac_cv_prog_gcc=yes
+else
+ ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:1900: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+ ac_cv_prog_cc_g=yes
+else
+ ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:1943: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
+ for ac_dir in $PATH; do
+ # Account for people who put trailing slashes in PATH elements.
+ case "$ac_dir/" in
+ /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ if test -f $ac_dir/$ac_prog; then
+ if test $ac_prog = install &&
+ grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ else
+ ac_cv_path_install="$ac_dir/$ac_prog -c"
+ break 2
+ fi
+ fi
+ done
+ ;;
+ esac
+ done
+ IFS="$ac_save_IFS"
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL="$ac_cv_path_install"
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL="$ac_install_sh"
+ fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+
+# Put a plausible default for CC_FOR_BUILD in Makefile.
+if test "x$cross_compiling" = "xno"; then
+ CC_FOR_BUILD='$(CC)'
+else
+ CC_FOR_BUILD=gcc
+fi
+
+
+
+
+AR=${AR-ar}
+
+# Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2009: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_RANLIB="ranlib"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
+fi
+fi
+RANLIB="$ac_cv_prog_RANLIB"
+if test -n "$RANLIB"; then
+ echo "$ac_t""$RANLIB" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+ALL_LINGUAS=
+
+ for ac_hdr in argz.h limits.h locale.h nl_types.h malloc.h string.h \
+unistd.h values.h sys/param.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2043: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2048 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2053: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ for ac_func in getcwd munmap putenv setenv setlocale strchr strcasecmp \
+__argz_count __argz_stringify __argz_next
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2083: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2088 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2111: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+ if test "${ac_cv_func_stpcpy+set}" != "set"; then
+ for ac_func in stpcpy
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2140: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2145 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2168: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ fi
+ if test "${ac_cv_func_stpcpy}" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_STPCPY 1
+EOF
+
+ fi
+
+ if test $ac_cv_header_locale_h = yes; then
+ echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6
+echo "configure:2202: checking for LC_MESSAGES" >&5
+if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2207 "configure"
+#include "confdefs.h"
+#include <locale.h>
+int main() {
+return LC_MESSAGES
+; return 0; }
+EOF
+if { (eval echo configure:2214: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ am_cv_val_LC_MESSAGES=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ am_cv_val_LC_MESSAGES=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$am_cv_val_LC_MESSAGES" 1>&6
+ if test $am_cv_val_LC_MESSAGES = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_LC_MESSAGES 1
+EOF
+
+ fi
+ fi
+ echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6
+echo "configure:2235: checking whether NLS is requested" >&5
+ # Check whether --enable-nls or --disable-nls was given.
+if test "${enable_nls+set}" = set; then
+ enableval="$enable_nls"
+ USE_NLS=$enableval
+else
+ USE_NLS=yes
+fi
+
+ echo "$ac_t""$USE_NLS" 1>&6
+
+
+ USE_INCLUDED_LIBINTL=no
+
+ if test "$USE_NLS" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define ENABLE_NLS 1
+EOF
+
+ echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6
+echo "configure:2255: checking whether included gettext is requested" >&5
+ # Check whether --with-included-gettext or --without-included-gettext was given.
+if test "${with_included_gettext+set}" = set; then
+ withval="$with_included_gettext"
+ nls_cv_force_use_gnu_gettext=$withval
+else
+ nls_cv_force_use_gnu_gettext=no
+fi
+
+ echo "$ac_t""$nls_cv_force_use_gnu_gettext" 1>&6
+
+ nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
+ if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
+ nls_cv_header_intl=
+ nls_cv_header_libgt=
+ CATOBJEXT=NONE
+
+ ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for libintl.h""... $ac_c" 1>&6
+echo "configure:2274: checking for libintl.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2279 "configure"
+#include "confdefs.h"
+#include <libintl.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2284: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6
+echo "configure:2301: checking for gettext in libc" >&5
+if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2306 "configure"
+#include "confdefs.h"
+#include <libintl.h>
+int main() {
+return (int) gettext ("")
+; return 0; }
+EOF
+if { (eval echo configure:2313: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ gt_cv_func_gettext_libc=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ gt_cv_func_gettext_libc=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6
+
+ if test "$gt_cv_func_gettext_libc" != "yes"; then
+ echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6
+echo "configure:2329: checking for bindtextdomain in -lintl" >&5
+ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lintl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2337 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char bindtextdomain();
+
+int main() {
+bindtextdomain()
+; return 0; }
+EOF
+if { (eval echo configure:2348: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6
+echo "configure:2364: checking for gettext in libintl" >&5
+if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2369 "configure"
+#include "confdefs.h"
+
+int main() {
+return (int) gettext ("")
+; return 0; }
+EOF
+if { (eval echo configure:2376: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ gt_cv_func_gettext_libintl=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ gt_cv_func_gettext_libintl=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$gt_cv_func_gettext_libintl" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ fi
+
+ if test "$gt_cv_func_gettext_libc" = "yes" \
+ || test "$gt_cv_func_gettext_libintl" = "yes"; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_GETTEXT 1
+EOF
+
+ # Extract the first word of "msgfmt", so it can be a program name with args.
+set dummy msgfmt; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2404: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$MSGFMT" in
+ /*)
+ ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then
+ ac_cv_path_MSGFMT="$ac_dir/$ac_word"
+ break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="no"
+ ;;
+esac
+fi
+MSGFMT="$ac_cv_path_MSGFMT"
+if test -n "$MSGFMT"; then
+ echo "$ac_t""$MSGFMT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ if test "$MSGFMT" != "no"; then
+ for ac_func in dcgettext
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2438: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2443 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2466: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+ # Extract the first word of "gmsgfmt", so it can be a program name with args.
+set dummy gmsgfmt; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2493: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$GMSGFMT" in
+ /*)
+ ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_path_GMSGFMT="$ac_dir/$ac_word"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT"
+ ;;
+esac
+fi
+GMSGFMT="$ac_cv_path_GMSGFMT"
+if test -n "$GMSGFMT"; then
+ echo "$ac_t""$GMSGFMT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ # Extract the first word of "xgettext", so it can be a program name with args.
+set dummy xgettext; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2528: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$XGETTEXT" in
+ /*)
+ ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then
+ ac_cv_path_XGETTEXT="$ac_dir/$ac_word"
+ break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":"
+ ;;
+esac
+fi
+XGETTEXT="$ac_cv_path_XGETTEXT"
+if test -n "$XGETTEXT"; then
+ echo "$ac_t""$XGETTEXT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ cat > conftest.$ac_ext <<EOF
+#line 2560 "configure"
+#include "confdefs.h"
+
+int main() {
+extern int _nl_msg_cat_cntr;
+ return _nl_msg_cat_cntr
+; return 0; }
+EOF
+if { (eval echo configure:2568: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ CATOBJEXT=.gmo
+ DATADIRNAME=share
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CATOBJEXT=.mo
+ DATADIRNAME=lib
+fi
+rm -f conftest*
+ INSTOBJEXT=.mo
+ fi
+ fi
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+
+ if test "$CATOBJEXT" = "NONE"; then
+ nls_cv_use_gnu_gettext=yes
+ fi
+ fi
+
+ if test "$nls_cv_use_gnu_gettext" = "yes"; then
+ INTLOBJS="\$(GETTOBJS)"
+ # Extract the first word of "msgfmt", so it can be a program name with args.
+set dummy msgfmt; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2600: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$MSGFMT" in
+ /*)
+ ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then
+ ac_cv_path_MSGFMT="$ac_dir/$ac_word"
+ break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="msgfmt"
+ ;;
+esac
+fi
+MSGFMT="$ac_cv_path_MSGFMT"
+if test -n "$MSGFMT"; then
+ echo "$ac_t""$MSGFMT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ # Extract the first word of "gmsgfmt", so it can be a program name with args.
+set dummy gmsgfmt; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2634: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$GMSGFMT" in
+ /*)
+ ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
+ ;;
+ ?:/*)
+ ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_path_GMSGFMT="$ac_dir/$ac_word"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT"
+ ;;
+esac
+fi
+GMSGFMT="$ac_cv_path_GMSGFMT"
+if test -n "$GMSGFMT"; then
+ echo "$ac_t""$GMSGFMT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ # Extract the first word of "xgettext", so it can be a program name with args.
+set dummy xgettext; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2669: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ case "$XGETTEXT" in
+ /*)
+ ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
+ ;;
+ *)
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then
+ ac_cv_path_XGETTEXT="$ac_dir/$ac_word"
+ break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":"
+ ;;
+esac
+fi
+XGETTEXT="$ac_cv_path_XGETTEXT"
+if test -n "$XGETTEXT"; then
+ echo "$ac_t""$XGETTEXT" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+ USE_INCLUDED_LIBINTL=yes
+ CATOBJEXT=.gmo
+ INSTOBJEXT=.mo
+ DATADIRNAME=share
+ INTLDEPS='$(top_builddir)/../intl/libintl.a'
+ INTLLIBS=$INTLDEPS
+ LIBS=`echo $LIBS | sed -e 's/-lintl//'`
+ nls_cv_header_intl=libintl.h
+ nls_cv_header_libgt=libgettext.h
+ fi
+
+ if test "$XGETTEXT" != ":"; then
+ if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
+ : ;
+ else
+ echo "$ac_t""found xgettext programs is not GNU xgettext; ignore it" 1>&6
+ XGETTEXT=":"
+ fi
+ fi
+
+ # We need to process the po/ directory.
+ POSUB=po
+ else
+ DATADIRNAME=share
+ nls_cv_header_intl=libintl.h
+ nls_cv_header_libgt=libgettext.h
+ fi
+
+ # If this is used in GNU gettext we have to set USE_NLS to `yes'
+ # because some of the sources are only built for this goal.
+ if test "$PACKAGE" = gettext; then
+ USE_NLS=yes
+ USE_INCLUDED_LIBINTL=yes
+ fi
+
+ for lang in $ALL_LINGUAS; do
+ GMOFILES="$GMOFILES $lang.gmo"
+ POFILES="$POFILES $lang.po"
+ done
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ if test "x$CATOBJEXT" != "x"; then
+ if test "x$ALL_LINGUAS" = "x"; then
+ LINGUAS=
+ else
+ echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6
+echo "configure:2759: checking for catalogs to be installed" >&5
+ NEW_LINGUAS=
+ for lang in ${LINGUAS=$ALL_LINGUAS}; do
+ case "$ALL_LINGUAS" in
+ *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
+ esac
+ done
+ LINGUAS=$NEW_LINGUAS
+ echo "$ac_t""$LINGUAS" 1>&6
+ fi
+
+ if test -n "$LINGUAS"; then
+ for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
+ fi
+ fi
+
+ if test $ac_cv_header_locale_h = yes; then
+ INCLUDE_LOCALE_H="#include <locale.h>"
+ else
+ INCLUDE_LOCALE_H="\
+/* The system does not provide the header <locale.h>. Take care yourself. */"
+ fi
+
+
+ if test -f $srcdir/po2tbl.sed.in; then
+ if test "$CATOBJEXT" = ".cat"; then
+ ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6
+echo "configure:2787: checking for linux/version.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2792 "configure"
+#include "confdefs.h"
+#include <linux/version.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2797: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ msgformat=linux
+else
+ echo "$ac_t""no" 1>&6
+msgformat=xopen
+fi
+
+
+ sed -e '/^#/d' $srcdir/$msgformat-msg.sed > po2msg.sed
+ fi
+ sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
+ $srcdir/po2tbl.sed.in > po2tbl.sed
+ fi
+
+ if test "$PACKAGE" = "gettext"; then
+ GT_NO="#NO#"
+ GT_YES=
+ else
+ GT_NO=
+ GT_YES="#YES#"
+ fi
+
+
+
+ MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs"
+
+
+ l=
+
+
+ if test -d $srcdir/po; then
+ test -d po || mkdir po
+ if test "x$srcdir" != "x."; then
+ if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
+ posrcprefix="$srcdir/"
+ else
+ posrcprefix="../$srcdir/"
+ fi
+ else
+ posrcprefix="../"
+ fi
+ rm -f po/POTFILES
+ sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
+ < $srcdir/po/POTFILES.in > po/POTFILES
+ fi
+
+
+# Check for common headers.
+# FIXME: Seems to me this can cause problems for i386-windows hosts.
+# At one point there were hardcoded AC_DEFINE's if ${host} = i386-*-windows*.
+for ac_hdr in stdlib.h string.h strings.h unistd.h time.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2866: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2871 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2876: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in sys/time.h sys/resource.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2906: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2911 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2916: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in fcntl.h fpu_control.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2946: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2951 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2956: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in getrusage time sigaction __setfpucw
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2985: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2990 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3013: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+# Check for socket libraries
+echo $ac_n "checking for bind in -lsocket""... $ac_c" 1>&6
+echo "configure:3040: checking for bind in -lsocket" >&5
+ac_lib_var=`echo socket'_'bind | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lsocket $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3048 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char bind();
+
+int main() {
+bind()
+; return 0; }
+EOF
+if { (eval echo configure:3059: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo socket | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lsocket $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
+echo "configure:3087: checking for gethostbyname in -lnsl" >&5
+ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lnsl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3095 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char gethostbyname();
+
+int main() {
+gethostbyname()
+; return 0; }
+EOF
+if { (eval echo configure:3106: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo nsl | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lnsl $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+. ${srcdir}/../../bfd/configure.host
+
+
+
+USE_MAINTAINER_MODE=no
+# Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
+if test "${enable_maintainer_mode+set}" = set; then
+ enableval="$enable_maintainer_mode"
+ case "${enableval}" in
+ yes) MAINT="" USE_MAINTAINER_MODE=yes ;;
+ no) MAINT="#" ;;
+ *) { echo "configure: error: "--enable-maintainer-mode does not take a value"" 1>&2; exit 1; }; MAINT="#" ;;
+esac
+if test x"$silent" != x"yes" && test x"$MAINT" = x""; then
+ echo "Setting maintainer mode" 6>&1
+fi
+else
+ MAINT="#"
+fi
+
+
+
+# Check whether --enable-sim-bswap or --disable-sim-bswap was given.
+if test "${enable_sim_bswap+set}" = set; then
+ enableval="$enable_sim_bswap"
+ case "${enableval}" in
+ yes) sim_bswap="-DWITH_BSWAP=1 -DUSE_BSWAP=1";;
+ no) sim_bswap="-DWITH_BSWAP=0";;
+ *) { echo "configure: error: "--enable-sim-bswap does not take a value"" 1>&2; exit 1; }; sim_bswap="";;
+esac
+if test x"$silent" != x"yes" && test x"$sim_bswap" != x""; then
+ echo "Setting bswap flags = $sim_bswap" 6>&1
+fi
+else
+ sim_bswap=""
+fi
+
+
+
+# Check whether --enable-sim-cflags or --disable-sim-cflags was given.
+if test "${enable_sim_cflags+set}" = set; then
+ enableval="$enable_sim_cflags"
+ case "${enableval}" in
+ yes) sim_cflags="-O2 -fomit-frame-pointer";;
+ trace) { echo "configure: error: "Please use --enable-sim-debug instead."" 1>&2; exit 1; }; sim_cflags="";;
+ no) sim_cflags="";;
+ *) sim_cflags=`echo "${enableval}" | sed -e "s/,/ /g"`;;
+esac
+if test x"$silent" != x"yes" && test x"$sim_cflags" != x""; then
+ echo "Setting sim cflags = $sim_cflags" 6>&1
+fi
+else
+ sim_cflags=""
+fi
+
+
+
+# Check whether --enable-sim-debug or --disable-sim-debug was given.
+if test "${enable_sim_debug+set}" = set; then
+ enableval="$enable_sim_debug"
+ case "${enableval}" in
+ yes) sim_debug="-DDEBUG=7 -DWITH_DEBUG=7";;
+ no) sim_debug="-DDEBUG=0 -DWITH_DEBUG=0";;
+ *) sim_debug="-DDEBUG='(${enableval})' -DWITH_DEBUG='(${enableval})'";;
+esac
+if test x"$silent" != x"yes" && test x"$sim_debug" != x""; then
+ echo "Setting sim debug = $sim_debug" 6>&1
+fi
+else
+ sim_debug=""
+fi
+
+
+
+# Check whether --enable-sim-stdio or --disable-sim-stdio was given.
+if test "${enable_sim_stdio+set}" = set; then
+ enableval="$enable_sim_stdio"
+ case "${enableval}" in
+ yes) sim_stdio="-DWITH_STDIO=DO_USE_STDIO";;
+ no) sim_stdio="-DWITH_STDIO=DONT_USE_STDIO";;
+ *) { echo "configure: error: "Unknown value $enableval passed to --enable-sim-stdio"" 1>&2; exit 1; }; sim_stdio="";;
+esac
+if test x"$silent" != x"yes" && test x"$sim_stdio" != x""; then
+ echo "Setting stdio flags = $sim_stdio" 6>&1
+fi
+else
+ sim_stdio=""
+fi
+
+
+
+# Check whether --enable-sim-trace or --disable-sim-trace was given.
+if test "${enable_sim_trace+set}" = set; then
+ enableval="$enable_sim_trace"
+ case "${enableval}" in
+ yes) sim_trace="-DTRACE=1 -DWITH_TRACE=-1";;
+ no) sim_trace="-DTRACE=0 -DWITH_TRACE=0";;
+ [-0-9]*)
+ sim_trace="-DTRACE='(${enableval})' -DWITH_TRACE='(${enableval})'";;
+ [a-z]*)
+ sim_trace=""
+ for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
+ if test x"$sim_trace" = x; then
+ sim_trace="-DWITH_TRACE='(TRACE_$x"
+ else
+ sim_trace="${sim_trace}|TRACE_$x"
+ fi
+ done
+ sim_trace="$sim_trace)'" ;;
+esac
+if test x"$silent" != x"yes" && test x"$sim_trace" != x""; then
+ echo "Setting sim trace = $sim_trace" 6>&1
+fi
+else
+ sim_trace=""
+fi
+
+
+
+# Check whether --enable-sim-profile or --disable-sim-profile was given.
+if test "${enable_sim_profile+set}" = set; then
+ enableval="$enable_sim_profile"
+ case "${enableval}" in
+ yes) sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1";;
+ no) sim_profile="-DPROFILE=0 -DWITH_PROFILE=0";;
+ [-0-9]*)
+ sim_profile="-DPROFILE='(${enableval})' -DWITH_PROFILE='(${enableval})'";;
+ [a-z]*)
+ sim_profile=""
+ for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
+ if test x"$sim_profile" = x; then
+ sim_profile="-DWITH_PROFILE='(PROFILE_$x"
+ else
+ sim_profile="${sim_profile}|PROFILE_$x"
+ fi
+ done
+ sim_profile="$sim_profile)'" ;;
+esac
+if test x"$silent" != x"yes" && test x"$sim_profile" != x""; then
+ echo "Setting sim profile = $sim_profile" 6>&1
+fi
+else
+ sim_profile=""
+fi
+
+
+
+echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
+echo "configure:3282: checking return type of signal handlers" >&5
+if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3287 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <signal.h>
+#ifdef signal
+#undef signal
+#endif
+#ifdef __cplusplus
+extern "C" void (*signal (int, void (*)(int)))(int);
+#else
+void (*signal ()) ();
+#endif
+
+int main() {
+int i;
+; return 0; }
+EOF
+if { (eval echo configure:3304: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_type_signal=void
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_type_signal=int
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_type_signal" 1>&6
+cat >> confdefs.h <<EOF
+#define RETSIGTYPE $ac_cv_type_signal
+EOF
+
+
+
+echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
+echo "configure:3324: checking for executable suffix" >&5
+if eval "test \"`echo '$''{'am_cv_exeext'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$CYGWIN32" = yes; then
+am_cv_exeext=.exe
+else
+cat > am_c_test.c << 'EOF'
+int main() {
+/* Nothing needed here */
+}
+EOF
+${CC-cc} -o am_c_test $CFLAGS $CPPFLAGS $LDFLAGS am_c_test.c $LIBS 1>&5
+am_cv_exeext=`ls am_c_test.* | grep -v am_c_test.c | sed -e s/am_c_test//`
+rm -f am_c_test*
+fi
+
+test x"${am_cv_exeext}" = x && am_cv_exeext=no
+fi
+EXEEXT=""
+test x"${am_cv_exeext}" != xno && EXEEXT=${am_cv_exeext}
+echo "$ac_t""${am_cv_exeext}" 1>&6
+
+
+sim_link_files=
+sim_link_links=
+
+sim_link_links=tconfig.h
+if test -f ${srcdir}/tconfig.in
+then
+ sim_link_files=tconfig.in
+else
+ sim_link_files=../common/tconfig.in
+fi
+
+# targ-vals.def points to the libc macro description file.
+case "${target}" in
+*-*-*) TARG_VALS_DEF=../common/nltvals.def ;;
+esac
+sim_link_files="${sim_link_files} ${TARG_VALS_DEF}"
+sim_link_links="${sim_link_links} targ-vals.def"
+
+
+
+for ac_hdr in unistd.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:3372: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3377 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:3382: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+
+
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+ case `(ac_space=' '; set) 2>&1 | grep ac_space` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
+if cmp -s $cache_file confcache; then
+ :
+else
+ if test -w $cache_file; then
+ echo "updating cache $cache_file"
+ cat confcache > $cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+DEFS=-DHAVE_CONFIG_H
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+ case "\$ac_option" in
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+ exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+ -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+ echo "$CONFIG_STATUS generated by autoconf version 2.12.2"
+ exit 0 ;;
+ -help | --help | --hel | --he | --h)
+ echo "\$ac_cs_usage"; exit 0 ;;
+ *) echo "\$ac_cs_usage"; exit 1 ;;
+ esac
+done
+
+ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
+
+trap 'rm -fr `echo "Makefile.sim:Makefile.in Make-common.sim:../common/Make-common.in .gdbinit:../common/gdbinit.in config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@sim_environment@%$sim_environment%g
+s%@sim_alignment@%$sim_alignment%g
+s%@sim_assert@%$sim_assert%g
+s%@sim_bitsize@%$sim_bitsize%g
+s%@sim_endian@%$sim_endian%g
+s%@sim_hostendian@%$sim_hostendian%g
+s%@sim_float@%$sim_float%g
+s%@sim_scache@%$sim_scache%g
+s%@sim_default_model@%$sim_default_model%g
+s%@sim_hw_cflags@%$sim_hw_cflags%g
+s%@sim_hw_objs@%$sim_hw_objs%g
+s%@sim_hw@%$sim_hw%g
+s%@sim_inline@%$sim_inline%g
+s%@sim_packages@%$sim_packages%g
+s%@sim_regparm@%$sim_regparm%g
+s%@sim_reserved_bits@%$sim_reserved_bits%g
+s%@sim_smp@%$sim_smp%g
+s%@sim_stdcall@%$sim_stdcall%g
+s%@sim_xor_endian@%$sim_xor_endian%g
+s%@build_warnings@%$build_warnings%g
+s%@SHELL@%$SHELL%g
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@host@%$host%g
+s%@host_alias@%$host_alias%g
+s%@host_cpu@%$host_cpu%g
+s%@host_vendor@%$host_vendor%g
+s%@host_os@%$host_os%g
+s%@target@%$target%g
+s%@target_alias@%$target_alias%g
+s%@target_cpu@%$target_cpu%g
+s%@target_vendor@%$target_vendor%g
+s%@target_os@%$target_os%g
+s%@build@%$build%g
+s%@build_alias@%$build_alias%g
+s%@build_cpu@%$build_cpu%g
+s%@build_vendor@%$build_vendor%g
+s%@build_os@%$build_os%g
+s%@CC@%$CC%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@CC_FOR_BUILD@%$CC_FOR_BUILD%g
+s%@HDEFINES@%$HDEFINES%g
+s%@AR@%$AR%g
+s%@RANLIB@%$RANLIB%g
+s%@SET_MAKE@%$SET_MAKE%g
+s%@CPP@%$CPP%g
+s%@ALLOCA@%$ALLOCA%g
+s%@USE_NLS@%$USE_NLS%g
+s%@MSGFMT@%$MSGFMT%g
+s%@GMSGFMT@%$GMSGFMT%g
+s%@XGETTEXT@%$XGETTEXT%g
+s%@USE_INCLUDED_LIBINTL@%$USE_INCLUDED_LIBINTL%g
+s%@CATALOGS@%$CATALOGS%g
+s%@CATOBJEXT@%$CATOBJEXT%g
+s%@DATADIRNAME@%$DATADIRNAME%g
+s%@GMOFILES@%$GMOFILES%g
+s%@INSTOBJEXT@%$INSTOBJEXT%g
+s%@INTLDEPS@%$INTLDEPS%g
+s%@INTLLIBS@%$INTLLIBS%g
+s%@INTLOBJS@%$INTLOBJS%g
+s%@POFILES@%$POFILES%g
+s%@POSUB@%$POSUB%g
+s%@INCLUDE_LOCALE_H@%$INCLUDE_LOCALE_H%g
+s%@GT_NO@%$GT_NO%g
+s%@GT_YES@%$GT_YES%g
+s%@MKINSTALLDIRS@%$MKINSTALLDIRS%g
+s%@l@%$l%g
+s%@MAINT@%$MAINT%g
+s%@sim_bswap@%$sim_bswap%g
+s%@sim_cflags@%$sim_cflags%g
+s%@sim_debug@%$sim_debug%g
+s%@sim_stdio@%$sim_stdio%g
+s%@sim_trace@%$sim_trace%g
+s%@sim_profile@%$sim_profile%g
+s%@EXEEXT@%$EXEEXT%g
+
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+ else
+ sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+ fi
+ if test ! -s conftest.s$ac_file; then
+ ac_more_lines=false
+ rm -f conftest.s$ac_file
+ else
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f conftest.s$ac_file"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+ fi
+ ac_file=`expr $ac_file + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_cmds`
+ fi
+done
+if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"Makefile.sim:Makefile.in Make-common.sim:../common/Make-common.in .gdbinit:../common/gdbinit.in"}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+ else
+ ac_dir_suffix= ac_dots=
+ fi
+
+ case "$ac_given_srcdir" in
+ .) srcdir=.
+ if test -z "$ac_dots"; then top_srcdir=.
+ else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+ /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+ *) # Relative path.
+ srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+ top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ esac
+
+ case "$ac_given_INSTALL" in
+ [/$]*) INSTALL="$ac_given_INSTALL" ;;
+ *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+ esac
+
+ echo creating "$ac_file"
+ rm -f "$ac_file"
+ configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+ case "$ac_file" in
+ *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+ *) ac_comsub= ;;
+ esac
+
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+ sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s*
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
+ac_dB='\([ ][ ]*\)[^ ]*%\1#\2'
+ac_dC='\3'
+ac_dD='%g'
+# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
+ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_uB='\([ ]\)%\1#\2define\3'
+ac_uC=' '
+ac_uD='\4%g'
+# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_eB='$%\1#\2define\3'
+ac_eC=' '
+ac_eD='%g'
+
+if test "${CONFIG_HEADERS+set}" != set; then
+EOF
+cat >> $CONFIG_STATUS <<EOF
+ CONFIG_HEADERS="config.h:config.in"
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+fi
+for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ echo creating $ac_file
+
+ rm -f conftest.frag conftest.in conftest.out
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+ cat $ac_file_inputs > conftest.in
+
+EOF
+
+# Transform confdefs.h into a sed script conftest.vals that substitutes
+# the proper values into config.h.in to produce config.h. And first:
+# Protect against being on the right side of a sed subst in config.status.
+# Protect against being in an unquoted here document in config.status.
+rm -f conftest.vals
+cat > conftest.hdr <<\EOF
+s/[\\&%]/\\&/g
+s%[\\$`]%\\&%g
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
+s%ac_d%ac_u%gp
+s%ac_u%ac_e%gp
+EOF
+sed -n -f conftest.hdr confdefs.h > conftest.vals
+rm -f conftest.hdr
+
+# This sed command replaces #undef with comments. This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >> conftest.vals <<\EOF
+s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
+EOF
+
+# Break up conftest.vals because some shells have a limit on
+# the size of here documents, and old seds have small limits too.
+
+rm -f conftest.tail
+while :
+do
+ ac_lines=`grep -c . conftest.vals`
+ # grep -c gives empty output for an empty file on some AIX systems.
+ if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
+ # Write a limited-size here document to conftest.frag.
+ echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
+ echo 'CEOF
+ sed -f conftest.frag conftest.in > conftest.out
+ rm -f conftest.in
+ mv conftest.out conftest.in
+' >> $CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
+ rm -f conftest.vals
+ mv conftest.tail conftest.vals
+done
+rm -f conftest.vals
+
+cat >> $CONFIG_STATUS <<\EOF
+ rm -f conftest.frag conftest.h
+ echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
+ cat conftest.in >> conftest.h
+ rm -f conftest.in
+ if cmp -s $ac_file conftest.h 2>/dev/null; then
+ echo "$ac_file is unchanged"
+ rm -f conftest.h
+ else
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ fi
+ rm -f $ac_file
+ mv conftest.h $ac_file
+ fi
+fi; done
+
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+ac_sources="$sim_link_files"
+ac_dests="$sim_link_links"
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+srcdir=$ac_given_srcdir
+while test -n "$ac_sources"; do
+ set $ac_dests; ac_dest=$1; shift; ac_dests=$*
+ set $ac_sources; ac_source=$1; shift; ac_sources=$*
+
+ echo "linking $srcdir/$ac_source to $ac_dest"
+
+ if test ! -r $srcdir/$ac_source; then
+ { echo "configure: error: $srcdir/$ac_source: File not found" 1>&2; exit 1; }
+ fi
+ rm -f $ac_dest
+
+ # Make relative symlinks.
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dest_dir=`echo $ac_dest|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then
+ # The dest file is in a subdirectory.
+ test ! -d "$ac_dest_dir" && mkdir "$ac_dest_dir"
+ ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's%^\./%%'`"
+ # A "../" for each directory in $ac_dest_dir_suffix.
+ ac_dots=`echo $ac_dest_dir_suffix|sed 's%/[^/]*%../%g'`
+ else
+ ac_dest_dir_suffix= ac_dots=
+ fi
+
+ case "$srcdir" in
+ [/$]*) ac_rel_source="$srcdir/$ac_source" ;;
+ *) ac_rel_source="$ac_dots$srcdir/$ac_source" ;;
+ esac
+
+ # Make a symlink if possible; otherwise try a hard link.
+ if ln -s $ac_rel_source $ac_dest 2>/dev/null ||
+ ln $srcdir/$ac_source $ac_dest; then :
+ else
+ { echo "configure: error: can not link $ac_dest to $srcdir/$ac_source" 1>&2; exit 1; }
+ fi
+done
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+case "x$CONFIG_FILES" in
+ xMakefile*)
+ echo "Merging Makefile.sim+Make-common.sim into Makefile ..."
+ rm -f Makesim1.tmp Makesim2.tmp Makefile
+ sed -n -e '/^## COMMON_PRE_/,/^## End COMMON_PRE_/ p' <Make-common.sim >Makesim1.tmp
+ sed -n -e '/^## COMMON_POST_/,/^## End COMMON_POST_/ p' <Make-common.sim >Makesim2.tmp
+ sed -e '/^## COMMON_PRE_/ r Makesim1.tmp' \
+ -e '/^## COMMON_POST_/ r Makesim2.tmp' \
+ <Makefile.sim >Makefile
+ rm -f Makefile.sim Make-common.sim Makesim1.tmp Makesim2.tmp
+ ;;
+ esac
+ case "x$CONFIG_HEADERS" in xconfig.h:config.in) echo > stamp-h ;; esac
+
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
+
diff --git a/sim/mcore/configure.in b/sim/mcore/configure.in
new file mode 100644
index 00000000000..033b0bc1615
--- /dev/null
+++ b/sim/mcore/configure.in
@@ -0,0 +1,10 @@
+dnl Process this file with autoconf to produce a configure script.
+sinclude(../common/aclocal.m4)
+AC_PREREQ(2.5)dnl
+AC_INIT(Makefile.in)
+
+SIM_AC_COMMON
+
+AC_CHECK_HEADERS(unistd.h)
+
+SIM_AC_OUTPUT
diff --git a/sim/mcore/interp.c b/sim/mcore/interp.c
new file mode 100644
index 00000000000..e6d5c1a4626
--- /dev/null
+++ b/sim/mcore/interp.c
@@ -0,0 +1,2133 @@
+/* Simulator for Motorolla's MCore processor
+ Copyright (C) 1999 Free Software Foundation, Inc.
+ Contributed by Cygnus Solutions.
+
+This file is part of GDB, the GNU debugger.
+
+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, write to the Free Software Foundation, Inc.,
+59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#include <signal.h>
+#include "sysdep.h"
+#include <sys/times.h>
+#include <sys/param.h>
+#include <netinet/in.h> /* for byte ordering macros */
+#include "bfd.h"
+#include "callback.h"
+#include "libiberty.h"
+#include "remote-sim.h"
+
+#ifndef NUM_ELEM
+#define NUM_ELEM(A) (sizeof (A) / sizeof (A)[0])
+#endif
+
+
+typedef long int word;
+typedef unsigned long int uword;
+
+static unsigned long heap_ptr = 0;
+host_callback * callback;
+
+
+#define TARGET_BYTE_ORDER BIG_ENDIAN /* XXX */
+
+unsigned long
+mcore_extract_unsigned_integer (addr, len)
+ unsigned char * addr;
+ int len;
+{
+ unsigned long retval;
+ unsigned char * p;
+ unsigned char * startaddr = (unsigned char *)addr;
+ unsigned char * endaddr = startaddr + len;
+
+ if (len > (int) sizeof (unsigned long))
+ printf ("That operation is not available on integers of more than %d bytes.",
+ sizeof (unsigned long));
+
+ /* Start at the most significant end of the integer, and work towards
+ the least significant. */
+ retval = 0;
+ for (p = startaddr; p < endaddr; ++p)
+ retval = (retval << 8) | * p;
+
+ return retval;
+}
+
+void
+mcore_store_unsigned_integer (addr, len, val)
+ unsigned char * addr;
+ int len;
+ unsigned long val;
+{
+ unsigned char * p;
+ unsigned char * startaddr = (unsigned char *)addr;
+ unsigned char * endaddr = startaddr + len;
+
+ /* Start at the least significant end of the integer, and work towards
+ the most significant. */
+ for (p = endaddr - 1; p >= startaddr; --p)
+ {
+ * p = val & 0xff;
+ val >>= 8;
+ }
+}
+
+/* The machine state.
+ This state is maintained in host byte order. The
+ fetch/store register functions must translate between host
+ byte order and the target processor byte order (for MCore this
+ is big-endian). Since we know that the MCore is always big-endian,
+ we cheat a bit and use the ntohl() and htonl() macros to
+ achieve this end.
+
+ Keeping this data in target byte order simplifies the register
+ read/write functions. Keeping this data in native order improves
+ the performance of the simulator. Simulation speed is deemed more
+ important. */
+
+/* The ordering of the mcore_regset structure is matched in the
+ gdb/config/mcore/tm-mcore.h file in the REGISTER_NAMES macro. */
+struct mcore_regset
+{
+ word gregs [16]; /* primary registers */
+ word alt_gregs [16]; /* alt register file */
+ word cregs [32]; /* control registers */
+ word pc; /* the pc */
+ int ticks;
+ int stalls;
+ int cycles;
+ int insts;
+ int exception;
+ unsigned long msize;
+ unsigned char * memory;
+ word * active_gregs;
+};
+
+union
+{
+ struct mcore_regset asregs;
+ word asints [1]; /* but accessed larger... */
+} cpu;
+
+#define LAST_VALID_CREG 12 /* only 0..12 implemented */
+#define NUM_MCORE_REGS (16 + 16 + LAST_VALID_CREG)
+
+int memcycles = 1;
+
+static SIM_OPEN_KIND sim_kind;
+static char * myname;
+
+static int issue_messages = 0;
+
+#define gr asregs.active_gregs
+#define cr asregs.cregs
+#define sr asregs.cregs[0]
+#define vbr asregs.cregs[1]
+#define esr asregs.cregs[2]
+#define fsr asregs.cregs[3]
+#define epc asregs.cregs[4]
+#define fpc asregs.cregs[5]
+#define ss0 asregs.cregs[6]
+#define ss1 asregs.cregs[7]
+#define ss2 asregs.cregs[8]
+#define ss3 asregs.cregs[9]
+#define ss4 asregs.cregs[10]
+#define gcr asregs.cregs[11]
+#define gsr asregs.cregs[12]
+#define mem asregs.memory
+
+/* maniuplate the carry bit */
+#define C_ON() (cpu.sr & 1)
+#define C_VALUE() (cpu.sr & 1)
+#define C_OFF() ((cpu.sr & 1) == 0)
+#define SET_C() {cpu.sr |= 1;}
+#define CLR_C() {cpu.sr &= 0xfffffffe;}
+#define NEW_C(v){CLR_C(); cpu.sr |= ((v) & 1);}
+
+#define SR_AF() ((cpu.sr >> 1) & 1)
+
+#define TRAPCODE 1 /* r1 holds which function we want */
+#define PARM1 2 /* first parameter */
+#define PARM2 3
+#define PARM3 4
+#define PARM4 5
+#define RET1 2 /* register for return values. */
+
+long
+int_sbrk (inc_bytes)
+ int inc_bytes;
+{
+ long addr;
+
+ addr = heap_ptr;
+
+ heap_ptr += inc_bytes;
+
+ if (issue_messages && heap_ptr>cpu.gr[0])
+ fprintf (stderr, "Warning: heap_ptr overlaps stack!\n");
+
+ return addr;
+}
+
+static void INLINE
+wbat (x, v)
+ word x, v;
+{
+ if (((uword)x) >= cpu.asregs.msize)
+ {
+ if (issue_messages)
+ fprintf (stderr, "byte write to 0x%x outside memory range\n", x);
+
+ cpu.asregs.exception = SIGSEGV;
+ }
+ else
+ {
+ unsigned char *p = cpu.mem + x;
+ p[0] = v;
+ }
+}
+
+static void INLINE
+wlat (x, v)
+ word x, v;
+{
+ if (((uword)x) >= cpu.asregs.msize)
+ {
+ if (issue_messages)
+ fprintf (stderr, "word write to 0x%x outside memory range\n", x);
+
+ cpu.asregs.exception = SIGSEGV;
+ }
+ else
+ {
+ if ((x & 3) != 0)
+ {
+ if (issue_messages)
+ fprintf (stderr, "word write to unaligned memory address: 0x%x\n", x);
+
+ cpu.asregs.exception = SIGBUS;
+ }
+ else
+ {
+ unsigned char * p = cpu.mem + x;
+ p[0] = v >> 24;
+ p[1] = v >> 16;
+ p[2] = v >> 8;
+ p[3] = v;
+ }
+ }
+}
+
+static void INLINE
+what (x, v)
+ word x, v;
+{
+ if (((uword)x) >= cpu.asregs.msize)
+ {
+ if (issue_messages)
+ fprintf (stderr, "short write to 0x%x outside memory range\n", x);
+
+ cpu.asregs.exception = SIGSEGV;
+ }
+ else
+ {
+ if ((x & 1) != 0)
+ {
+ if (issue_messages)
+ fprintf (stderr, "short write to unaligned memory address: 0x%x\n", x);
+
+ cpu.asregs.exception = SIGBUS;
+ }
+ else
+ {
+ unsigned char * p = cpu.mem + x;
+ p[0] = v >> 8;
+ p[1] = v;
+ }
+ }
+}
+
+/* Read functions */
+static int INLINE
+rbat (x)
+ word x;
+{
+ if (((uword)x) >= cpu.asregs.msize)
+ {
+ if (issue_messages)
+ fprintf (stderr, "byte read from 0x%x outside memory range\n", x);
+
+ cpu.asregs.exception = SIGSEGV;
+ return 0;
+ }
+ else
+ {
+ unsigned char * p = cpu.mem + x;
+ return p[0];
+ }
+}
+
+static int INLINE
+rlat (x)
+ word x;
+{
+ if (((uword) x) >= cpu.asregs.msize)
+ {
+ if (issue_messages)
+ fprintf (stderr, "word read from 0x%x outside memory range\n", x);
+
+ cpu.asregs.exception = SIGSEGV;
+ return 0;
+ }
+ else
+ {
+ if ((x & 3) != 0)
+ {
+ if (issue_messages)
+ fprintf (stderr, "word read from unaligned address: 0x%x\n", x);
+
+ cpu.asregs.exception = SIGBUS;
+ return 0;
+ }
+ else
+ {
+ unsigned char * p = cpu.mem + x;
+ return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
+ }
+ }
+}
+
+static int INLINE
+rhat (x)
+ word x;
+{
+ if (((uword)x) >= cpu.asregs.msize)
+ {
+ if (issue_messages)
+ fprintf (stderr, "short read from 0x%x outside memory range\n", x);
+
+ cpu.asregs.exception = SIGSEGV;
+ return 0;
+ }
+ else
+ {
+ if ((x & 1) != 0)
+ {
+ if (issue_messages)
+ fprintf (stderr, "short read from unaligned address: 0x%x\n", x);
+
+ cpu.asregs.exception = SIGBUS;
+ return 0;
+ }
+ else
+ {
+ unsigned char * p = cpu.mem + x;
+ return (p[0] << 8) | p[1];
+ }
+ }
+}
+
+
+#define SEXTB(x) (((x & 0xff) ^ (~ 0x7f)) + 0x80)
+#define SEXTW(y) ((int)((short)y))
+
+static int
+IOMEM (addr, write, value)
+ int addr;
+ int write;
+ int value;
+{
+}
+
+/* default to a 8 Mbyte (== 2^23) memory space */
+static int sim_memory_size = 23;
+
+#define MEM_SIZE_FLOOR 64
+void
+sim_size (power)
+ int power;
+{
+ sim_memory_size = power;
+ cpu.asregs.msize = 1 << sim_memory_size;
+
+ if (cpu.mem)
+ free (cpu.mem);
+
+ /* watch out for the '0 count' problem. There's probably a better
+ way.. e.g., why do we use 64 here? */
+ if (cpu.asregs.msize < 64) /* ensure a boundary */
+ cpu.mem = (unsigned char *) calloc (64, (64 + cpu.asregs.msize) / 64);
+ else
+ cpu.mem = (unsigned char *) calloc (64, cpu.asregs.msize / 64);
+
+ if (!cpu.mem)
+ {
+ if (issue_messages)
+ fprintf (stderr,
+ "Not enough VM for simulation of %d bytes of RAM\n", cpu.asregs.msize);
+
+ cpu.asregs.msize = 1;
+ cpu.mem = (unsigned char *) calloc (1, 1);
+ }
+}
+
+static void
+init_pointers ()
+{
+ if (cpu.asregs.msize != (1 << sim_memory_size))
+ sim_size (sim_memory_size);
+}
+
+static void
+set_initial_gprs ()
+{
+ int i;
+ long space;
+ unsigned long memsize;
+
+ init_pointers ();
+
+ /* Set up machine just out of reset. */
+ cpu.asregs.pc = 0;
+ cpu.sr = 0;
+
+ memsize = cpu.asregs.msize / (1024 * 1024);
+
+ if (issue_messages)
+ fprintf (stderr, "Simulated memory of %d Mbytes (0x0 .. 0x%08x)\n",
+ memsize, cpu.asregs.msize - 1);
+
+ /* Clean out the GPRs and alternate GPRs. */
+ for (i = 0; i < 16; i++)
+ {
+ cpu.asregs.gregs[i] = 0;
+ cpu.asregs.alt_gregs[i] = 0;
+ }
+
+ /* Make our register set point to the right place. */
+ if (SR_AF())
+ cpu.asregs.active_gregs = &cpu.asregs.alt_gregs[0];
+ else
+ cpu.asregs.active_gregs = &cpu.asregs.gregs[0];
+
+ /* ABI specifies initial values for these registers. */
+ cpu.gr[0] = cpu.asregs.msize - 4;
+
+ /* dac fix, the stack address must be 8-byte aligned! */
+ cpu.gr[0] = cpu.gr[0] - cpu.gr[0] % 8;
+ cpu.gr[PARM1] = 0;
+ cpu.gr[PARM2] = 0;
+ cpu.gr[PARM3] = 0;
+ cpu.gr[PARM4] = cpu.gr[0];
+}
+
+static void
+interrupt ()
+{
+ cpu.asregs.exception = SIGINT;
+}
+
+/* Functions so that trapped open/close don't interfere with the
+ parent's functions. We say that we can't close the descriptors
+ that we didn't open. exit() and cleanup() get in trouble here,
+ to some extent. That's the price of emulation. */
+
+unsigned char opened[100];
+
+static void
+log_open (fd)
+ int fd;
+{
+ if (fd < 0 || fd > NUM_ELEM (opened))
+ return;
+
+ opened[fd] = 1;
+}
+
+static void
+log_close (fd)
+ int fd;
+{
+ if (fd < 0 || fd > NUM_ELEM (opened))
+ return;
+
+ opened[fd] = 0;
+}
+
+static int
+is_opened (fd)
+ int fd;
+{
+ if (fd < 0 || fd > NUM_ELEM (opened))
+ return 0;
+
+ return opened[fd];
+}
+
+static void
+handle_trap1 ()
+{
+ unsigned long a[3];
+
+ switch ((unsigned long) (cpu.gr[TRAPCODE]))
+ {
+ case 3:
+ a[0] = (unsigned long) (cpu.gr[PARM1]);
+ a[1] = (unsigned long) (cpu.mem + cpu.gr[PARM2]);
+ a[2] = (unsigned long) (cpu.gr[PARM3]);
+ cpu.gr[RET1] = callback->read (callback, a[0], (char *) a[1], a[2]);
+ break;
+
+ case 4:
+ a[0] = (unsigned long) (cpu.gr[PARM1]);
+ a[1] = (unsigned long) (cpu.mem + cpu.gr[PARM2]);
+ a[2] = (unsigned long) (cpu.gr[PARM3]);
+ cpu.gr[RET1] = (int)callback->write (callback, a[0], (char *) a[1], a[2]);
+ break;
+
+ case 5:
+ a[0] = (unsigned long) (cpu.mem + cpu.gr[PARM1]);
+ a[1] = (unsigned long) (cpu.gr[PARM2]);
+ /* a[2] = (unsigned long) (cpu.gr[PARM3]); */
+ cpu.gr[RET1] = callback->open (callback, (char *) a[0], a[1]);
+ log_open (cpu.gr[RET1]);
+ break;
+
+ case 6:
+ a[0] = (unsigned long) (cpu.gr[4]);
+ /* Watch out for debugger's files. */
+ if (is_opened (a[0]))
+ {
+ log_close (a[0]);
+ cpu.gr[RET1] = callback->close (callback, a[0]);
+ }
+ else
+ {
+ /* Don't let him close it. */
+ cpu.gr[RET1] = (-1);
+ }
+ break;
+
+ case 9:
+ a[0] = (unsigned long) (cpu.mem + cpu.gr[PARM1]);
+ a[1] = (unsigned long) (cpu.mem + cpu.gr[PARM2]);
+ cpu.gr[RET1] = link ((char *) a[0], (char *) a[1]);
+ break;
+
+ case 10:
+ a[0] = (unsigned long) (cpu.mem + cpu.gr[PARM1]);
+ cpu.gr[RET1] = callback->unlink (callback, (char *) a[0]);
+ break;
+
+ case 13:
+ /* handle time(0) vs time(&var) */
+ a[0] = (unsigned long) (cpu.gr[PARM1]);
+ if (a[0])
+ a[0] += (unsigned long) cpu.mem;
+ cpu.gr[RET1] = callback->time (callback, (time_t *) a[0]);
+ break;
+
+ case 19:
+ a[0] = (unsigned long) (cpu.gr[PARM1]);
+ a[1] = (unsigned long) (cpu.gr[PARM2]);
+ a[2] = (unsigned long) (cpu.gr[PARM3]);
+ cpu.gr[RET1] = callback->lseek (callback, a[0], a[1], a[2]);
+ break;
+
+ case 33:
+ a[0] = (unsigned long) (cpu.mem + cpu.gr[PARM1]);
+ a[1] = (unsigned long) (cpu.gr[PARM2]);
+ cpu.gr[RET1] = access ((char *) a[0], a[1]);
+ break;
+
+ case 43:
+ a[0] = (unsigned long) (cpu.mem + cpu.gr[PARM1]);
+#if 0
+ cpu.gr[RET1] = times ((char *)a[0]);
+#else
+ {
+ /* Give him simulated cycles for utime
+ and an instruction count for stime. */
+ struct tms
+ {
+ time_t tms_utime;
+ time_t tms_stime;
+ time_t tms_cutime;
+ time_t tms_cstime;
+ } t;
+
+ t.tms_utime = cpu.asregs.cycles;
+ t.tms_stime = cpu.asregs.insts;
+ t.tms_cutime = t.tms_utime;
+ t.tms_cstime = t.tms_stime;
+
+ memcpy ((struct tms *)(a[0]), &t, sizeof (t));
+
+ cpu.gr[RET1] = cpu.asregs.cycles;
+ }
+#endif
+ break;
+
+ case 69:
+ a[0] = (unsigned long) (cpu.gr[PARM1]);
+ cpu.gr[RET1] = int_sbrk (a[0]);
+ break;
+
+ default:
+ if (issue_messages)
+ fprintf (stderr, "WARNING: sys call %d unimplemented\n", cpu.gr[TRAPCODE]);
+ break;
+ }
+}
+
+static void
+process_stub (what)
+ int what;
+{
+ /* These values should match those in libgloss/mcore/syscalls.s. */
+ switch (what)
+ {
+ case 3: /* _read */
+ case 5: /* _open */
+ case 6: /* _close */
+ case 10: /* _unlink */
+ case 19: /* _lseek */
+ case 43: /* _times */
+ cpu.gr [TRAPCODE] = what;
+ handle_trap1 ();
+ break;
+
+ default:
+ if (issue_messages)
+ fprintf (stderr, "Unhandled stub opcode: %d\n", what);
+ break;
+ }
+}
+
+static void
+util (what)
+ unsigned what;
+{
+ switch (what)
+ {
+ case 0: /* exit */
+ cpu.asregs.exception = SIGQUIT;
+ break;
+
+ case 1: /* printf */
+ {
+ unsigned long a[6];
+ unsigned char *s;
+ int i;
+
+ a[0] = (unsigned long)(cpu.mem + cpu.gr[PARM1]);
+
+ for (s = (unsigned char *)a[0], i = 1 ; *s && i < 6 ; s++)
+ {
+ if (*s == '%')
+ {
+ if (*++s == 's')
+ a[i] = (unsigned long)(cpu.mem + cpu.gr[PARM1+i]);
+ else
+ a[i] = cpu.gr[i+PARM1];
+ i++;
+ }
+ }
+
+ cpu.gr[RET1] = printf ((char *)a[0], a[1], a[2], a[3], a[4], a[5]);
+ }
+ break;
+
+ case 2: /* scanf */
+ if (issue_messages)
+ fprintf (stderr, "WARNING: scanf unimplemented\n");
+ break;
+
+ case 3: /* utime */
+ cpu.gr[RET1] = cpu.asregs.insts;
+ break;
+
+ case 0xFF:
+ process_stub (what);
+ break;
+
+ default:
+ if (issue_messages)
+ fprintf (stderr, "Unhandled util code: %x\n", what);
+ break;
+ }
+}
+
+/* For figuring out whether we carried; addc/subc use this. */
+static int
+iu_carry (a, b, cin)
+ unsigned long a;
+ unsigned long b;
+ int cin;
+{
+ unsigned long x;
+
+ x = (a & 0xffff) + (b & 0xffff) + cin;
+ x = (x >> 16) + (a >> 16) + (b >> 16);
+ x >>= 16;
+
+ return (x != 0);
+}
+
+#define WATCHFUNCTIONS 1
+#ifdef WATCHFUNCTIONS
+
+#define MAXWL 80
+word WL[MAXWL];
+char * WLstr[MAXWL];
+
+int ENDWL=0;
+int WLincyc;
+int WLcyc[MAXWL];
+int WLcnts[MAXWL];
+int WLmax[MAXWL];
+int WLmin[MAXWL];
+word WLendpc;
+int WLbcyc;
+int WLW;
+#endif
+
+#define RD (inst & 0xF)
+#define RS ((inst >> 4) & 0xF)
+#define RX ((inst >> 8) & 0xF)
+#define IMM5 ((inst >> 4) & 0x1F)
+#define IMM4 ((inst) & 0xF)
+
+static int tracing = 0;
+
+void
+sim_resume (sd, step, siggnal)
+ SIM_DESC sd;
+ int step, siggnal;
+{
+ int needfetch;
+ word ibuf;
+ word pc;
+ unsigned short inst;
+ void (* sigsave)();
+ int memops;
+ int bonus_cycles;
+ int insts;
+ int w;
+ int cycs;
+ word WLhash;
+
+ sigsave = signal (SIGINT, interrupt);
+ cpu.asregs.exception = step ? SIGTRAP: 0;
+ pc = cpu.asregs.pc;
+
+ /* fetch the initial instructions that we'll decode */
+ ibuf = rlat (pc & 0xFFFFFFFC);
+ needfetch = 0;
+
+ memops = 0;
+ bonus_cycles = 0;
+ insts = 0;
+
+ /* make our register set point to the right place */
+ if (SR_AF ())
+ cpu.asregs.active_gregs = & cpu.asregs.alt_gregs[0];
+ else
+ cpu.asregs.active_gregs = & cpu.asregs.gregs[0];
+
+ /* make a hash to speed exec loop, hope it's nonzero */
+ WLhash = 0xFFFFFFFF;
+
+ for (w = 1; w <= ENDWL; w++)
+ WLhash = WLhash & WL[w];
+
+ do
+ {
+ insts ++;
+
+ if (pc & 02)
+ {
+ inst = ibuf & 0xFFFF;
+ needfetch = 1;
+ }
+ else
+ {
+ inst = ibuf >> 16;
+ }
+
+#ifdef WATCHFUNCTIONS
+ /* now scan list of watch addresses, if match, count it and
+ note return address and count cycles until pc=return address */
+
+ if ((WLincyc == 1) && (pc == WLendpc))
+ {
+ cycs = (cpu.asregs.cycles + (insts + bonus_cycles +
+ (memops * memcycles)) - WLbcyc);
+
+ if (WLcnts[WLW] == 1)
+ {
+ WLmax[WLW] = cycs;
+ WLmin[WLW] = cycs;
+ WLcyc[WLW] = 0;
+ }
+
+ if (cycs > WLmax[WLW])
+ {
+ WLmax[WLW] = cycs;
+ }
+
+ if (cycs < WLmin[WLW])
+ {
+ WLmin[WLW] = cycs;
+ }
+
+ WLcyc[WLW] += cycs;
+ WLincyc = 0;
+ WLendpc = 0;
+ }
+
+ /* optimize with a hash to speed loop */
+ if (WLincyc == 0)
+ {
+ if ((WLhash == 0) || ((WLhash & pc) != 0))
+ {
+ for (w=1; w <= ENDWL; w++)
+ {
+ if (pc == WL[w])
+ {
+ WLcnts[w]++;
+ WLbcyc = cpu.asregs.cycles + insts
+ + bonus_cycles + (memops * memcycles);
+ WLendpc = cpu.gr[15];
+ WLincyc = 1;
+ WLW = w;
+ break;
+ }
+ }
+ }
+ }
+#endif
+
+ if (tracing)
+ fprintf (stderr, "%.4x: inst = %.4x ", pc, inst);
+
+ pc += 2;
+
+ switch (inst >> 8)
+ {
+ case 0x00:
+ switch RS
+ {
+ case 0x0:
+ switch RD
+ {
+ case 0x0: /* bkpt */
+ cpu.asregs.exception = SIGTRAP;
+ break;
+
+ case 0x1: /* sync */
+ break;
+
+ case 0x2: /* rte */
+ pc = cpu.epc;
+ cpu.sr = cpu.esr;
+ needfetch = 1;
+
+ if (SR_AF())
+ cpu.asregs.active_gregs = & cpu.asregs.alt_gregs[0];
+ else
+ cpu.asregs.active_gregs = & cpu.asregs.gregs[0];
+ break;
+
+ case 0x3: /* rfi */
+ pc = cpu.fpc;
+ cpu.sr = cpu.fsr;
+ needfetch = 1;
+
+ if (SR_AF ())
+ cpu.asregs.active_gregs = &cpu.asregs.alt_gregs[0];
+ else
+ cpu.asregs.active_gregs = &cpu.asregs.gregs[0];
+ break;
+
+ case 0x4: /* stop */
+ if (issue_messages)
+ fprintf (stderr, "WARNING: stop unimplemented\n");
+ break;
+
+ case 0x5: /* wait */
+ if (issue_messages)
+ fprintf (stderr, "WARNING: wait unimplemented\n");
+ break;
+
+ case 0x6: /* doze */
+ if (issue_messages)
+ fprintf (stderr, "WARNING: oze unimplemented\n");
+ break;
+
+ case 0x7:
+ cpu.asregs.exception = SIGILL; /* illegal */
+ break;
+
+ case 0x8: /* trap 0 */
+ case 0xA: /* trap 2 */
+ case 0xB: /* trap 3 */
+ cpu.asregs.exception = SIGTRAP;
+ break;
+
+ case 0xC: /* trap 4 */
+ case 0xD: /* trap 5 */
+ case 0xE: /* trap 6 */
+ cpu.asregs.exception = SIGILL; /* illegal */
+ break;
+
+ case 0xF: /* trap 7 */
+ cpu.asregs.exception = SIGTRAP; /* integer div-by-0 */
+ break;
+
+ case 0x9: /* trap 1 */
+ handle_trap1 ();
+ break;
+ }
+ break;
+
+ case 0x1:
+ cpu.asregs.exception = SIGILL; /* illegal */
+ break;
+
+ case 0x2: /* mvc */
+ cpu.gr[RD] = C_VALUE();
+ break;
+ case 0x3: /* mvcv */
+ cpu.gr[RD] = C_OFF();
+ break;
+ case 0x4: /* ldq */
+ {
+ char *addr = (char *)cpu.gr[RD];
+ int regno = 4; /* always r4-r7 */
+
+ bonus_cycles++;
+ memops += 4;
+ do
+ {
+ cpu.gr[regno] = rlat(addr);
+ addr += 4;
+ regno++;
+ }
+ while ((regno&0x3) != 0);
+ }
+ break;
+ case 0x5: /* stq */
+ {
+ char *addr = (char *)cpu.gr[RD];
+ int regno = 4; /* always r4-r7 */
+
+ memops += 4;
+ bonus_cycles++;
+ do
+ {
+ wlat(addr, cpu.gr[regno]);
+ addr += 4;
+ regno++;
+ }
+ while ((regno & 0x3) != 0);
+ }
+ break;
+ case 0x6: /* ldm */
+ {
+ char *addr = (char *)cpu.gr[0];
+ int regno = RD;
+
+ /* bonus cycle is really only needed if
+ the next insn shifts the last reg loaded.
+
+ bonus_cycles++;
+ */
+ memops += 16-regno;
+ while (regno <= 0xF)
+ {
+ cpu.gr[regno] = rlat(addr);
+ addr += 4;
+ regno++;
+ }
+ }
+ break;
+ case 0x7: /* stm */
+ {
+ char *addr = (char *)cpu.gr[0];
+ int regno = RD;
+
+ /* this should be removed! */
+ /* bonus_cycles ++; */
+
+ memops += 16 - regno;
+ while (regno <= 0xF)
+ {
+ wlat(addr, cpu.gr[regno]);
+ addr += 4;
+ regno++;
+ }
+ }
+ break;
+
+ case 0x8: /* dect */
+ cpu.gr[RD] -= C_VALUE();
+ break;
+ case 0x9: /* decf */
+ cpu.gr[RD] -= C_OFF();
+ break;
+ case 0xA: /* inct */
+ cpu.gr[RD] += C_VALUE();
+ break;
+ case 0xB: /* incf */
+ cpu.gr[RD] += C_OFF();
+ break;
+ case 0xC: /* jmp */
+ pc = cpu.gr[RD];
+ bonus_cycles++;
+ needfetch = 1;
+ break;
+ case 0xD: /* jsr */
+ cpu.gr[15] = pc;
+ pc = cpu.gr[RD];
+ bonus_cycles++;
+ needfetch = 1;
+ break;
+ case 0xE: /* ff1 */
+ {
+ word tmp, i;
+ tmp = cpu.gr[RD];
+ for (i = 0; !(tmp & 0x80000000) && i < 32; i++)
+ tmp <<= 1;
+ cpu.gr[RD] = i;
+ }
+ break;
+ case 0xF: /* brev */
+ {
+ word tmp;
+ tmp = cpu.gr[RD];
+ tmp = ((tmp & 0xaaaaaaaa) >> 1) | ((tmp & 0x55555555) << 1);
+ tmp = ((tmp & 0xcccccccc) >> 2) | ((tmp & 0x33333333) << 2);
+ tmp = ((tmp & 0xf0f0f0f0) >> 4) | ((tmp & 0x0f0f0f0f) << 4);
+ tmp = ((tmp & 0xff00ff00) >> 8) | ((tmp & 0x00ff00ff) << 8);
+ cpu.gr[RD] = ((tmp & 0xffff0000) >> 16) | ((tmp & 0x0000ffff) << 16);
+ }
+ break;
+ }
+ break;
+ case 0x01:
+ switch RS
+ {
+ case 0x0: /* xtrb3 */
+ cpu.gr[1] = (cpu.gr[RD]) & 0xFF;
+ NEW_C (cpu.gr[RD] != 0);
+ break;
+ case 0x1: /* xtrb2 */
+ cpu.gr[1] = (cpu.gr[RD]>>8) & 0xFF;
+ NEW_C (cpu.gr[RD] != 0);
+ break;
+ case 0x2: /* xtrb1 */
+ cpu.gr[1] = (cpu.gr[RD]>>16) & 0xFF;
+ NEW_C (cpu.gr[RD] != 0);
+ break;
+ case 0x3: /* xtrb0 */
+ cpu.gr[1] = (cpu.gr[RD]>>24) & 0xFF;
+ NEW_C (cpu.gr[RD] != 0);
+ break;
+ case 0x4: /* zextb */
+ cpu.gr[RD] &= 0x000000FF;
+ break;
+ case 0x5: /* sextb */
+ {
+ long tmp;
+ tmp = cpu.gr[RD];
+ tmp <<= 24;
+ tmp >>= 24;
+ cpu.gr[RD] = tmp;
+ }
+ break;
+ case 0x6: /* zexth */
+ cpu.gr[RD] &= 0x0000FFFF;
+ break;
+ case 0x7: /* sexth */
+ {
+ long tmp;
+ tmp = cpu.gr[RD];
+ tmp <<= 16;
+ tmp >>= 16;
+ cpu.gr[RD] = tmp;
+ }
+ break;
+ case 0x8: /* declt */
+ --cpu.gr[RD];
+ NEW_C ((long)cpu.gr[RD] < 0);
+ break;
+ case 0x9: /* tstnbz */
+ {
+ word tmp = cpu.gr[RD];
+ NEW_C ((tmp & 0xFF000000) != 0 &&
+ (tmp & 0x00FF0000) != 0 && (tmp & 0x0000FF00) != 0 &&
+ (tmp & 0x000000FF) != 0);
+ }
+ break;
+ case 0xA: /* decgt */
+ --cpu.gr[RD];
+ NEW_C ((long)cpu.gr[RD] > 0);
+ break;
+ case 0xB: /* decne */
+ --cpu.gr[RD];
+ NEW_C ((long)cpu.gr[RD] != 0);
+ break;
+ case 0xC: /* clrt */
+ if (C_ON())
+ cpu.gr[RD] = 0;
+ break;
+ case 0xD: /* clrf */
+ if (C_OFF())
+ cpu.gr[RD] = 0;
+ break;
+ case 0xE: /* abs */
+ if (cpu.gr[RD] & 0x80000000)
+ cpu.gr[RD] = ~cpu.gr[RD] + 1;
+ break;
+ case 0xF: /* not */
+ cpu.gr[RD] = ~cpu.gr[RD];
+ break;
+ }
+ break;
+ case 0x02: /* movt */
+ if (C_ON())
+ cpu.gr[RD] = cpu.gr[RS];
+ break;
+ case 0x03: /* mult */
+ /* consume 2 bits per cycle from rs, until rs is 0 */
+ {
+ unsigned int t = cpu.gr[RS];
+ int ticks;
+ for (ticks = 0; t != 0 ; t >>= 2)
+ ticks++;
+ bonus_cycles += ticks;
+ }
+ bonus_cycles += 2; /* min. is 3, so add 2, plus ticks above */
+ cpu.gr[RD] = cpu.gr[RD] * cpu.gr[RS];
+ break;
+ case 0x04: /* loopt */
+ if (C_ON())
+ {
+ pc += (IMM4 << 1) - 32;
+ bonus_cycles ++;
+ needfetch = 1;
+ }
+ --cpu.gr[RS]; /* not RD! */
+ NEW_C (((long)cpu.gr[RS]) > 0);
+ break;
+ case 0x05: /* subu */
+ cpu.gr[RD] -= cpu.gr[RS];
+ break;
+ case 0x06: /* addc */
+ {
+ unsigned long tmp, a, b;
+ a = cpu.gr[RD];
+ b = cpu.gr[RS];
+ cpu.gr[RD] = a + b + C_VALUE ();
+ tmp = iu_carry (a, b, C_VALUE ());
+ NEW_C (tmp);
+ }
+ break;
+ case 0x07: /* subc */
+ {
+ unsigned long tmp, a, b;
+ a = cpu.gr[RD];
+ b = cpu.gr[RS];
+ cpu.gr[RD] = a - b + C_VALUE () - 1;
+ tmp = iu_carry (a,~b, C_VALUE ());
+ NEW_C (tmp);
+ }
+ break;
+ case 0x08: /* illegal */
+ case 0x09: /* illegal*/
+ cpu.asregs.exception = SIGILL;
+ break;
+ case 0x0A: /* movf */
+ if (C_OFF())
+ cpu.gr[RD] = cpu.gr[RS];
+ break;
+ case 0x0B: /* lsr */
+ {
+ unsigned long dst, src;
+ dst = cpu.gr[RD];
+ src = cpu.gr[RS];
+ dst = dst >> src;
+ cpu.gr[RD] = dst;
+ }
+ break;
+ case 0x0C: /* cmphs */
+ NEW_C ((unsigned long )cpu.gr[RD] >=
+ (unsigned long)cpu.gr[RS]);
+ break;
+ case 0x0D: /* cmplt */
+ NEW_C ((long)cpu.gr[RD] < (long)cpu.gr[RS]);
+ break;
+ case 0x0E: /* tst */
+ NEW_C ((cpu.gr[RD] & cpu.gr[RS]) != 0);
+ break;
+ case 0x0F: /* cmpne */
+ NEW_C (cpu.gr[RD] != cpu.gr[RS]);
+ break;
+ case 0x10: case 0x11: /* mfcr */
+ {
+ unsigned r;
+ r = IMM5;
+ if (r <= LAST_VALID_CREG)
+ cpu.gr[RD] = cpu.cr[r];
+ else
+ cpu.asregs.exception = SIGILL;
+ }
+ break;
+
+ case 0x12: /* mov */
+ cpu.gr[RD] = cpu.gr[RS];
+ break;
+
+ case 0x13: /* bgenr */
+ if (cpu.gr[RS] & 0x20)
+ cpu.gr[RD] = 0;
+ else
+ cpu.gr[RD] = 1 << (cpu.gr[RS] & 0x1F);
+ break;
+
+ case 0x14: /* rsub */
+ cpu.gr[RD] = cpu.gr[RS] - cpu.gr[RD];
+ break;
+
+ case 0x15: /* ixw */
+ cpu.gr[RD] += cpu.gr[RS]<<2;
+ break;
+
+ case 0x16: /* and */
+ cpu.gr[RD] &= cpu.gr[RS];
+ break;
+
+ case 0x17: /* xor */
+ cpu.gr[RD] ^= cpu.gr[RS];
+ break;
+
+ case 0x18: case 0x19: /* mtcr */
+ {
+ unsigned r;
+ r = IMM5;
+ if (r <= LAST_VALID_CREG)
+ cpu.cr[r] = cpu.gr[RD];
+ else
+ cpu.asregs.exception = SIGILL;
+
+ /* we might have changed register sets... */
+ if (SR_AF ())
+ cpu.asregs.active_gregs = & cpu.asregs.alt_gregs[0];
+ else
+ cpu.asregs.active_gregs = & cpu.asregs.gregs[0];
+ }
+ break;
+
+ case 0x1A: /* asr */
+ cpu.gr[RD] = (long)cpu.gr[RD] >> cpu.gr[RS];
+ break;
+
+ case 0x1B: /* lsl */
+ cpu.gr[RD] = cpu.gr[RD] << cpu.gr[RS];
+ break;
+
+ case 0x1C: /* addu */
+ cpu.gr[RD] += cpu.gr[RS];
+ break;
+
+ case 0x1D: /* ixh */
+ cpu.gr[RD] += cpu.gr[RS] << 1;
+ break;
+
+ case 0x1E: /* or */
+ cpu.gr[RD] |= cpu.gr[RS];
+ break;
+
+ case 0x1F: /* andn */
+ cpu.gr[RD] &= ~cpu.gr[RS];
+ break;
+ case 0x20: case 0x21: /* addi */
+ cpu.gr[RD] =
+ cpu.gr[RD] + (IMM5 + 1);
+ break;
+ case 0x22: case 0x23: /* cmplti */
+ {
+ int tmp = (IMM5 + 1);
+ if (cpu.gr[RD] < tmp)
+ {
+ SET_C();
+ }
+ else
+ {
+ CLR_C();
+ }
+ }
+ break;
+ case 0x24: case 0x25: /* subi */
+ cpu.gr[RD] =
+ cpu.gr[RD] - (IMM5 + 1);
+ break;
+ case 0x26: case 0x27: /* illegal */
+ cpu.asregs.exception = SIGILL;
+ break;
+ case 0x28: case 0x29: /* rsubi */
+ cpu.gr[RD] =
+ IMM5 - cpu.gr[RD];
+ break;
+ case 0x2A: case 0x2B: /* cmpnei */
+ if (cpu.gr[RD] != IMM5)
+ {
+ SET_C();
+ }
+ else
+ {
+ CLR_C();
+ }
+ break;
+
+ case 0x2C: case 0x2D: /* bmaski, divu */
+ {
+ unsigned imm = IMM5;
+
+ if (imm == 1)
+ {
+ int exe;
+ int rxnlz, r1nlz;
+ unsigned int rx, r1;
+
+ rx = cpu.gr[RD];
+ r1 = cpu.gr[1];
+ exe = 0;
+
+ /* unsigned divide */
+ cpu.gr[RD] = (word) ((unsigned int) cpu.gr[RD] / (unsigned int)cpu.gr[1] );
+
+ /* compute bonus_cycles for divu */
+ for (r1nlz = 0; ((r1 & 0x80000000) == 0) && (r1nlz < 32); r1nlz ++)
+ r1 = r1 << 1;
+
+ for (rxnlz = 0; ((rx & 0x80000000) == 0) && (rxnlz < 32); rxnlz ++)
+ rx = rx << 1;
+
+ if (r1nlz < rxnlz)
+ exe += 4;
+ else
+ exe += 5 + r1nlz - rxnlz;
+
+ if (exe >= (2 * memcycles - 1))
+ {
+ bonus_cycles += exe - (2 * memcycles) + 1;
+ }
+ }
+ else if (imm == 0 || imm >= 8)
+ {
+ /* bmaski */
+ if (imm == 0)
+ cpu.gr[RD] = -1;
+ else
+ cpu.gr[RD] = (1 << imm) - 1;
+ }
+ else
+ {
+ /* illegal */
+ cpu.asregs.exception = SIGILL;
+ }
+ }
+ break;
+ case 0x2E: case 0x2F: /* andi */
+ cpu.gr[RD] = cpu.gr[RD] & IMM5;
+ break;
+ case 0x30: case 0x31: /* bclri */
+ cpu.gr[RD] = cpu.gr[RD] & ~(1<<IMM5);
+ break;
+ case 0x32: case 0x33: /* bgeni, divs */
+ {
+ unsigned imm = IMM5;
+ if (imm == 1)
+ {
+ int exe,sc;
+ int rxnlz, r1nlz;
+ signed int rx, r1;
+
+ /* compute bonus_cycles for divu */
+ rx = cpu.gr[RD];
+ r1 = cpu.gr[1];
+ exe = 0;
+
+ if (((rx < 0) && (r1 > 0)) || ((rx >= 0) && (r1 < 0)))
+ sc = 1;
+ else
+ sc = 0;
+
+ rx = abs (rx);
+ r1 = abs (r1);
+
+ /* signed divide, general registers are of type int, so / op is OK */
+ cpu.gr[RD] = cpu.gr[RD] / cpu.gr[1];
+
+ for (r1nlz = 0; ((r1 & 0x80000000) == 0) && (r1nlz < 32) ; r1nlz ++ )
+ r1 = r1 << 1;
+
+ for (rxnlz = 0; ((rx & 0x80000000) == 0) && (rxnlz < 32) ; rxnlz ++ )
+ rx = rx << 1;
+
+ if (r1nlz < rxnlz)
+ exe += 5;
+ else
+ exe += 6 + r1nlz - rxnlz + sc;
+
+ if (exe >= (2 * memcycles - 1))
+ {
+ bonus_cycles += exe - (2 * memcycles) + 1;
+ }
+ }
+ else if (imm >= 7)
+ {
+ /* bgeni */
+ cpu.gr[RD] = (1 << IMM5);
+ }
+ else
+ {
+ /* illegal */
+ cpu.asregs.exception = SIGILL;
+ }
+ break;
+ }
+ case 0x34: case 0x35: /* bseti */
+ cpu.gr[RD] = cpu.gr[RD] | (1 << IMM5);
+ break;
+ case 0x36: case 0x37: /* btsti */
+ NEW_C (cpu.gr[RD] >> IMM5);
+ break;
+ case 0x38: case 0x39: /* xsr, rotli */
+ {
+ unsigned imm = IMM5;
+ unsigned long tmp = cpu.gr[RD];
+ if (imm == 0)
+ {
+ word cbit;
+ cbit = C_VALUE();
+ NEW_C (tmp);
+ cpu.gr[RD] = (cbit << 31) | (tmp >> 1);
+ }
+ else
+ cpu.gr[RD] = (tmp << imm) | (tmp >> (32 - imm));
+ }
+ break;
+ case 0x3A: case 0x3B: /* asrc, asri */
+ {
+ unsigned imm = IMM5;
+ long tmp = cpu.gr[RD];
+ if (imm == 0)
+ {
+ NEW_C (tmp);
+ cpu.gr[RD] = tmp >> 1;
+ }
+ else
+ cpu.gr[RD] = tmp >> imm;
+ }
+ break;
+ case 0x3C: case 0x3D: /* lslc, lsli */
+ {
+ unsigned imm = IMM5;
+ unsigned long tmp = cpu.gr[RD];
+ if (imm == 0)
+ {
+ NEW_C (tmp >> 31);
+ cpu.gr[RD] = tmp << 1;
+ }
+ else
+ cpu.gr[RD] = tmp << imm;
+ }
+ break;
+ case 0x3E: case 0x3F: /* lsrc, lsri */
+ {
+ unsigned imm = IMM5;
+ unsigned long tmp = cpu.gr[RD];
+ if (imm == 0)
+ {
+ NEW_C (tmp);
+ cpu.gr[RD] = tmp >> 1;
+ }
+ else
+ cpu.gr[RD] = tmp >> imm;
+ }
+ break;
+ case 0x40: case 0x41: case 0x42: case 0x43:
+ case 0x44: case 0x45: case 0x46: case 0x47:
+ case 0x48: case 0x49: case 0x4A: case 0x4B:
+ case 0x4C: case 0x4D: case 0x4E: case 0x4F:
+ cpu.asregs.exception = SIGILL;
+ break;
+ case 0x50:
+ util (inst & 0xFF);
+ break;
+ case 0x51: case 0x52: case 0x53:
+ case 0x54: case 0x55: case 0x56: case 0x57:
+ case 0x58: case 0x59: case 0x5A: case 0x5B:
+ case 0x5C: case 0x5D: case 0x5E: case 0x5F:
+ cpu.asregs.exception = SIGILL;
+ break;
+ case 0x60: case 0x61: case 0x62: case 0x63: /* movi */
+ case 0x64: case 0x65: case 0x66: case 0x67:
+ cpu.gr[RD] = (inst >> 4) & 0x7F;
+ break;
+ case 0x68: case 0x69: case 0x6A: case 0x6B:
+ case 0x6C: case 0x6D: case 0x6E: case 0x6F: /* illegal */
+ cpu.asregs.exception = SIGILL;
+ break;
+ case 0x71: case 0x72: case 0x73:
+ case 0x74: case 0x75: case 0x76: case 0x77:
+ case 0x78: case 0x79: case 0x7A: case 0x7B:
+ case 0x7C: case 0x7D: case 0x7E: /* lrw */
+ cpu.gr[RX] = rlat ((pc + ((inst & 0xFF) << 2)) & 0xFFFFFFFC);
+ if (tracing)
+ fprintf (stderr, "LRW of 0x%x from 0x%x to reg %d",
+ rlat ((pc + ((inst & 0xFF) << 2)) & 0xFFFFFFFC),
+ (pc + ((inst & 0xFF) << 2)) & 0xFFFFFFFC, RX);
+ memops++;
+ break;
+ case 0x7F: /* jsri */
+ cpu.gr[15] = pc;
+ case 0x70: /* jmpi */
+ pc = rlat ((pc + ((inst & 0xFF) << 2)) & 0xFFFFFFFC);
+ memops++;
+ bonus_cycles++;
+ needfetch = 1;
+ break;
+
+ case 0x80: case 0x81: case 0x82: case 0x83:
+ case 0x84: case 0x85: case 0x86: case 0x87:
+ case 0x88: case 0x89: case 0x8A: case 0x8B:
+ case 0x8C: case 0x8D: case 0x8E: case 0x8F: /* ld */
+ cpu.gr[RX] = rlat (cpu.gr[RD] + ((inst >> 2) & 0x003C));
+ if (tracing)
+ fprintf (stderr, "load reg %d from 0x%x with 0x%x",
+ RX,
+ cpu.gr[RD] + ((inst >> 2) & 0x003C), cpu.gr[RX]);
+ memops++;
+ break;
+ case 0x90: case 0x91: case 0x92: case 0x93:
+ case 0x94: case 0x95: case 0x96: case 0x97:
+ case 0x98: case 0x99: case 0x9A: case 0x9B:
+ case 0x9C: case 0x9D: case 0x9E: case 0x9F: /* st */
+ wlat (cpu.gr[RD] + ((inst >> 2) & 0x003C), cpu.gr[RX]);
+ if (tracing)
+ fprintf (stderr, "store reg %d (containing 0x%x) to 0x%x",
+ RX, cpu.gr[RX],
+ cpu.gr[RD] + ((inst >> 2) & 0x003C));
+ memops++;
+ break;
+ case 0xA0: case 0xA1: case 0xA2: case 0xA3:
+ case 0xA4: case 0xA5: case 0xA6: case 0xA7:
+ case 0xA8: case 0xA9: case 0xAA: case 0xAB:
+ case 0xAC: case 0xAD: case 0xAE: case 0xAF: /* ld.b */
+ cpu.gr[RX] = rbat (cpu.gr[RD] + RS);
+ memops++;
+ break;
+ case 0xB0: case 0xB1: case 0xB2: case 0xB3:
+ case 0xB4: case 0xB5: case 0xB6: case 0xB7:
+ case 0xB8: case 0xB9: case 0xBA: case 0xBB:
+ case 0xBC: case 0xBD: case 0xBE: case 0xBF: /* st.b */
+ wbat (cpu.gr[RD] + RS, cpu.gr[RX]);
+ memops++;
+ break;
+ case 0xC0: case 0xC1: case 0xC2: case 0xC3:
+ case 0xC4: case 0xC5: case 0xC6: case 0xC7:
+ case 0xC8: case 0xC9: case 0xCA: case 0xCB:
+ case 0xCC: case 0xCD: case 0xCE: case 0xCF: /* ld.h */
+ cpu.gr[RX] = rhat (cpu.gr[RD] + ((inst >> 3) & 0x001E));
+ memops++;
+ break;
+ case 0xD0: case 0xD1: case 0xD2: case 0xD3:
+ case 0xD4: case 0xD5: case 0xD6: case 0xD7:
+ case 0xD8: case 0xD9: case 0xDA: case 0xDB:
+ case 0xDC: case 0xDD: case 0xDE: case 0xDF: /* st.h */
+ what (cpu.gr[RD] + ((inst >> 3) & 0x001E), cpu.gr[RX]);
+ memops++;
+ break;
+ case 0xE8: case 0xE9: case 0xEA: case 0xEB:
+ case 0xEC: case 0xED: case 0xEE: case 0xEF: /* bf */
+ if (C_OFF())
+ {
+ int disp;
+ disp = inst & 0x03FF;
+ if (inst & 0x0400)
+ disp |= 0xFFFFFC00;
+ pc += disp<<1;
+ bonus_cycles++;
+ needfetch = 1;
+ }
+ break;
+ case 0xE0: case 0xE1: case 0xE2: case 0xE3:
+ case 0xE4: case 0xE5: case 0xE6: case 0xE7: /* bt */
+ if (C_ON())
+ {
+ int disp;
+ disp = inst & 0x03FF;
+ if (inst & 0x0400)
+ disp |= 0xFFFFFC00;
+ pc += disp<<1;
+ bonus_cycles++;
+ needfetch = 1;
+ }
+ break;
+
+ case 0xF8: case 0xF9: case 0xFA: case 0xFB:
+ case 0xFC: case 0xFD: case 0xFE: case 0xFF: /* bsr */
+ cpu.gr[15] = pc;
+ case 0xF0: case 0xF1: case 0xF2: case 0xF3:
+ case 0xF4: case 0xF5: case 0xF6: case 0xF7: /* br */
+ {
+ int disp;
+ disp = inst & 0x03FF;
+ if (inst & 0x0400)
+ disp |= 0xFFFFFC00;
+ pc += disp<<1;
+ bonus_cycles++;
+ needfetch = 1;
+ }
+ break;
+
+ }
+
+ if (tracing)
+ fprintf (stderr, "\n");
+
+ if (needfetch)
+ {
+ /* Do not let him fetch from a bad address! */
+ if (((uword)pc) >= cpu.asregs.msize)
+ {
+ if (issue_messages)
+ fprintf (stderr, "PC outside of available memory! (%x)\n", pc);
+
+ cpu.asregs.exception = SIGSEGV;
+ }
+ else
+ {
+ ibuf = rlat (pc & 0xFFFFFFFC);
+ needfetch = 0;
+ }
+ }
+ }
+ while (!cpu.asregs.exception);
+
+ /* Hide away the things we've cached while executing. */
+ cpu.asregs.pc = pc;
+ cpu.asregs.insts += insts; /* instructions done ... */
+ cpu.asregs.cycles += insts; /* and each takes a cycle */
+ cpu.asregs.cycles += bonus_cycles; /* and extra cycles for branches */
+ cpu.asregs.cycles += memops * memcycles; /* and memop cycle delays */
+
+ signal (SIGINT, sigsave);
+}
+
+
+int
+sim_write (sd, addr, buffer, size)
+ SIM_DESC sd;
+ SIM_ADDR addr;
+ unsigned char * buffer;
+ int size;
+{
+ int i;
+ init_pointers ();
+
+ memcpy (& cpu.mem[addr], buffer, size);
+
+ return size;
+}
+
+int
+sim_read (sd, addr, buffer, size)
+ SIM_DESC sd;
+ SIM_ADDR addr;
+ unsigned char * buffer;
+ int size;
+{
+ int i;
+ init_pointers ();
+
+ memcpy (buffer, & cpu.mem[addr], size);
+
+ return size;
+}
+
+
+int
+sim_store_register (sd, rn, memory, length)
+ SIM_DESC sd;
+ int rn;
+ unsigned char * memory;
+ int length;
+{
+ init_pointers ();
+
+ if (rn < NUM_MCORE_REGS && rn >= 0)
+ {
+ if (length == 4)
+ {
+ /* ival is in 'target' order, which we know to be big-endian.
+ Let's convert it to natural order. */
+ long ival;
+
+ ival = mcore_extract_unsigned_integer (memory, 4);/* misalignment safe */
+ cpu.asints[rn] = ival;
+ }
+
+ return 4;
+ }
+ else
+ return 0;
+}
+
+int
+sim_fetch_register (sd, rn, memory, length)
+ SIM_DESC sd;
+ int rn;
+ unsigned char * memory;
+ int length;
+{
+ init_pointers ();
+
+ if (rn < NUM_MCORE_REGS && rn >= 0)
+ {
+ if (length == 4)
+ {
+ /* caller expects 'target order', which is big-endian. Convert
+ * the native order we used [to speed up simulation] to the
+ * byte order expected by the caller. */
+ long ival = cpu.asints[rn];
+ mcore_store_unsigned_integer (memory, 4, ival);/* misalignment-safe */
+ }
+
+ return 4;
+ }
+ else
+ return 0;
+}
+
+
+int
+sim_trace (sd)
+ SIM_DESC sd;
+{
+ tracing = 1;
+
+ sim_resume (sd, 0, 0);
+
+ tracing = 0;
+
+ return 1;
+}
+
+void
+sim_stop_reason (sd, reason, sigrc)
+ SIM_DESC sd;
+ enum sim_stop * reason;
+ int * sigrc;
+{
+ if (cpu.asregs.exception == SIGQUIT)
+ {
+ * reason = sim_exited;
+ * sigrc = cpu.gr[PARM1];
+ }
+ else
+ {
+ * reason = sim_stopped;
+ * sigrc = cpu.asregs.exception;
+ }
+}
+
+
+int
+sim_stop (sd)
+ SIM_DESC sd;
+{
+ cpu.asregs.exception = SIGINT;
+ return 1;
+}
+
+
+void
+sim_info (sd, verbose)
+ SIM_DESC sd;
+ int verbose;
+{
+#ifdef WATCHFUNCTIONS
+ int w, wcyc;
+#endif
+ double virttime = cpu.asregs.cycles / 36.0e6;
+
+ callback->printf_filtered (callback, "\n\n# instructions executed %10d\n", cpu.asregs.insts);
+ callback->printf_filtered (callback, "# cycles %10d\n", cpu.asregs.cycles);
+ callback->printf_filtered (callback, "# pipeline stalls %10d\n", cpu.asregs.stalls);
+ callback->printf_filtered (callback, "# virtual time taken %10.4f\n", virttime);
+
+#ifdef WATCHFUNCTIONS
+ callback->printf_filtered (callback, "\nNumber of watched functions: %d\n",ENDWL);
+
+ wcyc = 0;
+
+ for (w = 1; w <= ENDWL; w++)
+ {
+ callback->printf_filtered (callback, "WL = %s %8x\n",WLstr[w],WL[w]);
+ callback->printf_filtered (callback, " calls = %d, cycles = %d\n", WLcnts[w],WLcyc[w]);
+
+ if (WLcnts[w] != 0)
+ callback->printf_filtered (callback, " maxcpc = %d, mincpc = %d, avecpc = %d\n",WLmax[w],WLmin[w],WLcyc[w]/WLcnts[w]);
+ wcyc += WLcyc[w];
+ }
+
+ callback->printf_filtered (callback, "Total cycles for watched functions: %d\n",wcyc);
+#endif
+}
+
+struct aout
+{
+ unsigned char sa_machtype[2];
+ unsigned char sa_magic[2];
+ unsigned char sa_tsize[4];
+ unsigned char sa_dsize[4];
+ unsigned char sa_bsize[4];
+ unsigned char sa_syms[4];
+ unsigned char sa_entry[4];
+ unsigned char sa_trelo[4];
+ unsigned char sa_drelo[4];
+} aout;
+
+#define LONG(x) (((x)[0]<<24)|((x)[1]<<16)|((x)[2]<<8)|(x)[3])
+#define SHORT(x) (((x)[0]<<8)|(x)[1])
+
+SIM_DESC
+sim_open (kind, cb, abfd, argv)
+ SIM_OPEN_KIND kind;
+ host_callback * cb;
+ struct _bfd * abfd;
+ char ** argv;
+{
+ int osize = sim_memory_size;
+ myname = argv[0];
+ callback = cb;
+
+ if (kind == SIM_OPEN_STANDALONE)
+ issue_messages = 1;
+
+ /* Discard and reacquire memory -- start with a clean slate. */
+ sim_size (1); /* small */
+ sim_size (osize); /* and back again */
+
+ set_initial_gprs (); /* Reset the GPR registers. */
+
+ /* Fudge our descriptor for now. */
+ return (SIM_DESC) 1;
+}
+
+void
+sim_close (sd, quitting)
+ SIM_DESC sd;
+ int quitting;
+{
+ /* nothing to do */
+}
+
+SIM_RC
+sim_load (sd, prog, abfd, from_tty)
+ SIM_DESC sd;
+ char * prog;
+ bfd * abfd;
+ int from_tty;
+{
+ /* Do the right thing for ELF executables; this turns out to be
+ just about the right thing for any object format that:
+ - we crack using BFD routines
+ - follows the traditional UNIX text/data/bss layout
+ - calls the bss section ".bss". */
+
+ extern bfd * sim_load_file (); /* ??? Don't know where this should live. */
+ bfd * prog_bfd;
+
+ {
+ bfd * handle;
+ asection * s_bss;
+ handle = bfd_openr (prog, 0); /* could be "mcore" */
+
+ if (!handle)
+ {
+ printf("``%s'' could not be opened.\n", prog);
+ return SIM_RC_FAIL;
+ }
+
+ /* Makes sure that we have an object file, also cleans gets the
+ section headers in place. */
+ if (!bfd_check_format (handle, bfd_object))
+ {
+ /* wasn't an object file */
+ bfd_close (handle);
+ printf ("``%s'' is not appropriate object file.\n", prog);
+ return SIM_RC_FAIL;
+ }
+
+ /* Look for that bss section. */
+ s_bss = bfd_get_section_by_name (handle, ".bss");
+
+ if (!s_bss)
+ {
+ printf("``%s'' has no bss section.\n", prog);
+ return SIM_RC_FAIL;
+ }
+
+ /* Appropriately paranoid would check that we have
+ a traditional text/data/bss ordering within memory. */
+
+ /* figure the end of the bss section */
+#if 0
+ printf ("bss section at 0x%08x for 0x%08x bytes\n",
+ (unsigned long) s_bss->vma , (unsigned long) s_bss->_cooked_size);
+#endif
+ heap_ptr = (unsigned long) s_bss->vma + (unsigned long) s_bss->_cooked_size;
+
+ /* Clean up after ourselves. */
+ bfd_close (handle);
+
+ /* XXX: do we need to free the s_bss and handle structures? */
+ }
+
+ /* from sh -- dac */
+ prog_bfd = sim_load_file (sd, myname, callback, prog, abfd,
+ sim_kind == SIM_OPEN_DEBUG,
+ 0, sim_write);
+ if (prog_bfd == NULL)
+ return SIM_RC_FAIL;
+
+ if (abfd == NULL)
+ bfd_close (prog_bfd);
+
+ return SIM_RC_OK;
+}
+
+SIM_RC
+sim_create_inferior (sd, prog_bfd, argv, env)
+ SIM_DESC sd;
+ struct _bfd * prog_bfd;
+ char ** argv;
+ char ** env;
+{
+ char ** avp;
+ int nargs = 0;
+ int nenv = 0;
+ int s_length;
+ int l;
+ unsigned long strings;
+ unsigned long pointers;
+ unsigned long hi_stack;
+
+
+ /* Set the initial register set. */
+ l = issue_messages;
+ issue_messages = 0;
+ set_initial_gprs ();
+ issue_messages = l;
+
+ hi_stack = cpu.asregs.msize - 4;
+ cpu.asregs.pc = bfd_get_start_address (prog_bfd);
+
+ /* Calculate the argument and environment strings. */
+ s_length = 0;
+ nargs = 0;
+ avp = argv;
+ while (avp && *avp)
+ {
+ l = strlen (*avp) + 1; /* include the null */
+ s_length += (l + 3) & ~3; /* make it a 4 byte boundary */
+ nargs++; avp++;
+ }
+
+ nenv = 0;
+ avp = env;
+ while (avp && *avp)
+ {
+ l = strlen (*avp) + 1; /* include the null */
+ s_length += (l + 3) & ~ 3;/* make it a 4 byte boundary */
+ nenv++; avp++;
+ }
+
+ /* Claim some memory for the pointers and strings. */
+ pointers = hi_stack - sizeof(word) * (nenv+1+nargs+1);
+ pointers &= ~3; /* must be 4-byte aligned */
+ cpu.gr[0] = pointers;
+
+ strings = cpu.gr[0] - s_length;
+ strings &= ~3; /* want to make it 4-byte aligned */
+ cpu.gr[0] = strings;
+ /* dac fix, the stack address must be 8-byte aligned! */
+ cpu.gr[0] = cpu.gr[0] - cpu.gr[0] % 8;
+
+ /* Loop through the arguments and fill them in. */
+ cpu.gr[PARM1] = nargs;
+ if (nargs == 0)
+ {
+ /* No strings to fill in. */
+ cpu.gr[PARM2] = 0;
+ }
+ else
+ {
+ cpu.gr[PARM2] = pointers;
+ avp = argv;
+ while (avp && *avp)
+ {
+ /* Save where we're putting it. */
+ wlat (pointers, strings);
+
+ /* Copy the string. */
+ l = strlen (* avp) + 1;
+ strcpy ((char *)(cpu.mem + strings), *avp);
+
+ /* Bump the pointers. */
+ avp++;
+ pointers += 4;
+ strings += l+1;
+ }
+
+ /* A null to finish the list. */
+ wlat (pointers, 0);
+ pointers += 4;
+ }
+
+ /* Now do the environment pointers. */
+ if (nenv == 0)
+ {
+ /* No strings to fill in. */
+ cpu.gr[PARM3] = 0;
+ }
+ else
+ {
+ cpu.gr[PARM3] = pointers;
+ avp = env;
+
+ while (avp && *avp)
+ {
+ /* Save where we're putting it. */
+ wlat (pointers, strings);
+
+ /* Copy the string. */
+ l = strlen (* avp) + 1;
+ strcpy ((char *)(cpu.mem + strings), *avp);
+
+ /* Bump the pointers. */
+ avp++;
+ pointers += 4;
+ strings += l+1;
+ }
+
+ /* A null to finish the list. */
+ wlat (pointers, 0);
+ pointers += 4;
+ }
+
+ return SIM_RC_OK;
+}
+
+void
+sim_kill (sd)
+ SIM_DESC sd;
+{
+ /* nothing to do */
+}
+
+void
+sim_do_command (sd, cmd)
+ SIM_DESC sd;
+ char * cmd;
+{
+ /* Nothing there yet; it's all an error. */
+
+ if (cmd != NULL)
+ {
+ char ** simargv = buildargv (cmd);
+
+ if (strcmp (simargv[0], "watch") == 0)
+ {
+ if ((simargv[1] == NULL) || (simargv[2] == NULL))
+ {
+ fprintf (stderr, "Error: missing argument to watch cmd.\n");
+ return;
+ }
+
+ ENDWL++;
+
+ WL[ENDWL] = strtol (simargv[2], NULL, 0);
+ WLstr[ENDWL] = strdup (simargv[1]);
+ fprintf (stderr, "Added %s (%x) to watchlist, #%d\n",WLstr[ENDWL],
+ WL[ENDWL], ENDWL);
+
+ }
+ else if (strcmp (simargv[0], "dumpmem") == 0)
+ {
+ unsigned char * p;
+ FILE * dumpfile;
+
+ if (simargv[1] == NULL)
+ fprintf (stderr, "Error: missing argument to dumpmem cmd.\n");
+
+ fprintf (stderr, "Writing dumpfile %s...",simargv[1]);
+
+ dumpfile = fopen (simargv[1], "w");
+ p = cpu.mem;
+ fwrite (p, cpu.asregs.msize-1, 1, dumpfile);
+ fclose (dumpfile);
+
+ fprintf (stderr, "done.\n");
+ }
+ else if (strcmp (simargv[0], "clearstats") == 0)
+ {
+ cpu.asregs.cycles = 0;
+ cpu.asregs.insts = 0;
+ cpu.asregs.stalls = 0;
+ ENDWL = 0;
+ }
+ else if (strcmp (simargv[0], "verbose") == 0)
+ {
+ issue_messages = 1;
+ }
+ else
+ {
+ fprintf (stderr,"Error: \"%s\" is not a valid M.CORE simulator command.\n",
+ cmd);
+ }
+ }
+ else
+ {
+ fprintf (stderr, "M.CORE sim commands: \n");
+ fprintf (stderr, " watch <funcname> <addr>\n");
+ fprintf (stderr, " dumpmem <filename>\n");
+ fprintf (stderr, " clearstats\n");
+ fprintf (stderr, " verbose\n");
+ }
+}
+
+void
+sim_set_callbacks (ptr)
+ host_callback * ptr;
+{
+ callback = ptr;
+}
diff --git a/sim/mcore/sysdep.h b/sim/mcore/sysdep.h
new file mode 100644
index 00000000000..adf9b5e277f
--- /dev/null
+++ b/sim/mcore/sysdep.h
@@ -0,0 +1,91 @@
+/* System includes and definitions used by the Motorolla MCore simulator.
+ Copyright (C) 1999 Free Software Foundation, Inc.
+ Contributed by Cygnus Solutions.
+
+This file is part of GDB, the GNU debugger.
+
+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, write to the Free Software Foundation, Inc.,
+59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifndef __SYSDEP_H
+#define __SYSDEP_H
+
+#ifndef hosts_std_host_H
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <ctype.h>
+#include <string.h>
+#include <sys/file.h>
+#include "ansidecl.h"
+
+#ifndef O_ACCMODE
+#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
+#endif
+#ifndef SEEK_SET
+#define SEEK_SET 0
+#endif
+#ifndef SEEK_CUR
+#define SEEK_CUR 1
+#endif
+#ifdef STDC_HEADERS
+#include <stdlib.h>
+/*#include <string.h>*/
+#else
+extern char * mktemp ();
+extern PTR memset ();
+
+#ifndef DONTDECLARE_MALLOC
+extern PTR malloc ();
+extern PTR realloc ();
+#endif
+
+#ifndef __GNUC__
+extern PTR memcpy ();
+#else
+/* char * memcpy (); */
+#endif
+
+#ifdef __STDC__
+extern void free ();
+#else
+extern int free();
+#endif
+
+extern char * strchr();
+extern char * getenv();
+extern PTR memchr();
+extern char * strrchr();
+
+extern char * strrchr();
+extern char * ctime();
+extern long atol();
+extern char * getenv();
+#endif /* STDC_HEADERS */
+
+#ifndef BYTES_IN_PRINTF_INT
+#define BYTES_IN_PRINTF_INT 4
+#endif
+
+#include "fopen-same.h"
+#define hosts_std_host_H
+#endif
+
+#ifdef STDC_HEADERS
+#include <stddef.h>
+#endif /* STDC_HEADERS */
+
+#endif /* __SYSDEP_H */