$NetBSD$

1) Set the RPATH when creating executables and shared libraries.
2) Use pkgsrc libtommath instead of cyclone libtommath (cyclonebn).

--- Makefile.config.orig	2024-02-14 02:29:41.000000000 +0000
+++ Makefile.config
@@ -21,8 +21,8 @@ CYC_PTHREAD_SET_STACK_SIZE ?=
 OS = $(shell uname)
 CC ?= cc
 
-LIBS = -pthread -lcyclone -lck -lm -lcyclonebn
-ifneq ($(OS),FreeBSD)
+LIBS = -pthread -lcyclone -lck -lm -ltommath
+ifeq (,$(findstring $(OS),FreeBSD NetBSD OpenBSD DragonFly))
 # libdl is part of libc on FreeBSD
 LIBS += -ldl
 endif
@@ -55,6 +55,12 @@ CREATE_LIBRARY_COMMAND = $(AR)
 CREATE_LIBRARY_FLAGS = rcs
 endif
 
+COMP_LIBDIRS+= -L$(PKGSRC_LIBDIR)
+COMP_LIBDIRS+= -L$(PKGSRC_LIBDIR)/cyclone-bootstrap
+COMP_LIBDIRS+= $(COMPILER_RPATH_FLAG),$(PKGSRC_LIBDIR)
+LDFLAGS     += -L$(PKGSRC_LIBDIR)
+LDFLAGS     += $(COMPILER_RPATH_FLAG),$(PKGSRC_LIBDIR)
+
 # /usr/local is not in the search path by default on FreeBSD, so if libtommath and/or 
 # concurrencykit was installed via Ports, it won't be picked up without explicitly looking
 # for it here
