[amsat-bb] Re: getting predict compiled (under osx 10.4)
kb5mu at amsat.org
Mon Dec 1 20:47:54 PST 2008
At 2:38 PM -0800 12/1/08, Eric Fort wrote:
>... even better have ./install figure out which unix you are compiling for and get the necessary stuff (bearing in mind the remaining questions below)
It does do that, but not in the usual way. The portability problems are really almost entirely in the configuration process itself!
I found the easiest thing to do was ignore the installer program. Just do manually what it does automatically, which is to create a little include file and then compile the rest of the program.
The little include file is named "predict.h" and it contains three definitions, like this:
char *predictpath="/foo/", soundcard=1, *version="2.2.2x";
You'd replace "/foo/" with the path where you want to install Predict. You'd use the version string that matches the version of source code you're compiling, possibly with an "x" or something added to signify that you've messed with it. The variable soundcard=1 is what makes it shut up about not having a soundcard.
Then just compile with something like
cc -lncurses -O3 predict.c -o predict
Back in 2003 I wrote the following; I don't know offhand if it still applies on OS X:
At 3:25 PM -0700 7/13/03, Paul Williamson wrote:
>The only other interesting gotcha is that ftime() is used but doesn't exist in OS X's
>standard tools. You can work around this as follows:
>ftime() has been replaced by gettimeofday(). The following function replaces
>the existing CurrentDaynum() function in the predict.c with one that uses
> /* Read the system clock and return the number
> of days since 31Dec79 00:00:00 UTC (daynum 0) */
> //struct timeb tptr;
> //int x;
> // x=ftime(&tptr);
> //return ((((double)tptr.time+0.001*(double)tptr.millitm)/86400.0)-3651.0);
> struct timeval tv;
> struct timezone tz;
> // gettimeofday() is referenced to Jan 1, 1970; 3651 converts to the reference above.
> if (gettimeofday(&tv, &tz) != 0)
> return 8000.0; // how should we handle errors?
> return ((((double)tv.tv_sec + 0.000001*(double)tv.tv_usec)/86400.0)-3651.0);
>How do I get it to use the verson of vocalizer for the mac referenced above?
Just put the vocalizer program into the vocalizer subdirectory of the installation directory, which must match the value of predictpath from predict.h.
>Is there a means to easily call another external program instead of vocalizer when an event happens?
Vocalizer IS an external program. You can substitute any program you like, as long as it's named vocalizer/vocalizer. It takes simple command-line arguments.
kb5mu at amsat.org
More information about the AMSAT-BB