[x264-devel] [PATCH] add support for FreeBSD in common/cpu.c

Guillaume POIRIER poirierg at gmail.com
Thu Jan 3 23:44:59 CET 2008


Hello,

On Dec 30, 2007 10:59 PM, Igor Mozolevsky <igor at hybrid-lab.co.uk> wrote:
> --- common/cpu.c.orig   2007-12-30 21:40:50.000000000 +0000
> +++ common/cpu.c        2007-12-30 21:44:20.000000000 +0000
> @@ -28,7 +28,7 @@
>  #ifdef SYS_BEOS
>  #include <kernel/OS.h>
>  #endif
> -#ifdef SYS_MACOSX
> +#if defined(SYS_MACOSX) || defined(__FreeBSD__)

__FreeBSD__ is not defined by the configure script, which may harm
cross-compiling, or using compilers different from GCC.
The right way to do it, I believe, is to use SYS_FREEBSD instead.

Please try attached patch, which is more correct IMHO.


> -    if( sysctlbyname("hw.ncpu", &numberOfCPUs, &length, NULL, 0) )
> -    {
> -        numberOfCPUs = 1;
> -    }
> -    return numberOfCPUs;
> +    return sysctlbyname("hw.ncpu", &numberOfCPUs, &length, NULL, 0)
> != 0 ? 1 : numberOfCPUs;

I prefer to split functionnal changes in independent patches. I left
out that "cosmetic" part.

Guillaume
-- 
A soldier will fight long and hard for a bit of colored ribbon.
 -- Napoleon Bonaparte
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x264_freebsd_support.1.diff
Type: application/octet-stream
Size: 643 bytes
Desc: not available
Url : http://mailman.videolan.org/pipermail/x264-devel/attachments/20080103/e6b6e8aa/attachment.obj 


More information about the x264-devel mailing list