Fixed bug 2335 - Fails to build on Debian GNU/kFreeBSD

Felix Geyer

Starting from version 2.0.1 libsdl fails to build on Debian GNU/kFreeBSD in SDL_cpuinfo.c.

GNU/kFreeBSD defines __FreeBSD_kernel__ but not __FreeBSD__.
The #ifdef __FreeBSD__ check should be extended for __FreeBSD_kernel__, see the attached patch.

Build log:
libtool: compile:  gcc -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -DUSING_GENERATED_CONFIG_H -Iinclude -I/?BUILDDIR?/libsdl2-2.0.1+dfsg1/include -mmmx -m3dnow -msse -msse2 -fvisibility=hidden -D_REENTRANT -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-kfreebsd-gnu/dbus-1.0/include -DHAVE_USBHID_H -DUSBHID_NEW -D_REENTRANT -Wall -c /?BUILDDIR?/libsdl2-2.0.1+dfsg1/src/cpuinfo/SDL_cpuinfo.c  -fPIC -DPIC -o build/.libs/SDL_cpuinfo.o
/?BUILDDIR?/libsdl2-2.0.1+dfsg1/src/cpuinfo/SDL_cpuinfo.c: In function 'SDL_GetSystemRAM':
/?BUILDDIR?/libsdl2-2.0.1+dfsg1/src/cpuinfo/SDL_cpuinfo.c:632:35: error: 'HW_MEMSIZE' undeclared (first use in this function)
             int mib[2] = {CTL_HW, HW_MEMSIZE};
                                   ^
/?BUILDDIR?/libsdl2-2.0.1+dfsg1/src/cpuinfo/SDL_cpuinfo.c:632:35: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [build/SDL_cpuinfo.lo] Error 1
This commit is contained in:
Sam Lantinga 2014-02-22 18:01:18 -08:00
parent 6bb2f2ef8d
commit fea87cc9cf

View File

@ -653,7 +653,7 @@ SDL_GetSystemRAM(void)
#endif #endif
#ifdef HAVE_SYSCTLBYNAME #ifdef HAVE_SYSCTLBYNAME
if (SDL_SystemRAM <= 0) { if (SDL_SystemRAM <= 0) {
#ifdef __FreeBSD__ #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#ifdef HW_REALMEM #ifdef HW_REALMEM
int mib[2] = {CTL_HW, HW_REALMEM}; int mib[2] = {CTL_HW, HW_REALMEM};
#else #else
@ -662,7 +662,7 @@ SDL_GetSystemRAM(void)
#endif /* HW_REALMEM */ #endif /* HW_REALMEM */
#else #else
int mib[2] = {CTL_HW, HW_MEMSIZE}; int mib[2] = {CTL_HW, HW_MEMSIZE};
#endif /* __FreeBSD__ */ #endif /* __FreeBSD__ || __FreeBSD_kernel__ */
Uint64 memsize = 0; Uint64 memsize = 0;
size_t len = sizeof(memsize); size_t len = sizeof(memsize);