Cri-map
From BCF's Genetics Wiki
Getting cri-map to compile on os x
Edit our_allo.c as follows:
#define NALLOC 63000
/*static HEADER *morecore(nu)*/
HEADER *morecore(nu)
ALLOC nu;
{
/*char *malloc();*/
char *cp;
HEADER *up;
ALLOC rnu;
SHORT our_free();
rnu = NALLOC * ((nu + NALLOC - 1) / NALLOC);
printf("\n%ld bytes allocated in morecore\n", rnu * sizeof(HEADER));
cp = malloc(rnu * sizeof(HEADER));
if (!cp) {
printf("\n ERROR: ALLOCATION FAILED IN MORECORE\n");
exit(0);
}
up = (HEADER *)cp;
up->s.size = rnu;
our_free((char *)(up + 1));
return(allocp);
}
Edit our_orde.c such that it looks like the following:
#define NALLOC 6300
/*static HEADER *orders_morecore(nu)*/
HEADER *orders_morecore(nu)
ALLOC nu;
{
/*char *malloc();*/
char *cp;
HEADER *up;
ALLOC rnu;
SHORT our_orders_free();
rnu = NALLOC * ((nu + NALLOC - 1) / NALLOC);
printf("\n%ld bytes allocated in orders_morecore\n",
rnu * sizeof(HEADER));
cp = malloc(rnu * sizeof(HEADER));
if (!cp) {
printf("\nALLOC FAILED IN OUR_ORDERS_ALLOC\n");
exit(0);
}
up = (HEADER *)cp;
up->s.size = rnu;
our_orders_free((char *)(up + 1));
return(orders_allocp);
}
Compile with:
cc -O -o crimap *.c -lm
You can clear some of the warnings (exit) by adding...
#include <stdlib.h>
above the line:
#include "defs.h"
...in the following files:
- e_chrom.c
- e_crimap.c
- e_ped.c
- flips.c
- merge.c
- our_allo.c
- our_orde.c
- read_ord.c
You can also find and replace exit() [or exit ()] with:
exit(0)
This is what is done to the code available from the FreeBSD ports system, so thanks to the FreeBSD maintainers of this program.
To build a universal binary on OS X, the following script should do it:
#!/bin/bash
LDLIBS="-lm"
CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386"
LDFLAGS="-g -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386"
gcc -O2 $CFLAGS -o crimap *.c $LDLIBS
