From 0605b6dff4962813db633c97cefeb0008b166e4d Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Sun, 17 Mar 2013 16:50:57 -0700 Subject: [PATCH] Added support for building on Solaris with the Sun C compiler --- VAX/vax_cpu.c | 1 - makefile | 14 ++++++++++++-- sim_disk.c | 2 +- sim_ether.h | 2 +- sim_fio.c | 3 ++- sim_fio.h | 2 +- sim_tape.c | 2 -- 7 files changed, 17 insertions(+), 9 deletions(-) diff --git a/VAX/vax_cpu.c b/VAX/vax_cpu.c index fc68e020..c302c58c 100644 --- a/VAX/vax_cpu.c +++ b/VAX/vax_cpu.c @@ -3069,7 +3069,6 @@ for ( ;; ) { break; } /* end case op */ } /* end for */ -ABORT (STOP_UNKNOWN); } /* end sim_instr */ /* Prefetch buffer routine diff --git a/makefile b/makefile index 5f6eb835..c5ff3d21 100644 --- a/makefile +++ b/makefile @@ -2,7 +2,7 @@ # This GNU make makefile has been tested on: # Linux (x86 & Sparc & PPC) # OS X -# Solaris (x86 & Sparc) +# Solaris (x86 & Sparc) (gcc and Sun C) # OpenBSD # NetBSD # FreeBSD @@ -74,6 +74,14 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin) ifeq (,$(shell $(GCC) -v /dev/null 2>&1 | grep 'clang')) GCC_VERSION = $(shell $(GCC) -v /dev/null 2>&1 | grep 'gcc version' | awk '{ print $$3 }') COMPILER_NAME = GCC Version: $(GCC_VERSION) + ifeq (,$(GCC_VERSION)) + ifeq (SunOS,$(OSTYPE)) + ifneq (,$(shell $(GCC) -V | grep 'Sun C')) + SUNC_VERSION = $(shell $(GCC) -V | grep 'Sun C' | awk '{ print $$4 }') + COMPILER_NAME = Sun C $(SUNC_VERSION) + endif + endif + endif else ifeq (Apple,$(shell $(GCC) -v /dev/null 2>&1 | grep 'Apple' | awk '{ print $$1 }')) COMPILER_NAME = $(shell $(GCC) -v /dev/null 2>&1 | grep 'Apple' | awk '{ print $$1 " " $$2 " " $$3 " " $$4 }') @@ -469,7 +477,9 @@ endif ifeq (HP-UX,$(OSTYPE)) CC_STD = -std=gnu99 else - CC_STD = -std=c99 + ifeq (,$(SUNC_VERSION)) + CC_STD = -std=c99 + endif endif CC_OUTSPEC = -o $@ CC = $(GCC) $(CC_STD) -U__STRICT_ANSI__ $(CFLAGS_G) $(CFLAGS_O) $(CFLAGS_GIT) -I . $(OS_CCDEFS) $(ROMS_OPT) diff --git a/sim_disk.c b/sim_disk.c index 8940cb11..3923f2a5 100644 --- a/sim_disk.c +++ b/sim_disk.c @@ -1871,7 +1871,7 @@ _set_errno_from_status (GetLastError ()); return SCPE_IOERR; } -#elif defined (__linux) || defined (__linux__) || defined (__sun__) || defined (__hpux) +#elif defined (__linux) || defined (__linux__) || defined (__sun) || defined (__sun__) || defined (__hpux) #include #include diff --git a/sim_ether.h b/sim_ether.h index 82268108..78fb2957 100644 --- a/sim_ether.h +++ b/sim_ether.h @@ -82,7 +82,7 @@ #define DONT_USE_READER_THREAD #endif -#if (((defined(__sun__) && defined(__i386__)) || defined(__linux)) && !defined(DONT_USE_READER_THREAD)) +#if ((((defined(__sun) || defined(__sun__)) && defined(__i386__)) || defined(__linux)) && !defined(DONT_USE_READER_THREAD)) #define USE_READER_THREAD 1 #endif diff --git a/sim_fio.c b/sim_fio.c index fd7ee5a1..6504897e 100644 --- a/sim_fio.c +++ b/sim_fio.c @@ -233,7 +233,8 @@ return fopen (file, mode); /* 64b VMS */ -#if ((defined (__ALPHA) || defined (__ia64)) && defined (VMS) && (__DECC_VER >= 60590001)) || (defined(__sun__) && defined(_LARGEFILE_SOURCE)) +#if ((defined (__ALPHA) || defined (__ia64)) && defined (VMS) && (__DECC_VER >= 60590001)) || \ + ((defined(__sun) || defined(__sun__)) && defined(_LARGEFILE_SOURCE)) #define S_SIM_IO_FSEEK_EXT_ 1 int sim_fseeko (FILE *st, t_offset offset, int whence) { diff --git a/sim_fio.h b/sim_fio.h index 7e0cb25d..595ca720 100644 --- a/sim_fio.h +++ b/sim_fio.h @@ -40,7 +40,7 @@ int32 sim_finit (void); #if defined (__linux) || defined (__linux__) || defined (__hpux) || \ (defined (VMS) && (defined (__ALPHA) || defined (__ia64)) && (__DECC_VER >= 60590001)) || \ - (defined(__sun__) && defined(_LARGEFILE_SOURCE)) || \ + ((defined(__sun) || defined(__sun__)) && defined(_LARGEFILE_SOURCE)) || \ defined (_WIN32) || defined (__APPLE__) || defined (__FreeBSD__) typedef t_int64 t_offset; #else diff --git a/sim_tape.c b/sim_tape.c index 9c7e42d7..eda7810f 100644 --- a/sim_tape.c +++ b/sim_tape.c @@ -541,8 +541,6 @@ fprintf (st, " -E Must Exist (if not specified an attempt to create fprintf (st, " virtual tape will be attempted).\n"); fprintf (st, " -F Open the indicated tape container in a specific format (default\n"); fprintf (st, " is SIMH, alternatives are E11, TPC and P7B)\n"); -return SCPE_OK; - return SCPE_OK; }