summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2014-09-09 20:26:15 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2014-09-09 20:26:15 -0700
commit4c63319d249cb796b735ec56904c088c56a5171f (patch)
treef00f62f8eedca10ef7071f5601a0ead8f2d43745
parent9f0f4a2c5495eec2d81a4381fb962fad93b2ddde (diff)
Check for pagesize options via autoconf instead of per-platform #ifdefs
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--configure.ac3
-rw-r--r--lisp/lisp.c29
-rw-r--r--lisp/private.h1
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 <stdlib.h>
#include <string.h>
#ifdef sun
@@ -45,27 +49,6 @@
#include <unistd.h> /* 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