diff -Nurd ogdi-4.1.0.orig/config/common.mak.in ogdi-4.1.0/config/common.mak.in
--- ogdi-4.1.0.orig/config/common.mak.in	2019-04-20 13:00:51.000000000 +0100
+++ ogdi-4.1.0/config/common.mak.in	2021-01-14 22:55:53.000000000 -0500
@@ -76,7 +76,7 @@
 #	Final OS installation location.
 #
 ifndef prefix
-prefix		= /usr/local
+prefix		= @PREFIX@
 endif
 exec_prefix 	= ${prefix}
 INST_INCLUDE	= ${prefix}/include
@@ -123,18 +123,18 @@
 # Dynamic libraries (shared objects)
 #
 
-ODBCEXT_LINKLIB	= $(LINK_SW)$(LINKDIR)$(LIB_SW)odbcext$(LIB_SUFFIX)
-OGDI_LINKLIB	= $(LINK_SW)$(LINKDIR)$(LIB_SW)ogdi$(LIB_SUFFIX)
-ZLIB_LINKLIB	= $(LINK_SW)$(LINKDIR)$(LIB_SW)zlib_ogdi$(OGDI_VERSION)$(LIB_SUFFIX)
-EXPAT_LINKLIB	= $(LINK_SW)$(LINKDIR)$(LIB_SW)expat_ogdi$(OGDI_VERSION)$(LIB_SUFFIX)
+ODBCEXT_LINKLIB	= $(LINKDIR)/$(LIB_PREFIX)odbcext.$(DYLIB_EXT)
+OGDI_LINKLIB	= $(LINKDIR)/$(LIB_PREFIX)ogdi.$(DYLIB_EXT)
+ZLIB_LINKLIB	= $(LINKDIR)/$(LIB_PREFIX)zlib_ogdi$(OGDI_VERSION).$(DYLIB_EXT)
+EXPAT_LINKLIB	= $(LINKDIR)/$(LIB_PREFIX)expat_ogdi$(OGDI_VERSION).$(DYLIB_EXT)
 
 #
 # Static libraries (archives)
 #
 
-VPF_STATICLIB		= $(LINK_SW)$(LIBDIR)/static$(LIB_SW)vpf$(LIB_SUFFIX)
-REMOTE_STATICLIB	= $(LINK_SW)$(LIBDIR)/static$(LIB_SW)remote$(LIB_SUFFIX)
-GLUTIL_STATICLIB =	$(LINK_SW)$(LIBDIR)/static$(LIB_SW)glutil$(LIB_SUFFIX)
+VPF_STATICLIB		= $(LIBDIR)/static/$(LIB_PREFIX)vpf.$(ARCH_EXT)
+REMOTE_STATICLIB	= $(LIBDIR)/static/$(LIB_PREFIX)remote.$(ARCH_EXT)
+GLUTIL_STATICLIB =	$(LIBDIR)/static/$(LIB_PREFIX)glutil.$(ARCH_EXT)
 
 
 #
@@ -164,14 +164,14 @@
 
 TOBEGEN_STRIPPED=$(patsubst %$(OGDI_VERSION),%,$(TOBEGEN))
 
-ifndef ARCGEN
+ifndef ARCHGEN
 ARCHGEN = $(TOPDIR)/lib/$(TARGET)/static/$(LIB_PREFIX)$(TOBEGEN).$(ARCH_EXT)
 endif
 ifndef DYNAGEN
-DYNAGEN = $(TOPDIR)/bin/$(TARGET)/$(LIB_PREFIX)$(TOBEGEN).$(SHLIB_EXT)
+DYNAGEN = $(TOPDIR)/bin/$(TARGET)/$(LIB_PREFIX)$(TOBEGEN).$(DYNALIB_EXT)
 endif
 ifndef SHRDGEN
-SHRDGEN = $(TOPDIR)/bin/$(TARGET)/$(LIB_PREFIX)$(TOBEGEN).$(SHLIB_EXT).$(OGDI_MAJOR).$(OGDI_MINOR)
+SHRDGEN = $(TOPDIR)/bin/$(TARGET)/$(LIB_PREFIX)$(TOBEGEN).$(OGDI_MAJOR).$(SHLIB_EXT)
 endif
 ifndef PROGGEN
 PROGGEN = $(TOPDIR)/bin/$(TARGET)/$(TOBEGEN)$(APP_EXT)
@@ -227,17 +227,15 @@
 ifeq ($(TARGETGEN),$(DYNAGEN))
 default-install:
 	mkdir -p $(INST_LIB)/ogdi
-	cp $(TARGETGEN) $(INST_LIB)/ogdi
+	cp $(TOPDIR)/bin/$(TARGET)/$(LIB_PREFIX)$(TOBEGEN).$(SHLIB_EXT) $(INST_LIB)/ogdi
 endif
 
 ifeq ($(TARGETGEN),$(SHRDGEN))
 default-install:
-	cp $(TARGETGEN) $(INST_LIB)
+	cp $(TOPDIR)/bin/$(TARGET)/$(LIB_PREFIX)$(TOBEGEN).$(OGDI_MAJOR).$(DYLIB_EXT) $(INST_LIB)
 	cd $(INST_LIB); \
-	      ln -s $(LIB_PREFIX)$(TOBEGEN).$(SHLIB_EXT).$(OGDI_MAJOR).$(OGDI_MINOR) \
-	            $(LIB_PREFIX)$(TOBEGEN_STRIPPED).$(SHLIB_EXT).$(OGDI_MAJOR); \
-	      ln -s $(LIB_PREFIX)$(TOBEGEN).$(SHLIB_EXT).$(OGDI_MAJOR).$(OGDI_MINOR) \
-	            $(LIB_PREFIX)$(TOBEGEN_STRIPPED).$(SHLIB_EXT); \
+	      ln -s $(LIB_PREFIX)$(TOBEGEN).$(OGDI_MAJOR).$(DYLIB_EXT) \
+	            $(LIB_PREFIX)$(TOBEGEN_STRIPPED).$(DYLIB_EXT); \
 	cd $(CURDIR)
 endif
 
@@ -255,11 +253,11 @@
 endif
 
 install-so-link:
-	mv -f $(INST_LIB)/$(LIB_PREFIX)$(TOBEGEN).$(SHLIB_EXT).$(OGDI_MAJOR).$(OGDI_MINOR) $(INST_LIB)
-	mv -f $(INST_LIB)/$(LIB_PREFIX)$(TOBEGEN).$(SHLIB_EXT).$(OGDI_MAJOR) $(INST_LIB)
-	cd $(INST_LIB); ln -s $(LIB_PREFIX)$(TOBEGEN).$(SHLIB_EXT).$(OGDI_MAJOR).$(OGDI_MINOR) \
-	      $(LIB_PREFIX)$(TOBEGEN_STRIPPED).$(SHLIB_EXT) ; \
-	cd $(CURDIR)
+#	mv -f $(INST_LIB)/$(LIB_PREFIX)$(TOBEGEN).$(SHLIB_EXT).$(OGDI_MAJOR).$(OGDI_MINOR) $(INST_LIB)
+#	mv -f $(INST_LIB)/$(LIB_PREFIX)$(TOBEGEN).$(SHLIB_EXT).$(OGDI_MAJOR) $(INST_LIB)
+#	cd $(INST_LIB); ln -s $(LIB_PREFIX)$(TOBEGEN).$(SHLIB_EXT).$(OGDI_MAJOR).$(OGDI_MINOR) \
+#	      $(LIB_PREFIX)$(TOBEGEN_STRIPPED).$(SHLIB_EXT) ; \
+#	cd $(CURDIR)
 
 install:	default-install $(EXTRA_INSTALL_TARGETS)
 
diff -Nurd ogdi-4.1.0.orig/config/generic.mak.in ogdi-4.1.0/config/generic.mak.in
--- ogdi-4.1.0.orig/config/generic.mak.in	2019-04-20 13:00:51.000000000 +0100
+++ ogdi-4.1.0/config/generic.mak.in	2020-12-27 15:20:53.000000000 +0000
@@ -37,9 +37,15 @@
 SHLIB_CFLAGS	= @C_PIC@
 COMMON_CFLAGS	= $(OPTIMIZATION) @CFLAGS@ @C_WFLAGS@ -DUNIX=1 @C_PIC@ @RPC_CFLAGS@
 
-SHLIB_LDFLAGS	= -shared 
+SHLIB_LDFLAGS	= -dynamiclib -compatibility_version 4.1.0 -current_version 4.1.0
 COMMON_LDFLAGS  = $(OPTIMIZATION) @LDFLAGS@
 
+#
+# File name extensions
+#
+SHLIB_EXT	= so
+DYLIB_EXT	= dylib
+
 RPC_INCLUDES = @RPC_INCLUDES@
 
 UCB_STATICLIB = 
@@ -59,8 +65,7 @@
 #
 # platform specific file locations
 #
-#RPC_LINKLIB	= -lrpcsvc -lnsl -lsocket
-#RPC_LINKLIB	=	-ldl -ldbmalloc
+RPC_INCLUDES	=	-DHAVE_STD_RPC_INCLUDES
 RPC_LINKLIB	=	@LIBS@ @RPC_LIBS@
 
 #
@@ -97,3 +102,23 @@
 
 # Iconv
 HAVE_ICONV=@HAVE_ICONV@
+
+#
+# make rules
+#
+$(ARCHGEN): $(OBJECTS)
+	@echo Making archive file: $@
+	$(AR) $@ $^ 
+	ranlib $@
+	@echo $@ made successfully ...
+	
+$(SHRDGEN): $(OBJECTS)
+	@echo Making shared library: $@
+	$(SHLIB_LD) $(SHLIB_LDFLAGS) $(COMMON_LDFLAGS) $(LDFLAGS) -install_name $(INST_LIB)/$(notdir $(LIB_PREFIX)$(TOBEGEN).$(OGDI_MAJOR).$(DYLIB_EXT)) -o $(TOPDIR)/bin/$(TARGET)/$(LIB_PREFIX)$(TOBEGEN).$(OGDI_MAJOR).$(DYLIB_EXT) $^ $(LINK_LIBS) 
+	cd $(TOPDIR)/bin/$(TARGET); ln -s $(LIB_PREFIX)$(TOBEGEN).$(OGDI_MAJOR).$(DYLIB_EXT) $(LIB_PREFIX)$(TOBEGEN).$(DYLIB_EXT); cd $(CURDIR)
+	@echo $@ made successfully ...
+
+$(DYNAGEN): $(OBJECTS)
+	@echo Making dynamic library: $@
+	$(SHLIB_LD) -bundle $(COMMON_LDFLAGS) $(LDFLAGS) $(COMMON_CFLAGS) -o $(TOPDIR)/bin/$(TARGET)/$(LIB_PREFIX)$(TOBEGEN).$(SHLIB_EXT) $^ $(LINK_LIBS) 
+	@echo $@ made successfully ...
diff -Nurd ogdi-4.1.0.orig/config/unix.mak ogdi-4.1.0/config/unix.mak
--- ogdi-4.1.0.orig/config/unix.mak	2019-04-20 13:00:51.000000000 +0100
+++ ogdi-4.1.0/config/unix.mak	2020-12-22 12:04:28.000000000 +0000
@@ -88,19 +88,19 @@
 
 $(PROGGEN): $(OBJECTS)
 	@echo Making executable: $@
-	$(LD) $(COMMON_LDFLAGS) $(COMMON_CFLAGS) -o $@ $^ $(LINK_LIBS)
+	$(LD) $(COMMON_LDFLAGS) $(LDFLAGS) $(COMMON_CFLAGS) -o $@ $^ $(LINK_LIBS)
 	@echo $@ made successfully ...
 
 $(SHRDGEN): $(OBJECTS)
 	@echo Making shared library: $@
-	$(SHLIB_LD) $(SHLIB_LDFLAGS) $(COMMON_LDFLAGS) $(COMMON_CFLAGS) -Wl,-soname,$(LIB_PREFIX)$(TOBEGEN).$(SHLIB_EXT).$(OGDI_MAJOR) -o $@ $^ $(LINK_LIBS) 
+	$(SHLIB_LD) $(SHLIB_LDFLAGS) $(COMMON_LDFLAGS) $(LDFLAGS) $(COMMON_CFLAGS) -Wl,-soname,$(LIB_PREFIX)$(TOBEGEN).$(SHLIB_EXT).$(OGDI_MAJOR) -o $@ $^ $(LINK_LIBS) 
 	cd $(TOPDIR)/bin/$(TARGET); ln -s $(LIB_PREFIX)$(TOBEGEN).$(SHLIB_EXT).$(OGDI_MAJOR).$(OGDI_MINOR) $(LIB_PREFIX)$(TOBEGEN).$(SHLIB_EXT); \
 	ln -s $(LIB_PREFIX)$(TOBEGEN).$(SHLIB_EXT).$(OGDI_MAJOR).$(OGDI_MINOR) $(LIB_PREFIX)$(TOBEGEN).$(SHLIB_EXT).$(OGDI_MAJOR); cd $(CURDIR)
 	@echo $@ made successfully ...
 
 $(DYNAGEN): $(OBJECTS)
 	@echo Making dynamic library: $@
-	$(SHLIB_LD) $(SHLIB_LDFLAGS) $(COMMON_LDFLAGS) $(COMMON_CFLAGS) -o $@ $^ $(LINK_LIBS) 
+	$(SHLIB_LD) $(SHLIB_LDFLAGS) $(COMMON_LDFLAGS) $(LDFLAGS) $(COMMON_CFLAGS) -o $@ $^ $(LINK_LIBS) 
 	@echo $@ made successfully ...
 
 
diff -Nurd ogdi-4.1.0.orig/configure ogdi-4.1.0/configure
--- ogdi-4.1.0.orig/configure	2019-04-20 13:00:51.000000000 +0100
+++ ogdi-4.1.0/configure	2020-12-22 11:50:06.000000000 +0000
@@ -4044,8 +4044,8 @@
     as_fn_error $? "Unable to find $with_zlib/include/zlib.h" "$LINENO" 5
   fi
 
-  if test -r $with_zlib/lib/libz.so ; then
-    ZLIB_LIB=$with_zlib/lib/libz.so
+  if test -r $with_zlib/lib/libz.dylib ; then
+    ZLIB_LIB=$with_zlib/lib/libz.dylib
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: checking for $ZLIB_LIB ... found" >&5
 $as_echo "checking for $ZLIB_LIB ... found" >&6; }
 
@@ -4054,8 +4054,8 @@
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: checking for $ZLIB_LIB ... found" >&5
 $as_echo "checking for $ZLIB_LIB ... found" >&6; }
 
-  elif test -r $with_zlib/libz.so ; then
-    ZLIB_LIB=$with_zlib/libz.so
+  elif test -r $with_zlib/libz.dylib ; then
+    ZLIB_LIB=$with_zlib/libz.dylib
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: checking for $ZLIB_LIB ... found" >&5
 $as_echo "checking for $ZLIB_LIB ... found" >&6; }
 
@@ -4065,7 +4065,7 @@
 $as_echo "checking for $ZLIB_LIB ... found" >&6; }
 
   else
-    as_fn_error $? "Unable to find $with_zlib/{lib/,}libz.{so,a}" "$LINENO" 5
+    as_fn_error $? "Unable to find $with_zlib/{lib/,}libz.{dylib,a}" "$LINENO" 5
   fi
 
   ZLIB_SETTING=external
@@ -4208,16 +4208,16 @@
     as_fn_error $? "Unable to find $with_expat/include/expat.h" "$LINENO" 5
   fi
 
-  if test -r $with_expat/lib/libexpat.so ; then
-    EXPAT_LIB=$with_expat/lib/libexpat.so
+  if test -r $with_expat/lib/libexpat.dylib ; then
+    EXPAT_LIB=$with_expat/lib/libexpat.dylib
     echo "checking for $EXPAT_LIB ... found"
 
   elif test -r $with_expat/lib/libexpat.a ; then
     EXPAT_LIB=$with_expat/lib/libexpat.a
     echo "checking for $EXPAT_LIB ... found"
 
-  elif test -r $with_expat/libexpat.so ; then
-    EXPAT_LIB=$with_expat/libexpat.so
+  elif test -r $with_expat/libexpat.dylib ; then
+    EXPAT_LIB=$with_expat/libexpat.dylib
     echo "checking for $EXPAT_LIB ... found"
 
   elif test -r $with_expat/libexpat.a ; then
@@ -4225,7 +4225,7 @@
     echo "checking for $EXPAT_LIB ... found"
 
   else
-    as_fn_error $? "Unable to find $with_expat/{lib/,}libexpat.{so,a}" "$LINENO" 5
+    as_fn_error $? "Unable to find $with_expat/{lib/,}libexpat.{dylib,a}" "$LINENO" 5
   fi
 
   EXPAT_SETTING=external
diff -Nurd ogdi-4.1.0.orig/include/Linux/ogdi_macro.h ogdi-4.1.0/include/Linux/ogdi_macro.h
--- ogdi-4.1.0.orig/include/Linux/ogdi_macro.h	2019-04-20 13:00:51.000000000 +0100
+++ ogdi-4.1.0/include/Linux/ogdi_macro.h	2020-12-22 11:50:06.000000000 +0000
@@ -1,6 +1,6 @@
 #include <signal.h>
-#include <wait.h>
-#include <rpc/xdr.h>
+#include <sys/wait.h>
+/*#include <rpc/xdr.h>*/
 #include <stdio.h>
 
 #define ogdi_IXDR_PUT_LONG(buf, v) { \
diff -Nurd ogdi-4.1.0.orig/ogdi/c-api/makefile ogdi-4.1.0/ogdi/c-api/makefile
--- ogdi-4.1.0.orig/ogdi/c-api/makefile	2019-04-20 13:00:51.000000000 +0100
+++ ogdi-4.1.0/ogdi/c-api/makefile	2020-12-22 11:57:21.000000000 +0000
@@ -13,11 +13,7 @@
 
 TOBEGEN	= ogdi
 
-ifeq ($(TARGET),Linux)
 TARGETGEN=$(SHRDGEN)
-else
-TARGETGEN=$(DYNAGEN)
-endif
 
 SOURCES = ecs_dyna.c ecssplit.c \
           ecsassoc.c ecstile.c server.c ecsdist.c \
diff -Nurd ogdi-4.1.0.orig/ogdi/c-api/server.c ogdi-4.1.0/ogdi/c-api/server.c
--- ogdi-4.1.0.orig/ogdi/c-api/server.c	2019-04-20 13:00:51.000000000 +0100
+++ ogdi-4.1.0/ogdi/c-api/server.c	2020-12-22 12:07:17.000000000 +0000
@@ -292,7 +292,7 @@
   res = s->createserver(s,url); 
   if (res == NULL) {
     res = &svr_dummy_result;
-    sprintf(buffer,"A memory error occured when creating the server for the URL \"%s\"", url);
+    sprintf(buffer,"A memory error occurred when creating the server for the URL \"%s\"", url);
     ecs_SetError(res,1,buffer);
     return res;
     }
diff -Nurd ogdi-4.1.0.orig/ogdi/driver/rpf/rpf.h ogdi-4.1.0/ogdi/driver/rpf/rpf.h
--- ogdi-4.1.0.orig/ogdi/driver/rpf/rpf.h	2019-04-20 13:00:51.000000000 +0100
+++ ogdi-4.1.0/ogdi/driver/rpf/rpf.h	2020-12-22 11:50:06.000000000 +0000
@@ -74,7 +74,7 @@
 typedef unsigned short ushort;
 typedef unsigned long  uint;
 */
-typedef unsigned char  bool;
+typedef unsigned char  bbool;
 typedef unsigned char  uchar;
 typedef unsigned char* ucharp;
 typedef char           ascii;
@@ -136,7 +136,7 @@
 
 typedef struct header
 {
-  bool     endian;
+  bbool     endian;
   ushort   hdr_sec_len;       /* header section length */
   ascii    filename[12];
   uchar    new;
@@ -352,8 +352,8 @@
 
 typedef struct display1
 {
-  bool      all_subframes;
-  bool      no_transparent;
+  bbool      all_subframes;
+  bbool      no_transparent;
   ushort    subframe_seq_length;
   ushort    transparent_seq_length;
   uint      image_rows;
@@ -377,7 +377,7 @@
   RPF_image    img;
   Attribute    att;
   Replace      repupd;
-  bool         all_subframes;
+  bbool         all_subframes;
   int         NITF_hdr_len;
 } Frame_file;
 
diff -Nurd ogdi-4.1.0.orig/vpflib/reduce2.c ogdi-4.1.0/vpflib/reduce2.c
--- ogdi-4.1.0.orig/vpflib/reduce2.c	2019-04-20 13:00:51.000000000 +0100
+++ ogdi-4.1.0/vpflib/reduce2.c	2020-12-22 11:50:06.000000000 +0000
@@ -11,8 +11,8 @@
 #include "reduce2.h"
 #endif
 
-//#define  MAX(m,n) (((m) > (n)) ? (m) : (n))
-//#define  MIN(m,n) (((m) < (n)) ? (m) : (n))
+#define  MAX(m,n) (((m) > (n)) ? (m) : (n))
+#define  MIN(m,n) (((m) < (n)) ? (m) : (n))
 #define  DOCNT(i,t,n)   (_d_l=n, (_d_m=(t-(i)+_d_l)/_d_l) > 0 ? _d_m : 0L )
 
 /*    General purpose tools for polyline reduction:
