From 3937536bee4a3768d0cae057655d42e25701afde Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Wed, 11 Aug 2021 01:42:15 +0200 Subject: [PATCH] Build tweaks for ancient Macs I don't expect anyone else to actually use ksh93 on a museum-grade Power Mac G5 running Mac OS X 10.3.7, but ancient platforms are great bug and compatibility testing tools. These tweaks restore the ability to build on that platform. Also, to avoid a strange path search bug on that platform and possibly other ancient ones, set SHOPT_DYNAMIC to 0 in SHOPT.sh. --- src/cmd/builtin/pty.c | 7 ++++++- src/cmd/ksh93/sh/xec.c | 4 ++++ src/lib/libast/misc/debug.c | 5 ++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/cmd/builtin/pty.c b/src/cmd/builtin/pty.c index 64d4cb6bb..bcd94bd9d 100644 --- a/src/cmd/builtin/pty.c +++ b/src/cmd/builtin/pty.c @@ -257,7 +257,12 @@ mkpty(int* master, int* minion) tty.c_lflag |= ECHOKE; #endif tty.c_oflag |= (ONLCR | OPOST); - tty.c_oflag &= ~(OCRNL | ONLRET); +#ifdef OCRNL + tty.c_oflag &= ~OCRNL; +#endif +#ifdef ONLRET + tty.c_oflag &= ~ONLRET; +#endif tty.c_iflag |= BRKINT; tty.c_iflag &= ~IGNBRK; tty.c_cc[VTIME] = 0; diff --git a/src/cmd/ksh93/sh/xec.c b/src/cmd/ksh93/sh/xec.c index 71b753676..c3df0bee4 100644 --- a/src/cmd/ksh93/sh/xec.c +++ b/src/cmd/ksh93/sh/xec.c @@ -52,6 +52,10 @@ # define vfork() fork() #endif +#if _lib_getrusage && !defined(RUSAGE_SELF) +# include +#endif + #define SH_NTFORK SH_TIMING #define NV_BLTPFSH NV_ARRAY diff --git a/src/lib/libast/misc/debug.c b/src/lib/libast/misc/debug.c index 895f812e4..0b8b502e3 100644 --- a/src/lib/libast/misc/debug.c +++ b/src/lib/libast/misc/debug.c @@ -37,9 +37,12 @@ debug_fatal(const char* file, int line) abort(); } -#if defined(_sys_times) && defined(_lib_getrusage) +#if _sys_times && _lib_getrusage #include +#ifndef RUSAGE_SELF +#include +#endif double debug_elapsed(int set) {