summaryrefslogtreecommitdiff
path: root/sim/h8500
diff options
context:
space:
mode:
authorStan Shebs <shebs@apple.com>1999-04-16 01:35:26 +0000
committerStan Shebs <shebs@apple.com>1999-04-16 01:35:26 +0000
commit14cd51f7793a9ce07bc435069f57269450141363 (patch)
tree280a2da48f771d61be5b451ddbacdf9ef8e9ad13 /sim/h8500
downloadgdb-14cd51f7793a9ce07bc435069f57269450141363.tar.gz
Initial revision
Diffstat (limited to 'sim/h8500')
-rw-r--r--sim/h8500/ChangeLog413
-rw-r--r--sim/h8500/Makefile.in28
-rw-r--r--sim/h8500/acconfig.h15
-rw-r--r--sim/h8500/compile.c2519
-rw-r--r--sim/h8500/config.in158
-rwxr-xr-xsim/h8500/configure3892
-rw-r--r--sim/h8500/configure.in10
-rw-r--r--sim/h8500/inst.h101
-rw-r--r--sim/h8500/tconfig.in13
9 files changed, 7149 insertions, 0 deletions
diff --git a/sim/h8500/ChangeLog b/sim/h8500/ChangeLog
new file mode 100644
index 00000000000..92511edbdbb
--- /dev/null
+++ b/sim/h8500/ChangeLog
@@ -0,0 +1,413 @@
+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:20:11 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:19:40 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:43:42 1998 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * compile.c (sim_store_register, sim_fetch_register): Pass in
+ length parameter. Return -1.
+ (sim_create_inferior): Pass 4 into sim_store_register.
+
+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>
+
+ * compile.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.
+
+Thu Sep 4 17:21:23 1997 Doug Evans <dje@seba>
+
+ * configure: Regenerated to track ../common/aclocal.m4 changes.
+
+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:39:07 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * compile.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 15:51:53 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * compile.c (sim_open): Add ABFD argument.
+
+Tue May 20 10:33:19 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * compile.c (sim_set_callbacks): Delete SIM_DESC argument.
+ (sim_open): Add callback argument.
+
+Thu Apr 24 00:39:51 1997 Doug Evans <dje@canuck.cygnus.com>
+
+ * configure: Regenerated to track ../common/aclocal.m4 changes.
+
+Fri Apr 18 14:02:10 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * compile.c (sim_stop): New function.
+
+Thu Apr 17 03:11:06 1997 Doug Evans <dje@canuck.cygnus.com>
+
+ * Makefile.in (SIM_OBJS): Add sim-load.o.
+ * compile.c: #include bfd.h.
+ (sim_kind, myname, start_address): New static locals.
+ (sim_open): Set sim_kind, myname.
+ (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.
+
+Wed Apr 16 17:34:41 1997 Andrew Cagney <cagney@b1.cygnus.com>
+
+ * inst.h (H8500_MSIZE): Rename from MSIZE.
+ * compile.c (sim_read, sim_write, init_pointers): Update.
+
+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>
+
+ * compile.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 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 12:50:28 1997 Doug Evans <dje@canuck.cygnus.com>
+
+ * compile.c (sim_open): New SIM_DESC result. Argument is now in
+ argv form.
+ (other sim_*): New SIM_DESC argument.
+
+Tue Feb 4 13:36:29 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 01:48:23 1996 Doug Evans <dje@canuck.cygnus.com>
+
+ * Makefile.in: Delete stuff moved to ../common/Make-common.in.
+ * configure.in: Simplify using macros in ../common/aclocal.m4.
+ * configure: Regenerated.
+ (SIM_OBJS,SIM_EXTRA_CFLAGS): Define.
+ * compile.c (sim_set_simcache_size): Renamed from sim_csize.
+ (sim_size) New function.
+ (sim_callback): New global. Redirect all calls to printf_filtered
+ through callback.
+ (sim_set_callbacks): Record callback.
+ * run.c: Delete, using one in ../common now.
+ * tconfig.in: New file.
+
+Thu Oct 3 16:14:08 1996 Jason Molenda (crash@godzilla.cygnus.co.jp)
+
+ * Makefile.in (mostlyclean): Don't remove config.log here.
+
+Wed Jun 26 12:23:39 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.
+
+Wed Feb 21 12:15:46 1996 Ian Lance Taylor <ian@cygnus.com>
+
+ * configure: Regenerate with autoconf 2.7.
+
+Fri Oct 13 15:03:48 1995 steve chamberlain <sac@slash.cygnus.com>
+
+ * compile.c (sim_set_callbacks): New.
+
+Tue Oct 10 11:10:36 1995 Fred Fish <fnf@cygnus.com>
+
+ * Makefile.in (BISON): Remove macro.
+
+Wed Sep 20 13:35:24 1995 Ian Lance Taylor <ian@cygnus.com>
+
+ * Makefile.in (maintainer-clean): New synonym for realclean.
+
+Fri Sep 8 12:38:31 1995 Ian Lance Taylor <ian@cygnus.com>
+
+ * Makefile.in (install): Don't install in $(tooldir).
+
+ * configure.in: Call AC_CONFIG_HEADER. Don't try to use
+ bfd/hosts/*.h file or bfd/config/*.mh file. Call AC_PROG_CC and
+ AC_PROG_RANLIB. Substitute in values for CFLAGS, HDEFINES and AR.
+ Call AC_CHECK_HEADERS for stdlib.h and time.h. Touch stamp.h if
+ creating config.h.
+ * configure: Rebuild.
+ * config.in: New file, created by autoheader.
+ * Makefile.in (AR): Define as @AR@.
+ (CC): New variable, defined as @CC@.
+ (CFLAGS): Define as @CFLAGS@.
+ (RANLIB): Define as @RANLIB@.
+ (HDEFINES, TDEFINES): New variables.
+ (@host_makefile_frag@): Remove.
+ (compile.o, run.o): Depend upon config.h.
+ (mostlyclean): Make the same as clean, not distclean.
+ (clean): Remove config.log.
+ (distclean): Remove config.h and stamp-h.
+ (Makefile): Don't depend upon @frags@. Just rebuild Makefile when
+ invoking config.status.
+ (config.h, stamp-h): New targets.
+ * compile.c: Include "config.h". Don't include <sys/times.h>.
+ Include <time.h> and <stdlib.h> if they exist. Don't include
+ "sysdep.h".
+ * run.c: Include "config.h". Include <stdlib.h> if it exists.
+ Don't include "sysdep.h". Include "bfd.h", not "../../bfd/bfd.h".
+
+Thu Aug 10 16:29:23 1995 Doug Evans <dje@canuck.cygnus.com>
+
+ * compile.c (trap): Watch for abort.
+ * run.c (main): Return non-zero exit code if we didn't
+ exit cleanly.
+
+Thu Aug 10 09:44:20 1995 steve chamberlain <sac@slash.cygnus.com>
+
+ * compile.c (find): Fix another thinko.
+ * sim_resume (O_JSR): Make sure all JSRs stay in the same page.
+
+Thu Aug 10 13:43:47 1995 Ian Lance Taylor <ian@cygnus.com>
+
+ * Makefile.in (compile.o): Remove build rule.
+ (.c.o): Add generic build rule.
+
+Wed Aug 9 09:46:41 1995 steve chamberlain <sac@slash.cygnus.com>
+
+ * Makefile.in: Fix CSEARCH.
+ * compile.c (find): Handle ABS24 and ABS16 correctly.
+ Make JMP and JSR stay in right page.
+
+Thu Aug 3 10:45:37 1995 Fred Fish <fnf@cygnus.com>
+
+ * Update all FSF addresses except those in COPYING* files.
+
+Wed Jul 5 14:32:54 1995 J.T. Conklin <jtc@rtl.cygnus.com>
+
+ * Makefile.in (clean): Remove run.
+ (distclean): Remove Makefile.
+
+ * h8500.mt: Removed.
+
+ * Makefile.in, configure.in: converted to autoconf.
+ * configure: New file, generated with autconf 2.4.
+
+Fri Jun 30 16:50:56 1995 Stan Shebs <shebs@andros.cygnus.com>
+
+ * compile.c (sim_do_command): New function.
+
+Wed May 24 16:31:38 1995 Jim Wilson <wilson@chestnut.cygnus.com>
+
+ * configure.in: Fix typo in last change.
+
+Mon Mar 27 10:32:34 1995 J.T. Conklin <jtc@rtl.cygnus.com>
+
+ * run.c: parse arguments with getopt().
+
+Tue Feb 28 17:30:29 1995 Ian Lance Taylor <ian@cygnus.com>
+
+ * configure.in: Use ../../bfd/hosts/std-host.h if specific
+ host unavailable.
+
+Wed May 18 13:58:05 1994 Doug Evans (dje@canuck.cygnus.com)
+
+ * compile.c (sim_*): Change result to void where there isn't one.
+ (sim_resume): Fix subroutine calling (push return address).
+ (sim_set_pc): Delete.
+ (sim_info): Delete printf_fn arg, all callers changed.
+ Call printf_filtered instead.
+ (sim_create_inferior): Renamed from sim_set_args.
+ (sim_close): New function.
+ (sim_load): New function.
+ * run.c: #include <varargs.h>, "remote-sim.h".
+ (printf_filtered): New function.
+
+Sat Dec 11 16:35:34 1993 Steve Chamberlain (sac@thepub.cygnus.com)
+
+ * compile.c (segforreg): New vector. (sim_resume): Get Z flag
+ right for bitops. (sim_store_register, sim_fetch_register,
+ sim_set_pc): Use new register naming convention.
+
+Thu Oct 28 19:31:24 1993 Doug Evans (dje@canuck.cygnus.com)
+
+ * compile.c: #include "ansidecl.h" for remote-sim.h.
+
+Tue Oct 26 10:02:18 1993 Doug Evans (dje@canuck.cygnus.com)
+
+ * Makefile.in (CSEARCH): Add -I$(srcdir)/../../gdb.
+ * compile.c: #include "sysdep.h" and "remote-sim.h".
+ (SET_SEGREG): Protect arg `y' with parens.
+ (sim_resume): New arg `siggnal'.
+ (sim_write): Use SIM_ADDR for type of arg `addr', int result.
+ (sim_read): Ditto, use unsigned char * for arg `buf'.
+ (sim_store_register): int result, value passed by reference.
+ (sim_fetch_register): int result, use unsigned char * for arg `buf'.
+ (sim_trace): Update call to sim_resume.
+ (sim_stop_reason): Renamed from sim_stop_signal, new arg `reason',
+ int result (error code, currently always 0).
+ (sim_set_pc): Update calls to sim_store_register.
+ (sim_info): int result, new args `print_fn', `verbose'.
+ (sim_kill): int result.
+ (sim_open): Ditto, new arg `name'.
+ * run.c (main): Update call to sim_info.
+
+Sat Oct 23 15:06:10 1993 Doug Evans (dje@canuck.cygnus.com)
+
+ * compile.c (sim_stop_signal): Result is now enum sim_stop.
+
+Fri Oct 15 23:52:55 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
+
+ * compile.c (sim_kill, sim_open, sim_set_args): New functions.
+
+Tue Aug 17 07:17:09 1993 Steve Chamberlain (sac@phydeaux.cygnus.com)
+
+ * compile.c (sim_info): Don't work out simulation ration if
+ timetaken is zero.
+
+Mon Aug 2 14:08:24 1993 Steve Chamberlain (sac@phydeaux.cygnus.com)
+
+ * compile.c (get_now, now_persec): Use time system call. (find) do
+ pjmps right.
+
+Tue Jul 13 12:20:19 1993 Steve Chamberlain (sac@phydeaux.cygnus.com)
+
+ * compile.c (sim_set_pc): set cp at the same time. (sim_resume):
+ fix pjsr and pjmp.
+
+Tue Jun 8 14:34:37 1993 Steve Chamberlain (sac@phydeaux.cygnus.com)
+
+ * compile.c: Remove endian.h dependency.
+
+Mon Apr 5 10:08:30 1993 Steve Chamberlain (sac@thepub.cygnus.com)
+
+ * run.c (main): Now understands -v.
+ * compile.c: Passes all the tests in small model.
+
+Mon Mar 29 13:20:36 1993 Steve Chamberlain (sac@thepub.cygnus.com)
+
+ * run.c, inst.h compile.c: bug fixes,
+
+Thu Mar 25 12:21:18 1993 Stu Grossman (grossman@cygnus.com)
+
+ * compile.c (sim_store_register): Use GDB names for registers to
+ avoid version skew problems.
+ * (sim_fetch_register): Ditto, also return only bits that
+ actually exist.
+ * configure.in: Fix srctrigger & srcname to reflect h8500, not h8300.
+
+Fri Mar 19 14:46:31 1993 Steve Chamberlain (sac@thepub.cygnus.com)
+
+ * inst.h, compile.c, run.c: New files.
+
diff --git a/sim/h8500/Makefile.in b/sim/h8500/Makefile.in
new file mode 100644
index 00000000000..ead808e13ba
--- /dev/null
+++ b/sim/h8500/Makefile.in
@@ -0,0 +1,28 @@
+# Makefile template for Configure for the h8500 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 = compile.o sim-load.o
+# FIXME: This is probably a hack to get a syscall.h. better support for
+# syscall.h is in progress.
+SIM_EXTRA_CFLAGS = -I$(srcdir)/../../newlib/libc/sys/z8k
+
+## COMMON_POST_CONFIG_FRAG
+
+compile.o: compile.c config.h
diff --git a/sim/h8500/acconfig.h b/sim/h8500/acconfig.h
new file mode 100644
index 00000000000..f9b87a10c60
--- /dev/null
+++ b/sim/h8500/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/h8500/compile.c b/sim/h8500/compile.c
new file mode 100644
index 00000000000..1aad644fa8a
--- /dev/null
+++ b/sim/h8500/compile.c
@@ -0,0 +1,2519 @@
+/* Simulator for the Hitachi H8/500 architecture.
+
+ Written by Steve Chamberlain of Cygnus Support.
+ sac@cygnus.com
+
+ This file is part of H8/500 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_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+#include <sys/param.h>
+#include <setjmp.h>
+#include "ansidecl.h"
+#include "bfd.h"
+#include "callback.h"
+#include "remote-sim.h"
+
+#define O_RECOMPILE 85
+#define DEFINE_TABLE
+#define DISASSEMBLER_TABLE
+
+/* FIXME: Needs to live in header file.
+ This header should also include the things in remote-sim.h.
+ One could move this to remote-sim.h but this function isn't needed
+ by gdb. */
+void sim_set_simcache_size PARAMS ((int));
+
+int debug;
+
+host_callback *sim_callback;
+
+static SIM_OPEN_KIND sim_kind;
+static char *myname;
+
+/* This code can be compiled with any old C compiler, in which case
+ four or five switch statements will be executed for each
+ instruction simulated. It can be compiled with GCC, then the
+ simulated instructions thread through the code fragments, and
+ everything goes much faster.
+
+ These definitions make the code work either way
+*/
+#ifdef __GNUC__
+#define DISPATCH(X) goto *(X); do
+#define LABEL(X) X##_L
+#define LABELN(X,N) X##_L##N
+#define LABEL_REF(X) &&X##_L
+#define LABEL_REFN(X,N) &&X##_L##N
+#define ENDDISPATCH while (0);
+#define fastref void *
+
+#define DEFAULT ;
+#define INLINE __inline__
+#else
+#define DEFAULT default :
+#define DISPATCH(X) switch (X)
+#define LABEL(X) case X
+#define LABELN(X,N) case X
+#define LABEL_REF(X) X
+#define LABEL_REFN(X,N) X
+#define ENDDISPATCH
+#define fastref int
+
+
+
+#define INLINE
+#define STORE_REG_B 1
+#define STORE_REG_W 2
+#define STORE_INC_B 3
+#define STORE_INC_W 4
+#define STORE_DEC_B 5
+#define STORE_DEC_W 6
+#define STORE_DISP_B 7
+#define STORE_DISP_W 8
+#define STORE_CRB 9
+#define STORE_CRW 10
+#define STORE_REG_L 11
+#define STORE_NOP 12
+
+#define FETCH_NOP 9
+#define FETCH_REG_B 10
+#define FETCH_REG_W 11
+#define FETCH_INC_B 12
+#define FETCH_INC_W 13
+#define FETCH_DEC_B 14
+#define FETCH_DEC_W 15
+#define FETCH_DISP_B 16
+#define FETCH_DISP_W 17
+#define FETCH_IMM 18
+#define FETCH_CRB 19
+#define FETCH_CRW 20
+#define FETCH_LVAL 21
+#define FETCH_LVAL24 22
+#define FETCH_REG_L 23
+
+#define FLAG_m 20
+#define FLAG_M 21
+#define FLAG_A 22
+#define FLAG_NONE 23
+#define FLAG_NOSTORE 24
+#define FLAG_CLEAR 25
+#define FLAG_a 26
+#define FLAG_BRANCH 27
+#define FLAG_special 28
+
+#define FLAG_shiftword 29
+#define FLAG_shiftbyte 30
+
+#define FLAG_multword 31
+#define FLAG_multbyte 32
+#endif
+
+
+#define h8500_table h8500_compile_table
+#include "../opcodes/h8500-opc.h"
+
+#include "inst.h"
+
+#define LOW_BYTE(x) ((x) & 0xff)
+#define HIGH_BYTE(x) (((x)>>8) & 0xff)
+#define NORMAL_CP ((cpu.regs[R_CP].c - cpu.memory)>>16)
+#define NORMAL_DP ((cpu.regs[R_DP].c - cpu.memory)>>16)
+#define NORMAL_EP ((cpu.regs[R_EP].c - cpu.memory)>>16)
+#define NORMAL_TP ((cpu.regs[R_TP].c - cpu.memory)>>16)
+#define SET_NORMREG(x,y) ((cpu.regs[x].l = (y)))
+#define GET_NORMREG(x) (cpu.regs[x].l)
+#define SET_SEGREG(x,y) { cpu.regs[x].c = ((y) & 0xff0000) + cpu.memory;}
+#define GET_SEGREG(x) ( (cpu.regs[x].c - cpu.memory ) >> 16)
+#define SET_NORMAL_CPPC(x) { pc = (x) & 0xffff; SET_SEGREG(R_CP, (x));}
+#define NORMAL_SR ((N<<3)|(Z<<2)|(V<<1)|(C))
+#define P(X,Y) ((X<<8) | Y)
+
+#define BUILDSR() cpu.regs[R_SR].s[LOW] = (N << 3) | (Z << 2) | (V<<1) | C;
+
+#define GETSR() \
+ C = (cpu.regs[R_SR].s[LOW] >> 0) & 1;\
+ V = (cpu.regs[R_SR].s[LOW] >> 1) & 1;\
+ Z = (cpu.regs[R_SR].s[LOW] >> 2) & 1;\
+ N = (cpu.regs[R_SR].s[LOW] >> 3) & 1;
+
+#ifdef __CHAR_IS_SIGNED__
+#define SEXTCHAR(x) ((char)(x))
+#endif
+
+#ifndef SEXTCHAR
+#define SEXTCHAR(x) ((x & 0x80) ? (x | ~0xff):x)
+#endif
+
+#define SEXTSHORT(x) ((short)(x))
+
+/* Which segment registers go with which pointer registers */
+static unsigned char **segmap[R_LAST];
+static unsigned char *(regptr[R_LAST][3]);
+static unsigned char *(segregptr[R_LAST][3]);
+static cpu_state_type cpu;
+
+static int segforreg[] = {R_DP, R_DP, R_DP, R_DP,
+ R_EP, R_EP, R_TP, R_TP,
+ R_DP, R_DP, R_DP, R_DP,
+ R_EP, R_EP, R_TP, R_TP};
+int LOW;
+int HIGH;
+
+/* routines for getting and storing args */
+#define elval(struct, lit) \
+ (((*(struct.reg.wptr) + lit) & 0xffff) + (*(struct.r2.segreg)))
+
+#define displval(s) elval((s),(s).literal)
+
+#define ireglval(struct) elval(struct, 0)
+#define wordat(x) (((x)[0] << 8) | (x)[1])
+#define longat(x) ((wordat((x))<<16)|(wordat((x)+2)))
+#define byteat(x) ((x)[0])
+
+#define setwordat(x,y) {x[0] =( y)>>8; x[1] = y;}
+#define setbyteat(x,y) {x[0] = y;}
+
+/*#define setalignedwordat(x,y) {((short *)x)[0] =y;}*/
+/*
+statics
+*/
+
+ea_type rd;
+ea_type rs;
+ea_type imm;
+ea_type cr;
+ea_type ea;
+ea_type nop;
+ea_type lval;
+ea_type lval24;
+
+ea_type eavector[2];
+
+int disp;
+
+#define JBYTE 0
+#define JWORD 1
+#define JLONG 2
+
+typedef union
+{
+ struct
+ {
+ fastref srcabyte;
+ fastref srcaword;
+ fastref srcalong;
+
+ fastref srcbbyte;
+ fastref srcbword;
+ fastref srcblong;
+
+ fastref dstbyte;
+ fastref dstword;
+ fastref dstlong;
+ } s;
+ struct
+ {
+ fastref byte;
+ fastref word;
+ fastref lon;
+ } a[3];
+
+ fastref j[9];
+} size_ptr;
+
+union
+{
+ struct ea_struct
+ {
+ size_ptr ea_nop;
+ size_ptr ea_reg;
+ size_ptr ea_inc;
+ size_ptr ea_dec;
+ size_ptr ea_disp;
+
+ size_ptr ea_imm;
+ size_ptr ea_cr;
+ size_ptr ea_lval;
+ size_ptr ea_lval24;
+ } s;
+#define N_EATYPES (sizeof(struct ea_struct) / sizeof(size_ptr))
+ size_ptr a[N_EATYPES];
+} eas;
+
+/* This function takes an ea structure filled in for the 1st source
+ operand and modifies it to be for either the 1st, 2nd or dst operand */
+
+static void
+howto_workout (encoded, semiencoded, n)
+ ea_type *encoded;
+ ea_type *semiencoded;
+ int n;
+{
+ int i;
+ *encoded = *semiencoded;
+
+ for (i = 0; i < N_EATYPES; i++)
+ {
+ if (encoded->type == eas.a[i].s.srcabyte)
+ {
+ encoded->type = eas.a[i].a[n].byte;
+ return;
+ }
+ else if (encoded->type == eas.a[i].s.srcaword)
+ {
+ encoded->type = eas.a[i].a[n].word;
+ return;
+ }
+ else if (encoded->type == eas.a[i].s.srcalong)
+ {
+ encoded->type = eas.a[i].a[n].lon;
+ return;
+ }
+ }
+
+ abort ();
+}
+
+fastref flag_shiftword;
+fastref flag_shiftbyte;
+fastref flag_multword;
+fastref flag_multbyte;
+fastref flag_mp;
+fastref flag_special;
+fastref flag_Mp;
+fastref flag_ap;
+fastref flag_Ap;
+fastref flag_nonep;
+fastref flag_nostorep;
+fastref flag_clearp;
+fastref flag_branch;
+fastref exec_dispatch[100];
+
+static int
+get_now ()
+{
+ return time (0);
+}
+
+static int
+now_persec ()
+{
+ return 1;
+}
+
+static void
+gotcr (ptr, n)
+ ea_type *ptr;
+ int n;
+{
+ int size;
+ n &= 0x7;
+ if (n == 0)
+ {
+ abort ();
+ }
+ else
+ {
+ ptr->type = eas.s.ea_cr.j[JBYTE];
+ ptr->reg.bptr = segregptr[n][JLONG];
+ }
+}
+static void
+gotreg (ptr, n, size)
+ ea_type *ptr;
+ int n;
+ int size;
+{
+ n &= 0x7;
+ ptr->type = eas.s.ea_reg.j[size];
+ ptr->reg.bptr = regptr[n][size];
+}
+
+static void
+gotinc (ptr, n, inc, size)
+ ea_type *ptr;
+ int n;
+ int size;
+{
+ n &= 0x7;
+ if (inc > 0)
+ {
+ ptr->type = eas.s.ea_inc.j[size];
+ }
+ else
+ {
+ ptr->type = eas.s.ea_dec.j[size];
+ }
+ ptr->reg.bptr = regptr[n][JWORD];
+ ptr->r2.segreg = segmap[n];
+}
+
+
+static void
+gotabs (ptr, disp, reg, size)
+ ea_type *ptr;
+ int disp;
+ int reg;
+ int size;
+{
+ ptr->type = eas.s.ea_disp.j[size];
+ ptr->reg.bptr = regptr[reg][JWORD];
+ ptr->r2.segreg = segmap[reg];
+ ptr->literal = disp;
+}
+
+static void
+gotind (ptr, disp, reg, size)
+ ea_type *ptr;
+ int disp;
+ int reg;
+ int size;
+{
+ gotabs (ptr, disp, reg & 0x7, size);
+}
+
+static void
+gotimm (ptr, val)
+ ea_type *ptr;
+ int val;
+{
+ ptr->type = eas.s.ea_imm.j[0];
+ ptr->literal = val;
+}
+
+static void
+indoff (ptr)
+ ea_type *ptr;
+{
+ int i;
+ for (i = 0; i < 6; i++)
+ {
+ if (ptr->type == eas.s.ea_disp.j[i])
+ {
+ ptr->type = eas.s.ea_lval.j[i];
+ return;
+ }
+ }
+}
+
+thinkabout_shifts (d, bytesized)
+ decoded_inst *d;
+ int bytesized;
+{
+ if (bytesized)
+ {
+ /* Got a byte shift, fake up second arg */
+ d->srcb.type = eas.s.ea_imm.s.srcbword;
+ d->srcb.literal = 8;
+ }
+ else
+ {
+ /* got a word shift, fake up second arg */
+ d->srcb.type = eas.s.ea_imm.s.srcbword;
+ d->srcb.literal = 16;
+ }
+}
+
+/* Calculate the number of cycles required to run this
+ instruction
+*/
+static void
+compcycles (dst, opcode)
+ decoded_inst *dst;
+ h8500_opcode_info *opcode;
+{
+ int cycles = 0;
+ /* Guess for the time being - 1 cycle for the first two bytes in the
+ opcode - to fecth the operand, and 3 cycles for all the rest of
+ the bytes, since they mean that there is probably an operand to
+ fetch */
+
+ switch (opcode->length)
+ {
+ case 1:
+ case 2:
+ cycles += opcode->length;
+ break;
+ default:
+ cycles += opcode->length * 3;
+ break;
+ }
+
+ dst->cycles = cycles;
+}
+
+static void
+translate (ptr, from, to)
+ ea_type *ptr;
+ fastref from;
+ fastref to;
+{
+ if (ptr->reg.wptr == &cpu.regs[7].s[LOW]
+ && ptr->type == from)
+ {
+ ptr->type = to;
+ }
+}
+
+static
+void
+fix_incdecs (dst)
+ decoded_inst *dst;
+{
+ if (dst->dst.type == eas.s.ea_inc.s.dstbyte
+ && (dst->srca.type == eas.s.ea_inc.s.srcabyte
+ || dst->srcb.type == eas.s.ea_inc.s.srcbbyte))
+ {
+ dst->dst.type = eas.s.ea_disp.s.dstbyte;
+ }
+
+ if (dst->dst.type == eas.s.ea_inc.s.dstword
+ && (dst->srca.type == eas.s.ea_inc.s.srcaword
+ || dst->srcb.type == eas.s.ea_inc.s.srcbword))
+ {
+ dst->dst.type = eas.s.ea_disp.s.dstword;
+ }
+
+ if (dst->dst.type == eas.s.ea_dec.s.dstbyte
+ || dst->dst.type == eas.s.ea_dec.s.dstword)
+ {
+ if (dst->srca.type == eas.s.ea_dec.s.srcabyte)
+ {
+ dst->srca.type = eas.s.ea_disp.s.srcabyte;
+ }
+ else if (dst->srca.type == eas.s.ea_dec.s.srcaword)
+ {
+ dst->srca.type = eas.s.ea_disp.s.srcaword;
+ }
+ else if (dst->srcb.type == eas.s.ea_dec.s.srcbbyte)
+ {
+ dst->srcb.type = eas.s.ea_disp.s.srcbbyte;
+ }
+ else if (dst->srcb.type == eas.s.ea_dec.s.srcbword)
+ {
+ dst->srcb.type = eas.s.ea_disp.s.srcbword;
+ }
+ }
+
+
+ /* Turn a byte ops from the sp into word ops */
+ translate (&dst->dst, eas.s.ea_dec.s.dstbyte, eas.s.ea_dec.s.dstword);
+ translate (&dst->dst, eas.s.ea_inc.s.dstbyte, eas.s.ea_inc.s.dstword);
+
+ translate (&dst->srca, eas.s.ea_dec.s.srcabyte, eas.s.ea_dec.s.srcaword);
+ translate (&dst->srca, eas.s.ea_inc.s.srcabyte, eas.s.ea_inc.s.srcaword);
+
+ translate (&dst->srcb, eas.s.ea_dec.s.srcbbyte, eas.s.ea_dec.s.srcbword);
+ translate (&dst->srcb, eas.s.ea_inc.s.srcbbyte, eas.s.ea_inc.s.srcbword);
+
+
+}
+
+
+static void
+find (pc, buffer, dst)
+ int pc;
+ unsigned char *buffer;
+ decoded_inst *dst;
+{
+ h8500_opcode_info *opcode;
+ int i;
+ int idx;
+ int hadimm = 0;
+ dst->srca.reg.rptr = 0;
+
+ /* Run down the table to find the one which matches */
+ for (opcode = h8500_table; opcode->name; opcode++)
+ {
+ int byte;
+ int rn;
+ int rd;
+ int rs;
+ int disp;
+ int abs;
+ int imm;
+ int pcrel;
+ int qim;
+ int i;
+ int cr;
+
+
+ dst->opcode = exec_dispatch[opcode->flavor & 0x7f];
+
+ for (byte = 0; byte < opcode->length; byte++)
+ {
+ if ((buffer[byte] & opcode->bytes[byte].mask)
+ != (opcode->bytes[byte].contents))
+ {
+ goto next;
+ }
+ else
+ {
+ /* extract any info parts */
+ switch (opcode->bytes[byte].insert)
+ {
+ case 0:
+ case FP:
+ break;
+ default:
+ abort ();
+ break;
+ case RN:
+ rn = buffer[byte] & 0x7;
+ break;
+ case RS:
+ rs = buffer[byte] & 0x7;
+ break;
+ case CRB:
+ cr = buffer[byte] & 0x7;
+ if (cr == 0)
+ goto next;
+ break;
+ case CRW:
+ cr = buffer[byte] & 0x7;
+ if (cr != 0)
+ goto next;
+ break;
+ case DISP16:
+ disp = (buffer[byte] << 8) | (buffer[byte + 1]);
+ break;
+ case FPIND_D8:
+ case DISP8:
+ disp = ((char) (buffer[byte]));
+ break;
+ case RD:
+ case RDIND:
+ rd = buffer[byte] & 0x7;
+ break;
+ case ABS24:
+ abs =
+ (buffer[byte] << 16)
+ | (buffer[byte + 1] << 8)
+ | (buffer[byte + 2]);
+ break;
+ case ABS16:
+ abs = (buffer[byte] << 8) | (buffer[byte + 1]);
+ break;
+ case ABS8:
+ abs = (buffer[byte]);
+ break;
+ case IMM16:
+ imm = (buffer[byte] << 8) | (buffer[byte + 1]);
+ break;
+ case IMM4:
+ imm = (buffer[byte]) & 0xf;
+ break;
+ case IMM8:
+ case RLIST:
+ imm = SEXTCHAR (buffer[byte]);
+ break;
+ case PCREL16:
+ pcrel = SEXTSHORT ((buffer[byte] << 8) | (buffer[byte + 1]));
+ break;
+ case PCREL8:
+ pcrel = SEXTCHAR ((buffer[byte]));
+ break;
+ case QIM:
+ switch (buffer[byte] & 0x7)
+ {
+ case 0:
+ imm = 1;
+ break;
+ case 1:
+ imm = 2;
+ break;
+ case 4:
+ imm = -1;
+ break;
+ case 5:
+ imm = -2;
+ break;
+ }
+ break;
+
+ }
+ }
+ }
+ if (opcode->flavor & O_BYTE)
+ {
+ idx = 0;
+ switch (opcode->flags)
+ {
+ case 'h':
+ dst->flags = flag_shiftbyte;
+ break;
+ case 'p':
+ dst->flags = flag_multbyte;
+ break;
+ case 'B':
+ dst->flags = flag_branch;
+ break;
+ case 'm':
+ dst->flags = flag_mp;
+ break;
+ case 'a':
+ dst->flags = flag_ap;
+ break;
+ case '-':
+ dst->flags = flag_nonep;
+ break;
+ case 0:
+ dst->flags = flag_nostorep;
+ break;
+ case 'c':
+ dst->flags = flag_clearp;
+ break;
+ case 's':
+ /* special */
+ dst->flags = flag_special;
+ }
+ }
+ else
+ {
+ idx = 1;
+ switch (opcode->flags)
+ {
+ case 'h':
+ dst->flags = flag_shiftword;
+ break;
+ case 'p':
+ dst->flags = flag_multword;
+ break;
+ case 'B':
+ dst->flags = flag_branch;
+ break;
+ case 'm':
+ dst->flags = flag_Mp;
+ break;
+ case 'a':
+ dst->flags = flag_Ap;
+ break;
+ case '-':
+ dst->flags = flag_nonep;
+ break;
+ case 0:
+ dst->flags = flag_nostorep;
+ break;
+ case 'c':
+ dst->flags = flag_clearp;
+ break;
+ case 's':
+ /* special */
+ dst->flags = flag_special;
+ break;
+ }
+ }
+
+ for (i = 0; i < opcode->nargs; i++)
+ {
+ ea_type *p = eavector + i;
+
+ switch (opcode->arg_type[i])
+ {
+ default:
+ abort ();
+
+ case FP:
+ gotreg (p, 6, idx);
+ break;
+ case RNIND:
+ disp = 0;
+ case RNIND_D16:
+ case RNIND_D8:
+ gotind (p, disp, rn, idx);
+ break;
+ break;
+ case RDIND:
+ disp = 0;
+ case RDIND_D16:
+ case RDIND_D8:
+ gotind (p, disp, rd, idx);
+ break;
+ case FPIND_D8:
+ gotind (p, disp, 6, idx);
+ break;
+ case CRB:
+ case CRW:
+ gotcr (p, cr);
+ break;
+ case RN:
+ gotreg (p, rn, idx);
+ break;
+ case RD:
+ gotreg (p, rd, idx);
+ break;
+ case RS:
+ gotreg (p, rs, idx);
+ break;
+ case RNDEC:
+ gotinc (p, rn, -1, idx);
+ break;
+ case RNINC:
+ gotinc (p, rn, 1, idx);
+ break;
+ case SPINC:
+ gotinc (p, 7, 1, idx);
+ break;
+ case SPDEC:
+ gotinc (p, 7, -1, idx);
+ break;
+ case ABS24:
+ case ABS16:
+ gotabs (p, abs, R_HARD_0, idx);
+ break;
+ case ABS8:
+ gotabs (p, abs, R_HARD8_0, idx);
+ break;
+ case IMM16:
+ case RLIST:
+ case QIM:
+ case IMM4:
+ case IMM8:
+ gotimm (p, imm);
+ break;
+ case PCREL16:
+ case PCREL8:
+ gotimm (p,
+ ((pcrel + pc + opcode->length) & 0xffff) | (pc & 0xff0000),
+ R_HARD_0, JLONG);
+
+ }
+ }
+
+ /* Finished and done - turn from two operand stuff into three */
+
+ dst->srca.type = eas.s.ea_nop.s.srcabyte;
+ dst->srcb.type = eas.s.ea_nop.s.srcbbyte;
+ dst->dst.type = eas.s.ea_nop.s.dstbyte;
+
+ if (opcode->nargs)
+ {
+ switch (opcode->nargs)
+ {
+ case 1:
+ howto_workout (&dst->srca, &eavector[0], 0);
+ if (opcode->dst != '!')
+ howto_workout (&dst->dst, &eavector[0], 2);
+ break;
+ case 2:
+ if (opcode->src2 == '!')
+ {
+ howto_workout (&dst->srca, &eavector[0], 0);
+ howto_workout (&dst->dst, &eavector[1], 2);
+ }
+ else
+ {
+ howto_workout (&dst->srca, &eavector[0], 0);
+ howto_workout (&dst->srcb, &eavector[1], 1);
+ if (opcode->dst != '!')
+ {
+ howto_workout (&dst->dst, &eavector[1], 2);
+ }
+ }
+ break;
+ }
+
+
+
+ /* Some extra stuff with pre inc and post dec,
+ make sure that if the same ea is there twice, only one of the
+ ops is auto inc/dec */
+
+ fix_incdecs (dst);
+
+
+ /* Some special cases */
+ if (dst->opcode == exec_dispatch[O_PJSR]
+ || dst->opcode == exec_dispatch[O_PJMP])
+ {
+ /* Both the @abs:24 and @rn turn into a disp word,
+ chose the right a mode since @abs:24 is 4 bytes
+ long */
+
+ if (opcode->length == 4)
+ {
+ dst->srca.type = eas.s.ea_lval24.s.srcabyte;
+ }
+ else
+ {
+ dst->srca.type = eas.s.ea_reg.s.srcalong;
+ }
+
+ dst->srca.r2.rptr = &cpu.regs[R_HARD_0];
+
+ /* For [P]JSR, keep return address precomputed */
+ dst->srcb.literal = pc + opcode->length;
+ dst->srcb.type = eas.s.ea_imm.s.srcbword;
+ }
+ else if (dst->opcode == exec_dispatch[O_MULXU])
+ {
+ /* This is a multiply -fix the destination op */
+ if (dst->dst.type == eas.s.ea_reg.s.dstword)
+ {
+ dst->dst.type = eas.s.ea_reg.s.dstlong;
+ }
+ else
+ {
+ dst->dst.type = eas.s.ea_reg.s.dstword;
+ }
+ dst->dst.reg.bptr = regptr[rd][JWORD];
+ }
+ else if (dst->opcode == exec_dispatch[O_DIVXU])
+ {
+ /* This is a wider than normal, fix the source operand */
+ dst->srcb.type
+ = (dst->srcb.type == eas.s.ea_reg.s.srcbword)
+ ? eas.s.ea_reg.s.srcblong
+ : eas.s.ea_reg.s.srcbword;
+
+ dst->dst.type
+ = (dst->dst.type == eas.s.ea_reg.s.dstword)
+ ? eas.s.ea_reg.s.dstlong
+ : eas.s.ea_reg.s.dstword;
+
+ }
+
+ else if (dst->opcode == exec_dispatch[O_LDM])
+ {
+ /* Turn of the stack ref */
+ dst->srca.type = eas.s.ea_nop.s.srcabyte;
+ }
+ else if (dst->opcode == exec_dispatch[O_STM])
+ {
+ /* Turn of the stack ref */
+ dst->srcb.type = eas.s.ea_nop.s.srcbbyte;
+ }
+
+
+ /* extends read one size and write another */
+ else if (dst->opcode == exec_dispatch[O_EXTS]
+ || dst->opcode == exec_dispatch[O_EXTU])
+ {
+ dst->dst.type = eas.s.ea_reg.s.dstword;
+ dst->dst.reg.bptr = regptr[rd][JWORD];
+ dst->flags = flag_Ap;
+ }
+
+
+ if (opcode->flags == 'h')
+ thinkabout_shifts (dst, opcode->flavor & O_BYTE);
+
+
+ /* For a branch, turn off one level of indirection */
+ if (opcode->src1 == 'B')
+ {
+ indoff (&dst->srca, 0);
+ }
+
+ }
+ dst->next_pc = pc + opcode->length;
+
+ compcycles (dst, opcode);
+
+ return;
+
+
+ next:;
+ }
+
+ /* Couldn't understand anything */
+ dst->opcode = exec_dispatch[O_TRAPA];
+ dst->next_pc = pc + 1;
+
+}
+
+compile (pc)
+{
+ int idx;
+
+ /* find the next cache entry to use */
+
+ idx = cpu.cache_top + 1;
+ cpu.compiles++;
+ if (idx >= cpu.csize)
+ {
+ idx = 1;
+ }
+ cpu.cache_top = idx;
+
+ /* Throw away its old meaning */
+ cpu.cache_idx[cpu.cache[idx].oldpc] = 0;
+
+ /* set to new address */
+ cpu.cache[idx].oldpc = pc;
+
+ /* fill in instruction info */
+ find (pc, cpu.memory + pc, cpu.cache + idx);
+
+ /* point to new cache entry */
+ cpu.cache_idx[pc] = idx;
+}
+
+baddefault (x)
+{
+ printf ("bad default %d\n", x);
+}
+
+static int fetch_l (arg)
+ ea_type *arg;
+{
+ int l, r;
+
+ int h = *(arg->reg.wptr);
+ r = (union rtype *) (arg->reg.wptr) - &cpu.regs[0];
+ r++;
+
+ l = cpu.regs[r].s[LOW];
+ return (h << 16) | l;
+
+}
+
+#define FETCH(dst, arg, n) \
+{ \
+ int r; unsigned char*lval; \
+ DISPATCH((arg).type) \
+ { LABELN(FETCH_NOP,n): \
+ dst= 0; \
+ break; \
+ DEFAULT baddefault((arg).type); break; \
+ LABELN(FETCH_LVAL,n): \
+ dst = (*(((arg).reg.wptr)) + (arg.literal)) ; \
+ break; \
+ LABELN(FETCH_LVAL24,n): \
+ dst = (*(((arg).reg.wptr)) + *(((arg).r2.wptr)) + (arg.literal)) &0xffffff; \
+ break; \
+ LABELN(FETCH_CRB,n): \
+ dst = (*((arg).reg.segptr) - cpu.memory)>>16; \
+ break; \
+ LABELN(FETCH_CRW,n): \
+ dst = BUILDSR();\
+ break; \
+ LABELN(FETCH_REG_B,n): \
+ dst = *((arg).reg.bptr); \
+ break; \
+ LABELN(FETCH_REG_W,n): \
+ dst = *((arg).reg.wptr); \
+ break; \
+ LABELN(FETCH_REG_L,n): \
+ dst = fetch_l(&(arg));\
+ break; \
+ LABELN(FETCH_INC_B,n): \
+ lval = elval ((arg), 0); \
+ dst = byteat (lval); \
+ (*((arg).reg.wptr))++; \
+ break; \
+ LABELN(FETCH_INC_W,n): \
+ lval = elval ((arg), 0); \
+ dst = wordat (lval); \
+ (*(((arg).reg.wptr))) += 2; \
+ break; \
+ LABELN(FETCH_DEC_B, n): \
+ (*(arg).reg.wptr)--; \
+ lval = elval ((arg), 0); \
+ r = byteat (lval); \
+ dst = r; \
+ break; \
+ LABELN(FETCH_DEC_W, n): \
+ (*((arg).reg.wptr)) -= 2; \
+ lval = elval ((arg), 0); \
+ r = wordat (lval); \
+ dst = r; \
+ break; \
+ LABELN(FETCH_DISP_B,n): \
+ lval = displval ((arg)); \
+ dst = byteat (lval); \
+ break; \
+ LABELN(FETCH_DISP_W,n): \
+ lval = displval ((arg)); \
+ dst = wordat (lval); \
+ break; \
+ LABELN(FETCH_IMM, n): \
+ dst = (arg).literal; \
+ break; \
+ } \
+ ENDDISPATCH; \
+}
+
+static union
+{
+ short int i;
+ struct
+ {
+ char low;
+ char high;
+ }
+ u;
+}
+
+littleendian;
+
+static
+void
+init_pointers ()
+{
+ static int init;
+
+ if (!init)
+ {
+ int i;
+
+ init = 1;
+ littleendian.i = 1;
+
+ for (i = 0; i < (int) R_LAST; i++)
+ {
+ if (littleendian.u.high)
+ {
+ /* big endian host */
+
+
+ LOW = 1;
+ HIGH = 0;
+
+ regptr[i][0] = ((unsigned char *) (cpu.regs + i)) + 3;
+ regptr[i][1] = ((unsigned char *) (cpu.regs + i)) + 2;
+ }
+ else
+ {
+ LOW = 0;
+ HIGH = 1;
+
+ regptr[i][0] = (unsigned char *) &(cpu.regs[i]);
+ regptr[i][1] = (unsigned char *) (&(cpu.regs[i]));
+ }
+
+ regptr[i][2] = (unsigned char *) &(cpu.regs[i]);
+ }
+
+ memcpy (segregptr + 0, regptr + R_SR, sizeof (segregptr[0]));
+ memcpy (segregptr + 1, regptr + R_TP, sizeof (segregptr[1]));
+ memcpy (segregptr + 3, regptr + R_BR, sizeof (segregptr[3]));
+ memcpy (segregptr + 4, regptr + R_EP, sizeof (segregptr[4]));
+ memcpy (segregptr + 5, regptr + R_DP, sizeof (segregptr[5]));
+ memcpy (segregptr + 6, regptr + R_CP, sizeof (segregptr[6]));
+ memcpy (segregptr + 7, regptr + R_TP, sizeof (segregptr[7]));
+
+ /* Pointers to into the cpu state for the seg registers */
+
+ segmap[R0] = &cpu.regs[R_DP].c;
+ segmap[R1] = &cpu.regs[R_DP].c;
+ segmap[R2] = &cpu.regs[R_DP].c;
+ segmap[R3] = &cpu.regs[R_DP].c;
+ segmap[R4] = &cpu.regs[R_EP].c;
+ segmap[R5] = &cpu.regs[R_EP].c;
+ segmap[R6] = &cpu.regs[R_TP].c;
+ segmap[R7] = &cpu.regs[R_TP].c;
+ segmap[R_HARD_0] = &cpu.regs[R_DP].c;
+ segmap[R_HARD8_0] = &cpu.regs[R_BP].c;
+
+ cpu.memory = (unsigned char *) calloc (sizeof (char), H8500_MSIZE);
+ cpu.cache_idx = (unsigned short *) calloc (sizeof (short), H8500_MSIZE);
+
+ /* initialize the seg registers */
+
+ cpu.regs[R_DP].c = cpu.memory;
+ cpu.regs[R_TP].c = cpu.memory;
+ cpu.regs[R_CP].c = cpu.memory;
+ cpu.regs[R_BP].c = cpu.memory;
+ cpu.regs[R_EP].c = cpu.memory;
+ cpu.regs[R7].s[LOW] = 0xfffe;
+ cpu.regs[R6].s[LOW] = 0xfffe;
+ if (!cpu.cache)
+ sim_set_simcache_size (CSIZE);
+ }
+}
+
+#define PUSHWORD(x) \
+{ \
+ int sp = cpu.regs[R7].s[LOW]; \
+ unsigned char *p; \
+ \
+ sp -= 2; \
+ p = (sp & 0xffff) + (cpu.regs[R_TP].c); \
+ cpu.regs[R7].s[LOW] = sp; \
+ setwordat (p, x); \
+} \
+
+#define POPWORD(d) \
+{ \
+ int spx= cpu.regs[R7].s[LOW]; \
+ unsigned char *p; \
+ \
+ p = (spx& 0xffff) + (cpu.regs[R_TP].c); \
+ spx+= 2; \
+ cpu.regs[R7].s[LOW] = spx; \
+ d = wordat (p); \
+} \
+
+/* simulate a monitor trap */
+trap ()
+{
+ switch (cpu.regs[R3].s[LOW] & 0xff)
+ {
+ case 33:
+ /* exit */
+ cpu.exception = SIGQUIT;
+ break;
+ case 34:
+ /* abort */
+ cpu.exception = SIGABRT;
+ break;
+ case 6:
+ /* print char in r0 */
+ printf ("%c", cpu.regs[R0].s[LOW]);
+ break;
+ }
+}
+void
+control_c (sig, code, scp, addr)
+ int sig;
+ int code;
+ char *scp;
+ char *addr;
+{
+ cpu.exception = SIGINT;
+}
+
+static jmp_buf jbuf;
+static void
+segv ()
+{
+ cpu.exception = SIGSEGV;
+ longjmp (jbuf, 1);
+}
+
+int
+sim_stop (sd)
+ SIM_DESC sd;
+{
+ cpu.exception = SIGINT;
+ return 1;
+}
+
+void
+sim_resume (sd, step, siggnal)
+ SIM_DESC sd;
+{
+ static int init1;
+ int res;
+ int tmp;
+ int arga;
+ int argb;
+ int bit;
+ int pc;
+ int C, Z, V, N;
+ int cycles = 0;
+ int insts = 0;
+ int tick_start = get_now ();
+ void (*prev) ();
+ void (*prev_seg) ();
+
+ if (!init1)
+ {
+ int i;
+
+ init1 = 1;
+ init_pointers ();
+
+ for (i = 0; i < N_EATYPES; i++)
+ {
+ eas.a[i].s.srcabyte = LABEL_REFN (FETCH_NOP, 0);
+ eas.a[i].s.srcaword = LABEL_REFN (FETCH_NOP, 0);
+ eas.a[i].s.srcalong = LABEL_REFN (FETCH_NOP, 0);
+
+ eas.a[i].s.srcbbyte = LABEL_REFN (FETCH_NOP, 1);
+ eas.a[i].s.srcbword = LABEL_REFN (FETCH_NOP, 1);
+ eas.a[i].s.srcblong = LABEL_REFN (FETCH_NOP, 1);
+
+ eas.a[i].s.dstbyte = LABEL_REF (STORE_NOP);
+ eas.a[i].s.dstword = LABEL_REF (STORE_NOP);
+ eas.a[i].s.dstlong = LABEL_REF (STORE_NOP);
+ }
+
+ eas.s.ea_lval.s.srcabyte = LABEL_REFN (FETCH_LVAL, 0);
+ eas.s.ea_lval.s.srcaword = LABEL_REFN (FETCH_LVAL, 0);
+ eas.s.ea_lval24.s.srcabyte = LABEL_REFN (FETCH_LVAL24, 0);
+ eas.s.ea_lval24.s.srcaword = LABEL_REFN (FETCH_LVAL24, 0);
+
+ eas.s.ea_nop.s.srcabyte = LABEL_REFN (FETCH_NOP, 0);
+ eas.s.ea_nop.s.srcaword = LABEL_REFN (FETCH_NOP, 0);
+ eas.s.ea_nop.s.srcbbyte = LABEL_REFN (FETCH_NOP, 1);
+ eas.s.ea_nop.s.srcbword = LABEL_REFN (FETCH_NOP, 1);
+ eas.s.ea_nop.s.dstbyte = LABEL_REF (STORE_NOP);
+ eas.s.ea_nop.s.dstword = LABEL_REF (STORE_NOP);
+
+ eas.s.ea_cr.s.srcabyte = LABEL_REFN (FETCH_CRB, 0);
+ eas.s.ea_cr.s.srcaword = LABEL_REFN (FETCH_CRW, 0);
+
+ eas.s.ea_cr.s.srcbbyte = LABEL_REFN (FETCH_CRB, 1);
+ eas.s.ea_cr.s.srcbword = LABEL_REFN (FETCH_CRW, 1);
+
+ eas.s.ea_cr.s.dstbyte = LABEL_REF (STORE_CRB);
+ eas.s.ea_cr.s.dstword = LABEL_REF (STORE_CRW);
+
+ eas.s.ea_reg.s.srcabyte = LABEL_REFN (FETCH_REG_B, 0);
+ eas.s.ea_reg.s.srcaword = LABEL_REFN (FETCH_REG_W, 0);
+ eas.s.ea_reg.s.srcalong = LABEL_REFN (FETCH_REG_L, 0);
+
+ eas.s.ea_reg.s.srcbbyte = LABEL_REFN (FETCH_REG_B, 1);
+ eas.s.ea_reg.s.srcbword = LABEL_REFN (FETCH_REG_W, 1);
+ eas.s.ea_reg.s.srcblong = LABEL_REFN (FETCH_REG_L, 1);
+
+ eas.s.ea_reg.s.dstbyte = LABEL_REF (STORE_REG_B);
+ eas.s.ea_reg.s.dstword = LABEL_REF (STORE_REG_W);
+ eas.s.ea_reg.s.dstlong = LABEL_REF (STORE_REG_L);
+
+ eas.s.ea_inc.s.srcabyte = LABEL_REFN (FETCH_INC_B, 0);
+ eas.s.ea_inc.s.srcaword = LABEL_REFN (FETCH_INC_W, 0);
+ eas.s.ea_inc.s.srcbbyte = LABEL_REFN (FETCH_INC_B, 1);
+ eas.s.ea_inc.s.srcbword = LABEL_REFN (FETCH_INC_W, 1);
+ eas.s.ea_inc.s.dstbyte = LABEL_REF (STORE_INC_B);
+ eas.s.ea_inc.s.dstword = LABEL_REF (STORE_INC_W);
+
+ eas.s.ea_dec.s.srcabyte = LABEL_REFN (FETCH_DEC_B, 0);
+ eas.s.ea_dec.s.srcaword = LABEL_REFN (FETCH_DEC_W, 0);
+ eas.s.ea_dec.s.srcbbyte = LABEL_REFN (FETCH_DEC_B, 1);
+ eas.s.ea_dec.s.srcbword = LABEL_REFN (FETCH_DEC_W, 1);
+ eas.s.ea_dec.s.dstbyte = LABEL_REF (STORE_DEC_B);
+ eas.s.ea_dec.s.dstword = LABEL_REF (STORE_DEC_W);
+
+ eas.s.ea_disp.s.srcabyte = LABEL_REFN (FETCH_DISP_B, 0);
+ eas.s.ea_disp.s.srcaword = LABEL_REFN (FETCH_DISP_W, 0);
+ eas.s.ea_disp.s.srcbbyte = LABEL_REFN (FETCH_DISP_B, 1);
+ eas.s.ea_disp.s.srcbword = LABEL_REFN (FETCH_DISP_W, 1);
+ eas.s.ea_disp.s.dstbyte = LABEL_REF (STORE_DISP_B);
+ eas.s.ea_disp.s.dstword = LABEL_REF (STORE_DISP_W);
+
+ eas.s.ea_imm.s.srcabyte = LABEL_REFN (FETCH_IMM, 0);
+ eas.s.ea_imm.s.srcaword = LABEL_REFN (FETCH_IMM, 0);
+ eas.s.ea_imm.s.srcbbyte = LABEL_REFN (FETCH_IMM, 1);
+ eas.s.ea_imm.s.srcbword = LABEL_REFN (FETCH_IMM, 1);
+
+ flag_special = LABEL_REF (FLAG_special);
+ flag_mp = LABEL_REF (FLAG_m);
+ flag_Mp = LABEL_REF (FLAG_M);
+ flag_ap = LABEL_REF (FLAG_a);
+ flag_Ap = LABEL_REF (FLAG_A);
+ flag_nonep = LABEL_REF (FLAG_NONE);
+ flag_nostorep = LABEL_REF (FLAG_NOSTORE);
+ flag_clearp = LABEL_REF (FLAG_CLEAR);
+ flag_shiftbyte = LABEL_REF (FLAG_shiftbyte);
+ flag_shiftword = LABEL_REF (FLAG_shiftword);
+ flag_multbyte = LABEL_REF (FLAG_multbyte);
+ flag_multword = LABEL_REF (FLAG_multword);
+
+
+ exec_dispatch[O_ADDS] = LABEL_REF (O_ADDS);
+ exec_dispatch[O_ADDX] = LABEL_REF (O_ADDX);
+ exec_dispatch[O_ADD] = LABEL_REF (O_ADD);
+ exec_dispatch[O_ANDC] = LABEL_REF (O_ANDC);
+ exec_dispatch[O_AND] = LABEL_REF (O_AND);
+ exec_dispatch[O_BCC] = LABEL_REF (O_BCC);
+ exec_dispatch[O_BCLR] = LABEL_REF (O_BCLR);
+ exec_dispatch[O_BCS] = LABEL_REF (O_BCS);
+ exec_dispatch[O_BEQ] = LABEL_REF (O_BEQ);
+ exec_dispatch[O_BF] = LABEL_REF (O_BF);
+ exec_dispatch[O_BGE] = LABEL_REF (O_BGE);
+ exec_dispatch[O_BGT] = LABEL_REF (O_BGT);
+ exec_dispatch[O_BHI] = LABEL_REF (O_BHI);
+ exec_dispatch[O_BHS] = LABEL_REF (O_BHS);
+ exec_dispatch[O_BLE] = LABEL_REF (O_BLE);
+ exec_dispatch[O_BLO] = LABEL_REF (O_BLO);
+ exec_dispatch[O_BLS] = LABEL_REF (O_BLS);
+ exec_dispatch[O_BLT] = LABEL_REF (O_BLT);
+ exec_dispatch[O_BMI] = LABEL_REF (O_BMI);
+ exec_dispatch[O_BNE] = LABEL_REF (O_BNE);
+ exec_dispatch[O_BNOT] = LABEL_REF (O_BNOT);
+ exec_dispatch[O_BPL] = LABEL_REF (O_BPL);
+ exec_dispatch[O_BPT] = LABEL_REF (O_BPT);
+ exec_dispatch[O_BRA] = LABEL_REF (O_BRA);
+ exec_dispatch[O_BRN] = LABEL_REF (O_BRN);
+ exec_dispatch[O_BSET] = LABEL_REF (O_BSET);
+ exec_dispatch[O_BSR] = LABEL_REF (O_BSR);
+ exec_dispatch[O_BTST] = LABEL_REF (O_BTST);
+ exec_dispatch[O_BT] = LABEL_REF (O_BT);
+ exec_dispatch[O_BVC] = LABEL_REF (O_BVC);
+ exec_dispatch[O_BVS] = LABEL_REF (O_BVS);
+ exec_dispatch[O_CLR] = LABEL_REF (O_CLR);
+ exec_dispatch[O_CMP] = LABEL_REF (O_CMP);
+ exec_dispatch[O_DADD] = LABEL_REF (O_DADD);
+ exec_dispatch[O_DIVXU] = LABEL_REF (O_DIVXU);
+ exec_dispatch[O_DSUB] = LABEL_REF (O_DSUB);
+ exec_dispatch[O_EXTS] = LABEL_REF (O_EXTS);
+ exec_dispatch[O_EXTU] = LABEL_REF (O_EXTU);
+ exec_dispatch[O_JMP] = LABEL_REF (O_JMP);
+ exec_dispatch[O_JSR] = LABEL_REF (O_JSR);
+ exec_dispatch[O_LDC] = LABEL_REF (O_LDC);
+ exec_dispatch[O_LDM] = LABEL_REF (O_LDM);
+ exec_dispatch[O_LINK] = LABEL_REF (O_LINK);
+ exec_dispatch[O_MOVFPE] = LABEL_REF (O_MOVFPE);
+ exec_dispatch[O_MOVTPE] = LABEL_REF (O_MOVTPE);
+ exec_dispatch[O_MOV] = LABEL_REF (O_MOV);
+ exec_dispatch[O_MULXU] = LABEL_REF (O_MULXU);
+ exec_dispatch[O_NEG] = LABEL_REF (O_NEG);
+ exec_dispatch[O_NOP] = LABEL_REF (O_NOP);
+ exec_dispatch[O_NOT] = LABEL_REF (O_NOT);
+ exec_dispatch[O_ORC] = LABEL_REF (O_ORC);
+ exec_dispatch[O_OR] = LABEL_REF (O_OR);
+ exec_dispatch[O_PJMP] = LABEL_REF (O_PJMP);
+ exec_dispatch[O_PJSR] = LABEL_REF (O_PJSR);
+ exec_dispatch[O_PRTD] = LABEL_REF (O_PRTD);
+ exec_dispatch[O_PRTS] = LABEL_REF (O_PRTS);
+ exec_dispatch[O_RECOMPILE] = LABEL_REF (O_RECOMPILE);
+
+ exec_dispatch[O_ROTL] = LABEL_REF (O_ROTL);
+ exec_dispatch[O_ROTR] = LABEL_REF (O_ROTR);
+ exec_dispatch[O_ROTXL] = LABEL_REF (O_ROTXL);
+ exec_dispatch[O_ROTXR] = LABEL_REF (O_ROTXR);
+
+ exec_dispatch[O_RTD] = LABEL_REF (O_RTD);
+ exec_dispatch[O_RTS] = LABEL_REF (O_RTS);
+ exec_dispatch[O_SCB_EQ] = LABEL_REF (O_SCB_EQ);
+ exec_dispatch[O_SCB_F] = LABEL_REF (O_SCB_F);
+ exec_dispatch[O_SCB_NE] = LABEL_REF (O_SCB_NE);
+ exec_dispatch[O_SHAL] = LABEL_REF (O_SHAL);
+ exec_dispatch[O_SHAR] = LABEL_REF (O_SHAR);
+ exec_dispatch[O_SHLL] = LABEL_REF (O_SHLL);
+ exec_dispatch[O_SHLR] = LABEL_REF (O_SHLR);
+
+ exec_dispatch[O_SLEEP] = LABEL_REF (O_SLEEP);
+ exec_dispatch[O_STC] = LABEL_REF (O_STC);
+ exec_dispatch[O_STM] = LABEL_REF (O_STM);
+ exec_dispatch[O_SUBS] = LABEL_REF (O_SUBS);
+ exec_dispatch[O_SUBX] = LABEL_REF (O_SUBX);
+ exec_dispatch[O_SUB] = LABEL_REF (O_SUB);
+ exec_dispatch[O_SWAP] = LABEL_REF (O_SWAP);
+ exec_dispatch[O_TAS] = LABEL_REF (O_TAS);
+ exec_dispatch[O_TRAPA] = LABEL_REF (O_TRAPA);
+ exec_dispatch[O_TRAP_VS] = LABEL_REF (O_TRAP_VS);
+ exec_dispatch[O_TST] = LABEL_REF (O_TST);
+ exec_dispatch[O_UNLK] = LABEL_REF (O_UNLK);
+ exec_dispatch[O_XCH] = LABEL_REF (O_XCH);
+ exec_dispatch[O_XORC] = LABEL_REF (O_XORC);
+ exec_dispatch[O_XOR] = LABEL_REF (O_XOR);
+ nop.type = eas.s.ea_nop.s.srcabyte;
+ cpu.cache[0].opcode = exec_dispatch[O_RECOMPILE];
+ cpu.cache[0].srca.type = eas.s.ea_nop.s.srcabyte;
+ cpu.cache[0].srcb.type = eas.s.ea_nop.s.srcbbyte;
+ }
+
+ prev = signal (SIGINT, control_c);
+ prev_seg = signal (SIGSEGV, segv);
+
+ if (step)
+ {
+ cpu.exception = SIGTRAP;
+ }
+ else
+ {
+ cpu.exception = 0;
+ }
+
+ pc = cpu.regs[R_PC].s[LOW] + (NORMAL_CP << 16);
+
+ GETSR ();
+
+ if (setjmp (jbuf) == 0) {
+ do
+ {
+ int cidx;
+ decoded_inst *code;
+
+ top:
+ cidx = cpu.cache_idx[pc];
+ code = cpu.cache + cidx;
+
+ FETCH (arga, code->srca, 0);
+ FETCH (argb, code->srcb, 1);
+
+
+
+#ifdef DEBUG
+ if (debug)
+ {
+ printf ("%x %d %s\n", pc, code->opcode,
+ code->op ? code->op->name : "**");
+ }
+#endif
+
+ cycles += code->cycles;
+ insts++;
+ DISPATCH (code->opcode)
+ {
+ LABEL (O_RECOMPILE):
+ /* This opcode is a fake for when we get to an instruction which
+ hasn't been compiled */
+ compile (pc);
+ goto top;
+ break;
+ LABEL (O_NEG):
+ arga = -arga;
+ argb = 0;
+ res = arga + argb;
+ break;
+ LABEL (O_SUBX):
+ arga += C;
+ LABEL (O_SUB):
+ LABEL (O_SUBS):
+ arga = -arga;
+ LABEL (O_ADD):
+ LABEL (O_ADDS):
+ res = arga + argb;
+ break;
+
+ LABEL (O_ADDX):
+ res = arga + argb + C;
+ break;
+
+ LABEL (O_AND):
+ LABEL (O_ANDC):
+ res = arga & argb;
+ break;
+ break;
+
+ LABEL (O_BCLR):
+ arga &= 0xf;
+ bit = (argb & (1 << arga));
+ res = argb & ~(1 << arga);
+ goto bitop;
+
+
+ LABEL (O_BRA):
+ LABEL (O_BT):
+ if (1)
+ goto condtrue;
+
+ LABEL (O_BRN):
+ LABEL (O_BF):
+ if (0)
+ goto condtrue;
+ break;
+
+ LABEL (O_BHI):
+ if ((C || Z) == 0)
+ goto condtrue;
+ break;
+
+ LABEL (O_BLS):
+ if ((C || Z))
+ goto condtrue;
+ break;
+
+ LABEL (O_BCS):
+ LABEL (O_BLO):
+ if ((C == 1))
+ goto condtrue;
+ break;
+
+ LABEL (O_BCC):
+ LABEL (O_BHS):
+ if ((C == 0))
+ goto condtrue;
+ break;
+
+ LABEL (O_BEQ):
+ if (Z)
+ goto condtrue;
+ break;
+ LABEL (O_BGT):
+ if (((Z || (N ^ V)) == 0))
+ goto condtrue;
+ break;
+
+
+ LABEL (O_BLE):
+ if (((Z || (N ^ V)) == 1))
+ goto condtrue;
+ break;
+
+ LABEL (O_BGE):
+ if ((N ^ V) == 0)
+ goto condtrue;
+ break;
+ LABEL (O_BLT):
+ if ((N ^ V))
+ goto condtrue;
+ break;
+ LABEL (O_BMI):
+ if ((N))
+ goto condtrue;
+ break;
+ LABEL (O_BNE):
+ if ((Z == 0))
+ goto condtrue;
+ break;
+ LABEL (O_BPL):
+ if (N == 0)
+ goto condtrue;
+ break;
+ break;
+ LABEL (O_BVC):
+ if ((V == 0))
+ goto condtrue;
+ break;
+ LABEL (O_BVS):
+ if ((V == 1))
+ goto condtrue;
+ break;
+
+ LABEL (O_BNOT):
+ bit = argb & (1<<(arga & 0xf));
+ res = argb ^ (1<<(arga & 0xf));
+ goto bitop;
+ break;
+
+ LABEL (O_BSET):
+ arga = 1 << (arga & 0xf);
+ bit = argb & arga;
+ res = argb | arga;
+ goto bitop;
+ break;
+
+ LABEL (O_PJMP):
+ pc = arga;
+ goto next;
+
+ LABEL (O_UNLK):
+ {
+ int t;
+ SET_NORMREG (R7, GET_NORMREG (R6));
+ POPWORD (t);
+ SET_NORMREG (R6, t);
+ pc = code->next_pc;
+ goto next;
+ }
+
+ LABEL (O_RTS):
+ {
+ int cp = pc & 0xff0000;
+ POPWORD (pc);
+ pc |= cp;
+ goto next;
+ }
+ break;
+
+ LABEL (O_PRTS):
+ {
+ int cp;
+ int off;
+ POPWORD (cp);
+ POPWORD (off);
+ cp <<= 16;
+ SET_SEGREG (R_CP, cp);
+ pc = cp + off;
+ }
+ goto next;
+
+ LABEL (O_PJSR):
+ PUSHWORD (argb & 0xffff);
+ PUSHWORD (argb >> 16);
+ pc = (arga & 0xffffff);
+ goto next;
+
+ LABEL (O_BSR):
+ LABEL (O_JSR):
+ PUSHWORD (code->next_pc);
+ pc = arga | (pc & 0xff0000);
+ goto next;
+
+ LABEL (O_BTST):
+ Z = (((argb >> (arga & 0xf)) & 1) == 0);
+ pc = code->next_pc;
+ goto next;
+
+ LABEL (O_CLR):
+ res = 0;
+ break;
+
+ LABEL (O_CMP):
+ arga = -arga;
+ res = arga + argb;
+ break;
+
+ LABEL (O_DADD):
+ res = arga + argb + C;
+ if (res > 99)
+ {
+ res -= 100;
+ C = 1;
+ }
+ else
+ {
+ C = 0;
+ }
+ Z = Z && (res == 0);
+ break;
+
+
+ LABEL (O_DSUB):
+ res = argb - arga - C;
+ if (res < 0)
+ {
+ res += 100;
+ C = 1;
+ }
+ else
+ {
+ C = 0;
+ }
+ Z = Z && (res == 0);
+ break;
+
+ LABEL (O_EXTS):
+ res = SEXTCHAR (arga);
+ break;
+
+ LABEL (O_EXTU):
+ res = (unsigned char) arga;
+ break;
+
+ LABEL (O_JMP):
+ pc = arga | (pc & 0xff0000);
+ goto next;
+ break;
+
+ LABEL (O_LDM):
+
+ for (tmp = 0; tmp < 7; tmp++)
+ {
+ if (argb & (1 << tmp))
+ {
+ POPWORD (cpu.regs[tmp].s[LOW]);
+ }
+ }
+ if (argb & 0x80)
+ POPWORD (tmp); /* dummy ready for sp */
+ goto nextpc;
+ break;
+
+ LABEL (O_LINK):
+ PUSHWORD (cpu.regs[R6].s[LOW]);
+ cpu.regs[R6].s[LOW] = cpu.regs[R7].s[LOW];
+ cpu.regs[R7].s[LOW] += argb;
+ goto nextpc;
+
+ LABEL (O_STC):
+ LABEL (O_LDC):
+ LABEL (O_MOVFPE):
+ LABEL (O_MOVTPE):
+ LABEL (O_MOV):
+ LABEL (O_TST):
+ res = arga;
+ break;
+
+ LABEL (O_TRAPA):
+ if (arga == 15)
+ {
+ trap ();
+ }
+ else
+ {
+ PUSHWORD (pc & 0xffff);
+ if (cpu.maximum)
+ {
+ PUSHWORD (NORMAL_CP);
+ }
+ PUSHWORD (NORMAL_SR);
+ if (cpu.maximum)
+ {
+ arga = arga * 4 + 0x40;
+ SET_NORMAL_CPPC (longat (cpu.memory + arga));
+ }
+ else
+ {
+ arga = arga * 2 + 0x20;
+ SET_NORMAL_CPPC (wordat (cpu.memory + arga));
+ }
+ }
+ break;
+
+ LABEL (O_OR):
+ LABEL (O_ORC):
+ res = arga | argb;
+ break;
+
+ LABEL (O_XOR):
+ LABEL (O_XORC):
+ res = arga ^ argb;
+ break;
+
+ LABEL (O_SCB_F):
+ {
+ scb_f:
+ res = arga - 1;
+ code->srca.reg.wptr[0] = res;
+ if (res != -1)
+ {
+ pc = argb;
+ goto next;
+ }
+ }
+ break;
+
+ LABEL (O_SCB_EQ):
+ if (Z == 1)
+ break;
+ else
+ goto scb_f;
+
+ LABEL (O_SCB_NE):
+ if (Z == 0)
+ break;
+ else
+ goto scb_f;
+
+ LABEL (O_NOP):
+ /* If only they were all as simple as this */
+ break;
+
+ LABEL (O_ROTL):
+ res = arga << 1;
+ C = (res >> argb) & 1;
+ res |= C;
+ break;
+
+
+ LABEL (O_ROTR):
+ C = arga & 1;
+ res = arga >> 1;
+ res |= (C << (argb - 1));
+ break;
+
+ LABEL (O_ROTXL):
+ res = arga << 1;
+ res |= C;
+ C = (res >> argb) & 1;
+ break;
+
+ LABEL (O_ROTXR):
+ res = arga >> 1;
+ res |= (C << (argb - 1));
+ C = arga & 1;
+ break;
+
+ LABEL (O_SHAL):
+ res = arga << 1;
+ if (argb == 16)
+ {
+ C = (res >> (16)) & 1;
+ Z = ((res & 0xffff) == 0);
+ N = ((res & 0x8000) != 0);
+ }
+
+ else
+ {
+ C = (res >> (8)) & 1;
+ Z = ((res & 0xff) == 0);
+ N = ((res & 0x80) != 0);
+
+ }
+ V = C ^ N;
+ goto none;
+
+ LABEL (O_SHAR):
+ C = arga & 1;
+ if (argb == 16)
+ {
+ res = ((short) arga) >> 1;
+ }
+ else
+ {
+ res = (SEXTCHAR (arga)) >> 1;
+ }
+ break;
+
+ LABEL (O_SHLL):
+ res = arga << 1;
+ C = (res >> argb) & 1;
+ break;
+
+ LABEL (O_SHLR):
+ C = arga & 1;
+ res = arga >> 1;
+ break;
+
+ LABEL (O_DIVXU):
+ if (arga == 0)
+ {
+ N = V = C = 0;
+ Z = 1;
+ cpu.exception = SIGILL;
+ }
+ else
+ {
+ int d = argb / arga;
+ int m = argb % arga;
+ if (code->dst.type == eas.s.ea_reg.s.dstlong)
+ {
+ res = (m << 16) | (d & 0xffff);
+ }
+ else
+ {
+ res = (m << 8) | (d & 0xff);
+ }
+
+ }
+ break;
+
+ LABEL (O_MULXU):
+ res = arga * argb;
+ break;
+
+ LABEL (O_NOT):
+ res = ~arga;
+ break;
+
+ LABEL (O_SWAP):
+ res = ((arga >> 8) & 0xff) | ((arga << 8) & 0xff00);
+ break;
+
+
+ LABEL (O_STM):
+ for (tmp = 7; tmp >= 0; tmp--)
+ {
+ if (arga & (1 << tmp))
+ {
+ PUSHWORD (cpu.regs[tmp].s[LOW]);
+ }
+ }
+ goto nextpc;
+
+ LABEL (O_TAS):
+ C = 0;
+ V = 0;
+ Z = arga == 0;
+ N = arga < 0;
+ res = arga | 0x80;
+ goto none;
+
+ LABEL (O_PRTD):
+ LABEL (O_XCH):
+ LABEL (O_RTD):
+ cpu.exception = SIGILL;
+ goto next;
+
+ LABEL (O_TRAP_VS):
+ LABEL (O_SLEEP):
+ LABEL (O_BPT):
+ cpu.exception = SIGTRAP;
+ goto next;
+ break;
+ }
+
+ ENDDISPATCH;
+
+ DISPATCH (code->flags)
+ {
+ bitop:
+ Z = (res & bit) == 0;
+ pc = code->next_pc;
+ break;
+ LABEL (FLAG_multword):
+ Z = (res & 0xffff) == 0;
+ N = (res & 0x8000) != 0;
+ V = 0;
+ C = 0;
+ pc = code->next_pc;
+ break;
+
+ LABEL (FLAG_multbyte):
+ /* 8*8 -> 16 */
+ Z = (res & 0xff) == 0;
+ N = (res & 0x80) != 0;
+ V = 0;
+ C = 0;
+ pc = code->next_pc;
+ break;
+
+ LABEL (FLAG_shiftword):
+ N = (res & 0x8000) != 0;
+ Z = (res & 0xffff) == 0;
+ V = 0;
+ pc = code->next_pc;
+ break;
+
+ LABEL (FLAG_shiftbyte):
+ N = (res & 0x80) != 0;
+ Z = (res & 0xff) == 0;
+ V = 0;
+ pc = code->next_pc;
+ break;
+
+ LABEL (FLAG_special):
+ pc = code->next_pc;
+ break;
+
+ LABEL (FLAG_m):
+ /* Move byte flags */
+ /* after a logical instruction */
+ N = (res & 0x80) != 0;
+ Z = (res & 0xff) == 0;
+ V = (((~arga & ~argb & res) | (arga & argb & ~res)) & 0x80) != 0;
+ pc = code->next_pc;
+ break;
+
+ LABEL (FLAG_M):
+ /* Move word flags */
+ /* after a logical instruction */
+ N = (res & 0x8000) != 0;
+ Z = (res & 0xffff) == 0;
+ V = (((~arga & ~argb & res) | (arga & argb & ~res)) & 0x8000) != 0;
+ pc = code->next_pc;
+ break;
+
+ LABEL (FLAG_a):
+ /* after byte sized arith */
+ C = (res & 0x100) != 0;
+ N = (res & 0x80) != 0;
+ Z = (res & 0xff) == 0;
+ V = (((~arga & ~argb & res) | (arga & argb & ~res)) & 0x80) != 0;
+ pc = code->next_pc;
+ break;
+
+ LABEL (FLAG_A):
+ /* after word sized arith */
+ C = (res & 0x10000) != 0;
+ N = (res & 0x8000) != 0;
+ Z = (res & 0xffff) == 0;
+ V = (((~arga & ~argb & res) | (arga & argb & ~res)) & 0x8000) != 0;
+ pc = code->next_pc;
+ break;
+
+ LABEL (FLAG_NONE):
+ none:;
+ /* no flags but store */
+ pc = code->next_pc;
+ break;
+ LABEL (FLAG_NOSTORE):
+ /* no flags and no store */
+ pc = code->next_pc;
+ break;
+ LABEL (FLAG_CLEAR):
+ /* clear flags */
+ N = 0;
+ Z = 1;
+ V = 0;
+ C = 0;
+ pc = code->next_pc;
+ break;
+ condtrue:
+ pc = arga;
+ goto next;
+ }
+ ENDDISPATCH;
+
+ DISPATCH (code->dst.type)
+ {
+ unsigned char *lval;
+
+ LABEL (STORE_CRB):
+ (*(code->dst.reg.segptr)) = cpu.memory + (res << 16);
+ break;
+
+ LABEL (STORE_NOP):
+ break;
+
+ LABEL (STORE_REG_B):
+ (*(code->dst.reg.bptr)) = res;
+ break;
+
+ LABEL (STORE_REG_W):
+ (*(code->dst.reg.wptr)) = res;
+ break;
+
+ LABEL (STORE_REG_L):
+ {
+ int l, r;
+
+ r = (union rtype *) (code->dst.reg.wptr) - &cpu.regs[0];
+ r++;
+ *(code->dst.reg.wptr) = res >> 16;
+ cpu.regs[r].s[LOW] = res & 0xffff;
+
+ }
+
+ break;
+
+ LABEL (STORE_DISP_W):
+ lval = displval (code->dst);
+ setwordat (lval, res);
+ break;
+
+ LABEL (STORE_DISP_B):
+ lval = displval (code->dst);
+ setbyteat (lval, res);
+ break;
+
+ LABEL (STORE_INC_B):
+ lval = elval (code->dst, 0);
+ setbyteat (lval, res);
+ (*(code->dst.reg.wptr))++;
+ break;
+
+ LABEL (STORE_INC_W):
+ lval = elval (code->dst, 0);
+ setwordat (lval, res);
+ (*(code->dst.reg.wptr)) += 2;
+ break;
+
+ LABEL (STORE_DEC_B):
+ (*(code->dst.reg.wptr))--;
+ lval = elval (code->dst, 0);
+ setbyteat (lval, res);
+ break;
+
+ LABEL (STORE_CRW):
+ /* Make an up to date sr from the flag state */
+ cpu.regs[R_SR].s[LOW] = res;
+ GETSR ();
+ break;
+
+ LABEL (STORE_DEC_W):
+ (*(code->dst.reg.wptr)) -= 2;
+ lval = elval (code->dst, 0);
+ setwordat (lval, res);
+
+ break;
+
+ nextpc:
+ pc = code->next_pc;
+
+ }
+ ENDDISPATCH;
+ next:;
+ }
+ while (!cpu.exception);
+ }
+
+ cpu.ticks += get_now () - tick_start;
+ cpu.cycles += cycles;
+ cpu.insts += insts;
+ cpu.regs[R_PC].s[LOW] = pc;
+ BUILDSR ();
+
+ signal (SIGINT, prev);
+ signal (SIGSEGV, prev_seg);
+}
+
+
+
+
+int
+sim_write (sd, addr, buffer, size)
+ SIM_DESC sd;
+ SIM_ADDR addr;
+ unsigned char *buffer;
+ int size;
+{
+ int i;
+
+ init_pointers ();
+ if (addr < 0 || addr + size > H8500_MSIZE)
+ return 0;
+ for (i = 0; i < size; i++)
+ {
+ cpu.memory[addr + i] = buffer[i];
+ cpu.cache_idx[addr + i] = 0;
+ }
+ return size;
+}
+
+int
+sim_read (sd, addr, buffer, size)
+ SIM_DESC sd;
+ SIM_ADDR addr;
+ unsigned char *buffer;
+ int size;
+{
+ init_pointers ();
+ if (addr < 0 || addr + size > H8500_MSIZE)
+ return 0;
+ memcpy (buffer, cpu.memory + addr, size);
+ return size;
+}
+
+/* Ripped off from tm-h8500.h */
+
+#define R0_REGNUM 0
+#define R1_REGNUM 1
+#define R2_REGNUM 2
+#define R3_REGNUM 3
+#define R4_REGNUM 4
+#define R5_REGNUM 5
+#define R6_REGNUM 6
+#define R7_REGNUM 7
+
+/* As above, but with correct seg register glued on */
+#define PR0_REGNUM 8
+#define PR1_REGNUM 9
+#define PR2_REGNUM 10
+#define PR3_REGNUM 11
+#define PR4_REGNUM 12
+#define PR5_REGNUM 13
+#define PR6_REGNUM 14
+#define PR7_REGNUM 15
+
+#define SP_REGNUM PR7_REGNUM /* Contains address of top of stack */
+#define FP_REGNUM PR6_REGNUM /* Contains address of executing stack frame */
+
+
+#define SEG_C_REGNUM 16 /* Segment registers */
+#define SEG_D_REGNUM 17
+#define SEG_E_REGNUM 18
+#define SEG_T_REGNUM 19
+
+#define CCR_REGNUM 20 /* Contains processor status */
+#define PC_REGNUM 21 /* Contains program counter */
+
+#define CYCLE_REGNUM 22
+#define INST_REGNUM 23
+#define TICK_REGNUM 24
+
+int
+sim_store_register (sd, rn, value, length)
+ SIM_DESC sd;
+ int rn;
+ unsigned char *value;
+ int length;
+{
+ int seg = 0;
+ int reg = -1;
+
+ init_pointers ();
+ switch (rn)
+ {
+ case PC_REGNUM:
+ SET_SEGREG (R_CP, (value[1]<<16));
+ cpu.regs[R_PC].s[LOW] = (value[2] << 8) | value[3];
+ break;
+ case SEG_C_REGNUM:
+ case SEG_D_REGNUM:
+ case SEG_E_REGNUM:
+ case SEG_T_REGNUM:
+ seg = rn - SEG_C_REGNUM + R_CP;
+ reg = -1;
+ break;
+ default:
+ abort ();
+ case R0_REGNUM:
+ case R1_REGNUM:
+ case R2_REGNUM:
+ case R3_REGNUM:
+ case R4_REGNUM:
+ case R5_REGNUM:
+ case R6_REGNUM:
+ case R7_REGNUM:
+ seg = 0;
+ reg = rn - R0_REGNUM;
+ break;
+ case CCR_REGNUM:
+ seg = 0;
+ reg = R_SR;
+ break;
+ case CYCLE_REGNUM:
+ cpu.cycles = (value[0] << 24) | (value[1] << 16) | (value[2] << 8) | value[3];
+ return;
+ case INST_REGNUM:
+ cpu.insts = (value[0] << 24) | (value[1] << 16) | (value[2] << 8) | value[3];
+ return;
+ case TICK_REGNUM:
+ cpu.ticks = (value[0] << 24) | (value[1] << 16) | (value[2] << 8) | value[3];
+ return;
+ case PR0_REGNUM:
+ case PR1_REGNUM:
+ case PR2_REGNUM:
+ case PR3_REGNUM:
+ case PR4_REGNUM:
+ case PR5_REGNUM:
+ case PR6_REGNUM:
+ case PR7_REGNUM:
+ SET_SEGREG (segforreg[rn], value[1]);
+ reg = rn - PR0_REGNUM;
+ cpu.regs[reg].s[LOW] = (value[2] << 8) | value[3];
+ return;
+ }
+
+ if (seg)
+ SET_SEGREG (seg, value[0] << 16);
+
+ if (reg > 0)
+ {
+ cpu.regs[reg].s[LOW] = (value[0] << 8) | value[1];
+ }
+ return -1;
+}
+
+int
+sim_fetch_register (sd, rn, buf, length)
+ SIM_DESC sd;
+ int rn;
+ unsigned char *buf;
+ int length;
+{
+ init_pointers ();
+
+ switch (rn)
+ {
+ default:
+ abort ();
+ case SEG_C_REGNUM:
+ case SEG_D_REGNUM:
+ case SEG_E_REGNUM:
+ case SEG_T_REGNUM:
+ buf[0] = GET_SEGREG(rn - SEG_C_REGNUM + R_CP);
+ break;
+ case CCR_REGNUM:
+ buf[0] = cpu.regs[R_SR].s[HIGH];
+ buf[1] = cpu.regs[R_SR].s[LOW];
+ break;
+ case PC_REGNUM:
+ buf[0] = 0;
+ buf[1] = GET_SEGREG(R_CP);
+ buf[2] = HIGH_BYTE (cpu.regs[R_PC].s[LOW]);
+ buf[3] = LOW_BYTE (cpu.regs[R_PC].s[LOW]);
+ break;
+
+ case PR0_REGNUM:
+ case PR1_REGNUM:
+ case PR2_REGNUM:
+ case PR3_REGNUM:
+ case PR4_REGNUM:
+ case PR5_REGNUM:
+ case PR6_REGNUM:
+ case PR7_REGNUM:
+ rn -= PR0_REGNUM;
+ buf[0] = 0;
+ buf[1] = GET_SEGREG(segforreg[rn]);
+ buf[2] = HIGH_BYTE (cpu.regs[rn].s[LOW]);
+ buf[3] = LOW_BYTE (cpu.regs[rn].s[LOW]);
+ break;
+ case R0_REGNUM:
+ case R1_REGNUM:
+ case R2_REGNUM:
+ case R3_REGNUM:
+ case R4_REGNUM:
+ case R5_REGNUM:
+ case R6_REGNUM:
+ case R7_REGNUM:
+ buf[0] = HIGH_BYTE (cpu.regs[rn].s[LOW]);
+ buf[1] = LOW_BYTE (cpu.regs[rn].s[LOW]);
+ break;
+ case CYCLE_REGNUM:
+ buf[0] = cpu.cycles >> 24;
+ buf[1] = cpu.cycles >> 16;
+ buf[2] = cpu.cycles >> 8;
+ buf[3] = cpu.cycles >> 0;
+ break;
+
+ case TICK_REGNUM:
+ buf[0] = cpu.ticks >> 24;
+ buf[1] = cpu.ticks >> 16;
+ buf[2] = cpu.ticks >> 8;
+ buf[3] = cpu.ticks >> 0;
+ break;
+
+ case INST_REGNUM:
+ buf[0] = cpu.insts >> 24;
+ buf[1] = cpu.insts >> 16;
+ buf[2] = cpu.insts >> 8;
+ buf[3] = cpu.insts >> 0;
+ break;
+ }
+ return -1;
+}
+
+int
+sim_trace (sd)
+ SIM_DESC sd;
+{
+
+ int i;
+
+ for (i = 0; i < 12; i += 2)
+ {
+ unsigned char *p = cpu.regs[R_TP].c + ((cpu.regs[R6].s[LOW] + i) & 0xffff);
+ unsigned short *j = (unsigned short *) p;
+
+ printf ("%04x ", *j);
+ }
+ printf ("\n");
+ printf ("%02x %02x %02x %02x:%04x %04x %04x %04x %04x %04x %04x %04x %04x\n",
+ NORMAL_DP,
+ NORMAL_EP,
+ NORMAL_TP,
+ NORMAL_CP,
+ cpu.regs[R_PC].s[LOW],
+ cpu.regs[0].s[LOW],
+ cpu.regs[1].s[LOW],
+ cpu.regs[2].s[LOW],
+ cpu.regs[3].s[LOW],
+ cpu.regs[4].s[LOW],
+ cpu.regs[5].s[LOW],
+ cpu.regs[6].s[LOW],
+ cpu.regs[7].s[LOW]);
+ sim_resume (sd, 1, 0);
+ return 0;
+}
+
+void
+sim_stop_reason (sd, reason, sigrc)
+ SIM_DESC sd;
+ enum sim_stop *reason;
+ int *sigrc;
+{
+ *reason = sim_stopped;
+ *sigrc = cpu.exception;
+}
+
+void
+sim_set_simcache_size (n)
+{
+ if (cpu.cache)
+ free (cpu.cache);
+ if (n < 2)
+ n = 2;
+ cpu.cache = (decoded_inst *) malloc (sizeof (decoded_inst) * n);
+ cpu.csize = n;
+}
+
+void
+sim_size (n)
+ int n;
+{
+ /* Fixed size. */
+}
+
+void
+sim_info (sd, verbose)
+ SIM_DESC sd;
+ int verbose;
+{
+ double timetaken = (double) cpu.ticks / (double) now_persec ();
+ double virttime = cpu.cycles / 10.0e6;
+
+ (*sim_callback->printf_filtered) (sim_callback,
+ "\n\ninstructions executed %10d\n",
+ cpu.insts);
+ (*sim_callback->printf_filtered) (sim_callback,
+ "cycles (v approximate) %10d\n",
+ cpu.cycles);
+ (*sim_callback->printf_filtered) (sim_callback,
+ "real time taken %10.4f\n",
+ timetaken);
+ (*sim_callback->printf_filtered) (sim_callback,
+ "virtual time taked %10.4f\n",
+ virttime);
+ if (timetaken)
+ {
+ (*sim_callback->printf_filtered) (sim_callback,
+ "simulation ratio %10.4f\n",
+ virttime / timetaken);
+ }
+
+ (*sim_callback->printf_filtered) (sim_callback,
+ "compiles %10d\n",
+ cpu.compiles);
+ (*sim_callback->printf_filtered) (sim_callback,
+ "cache size %10d\n",
+ cpu.csize);
+}
+
+SIM_DESC
+sim_open (kind, cb, abfd, argv)
+ SIM_OPEN_KIND kind;
+ host_callback *cb;
+ struct _bfd *abfd;
+ char **argv;
+{
+ sim_kind = kind;
+ myname = argv[0];
+ sim_callback = cb;
+ /* fudge our descriptor */
+ return (SIM_DESC) 1;
+}
+
+void
+sim_close (sd, quitting)
+ SIM_DESC sd;
+ int quitting;
+{
+ /* nothing to do */
+}
+
+SIM_RC
+sim_load (sd, prog, abfd, from_tty)
+ SIM_DESC sd;
+ char *prog;
+ bfd *abfd;
+ int from_tty;
+{
+ extern bfd *sim_load_file (); /* ??? Don't know where this should live. */
+ bfd *prog_bfd;
+
+ prog_bfd = sim_load_file (sd, myname, sim_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, abfd, argv, env)
+ SIM_DESC sd;
+ struct _bfd *abfd;
+ char **argv;
+ char **env;
+{
+ int pc;
+ bfd_vma start_address;
+ if (abfd != NULL)
+ start_address = bfd_get_start_address (abfd);
+ else
+ start_address = 0;
+
+ /* ??? We assume this is a 4 byte quantity. */
+ pc = start_address;
+
+ sim_store_register (sd, PC_REGNUM, (unsigned char *) &pc, 4);
+ return SIM_RC_OK;
+}
+
+void
+sim_do_command (sd, cmd)
+ SIM_DESC sd;
+ char *cmd;
+{
+ (*sim_callback->printf_filtered) (sim_callback,
+ "This simulator does not accept any commands.\n");
+}
+
+void
+sim_set_callbacks (ptr)
+ struct host_callback_struct *ptr;
+{
+ sim_callback = ptr;
+}
diff --git a/sim/h8500/config.in b/sim/h8500/config.in
new file mode 100644
index 00000000000..1f87a2bee4e
--- /dev/null
+++ b/sim/h8500/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/h8500/configure b/sim/h8500/configure
new file mode 100755
index 00000000000..7e4cfb07b25
--- /dev/null
+++ b/sim/h8500/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 stdlib.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: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/h8500/configure.in b/sim/h8500/configure.in
new file mode 100644
index 00000000000..67a48825045
--- /dev/null
+++ b/sim/h8500/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(stdlib.h time.h)
+
+SIM_AC_OUTPUT
diff --git a/sim/h8500/inst.h b/sim/h8500/inst.h
new file mode 100644
index 00000000000..328ca945a89
--- /dev/null
+++ b/sim/h8500/inst.h
@@ -0,0 +1,101 @@
+#define DEBUG
+
+#define H8500_MSIZE (8*64*1024)
+#define CSIZE 1000
+
+
+union rtype
+ {
+ unsigned long l;
+ unsigned short s[2];
+ unsigned char *c;
+ };
+
+
+/* Local register names */
+typedef enum
+{
+ R0, R1, R2, R3, R4, R5, R6, R7,
+ R_SR, /* 8 */
+ R_PC, /* 9 */
+ R_BR, /* 10 */
+ R_BP, /* 11 */
+ R_CP, /* 14 */
+ R_DP, /* 13 */
+ R_EP, /* 12 */
+ R_TP, /* 15 */
+ R_HARD_0, /* 16 */
+ R_HARD8_0, /* 17 */
+ R_LAST,
+} reg_type;
+
+
+
+
+typedef struct
+{
+ fastref type;
+ union
+ {
+ int code;
+ unsigned char *bptr;
+ unsigned short *wptr;
+ unsigned long *lptr;
+ unsigned char **segptr;
+ union rtype *rptr;
+
+ }
+ reg;
+ int literal;
+ union
+ {
+ unsigned char **segreg;
+ unsigned short *wptr;
+ union rtype *rptr;
+ }
+ r2;
+}
+
+ea_type;
+
+
+
+typedef struct
+{
+ ea_type srca;
+ ea_type srcb;
+ ea_type dst;
+ fastref opcode;
+ fastref flags;
+ int next_pc;
+ int oldpc;
+ int cycles;
+#ifdef DEBUG
+ h8500_opcode_info *op;
+#endif
+}
+
+decoded_inst;
+
+
+
+typedef struct
+{
+ int exception;
+ union rtype regs[20];
+
+
+
+ unsigned char *memory;
+ unsigned short *cache_idx;
+ int cache_top;
+ int maximum;
+ int csize;
+ decoded_inst *cache;
+ int cycles;
+ int insts;
+ int ticks;
+ int compiles;
+}
+
+cpu_state_type;
diff --git a/sim/h8500/tconfig.in b/sim/h8500/tconfig.in
new file mode 100644
index 00000000000..21e0d0446a9
--- /dev/null
+++ b/sim/h8500/tconfig.in
@@ -0,0 +1,13 @@
+/* h8500 target configuration 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