bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Patch for the getpagesize module


From: Martin Lambers
Subject: Re: Patch for the getpagesize module
Date: Mon, 10 Dec 2007 15:49:08 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

Bruno Haible wrote:
> > Do you want to replace the getpagesize function from libgcc.a on MinGW
> > with the implementation above? Or do you want the implementation above
> > only for native Windows variants that don't have getpagesize?
>
> The former. The function from libgcc.a is maybe not correct in all
> situations (think of 64-bit Windows), therefore I would use the
> replacement also on mingw.

OK, I attached a patch. 

Martin


diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index 89c6fd5..5400c86 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -181,7 +181,10 @@ extern int getlogin_r (char *name, size_t size);
 
 
 #if @GNULIB_GETPAGESIZE@
-# if address@hidden@
+# if @REPLACE_GETPAGESIZE@
+#  define getpagesize rpl_getpagesize
+extern int getpagesize (void);
+# elif address@hidden@
 /* This is for POSIX systems.  */
 #  if !defined getpagesize && defined _SC_PAGESIZE
 #   if ! (defined __VMS && __VMS_VER < 70000000)
diff --git a/m4/getpagesize.m4 b/m4/getpagesize.m4
index 37a0683..0d07a3a 100644
--- a/m4/getpagesize.m4
+++ b/m4/getpagesize.m4
@@ -7,6 +7,7 @@ dnl with or without modifications, as long as this notice is 
preserved.
 AC_DEFUN([gl_FUNC_GETPAGESIZE],
 [
   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
   AC_CHECK_FUNCS([getpagesize])
   if test $ac_cv_func_getpagesize = no; then
     HAVE_GETPAGESIZE=0
@@ -19,4 +20,10 @@ AC_DEFUN([gl_FUNC_GETPAGESIZE],
       HAVE_SYS_PARAM_H=1
     fi
   fi
+  case "$host_os" in
+    mingw*)
+      REPLACE_GETPAGESIZE=1
+      AC_LIBOBJ([getpagesize])
+      ;;
+  esac
 ])
diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4
index 91c02e7..4b8857c 100644
--- a/m4/unistd_h.m4
+++ b/m4/unistd_h.m4
@@ -55,6 +55,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   REPLACE_CHOWN=0;        AC_SUBST([REPLACE_CHOWN])
   REPLACE_FCHDIR=0;       AC_SUBST([REPLACE_FCHDIR])
   REPLACE_GETCWD=0;       AC_SUBST([REPLACE_GETCWD])
+  REPLACE_GETPAGESIZE=0;  AC_SUBST([REPLACE_GETPAGESIZE])
   REPLACE_LCHOWN=0;       AC_SUBST([REPLACE_LCHOWN])
   REPLACE_LSEEK=0;        AC_SUBST([REPLACE_LSEEK])
 ])
diff --git a/modules/getpagesize b/modules/getpagesize
index 91113b9..9cc4f37 100644
--- a/modules/getpagesize
+++ b/modules/getpagesize
@@ -2,6 +2,7 @@ Description:
 getpagesize() function: Return memory page size.
 
 Files:
+lib/getpagesize.c
 m4/getpagesize.m4
 
 Depends-on:
diff --git a/modules/unistd b/modules/unistd
index 5fb287d..4d16cf3 100644
--- a/modules/unistd
+++ b/modules/unistd
@@ -45,6 +45,7 @@ unistd.h: unistd.in.h
              -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
              -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
              -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
+             -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
              -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
              -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \
              < $(srcdir)/unistd.in.h; \




reply via email to

[Prev in Thread] Current Thread [Next in Thread]