Index: /issm/trunk/externalpackages/chaco/chaco.patch
===================================================================
--- /issm/trunk/externalpackages/chaco/chaco.patch	(revision 4634)
+++ /issm/trunk/externalpackages/chaco/chaco.patch	(revision 4635)
@@ -1,81 +1,100 @@
-diff -rc src/code/assign/assign_out.c new/code/assign/assign_out.c
-*** src/code/assign/assign_out.c	1995-08-08 14:32:10.000000000 -0700
---- new/code/assign/assign_out.c	2010-04-06 15:51:09.378194563 -0700
-***************
-*** 3,8 ****
---- 3,9 ----
+diff -rc src/code/assign/assign_out.c old/code/assign/assign_out.c
+*** src/code/assign/assign_out.c	2010-07-16 15:20:47.342501437 -0700
+--- old/code/assign/assign_out.c	1995-08-08 14:32:10.000000000 -0700
+***************
+*** 3,9 ****
    * contract DE-AC04-76DP00789 and is copyrighted by Sandia Corporation. */
   
   #include	<stdio.h>
-+ #include	"defs.h"
+- #include	"defs.h"
   
   static void assign_out_normal(), assign_out_inv();
   
-diff -rc src/code/eigen/get_extval.c new/code/eigen/get_extval.c
-*** src/code/eigen/get_extval.c	1995-08-08 14:32:20.000000000 -0700
---- new/code/eigen/get_extval.c	2010-04-06 15:51:09.399194588 -0700
-***************
-*** 4,9 ****
---- 4,10 ----
+--- 3,8 ----
+diff -rc src/code/eigen/get_extval.c old/code/eigen/get_extval.c
+*** src/code/eigen/get_extval.c	2010-07-16 15:20:47.344501453 -0700
+--- old/code/eigen/get_extval.c	1995-08-08 14:32:20.000000000 -0700
+***************
+*** 4,10 ****
   
   #include <math.h>
   #include <stdio.h>
-+ #include "defs.h"
+- #include "defs.h"
   
   /* Finds first extended eigenpair of system corresponding to
      tridiagonal T using using Rafael's bisection technique. */
-diff -rc src/code/klvspiff/matching.c new/code/klvspiff/matching.c
-*** src/code/klvspiff/matching.c	1996-03-11 10:24:25.000000000 -0800
---- new/code/klvspiff/matching.c	2010-04-06 15:51:09.424194619 -0700
-***************
-*** 6,11 ****
---- 6,12 ----
+--- 4,9 ----
+diff -rc src/code/klvspiff/matching.c old/code/klvspiff/matching.c
+*** src/code/klvspiff/matching.c	2010-07-16 15:20:47.347501477 -0700
+--- old/code/klvspiff/matching.c	1996-03-11 10:24:25.000000000 -0800
+***************
+*** 6,12 ****
      code provided by Ed Rothberg at SGI. */
   
   #include <stdio.h>
-+ #include "defs.h"
+- #include "defs.h"
   
   #define  TRUE  1
   #define  FALSE 0
-diff -rc src/code/main/defs.h new/code/main/defs.h
-*** src/code/main/defs.h	1995-08-08 14:32:41.000000000 -0700
---- new/code/main/defs.h	2010-06-15 10:43:54.039227352 -0700
-***************
-*** 9,11 ****
---- 9,28 ----
+--- 6,11 ----
+diff -rc src/code/main/defs.h old/code/main/defs.h
+*** src/code/main/defs.h	2010-07-16 15:22:43.944433523 -0700
+--- old/code/main/defs.h	1995-08-08 14:32:41.000000000 -0700
+***************
+*** 1,6 ****
+- #ifndef _CHACO_DEFS_H_
+- #define _CHACO_DEFS_H_
+- 
+  #define	max(A, B)	((A) > (B) ? (A) : (B))
+  #define	min(A, B)	((A) < (B) ? (A) : (B))
+  #define sign(A)		((A) <  0  ? -1  :  1)
+--- 1,3 ----
+***************
+*** 12,32 ****
   #define	PI	3.141592653589793
   #define	TWOPI	6.283185307179586
   #define HALFPI  1.570796326794896
-+ 
-+ #ifdef MATLAB
-+     #include "mat.h"
-+     #include "mex.h"
-+     #include "matrix.h"
-+    
-+     #define printf mexPrintf
-+     #define fprintf(file,...) (file == stdout || file == stderr ? mexPrintf(__VA_ARGS__) : fprintf(file,__VA_ARGS__))
-+     #define malloc mxMalloc
-+     #define calloc mxCalloc
-+     #define realloc mxRealloc
-+     #define free mxFree
-+ 	#define exit(status) mexErrMsgTxt("exit=" #status)
-+ 
-+ #endif
-+ #define check_graph chaco_check_graph
-+ 
-diff -rc src/code/Makefile new/code/Makefile
-*** src/code/Makefile	1997-10-02 10:23:22.000000000 -0700
---- new/code/Makefile	2010-06-15 10:35:41.507925761 -0700
-***************
-*** 2,9 ****
-  DEST=		${DEST_DIR}/chaco
-  CC = 		gcc
-  IFLAG =		-Imain
-! CFLAGS =	-O2
-  OFLAGS =	-O2
-  
-  FILES.c=	main/user_params.c main/interface.c main/main.c \
-  		submain/balance.c submain/divide.c submain/submain.c \
---- 2,18 ----
+- 
+- #ifdef MATLAB
+-     #include "mat.h"
+-     #include "mex.h"
+-     #include "matrix.h"
+-    
+-     #define printf mexPrintf
+-     #define fprintf(file,...) (file == stdout || file == stderr ? mexPrintf(__VA_ARGS__) : fprintf(file,__VA_ARGS__))
+-     #define malloc mxMalloc
+-     #define calloc mxCalloc
+-     #define realloc mxRealloc
+-     #define free mxFree
+- 	#define exit(status) mexErrMsgTxt("exit=" #status)
+- 
+- #endif
+- #define check_graph chaco_check_graph
+- 
+- #endif //ifndef _CHACO_DEFS_H_
+--- 9,11 ----
+diff -rc src/code/main/params.h old/code/main/params.h
+*** src/code/main/params.h	2010-07-16 15:23:11.519653477 -0700
+--- old/code/main/params.h	1995-08-08 14:32:43.000000000 -0700
+***************
+*** 1,12 ****
+- #ifndef _CHACO_PARAMS_H_
+- #define _CHACO_PARAMS_H_
+- 
+- 
+  #define NAME_LENGTH	80	/* Maximum length of file name */
+  #define LINE_LENGTH	200	/* Length of input files read at once */
+  
+  #define MAXDIMS		3	/* Most cuts allowed at one time */
+  #define MAXSETS		8	/* 2^MAXDIMS */
+- 
+- 
+- #endif //ifndef _CHACO_PARAMS_H_
+--- 1,5 ----
+diff -rc src/code/Makefile old/code/Makefile
+*** src/code/Makefile	2010-07-16 15:20:47.351501509 -0700
+--- old/code/Makefile	1997-10-02 10:23:22.000000000 -0700
+***************
+*** 2,18 ****
   DEST=		${DEST_DIR}/chaco
   CC = 		gcc
@@ -88,22 +107,22 @@
 ! #CFLAGS =	-fPIC -fno-omit-frame-pointer -pthread -fexceptions -DMATLAB
   OFLAGS =	-O2
-+ #AR =             /usr/ccs/bin/ar rcv   # for solaris 2
-+ AR =             /usr/bin/ar rcv
-+ #RANLIB =         /usr/ccs/bin/ranlib   # for solaris 2
-+ RANLIB =         /usr/bin/ranlib
+- #AR =             /usr/ccs/bin/ar rcv   # for solaris 2
+- AR =             /usr/bin/ar rcv
+- #RANLIB =         /usr/ccs/bin/ranlib   # for solaris 2
+- RANLIB =         /usr/bin/ranlib
   
   FILES.c=	main/user_params.c main/interface.c main/main.c \
   		submain/balance.c submain/divide.c submain/submain.c \
-***************
-*** 90,97 ****
-  FILES.o=	$(FILES.c:.c=.o) 
-  
-  
-! ${DEST}:	${FILES.o} Makefile
-! 		${CC} ${OFLAGS} ${FILES.o} -lm -o ${DEST}
-  
-  lint:
-  		lint ${IFLAG} ${FILES.c} -lm
---- 99,109 ----
+--- 2,9 ----
+  DEST=		${DEST_DIR}/chaco
+  CC = 		gcc
+  IFLAG =		-Imain
+! CFLAGS =	-O2
+  OFLAGS =	-O2
+  
+  FILES.c=	main/user_params.c main/interface.c main/main.c \
+  		submain/balance.c submain/divide.c submain/submain.c \
+***************
+*** 99,109 ****
   FILES.o=	$(FILES.c:.c=.o) 
   
@@ -117,109 +136,99 @@
   lint:
   		lint ${IFLAG} ${FILES.c} -lm
-***************
-*** 100,106 ****
-  		alint ${IFLAG} ${FILES.c} -lm
-  
-  clean:
-! 		rm -f */*.o ${DEST_DIR}/core
-  
-  .c.o:
-  		${CC} -c ${IFLAG} ${CFLAGS} -o $*.o $*.c
---- 112,118 ----
-  		alint ${IFLAG} ${FILES.c} -lm
-  
-  clean:
-! 		rm -f */*.o ${DEST_DIR}/core
-  
-  .c.o:
-  		${CC} -c ${IFLAG} ${CFLAGS} -o $*.o $*.c
-diff -rc src/code/misc/timing.c new/code/misc/timing.c
-*** src/code/misc/timing.c	1997-01-03 09:10:52.000000000 -0800
---- new/code/misc/timing.c	2010-04-06 15:51:09.480194687 -0700
-***************
-*** 3,8 ****
---- 3,9 ----
+--- 90,97 ----
+  FILES.o=	$(FILES.c:.c=.o) 
+  
+  
+! ${DEST}:	${FILES.o} Makefile
+! 		${CC} ${OFLAGS} ${FILES.o} -lm -o ${DEST}
+  
+  lint:
+  		lint ${IFLAG} ${FILES.c} -lm
+diff -rc src/code/misc/timing.c old/code/misc/timing.c
+*** src/code/misc/timing.c	2010-07-16 15:20:47.354501533 -0700
+--- old/code/misc/timing.c	1997-01-03 09:10:52.000000000 -0800
+***************
+*** 3,9 ****
    * contract DE-AC04-76DP00789 and is copyrighted by Sandia Corporation. */
   
   #include   <stdio.h>
-+ #include   "defs.h"
+- #include   "defs.h"
   
   /* Timing parameters. */
   
-diff -rc src/code/util/bail.c new/code/util/bail.c
-*** src/code/util/bail.c	1995-08-08 14:33:01.000000000 -0700
---- new/code/util/bail.c	2010-05-27 10:29:34.698534832 -0700
-***************
-*** 4,9 ****
---- 4,10 ----
+--- 3,8 ----
+diff -rc src/code/util/bail.c old/code/util/bail.c
+*** src/code/util/bail.c	2010-07-16 15:20:47.356501549 -0700
+--- old/code/util/bail.c	1995-08-08 14:33:01.000000000 -0700
+***************
+*** 4,10 ****
   
   #include	<stdio.h>
   #include	<string.h>
-+ #include	"defs.h"
+- #include	"defs.h"
   
   /* Wrapper for exit() - print message and exit with status code. Exit code
      of 0 indicates normal termination. Exit code of 1 indicates early 
-***************
-*** 14,20 ****
+--- 4,9 ----
+***************
+*** 15,20 ****
+--- 14,20 ----
   int       status;
   {
       extern FILE *Output_File;		/* Output file or NULL */
--     void      exit();
++     void      exit();
   
       if (msg != NULL && (int) strlen(msg) > 0) {
           printf("%s\n", msg);
---- 15,20 ----
-Only in new/code/util: bail_old.c
-diff -rc src/code/util/checkpnt.c new/code/util/checkpnt.c
-*** src/code/util/checkpnt.c	1995-08-08 14:33:01.000000000 -0700
---- new/code/util/checkpnt.c	2010-04-06 15:51:09.513194728 -0700
-***************
-*** 4,9 ****
---- 4,10 ----
+diff -rc src/code/util/checkpnt.c old/code/util/checkpnt.c
+*** src/code/util/checkpnt.c	2010-07-16 15:20:47.358501565 -0700
+--- old/code/util/checkpnt.c	1995-08-08 14:33:01.000000000 -0700
+***************
+*** 4,10 ****
   
   #include	<stdio.h>
   #include	<string.h>
-+ #include	"defs.h"
+- #include	"defs.h"
   
   /* Debug break point. */
   void      checkpnt(tag)
-diff -rc src/code/util/doubleout.c new/code/util/doubleout.c
-*** src/code/util/doubleout.c	1995-08-08 14:33:02.000000000 -0700
---- new/code/util/doubleout.c	2010-04-06 15:51:09.527194745 -0700
-***************
-*** 3,8 ****
---- 3,9 ----
+--- 4,9 ----
+diff -rc src/code/util/doubleout.c old/code/util/doubleout.c
+*** src/code/util/doubleout.c	2010-07-16 15:20:47.360501581 -0700
+--- old/code/util/doubleout.c	1995-08-08 14:33:02.000000000 -0700
+***************
+*** 3,9 ****
    * contract DE-AC04-76DP00789 and is copyrighted by Sandia Corporation. */
   
   #include  <stdio.h>
-+ #include  "defs.h"
+- #include  "defs.h"
   
   /* Print a double precision number with filtering format to screen. */
   void      doubleout(number, mode)
-diff -rc src/code/util/smalloc.c new/code/util/smalloc.c
-*** src/code/util/smalloc.c	1996-03-11 10:44:07.000000000 -0800
---- new/code/util/smalloc.c	2010-04-06 15:51:09.542194763 -0700
-***************
-*** 4,9 ****
---- 4,10 ----
+--- 3,8 ----
+diff -rc src/code/util/smalloc.c old/code/util/smalloc.c
+*** src/code/util/smalloc.c	2010-07-16 15:20:47.363501605 -0700
+--- old/code/util/smalloc.c	1996-03-11 10:44:07.000000000 -0800
+***************
+*** 4,10 ****
   
   #include <stdio.h>
   #include <malloc.h>
-+ #include "defs.h"
+- #include "defs.h"
   
   static int nmalloc = 0;		/* number of calls to malloc */
   static int nfree = 0;		/* number of calls to free */
-diff -rc src/code/util/strout.c new/code/util/strout.c
-*** src/code/util/strout.c	1995-08-08 14:33:05.000000000 -0700
---- new/code/util/strout.c	2010-04-06 15:51:09.549194772 -0700
-***************
-*** 4,9 ****
---- 4,10 ----
+--- 4,9 ----
+diff -rc src/code/util/strout.c old/code/util/strout.c
+*** src/code/util/strout.c	2010-07-16 15:20:47.365501621 -0700
+--- old/code/util/strout.c	1995-08-08 14:33:05.000000000 -0700
+***************
+*** 4,10 ****
   
   #include	<stdio.h>
   #include	<string.h>
-+ #include	"defs.h"
+- #include	"defs.h"
   
   /* Wrapper for a printf statement with a string as only arg.
      Prints to screen and to output file if there is one. */
-Only in new/exec: chaco
+--- 4,9 ----
Index: /issm/trunk/externalpackages/chaco/install.sh
===================================================================
--- /issm/trunk/externalpackages/chaco/install.sh	(revision 4634)
+++ /issm/trunk/externalpackages/chaco/install.sh	(revision 4635)
@@ -1,3 +1,6 @@
 #!/bin/bash
+
+#get number of CPUS
+NUMCPUS=$1;
 
 # Some cleanup
@@ -18,9 +21,10 @@
 # Apply patches (all at once)
 # (written by diff -rc src ~/Libs/Chaco-2.2 > chaco.patch)
-patch -p0 < chaco.patch
+patch -R -p0 < chaco.patch
 
 # Build chaco
 cd src/code
-make
+make -j $NUMCPUS
+
 # Clean up objects (but not library or executable)
 make clean
@@ -33,9 +37,8 @@
 cp -p src/exec/*.graph install
 mkdir install/include
-cp -p src/code/main/defs.h install/include
-cp -p src/code/main/params.h install/include
+cp -p src/code/main/defs.h install/include/chaco_defs.h
+cp -p src/code/main/params.h install/include/chaco_params.h
 mkdir install/lib
-mv src/code/chaco.a install/lib
+mv src/code/chaco.a install/lib/libchaco.a
 mkdir install/exec
 mv src/exec/chaco install/exec
-
