path: root/mcon/U/d_getpagsz.U
diff options
authorManoj Srivastava <>2014-04-27 18:05:39 -0700
committerManoj Srivastava <>2014-04-27 18:05:39 -0700
commit7d4c02d5c9108aa413fbb0ffa1dc8a39bc5f54a1 (patch)
tree2abb9ad01d397bc1e208f57f528c1ec529761392 /mcon/U/d_getpagsz.U
parent5c913c35c09a82eead2c07534baa709a5dead3e7 (diff)
parent8f5e5726134ce5b4bd436b16f367796d851df553 (diff)
Merge branch 'upstream'
Signed-off-by: Manoj Srivastava <> Conflicts: jmake/
Diffstat (limited to 'mcon/U/d_getpagsz.U')
1 files changed, 29 insertions, 11 deletions
diff --git a/mcon/U/d_getpagsz.U b/mcon/U/d_getpagsz.U
index 6f05f85..d2b2baf 100644
--- a/mcon/U/d_getpagsz.U
+++ b/mcon/U/d_getpagsz.U
@@ -1,11 +1,11 @@
-?RCS: $Id: d_getpagsz.U 1 2006-08-24 12:32:52Z rmanfredi $
+?RCS: $Id: d_getpagsz.U 167 2013-05-08 17:58:00Z rmanfredi $
?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
-?RCS: You may redistribute only under the terms of the Artistic Licence,
+?RCS: You may redistribute only under the terms of the Artistic License,
?RCS: as specified in the README file that comes with the distribution.
?RCS: You may reuse parts of this distribution only within the terms of
-?RCS: that same Artistic Licence; a copy of which may be found at the root
+?RCS: that same Artistic License; a copy of which may be found at the root
?RCS: of the source tree for dist 4.0.
?RCS: $Log: d_getpagsz.U,v $
@@ -15,8 +15,8 @@
?RCS: Revision 3.0 1993/08/18 12:06:14 ram
?RCS: Baseline for dist 3.0 netwide release.
-?MAKE:d_getpagsz pagesize: Oldconfig Myread Inlibc cat contains +cc +ccflags \
- libs rm Findhdr
+?MAKE:d_getpagsz pagesize: Oldconfig Myread Trylink cat contains +cc +ccflags \
+ libs rm Findhdr i_unistd
?MAKE: -pick add $@ %<
?S: This variable conditionally defines HAS_GETPAGESIZE if getpagesize()
@@ -43,8 +43,21 @@
?LINT:set d_getpagsz
: see if getpagesize exists
-set getpagesize d_getpagsz
-eval $inlibc
+$cat >try.c <<EOC
+#$i_unistd I_UNISTD
+#ifdef I_UNISTD
+#include <unistd.h>
+int main(void)
+ static int ret;
+ ret |= getpagesize();
+ return ret ? 0 : 1;
+set d_getpagsz
+eval $trylink
@if pagesize || PAGESIZE_VALUE
: determine the system page size
@@ -53,8 +66,12 @@ guess=' (OK to guess)'
case "$pagesize" in
$cat >page.c <<EOP
-extern int getpagesize();
-int main()
+#include <stdio.h>
+#$i_unistd I_UNISTD
+#ifdef I_UNISTD
+#include <unistd.h>
+int main(void)
printf("%d\n", getpagesize());
@@ -79,9 +96,10 @@ EOP
if $contains PAGESIZE `./findhdr sys/param.h` >/dev/null 2>&1; then
$cat >page.c <<EOP
#include <sys/param.h>
-int main()
+#include <stdio.h>
+int main(void)
- printf("%d\n", PAGESIZE);
+ printf("%d\n", (int) PAGESIZE);
if $cc $ccflags -o page page.c $libs >/dev/null 2>&1; then