diff -Nurd afni_src.orig/Makefile.macosx_10.2 afni_src/Makefile.macosx_10.2
--- afni_src.orig/Makefile.macosx_10.2	2002-11-21 11:41:35.000000000 -0500
+++ afni_src/Makefile.macosx_10.2	2005-12-13 13:22:57.000000000 -0500
@@ -1,19 +1,19 @@
 # This Makefile is for Mac OSX 10.0 (Darwin)
 
 CCDEBS = -DAFNI_DEBUG -DIMSEQ_DEBUG -DDISPLAY_DEBUG -DTHD_DEBUG
-CEXTRA = -Wcomment -Wformat -DUSE_TRACING -DHAVE_XDBE -no-cpp-precomp
+CEXTRA = -Wcomment -Wformat -DUSE_TRACING -DHAVE_XDBE 
 CC     = cc -O2 -ffast-math -DDARWIN -DNO_GAMMA $(CEXTRA)
 CCVOL  = cc -O2 -ffast-math -DDARWIN -DNO_GAMMA $(CEXTRA)
 CCFAST = cc -O3 -ffast-math -DDARWIN -DNO_GAMMA $(CEXTRA)
 CCMIN  = cc
 CCD    = $(CC) $(CCDEBS)
-IFLAGS = -I. -I/usr/include -I/usr/include/sys -I/usr/X11R6/include
-LFLAGS = -L. -L/usr/X11R6/lib -Wl,-force_flat_namespace
+IFLAGS = -I. -I/usr/X11R6/include -I@PREFIX@/include
+LFLAGS = -L. -L/usr/X11R6/lib -L@PREFIX@/lib
 
 PLUGIN_SUFFIX = so
 PLUGIN_LFLAGS = -flat_namespace -bundle -undefined suppress
 PLUGIN_CC     = $(CC) -dynamic -fno-common
-PLFLAGS       = -dynamic -L. -L/usr/X11R6/lib -Wl,-force_flat_namespace
+PLFLAGS       = -dynamic -L. -L/usr/X11R6/lib -L@PREFIX@/lib
 
 AR     = /usr/bin/ar
 RANLIB = /usr/bin/ranlib
@@ -31,7 +31,7 @@
 INSTALLDIR = ./macosx_10.2
 LIBDIR = $(INSTALLDIR)
 
-LIBDL = libdl.a
+#LIBDL = libdl.a
 
 # for dynamic linking
 
diff -Nurd afni_src.orig/afni_setup.c afni_src/afni_setup.c
--- afni_src.orig/afni_setup.c	2002-11-21 11:41:32.000000000 -0500
+++ afni_src/afni_setup.c	2005-12-13 14:24:52.000000000 -0500
@@ -176,7 +176,7 @@
 
 if(PRINT_TRACING)
 { char str[256] ;
-  sprintf(str,"found palette label=%s. [len=%d label[0]=%d]",
+  sprintf(str,"found palette label=%s. [len=%lu label[0]=%d]",
           label,strlen(label),(int)label[0]); STATUS(str);
   sprintf(str,"nbuf=%d fptr-fbuf=%d",nbuf,fptr-fbuf); STATUS(str);}
 
diff -Nurd afni_src.orig/f2cdir/f2c.h afni_src/f2cdir/f2c.h
--- afni_src.orig/f2cdir/f2c.h	2002-11-21 11:41:37.000000000 -0500
+++ afni_src/f2cdir/f2c.h	2005-12-13 13:22:57.000000000 -0500
@@ -8,7 +8,7 @@
 #define F2C_INCLUDE
 
 #define NON_UNIX_STDIO     /* RWCox */
-#define complex complexxx  /* RWCox */
+//#define complex complexxx  /* RWCox */
 
 typedef long int integer;
 typedef unsigned long uinteger;
diff -Nurd afni_src.orig/mcw_malloc.c afni_src/mcw_malloc.c
--- afni_src.orig/mcw_malloc.c	2002-11-21 11:41:33.000000000 -0500
+++ afni_src/mcw_malloc.c	2005-12-13 13:28:34.000000000 -0500
@@ -215,7 +215,7 @@
    for( ii=0 ; ii < NEXTRA ; ii++ )
       if( fred[ii] != MAGIC ){
          fprintf(stderr,"*** malloc pre-corruption!  "
-                        "serial=%u size=%d source=%s line#=%d\n",
+                        "serial=%u size=%zd source=%s line#=%d\n",
                         ip->pss,ip->psz,ip->pfn,ip->pln ) ;
          break ;
       }
@@ -223,7 +223,7 @@
    for( ii=0 ; ii < NEXTRA ; ii++ )
       if( fred[n+NEXTRA+ii] != MAGIC ){
          fprintf(stderr,"*** malloc post-corruption!  "
-                        "serial=%u size=%d source=%s line#=%d\n",
+                        "serial=%u size=%zd source=%s line#=%d\n",
                         ip->pss,ip->psz,ip->pfn,ip->pln ) ;
          break ;
       }
@@ -416,7 +416,7 @@
       jj = jk[ii] / JBASE ;           /* retrieve jj and kk */
       kk = jk[ii] % JBASE ;
       if( htab[jj][kk].pmt != NULL ){
-         fprintf(fp,"%7u %10d %-20.30s %5d %10p %5d %3d",
+         fprintf(fp,"%7u %10zd %-20.30s %5d %10p %5d %3d",
                  htab[jj][kk].pss , htab[jj][kk].psz ,
                  htab[jj][kk].pfn , htab[jj][kk].pln , htab[jj][kk].pmt ,
                  jj,kk ) ;
diff -Nurd afni_src.orig/niml.c afni_src/niml.c
--- afni_src.orig/niml.c	2002-11-21 11:41:33.000000000 -0500
+++ afni_src/niml.c	2005-12-13 13:44:16.000000000 -0500
@@ -1435,7 +1435,7 @@
      }
      nbuf = strlen(buf); sprintf(buf+nbuf,"%02x",(int)urr[nurr]);
      nurr = (nurr+1) % NURR ;
-URR_DONE:
+URR_DONE: ;
    }
 #endif /* NURR */
 
@@ -8950,7 +8950,7 @@
    for( ii=0 ; ii < NEXTRA ; ii++ )
      if( fred[ii] != MAGIC ){
        fprintf(stderr,"*** malloc pre-corruption!  "
-                      "serial=%u size=%d source=%s line#=%d\n",
+                      "serial=%u size=%zd source=%s line#=%d\n",
                       ip->pss,ip->psz,ip->pfn,ip->pln ) ;
         break ;
      }
@@ -8958,7 +8958,7 @@
    for( ii=0 ; ii < NEXTRA ; ii++ )
      if( fred[n+NEXTRA+ii] != MAGIC ){
        fprintf(stderr,"*** malloc post-corruption!  "
-                      "serial=%u size=%d source=%s line#=%d\n",
+                      "serial=%u size=%zd source=%s line#=%d\n",
                       ip->pss,ip->psz,ip->pfn,ip->pln ) ;
        break ;
      }
@@ -9148,7 +9148,7 @@
      jj = jk[ii] / JBASE ;           /* retrieve jj and kk */
      kk = jk[ii] % JBASE ;
      if( htab[jj][kk].pmt != NULL ){
-       fprintf(fp,"%7u %10d %-20.30s %5d %10p %5d %3d",
+       fprintf(fp,"%7u %10zd %-20.30s %5d %10p %5d %3d",
                htab[jj][kk].pss , htab[jj][kk].psz ,
                htab[jj][kk].pfn , htab[jj][kk].pln , htab[jj][kk].pmt ,
                jj,kk ) ;
diff -Nurd afni_src.orig/plug_maskcalc.c afni_src/plug_maskcalc.c
--- afni_src.orig/plug_maskcalc.c	2002-11-21 11:41:33.000000000 -0500
+++ afni_src/plug_maskcalc.c	2005-12-13 13:22:57.000000000 -0500
@@ -23,7 +23,6 @@
 #include <stdio.h>
 #include <math.h>
 #include <stdlib.h>
-#include <malloc.h>
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
diff -Nurd afni_src.orig/plug_threshold.c afni_src/plug_threshold.c
--- afni_src.orig/plug_threshold.c	2002-11-21 11:41:34.000000000 -0500
+++ afni_src/plug_threshold.c	2005-12-13 13:22:57.000000000 -0500
@@ -36,13 +36,13 @@
 #include <sys/types.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <malloc.h>
 #include <strings.h>
 #include <math.h>
 #include "afni.h"
 
 #if !defined(DARWIN) && !defined(CYGWIN)
 #include <values.h>
+#include <malloc.h>
 #endif
 
 #ifndef MAXINT
diff -Nurd afni_src.orig/volpack/vp_global.h afni_src/volpack/vp_global.h
--- afni_src.orig/volpack/vp_global.h	2002-11-21 11:41:36.000000000 -0500
+++ afni_src/volpack/vp_global.h	2005-12-13 13:22:57.000000000 -0500
@@ -36,7 +36,6 @@
 #include "volpack.h"
 
 #include <stdio.h>
-#include <malloc.h>
 #include <math.h>
 extern double rint ANSI_ARGS((double x)); /* missing from Ultrix math.h */
 
