diff --git a/makefile b/makefile index 43aa2ab1..ec642a11 100644 --- a/makefile +++ b/makefile @@ -287,11 +287,11 @@ ifeq ($(WIN32),) #*nix Environments (&& cygwin) endif else ifeq (Linux,$(OSTYPE)) + ifeq (Android,$(shell uname -o)) + OS_CCDEFS += -D__ANDROID_API__=$(shell getprop ro.build.version.sdk) + endif ifneq (lib,$(findstring lib,$(UNSUPPORTED_BUILD))) ifneq (,$(shell if $(TEST) -d /system/lib; then echo systemlib; fi)) - ifneq (,$(shell uname -a | grep 'aarch64 Android')) - OS_CCDEFS += -DCANT_USE_TERMIOS_TCSAFLUSH - endif LIBPATH += /system/lib endif ifneq (,$(shell if $(TEST) -d /data/data/com.termux/files/usr/lib; then echo termuxlib; fi)) diff --git a/sim_console.c b/sim_console.c index bea49c75..c6e93c13 100644 --- a/sim_console.c +++ b/sim_console.c @@ -3928,7 +3928,7 @@ return SCPE_OK; #else -#if !defined(CANT_USE_TERMIOS_TCSAFLUSH) +#if !defined (__ANDROID_API__) || (__ANDROID_API__ < 26) #define TCSETATTR_ACTION TCSAFLUSH #else #define TCSETATTR_ACTION TCSANOW diff --git a/sim_fio.c b/sim_fio.c index 6d7cb6e0..36f18584 100644 --- a/sim_fio.c +++ b/sim_fio.c @@ -324,7 +324,7 @@ return (t_offset)fileaddr; /* Linux */ -#if defined (__linux) || defined (__linux__) || defined (__hpux) || defined (_AIX) +#if ((defined (__linux) || defined (__linux__)) && (!defined (__ANDROID_API__) || (__ANDROID_API__ >= 24))) || defined (__hpux) || defined (_AIX) #define S_SIM_IO_FSEEK_EXT_ 1 int sim_fseeko (FILE *st, t_offset xpos, int origin) {