summaryrefslogtreecommitdiffstats
path: root/contrib/binutils/libiberty/getpagesize.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/binutils/libiberty/getpagesize.c')
-rw-r--r--contrib/binutils/libiberty/getpagesize.c55
1 files changed, 31 insertions, 24 deletions
diff --git a/contrib/binutils/libiberty/getpagesize.c b/contrib/binutils/libiberty/getpagesize.c
index e9784b8..564d6c0 100644
--- a/contrib/binutils/libiberty/getpagesize.c
+++ b/contrib/binutils/libiberty/getpagesize.c
@@ -28,36 +28,43 @@ BUGS
#ifndef VMS
+#include "config.h"
+
#include <sys/types.h>
-#ifndef NO_SYS_PARAM_H
+#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
-#ifdef HAVE_SYSCONF
+#undef GNU_OUR_PAGESIZE
+#if defined (HAVE_SYSCONF) && defined (HAVE_UNISTD_H)
#include <unistd.h>
+#ifdef _SC_PAGESIZE
#define GNU_OUR_PAGESIZE sysconf(_SC_PAGESIZE)
-#else
-#ifdef PAGESIZE
-#define GNU_OUR_PAGESIZE PAGESIZE
-#else /* no PAGESIZE */
-#ifdef EXEC_PAGESIZE
-#define GNU_OUR_PAGESIZE EXEC_PAGESIZE
-#else /* no EXEC_PAGESIZE */
-#ifdef NBPG
-#define GNU_OUR_PAGESIZE (NBPG * CLSIZE)
-#ifndef CLSIZE
-#define CLSIZE 1
-#endif /* CLSIZE */
-#else /* no NBPG */
-#ifdef NBPC
-#define GNU_OUR_PAGESIZE NBPC
-#else /* no NBPC */
-#define GNU_OUR_PAGESIZE 4096 /* Just punt and use reasonable value */
-#endif /* NBPC */
-#endif /* NBPG */
-#endif /* EXEC_PAGESIZE */
-#endif /* PAGESIZE */
-#endif /* HAVE_SYSCONF */
+#endif
+#endif
+
+#ifndef GNU_OUR_PAGESIZE
+# ifdef PAGESIZE
+# define GNU_OUR_PAGESIZE PAGESIZE
+# else /* no PAGESIZE */
+# ifdef EXEC_PAGESIZE
+# define GNU_OUR_PAGESIZE EXEC_PAGESIZE
+# else /* no EXEC_PAGESIZE */
+# ifdef NBPG
+# define GNU_OUR_PAGESIZE (NBPG * CLSIZE)
+# ifndef CLSIZE
+# define CLSIZE 1
+# endif /* CLSIZE */
+# else /* no NBPG */
+# ifdef NBPC
+# define GNU_OUR_PAGESIZE NBPC
+# else /* no NBPC */
+# define GNU_OUR_PAGESIZE 4096 /* Just punt and use reasonable value */
+# endif /* NBPC */
+# endif /* NBPG */
+# endif /* EXEC_PAGESIZE */
+# endif /* PAGESIZE */
+#endif /* GNU_OUR_PAGESIZE */
int
getpagesize ()
OpenPOWER on IntegriCloud