Sign installed executables if running macOS on Apple Silicon.

Fixes:

zsh: killed     unicon

Based on:

https://github.com/uniconproject/unicon/commit/62efef6e87446ea7a67e24ab519bee8b353561f9
--- Makedefs.in.orig	2020-12-20 23:08:43.000000000 -0600
+++ Makedefs.in	2026-03-30 02:13:06.000000000 -0500
@@ -66,6 +66,8 @@
 UOS=@unicon_os@
 OSDIST=@unicon_osdist@
 OSREL=@unicon_osrel@
+UNICONCPU=@unicon_cpu@
+UNICONHOST=@unicon_host@
 
 # commands
 SHELL = /bin/sh
--- Makedefs.uni.in.orig	2020-12-20 23:08:43.000000000 -0600
+++ Makedefs.uni.in	2026-03-30 02:15:53.000000000 -0500
@@ -2,6 +2,8 @@
 OS=@unicon_os@
 OSDIST=@unicon_osdist@
 OSREL=@unicon_osrel@
+UNICONCPU=@unicon_cpu@
+UNICONHOST=@unicon_host@
 
 EXE=@EXE@
 GRAPHICS=@GRAPHICS@
--- Makefile.in.orig	2020-12-20 23:08:43.000000000 -0600
+++ Makefile.in	2026-03-30 02:32:28.000000000 -0500
@@ -200,7 +200,14 @@
 UPLUGINS=$(ULROT)/plugins/lib
 INST=$(SHTOOL) install -c
 F=*.{u,icn}
-Tbins=unicon icont iconx iconc udb uprof unidep UniDoc ui ivib patchstr iyacc rt.a rt.h
+
+# runtime binaries
+RTbins=icont iconx iconc
+ADDONbins=udb uprof unidep UniDoc ui ivib
+UTILbins=patchstr iyacc
+ALLbins=$(RTbins) unicon $(ADDONbins) $(UTILbins) rt.a rt.h
+# binaries that should be signed after install, only needed on arm macOS for now
+SIGNbins=$(RTbins) $(UTILbins)
 
 Tdirs=$(DESTDIR)$(ULB) $(DESTDIR)$(UIPL) $(DESTDIR)$(UPLUGINS)
 Udirs=lib 3d gui unidoc unidep xml parser
@@ -214,7 +221,7 @@
 	   rm -rf $$d; \
 	done
 #	delete the binaries we installed from  unicon/bin
-	@for f in $(Tbins); do \
+	@for f in $(ALLbins); do \
 	   echo "Uninstalling $(DESTDIR)$(bindir)/$$f ..."; \
 	   rm -f $(DESTDIR)$(bindir)/$$f; \
 	done
@@ -237,7 +244,7 @@
 	    (echo "Creating dir $(DESTDIR)$(ULB)/$$d") && (mkdir -p $(DESTDIR)$(ULB)/$$d); \
 	done
 #	install unicon/bin
-	@for f in $(Tbins); do \
+	@for f in $(ALLbins); do \
 	  if test -f "bin/$$f"; then \
 	    (echo "Installing bin/$$f") && ($(INST) bin/$$f $(DESTDIR)$(bindir)); \
 	    if test "$$f" = "icont" ; then \
@@ -277,6 +284,13 @@
 	@$(INST) -m 644 README.md $(DESTDIR)$(docdir)
 	@echo "Installing $(DESTDIR)$(docdir) ..."
 	@$(INST) -m 644 doc/unicon/*.* $(DESTDIR)$(docdir)
+#   Sign code if we are running MacOS on Apple's processors
+	if test "$(UNICONHOST)" = "arm_64_macos"; then \
+		for f in $(SIGNbins); do \
+			echo signing  $(DESTDIR)$(bindir)/$$f ; \
+			codesign -s - $(DESTDIR)$(bindir)/$$f ;\
+		done; \
+	fi
 
 # Bundle up for binary distribution.
 PKGDIR=$(PKG_TARNAME).$(PKG_VERSION)
--- configure.ac.orig	2020-12-20 23:08:43.000000000 -0600
+++ configure.ac	2026-03-30 02:13:06.000000000 -0500
@@ -389,6 +389,8 @@
 AC_SUBST(unicon_os)
 AC_SUBST(unicon_osdist)
 AC_SUBST(unicon_osrel)
+AC_SUBST(unicon_cpu)
+AC_SUBST(unicon_host)
 
 AC_SUBST(CC)
 AC_SUBST(RLINK)
