diff -urN ogdi-3.1.5-orig/config/common.mak ogdi-3.1.5/config/common.mak
--- ogdi-3.1.5-orig/config/common.mak	2001-06-25 21:14:46.000000000 -0400
+++ ogdi-3.1.5/config/common.mak	2021-01-14 22:32:51.000000000 -0500
@@ -55,7 +55,7 @@
 #
 #	Final OS installation location.
 #
-prefix		= /usr/local
+prefix		= @PREFIX@
 exec_prefix 	= ${prefix}
 INST_INCLUDE	= ${prefix}/include
 INST_LIB	= ${exec_prefix}/lib
@@ -103,19 +103,19 @@
 # Dynamic libraries (shared objects)
 #
 
-ODBCEXT_LINKLIB	= $(LINK_SW)$(LINKDIR)$(LIB_SW)odbcext$(LIB_SUFFIX)
-OGDI_LINKLIB	= $(LINK_SW)$(LINKDIR)$(LIB_SW)ogdi$(OGDI_VERSION)$(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.$(SHLIB_EXT)
+OGDI_LINKLIB	= $(LINKDIR)/$(LIB_PREFIX)ogdi$(OGDI_VERSION).$(SHLIB_EXT)
+ZLIB_LINKLIB	= $(LINKDIR)/$(LIB_PREFIX)zlib_ogdi$(OGDI_VERSION).$(SHLIB_EXT)
+EXPAT_LINKLIB	= $(LINKDIR)/$(LIB_PREFIX)expat_ogdi$(OGDI_VERSION).$(SHLIB_EXT)
 
 #
 # Static libraries (archives)
 #
 
-PROJ_STATICLIB		= $(LINK_SW)$(LIBDIR)/static$(LIB_SW)proj$(LIB_SUFFIX)
-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)
+PROJ_STATICLIB		= $(LIBDIR)/static/$(LIB_PREFIX)proj.$(ARCH_EXT)
+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)
 
 
 #
diff -urN ogdi-3.1.5-orig/config/darwin.mak ogdi-3.1.5/config/darwin.mak
--- ogdi-3.1.5-orig/config/darwin.mak	2003-12-15 13:08:00.000000000 -0500
+++ ogdi-3.1.5/config/darwin.mak	2021-01-14 22:21:51.000000000 -0500
@@ -33,7 +33,7 @@
 SHLIB_CFLAGS	= -fno-common
 COMMON_CFLAGS	= $(OPTIMIZATION) -fno-common
 
-SHLIB_LDFLAGS	= -dynamiclib
+SHLIB_LDFLAGS	= -dynamiclib -compatibility_version 3.1.0 -current_version 3.1.5
 COMMON_LDFLAGS  = $(OPTIMIZATION)
 
 
@@ -50,6 +50,16 @@
 
 BIG_ENDIAN          = 1
 
+RPC_LINKLIB	=	-ldl 
+PROJ_SETTING=external
+PROJ_INCLUDE :=	-I@PREFIX@/include
+PROJ_STATICLIB := -L@PREFIX@/lib -lproj
+ZLIB_SETTING=external
+ZLIB_INCLUDE :=	
+ZLIB_LINKLIB := -lz
+EXPAT_SETTING=external
+EXPAT_INCLUDE := -I@PREFIX@/include
+EXPAT_LINKLIB := -L@PREFIX@/lib -lexpat
 
 #
 # make rules
@@ -62,5 +72,5 @@
 	
 $(DYNAGEN): $(OBJECTS)
 	@echo Making shared library: $@
-	$(SHLIB_LD) $(SHLIB_LDFLAGS) $(COMMON_LDFLAGS) -o $@ $^ $(LINK_LIBS) 
+	$(SHLIB_LD) $(SHLIB_LDFLAGS) -install_name $(INST_LIB)/$(notdir $@) $(COMMON_LDFLAGS) -o $@ $^ $(LINK_LIBS) 
 	@echo $@ made successfully ...
diff -urN ogdi-3.1.5-orig/contrib/ogdi_import/makefile ogdi-3.1.5/contrib/ogdi_import/makefile
--- ogdi-3.1.5-orig/contrib/ogdi_import/makefile	2001-02-18 23:12:21.000000000 -0500
+++ ogdi-3.1.5/contrib/ogdi_import/makefile	2021-01-14 23:54:04.000000000 -0500
@@ -16,8 +16,8 @@
 
 SOURCES = ogdi_import.c shpopen.c dbfopen.c
 
-INCLUDES = $(CURRENT_INCLUDE) $(OGDI_INCLUDE) $(PROJ_INCLUDE)\
-	   $(ZLIB_INCLUDE) $(GENERAL_INCLUDE) $(TCLTK_INCLUDE)
+INCLUDES = $(CURRENT_INCLUDE) $(OGDI_INCLUDE) \
+	   $(ZLIB_INCLUDE) $(GENERAL_INCLUDE) $(PROJ_INCLUDE) $(TCLTK_INCLUDE)
 
 CFLAGS 	= $(INCLUDES) $(COMMON_CFLAGS) $(FLAGS_X86DEF)
 
diff -urN ogdi-3.1.5-orig/contrib/ogdi_info/makefile ogdi-3.1.5/contrib/ogdi_info/makefile
--- ogdi-3.1.5-orig/contrib/ogdi_info/makefile	2001-02-18 23:12:21.000000000 -0500
+++ ogdi-3.1.5/contrib/ogdi_info/makefile	2021-01-14 23:54:10.000000000 -0500
@@ -16,8 +16,8 @@
 
 SOURCES = ogdi_info.c
 
-INCLUDES = $(CURRENT_INCLUDE) $(OGDI_INCLUDE) $(PROJ_INCLUDE)\
-	   $(ZLIB_INCLUDE) $(GENERAL_INCLUDE) $(TCLTK_INCLUDE)
+INCLUDES = $(CURRENT_INCLUDE) $(OGDI_INCLUDE) \
+	   $(ZLIB_INCLUDE) $(GENERAL_INCLUDE) $(PROJ_INCLUDE) $(TCLTK_INCLUDE)
 
 CFLAGS 	= $(INCLUDES) $(COMMON_CFLAGS) $(FLAGS_X86DEF)
 
diff -urN ogdi-3.1.5-orig/ogdi/c-api/ecs_dyna.c ogdi-3.1.5/ogdi/c-api/ecs_dyna.c
--- ogdi-3.1.5-orig/ogdi/c-api/ecs_dyna.c	2004-02-18 16:50:21.000000000 -0500
+++ ogdi-3.1.5/ogdi/c-api/ecs_dyna.c	2021-01-14 22:21:51.000000000 -0500
@@ -82,11 +82,11 @@
   if (handle == NULL) {
     /* Try with the .so extension */
 
-    if ((temp = (char *) malloc(strlen(libname)+7)) == NULL)
+    if ((temp = (char *) malloc(strlen(libname)+10)) == NULL)
       return NULL;
     strcpy(temp,"lib");
     strcat(temp,libname);
-    strcat(temp,".so");
+    strcat(temp,".dylib");
 
     handle = dlopen(temp,RTLD_LAZY);
 #ifdef notdef
diff -urN ogdi-3.1.5-orig/ogdi/driver/rpf/rpf.h ogdi-3.1.5/ogdi/driver/rpf/rpf.h
--- ogdi-3.1.5-orig/ogdi/driver/rpf/rpf.h	2001-04-12 15:22:46.000000000 -0400
+++ ogdi-3.1.5/ogdi/driver/rpf/rpf.h	2021-01-14 22:21:51.000000000 -0500
@@ -52,7 +52,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;
@@ -114,7 +114,7 @@
 
 typedef struct header
 {
-  bool     endian;
+  bbool    endian;
   ushort   hdr_sec_len;       /* header section length */
   ascii    filename[12];
   uchar    new;
@@ -330,8 +330,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;
@@ -355,7 +355,7 @@
   RPF_image    img;
   Attribute    att;
   Replace      repupd;
-  bool         all_subframes;
+  bbool        all_subframes;
   int         NITF_hdr_len;
 } Frame_file;
 
diff -urN ogdi-3.1.5-orig/ogdi/driver/vrf/makefile ogdi-3.1.5/ogdi/driver/vrf/makefile
--- ogdi-3.1.5-orig/ogdi/driver/vrf/makefile	2001-06-20 17:49:31.000000000 -0400
+++ ogdi-3.1.5/ogdi/driver/vrf/makefile	2021-01-14 23:59:31.000000000 -0500
@@ -16,7 +16,7 @@
 
 SOURCES = vrf.c utils.c feature.c object.c open.c swq.c vrfswq.c
 
-INCLUDES = $(CURRENT_INCLUDE) $(GENERAL_INCLUDE) $(OGDI_INCLUDE) $(VPF_INCLUDE) $(PROJ_INCLUDE) $(GLUTIL_INCLUDE)
+INCLUDES = $(CURRENT_INCLUDE) $(GENERAL_INCLUDE) $(OGDI_INCLUDE) $(VPF_INCLUDE) $(GLUTIL_INCLUDE) $(PROJ_INCLUDE)
 CFLAGS 	= $(INCLUDES) $(COMMON_CFLAGS)
 
 LINK_LIBS= $(OGDI_LINKLIB) $(WIN_LINKLIB) $(VPF_STATICLIB) $(MATH_LINKLIB)
diff -urN ogdi-3.1.5-orig/ogdi/gltpd/makefile ogdi-3.1.5/ogdi/gltpd/makefile
--- ogdi-3.1.5-orig/ogdi/gltpd/makefile	2001-02-18 23:12:21.000000000 -0500
+++ ogdi-3.1.5/ogdi/gltpd/makefile	2021-01-14 23:58:22.000000000 -0500
@@ -16,8 +16,8 @@
 
 SOURCES = asyncsvr.c ecs_sif.c ecs_svc.c
 
-INCLUDES = $(CURRENT_INCLUDE) $(OGDI_INCLUDE) $(PROJ_INCLUDE)\
-	   $(ZLIB_INCLUDE) $(GENERAL_INCLUDE)
+INCLUDES = $(CURRENT_INCLUDE) $(OGDI_INCLUDE) \
+	   $(ZLIB_INCLUDE) $(GENERAL_INCLUDE) $(PROJ_INCLUDE)
 
 CFLAGS 	= $(INCLUDES) $(COMMON_CFLAGS) $(FLAGS_X86DEF) $(RPC_INCLUDES)
 
