From 4c63319d249cb796b735ec56904c088c56a5171f Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Tue, 9 Sep 2014 20:26:15 -0700 Subject: Check for pagesize options via autoconf instead of per-platform #ifdefs Signed-off-by: Alan Coopersmith --- configure.ac | 3 +++ lisp/lisp.c | 29 ++++++----------------------- lisp/private.h | 1 + 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/configure.ac b/configure.ac index 9df9ecc..720a7ba 100644 --- a/configure.ac +++ b/configure.ac @@ -47,6 +47,9 @@ AC_ARG_WITH(lispdir, AS_HELP_STRING([--with-lispdir=PATH], LISPDIR=$lispdir AC_SUBST(LISPDIR) +AC_CHECK_DECLS([_SC_PAGESIZE]) +AC_CHECK_FUNCS([getpagesize]) + AC_CHECK_FUNC(realpath, [], [have_realpath=yes]) AM_CONDITIONAL(NEED_REALPATH, test x$have_realpath = xyes) AC_CHECK_FUNC(strcasecmp, [], [have_strcasecmp=yes]) diff --git a/lisp/lisp.c b/lisp/lisp.c index b999b8a..a533beb 100644 --- a/lisp/lisp.c +++ b/lisp/lisp.c @@ -29,6 +29,10 @@ /* $XFree86: xc/programs/xedit/lisp/lisp.c,v 1.87tsi Exp $ */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include #include #ifdef sun @@ -45,27 +49,6 @@ #include /* for sysconf(), and getpagesize() */ #endif -#if defined(linux) -#define HAS_GETPAGESIZE -#define HAS_SC_PAGESIZE /* _SC_PAGESIZE may be an enum for Linux */ -#endif - -#if defined(CSRG_BASED) -#define HAS_GETPAGESIZE -#endif - -#if defined(sun) -#define HAS_GETPAGESIZE -#endif - -#if defined(QNX4) -#define HAS_GETPAGESIZE -#endif - -#if defined(__QNXNTO__) -#define HAS_SC_PAGESIZE -#endif - #include "lisp/bytecode.h" #include "lisp/read.h" @@ -636,7 +619,7 @@ LispGetPageSize(void) /* Try each supported method in the preferred order */ -#if defined(_SC_PAGESIZE) || defined(HAS_SC_PAGESIZE) +#if defined(_SC_PAGESIZE) || defined(HAVE_DECL__SC_PAGESIZE) pagesize = sysconf(_SC_PAGESIZE); #endif @@ -645,7 +628,7 @@ LispGetPageSize(void) pagesize = sysconf(_SC_PAGE_SIZE); #endif -#ifdef HAS_GETPAGESIZE +#ifdef HAVE_GETPAGESIZE if (pagesize == -1) pagesize = getpagesize(); #endif diff --git a/lisp/private.h b/lisp/private.h index f6aeff0..2cbdfc3 100644 --- a/lisp/private.h +++ b/lisp/private.h @@ -68,6 +68,7 @@ (LispObj *)lisp__data.features->data.atom->property->value : \ NIL) #define PACK lisp__data.packlist +#undef PACKAGE /* avoid conflicts with autoconf's #define in config.h */ #define PACKAGE lisp__data.package->data.atom->property->value #define MOD lisp__data.modlist #define COD lisp__data.codlist -- cgit v1.2.3