1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-03-04 10:24:43 +00:00

Address older versions of C compiler which don't have __BYTE_ORDER__ (#335)

* Address older versions of C compiler which don't have __BYTE_ORDER__

* Checking for __GNUC__ is not sufficient to determine if builtins are available.

* Add makefile fragment for 32-bit PowerPC on Mac OSX build, and ignore the build directories.

* Add comment describing use of __BIG/LITTLE_ENDIAN__ definition
This commit is contained in:
Nick Briggs
2021-02-06 20:51:42 -08:00
committed by GitHub
parent 9957f5c305
commit d482cc461c
4 changed files with 46 additions and 1 deletions

2
.gitignore vendored
View File

@@ -7,6 +7,8 @@
# build directories
*.386-x/**
*.386/**
*.ppc-x/**
*.ppc/**
*.sparc-x/**
*.sparc/**
*.x86_64-x/**

30
bin/makefile-darwin.ppc-x Normal file
View File

@@ -0,0 +1,30 @@
# Options for MacOS, x86 processor, X windows
CC = cc $(GCC_CFLAGS)
OEXT=.o
XFILES = $(OBJECTDIR)xmkicon.o \
$(OBJECTDIR)xbbt.o \
$(OBJECTDIR)dspif.o \
$(OBJECTDIR)xinit.o \
$(OBJECTDIR)xscroll.o \
$(OBJECTDIR)xcursor.o \
$(OBJECTDIR)xlspwin.o \
$(OBJECTDIR)xrdopt.o \
$(OBJECTDIR)xwinman.o
XFLAGS = -I/usr/X11/include -DXWINDOW
# OPTFLAGS is normally -O2.
OPTFLAGS = -O2 -g
DEBUGFLAGS = # -DDEBUG -DOPTRACE
DFLAGS = $(DEBUGFLAGS) $(XFLAGS) \
-DRELEASE=351
LDFLAGS = -L/usr/X11/lib -lX11 -lm
LDELDFLAGS = -L/usr/X11/lib -lX11 -lm
OBJECTDIR = ../$(RELEASENAME)/
default : ../$(OSARCHNAME)/lde ../$(OSARCHNAME)/ldex

View File

@@ -137,6 +137,9 @@
# define MAIKO_ARCH_DETECTED 1
#endif
/* Modern GNU C, Clang, Sun Studio provide __BYTE_ORDER__
* Older GNU C (ca. 4.0.1) provides __BIG_ENDIAN__/__LITTLE_ENDIAN__
*/
#if defined(__BYTE_ORDER__)
# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
# define BYTESWAP 1
@@ -145,6 +148,10 @@
# else
# error "Unknown byte order"
# endif
#elif __BIG_ENDIAN__ == 1
# undef BYTESWAP
#elif __LITTLE_ENDIAN__ == 1
# define BYTESWAP 1
#else
# error "Could not detect byte order"
#endif

View File

@@ -204,7 +204,13 @@ error Must specify RELEASE to build Medley.
/********************************************************/
/* */
/********************************************************/
#ifdef __GNUC__
#ifndef __has_builtin
#define __has_builtin(x) 0
#endif
#if __has_builtin(__builtin_sadd_overflow) && \
__has_builtin(__builtin_ssub_overflow) && \
__has_builtin(__builtin_smul_overflow)
#define USE_OVERFLOW_BUILTINS
#endif