Include proper headers for sysctlbyname() on Mac OS
authorThomas Zander <thomas.e.zander@googlemail.com>
Thu, 29 Oct 2015 13:32:03 +0000 (14:32 +0100)
committerErik de Castro Lopo <erikd@mega-nerd.com>
Fri, 30 Oct 2015 09:21:26 +0000 (20:21 +1100)
According to Xcode documentation[1], sysctlbyname is available on
Mac OS via the same includes as on FreeBSD/DragonFly.

[1] https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man3/sysctlbyname.3.html

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
src/libFLAC/cpu.c

index 77e0035..63f0ffa 100644 (file)
@@ -77,15 +77,11 @@ static void disable_avx(FLAC__CPUInfo *info)
 #include <machine/cpu.h>
 #endif
 
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) || defined(__APPLE__)
 #include <sys/types.h>
 #include <sys/sysctl.h>
 #endif
 
-#if defined(__APPLE__)
-/* how to get sysctlbyname()? */
-#endif
-
 #ifdef FLAC__CPU_IA32
 /* these are flags in EDX of CPUID AX=00000001 */
 static const unsigned FLAC__CPUINFO_IA32_CPUID_CMOV = 0x00008000;