oksh-noxz

[fork] Portable OpenBSD ksh, based on the Public Domain Korn Shell (pdksh).
git clone https://noxz.tech/git/oksh-noxz.git
oksh-noxz

commit: 61bde733da2f4e0b595194659258cc1aa5a4b40f
parent: e6f14a4dd2f4cbb86c9ad17fc0e1e3566a4d0552
author: Brian Callahan <bcallah@openbsd.org>
date:   Mon, 3 Jul 2023 22:47:19 -0400
Prepare for kefir support.
Mconfigure33+++++++++++++++++---
1 file changed, 29 insertions(+), 4 deletions(-)
diff --git a/configure b/configure
@@ -162,8 +162,19 @@ cccheck() {
 cat << EOF > conftest.c
 int main(void){return 0;}
 EOF
-    $CC $cflags -o conftest.o -c conftest.c > /dev/null 2>&1
-    $CC $ldflags -o conftest conftest.o > /dev/null 2>&1
+    if [ "x$CC" = "xkefir" ] ; then
+      ccos=`uname -s`
+      case "x$ccos" in
+	"xOpenBSD")
+	  ccenv="KEFIR_OPENBSD_DYNAMIC_LINKER=/usr/libexec/ld.so KEFIR_OPENBSD_INCLUDE=/usr/include KEFIR_OPENBSD_LIB=/usr/lib"
+	  export KEFIR_OPENBSD_DYNAMIC_LINKER=/usr/libexec/ld.so
+	  export KEFIR_OPENBSD_INCLUDE=/usr/include
+	  export KEFIR_OPENBSD_LIB=/usr/lib
+	  ;;
+      esac
+    fi
+    $CC $cflags -o conftest.o -c conftest.c
+    $CC $ldflags -o conftest conftest.o
     if [ $? -eq 0 ] ; then
       ./conftest
       if [ $? -eq 0 ] ; then
@@ -934,13 +945,13 @@ else
 fi
 
 if [ ! -z "$LDFLAGS" ] ; then
-  ldflags="$LDFLAGS "
+  ldflags="$LDFLAGS"
 else
   ldflags=""
 fi
 
 if [ $static -ne 0 ] ; then
-  ldflags="${ldflags}-static"
+  ldflags="$ldflags -static"
 fi
 
 if [ $compileonly -eq 1 ] ; then
@@ -1079,6 +1090,9 @@ case "x$os" in
       "xchibicc")
 	cflags="$cflags -D_ANSI_LIBRARY"
 	;;
+      "xkefir")
+	cflags="$cflags -D_ANSI_LIBRARY"
+	;;
       "xnwcc")
 	ldflags="$ldflags -Wl,-nopie"
 	;;
@@ -1418,6 +1432,17 @@ else
   cflags="$cflags -I$(pwd)"
 fi
 
+if [ ! -z "$cflags" ] ; then
+  cflags="${cflags## }"
+fi
+
+if [ ! -z "$ldflags" ] ; then
+  ldflags="${ldflags## }"
+fi
+
 printf "creating Makefile... "
+if [ "x$cc" = "xkefir" ] ; then
+  cc="$ccenv $cc"
+fi
 Makefile
 echo "done"