[PD-dev] powf, sinf, etc. on Mac OS X

Hans-Christoph Steiner hans at eds.org
Sat Jan 28 16:12:19 CET 2006


On Jan 28, 2006, at 3:13 AM, zmoelnig at iem.at wrote:

> Zitiere Hans-Christoph Steiner <hans at eds.org>:
>
>> Any problem with using the right functions on Mac OS X?  This should
>> speed things up a bit, no?  I'll make the patch if there's no
>> problem...
>
> yes! the "right functions" have been only been added to recent  
> versions of os-X.
> so abandoning the macros would make pd unusable on older versions of  
> this os.
> in zexy and Gem, jamie has incorporated a more or less generic way  
> (without(!)
> autoconf, just header magic) to test whether the right functions exist  
> or not.

This is what autoconf is all about.  Its pretty easy to do, and it  
would look something like this in x_arithmetic.c:

#if defined(MSW) || ( defined(__APPLE__) && !defined(HAVE_LIBMX) )
#define sinf sin
#define cosf cos
#define atanf atan
#define atan2f atan2
#define sqrtf sqrt
#define logf log
#define expf exp
#define fabsf fabs
#define powf pow
#endif


and this in configure.in:

dnl Checking for `powf' function in -lmx, which provides :
AC_CHECK_LIB(mx, powf, PDLIB="$PDLIB -lmx";
             MORECFLAGS="$MORECFLAGS -DHAVE_LIBMX",
	         echo "using libmx for single precision")

And by the way, compiling with gcc 4.0 on Mac OS X automatically  
includes libmx, so Pd builds on Mac OS X 10.4 will only run on 10.3.9  
or newer (unless you make it compile with gcc 3.3 and compatibility  
libs).

.hc
________________________________________________________________________ 
____

"Information wants to be free."
                                      -Stewart Brand





More information about the Pd-dev mailing list