Christian Biesinger
2006-May-25 11:08 UTC
[Fontconfig] Fontconfig 2.3.95 and no _SC_PAGESIZE
Hi, I''ve tried to compile Fontconfig 2.3.95 on a Zeta (BeOS) system. This system has a sysconf call, but lacks the _SC_PAGESIZE constant. The attached patch makes it possible to compile fontconfig on BeOS again. thanks, -christian -------------- next part -------------- Index: configure.in ==================================================================RCS file: /cvs/fontconfig/fontconfig/configure.in,v retrieving revision 1.66.2.12 diff -p -u -6 -r1.66.2.12 configure.in --- configure.in 25 Apr 2006 15:33:07 -0000 1.66.2.12 +++ configure.in 25 May 2006 17:20:34 -0000 @@ -144,12 +144,19 @@ AC_TYPE_PID_T # Checks for library functions. AC_FUNC_VPRINTF AC_FUNC_MMAP AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr strtol getopt getopt_long sysconf ftruncate chsize rand_r]) +# Not all systems that have sysconf also have _SC_PAGESIZE +# For example, BeOS has the former but lacks the latter +AC_TRY_COMPILE([#include <unistd.h>], + [sysconf(_SC_PAGESIZE);], + [AC_DEFINE([HAVE_SC_PAGESIZE], [], + [Whether there''s a _SC_PAGESIZE constant])]) + # # Checks for iconv # AC_MSG_CHECKING([for a usable iconv]) ICONV_LIBS="" AC_TRY_LINK([#include <iconv.h>], Index: src/fccache.c ==================================================================RCS file: /cvs/fontconfig/fontconfig/src/fccache.c,v retrieving revision 1.23.4.88 diff -p -u -6 -r1.23.4.88 fccache.c --- src/fccache.c 27 Apr 2006 07:11:44 -0000 1.23.4.88 +++ src/fccache.c 25 May 2006 17:20:34 -0000 @@ -619,13 +619,13 @@ FcCacheNextOffset(off_t w) static long pagesize = -1; if (w == -1) return w; if (pagesize == -1) -#if defined (HAVE_SYSCONF) +#if defined (HAVE_SYSCONF) && defined (HAVE_SC_PAGESIZE) pagesize = sysconf(_SC_PAGESIZE); #else pagesize = FC_HARDCODED_PAGESIZE; #endif if (w % pagesize == 0) return w;