aboutsummaryrefslogtreecommitdiff
path: root/sim/sh
diff options
context:
space:
mode:
authorStan Shebs <shebs@codesourcery.com>1999-04-16 01:35:26 +0000
committerStan Shebs <shebs@codesourcery.com>1999-04-16 01:35:26 +0000
commitc906108c21474dfb4ed285bcc0ac6fe02cd400cc (patch)
treea0015aa5cedc19ccbab307251353a41722a3ae13 /sim/sh
parentcd946cff9ede3f30935803403f06f6ed30cad136 (diff)
downloadgdb-c906108c21474dfb4ed285bcc0ac6fe02cd400cc.zip
gdb-c906108c21474dfb4ed285bcc0ac6fe02cd400cc.tar.gz
gdb-c906108c21474dfb4ed285bcc0ac6fe02cd400cc.tar.bz2
Initial creation of sourceware repositorygdb-4_18-branchpoint
Diffstat (limited to 'sim/sh')
-rw-r--r--sim/sh/ChangeLog736
-rw-r--r--sim/sh/Makefile.in41
-rw-r--r--sim/sh/acconfig.h15
-rw-r--r--sim/sh/config.in158
-rwxr-xr-xsim/sh/configure3892
-rw-r--r--sim/sh/configure.in10
-rw-r--r--sim/sh/gencode.c1755
-rw-r--r--sim/sh/interp.c1414
-rw-r--r--sim/sh/syscall.h33
-rw-r--r--sim/sh/tconfig.in17
10 files changed, 8071 insertions, 0 deletions
diff --git a/sim/sh/ChangeLog b/sim/sh/ChangeLog
new file mode 100644
index 0000000..1939d18
--- /dev/null
+++ b/sim/sh/ChangeLog
@@ -0,0 +1,736 @@
+Thu Sep 10 02:16:39 1997 J"orn Rennecke <amylaar@cygnus.co.uk>
+
+ * interp.c (saved_state.asregs): Add new member pad_dummy.
+ (sim_store_register, sim_fetch_regsiter): Add 1 to rn for use
+ as index into saved_state.asints.
+
+Mon Jun 29 19:35:24 1998 Jason Molenda (crash@bugshack.cygnus.com)
+
+ * interp.c (sim_open): set endianness based on the ABFD if a -E
+ option is not present and we have an ABFD.
+
+Tue Apr 28 18:33:31 1998 Geoffrey Noer <noer@cygnus.com>
+
+ * configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Sun Apr 26 15:31:55 1998 Tom Tromey <tromey@creche>
+
+ * configure: Regenerated to track ../common/aclocal.m4 changes.
+ * config.in: Ditto.
+
+Sun Apr 26 15:19:48 1998 Tom Tromey <tromey@cygnus.com>
+
+ * acconfig.h: New file.
+ * configure.in: Reverted change of Apr 24; use sinclude again.
+
+Fri Apr 24 14:16:40 1998 Tom Tromey <tromey@creche>
+
+ * configure: Regenerated to track ../common/aclocal.m4 changes.
+ * config.in: Ditto.
+
+Fri Apr 24 11:18:35 1998 Tom Tromey <tromey@cygnus.com>
+
+ * configure.in: Don't call sinclude.
+
+Sat Apr 4 20:36:25 1998 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Fri Mar 27 16:15:52 1998 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Wed Mar 25 12:35:29 1998 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Wed Mar 18 12:38:12 1998 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Tue Feb 17 12:49:44 1998 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * interp.c (sim_fetch_register, sim_store_register): Pass in
+ length parameter. Return -1.
+
+Sun Feb 1 16:47:51 1998 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Sat Jan 31 18:15:41 1998 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Mon Jan 19 22:26:29 1998 Doug Evans <devans@seba>
+
+ * configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Mon Dec 15 23:17:11 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * configure: Regenerated to track ../common/aclocal.m4 changes.
+ * config.in: Ditto.
+
+Thu Dec 4 09:21:05 1997 Doug Evans <devans@canuck.cygnus.com>
+
+ * configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Wed Oct 22 14:43:00 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * interp.c (sim_load): Pass lma_p and sim_write args to
+ sim_load_file.
+
+Fri Oct 3 09:28:00 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Wed Sep 24 17:38:57 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Tue Sep 23 11:04:38 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Mon Sep 22 11:46:20 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Fri Sep 19 17:45:25 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Mon Sep 15 17:36:15 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Tue Sep 9 20:52:21 1997 Felix Lee <flee@cygnus.com>
+
+ * interp.c (sim_resume): poll_quit() at least once per call;
+ otherwise gdb can loop sim_resume() uninterruptably.
+
+Thu Sep 4 17:21:23 1997 Doug Evans <dje@seba>
+
+ * configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Tue Sep 2 13:15:27 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * gencode.c (tab): Order instructions according to SH3 document.
+
+Wed Aug 27 18:13:22 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * configure: Regenerated to track ../common/aclocal.m4 changes.
+ * config.in: Ditto.
+
+Tue Aug 26 10:41:55 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * interp.c (sim_kill): Delete.
+ (sim_create_inferior): Add ABFD argument.
+ (sim_load): Move setting of PC from here.
+ (sim_create_inferior): To here.
+
+Mon Aug 25 17:50:22 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * configure: Regenerated to track ../common/aclocal.m4 changes.
+ * config.in: Ditto.
+
+Mon Aug 25 16:17:51 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * interp.c (sim_open): Add ABFD argument.
+
+Mon Jun 23 15:49:14 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * interp.c (get_dr): Avoid SIGFPE by moving integers instead of
+ FP's around.
+ (set_dr): Ditto.
+
+Sun Jun 22 19:33:33 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * interp.c (set_fpscr1): From J"orn Rennecke
+ <amylaar@cygnus.co.uk>, Fix typo. Ditto for comment.
+
+Thu Jun 19 00:28:08 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * interp.c (sim_create_inferior): Clear registers each time an
+ inferior is started.
+
+Sun Jun 15 15:22:52 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * gencode.c (main): Perform basic checks on tab entries.
+
+ * Makefile.in (gencode): Always compile with -g.
+
+Sat Jun 14 13:45:09 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * gencode.c (gensim): Move ref checking code to before `stuff'.
+ For branches with delay slots refs were not being checked.
+
+ * interp.c (sim_resume): Use nia to specify the next instruction
+ address instead of overloading pc.
+ (C): Delete definiton - refer to cycles directly.
+ (SEXT12): New macro - sign extend a 12 bit quantity.
+ (Delay_Slot): Rename from SL.
+
+ * gencode.c (tab): Update/simplify.
+
+ * gencode.c (gensim): Better formatting of output code.
+ (gensim): Replace 10 with constant MAX_NR_STUFF- define as 15.
+ (tab): Sort alphabetically. Break `stuff' into multiple lines.
+
+Fri Jun 13 22:10:13 1997 J"orn Rennecke <amylaar@cygnus.co.uk>
+
+ * gencode.c (braf, bsrf): Fix branch destination calculation to
+ be in accordance with the documentation.
+
+Fri Jun 13 15:33:53 1997 J"orn Rennecke <amylaar@cygnus.co.uk>
+
+ * interp.c (init_pointers): Fix little endian test.
+
+Wed May 28 23:42:35 1997 J"orn Rennecke <amylaar@cygnus.co.uk>
+
+ * gencode.c (swap.b): Fix treatment of high word.
+
+Tue May 20 10:23:28 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * interp.c (sim_open): Add callback argument.
+ (sim_set_callbacks): Delete SIM_DESC argument.
+
+Wed Apr 30 11:38:08 1997 Doug Evans <dje@canuck.cygnus.com>
+
+ * Makefile.in (SIM_EXTRA_CLEAN): Define.
+ (clean targets): Delete.
+ (sh-clean): New target.
+
+Thu Apr 24 00:39:51 1997 Doug Evans <dje@canuck.cygnus.com>
+
+ * configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Wed Apr 23 17:55:22 1997 Doug Evans <dje@canuck.cygnus.com>
+
+ * tconfig.in: New file.
+ * interp.c (sim_open): Handle missing arg to -E.
+
+Tue Apr 22 08:55:35 1997 Stu Grossman (grossman@critters.cygnus.com)
+
+ * Makefile.in: Add clean targets.
+
+Fri Apr 18 18:57:04 1997 Stu Grossman (grossman@critters.cygnus.com)
+
+ * interp.c: Include float.h and define SIGTRAP if _WIN32.
+ WIN32 -> _WIN32.
+ * (trap): Do do SYS_chown for _WIN32.
+
+Fri Apr 18 13:33:09 1997 Doug Evans <dje@canuck.cygnus.com>
+
+ * interp.c (sim_resume): Fix argument to poll_quit.
+
+Fri Apr 18 14:14:49 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * interp.c (sim_stop): New function.
+ (sim_resume): Use poll_quit for polling.
+
+Thu Apr 17 03:32:04 1997 Doug Evans <dje@canuck.cygnus.com>
+
+ * Makefile.in (SIM_OBJS): Add sim-load.o.
+ * interp.c (target_byte_order): Delete.
+ (sim_kind, myname, little_endian_p): New static locals.
+ (init_pointers): Use little_endian_p instead of target_byte_order.
+ (sim_resume): Likewise.
+ (sim_open): Set sim_kind, myname. Set little_endian_p from -E arg.
+ (sim_load): Return SIM_RC. New arg abfd. Call sim_load_file to
+ load file into simulator. Set start address from bfd.
+ (sim_create_inferior): Return SIM_RC. Delete arg start_address.
+
+Mon Apr 7 15:45:02 1997 Andrew Cagney <cagney@kremvax.cygnus.com>
+
+ * configure: Regenerated to track ../common/aclocal.m4 changes.
+ * config.in: Ditto.
+
+Wed Apr 2 15:06:28 1997 Doug Evans <dje@canuck.cygnus.com>
+
+ * interp.c (sim_open): New arg `kind'.
+
+ * configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Wed Apr 2 14:34:19 1997 Andrew Cagney <cagney@kremvax.cygnus.com>
+
+ * configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Wed Mar 19 09:34:36 1997 Fred Fish <fnf@cygnus.com>
+
+ * interp.c (sim_do_command): Check for NULL command or empty
+ string and handle it the same as a "help" command. Use callback
+ to print error message for unrecognized commands. Replace
+ hardcoded tab in literal string with a \t. Other minor code
+ cleanup.
+
+Wed Mar 19 01:14:00 1997 Andrew Cagney <cagney@kremvax.cygnus.com>
+
+ * configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Mon Mar 17 15:10:07 1997 Andrew Cagney <cagney@kremvax.cygnus.com>
+
+ * configure: Re-generate.
+
+Fri Mar 14 10:34:11 1997 Michael Meissner <meissner@cygnus.com>
+
+ * configure: Regenerate to track ../common/aclocal.m4 changes.
+
+Thu Mar 13 13:00:00 1997 Doug Evans <dje@canuck.cygnus.com>
+
+ * interp.c (sim_open): New SIM_DESC result. Argument is now
+ in argv form.
+ (other sim_*): New SIM_DESC argument.
+
+Tue Feb 4 13:33:30 1997 Doug Evans <dje@canuck.cygnus.com>
+
+ * Makefile.in (@COMMON_MAKEFILE_FRAG): Use
+ COMMON_{PRE,POST}_CONFIG_FRAG instead.
+ * configure.in: sinclude ../common/aclocal.m4.
+ * configure: Regenerated.
+
+Thu Jan 23 11:46:23 1997 Stu Grossman (grossman@critters.cygnus.com)
+
+ * configure configure.in Makefile.in: Update to new configure
+ scheme which is more compatible with WinGDB builds.
+ * configure.in: Improve comment on how to run autoconf.
+ * configure: Re-run autoconf to get new ../common/aclocal.m4.
+ * Makefile.in: Use autoconf substitution to install common
+ makefile fragment.
+
+Wed Nov 20 02:04:32 1996 Doug Evans <dje@canuck.cygnus.com>
+
+ * Makefile.in: Delete stuff moved to ../common/Make-common.in.
+ (SIM_OBJS,SIM_EXTRA_LIBS): Define.
+ * configure.in: Simplify using macros in ../common/aclocal.m4.
+ Call AC_CHECK_HEADERS(unistd.h).
+ * configure: Regenerated.
+ * config.in: New file.
+ * interp.c: #include "config.h". #include <unistd.h> if present.
+ (trap): Fetch errno value with callback->get_errno.
+
+Tue Nov 12 13:34:00 1996 Dawn Perchik <dawn@cygnus.com>
+
+ * interp.c: Don't include windows polling code if inside simluator.
+
+Fri Sep 20 14:57:50 1996 Stan Shebs <shebs@andros.cygnus.com>
+
+ * interp.c: Minor formatting improvements.
+ (saved_state_type): Add bank registers.
+ (bp_holder): New function, use to break on when debugging BUSERROR.
+ (BUSERROR): Call it if bus error occurs.
+
+Wed Jun 26 12:29:22 1996 Jason Molenda (crash@godzilla.cygnus.co.jp)
+
+ * Makefile.in (bindir, libdir, datadir, mandir, infodir, includedir,
+ INSTALL_PROGRAM, INSTALL_DATA): Use autoconf-set values.
+ (docdir): Removed.
+ * configure.in (AC_PREREQ): autoconf 2.5 or higher.
+ (AC_PROG_INSTALL): Added.
+ * configure: Rebuilt.
+
+Thu May 16 15:44:29 1996 Ian Lance Taylor <ian@cygnus.com>
+
+ * interp.c (saved_state_type): Add memstalls field.
+ (MA) Define macro.
+ (sim_resume): New local variable memstalls. Add it back in to
+ saved_state at the end of the function.
+ (sim_info): Report memstalls.
+ * gencode.c (tab): Add MA() to the execution string of all
+ instructions which access memory.
+
+Wed Feb 21 12:16:41 1996 Ian Lance Taylor <ian@cygnus.com>
+
+ * configure: Regenerate with autoconf 2.7.
+
+Tue Dec 5 16:38:55 1995 Stu Grossman (grossman@cygnus.com)
+
+ * gencode.c (mac.l): Don't abort GDB if executing mac.l
+ instruction (which is unimplemented). Generate a SIGTRAP (in the
+ simulated target) instead.
+
+Mon Dec 4 12:22:24 1995 J.T. Conklin <jtc@rtl.cygnus.com>
+
+ * gencode.c (tab): Added several sh3 opcodes.
+ (think): Added printonmatch for A_SSR and A_SPC.
+ * interp.c (SSR, SPC): Added definitions.
+ (saved_state_type): Added ssr and spc registers.
+
+Wed Nov 29 12:39:27 1995 Jim Wilson <wilson@chestnut.cygnus.com>
+
+ * gencode.c (tab): In shad/shld definitions, negate R[m] before
+ the and operation instead of after. For shad delete cast. For shld
+ use UR instead of R and delete cast.
+
+Fri Nov 17 12:48:55 1995 Jim Wilson <wilson@chestnut.cygnus.com>
+
+ * gencode.c (tab): Add explicit NaN support for ftrc instruction.
+
+Wed Nov 15 11:25:27 1995 Stu Grossman (grossman@cygnus.com)
+
+ * interp.c: Make target_byte_order be extern to prevent SGI cc from
+ issuing warnings about the use of common symbols.
+
+Tue Nov 14 15:19:43 1995 Stu Grossman (grossman@cygnus.com)
+
+ * gencode.c: jsr, bsr and bsrf actually save pc+4 in pr, and rts
+ actually uses pr+0.
+
+Sat Oct 21 13:01:18 1995 Jim Wilson <wilson@chestnut.cygnus.com>
+
+ * sh/interp.c (sim_stop_reason): Catch SIGQUIT and indicate
+ program exited.
+ (sim_get_quit_code): Delete.
+
+ * gencode.c (gensim): Indicate SIGILL instead of calling abort for
+ default case.
+
+Mon Oct 16 18:24:03 1995 Jim Wilson <wilson@chestnut.cygnus.com>
+
+ * interp.c (saved_state_type): Move FP registers to immediately
+ after SR.
+
+Tue Oct 10 11:12:15 1995 Fred Fish <fnf@cygnus.com>
+
+ * Makefile.in (BISON): Remove macro.
+
+Fri Oct 6 12:08:18 1995 Jim Wilson <wilson@chestnut.cygnus.com>
+
+ * interp.c (trap, case SYS_utime): Cast second arg of utime to
+ void * to avoid compiler error.
+
+ * interp.c (callback): Remove last change. It is initialized by
+ a sim_set_callbacks call.
+
+Thu Oct 5 14:13:29 1995 steve chamberlain <sac@slash.cygnus.com>
+
+ * interp.c (callback): Initialize to default callback.
+
+Thu Sep 28 15:26:59 1995 steve chamberlain <sac@slash.cygnus.com>
+
+ * run.c: Moved to ../common.
+ * interp.c (trap): Use gdb's callback interface.
+ * Makefile.in: Updated.
+
+Wed Sep 20 13:35:13 1995 Ian Lance Taylor <ian@cygnus.com>
+
+ * Makefile.in (maintainer-clean): New synonym for realclean.
+
+Wed Sep 20 09:51:50 1995 steve chamberlain <sac@slash.cygnus.com>
+
+ * run.c (sim_callback_write_stdout): New.
+ * interp.c (trap): Call sim_callback_write_stdout when needed.
+
+Mon Sep 18 18:42:27 1995 steve chamberlain <sac@slash.cygnus.com>
+
+ * interp.c (trap): Remove useless code.
+
+Fri Sep 15 19:30:05 1995 steve chamberlain <sac@slash.cygnus.com>
+
+ * syscall.h: Copy from newlib.
+
+Thu Sep 14 19:32:59 1995 Stu Grossman (grossman@cygnus.com)
+
+ * gencode.c: Back up PC by 2 for breakpoints.
+ * interp.c: Move fp regs beyond pc/pr/etc to avoid confusing GDB,
+ which expect pc to immediatly follow regs[].
+
+Fri Sep 8 14:18:13 1995 Ian Lance Taylor <ian@cygnus.com>
+
+ * configure.in: Define CC_FOR_BUILD. Don't call AC_PROG_INSTALL.
+ * configure: Rebuild.
+ * Makefile.in (INSTALL): Revert to using install.sh.
+ (INSTALL_PROGRAM, INSTALL_DATA): Set to $(INSTALL).
+ (INSTALL_XFORM, INSTALL_XFORM1): Restore.
+ (CC_FOR_BUILD): Restore.
+ (gencode): Build using $(CC_FOR_BUILD).
+ (install): Don't install in $(tooldir).
+
+Thu Sep 7 15:02:31 1995 J.T. Conklin <jtc@rtl.cygnus.com>
+
+ (Try to) Update to new bfd autoconf scheme.
+ * run.c: Don't include sysdep.h.
+ * Makefile.in (INSTALL{,_PROGRAM,_DATA}): Use autoconf computed value.
+ (CC, CFLAGS, AR, RANLIB): Likewise.
+ (HDEFINES, TDEFINES): Define.
+ (CC_FOR_BUILD): Delete.
+ (host_makefile_frag): Delete.
+ (Makefile): Don't depend on frags.
+ * configure.in (sysdep.h): Don't create symlink.
+ (host_makefile_frag, frags): Deleted.
+ (CC, CFLAGS, AR, RANLIB, INSTALL): Compute values.
+ * configure: Regenerated.
+
+Thu Aug 31 12:39:07 1995 Jim Wilson <wilson@chestnut.cygnus.com>
+
+ * interp.c: Include <math.h>.
+
+Wed Aug 30 22:05:17 1995 Jeff Law (law@snake.cs.utah.edu)
+
+ * Makefile.in (run): Link in math library too.
+ * gencode.c (gensim): abort if an unknown opcode is encountered.
+ * interp.c (FPSCR, FPUL): Define.
+ (struct save_state): Add fields for floating point registers,
+ FPSCR and FPUL.
+ (sim_resume): Add 'F' for accessing floating point registers
+ in the save state structure.
+ * gencode.c: Add sh3e opcodes.
+ (gensym): Define a buffer for int<->fp conversions.
+
+Tue Aug 22 14:16:46 1995 J.T. Conklin <jtc@rtl.cygnus.com>
+
+ * interp.c (trap): Use trap vector 34 for host system interface.
+ * gencode.c: Add 34 to conditional which determines which traps
+ will be handled by simulator.
+
+Fri Aug 11 17:59:15 1995 Jim Wilson <wilson@chestnut.cygnus.com>
+
+ * run.c: Include <signal.h>. Define SIGQUIT if not defined.
+ (main): New variables reason and sigrc. After simulator exits,
+ check to see if it exited because of a signal, and if so, then
+ use the signal number as the return value.
+
+Thu Aug 3 10:45:37 1995 Fred Fish <fnf@cygnus.com>
+
+ * Update all FSF addresses except those in COPYING* files.
+
+Tue Jul 18 23:33:10 1995 Fred Fish <fnf@fishbowl>
+
+ * interp.c (trap): Only use SYS_execv if defined. Might be
+ implemented as execve(arg1,arg2,0), as with Unixware 2.0.
+ (sim_resume): In sbit initializer, cast shifted arg to unsigned
+ to avoid signed integer overflow.
+
+Wed Jul 5 14:32:54 1995 J.T. Conklin <jtc@rtl.cygnus.com>
+
+ * Makefile.in (clean): Remove run, libsim.a.
+ (distclean, mostlyclean, realclean): Remove Makefile and
+ autoconf files.
+
+ * sh.mt: Removed.
+
+ * Makefile.in, configure.in: converted to autoconf.
+ * configure: New file, generated with autconf 2.4.
+
+Fri Jun 30 16:51:38 1995 Stan Shebs <shebs@andros.cygnus.com>
+
+ * interp.c (sim_open): If argument supplied, interpret as
+ desired memory size.
+ (parse_and_set_memory_size): New function.
+ (sim_do_command): New function.
+
+Thu Jun 29 10:02:28 1995 Fred Fish <fnf@deneb.cygnus.com>
+
+ * interp.c (SYS_wait): Define as SYS_wait4 if available and
+ SYS_wait is not already defined (SunOS 4.1.3 for example).
+ (SYS_utime): Define as SYS_utimes if available and
+ SYS_utime is not already defined.
+
+Thu Jun 22 17:25:57 1995 Steve Chamberlain <sac@slash.cygnus.com>
+
+ * interp.c: Don't include sys/times.h or sys/param.h
+
+Wed Jun 21 15:03:49 1995 Steve Chamberlain <sac@slash.cygnus.com>
+
+ * interp.c (SIGBUS, SIGTERM): Define if not.
+ (sim_memory_size): default to 2^19 on PCs.
+ (sim_resume): Poll for quits on win32.
+
+Wed May 24 16:22:48 1995 Jim Wilson <wilson@chestnut.cygnus.com>
+
+ * gencode.c (op_tab): Add SH3 support.
+
+Wed May 24 14:07:11 1995 Steve Chamberlain <sac@slash.cygnus.com>
+
+ * gencode.c (tab): Add bsrf and braf.
+
+Mon Apr 24 15:09:49 1995 Jason Molenda (crash@cygnus.com)
+
+ * configure.in: use ../../bfd/hosts/std-host.h, not
+ ../bfd/hosts/std-host.h (which doesn't exist).
+
+Mon Mar 27 10:32:34 1995 J.T. Conklin <jtc@rtl.cygnus.com>
+
+ * run.c: parse arguments with getopt().
+
+Sun Feb 26 15:27:24 1995 Steve Chamberlain <sac@cygnus.com>
+
+ * configure.in: Use ../../bfd/hosts/std-host.h if specific
+ host unavailable.
+
+Mon Jan 23 16:10:58 1995 Torbjorn Granlund <tege@rtl.cygnus.com>
+
+ * interp.c (macw): Sign extend MACH at bit 10 for non-saturating case.
+
+Sun Jan 22 13:55:36 1995 Torbjorn Granlund <tege@rtl.cygnus.com>
+
+ * gencode.c (op_tab): Make MAC.W call macw, not abort.
+ * interp.c (macw): New function.
+ (S): New #define.
+
+Sat Jan 21 15:52:30 1995 Torbjorn Granlund <tege@rtl.cygnus.com>
+
+ * gencode.c (op_tab): New code for ADDV and SUBV.
+ Make MAC.L abort sicne it is not implemented.
+
+ * interp.c (dmul): Handle the signed case by adjusting after unsigned multiply.
+ Get rid of __GNUC__ conditional.
+
+aThu Jan 19 05:50:50 1995 Torbjorn Granlund <tege@rtl.cygnus.com>
+
+ * gencode.c (op_tab): Also replace NEGC, and try again with SUBC.
+ Change ADDC for symmetry.
+
+ * gencode.c (op_tab): Replace code for ADDC and SUBC.
+
+Mon Jan 9 15:43:53 1995 Stu Grossman (grossman@cygnus.com)
+
+ * interp.c: Remove def of INLINE. This comes from bfd.h. Also,
+ declare IOMEM before using it.
+
+Wed Dec 28 21:25:31 1994 Steve Chamberlain (sac@jonny.cygnus.com)
+
+ * interp.c (BUSERROR): New macro.
+ ([r|w][bwl]at[little|big]) New functions.
+ (sim_resume): If GO32 check for interrupt every now
+ and again. Decrement PC if SIGBUS seen.
+ * run.c (main): Return result of simulated _exit.
+
+Mon Dec 5 21:59:51 1994 Doug Evans <dje@canuck.cygnus.com>
+
+ * Makefile.in (gencode): Allow build in different directory.
+
+Wed Nov 30 17:47:13 1994 Jim Wilson <wilson@chestnut.cygnus.com>
+
+ * Makefile.in (gencode): Change $< to gencode.c for portability.
+
+Wed Nov 23 21:31:55 1994 Steve Chamberlain (sac@jonny.cygnus.com)
+
+ * interp.c ([wr][bwl]at): New functions.
+ (trap): Cope with both byte modes.
+
+Thu Sep 8 17:35:07 1994 Steve Chamberlain (sac@jonny.cygnus.com)
+
+ * gencode.c (tab): Simulate T bit after a negc insn right.
+ * interp.c (RSBAT): Sign extend the arg.
+ (ACE_FAST): New macro.
+ (sim_resume): Remove obsolete test of sim_timeout.
+
+Fri Aug 5 14:12:31 1994 Steve Chamberlain (sac@jonny.cygnus.com)
+
+ * interp.c (IOMEM): New function, simulates very basic I/O area of
+ the SH.
+ (WBAT, RBAT) : Call I/O functions.
+ * gencode.c (tab): Special case trapa #3.
+
+Mon Jun 27 18:04:54 1994 Steve Chamberlain (sac@cirdan.cygnus.com)
+
+ * run.c (main): Specify the file type again.
+
+Thu May 26 19:04:37 1994 Steve Chamberlain (sac@thepub.cygnus.com)
+
+ * interp.c (trap): Fix irix incompatibility.
+ * run.c (main): open without specifying file type.
+
+Wed May 18 14:18:53 1994 Doug Evans (dje@canuck.cygnus.com)
+
+ * interp.c (sim_*): Make result void where there isn't one.
+ (sim_set_pc): Delete.
+ (sim_info): Delete printf_fn arg, all callers changed.
+ Call printf_filtered instead.
+ (sim_close): New function.
+ (sim_load): New function.
+ (sim_create_inferior): Renamed from sim_set_args, all callers changed.
+ * run.c: #include <varargs.h>, "remote-sim.h".
+ (printf_filtered): New function.
+
+Wed Apr 27 12:03:48 1994 Steve Chamberlain (sac@cygnus.com)
+
+ * gencode.c (table): Get direction of some opcodes right.
+ (trapa, rte): Implement fully.
+ * interp.c (trap): Make stat call more portable.
+
+Fri Feb 11 21:59:38 1994 Steve Chamberlain (sac@sphagnum.cygnus.com)
+
+ * gencode.c (main, gendefines): New -d option prints table of defines.
+ * interp.c (trap): Add a load of system calls.
+ (sim_memory_size): Now default to 8Mbyte.
+ (PARANOID): Keep vector of registers with undefined contents.
+
+Mon Nov 15 14:37:18 1993 Steve Chamberlain (sac@jonny.cygnus.com)
+
+ * gencode.c: mova uses aligned addresses
+ * interp.c (trap): Return results in r0.
+
+Tue Oct 26 10:38:55 1993 Doug Evans (dje@canuck.cygnus.com)
+
+ * Makefile.in (CSEARCH): Add -I$(srcdir)/../../gdb
+ * interp.c: #include "remote-sim.h".
+ (sim_resume): int result, new arg `siggnal'.
+ (sim_write): Use SIM_ADDR for type of arg `addr'.
+ (sim_read): Use SIM_ADDR for type of arg `addr'.
+ Use unsigned char * for `buffer'.
+ (sim_store_register): int result.
+ (sim_fetch_register): Ditto.
+ (sim_stop_reason): Renamed from sim_stop_signal. New arg `reason'.
+ (sim_set_pc): int result, use SIM_ADDR for type of arg `x'.
+ (sim_info): int result, new args `verbose', `printf_fn'.
+ (sim_kill): int result.
+ (sim_open): int result, new arg `name'.
+ * run.c: #include <stdio.h>
+ (main): Update call to sim_info.
+
+Sat Oct 23 15:09:29 1993 Doug Evans (dje@canuck.cygnus.com)
+
+ * interp.c (sim_stop_signal): Result is now enum sim_stop.
+
+Fri Oct 8 10:47:09 1993 Steve Chamberlain (sac@phydeaux.cygnus.com)
+
+ * gencode.c (table): Becomes unsigned.
+ * interp.c (trap): Get right breakpoint SIGnum. (sim_write,
+ sim_read): Return number of bytes copied. (sim_store_register):
+ Value passed by reference. (sim_kill, sim_open, sim_set_args): New functions.
+
+Tue Sep 7 16:24:13 1993 Stan Shebs (shebs@rtl.cygnus.com)
+
+ * interp.c (sim_info): Fix small typo in printf string.
+
+Thu Aug 5 11:37:48 1993 Stan Shebs (shebs@rtl.cygnus.com)
+
+ * interp.c (sim_resume): Set memory after pointers inited.
+
+Mon Aug 2 14:13:22 1993 Steve Chamberlain (sac@phydeaux.cygnus.com)
+
+ * interp.c (get_now): Use time system call.
+ * Makefile.in: install correctly.
+
+Tue Jul 6 10:30:46 1993 Steve Chamberlain (sac@phydeaux.cygnus.com)
+
+ * run.c (main), interp.c (sim_set_timeout): Remove timeout
+ functionality.
+
+Thu Jun 24 13:29:57 1993 david d `zoo' zuhn (zoo at rtl.cygnus.com)
+
+ * Makefile.in: don't run indent everytime; also add a space in the
+ includes
+
+Thu Jun 17 18:30:42 1993 Steve Chamberlain (sac@phydeaux.cygnus.com)
+
+ * gencode.c: Fix some opcodes.
+ * interp.c: Support for profiling and portability fixes.
+ * run.c (main): Get profiling args.
+
+Wed May 5 13:17:22 1993 Steve Chamberlain (sac@cygnus.com)
+
+ * gencode.c (tab): Lint for sgi compiler
+ * interp.c: Lint for sgi compiler.
+
+Mon May 3 15:25:33 1993 Steve Chamberlain (sac@thepub.cygnus.com)
+
+ * run.c (main): Support for resizing simulated RAM.
+ * Makefile.in: Support for broken makes.
+ * interp.c, gencode.c: Lint.
+
+Mon Apr 26 18:01:10 1993 Steve Chamberlain (sac@thepub.cygnus.com)
+
+ * created
+
diff --git a/sim/sh/Makefile.in b/sim/sh/Makefile.in
new file mode 100644
index 0000000..7de4b53
--- /dev/null
+++ b/sim/sh/Makefile.in
@@ -0,0 +1,41 @@
+# Makefile template for Configure for the SH sim library.
+# Copyright (C) 1990, 91, 92, 95, 96, 1997 Free Software Foundation, Inc.
+# Written by Cygnus Support.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+## COMMON_PRE_CONFIG_FRAG
+
+SIM_OBJS = interp.o table.o sim-load.o
+SIM_EXTRA_LIBS = -lm
+SIM_EXTRA_CLEAN = sh-clean
+
+## COMMON_POST_CONFIG_FRAG
+
+interp.o: interp.c code.c table.c
+
+code.c: gencode
+ ./gencode -x >code.c
+# indent code.c
+
+table.c: gencode
+ ./gencode -s >table.c
+# indent table.c
+
+gencode: gencode.c
+ $(CC_FOR_BUILD) -o gencode $(srcdir)/gencode.c
+
+sh-clean:
+ rm -f gencode code.c table.c
diff --git a/sim/sh/acconfig.h b/sim/sh/acconfig.h
new file mode 100644
index 0000000..f9b87a1
--- /dev/null
+++ b/sim/sh/acconfig.h
@@ -0,0 +1,15 @@
+
+/* Define to 1 if NLS is requested. */
+#undef ENABLE_NLS
+
+/* Define as 1 if you have catgets and don't want to use GNU gettext. */
+#undef HAVE_CATGETS
+
+/* Define as 1 if you have gettext and don't want to use GNU gettext. */
+#undef HAVE_GETTEXT
+
+/* Define as 1 if you have the stpcpy function. */
+#undef HAVE_STPCPY
+
+/* Define if your locale.h file contains LC_MESSAGES. */
+#undef HAVE_LC_MESSAGES
diff --git a/sim/sh/config.in b/sim/sh/config.in
new file mode 100644
index 0000000..1f87a2b
--- /dev/null
+++ b/sim/sh/config.in
@@ -0,0 +1,158 @@
+/* config.in. Generated automatically from configure.in by autoheader. */
+
+/* Define if using alloca.c. */
+#undef C_ALLOCA
+
+/* Define to empty if the keyword does not work. */
+#undef const
+
+/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
+ This function is required for alloca.c support on those systems. */
+#undef CRAY_STACKSEG_END
+
+/* Define if you have alloca, as a function or macro. */
+#undef HAVE_ALLOCA
+
+/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
+#undef HAVE_ALLOCA_H
+
+/* Define if you have a working `mmap' system call. */
+#undef HAVE_MMAP
+
+/* Define as __inline if that's what the C compiler calls it. */
+#undef inline
+
+/* Define to `long' if <sys/types.h> doesn't define. */
+#undef off_t
+
+/* Define if you need to in order for stat and other things to work. */
+#undef _POSIX_SOURCE
+
+/* Define as the return type of signal handlers (int or void). */
+#undef RETSIGTYPE
+
+/* Define to `unsigned' if <sys/types.h> doesn't define. */
+#undef size_t
+
+/* If using the C implementation of alloca, define if you know the
+ direction of stack growth for your system; otherwise it will be
+ automatically deduced at run-time.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown
+ */
+#undef STACK_DIRECTION
+
+/* Define if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define to 1 if NLS is requested. */
+#undef ENABLE_NLS
+
+/* Define as 1 if you have gettext and don't want to use GNU gettext. */
+#undef HAVE_GETTEXT
+
+/* Define as 1 if you have the stpcpy function. */
+#undef HAVE_STPCPY
+
+/* Define if your locale.h file contains LC_MESSAGES. */
+#undef HAVE_LC_MESSAGES
+
+/* Define if you have the __argz_count function. */
+#undef HAVE___ARGZ_COUNT
+
+/* Define if you have the __argz_next function. */
+#undef HAVE___ARGZ_NEXT
+
+/* Define if you have the __argz_stringify function. */
+#undef HAVE___ARGZ_STRINGIFY
+
+/* Define if you have the __setfpucw function. */
+#undef HAVE___SETFPUCW
+
+/* Define if you have the dcgettext function. */
+#undef HAVE_DCGETTEXT
+
+/* Define if you have the getcwd function. */
+#undef HAVE_GETCWD
+
+/* Define if you have the getpagesize function. */
+#undef HAVE_GETPAGESIZE
+
+/* Define if you have the getrusage function. */
+#undef HAVE_GETRUSAGE
+
+/* Define if you have the munmap function. */
+#undef HAVE_MUNMAP
+
+/* Define if you have the putenv function. */
+#undef HAVE_PUTENV
+
+/* Define if you have the setenv function. */
+#undef HAVE_SETENV
+
+/* Define if you have the setlocale function. */
+#undef HAVE_SETLOCALE
+
+/* Define if you have the sigaction function. */
+#undef HAVE_SIGACTION
+
+/* Define if you have the stpcpy function. */
+#undef HAVE_STPCPY
+
+/* Define if you have the strcasecmp function. */
+#undef HAVE_STRCASECMP
+
+/* Define if you have the strchr function. */
+#undef HAVE_STRCHR
+
+/* Define if you have the time function. */
+#undef HAVE_TIME
+
+/* Define if you have the <argz.h> header file. */
+#undef HAVE_ARGZ_H
+
+/* Define if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define if you have the <fpu_control.h> header file. */
+#undef HAVE_FPU_CONTROL_H
+
+/* Define if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+
+/* Define if you have the <locale.h> header file. */
+#undef HAVE_LOCALE_H
+
+/* Define if you have the <malloc.h> header file. */
+#undef HAVE_MALLOC_H
+
+/* Define if you have the <nl_types.h> header file. */
+#undef HAVE_NL_TYPES_H
+
+/* 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/param.h> header file. */
+#undef HAVE_SYS_PARAM_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
+
+/* Define if you have the <values.h> header file. */
+#undef HAVE_VALUES_H
diff --git a/sim/sh/configure b/sim/sh/configure
new file mode 100755
index 0000000..e646fa8
--- /dev/null
+++ b/sim/sh/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/sh/configure.in b/sim/sh/configure.in
new file mode 100644
index 0000000..033b0bc
--- /dev/null
+++ b/sim/sh/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/sh/gencode.c b/sim/sh/gencode.c
new file mode 100644
index 0000000..338b934
--- /dev/null
+++ b/sim/sh/gencode.c
@@ -0,0 +1,1755 @@
+/* Simulator/Opcode generator for the Hitachi Super-H architecture.
+
+ Written by Steve Chamberlain of Cygnus Support.
+ sac@cygnus.com
+
+ This file is part of SH sim
+
+
+ THIS SOFTWARE IS NOT COPYRIGHTED
+
+ Cygnus offers the following for use in the public domain. Cygnus
+ makes no warranty with regard to the software or it's performance
+ and the user accepts the software "AS IS" with all faults.
+
+ CYGNUS DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD TO
+ THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+
+*/
+
+/* This program generates the opcode table for the assembler and
+ the simulator code
+
+ -t prints a pretty table for the assembler manual
+ -s generates the simulator code jump table
+ -d generates a define table
+ -x generates the simulator code switch statement
+ default generates the opcode tables
+
+*/
+
+#include <stdio.h>
+
+#define MAX_NR_STUFF 20
+
+typedef struct
+{
+ char *defs;
+ char *refs;
+ char *name;
+ char *code;
+ char *stuff[MAX_NR_STUFF];
+ int index;
+}
+
+op;
+
+
+op tab[] =
+{
+
+ { "n", "", "add #<imm>,<REG_N>", "0111nnnni8*1....",
+ "R[n] += SEXT(i);",
+ "if (i == 0) {",
+ " UNDEF(n); /* see #ifdef PARANOID */",
+ " break;",
+ "}",
+ },
+ { "n", "mn", "add <REG_M>,<REG_N>", "0011nnnnmmmm1100",
+ "R[n] += R[m];",
+ },
+
+ { "n", "mn", "addc <REG_M>,<REG_N>", "0011nnnnmmmm1110",
+ "ult = R[n] + T;",
+ "SET_SR_T (ult < R[n]);",
+ "R[n] = ult + R[m];",
+ "SET_SR_T (T || (R[n] < ult));",
+ },
+
+ { "n", "mn", "addv <REG_M>,<REG_N>", "0011nnnnmmmm1111",
+ "ult = R[n] + R[m];",
+ "SET_SR_T ((~(R[n] ^ R[m]) & (ult ^ R[n])) >> 31);",
+ "R[n] = ult;",
+ },
+
+ { "0", "", "and #<imm>,R0", "11001001i8*1....",
+ "R0 &= i;",
+ },
+ { "n", "nm", "and <REG_M>,<REG_N>", "0010nnnnmmmm1001",
+ "R[n] &= R[m];",
+ },
+ { "", "0", "and.b #<imm>,@(R0,GBR)", "11001101i8*1....",
+ "MA (1);",
+ "WBAT (GBR + R0, RBAT (GBR + R0) & i);",
+ },
+
+ { "", "", "bf <bdisp8>", "10001011i8p1....",
+ "if (!T) {",
+ " nia = PC + 4 + (SEXT(i) * 2);",
+ " cycles += 2;",
+ "}",
+ },
+
+ { "", "", "bf.s <bdisp8>", "10001111i8p1....",
+ "if (!T) {",
+ " nia = PC + 4 + (SEXT (i) * 2);",
+ " cycles += 2;",
+ " Delay_Slot (PC + 2);",
+ "}",
+ },
+
+ { "", "", "bra <bdisp12>", "1010i12.........",
+ "nia = PC + 4 + (SEXT12 (i) * 2);",
+ "Delay_Slot (PC + 2);",
+ },
+
+ { "", "n", "braf <REG_N>", "0000nnnn00100011",
+ "nia = PC + 4 + R[n];",
+ "Delay_Slot (PC + 2);",
+ },
+
+ { "", "", "bsr <bdisp12>", "1011i12.........",
+ "PR = PC + 4;",
+ "nia = PC + 4 + (SEXT12 (i) * 2);",
+ "Delay_Slot (PC + 2);",
+ },
+
+ { "", "n", "bsrf <REG_N>", "0000nnnn00000011",
+ "PR = PC + 4;",
+ "nia = PC + 4 + R[n];",
+ "Delay_Slot (PC + 2);",
+ },
+
+ { "", "", "bt <bdisp8>", "10001001i8p1....",
+ "if (T) {",
+ " nia = PC + 4 + (SEXT (i) * 2);",
+ " cycles += 2;",
+ "}",
+ },
+
+ { "", "", "bt.s <bdisp8>", "10001101i8p1....",
+ "if (T) {",
+ " nia = PC + 4 + (SEXT (i) * 2);",
+ " cycles += 2;",
+ " Delay_Slot (PC + 2);",
+ "}",
+ },
+
+ { "", "", "clrmac", "0000000000101000",
+ "MACH = 0;",
+ "MACL = 0;",
+ },
+
+ { "", "", "clrs", "0000000001001000",
+ "SET_SR_S (0);",
+ },
+
+ { "", "", "clrt", "0000000000001000",
+ "SET_SR_T (0);",
+ },
+
+ { "", "0", "cmp/eq #<imm>,R0", "10001000i8*1....",
+ "SET_SR_T (R0 == SEXT (i));",
+ },
+ { "", "mn", "cmp/eq <REG_M>,<REG_N>", "0011nnnnmmmm0000",
+ "SET_SR_T (R[n] == R[m]);",
+ },
+ { "", "mn", "cmp/ge <REG_M>,<REG_N>", "0011nnnnmmmm0011",
+ "SET_SR_T (R[n] >= R[m]);",
+ },
+ { "", "mn", "cmp/gt <REG_M>,<REG_N>", "0011nnnnmmmm0111",
+ "SET_SR_T (R[n] > R[m]);",
+ },
+ { "", "mn", "cmp/hi <REG_M>,<REG_N>", "0011nnnnmmmm0110",
+ "SET_SR_T (UR[n] > UR[m]);",
+ },
+ { "", "mn", "cmp/hs <REG_M>,<REG_N>", "0011nnnnmmmm0010",
+ "SET_SR_T (UR[n] >= UR[m]);",
+ },
+ { "", "n", "cmp/pl <REG_N>", "0100nnnn00010101",
+ "SET_SR_T (R[n] > 0);",
+ },
+ { "", "n", "cmp/pz <REG_N>", "0100nnnn00010001",
+ "SET_SR_T (R[n] >= 0);",
+ },
+ { "", "mn", "cmp/str <REG_M>,<REG_N>", "0010nnnnmmmm1100",
+ "ult = R[n] ^ R[m];",
+ "SET_SR_T (((ult & 0xff000000) == 0)",
+ " | ((ult & 0xff0000) == 0)",
+ " | ((ult & 0xff00) == 0)",
+ " | ((ult & 0xff) == 0));",
+ },
+
+ { "", "mn", "div0s <REG_M>,<REG_N>", "0010nnnnmmmm0111",
+ "SET_SR_Q ((R[n] & sbit) != 0);",
+ "SET_SR_M ((R[m] & sbit) != 0);",
+ "SET_SR_T (M != Q);",
+ },
+
+ { "", "", "div0u", "0000000000011001",
+ "SET_SR_M (0);",
+ "SET_SR_Q (0);",
+ "SET_SR_T (0);",
+ },
+
+ { "", "", "div1 <REG_M>,<REG_N>", "0011nnnnmmmm0100",
+ "div1 (R, m, n/*, T*/);",
+ },
+
+ { "", "nm", "dmuls.l <REG_M>,<REG_N>", "0011nnnnmmmm1101",
+ "dmul (1/*signed*/, R[n], R[m]);",
+ },
+
+ { "", "nm", "dmulu.l <REG_M>,<REG_N>", "0011nnnnmmmm0101",
+ "dmul (0/*unsigned*/, R[n], R[m]);",
+ },
+
+ { "n", "n", "dt <REG_N>", "0100nnnn00010000",
+ "R[n]--;",
+ "SET_SR_T (R[n] == 0);",
+ },
+
+ { "n", "m", "exts.b <REG_M>,<REG_N>", "0110nnnnmmmm1110",
+ "R[n] = SEXT (R[m]);",
+ },
+ { "n", "m", "exts.w <REG_M>,<REG_N>", "0110nnnnmmmm1111",
+ "R[n] = SEXTW (R[m]);",
+ },
+
+ { "n", "m", "extu.b <REG_M>,<REG_N>", "0110nnnnmmmm1100",
+ "R[n] = (R[m] & 0xff);",
+ },
+ { "n", "m", "extu.w <REG_M>,<REG_N>", "0110nnnnmmmm1101",
+ "R[n] = (R[m] & 0xffff);",
+ },
+
+ /* sh3e */
+ { "", "", "fabs <FREG_N>", "1111nnnn01011101",
+ "FP_UNARY (n, fabs);",
+ "/* FIXME: FR(n) &= 0x7fffffff; */",
+ },
+
+ /* sh3e */
+ { "", "", "fadd <FREG_M>,<FREG_N>", "1111nnnnmmmm0000",
+ "FP_OP (n, +, m);",
+ },
+
+ /* sh3e */
+ { "", "", "fcmp/eq <FREG_M>,<FREG_N>", "1111nnnnmmmm0100",
+ "FP_CMP (n, ==, m);",
+ },
+ /* sh3e */
+ { "", "", "fcmp/gt <FREG_M>,<FREG_N>", "1111nnnnmmmm0101",
+ "FP_CMP (n, >, m);",
+ },
+
+ /* sh3e */
+ { "", "", "fdiv <FREG_M>,<FREG_N>", "1111nnnnmmmm0011",
+ "FP_OP (n, /, m);",
+ "/* FIXME: check for DP and (n & 1) == 0? */",
+ },
+
+ /* sh3e */
+ { "", "", "fldi0 <FREG_N>", "1111nnnn10001101",
+ "SET_FR (n, (float)0.0);",
+ "/* FIXME: check for DP and (n & 1) == 0? */",
+ },
+
+ /* sh3e */
+ { "", "", "fldi1 <FREG_N>", "1111nnnn10011101",
+ "SET_FR (n, (float)1.0);",
+ "/* FIXME: check for DP and (n & 1) == 0? */",
+ },
+
+ /* sh3e */
+ { "", "", "flds <FREG_N>,FPUL", "1111nnnn00011101",
+ "char buf[4];",
+ "*(float *)buf = FR(n);",
+ "FPUL = *(int *)buf;",
+ },
+
+ /* sh3e */
+ { "", "", "float FPUL,<FREG_N>", "1111nnnn00101101",
+ "{",
+ " SET_FR (n, (float)FPUL);",
+ "}",
+ },
+
+ /* sh3e */
+ { "", "", "fmac <FREG_0>,<FREG_M>,<FREG_N>", "1111nnnnmmmm1110",
+ "SET_FR (n, FR(m) * FR(0) + FR(n));",
+ "/* FIXME: check for DP and (n & 1) == 0? */",
+ },
+
+ /* sh3e */
+ { "", "", "fmov <FREG_M>,<FREG_N>", "1111nnnnmmmm1100",
+ "{",
+ " SET_FR (n, FR (m));",
+ "}",
+ },
+ /* sh3e */
+ { "", "", "fmov.s <FREG_M>,@<REG_N>", "1111nnnnmmmm1010",
+ "{",
+ " MA (1);",
+ " WLAT (R[n], FI(m));",
+ "}",
+ },
+ /* sh3e */
+ { "", "", "fmov.s @<REG_M>,<FREG_N>", "1111nnnnmmmm1000",
+ "{",
+ " MA (1);",
+ " SET_FI(n, RLAT(R[m]));",
+ "}",
+ },
+ /* sh3e */
+ { "", "", "fmov.s @<REG_M>+,<FREG_N>", "1111nnnnmmmm1001",
+ "{",
+ " MA (1);",
+ " SET_FI (n, RLAT (R[m]));",
+ " R[m] += 4;",
+ "}",
+ },
+ /* sh3e */
+ { "", "", "fmov.s <FREG_M>,@-<REG_N>", "1111nnnnmmmm1011",
+ "{",
+ " MA (1);",
+ " R[n] -= 4;",
+ " WLAT (R[n], FI(m));",
+ "}",
+ },
+ /* sh3e */
+ { "", "", "fmov.s @(R0,<REG_M>),<FREG_N>", "1111nnnnmmmm0110",
+ "{",
+ " MA (1);",
+ " SET_FI(n, RLAT(R[0] + R[m]));",
+ "}",
+ },
+ /* sh3e */
+ { "", "", "fmov.s <FREG_M>,@(R0,<REG_N>)", "1111nnnnmmmm0111",
+ "{",
+ " MA (1);",
+ " WLAT((R[0]+R[n]), FI(m));",
+ "}",
+ },
+
+ /* sh3e */
+ { "", "", "fmul <FREG_M>,<FREG_N>", "1111nnnnmmmm0010",
+ "FP_OP(n, *, m);",
+ },
+
+ /* sh3e */
+ { "", "", "fneg <FREG_N>", "1111nnnn01001101",
+ "FP_UNARY(n, -);",
+ },
+
+ /* sh3e */
+ { "", "", "fsqrt <FREG_N>", "1111nnnn01101101",
+ "FP_UNARY(n, sqrt);",
+ },
+
+ /* sh3e */
+ { "", "", "fsub <FREG_M>,<FREG_N>", "1111nnnnmmmm0001",
+ "FP_OP(n, -, m);",
+ },
+
+ /* sh3e */
+ { "", "", "ftrc <FREG_N>, FPUL", "1111nnnn00111101",
+ "if (FR(n) != FR(n)) /* NaN */",
+ " FPUL = 0x80000000;",
+ "else",
+ " FPUL = (int)FR(n);",
+ },
+
+ /* sh3e */
+ { "", "", "ftst/nan <FREG_N>", "1111nnnn01111101",
+ "SET_SR_T (isnan (FR(n)));",
+ },
+ /* sh3e */
+ { "", "", "fsts FPUL,<FREG_N>", "1111nnnn00001101",
+ "char buf[4];",
+ "*(int *)buf = FPUL;",
+ "SET_FR (n, *(float *)buf);",
+ },
+
+ { "", "n", "jmp @<REG_N>", "0100nnnn00101011",
+ "nia = R[n];",
+ "Delay_Slot (PC + 2);",
+ },
+
+ { "", "n", "jsr @<REG_N>", "0100nnnn00001011",
+ "PR = PC + 4;",
+ "nia = R[n];",
+ "if (~doprofile)",
+ " gotcall (PR, nia);",
+ "Delay_Slot (PC + 2);",
+ },
+
+ { "", "n", "ldc <REG_N>,GBR", "0100nnnn00011110",
+ "GBR = R[n];",
+ "/* FIXME: user mode */",
+ },
+ { "", "n", "ldc <REG_N>,SR", "0100nnnn00001110",
+ "SET_SR (R[n]);",
+ "/* FIXME: user mode */",
+ },
+ { "", "n", "ldc <REG_N>,VBR", "0100nnnn00101110",
+ "VBR = R[n];",
+ "/* FIXME: user mode */",
+ },
+ { "", "n", "ldc <REG_N>,SSR", "0100nnnn00111110",
+ "SSR = R[n];",
+ "/* FIXME: user mode */",
+ },
+ { "", "n", "ldc <REG_N>,SPC", "0100nnnn01001110",
+ "SPC = R[n];",
+ "/* FIXME: user mode */",
+ },
+ { "", "n", "ldc <REG_N>,R0_BANK", "0100nnnn10001110",
+ "SET_Rn_BANK (0, R[n]);",
+ "/* FIXME: user mode */",
+ },
+ { "", "n", "ldc <REG_N>,R1_BANK", "0100nnnn10011110",
+ "SET_Rn_BANK (1, R[n]);",
+ "/* FIXME: user mode */",
+ },
+ { "", "n", "ldc <REG_N>,R2_BANK", "0100nnnn10101110",
+ "SET_Rn_BANK (2, R[n]);",
+ "/* FIXME: user mode */",
+ },
+ { "", "n", "ldc <REG_N>,R3_BANK", "0100nnnn10111110",
+ "SET_Rn_BANK (3, R[n]);",
+ "/* FIXME: user mode */",
+ },
+ { "", "n", "ldc <REG_N>,R4_BANK", "0100nnnn11001110",
+ "SET_Rn_BANK (4, R[n]);",
+ "/* FIXME: user mode */",
+ },
+ { "", "n", "ldc <REG_N>,R5_BANK", "0100nnnn11011110",
+ "SET_Rn_BANK (5, R[n]);",
+ "/* FIXME: user mode */",
+ },
+ { "", "n", "ldc <REG_N>,R6_BANK", "0100nnnn11101110",
+ "SET_Rn_BANK (6, R[n]);",
+ "/* FIXME: user mode */",
+ },
+ { "", "n", "ldc <REG_N>,R7_BANK", "0100nnnn11111110",
+ "SET_Rn_BANK (7, R[n]);",
+ "/* FIXME: user mode */",
+ },
+ { "", "n", "ldc.l @<REG_N>+,GBR", "0100nnnn00010111",
+ "MA (1);",
+ "GBR = RLAT (R[n]);",
+ "R[n] += 4;",
+ "/* FIXME: user mode */",
+ },
+ { "", "n", "ldc.l @<REG_N>+,SR", "0100nnnn00000111",
+ "MA (1);",
+ "SET_SR (RLAT (R[n]));",
+ "R[n] += 4;",
+ "/* FIXME: user mode */",
+ },
+ { "", "n", "ldc.l @<REG_N>+,VBR", "0100nnnn00100111",
+ "MA (1);",
+ "VBR = RLAT (R[n]);",
+ "R[n] += 4;",
+ "/* FIXME: user mode */",
+ },
+ { "", "n", "ldc.l @<REG_N>+,SSR", "0100nnnn00110111",
+ "MA (1);",
+ "SSR = RLAT (R[n]);",
+ "R[n] += 4;",
+ "/* FIXME: user mode */",
+ },
+ { "", "n", "ldc.l @<REG_N>+,SPC", "0100nnnn01000111",
+ "MA (1);",
+ "SPC = RLAT (R[n]);",
+ "R[n] += 4;",
+ "/* FIXME: user mode */",
+ },
+ { "", "n", "ldc.l @<REG_N>+,R0_BANK", "0100nnnn10000111",
+ "MA (1);",
+ "SET_Rn_BANK (0, RLAT (R[n]));",
+ "R[n] += 4;",
+ "/* FIXME: user mode */",
+ },
+ { "", "n", "ldc.l @<REG_N>+,R1_BANK", "0100nnnn10010111",
+ "MA (1);",
+ "SET_Rn_BANK (1, RLAT (R[n]));",
+ "R[n] += 4;",
+ "/* FIXME: user mode */",
+ },
+ { "", "n", "ldc.l @<REG_N>+,R2_BANK", "0100nnnn10100111",
+ "MA (1);",
+ "SET_Rn_BANK (2, RLAT (R[n]));",
+ "R[n] += 4;",
+ "/* FIXME: user mode */",
+ },
+ { "", "n", "ldc.l @<REG_N>+,R3_BANK", "0100nnnn10110111",
+ "MA (1);",
+ "SET_Rn_BANK (3, RLAT (R[n]));",
+ "R[n] += 4;",
+ "/* FIXME: user mode */",
+ },
+ { "", "n", "ldc.l @<REG_N>+,R4_BANK", "0100nnnn11000111",
+ "MA (1);",
+ "SET_Rn_BANK (4, RLAT (R[n]));",
+ "R[n] += 4;",
+ "/* FIXME: user mode */",
+ },
+ { "", "n", "ldc.l @<REG_N>+,R5_BANK", "0100nnnn11010111",
+ "MA (1);",
+ "SET_Rn_BANK (5, RLAT (R[n]));",
+ "R[n] += 4;",
+ "/* FIXME: user mode */",
+ },
+ { "", "n", "ldc.l @<REG_N>+,R6_BANK", "0100nnnn11100111",
+ "MA (1);",
+ "SET_Rn_BANK (6, RLAT (R[n]));",
+ "R[n] += 4;",
+ "/* FIXME: user mode */",
+ },
+ { "", "n", "ldc.l @<REG_N>+,R7_BANK", "0100nnnn11110111",
+ "MA (1);",
+ "SET_Rn_BANK (7, RLAT (R[n]));",
+ "R[n] += 4;",
+ "/* FIXME: user mode */",
+ },
+
+ /* sh3e */
+ { "", "", "lds <REG_N>,FPUL", "0100nnnn01011010",
+ "FPUL = R[n];",
+ },
+ /* sh3e */
+ { "", "", "lds.l @<REG_N>+,FPUL", "0100nnnn01010110",
+ "MA (1);",
+ "FPUL = RLAT(R[n]);",
+ "R[n] += 4;",
+ },
+ /* sh3e */
+ { "", "", "lds <REG_N>,FPSCR", "0100nnnn01101010",
+ "SET_FPSCR(R[n]);",
+ },
+ /* sh3e */
+ { "", "", "lds.l @<REG_N>+,FPSCR", "0100nnnn01100110",
+ "MA (1);",
+ "SET_FPSCR (RLAT(R[n]));",
+ "R[n] += 4;",
+ },
+
+ { "", "n", "lds <REG_N>,MACH", "0100nnnn00001010",
+ "MACH = R[n];",
+ },
+ { "", "n", "lds <REG_N>,MACL", "0100nnnn00011010",
+ "MACL= R[n];",
+ },
+ { "", "n", "lds <REG_N>,PR", "0100nnnn00101010",
+ "PR = R[n];",
+ },
+ { "", "n", "lds.l @<REG_N>+,MACH", "0100nnnn00000110",
+ "MA (1);",
+ "MACH = SEXT(RLAT(R[n]));",
+ "R[n]+=4;",
+ },
+ { "", "n", "lds.l @<REG_N>+,MACL", "0100nnnn00010110",
+ "MA (1);",
+ "MACL = RLAT(R[n]);",
+ "R[n]+=4;",
+ },
+ { "", "n", "lds.l @<REG_N>+,PR", "0100nnnn00100110",
+ "MA (1);",
+ "PR = RLAT(R[n]);",
+ "R[n]+=4;;",
+ },
+
+ { "", "", "ldtlb", "0000000000111000",
+ "/* FIXME: XXX*/ abort();",
+ },
+
+ { "", "nm", "mac.l @<REG_M>+,@<REG_N>+", "0000nnnnmmmm1111",
+ "trap (255,R0,memory,maskl,maskw,little_endian);",
+ "/* FIXME: mac.l support */",
+ },
+
+ { "", "nm", "mac.w @<REG_M>+,@<REG_N>+", "0100nnnnmmmm1111",
+ "macw(R0,memory,n,m);",
+ },
+
+ { "n", "", "mov #<imm>,<REG_N>", "1110nnnni8*1....",
+ "R[n] = SEXT(i);",
+ },
+ { "n", "m", "mov <REG_M>,<REG_N>", "0110nnnnmmmm0011",
+ "R[n] = R[m];",
+ },
+
+ { "0", "", "mov.b @(<disp>,GBR),R0", "11000100i8*1....",
+ "MA (1);",
+ "R0 = RSBAT (i + GBR);",
+ "L (0);",
+ },
+ { "0", "m", "mov.b @(<disp>,<REG_M>),R0", "10000100mmmmi4*1",
+ "MA (1);",
+ "R0 = RSBAT (i + R[m]);",
+ "L (0);",
+ },
+ { "n", "0m", "mov.b @(R0,<REG_M>),<REG_N>", "0000nnnnmmmm1100",
+ "MA (1);",
+ "R[n] = RSBAT (R0 + R[m]);",
+ "L (n);",
+ },
+ { "n", "m", "mov.b @<REG_M>+,<REG_N>", "0110nnnnmmmm0100",
+ "MA (1);",
+ "R[n] = RSBAT (R[m]);",
+ "R[m] += 1;",
+ "L (n);",
+ },
+ { "", "mn", "mov.b <REG_M>,@<REG_N>", "0010nnnnmmmm0000",
+ "MA (1);",
+ "WBAT (R[n], R[m]);",
+ },
+ { "", "0", "mov.b R0,@(<disp>,GBR)", "11000000i8*1....",
+ "MA (1);",
+ "WBAT (i + GBR, R0);",
+ },
+ { "", "m0", "mov.b R0,@(<disp>,<REG_M>)", "10000000mmmmi4*1",
+ "MA (1);",
+ "WBAT (i + R[m], R0);",
+ },
+ { "", "mn0", "mov.b <REG_M>,@(R0,<REG_N>)", "0000nnnnmmmm0100",
+ "MA (1);",
+ "WBAT (R[n] + R0, R[m]);",
+ },
+ { "", "nm", "mov.b <REG_M>,@-<REG_N>", "0010nnnnmmmm0100",
+ "MA (1);",
+ "R[n] -= 1;",
+ "WBAT (R[n], R[m]);",
+ },
+ { "n", "m", "mov.b @<REG_M>,<REG_N>", "0110nnnnmmmm0000",
+ "MA (1);",
+ "R[n] = RSBAT (R[m]);",
+ "L (n);",
+ },
+
+ { "0", "", "mov.l @(<disp>,GBR),R0", "11000110i8*4....",
+ "MA (1);",
+ "R0 = RLAT (i + GBR);",
+ "L (0);",
+ },
+ { "n", "", "mov.l @(<disp>,PC),<REG_N>", "1101nnnni8p4....",
+ "MA (1);",
+ "R[n] = RLAT((PC & ~3) + 4 + i);",
+ "L (n);",
+ },
+ { "n", "m", "mov.l @(<disp>,<REG_M>),<REG_N>", "0101nnnnmmmmi4*4",
+ "MA (1);",
+ "R[n] = RLAT (i + R[m]);",
+ "L (n);",
+ },
+ { "n", "m0", "mov.l @(R0,<REG_M>),<REG_N>", "0000nnnnmmmm1110",
+ "MA (1);",
+ "R[n] = RLAT (R0 + R[m]);",
+ "L (n);",
+ },
+ { "nm", "m", "mov.l @<REG_M>+,<REG_N>", "0110nnnnmmmm0110",
+ "MA (1);",
+ "R[n] = RLAT (R[m]);",
+ "R[m] += 4;",
+ "L (n);",
+ },
+ { "n", "m", "mov.l @<REG_M>,<REG_N>", "0110nnnnmmmm0010",
+ "MA (1);",
+ "R[n] = RLAT (R[m]);",
+ "L (n);",
+ },
+ { "", "0", "mov.l R0,@(<disp>,GBR)", "11000010i8*4....",
+ "MA (1);",
+ "WLAT (i + GBR, R0);",
+ },
+ { "", "nm", "mov.l <REG_M>,@(<disp>,<REG_N>)", "0001nnnnmmmmi4*4",
+ "MA (1);",
+ "WLAT (i + R[n], R[m]);",
+ },
+ { "", "nm0", "mov.l <REG_M>,@(R0,<REG_N>)", "0000nnnnmmmm0110",
+ "MA (1);",
+ "WLAT (R0 + R[n], R[m]);",
+ },
+ { "", "nm", "mov.l <REG_M>,@-<REG_N>", "0010nnnnmmmm0110",
+ "MA (1) ;",
+ "R[n] -= 4;",
+ "WLAT (R[n], R[m]);",
+ },
+ { "", "nm", "mov.l <REG_M>,@<REG_N>", "0010nnnnmmmm0010",
+ "MA (1);",
+ "WLAT (R[n], R[m]);",
+ },
+
+ { "0", "", "mov.w @(<disp>,GBR),R0", "11000101i8*2....",
+ "MA (1)",
+ ";R0 = RSWAT (i + GBR);",
+ "L (0);",
+ },
+ { "n", "", "mov.w @(<disp>,PC),<REG_N>", "1001nnnni8p2....",
+ "MA (1);",
+ "R[n] = RSWAT (PC + 4 + i);",
+ "L (n);",
+ },
+ { "0", "m", "mov.w @(<disp>,<REG_M>),R0", "10000101mmmmi4*2",
+ "MA (1);",
+ "R0 = RSWAT (i + R[m]);",
+ "L (0);",
+ },
+ { "n", "m0", "mov.w @(R0,<REG_M>),<REG_N>", "0000nnnnmmmm1101",
+ "MA (1);",
+ "R[n] = RSWAT (R0 + R[m]);",
+ "L (n);",
+ },
+ { "nm", "n", "mov.w @<REG_M>+,<REG_N>", "0110nnnnmmmm0101",
+ "MA (1);",
+ "R[n] = RSWAT (R[m]);",
+ "R[m] += 2;",
+ "L (n);",
+ },
+ { "n", "m", "mov.w @<REG_M>,<REG_N>", "0110nnnnmmmm0001",
+ "MA (1);",
+ "R[n] = RSWAT (R[m]);",
+ "L (n);",
+ },
+ { "", "0", "mov.w R0,@(<disp>,GBR)", "11000001i8*2....",
+ "MA (1);",
+ "WWAT (i + GBR, R0);",
+ },
+ { "", "0m", "mov.w R0,@(<disp>,<REG_M>)", "10000001mmmmi4*2",
+ "MA (1);",
+ "WWAT (i + R[m], R0);",
+ },
+ { "", "m0n", "mov.w <REG_M>,@(R0,<REG_N>)", "0000nnnnmmmm0101",
+ "MA (1);",
+ "WWAT (R0 + R[n], R[m]);",
+ },
+ { "n", "mn", "mov.w <REG_M>,@-<REG_N>", "0010nnnnmmmm0101",
+ "MA (1);",
+ "R[n] -= 2;",
+ "WWAT (R[n], R[m]);",
+ },
+ { "", "nm", "mov.w <REG_M>,@<REG_N>", "0010nnnnmmmm0001",
+ "MA (1);",
+ "WWAT (R[n], R[m]);",
+ },
+
+ { "0", "", "mova @(<disp>,PC),R0", "11000111i8p4....",
+ "R0 = ((i + 4 + PC) & ~0x3);",
+ },
+
+ { "n", "", "movt <REG_N>", "0000nnnn00101001",
+ "R[n] = T;",
+ },
+
+ { "", "mn", "mul.l <REG_M>,<REG_N>", "0000nnnnmmmm0111",
+ "MACL = ((int)R[n]) * ((int)R[m]);",
+ },
+#if 0
+ { "", "nm", "mul.l <REG_M>,<REG_N>", "0000nnnnmmmm0111",
+ "MACL = R[n] * R[m];",
+ },
+#endif
+
+ /* muls.w - see muls */
+ { "", "mn", "muls <REG_M>,<REG_N>", "0010nnnnmmmm1111",
+ "MACL = ((int)(short)R[n]) * ((int)(short)R[m]);",
+ },
+
+ /* mulu.w - see mulu */
+ { "", "mn", "mulu <REG_M>,<REG_N>", "0010nnnnmmmm1110",
+ "MACL = (((unsigned int)(unsigned short)R[n])",
+ " * ((unsigned int)(unsigned short)R[m]));",
+ },
+
+ { "n", "m", "neg <REG_M>,<REG_N>", "0110nnnnmmmm1011",
+ "R[n] = - R[m];",
+ },
+
+ { "n", "m", "negc <REG_M>,<REG_N>", "0110nnnnmmmm1010",
+ "ult = -T;",
+ "SET_SR_T (ult > 0);",
+ "R[n] = ult - R[m];",
+ "SET_SR_T (T || (R[n] > ult));",
+ },
+
+ { "", "", "nop", "0000000000001001",
+ "/* nop */",
+ },
+
+ { "n", "m", "not <REG_M>,<REG_N>", "0110nnnnmmmm0111",
+ "R[n] = ~R[m];",
+ },
+
+ { "0", "", "or #<imm>,R0", "11001011i8*1....",
+ "R0 |= i;",
+ },
+ { "n", "m", "or <REG_M>,<REG_N>", "0010nnnnmmmm1011",
+ "R[n] |= R[m];",
+ },
+ { "", "0", "or.b #<imm>,@(R0,GBR)", "11001111i8*1....",
+ "MA (1);",
+ "WBAT (R0 + GBR, (RBAT (R0 + GBR) | i));",
+ },
+
+ { "", "n", "pref @<REG_N>", "0000nnnn10000011",
+ "/* Except for the effect on the cache - which is not simulated -",
+ " this is like a nop. */",
+ },
+
+ { "n", "n", "rotcl <REG_N>", "0100nnnn00100100",
+ "ult = R[n] < 0;",
+ "R[n] = (R[n] << 1) | T;",
+ "SET_SR_T (ult);",
+ },
+
+ { "n", "n", "rotcr <REG_N>", "0100nnnn00100101",
+ "ult = R[n] & 1;",
+ "R[n] = (UR[n] >> 1) | (T << 31);",
+ "SET_SR_T (ult);",
+ },
+
+ { "n", "n", "rotl <REG_N>", "0100nnnn00000100",
+ "SET_SR_T (R[n] < 0);",
+ "R[n] <<= 1;",
+ "R[n] |= T;",
+ },
+
+ { "n", "n", "rotr <REG_N>", "0100nnnn00000101",
+ "SET_SR_T (R[n] & 1);",
+ "R[n] = UR[n] >> 1;",
+ "R[n] |= (T << 31);",
+ },
+
+ { "", "", "rte", "0000000000101011",
+#if 0
+ /* SH-[12] */
+ "int tmp = PC;",
+ "nia = RLAT (R[15]) + 2;",
+ "R[15] += 4;",
+ "SET_SR (RLAT (R[15]) & 0x3f3);",
+ "R[15] += 4;",
+ "Delay_Slot (PC + 2);",
+#else
+ "nia = SPC;",
+ "SET_SR (SSR);",
+ "Delay_Slot (PC + 2);",
+#endif
+ },
+
+ { "", "", "rts", "0000000000001011",
+ "nia = PR;",
+ "Delay_Slot (PC + 2);",
+ },
+
+ { "", "", "sets", "0000000001011000",
+ "SET_SR_S (1);",
+ },
+
+ { "", "", "sett", "0000000000011000",
+ "SET_SR_T (1);",
+ },
+
+ { "n", "mn", "shad <REG_M>,<REG_N>", "0100nnnnmmmm1100",
+ "R[n] = (R[m] < 0) ? (R[n] >> ((-R[m])&0x1f)) : (R[n] << (R[m] & 0x1f));",
+ },
+
+ { "n", "n", "shal <REG_N>", "0100nnnn00100000",
+ "SET_SR_T (R[n] < 0);",
+ "R[n] <<= 1;",
+ },
+
+ { "n", "n", "shar <REG_N>", "0100nnnn00100001",
+ "SET_SR_T (R[n] & 1);",
+ "R[n] = R[n] >> 1;",
+ },
+
+ { "n", "mn", "shld <REG_M>,<REG_N>", "0100nnnnmmmm1101",
+ "R[n] = (R[m] < 0) ? (UR[n] >> ((-R[m])&0x1f)): (R[n] << (R[m] & 0x1f));",
+ },
+
+ { "n", "n", "shll <REG_N>", "0100nnnn00000000",
+ "SET_SR_T (R[n] < 0);",
+ "R[n] <<= 1;",
+ },
+
+ { "n", "n", "shll2 <REG_N>", "0100nnnn00001000",
+ "R[n] <<= 2;",
+ },
+ { "n", "n", "shll8 <REG_N>", "0100nnnn00011000",
+ "R[n] <<= 8;",
+ },
+ { "n", "n", "shll16 <REG_N>", "0100nnnn00101000",
+ "R[n] <<= 16;",
+ },
+
+ { "n", "n", "shlr <REG_N>", "0100nnnn00000001",
+ "SET_SR_T (R[n] & 1);",
+ "R[n] = UR[n] >> 1;",
+ },
+
+ { "n", "n", "shlr2 <REG_N>", "0100nnnn00001001",
+ "R[n] = UR[n] >> 2;",
+ },
+ { "n", "n", "shlr8 <REG_N>", "0100nnnn00011001",
+ "R[n] = UR[n] >> 8;",
+ },
+ { "n", "n", "shlr16 <REG_N>", "0100nnnn00101001",
+ "R[n] = UR[n] >> 16;",
+ },
+
+ { "", "", "sleep", "0000000000011011",
+ "trap (0xc3, R0, memory, maskl, maskw, little_endian);",
+ "nia = PC;",
+ },
+
+ { "n", "", "stc GBR,<REG_N>", "0000nnnn00010010",
+ "R[n] = GBR;",
+ },
+ { "n", "", "stc SR,<REG_N>", "0000nnnn00000010",
+ "R[n] = GET_SR ();",
+ },
+ { "n", "", "stc VBR,<REG_N>", "0000nnnn00100010",
+ "R[n] = VBR;",
+ },
+ { "n", "", "stc SSR,<REG_N>", "0000nnnn00110010",
+ "R[n] = SSR;",
+ },
+ { "n", "", "stc SPC,<REG_N>", "0000nnnn01000010",
+ "R[n] = SPC;",
+ },
+ { "n", "", "stc R0_BANK,<REG_N>", "0000nnnn10000010",
+ "R[n] = Rn_BANK (0);",
+ },
+ { "n", "", "stc R1_BANK,<REG_N>", "0000nnnn10010010",
+ "R[n] = Rn_BANK (1);",
+ },
+ { "n", "", "stc R2_BANK,<REG_N>", "0000nnnn10100010",
+ "R[n] = Rn_BANK (2);",
+ },
+ { "n", "", "stc R3_BANK,<REG_N>", "0000nnnn10110010",
+ "R[n] = Rn_BANK (3);",
+ },
+ { "n", "", "stc R4_BANK,<REG_N>", "0000nnnn11000010",
+ "R[n] = Rn_BANK (4);",
+ },
+ { "n", "", "stc R5_BANK,<REG_N>", "0000nnnn11010010",
+ "R[n] = Rn_BANK (5);",
+ },
+ { "n", "", "stc R6_BANK,<REG_N>", "0000nnnn11100010",
+ "R[n] = Rn_BANK (6);",
+ },
+ { "n", "", "stc R7_BANK,<REG_N>", "0000nnnn11110010",
+ "R[n] = Rn_BANK (7);",
+ },
+ { "n", "n", "stc.l GBR,@-<REG_N>", "0100nnnn00010011",
+ "MA (1);",
+ "R[n] -= 4;",
+ "WLAT (R[n], GBR);;",
+ },
+ { "n", "n", "stc.l SR,@-<REG_N>", "0100nnnn00000011",
+ "MA (1);",
+ "R[n] -= 4;",
+ "WLAT (R[n], GET_SR());",
+ },
+ { "n", "n", "stc.l VBR,@-<REG_N>", "0100nnnn00100011",
+ "MA (1);",
+ "R[n] -= 4;",
+ "WLAT (R[n], VBR);",
+ },
+ { "n", "n", "stc.l SSR,@-<REG_N>", "0100nnnn00110011",
+ "MA (1);",
+ "R[n] -= 4;",
+ "WLAT (R[n], SSR);",
+ },
+ { "n", "n", "stc.l SPC,@-<REG_N>", "0100nnnn01000011",
+ "MA (1);",
+ "R[n] -= 4;",
+ "WLAT (R[n], SPC);",
+ },
+ { "n", "", "stc R0_BANK,@-<REG_N>", "0100nnnn10000010",
+ "MA (1);",
+ "R[n] -= 4;",
+ "WLAT (R[n], Rn_BANK (0));",
+ },
+ { "n", "", "stc R1_BANK,@-<REG_N>", "0100nnnn10010010",
+ "MA (1);",
+ "R[n] -= 4;",
+ "WLAT (R[n], Rn_BANK (1));",
+ },
+ { "n", "", "stc R2_BANK,@-<REG_N>", "0100nnnn10100010",
+ "MA (1);",
+ "R[n] -= 4;",
+ "WLAT (R[n], Rn_BANK (2));",
+ },
+ { "n", "", "stc R3_BANK,@-<REG_N>", "0100nnnn10110010",
+ "MA (1);",
+ "R[n] -= 4;",
+ "WLAT (R[n], Rn_BANK (3));",
+ },
+ { "n", "", "stc R4_BANK,@-<REG_N>", "0100nnnn11000010",
+ "MA (1);",
+ "R[n] -= 4;",
+ "WLAT (R[n], Rn_BANK (4));",
+ },
+ { "n", "", "stc R5_BANK,@-<REG_N>", "0100nnnn11010010",
+ "MA (1);",
+ "R[n] -= 4;",
+ "WLAT (R[n], Rn_BANK (5));",
+ },
+ { "n", "", "stc R6_BANK,@-<REG_N>", "0100nnnn11100010",
+ "MA (1);",
+ "R[n] -= 4;",
+ "WLAT (R[n], Rn_BANK (6));",
+ },
+ { "n", "", "stc R7_BANK,@-<REG_N>", "0100nnnn11110010",
+ "MA (1);",
+ "R[n] -= 4;",
+ "WLAT (R[n], Rn_BANK (7));",
+ },
+
+ /* sh3e */
+ { "", "", "sts FPUL,<REG_N>", "0000nnnn01011010",
+ "R[n] = FPUL;",
+ },
+ /* sh3e */
+ { "", "", "sts.l FPUL,@-<REG_N>", "0100nnnn01010010",
+ "MA (1);",
+ "R[n] -= 4;",
+ "WLAT (R[n], FPUL);",
+ },
+ /* sh3e */
+ { "", "", "sts FPSCR,<REG_N>", "0000nnnn01101010",
+ "R[n] = GET_FPSCR ();",
+ },
+ /* sh3e */
+ { "", "", "sts.l FPSCR,@-<REG_N>", "0100nnnn01100010",
+ "MA (1);",
+ "R[n] -= 4;",
+ "WLAT (R[n], GET_FPSCR ());",
+ },
+
+ { "n", "", "sts MACH,<REG_N>", "0000nnnn00001010",
+ "R[n] = MACH;",
+ },
+ { "n", "", "sts MACL,<REG_N>", "0000nnnn00011010",
+ "R[n] = MACL;",
+ },
+ { "n", "", "sts PR,<REG_N>", "0000nnnn00101010",
+ "R[n] = PR;",
+ },
+ { "n", "n", "sts.l MACH,@-<REG_N>", "0100nnnn00000010",
+ "MA (1);",
+ "R[n] -= 4;",
+ "WLAT (R[n], MACH);",
+ },
+ { "n", "n", "sts.l MACL,@-<REG_N>", "0100nnnn00010010",
+ "MA (1);",
+ "R[n] -= 4;",
+ "WLAT (R[n], MACL);",
+ },
+ { "n", "n", "sts.l PR,@-<REG_N>", "0100nnnn00100010",
+ "MA (1);",
+ "R[n] -= 4;",
+ "WLAT (R[n], PR);",
+ },
+
+ { "n", "nm", "sub <REG_M>,<REG_N>", "0011nnnnmmmm1000",
+ "R[n] -= R[m];",
+ },
+
+ { "n", "nm", "subc <REG_M>,<REG_N>", "0011nnnnmmmm1010",
+ "ult = R[n] - T;",
+ "SET_SR_T (ult > R[n]);",
+ "R[n] = ult - R[m];",
+ "SET_SR_T (T || (R[n] > ult));",
+ },
+
+ { "n", "nm", "subv <REG_M>,<REG_N>", "0011nnnnmmmm1011",
+ "ult = R[n] - R[m];",
+ "SET_SR_T (((R[n] ^ R[m]) & (ult ^ R[n])) >> 31);",
+ "R[n] = ult;",
+ },
+
+ { "n", "nm", "swap.b <REG_M>,<REG_N>", "0110nnnnmmmm1000",
+ "R[n] = ((R[m] & 0xffff0000)",
+ " | ((R[m] << 8) & 0xff00)",
+ " | ((R[m] >> 8) & 0x00ff));",
+ },
+ { "n", "nm", "swap.w <REG_M>,<REG_N>", "0110nnnnmmmm1001",
+ "R[n] = (((R[m] << 16) & 0xffff0000)",
+ " | ((R[m] >> 16) & 0x00ffff));",
+ },
+
+ { "", "n", "tas.b @<REG_N>", "0100nnnn00011011",
+ "MA (1);",
+ "ult = RBAT(R[n]);",
+ "SET_SR_T (ult == 0);",
+ "WBAT(R[n],ult|0x80);",
+ },
+
+ { "0", "", "trapa #<imm>", "11000011i8*1....",
+#if 0
+ /* SH-[12] */
+ "long imm = 0xff & i;",
+ "if (i==0xc3)",
+ " PC-=2;",
+ "if (i<20||i==34||i==0xc3)",
+ " trap(i,R,memory,maskl,maskw,little_endian);",
+ "else {",
+ " R[15]-=4;",
+ " WLAT(R[15],GET_SR());",
+ " R[15]-=4;",
+ " WLAT(R[15],PC+2);",
+ " PC=RLAT(VBR+(imm<<2))-2;",
+ "}",
+#else
+ "if (i == 0xc3)",
+ " {",
+ " nia = PC;",
+ " trap (i, R, memory, maskl, maskw, little_endian);",
+ " }",
+ "else if (i < 20 || i==34 || i==0xc3)",
+ " trap (i, R, memory, maskl, maskw, little_endian);",
+ "else if (!SR_BL) {",
+ " /* FIXME: TRA = (imm << 2); */",
+ " SSR = GET_SR();",
+ " SPC = PC + 2;",
+ " SET_SR (GET_SR() | SR_MASK_MD | SR_MASK_BL | SR_MASK_RB);",
+ " /* FIXME: EXPEVT = 0x00000160; */",
+ " nia = VBR + 0x00000100;",
+ "}",
+#endif
+ },
+
+ { "", "mn", "tst <REG_M>,<REG_N>", "0010nnnnmmmm1000",
+ "SET_SR_T ((R[n] & R[m]) == 0);",
+ },
+ { "", "0", "tst #<imm>,R0", "11001000i8*1....",
+ "SET_SR_T ((R0 & i) == 0);",
+ },
+ { "", "0", "tst.b #<imm>,@(R0,GBR)", "11001100i8*1....",
+ "MA (1);",
+ "SET_SR_T ((RBAT (GBR+R0) & i) == 0);",
+ },
+
+ { "", "0", "xor #<imm>,R0", "11001010i8*1....",
+ "R0 ^= i;",
+ },
+ { "n", "mn", "xor <REG_M>,<REG_N>", "0010nnnnmmmm1010",
+ "R[n] ^= R[m];",
+ },
+ { "", "0", "xor.b #<imm>,@(R0,GBR)", "11001110i8*1....",
+ "MA (1);",
+ "ult = RBAT (GBR+R0);",
+ "ult ^= i;",
+ "WBAT (GBR + R0, ult);",
+ },
+
+ { "n", "nm", "xtrct <REG_M>,<REG_N>", "0010nnnnmmmm1101",
+ "R[n] = (((R[n] >> 16) & 0xffff)",
+ " | ((R[m] << 16) & 0xffff0000));",
+ },
+
+ {0, 0}};
+
+/* Tables of things to put into enums for sh-opc.h */
+static char *nibble_type_list[] =
+{
+ "HEX_0",
+ "HEX_1",
+ "HEX_2",
+ "HEX_3",
+ "HEX_4",
+ "HEX_5",
+ "HEX_6",
+ "HEX_7",
+ "HEX_8",
+ "HEX_9",
+ "HEX_A",
+ "HEX_B",
+ "HEX_C",
+ "HEX_D",
+ "HEX_E",
+ "HEX_F",
+ "REG_N",
+ "REG_M",
+ "BRANCH_12",
+ "BRANCH_8",
+ "DISP_8",
+ "DISP_4",
+ "IMM_4",
+ "IMM_4BY2",
+ "IMM_4BY4",
+ "PCRELIMM_8BY2",
+ "PCRELIMM_8BY4",
+ "IMM_8",
+ "IMM_8BY2",
+ "IMM_8BY4",
+ 0
+};
+static
+char *arg_type_list[] =
+{
+ "A_END",
+ "A_BDISP12",
+ "A_BDISP8",
+ "A_DEC_M",
+ "A_DEC_N",
+ "A_DISP_GBR",
+ "A_DISP_PC",
+ "A_DISP_REG_M",
+ "A_DISP_REG_N",
+ "A_GBR",
+ "A_IMM",
+ "A_INC_M",
+ "A_INC_N",
+ "A_IND_M",
+ "A_IND_N",
+ "A_IND_R0_REG_M",
+ "A_IND_R0_REG_N",
+ "A_MACH",
+ "A_MACL",
+ "A_PR",
+ "A_R0",
+ "A_R0_GBR",
+ "A_REG_M",
+ "A_REG_N",
+ "A_SR",
+ "A_VBR",
+ "A_SSR",
+ "A_SPC",
+ 0,
+};
+
+static void
+make_enum_list (name, s)
+ char *name;
+ char **s;
+{
+ int i = 1;
+ printf ("typedef enum {\n");
+ while (*s)
+ {
+ printf ("\t%s,\n", *s);
+ s++;
+ i++;
+ }
+ printf ("} %s;\n", name);
+}
+
+static int
+qfunc (a, b)
+ op *a;
+ op *b;
+{
+ char bufa[9];
+ char bufb[9];
+ memcpy (bufa, a->code, 4);
+ memcpy (bufa + 4, a->code + 12, 4);
+ bufa[8] = 0;
+
+ memcpy (bufb, b->code, 4);
+ memcpy (bufb + 4, b->code + 12, 4);
+ bufb[8] = 0;
+ return (strcmp (bufa, bufb));
+}
+
+static void
+sorttab ()
+{
+ op *p = tab;
+ int len = 0;
+
+ while (p->name)
+ {
+ p++;
+ len++;
+ }
+ qsort (tab, len, sizeof (*p), qfunc);
+}
+
+static void
+printonmatch (ptr, a, rep)
+ char **ptr;
+ char *a;
+ char *rep;
+{
+ int l = strlen (a);
+ if (strncmp (*ptr, a, l) == 0)
+ {
+ printf ("%s", rep);
+ *ptr += l;
+ if (**ptr)
+ printf (",");
+ }
+}
+
+
+static
+void
+think (o)
+ op *o;
+{
+ char *n;
+ char *p;
+
+ printf ("{\"");
+ n = o->name;
+ while (*n && *n != ' ')
+ {
+ printf ("%c", *n);
+ n++;
+ }
+ printf ("\",{");
+
+ p = n;
+
+ if (!*p)
+ {
+ printf ("0");
+ }
+ while (*p)
+ {
+ while (*p == ',' || *p == ' ')
+ p++;
+ printonmatch (&p, "#<imm>", "A_IMM");
+ printonmatch (&p, "R0", "A_R0");
+ printonmatch (&p, "<REG_N>", "A_REG_N");
+ printonmatch (&p, "@<REG_N>+", "A_INC_N");
+ printonmatch (&p, "@<REG_N>", "A_IND_N");
+ printonmatch (&p, "@-<REG_N>", "A_DEC_N");
+ printonmatch (&p, "<REG_M>", " A_REG_M");
+ printonmatch (&p, "@<REG_M>+", "A_INC_M");
+ printonmatch (&p, "@<REG_M>", "A_IND_M");
+ printonmatch (&p, "@-<REG_M>", "A_DEC_M");
+ printonmatch (&p, "@(<disp>,PC)", "A_DISP_PC");
+ printonmatch (&p, "@(<disp>,<REG_M>)", "A_DISP_REG_M");
+ printonmatch (&p, "@(<disp>,<REG_N>)", "A_DISP_REG_N");
+ printonmatch (&p, "@(R0,<REG_N>)", "A_IND_R0_REG_N");
+ printonmatch (&p, "@(R0,<REG_M>)", "A_IND_R0_REG_M");
+ printonmatch (&p, "@(<disp>,GBR)", "A_DISP_GBR");
+ printonmatch (&p, "@(R0,GBR)", "A_R0_GBR");
+ printonmatch (&p, "<bdisp8>", "A_BDISP8");
+ printonmatch (&p, "<bdisp12>", "A_BDISP12");
+ printonmatch (&p, "SR", "A_SR");
+ printonmatch (&p, "GBR", "A_GBR");
+ printonmatch (&p, "VBR", "A_VBR");
+ printonmatch (&p, "SSR", "A_SSR");
+ printonmatch (&p, "SPC", "A_SPC");
+ printonmatch (&p, "MACH", "A_MACH");
+ printonmatch (&p, "MACL", "A_MACL");
+ printonmatch (&p, "PR", "A_PR");
+
+ }
+ printf ("},{");
+
+ p = o->code;
+ while (*p)
+ {
+ printonmatch (&p, "0000", "HEX_0");
+ printonmatch (&p, "0001", "HEX_1");
+ printonmatch (&p, "0010", "HEX_2");
+ printonmatch (&p, "0011", "HEX_3");
+ printonmatch (&p, "0100", "HEX_4");
+ printonmatch (&p, "0101", "HEX_5");
+ printonmatch (&p, "0110", "HEX_6");
+ printonmatch (&p, "0111", "HEX_7");
+
+ printonmatch (&p, "1000", "HEX_8");
+ printonmatch (&p, "1001", "HEX_9");
+ printonmatch (&p, "1010", "HEX_A");
+ printonmatch (&p, "1011", "HEX_B");
+ printonmatch (&p, "1100", "HEX_C");
+ printonmatch (&p, "1101", "HEX_D");
+ printonmatch (&p, "1110", "HEX_E");
+ printonmatch (&p, "1111", "HEX_F");
+ printonmatch (&p, "i8*1....", "IMM_8");
+ printonmatch (&p, "i4*1", "IMM_4");
+ printonmatch (&p, "i8p4....", "PCRELIMM_8BY4");
+ printonmatch (&p, "i8p2....", "PCRELIMM_8BY2");
+ printonmatch (&p, "i8*2....", "IMM_8BY2");
+ printonmatch (&p, "i4*2", "IMM_4BY2");
+ printonmatch (&p, "i8*4....", "IMM_8BY4");
+ printonmatch (&p, "i4*4", "IMM_4BY4");
+ printonmatch (&p, "i12.........", "BRANCH_12");
+ printonmatch (&p, "i8p1....", "BRANCH_8");
+ printonmatch (&p, "nnnn", "REG_N");
+ printonmatch (&p, "mmmm", "REG_M");
+
+ }
+ printf ("}},\n");
+}
+
+static void
+gengastab ()
+{
+ op *p;
+ sorttab ();
+ for (p = tab; p->name; p++)
+ {
+ printf ("%s %-30s\n", p->code, p->name);
+ }
+
+
+}
+
+
+static void
+genopc ()
+{
+ op *p;
+ make_enum_list ("sh_nibble_type", nibble_type_list);
+ make_enum_list ("sh_arg_type", arg_type_list);
+
+ printf ("typedef struct {\n");
+ printf ("char *name;\n");
+ printf ("sh_arg_type arg[3];\n");
+ printf ("sh_nibble_type nibbles[4];\n");
+ printf ("} sh_opcode_info;\n");
+ printf ("#ifdef DEFINE_TABLE\n");
+ printf ("sh_opcode_info sh_table[]={\n");
+ for (p = tab; p->name; p++)
+ {
+ printf ("\n/* %s %-20s*/", p->code, p->name);
+ think (p);
+ }
+ printf ("0};\n");
+ printf ("#endif\n");
+}
+
+
+
+
+
+
+/* Convert a string of 4 binary digits into an int */
+
+static
+int
+bton (s)
+ char *s;
+
+{
+ int n = 0;
+ int v = 8;
+ while (v)
+ {
+ if (*s == '1')
+ n |= v;
+ v >>= 1;
+ s++;
+ }
+ return n;
+}
+
+static unsigned char table[1 << 16];
+
+/* Take an opcode expand all varying fields in it out and fill all the
+ right entries in 'table' with the opcode index*/
+
+static void
+expand_opcode (shift, val, i, s)
+ int shift;
+ int val;
+ int i;
+ char *s;
+{
+ int j;
+
+ if (*s == 0)
+ {
+ table[val] = i;
+ }
+ else
+ {
+ switch (s[0])
+ {
+
+ case '0':
+ case '1':
+ {
+
+ int n = bton (s);
+ if (n >= 0)
+ {
+ expand_opcode (shift - 4, val | (n << shift), i, s + 4);
+ }
+ break;
+ }
+ case 'n':
+ case 'm':
+ for (j = 0; j < 16; j++)
+ {
+ expand_opcode (shift - 4, val | (j << shift), i, s + 4);
+
+ }
+ break;
+
+ default:
+ for (j = 0; j < (1 << (shift + 4)); j++)
+ {
+ table[val | j] = i;
+ }
+ }
+ }
+}
+
+/* Print the jump table used to index an opcode into a switch
+ statement entry. */
+
+static void
+dumptable ()
+{
+ int lump = 256;
+ int online = 16;
+
+ int i = 0;
+
+ while (i < 1 << 16)
+ {
+ int j = 0;
+
+ printf ("unsigned char sh_jump_table%x[%d]={\n", i, lump);
+
+ while (j < lump)
+ {
+ int k = 0;
+ while (k < online)
+ {
+ printf ("%2d", table[i + j + k]);
+ if (j + k < lump)
+ printf (",");
+
+ k++;
+ }
+ j += k;
+ printf ("\n");
+ }
+ i += j;
+ printf ("};\n");
+ }
+
+}
+
+
+static void
+filltable ()
+{
+ op *p;
+ int index = 1;
+
+ sorttab ();
+ for (p = tab; p->name; p++)
+ {
+ p->index = index++;
+ expand_opcode (12, 0, p->index, p->code);
+ }
+}
+
+static void
+gensim ()
+{
+ op *p;
+ int j;
+
+ printf ("{\n");
+ printf (" switch (jump_table[iword]) {\n");
+
+ for (p = tab; p->name; p++)
+ {
+ int sextbit = -1;
+ int needm = 0;
+ int needn = 0;
+
+ char *s = p->code;
+
+ printf (" /* %s %s */\n", p->name, p->code);
+ printf (" case %d: \n", p->index);
+
+ printf (" {\n");
+ while (*s)
+ {
+ switch (*s)
+ {
+ case '0':
+ case '1':
+ case '.':
+ s += 4;
+ break;
+ case 'n':
+ printf (" int n = (iword >>8) & 0xf;\n");
+ needn = 1;
+ s += 4;
+ break;
+ case 'm':
+ printf (" int m = (iword >>4) & 0xf;\n");
+ needm = 1;
+ s += 4;
+
+ break;
+
+ case 'i':
+ printf (" int i = (iword & 0x");
+
+ switch (s[1])
+ {
+ case '4':
+ printf ("f");
+ break;
+ case '8':
+ printf ("ff");
+ break;
+ case '1':
+ sextbit = 12;
+
+ printf ("fff");
+ break;
+ }
+ printf (")");
+
+ switch (s[3])
+ {
+ case '1':
+ break;
+ case '2':
+ printf ("<<1");
+ break;
+ case '4':
+ printf ("<<2");
+ break;
+ }
+ printf (";\n");
+ s += 4;
+ }
+ }
+ if (sextbit > 0)
+ {
+ printf (" i = (i ^ (1<<%d))-(1<<%d);\n",
+ sextbit - 1, sextbit - 1);
+ }
+
+ if (needm && needn)
+ printf (" TB(m,n);\n");
+ else if (needm)
+ printf (" TL(m);\n");
+ else if (needn)
+ printf (" TL(n);\n");
+
+ {
+ /* Do the refs */
+ char *r;
+ for (r = p->refs; *r; r++)
+ {
+ if (*r == '0') printf(" CREF(0);\n");
+ if (*r == 'n') printf(" CREF(n);\n");
+ if (*r == 'm') printf(" CREF(m);\n");
+ }
+ }
+
+ printf (" {\n");
+ for (j = 0; j < MAX_NR_STUFF; j++)
+ {
+ if (p->stuff[j])
+ {
+ printf (" %s\n", p->stuff[j]);
+ }
+ }
+ printf (" }\n");
+
+ {
+ /* Do the defs */
+ char *r;
+ for (r = p->defs; *r; r++)
+ {
+ if (*r == '0') printf(" CDEF(0);\n");
+ if (*r == 'n') printf(" CDEF(n);\n");
+ if (*r == 'm') printf(" CDEF(m);\n");
+ }
+ }
+
+ printf (" break;\n");
+ printf (" }\n");
+ }
+ printf (" default:\n");
+ printf (" {\n");
+ printf (" saved_state.asregs.exception = SIGILL;\n");
+ printf (" }\n");
+ printf (" }\n");
+ printf ("}\n");
+}
+
+
+static void
+gendefines ()
+{
+ op *p;
+ filltable();
+ for (p = tab; p->name; p++)
+ {
+ char *s = p->name;
+ printf ("#define OPC_");
+ while (*s) {
+ if (isupper(*s))
+ *s = tolower(*s);
+ if (isalpha(*s)) printf("%c", *s);
+ if (*s == ' ') printf("_");
+ if (*s == '@') printf("ind_");
+ if (*s == ',') printf("_");
+ s++;
+ }
+ printf(" %d\n",p->index);
+ }
+}
+
+int
+main (ac, av)
+ int ac;
+ char **av;
+{
+ /* verify the table before anything else */
+ {
+ op *p;
+ for (p = tab; p->name; p++)
+ {
+ /* check that the code field contains 16 bits */
+ if (strlen (p->code) != 16)
+ {
+ fprintf (stderr, "Code `%s' length wrong (%d) for `%s'\n",
+ p->code, strlen (p->code), p->name);
+ abort ();
+ }
+ }
+ }
+
+ /* now generate the requested data */
+ if (ac > 1)
+ {
+ if (strcmp (av[1], "-t") == 0)
+ {
+ gengastab ();
+ }
+ else if (strcmp (av[1], "-d") == 0)
+ {
+ gendefines ();
+ }
+ else if (strcmp (av[1], "-s") == 0)
+ {
+ filltable ();
+ dumptable ();
+
+ }
+ else if (strcmp (av[1], "-x") == 0)
+ {
+ filltable ();
+ gensim ();
+ }
+ }
+ else
+ {
+ genopc ();
+ }
+ return 0;
+}
diff --git a/sim/sh/interp.c b/sim/sh/interp.c
new file mode 100644
index 0000000..bd26967
--- /dev/null
+++ b/sim/sh/interp.c
@@ -0,0 +1,1414 @@
+/* Simulator for the Hitachi SH architecture.
+
+ Written by Steve Chamberlain of Cygnus Support.
+ sac@cygnus.com
+
+ This file is part of SH sim
+
+
+ THIS SOFTWARE IS NOT COPYRIGHTED
+
+ Cygnus offers the following for use in the public domain. Cygnus
+ makes no warranty with regard to the software or it's performance
+ and the user accepts the software "AS IS" with all faults.
+
+ CYGNUS DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD TO
+ THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+
+*/
+
+#include "config.h"
+
+#include <signal.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include "sysdep.h"
+#include "bfd.h"
+#include "callback.h"
+#include "remote-sim.h"
+
+/* This file is local - if newlib changes, then so should this. */
+#include "syscall.h"
+
+#include <math.h>
+
+#ifdef _WIN32
+#include <float.h> /* Needed for _isnan() */
+#define isnan _isnan
+#endif
+
+#ifndef SIGBUS
+#define SIGBUS SIGSEGV
+#endif
+
+#ifndef SIGQUIT
+#define SIGQUIT SIGTERM
+#endif
+
+#ifndef SIGTRAP
+#define SIGTRAP 5
+#endif
+
+#define O_RECOMPILE 85
+#define DEFINE_TABLE
+#define DISASSEMBLER_TABLE
+
+typedef union
+{
+
+ struct
+ {
+ int pad_dummy;
+ int regs[16];
+ int pc;
+ int pr;
+
+ int gbr;
+ int vbr;
+ int mach;
+ int macl;
+
+ int sr;
+
+ int fpul;
+
+ int fpscr;
+
+ /* sh3e */
+ union fregs_u
+ {
+ float f[16];
+ double d[8];
+ int i[16];
+ }
+ fregs;
+
+ int ssr;
+ int spc;
+ /* sh3 */
+ int bank[2][8];
+
+ int ticks;
+ int stalls;
+ int memstalls;
+ int cycles;
+ int insts;
+
+ int prevlock;
+ int thislock;
+ int exception;
+
+ int end_of_registers;
+
+ int msize;
+#define PROFILE_FREQ 1
+#define PROFILE_SHIFT 2
+ int profile;
+ unsigned short *profile_hist;
+ unsigned char *memory;
+ }
+ asregs;
+ int asints[40];
+} saved_state_type;
+
+saved_state_type saved_state;
+
+
+/* These variables are at file scope so that functions other than
+ sim_resume can use the fetch/store macros */
+
+static int target_little_endian;
+static int host_little_endian;
+
+#if 1
+static int maskl = ~0;
+static int maskw = ~0;
+#endif
+
+static SIM_OPEN_KIND sim_kind;
+static char *myname;
+
+
+/* Short hand definitions of the registers */
+
+#define SBIT(x) ((x)&sbit)
+#define R0 saved_state.asregs.regs[0]
+#define Rn saved_state.asregs.regs[n]
+#define Rm saved_state.asregs.regs[m]
+#define UR0 (unsigned int)(saved_state.asregs.regs[0])
+#define UR (unsigned int)R
+#define UR (unsigned int)R
+#define SR0 saved_state.asregs.regs[0]
+#define GBR saved_state.asregs.gbr
+#define VBR saved_state.asregs.vbr
+#define SSR saved_state.asregs.ssr
+#define SPC saved_state.asregs.spc
+#define MACH saved_state.asregs.mach
+#define MACL saved_state.asregs.macl
+#define FPUL saved_state.asregs.fpul
+
+#define PC pc
+
+
+
+/* Alternate bank of registers r0-r6 */
+
+/* Note: code controling SR handles flips between BANK0 and BANK1 */
+#define Rn_BANK(n) (saved_state.asregs.bank[!SR_RB][(n)])
+#define SET_Rn_BANK(n, EXP) do { saved_state.asregs.bank[!SR_RB][(n)] = (EXP); } while (0)
+
+
+/* Manipulate SR */
+
+#define SR_MASK_M (1 << 9)
+#define SR_MASK_Q (1 << 8)
+#define SR_MASK_I (0xf << 4)
+#define SR_MASK_S (1 << 1)
+#define SR_MASK_T (1 << 0)
+
+#define SR_MASK_BL (1 << 28)
+#define SR_MASK_RB (1 << 29)
+#define SR_MASK_MD (1 << 30)
+
+#define M ((saved_state.asregs.sr & SR_MASK_M) != 0)
+#define Q ((saved_state.asregs.sr & SR_MASK_Q) != 0)
+#define S ((saved_state.asregs.sr & SR_MASK_S) != 0)
+#define T ((saved_state.asregs.sr & SR_MASK_T) != 0)
+
+#define SR_BL ((saved_state.asregs.sr & SR_MASK_BL) != 0)
+#define SR_RB ((saved_state.asregs.sr & SR_MASK_RB) != 0)
+#define SR_MD ((saved_state.asregs.sr & SR_MASK_MD) != 0)
+
+/* Note: don't use this for privileged bits */
+#define SET_SR_BIT(EXP, BIT) \
+do { \
+ if ((EXP) & 1) \
+ saved_state.asregs.sr |= (BIT); \
+ else \
+ saved_state.asregs.sr &= ~(BIT); \
+} while (0)
+
+#define SET_SR_M(EXP) SET_SR_BIT ((EXP), SR_MASK_M)
+#define SET_SR_Q(EXP) SET_SR_BIT ((EXP), SR_MASK_Q)
+#define SET_SR_S(EXP) SET_SR_BIT ((EXP), SR_MASK_S)
+#define SET_SR_T(EXP) SET_SR_BIT ((EXP), SR_MASK_T)
+
+#define GET_SR() (saved_state.asregs.sr - 0)
+#define SET_SR(x) set_sr (x)
+static void
+set_sr (new_sr)
+ int new_sr;
+{
+ /* do we need to swap banks */
+ int old_gpr = (SR_MD ? !SR_RB : 0);
+ int new_gpr = ((new_sr & SR_MASK_MD)
+ ? (new_sr & SR_MASK_RB) == 0
+ : 0);
+ if (old_gpr != new_gpr)
+ {
+ int i;
+ for (i = 0; i < 8; i++)
+ {
+ saved_state.asregs.bank[old_gpr][i] = saved_state.asregs.regs[i];
+ saved_state.asregs.regs[i] = saved_state.asregs.bank[new_gpr][i];
+ }
+ }
+}
+
+
+/* Manipulate FPSCR */
+
+#define set_fpscr1(x)
+#define SET_FPSCR(x) (saved_state.asregs.fpscr = (x))
+#define GET_FPSCR() (saved_state.asregs.fpscr)
+
+
+int
+fail ()
+{
+ abort ();
+}
+
+/* This function exists solely for the purpose of setting a breakpoint to
+ catch simulated bus errors when running the simulator under GDB. */
+
+void
+bp_holder ()
+{
+}
+
+/* FIXME: sim_resume should be renamed to sim_engine_run. sim_resume
+ being implemented by ../common/sim_resume.c and the below should
+ make a call to sim_engine_halt */
+
+#define BUSERROR(addr, mask) \
+ if (addr & ~mask) { saved_state.asregs.exception = SIGBUS; bp_holder (); }
+
+/* Define this to enable register lifetime checking.
+ The compiler generates "add #0,rn" insns to mark registers as invalid,
+ the simulator uses this info to call fail if it finds a ref to an invalid
+ register before a def
+
+ #define PARANOID
+*/
+
+#ifdef PARANOID
+int valid[16];
+#define CREF(x) if(!valid[x]) fail();
+#define CDEF(x) valid[x] = 1;
+#define UNDEF(x) valid[x] = 0;
+#else
+#define CREF(x)
+#define CDEF(x)
+#define UNDEF(x)
+#endif
+
+static void parse_and_set_memory_size PARAMS ((char *str));
+
+static int IOMEM PARAMS ((int addr, int write, int value));
+
+static host_callback *callback;
+
+
+
+/* Floating point registers */
+
+#define FI(n) (saved_state.asregs.fregs.i[(n)])
+#define FR(n) (saved_state.asregs.fregs.f[(n)])
+
+#define SET_FI(n,EXP) (saved_state.asregs.fregs.i[(n)] = (EXP))
+#define SET_FR(n,EXP) (saved_state.asregs.fregs.f[(n)] = (EXP))
+
+#define FP_OP(n, OP, m) (SET_FR(n, (FR(n) OP FR(m))))
+#define FP_UNARY(n, OP) (SET_FR(n, (OP (FR(n)))))
+#define FP_CMP(n, OP, m) SET_SR_T(FR(n) OP FR(m))
+
+
+
+static void INLINE
+wlat_little (memory, x, value, maskl)
+ unsigned char *memory;
+{
+ int v = value;
+ unsigned char *p = memory + ((x) & maskl);
+ BUSERROR(x, maskl);
+ p[3] = v >> 24;
+ p[2] = v >> 16;
+ p[1] = v >> 8;
+ p[0] = v;
+}
+
+static void INLINE
+wwat_little (memory, x, value, maskw)
+ unsigned char *memory;
+{
+ int v = value;
+ unsigned char *p = memory + ((x) & maskw);
+ BUSERROR(x, maskw);
+
+ p[1] = v >> 8;
+ p[0] = v;
+}
+
+static void INLINE
+wbat_any (memory, x, value, maskb)
+ unsigned char *memory;
+{
+ unsigned char *p = memory + (x & maskb);
+ if (x > 0x5000000)
+ IOMEM (x, 1, value);
+ BUSERROR(x, maskb);
+
+ p[0] = value;
+}
+
+static void INLINE
+wlat_big (memory, x, value, maskl)
+ unsigned char *memory;
+{
+ int v = value;
+ unsigned char *p = memory + ((x) & maskl);
+ BUSERROR(x, maskl);
+
+ p[0] = v >> 24;
+ p[1] = v >> 16;
+ p[2] = v >> 8;
+ p[3] = v;
+}
+
+static void INLINE
+wwat_big (memory, x, value, maskw)
+ unsigned char *memory;
+{
+ int v = value;
+ unsigned char *p = memory + ((x) & maskw);
+ BUSERROR(x, maskw);
+
+ p[0] = v >> 8;
+ p[1] = v;
+}
+
+static void INLINE
+wbat_big (memory, x, value, maskb)
+ unsigned char *memory;
+{
+ unsigned char *p = memory + (x & maskb);
+ BUSERROR(x, maskb);
+
+ if (x > 0x5000000)
+ IOMEM (x, 1, value);
+ p[0] = value;
+}
+
+/* Read functions */
+
+static int INLINE
+rlat_little (memory, x, maskl)
+ unsigned char *memory;
+{
+ unsigned char *p = memory + ((x) & maskl);
+ BUSERROR(x, maskl);
+
+ return (p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0];
+}
+
+static int INLINE
+rwat_little (memory, x, maskw)
+ unsigned char *memory;
+{
+ unsigned char *p = memory + ((x) & maskw);
+ BUSERROR(x, maskw);
+
+ return (p[1] << 8) | p[0];
+}
+
+static int INLINE
+rbat_any (memory, x, maskb)
+ unsigned char *memory;
+{
+ unsigned char *p = memory + ((x) & maskb);
+ BUSERROR(x, maskb);
+
+ return p[0];
+}
+
+static int INLINE
+rlat_big (memory, x, maskl)
+ unsigned char *memory;
+{
+ unsigned char *p = memory + ((x) & maskl);
+ BUSERROR(x, maskl);
+
+ return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
+}
+
+static int INLINE
+rwat_big (memory, x, maskw)
+ unsigned char *memory;
+{
+ unsigned char *p = memory + ((x) & maskw);
+ BUSERROR(x, maskw);
+
+ return (p[0] << 8) | p[1];
+}
+
+#define RWAT(x) (little_endian ? rwat_little(memory, x, maskw): rwat_big(memory, x, maskw))
+#define RLAT(x) (little_endian ? rlat_little(memory, x, maskl): rlat_big(memory, x, maskl))
+#define RBAT(x) (rbat_any (memory, x, maskb))
+#define WWAT(x,v) (little_endian ? wwat_little(memory, x, v, maskw): wwat_big(memory, x, v, maskw))
+#define WLAT(x,v) (little_endian ? wlat_little(memory, x, v, maskl): wlat_big(memory, x, v, maskl))
+#define WBAT(x,v) (wbat_any (memory, x, v, maskb))
+
+#define RUWAT(x) (RWAT(x) & 0xffff)
+#define RSWAT(x) ((short)(RWAT(x)))
+#define RSBAT(x) (SEXT(RBAT(x)))
+
+
+
+
+#define MA(n) do { memstalls += (((pc & 3) != 0) ? (n) : ((n) - 1)); } while (0)
+
+#define SEXT(x) (((x & 0xff) ^ (~0x7f))+0x80)
+#define SEXT12(x) (((x & 0xfff) ^ 0x800) - 0x800)
+#define SEXTW(y) ((int)((short)y))
+
+#define Delay_Slot(TEMPPC) iword = RUWAT(TEMPPC); goto top;
+
+int empty[16];
+
+#define L(x) thislock = x;
+#define TL(x) if ((x) == prevlock) stalls++;
+#define TB(x,y) if ((x) == prevlock || (y)==prevlock) stalls++;
+
+#if defined(__GO32__) || defined(_WIN32)
+int sim_memory_size = 19;
+#else
+int sim_memory_size = 24;
+#endif
+
+static int sim_profile_size = 17;
+static int nsamples;
+
+#undef TB
+#define TB(x,y)
+
+#define SMR1 (0x05FFFEC8) /* Channel 1 serial mode register */
+#define BRR1 (0x05FFFEC9) /* Channel 1 bit rate register */
+#define SCR1 (0x05FFFECA) /* Channel 1 serial control register */
+#define TDR1 (0x05FFFECB) /* Channel 1 transmit data register */
+#define SSR1 (0x05FFFECC) /* Channel 1 serial status register */
+#define RDR1 (0x05FFFECD) /* Channel 1 receive data register */
+
+#define SCI_RDRF 0x40 /* Recieve data register full */
+#define SCI_TDRE 0x80 /* Transmit data register empty */
+
+static int
+IOMEM (addr, write, value)
+ int addr;
+ int write;
+ int value;
+{
+ if (write)
+ {
+ switch (addr)
+ {
+ case TDR1:
+ if (value != '\r')
+ {
+ putchar (value);
+ fflush (stdout);
+ }
+ break;
+ }
+ }
+ else
+ {
+ switch (addr)
+ {
+ case RDR1:
+ return getchar ();
+ }
+ }
+ return 0;
+}
+
+static int
+get_now ()
+{
+ return time ((long *) 0);
+}
+
+static int
+now_persec ()
+{
+ return 1;
+}
+
+static FILE *profile_file;
+
+static void
+swap (memory, n)
+ unsigned char *memory;
+ int n;
+{
+ int little_endian = target_little_endian;
+ WLAT (0, n);
+}
+
+static void
+swap16 (memory, n)
+ unsigned char *memory;
+ int n;
+{
+ int little_endian = target_little_endian;
+ WWAT (0, n);
+}
+
+static void
+swapout (n)
+ int n;
+{
+ if (profile_file)
+ {
+ char b[4];
+ swap (b, n);
+ fwrite (b, 4, 1, profile_file);
+ }
+}
+
+static void
+swapout16 (n)
+ int n;
+{
+ char b[4];
+ swap16 (b, n);
+ fwrite (b, 2, 1, profile_file);
+}
+
+/* Turn a pointer in a register into a pointer into real memory. */
+
+static char *
+ptr (x)
+ int x;
+{
+ return (char *) (x + saved_state.asregs.memory);
+}
+
+/* Simulate a monitor trap, put the result into r0 and errno into r1 */
+
+static void
+trap (i, regs, memory, maskl, maskw, little_endian)
+ int i;
+ int *regs;
+ unsigned char *memory;
+{
+ switch (i)
+ {
+ case 1:
+ printf ("%c", regs[0]);
+ break;
+ case 2:
+ saved_state.asregs.exception = SIGQUIT;
+ break;
+ case 3: /* FIXME: for backwards compat, should be removed */
+ case 34:
+ {
+ extern int errno;
+ int perrno = errno;
+ errno = 0;
+
+ switch (regs[4])
+ {
+
+#if !defined(__GO32__) && !defined(_WIN32)
+ case SYS_fork:
+ regs[0] = fork ();
+ break;
+ case SYS_execve:
+ regs[0] = execve (ptr (regs[5]), (char **)ptr (regs[6]), (char **)ptr (regs[7]));
+ break;
+ case SYS_execv:
+ regs[0] = execve (ptr (regs[5]),(char **) ptr (regs[6]), 0);
+ break;
+ case SYS_pipe:
+ {
+ char *buf;
+ int host_fd[2];
+
+ buf = ptr (regs[5]);
+
+ regs[0] = pipe (host_fd);
+
+ WLAT (buf, host_fd[0]);
+ buf += 4;
+ WLAT (buf, host_fd[1]);
+ }
+ break;
+
+ case SYS_wait:
+ regs[0] = wait (ptr (regs[5]));
+ break;
+#endif
+
+ case SYS_read:
+ regs[0] = callback->read (callback, regs[5], ptr (regs[6]), regs[7]);
+ break;
+ case SYS_write:
+ if (regs[5] == 1)
+ regs[0] = (int)callback->write_stdout (callback, ptr(regs[6]), regs[7]);
+ else
+ regs[0] = (int)callback->write (callback, regs[5], ptr (regs[6]), regs[7]);
+ break;
+ case SYS_lseek:
+ regs[0] = callback->lseek (callback,regs[5], regs[6], regs[7]);
+ break;
+ case SYS_close:
+ regs[0] = callback->close (callback,regs[5]);
+ break;
+ case SYS_open:
+ regs[0] = callback->open (callback,ptr (regs[5]), regs[6]);
+ break;
+ case SYS_exit:
+ /* EXIT - caller can look in r5 to work out the reason */
+ saved_state.asregs.exception = SIGQUIT;
+ regs[0] = regs[5];
+ break;
+
+ case SYS_stat: /* added at hmsi */
+ /* stat system call */
+ {
+ struct stat host_stat;
+ char *buf;
+
+ regs[0] = stat (ptr (regs[5]), &host_stat);
+
+ buf = ptr (regs[6]);
+
+ WWAT (buf, host_stat.st_dev);
+ buf += 2;
+ WWAT (buf, host_stat.st_ino);
+ buf += 2;
+ WLAT (buf, host_stat.st_mode);
+ buf += 4;
+ WWAT (buf, host_stat.st_nlink);
+ buf += 2;
+ WWAT (buf, host_stat.st_uid);
+ buf += 2;
+ WWAT (buf, host_stat.st_gid);
+ buf += 2;
+ WWAT (buf, host_stat.st_rdev);
+ buf += 2;
+ WLAT (buf, host_stat.st_size);
+ buf += 4;
+ WLAT (buf, host_stat.st_atime);
+ buf += 4;
+ WLAT (buf, 0);
+ buf += 4;
+ WLAT (buf, host_stat.st_mtime);
+ buf += 4;
+ WLAT (buf, 0);
+ buf += 4;
+ WLAT (buf, host_stat.st_ctime);
+ buf += 4;
+ WLAT (buf, 0);
+ buf += 4;
+ WLAT (buf, 0);
+ buf += 4;
+ WLAT (buf, 0);
+ buf += 4;
+ }
+ break;
+
+#ifndef _WIN32
+ case SYS_chown:
+ regs[0] = chown (ptr (regs[5]), regs[6], regs[7]);
+ break;
+#endif /* _WIN32 */
+ case SYS_chmod:
+ regs[0] = chmod (ptr (regs[5]), regs[6]);
+ break;
+ case SYS_utime:
+ /* Cast the second argument to void *, to avoid type mismatch
+ if a prototype is present. */
+ regs[0] = utime (ptr (regs[5]), (void *) ptr (regs[6]));
+ break;
+ default:
+ abort ();
+ }
+ regs[1] = callback->get_errno (callback);
+ errno = perrno;
+ }
+ break;
+
+ case 0xc3:
+ case 255:
+ saved_state.asregs.exception = SIGTRAP;
+ break;
+ }
+
+}
+
+void
+control_c (sig, code, scp, addr)
+ int sig;
+ int code;
+ char *scp;
+ char *addr;
+{
+ saved_state.asregs.exception = SIGINT;
+}
+
+static int
+div1 (R, iRn2, iRn1/*, T*/)
+ int *R;
+ int iRn1;
+ int iRn2;
+ /* int T;*/
+{
+ unsigned long tmp0;
+ unsigned char old_q, tmp1;
+
+ old_q = Q;
+ SET_SR_Q ((unsigned char) ((0x80000000 & R[iRn1]) != 0));
+ R[iRn1] <<= 1;
+ R[iRn1] |= (unsigned long) T;
+
+ switch (old_q)
+ {
+ case 0:
+ switch (M)
+ {
+ case 0:
+ tmp0 = R[iRn1];
+ R[iRn1] -= R[iRn2];
+ tmp1 = (R[iRn1] > tmp0);
+ switch (Q)
+ {
+ case 0:
+ SET_SR_Q (tmp1);
+ break;
+ case 1:
+ SET_SR_Q ((unsigned char) (tmp1 == 0));
+ break;
+ }
+ break;
+ case 1:
+ tmp0 = R[iRn1];
+ R[iRn1] += R[iRn2];
+ tmp1 = (R[iRn1] < tmp0);
+ switch (Q)
+ {
+ case 0:
+ SET_SR_Q ((unsigned char) (tmp1 == 0));
+ break;
+ case 1:
+ SET_SR_Q (tmp1);
+ break;
+ }
+ break;
+ }
+ break;
+ case 1:
+ switch (M)
+ {
+ case 0:
+ tmp0 = R[iRn1];
+ R[iRn1] += R[iRn2];
+ tmp1 = (R[iRn1] < tmp0);
+ switch (Q)
+ {
+ case 0:
+ SET_SR_Q (tmp1);
+ break;
+ case 1:
+ SET_SR_Q ((unsigned char) (tmp1 == 0));
+ break;
+ }
+ break;
+ case 1:
+ tmp0 = R[iRn1];
+ R[iRn1] -= R[iRn2];
+ tmp1 = (R[iRn1] > tmp0);
+ switch (Q)
+ {
+ case 0:
+ SET_SR_Q ((unsigned char) (tmp1 == 0));
+ break;
+ case 1:
+ SET_SR_Q (tmp1);
+ break;
+ }
+ break;
+ }
+ break;
+ }
+ /*T = (Q == M);*/
+ SET_SR_T (Q == M);
+ /*return T;*/
+}
+
+static void
+dmul (sign, rm, rn)
+ int sign;
+ unsigned int rm;
+ unsigned int rn;
+{
+ unsigned long RnL, RnH;
+ unsigned long RmL, RmH;
+ unsigned long temp0, temp1, temp2, temp3;
+ unsigned long Res2, Res1, Res0;
+
+ RnL = rn & 0xffff;
+ RnH = (rn >> 16) & 0xffff;
+ RmL = rm & 0xffff;
+ RmH = (rm >> 16) & 0xffff;
+ temp0 = RmL * RnL;
+ temp1 = RmH * RnL;
+ temp2 = RmL * RnH;
+ temp3 = RmH * RnH;
+ Res2 = 0;
+ Res1 = temp1 + temp2;
+ if (Res1 < temp1)
+ Res2 += 0x00010000;
+ temp1 = (Res1 << 16) & 0xffff0000;
+ Res0 = temp0 + temp1;
+ if (Res0 < temp0)
+ Res2 += 1;
+ Res2 += ((Res1 >> 16) & 0xffff) + temp3;
+
+ if (sign)
+ {
+ if (rn & 0x80000000)
+ Res2 -= rm;
+ if (rm & 0x80000000)
+ Res2 -= rn;
+ }
+
+ MACH = Res2;
+ MACL = Res0;
+}
+
+static void
+macw (regs, memory, n, m)
+ int *regs;
+ unsigned char *memory;
+ int m, n;
+{
+ int little_endian = target_little_endian;
+ long tempm, tempn;
+ long prod, macl, sum;
+
+ tempm=RSWAT(regs[m]); regs[m]+=2;
+ tempn=RSWAT(regs[n]); regs[n]+=2;
+
+ macl = MACL;
+ prod = (long)(short) tempm * (long)(short) tempn;
+ sum = prod + macl;
+ if (S)
+ {
+ if ((~(prod ^ macl) & (sum ^ prod)) < 0)
+ {
+ /* MACH's lsb is a sticky overflow bit. */
+ MACH |= 1;
+ /* Store the smallest negative number in MACL if prod is
+ negative, and the largest positive number otherwise. */
+ sum = 0x7fffffff + (prod < 0);
+ }
+ }
+ else
+ {
+ long mach;
+ /* Add to MACH the sign extended product, and carry from low sum. */
+ mach = MACH + (-(prod < 0)) + ((unsigned long) sum < prod);
+ /* Sign extend at 10:th bit in MACH. */
+ MACH = (mach & 0x1ff) | -(mach & 0x200);
+ }
+ MACL = sum;
+}
+
+/* Set the memory size to the power of two provided. */
+
+void
+sim_size (power)
+ int power;
+
+{
+ saved_state.asregs.msize = 1 << power;
+
+ sim_memory_size = power;
+
+ if (saved_state.asregs.memory)
+ {
+ free (saved_state.asregs.memory);
+ }
+
+ saved_state.asregs.memory =
+ (unsigned char *) calloc (64, saved_state.asregs.msize / 64);
+
+ if (!saved_state.asregs.memory)
+ {
+ fprintf (stderr,
+ "Not enough VM for simulation of %d bytes of RAM\n",
+ saved_state.asregs.msize);
+
+ saved_state.asregs.msize = 1;
+ saved_state.asregs.memory = (unsigned char *) calloc (1, 1);
+ }
+}
+
+static void
+init_pointers ()
+{
+ host_little_endian = 0;
+ *(char*)&host_little_endian = 1;
+ host_little_endian &= 1;
+
+ if (saved_state.asregs.msize != 1 << sim_memory_size)
+ {
+ sim_size (sim_memory_size);
+ }
+
+ if (saved_state.asregs.profile && !profile_file)
+ {
+ profile_file = fopen ("gmon.out", "wb");
+ /* Seek to where to put the call arc data */
+ nsamples = (1 << sim_profile_size);
+
+ fseek (profile_file, nsamples * 2 + 12, 0);
+
+ if (!profile_file)
+ {
+ fprintf (stderr, "Can't open gmon.out\n");
+ }
+ else
+ {
+ saved_state.asregs.profile_hist =
+ (unsigned short *) calloc (64, (nsamples * sizeof (short) / 64));
+ }
+ }
+}
+
+static void
+dump_profile ()
+{
+ unsigned int minpc;
+ unsigned int maxpc;
+ unsigned short *p;
+ int i;
+
+ p = saved_state.asregs.profile_hist;
+ minpc = 0;
+ maxpc = (1 << sim_profile_size);
+
+ fseek (profile_file, 0L, 0);
+ swapout (minpc << PROFILE_SHIFT);
+ swapout (maxpc << PROFILE_SHIFT);
+ swapout (nsamples * 2 + 12);
+ for (i = 0; i < nsamples; i++)
+ swapout16 (saved_state.asregs.profile_hist[i]);
+
+}
+
+static void
+gotcall (from, to)
+ int from;
+ int to;
+{
+ swapout (from);
+ swapout (to);
+ swapout (1);
+}
+
+#define MMASKB ((saved_state.asregs.msize -1) & ~0)
+
+int
+sim_stop (sd)
+ SIM_DESC sd;
+{
+ saved_state.asregs.exception = SIGINT;
+ return 1;
+}
+
+void
+sim_resume (sd, step, siggnal)
+ SIM_DESC sd;
+ int step, siggnal;
+{
+ register unsigned int pc;
+ register int cycles = 0;
+ register int stalls = 0;
+ register int memstalls = 0;
+ register int insts = 0;
+ register int prevlock;
+ register int thislock;
+ register unsigned int doprofile;
+ register int pollcount = 0;
+ register int little_endian = target_little_endian;
+
+ int tick_start = get_now ();
+ void (*prev) ();
+ void (*prev_fpe) ();
+ extern unsigned char sh_jump_table0[];
+
+ register unsigned char *jump_table = sh_jump_table0;
+
+ register int *R = &(saved_state.asregs.regs[0]);
+ /*register int T;*/
+ register int PR;
+
+ register int maskb = ((saved_state.asregs.msize - 1) & ~0);
+ register int maskw = ((saved_state.asregs.msize - 1) & ~1);
+ register int maskl = ((saved_state.asregs.msize - 1) & ~3);
+ register unsigned char *memory;
+ register unsigned int sbit = ((unsigned int) 1 << 31);
+
+ prev = signal (SIGINT, control_c);
+ prev_fpe = signal (SIGFPE, SIG_IGN);
+
+ init_pointers ();
+
+ memory = saved_state.asregs.memory;
+
+ if (step)
+ {
+ saved_state.asregs.exception = SIGTRAP;
+ }
+ else
+ {
+ saved_state.asregs.exception = 0;
+ }
+
+ pc = saved_state.asregs.pc;
+ PR = saved_state.asregs.pr;
+ /*T = GET_SR () & SR_MASK_T;*/
+ prevlock = saved_state.asregs.prevlock;
+ thislock = saved_state.asregs.thislock;
+ doprofile = saved_state.asregs.profile;
+
+ /* If profiling not enabled, disable it by asking for
+ profiles infrequently. */
+ if (doprofile == 0)
+ doprofile = ~0;
+
+ do
+ {
+ register unsigned int iword = RUWAT (pc);
+ register unsigned int ult;
+ register unsigned int nia = pc + 2;
+#ifndef ACE_FAST
+ insts++;
+#endif
+ top:
+
+#include "code.c"
+
+
+ pc = nia;
+
+ if (--pollcount < 0)
+ {
+ pollcount = 1000;
+ if ((*callback->poll_quit) != NULL
+ && (*callback->poll_quit) (callback))
+ {
+ sim_stop (sd);
+ }
+ }
+
+#ifndef ACE_FAST
+ prevlock = thislock;
+ thislock = 30;
+ cycles++;
+
+ if (cycles >= doprofile)
+ {
+
+ saved_state.asregs.cycles += doprofile;
+ cycles -= doprofile;
+ if (saved_state.asregs.profile_hist)
+ {
+ int n = pc >> PROFILE_SHIFT;
+ if (n < nsamples)
+ {
+ int i = saved_state.asregs.profile_hist[n];
+ if (i < 65000)
+ saved_state.asregs.profile_hist[n] = i + 1;
+ }
+
+ }
+ }
+#endif
+ }
+ while (!saved_state.asregs.exception);
+
+ if (saved_state.asregs.exception == SIGILL
+ || saved_state.asregs.exception == SIGBUS)
+ {
+ pc -= 2;
+ }
+
+ saved_state.asregs.ticks += get_now () - tick_start;
+ saved_state.asregs.cycles += cycles;
+ saved_state.asregs.stalls += stalls;
+ saved_state.asregs.memstalls += memstalls;
+ saved_state.asregs.insts += insts;
+ saved_state.asregs.pc = pc;
+ /* restore the T and other cached SR bits */
+ SET_SR (GET_SR());
+ saved_state.asregs.pr = PR;
+
+ saved_state.asregs.prevlock = prevlock;
+ saved_state.asregs.thislock = thislock;
+
+ if (profile_file)
+ {
+ dump_profile ();
+ }
+
+ signal (SIGFPE, prev_fpe);
+ signal (SIGINT, prev);
+}
+
+int
+sim_write (sd, addr, buffer, size)
+ SIM_DESC sd;
+ SIM_ADDR addr;
+ unsigned char *buffer;
+ int size;
+{
+ int i;
+
+ init_pointers ();
+
+ for (i = 0; i < size; i++)
+ {
+ saved_state.asregs.memory[MMASKB & (addr + i)] = buffer[i];
+ }
+ return size;
+}
+
+int
+sim_read (sd, addr, buffer, size)
+ SIM_DESC sd;
+ SIM_ADDR addr;
+ unsigned char *buffer;
+ int size;
+{
+ int i;
+
+ init_pointers ();
+
+ for (i = 0; i < size; i++)
+ {
+ buffer[i] = saved_state.asregs.memory[MMASKB & (addr + i)];
+ }
+ return size;
+}
+
+/* We have to add one to RN as an index into asints because of the padding
+ added at the start of asregs. */
+int
+sim_store_register (sd, rn, memory, length)
+ SIM_DESC sd;
+ int rn;
+ unsigned char *memory;
+ int length;
+{
+ int little_endian;
+ init_pointers ();
+ little_endian = target_little_endian;
+ if (&saved_state.asints[rn+1]
+ == &saved_state.asregs.fpscr)
+ set_fpscr1 (RLAT(0));
+ else
+ saved_state.asints[rn+1] = RLAT(0);
+ return -1;
+}
+
+int
+sim_fetch_register (sd, rn, memory, length)
+ SIM_DESC sd;
+ int rn;
+ unsigned char *memory;
+ int length;
+{
+ int little_endian;
+ init_pointers ();
+ little_endian = target_little_endian;
+ WLAT (0, saved_state.asints[rn+1]);
+ return -1;
+}
+
+int
+sim_trace (sd)
+ SIM_DESC sd;
+{
+ return 0;
+}
+
+void
+sim_stop_reason (sd, reason, sigrc)
+ SIM_DESC sd;
+ enum sim_stop *reason;
+ int *sigrc;
+{
+ /* The SH simulator uses SIGQUIT to indicate that the program has
+ exited, so we must check for it here and translate it to exit. */
+ if (saved_state.asregs.exception == SIGQUIT)
+ {
+ *reason = sim_exited;
+ *sigrc = saved_state.asregs.regs[5];
+ }
+ else
+ {
+ *reason = sim_stopped;
+ *sigrc = saved_state.asregs.exception;
+ }
+}
+
+void
+sim_info (sd, verbose)
+ SIM_DESC sd;
+ int verbose;
+{
+ double timetaken = (double) saved_state.asregs.ticks / (double) now_persec ();
+ double virttime = saved_state.asregs.cycles / 36.0e6;
+
+ callback->printf_filtered (callback, "\n\n# instructions executed %10d\n",
+ saved_state.asregs.insts);
+ callback->printf_filtered (callback, "# cycles %10d\n",
+ saved_state.asregs.cycles);
+ callback->printf_filtered (callback, "# pipeline stalls %10d\n",
+ saved_state.asregs.stalls);
+ callback->printf_filtered (callback, "# misaligned load/store %10d\n",
+ saved_state.asregs.memstalls);
+ callback->printf_filtered (callback, "# real time taken %10.4f\n",
+ timetaken);
+ callback->printf_filtered (callback, "# virtual time taken %10.4f\n",
+ virttime);
+ callback->printf_filtered (callback, "# profiling size %10d\n",
+ sim_profile_size);
+ callback->printf_filtered (callback, "# profiling frequency %10d\n",
+ saved_state.asregs.profile);
+ callback->printf_filtered (callback, "# profile maxpc %10x\n",
+ (1 << sim_profile_size) << PROFILE_SHIFT);
+
+ if (timetaken != 0)
+ {
+ callback->printf_filtered (callback, "# cycles/second %10d\n",
+ (int) (saved_state.asregs.cycles / timetaken));
+ callback->printf_filtered (callback, "# simulation ratio %10.4f\n",
+ virttime / timetaken);
+ }
+}
+
+void
+sim_set_profile (n)
+ int n;
+{
+ saved_state.asregs.profile = n;
+}
+
+void
+sim_set_profile_size (n)
+ int n;
+{
+ sim_profile_size = n;
+}
+
+SIM_DESC
+sim_open (kind, cb, abfd, argv)
+ SIM_OPEN_KIND kind;
+ host_callback *cb;
+ struct _bfd *abfd;
+ char **argv;
+{
+ char **p;
+ int endian_set = 0;
+
+ sim_kind = kind;
+ myname = argv[0];
+ callback = cb;
+
+ for (p = argv + 1; *p != NULL; ++p)
+ {
+ if (strcmp (*p, "-E") == 0)
+ {
+ ++p;
+ if (*p == NULL)
+ {
+ /* FIXME: This doesn't use stderr, but then the rest of the
+ file doesn't either. */
+ callback->printf_filtered (callback, "Missing argument to `-E'.\n");
+ return 0;
+ }
+ target_little_endian = strcmp (*p, "big") != 0;
+ endian_set = 1;
+ }
+ else if (isdigit (**p))
+ parse_and_set_memory_size (*p);
+ }
+
+ if (abfd != NULL && ! endian_set)
+ target_little_endian = ! bfd_big_endian (abfd);
+
+ /* fudge our descriptor for now */
+ return (SIM_DESC) 1;
+}
+
+static void
+parse_and_set_memory_size (str)
+ char *str;
+{
+ int n;
+
+ n = strtol (str, NULL, 10);
+ if (n > 0 && n <= 24)
+ sim_memory_size = n;
+ else
+ callback->printf_filtered (callback, "Bad memory size %d; must be 1 to 24, inclusive\n", n);
+}
+
+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;
+{
+ extern bfd *sim_load_file (); /* ??? Don't know where this should live. */
+ bfd *prog_bfd;
+
+ 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;
+{
+ /* clear the registers */
+ memset (&saved_state, 0,
+ (char*)&saved_state.asregs.end_of_registers - (char*)&saved_state);
+ /* set the PC */
+ if (prog_bfd != NULL)
+ saved_state.asregs.pc = bfd_get_start_address (prog_bfd);
+ return SIM_RC_OK;
+}
+
+void
+sim_do_command (sd, cmd)
+ SIM_DESC sd;
+ char *cmd;
+{
+ char *sms_cmd = "set-memory-size";
+ int cmdsize;
+
+ if (cmd == NULL || *cmd == '\0')
+ {
+ cmd = "help";
+ }
+
+ cmdsize = strlen (sms_cmd);
+ if (strncmp (cmd, sms_cmd, cmdsize) == 0 && strchr (" \t", cmd[cmdsize]) != NULL)
+ {
+ parse_and_set_memory_size (cmd + cmdsize + 1);
+ }
+ else if (strcmp (cmd, "help") == 0)
+ {
+ (callback->printf_filtered) (callback, "List of SH simulator commands:\n\n");
+ (callback->printf_filtered) (callback, "set-memory-size <n> -- Set the number of address bits to use\n");
+ (callback->printf_filtered) (callback, "\n");
+ }
+ else
+ {
+ (callback->printf_filtered) (callback, "Error: \"%s\" is not a valid SH simulator command.\n", cmd);
+ }
+}
+
+void
+sim_set_callbacks (p)
+ host_callback *p;
+{
+ callback = p;
+}
diff --git a/sim/sh/syscall.h b/sim/sh/syscall.h
new file mode 100644
index 0000000..2c15447
--- /dev/null
+++ b/sim/sh/syscall.h
@@ -0,0 +1,33 @@
+
+/* !!! DANGER !!!
+ This was copied from newlib. */
+
+
+#define SYS_exit 1
+#define SYS_fork 2
+#define SYS_read 3
+#define SYS_write 4
+#define SYS_open 5
+#define SYS_close 6
+#define SYS_wait4 7
+#define SYS_creat 8
+#define SYS_link 9
+#define SYS_unlink 10
+#define SYS_execv 11
+#define SYS_chdir 12
+#define SYS_mknod 14
+#define SYS_chmod 15
+#define SYS_chown 16
+#define SYS_lseek 19
+#define SYS_getpid 20
+#define SYS_isatty 21
+#define SYS_fstat 22
+#define SYS_time 23
+#define SYS_ARG 24
+#define SYS_stat 38
+#define SYS_pipe 42
+#define SYS_execve 59
+#define SYS_utime 201 /* not really a system call */
+#define SYS_wait 202 /* nor is this */
+
+
diff --git a/sim/sh/tconfig.in b/sim/sh/tconfig.in
new file mode 100644
index 0000000..c5ec4fa
--- /dev/null
+++ b/sim/sh/tconfig.in
@@ -0,0 +1,17 @@
+/* sh target config file */
+
+/* Define this if the simulator supports profiling.
+ See the mips simulator for an example.
+ This enables the `-p foo' and `-s bar' options.
+ The target is required to provide sim_set_profile{,_size}. */
+/* #define SIM_HAVE_PROFILE */
+
+/* Define this if the simulator uses an instruction cache.
+ See the h8/300 simulator for an example.
+ This enables the `-c size' option to set the size of the cache.
+ The target is required to provide sim_set_simcache_size. */
+/* #define SIM_HAVE_SIMCACHE */
+
+/* Define this if the target cpu is bi-endian
+ and the simulator supports it. */
+#define SIM_HAVE_BIENDIAN