Backport from current libsdl svn so we can work with newer kernel headers http://bugs.gentoo.org/159923 http://bugs.gentoo.org/169388 --- configure.in +++ configure.in @@ -807,6 +807,7 @@ ]) AC_MSG_RESULT($video_fbcon) if test x$video_fbcon = xyes; then + AC_CHECK_FUNCS(getpagesize) AC_DEFINE(SDL_VIDEO_DRIVER_FBCON) SOURCES="$SOURCES $srcdir/src/video/fbcon/*.c" have_video=yes --- include/SDL_config.h.in +++ include/SDL_config.h.in @@ -302,4 +302,6 @@ #undef SDL_HERMES_BLITTERS #undef SDL_ALTIVEC_BLITTERS +#undef HAVE_GETPAGESIZE + #endif /* _SDL_config_h */ --- src/video/fbcon/SDL_fbvideo.c +++ src/video/fbcon/SDL_fbvideo.c @@ -29,7 +29,9 @@ #include #include #include +#ifndef HAVE_GETPAGESIZE #include /* For definition of PAGE_SIZE */ +#endif #include #include "SDL_video.h" @@ -149,6 +151,18 @@ struct fb_var_screeninfo *vinfo); static void FB_RestorePalette(_THIS); +static int SDL_getpagesize(void) +{ +#ifdef HAVE_GETPAGESIZE + return getpagesize(); +#elif defined(PAGE_SIZE) + return PAGE_SIZE; +#else +#error Can not determine system page size. + return 4096; /* this is what it USED to be in Linux... */ +#endif +} + /* Small wrapper for mmap() so we can play nicely with no-mmu hosts * (non-mmu hosts disallow the MAP_SHARED flag) */ @@ -547,7 +561,7 @@ /* Memory map the device, compensating for buggy PPC mmap() */ mapped_offset = (((long)finfo.smem_start) - - (((long)finfo.smem_start)&~(PAGE_SIZE-1))); + (((long)finfo.smem_start)&~(SDL_getpagesize()-1))); mapped_memlen = finfo.smem_len+mapped_offset; mapped_mem = do_mmap(NULL, mapped_memlen, PROT_READ|PROT_WRITE, MAP_SHARED, console_fd, 0); --- src/video/Xext/Xxf86dga/XF86DGA.c 2007/03/13 23:11:02 1.1 +++ src/video/Xext/Xxf86dga/XF86DGA.c 2007/03/13 23:15:14 @@ -18,7 +18,8 @@ Copyright (c) 1995,1996 The XFree86 Pro #define HAS_MMAP_ANON #include #include -#include /* PAGE_SIZE */ +/* kernel header doesn't work with -ansi */ +/* #include */ /* PAGE_SIZE */ #define HAS_SC_PAGESIZE /* _SC_PAGESIZE may be an enum for Linux */ #define HAS_GETPAGESIZE #endif /* linux */