diff -uN mm2.7/src/Makefile.ORG mm2.7/src/Makefile
--- mm2.7/src/Makefile.ORG	1994-01-27 02:32:33.000000000 +0900
+++ mm2.7/src/Makefile	2013-07-27 19:18:35.744919000 +0900
@@ -26,7 +26,7 @@
 CP = cp
 
 # How to compile C programs
-CC = cc
+CC = gcc
 
 # You may also want to change the CFLAGS variable, which will be passed on 
 # to all subdirectories.    If you do that, the changes will only work right if you
@@ -38,11 +38,12 @@
 
 STATICFLAG=FOOBAR${HOST_ARCH}
 
-CFLAGS = -g -I.  ${$(STATICFLAG)} 
+#CFLAGS = -g -I.  ${$(STATICFLAG)} 
 # The following is better if you want to make sure you run with SYSV defined
-# CFLAGS = -g -I.  ${$(STATICFLAG)}  -DSYSV
+#CFLAGS = -g -I.  ${$(STATICFLAG)}  -DSYSV
 # Also, for SGI Irix, compile in K&R mode
 #CFLAGS = -g -I.  ${$(STATICFLAG)}  -DSYSV -cckr
+CFLAGS = -g -I.  ${$(STATICFLAG)} -DSYSV
 
 # You may have to include other libraries to the link to get things like
 # gethostname() resolved or use shared libraries.  This is done with the
@@ -72,10 +73,11 @@
 #	install -s -c $(LOCALBINDIR) $$file
 #
 #INSTALL = cp
-INSTALL = install -c -s
+#INSTALL = install -c -s
+INSTALL = install -c -m 0755
 
 # Root of installation tree
-INSTROOT = /usr/local
+INSTROOT = /usr/local/misc
 #
 # This is where binaries should be copied
 LOCALBINDIR = ${INSTROOT}/bin
diff -uN mm2.7/src/config.h.ORG mm2.7/src/config.h
--- mm2.7/src/config.h.ORG	1993-11-25 00:36:07.000000000 +0900
+++ mm2.7/src/config.h	2013-07-27 19:10:12.739046000 +0900
@@ -100,6 +100,7 @@
 #endif
 
 #ifdef SYSV
+#ifndef __sun__
 #define killpg(a, b) kill(-(a), (b))
 #define bcopy(a, b, c) memcpy(b, a, c)
 #define bzero(a, b) memset(a, 0, b)
@@ -108,13 +109,20 @@
 #define rindex strrchr
 #define initstate srand
 #define random rand
+#endif
 #define NO_RLIMITS 1
 #define sigtype void
 #endif
 
 /* Solaris, at least, has better versions of some functions */
 #ifdef __svr4__
+#ifndef __sun__
 #define bcopy(a, b, c) memmove(b, a, c)
+#else
+#include <strings.h>
+#include <string.h>
+#include <stdlib.h>
+#endif
 #define initstate srand48
 #define random lrand48
 #endif
diff -uN mm2.7/src/metamail/mailto.c.ORG mm2.7/src/metamail/mailto.c
--- mm2.7/src/metamail/mailto.c.ORG	1994-02-10 05:30:26.000000000 +0900
+++ mm2.7/src/metamail/mailto.c	2013-07-27 19:07:59.332610000 +0900
@@ -60,7 +60,10 @@
 #include <unistd.h>
 #endif
 
+#ifndef __sun__
 extern char *malloc(), *realloc(), *index(), *getmyname();
+#else
+#endif
 struct mailpart *CreateNewPart();
 
 /* The main data structure for the multiple parts of the mail */
diff -uN mm2.7/src/metamail/metamail.c.ORG mm2.7/src/metamail/metamail.c
--- mm2.7/src/metamail/metamail.c.ORG	1994-02-17 10:57:19.000000000 +0900
+++ mm2.7/src/metamail/metamail.c	2013-07-27 19:01:30.477103000 +0900
@@ -100,7 +100,7 @@
 #define CMDSIZE 1200 /* Maximum size of command to execute */
 
 #define LINE_BUF_SIZE       2000
-#ifndef MICROSOFT
+#if !defined(MICROSOFT) && !defined(__sun__)
 extern char *malloc();
 extern char *realloc();
 #endif
diff -uN mm2.7/src/metamail/putenv.c.ORG mm2.7/src/metamail/putenv.c
--- mm2.7/src/metamail/putenv.c.ORG	1993-10-13 01:17:43.000000000 +0900
+++ mm2.7/src/metamail/putenv.c	2013-07-27 19:06:23.325306000 +0900
@@ -48,7 +48,11 @@
 /* Put STRING, which is of the form "NAME=VALUE", in the environment.  */
 int
 putenv (string)
+#ifndef __sun__
      const char *string;
+#else
+     char *string;
+#endif
 {
   char *name_end = index (string, '=');
   register size_t size;
diff -uN mm2.7/src/metamail/shared.c.ORG mm2.7/src/metamail/shared.c
--- mm2.7/src/metamail/shared.c.ORG	1993-05-17 03:19:32.000000000 +0900
+++ mm2.7/src/metamail/shared.c	2013-07-27 19:02:46.895633000 +0900
@@ -6,7 +6,9 @@
 #include <sys/utsname.h>
 #endif
 
+#ifndef __sun__
 extern char *malloc();
+#endif
 char **Exceptions;
 int *NeedsPortableNewlines;
 int ExceptionsAlloced = 0, ExceptionsUsed = 0;
diff -uN mm2.7/src/metamail/splitmail.c.ORG mm2.7/src/metamail/splitmail.c
--- mm2.7/src/metamail/splitmail.c.ORG	1994-02-01 07:23:14.000000000 +0900
+++ mm2.7/src/metamail/splitmail.c	2013-07-27 19:09:29.287669000 +0900
@@ -28,7 +28,9 @@
 #include <time.h>
 
 #define MINCHUNKSIZE 20000 /* Better be enough to hold the headers, or we die! */
+#ifndef __sun__
 extern char *malloc(), *index(), *getmyname();
+#endif
 
 #ifdef AMIGA
 #define Prototype   extern
diff -uN mm2.7/src/richmail/richlex.c.ORG mm2.7/src/richmail/richlex.c
--- mm2.7/src/richmail/richlex.c.ORG	1994-02-03 11:29:37.000000000 +0900
+++ mm2.7/src/richmail/richlex.c	2013-07-27 19:12:24.900656000 +0900
@@ -42,6 +42,7 @@
 -------------------------------------------------------------------------*/
 
 #include <stdio.h>
+#include <string.h>
 #include <ctype.h>
 #include "richlex.h"
 #include "richset.h"
diff -uN mm2.7/src/richmail/richset.c.ORG mm2.7/src/richmail/richset.c
--- mm2.7/src/richmail/richset.c.ORG	1992-10-22 03:04:19.000000000 +0900
+++ mm2.7/src/richmail/richset.c	2013-07-27 19:12:02.250522000 +0900
@@ -34,6 +34,7 @@
 -------------------------------------------------------------------------*/
 
 #include <stdio.h>
+#include <stdlib.h>
 #include "richlex.h"
 #include "richset.h"
 
diff -uN mm2.7/src/richmail/richtext.c.ORG mm2.7/src/richmail/richtext.c
--- mm2.7/src/richmail/richtext.c.ORG	1994-02-10 01:31:18.000000000 +0900
+++ mm2.7/src/richmail/richtext.c	2013-07-27 18:57:01.157725000 +0900
@@ -156,6 +156,17 @@
 #endif
 }
 
+static lc2strcmp(s1, s2)
+char *s1, *s2;
+{
+    if (!s1 || !s2) return (-1);
+    while (*s1 && *s2) {
+	if (*s1 != *s2 && (tolower(*s1) != *s2)) return(-1);
+	++s1; ++s2;
+    }
+    return((*s1 == *s2) ? 0 : -1);
+}
+
 #ifndef	RICHTEXT_LIBRARY
 
 /*
@@ -989,17 +1000,6 @@
     while(*s) (*RichtextPutc)((int)(*s++),fp);
 }
 
-static lc2strcmp(s1, s2)
-char *s1, *s2;
-{
-    if (!s1 || !s2) return (-1);
-    while (*s1 && *s2) {
-	if (*s1 != *s2 && (tolower(*s1) != *s2)) return(-1);
-	++s1; ++s2;
-    }
-    return((*s1 == *s2) ? 0 : -1);
-}
-
 static lc2strncmp(s1, s2, len)
 char *s1, *s2;
 int len;
