Martin Lambers wrote on 2007-11-28:
> I attached an updated patch. It now only does the following:
> 
> - Do not provide getpagesize.h; modify gnulibs unistd.h instead.
> - Provide a getpagesize declaration if the system does not provide one
>   (needed on MinGW).

Thanks. The first part is undoubtably the right thing to do; so I'm applying
that first (with HAVE_OS_H and HAVE_SYS_PARAM_H being AC_SUBSTed - the reason
is that some people want to copy the generated unistd.h file).


2007-12-02  Martin Lambers <[EMAIL PROTECTED]>
            Bruno Haible  <[EMAIL PROTECTED]>

        * lib/getpagesize.h: Remove file.
        * lib/unistd.in.h: Include declaration of getpagesize here.
        * m4/getpagesize.m4 (gl_FUNC_GETPAGESIZE): Renamed from gl_GETPAGESIZE.
        Invoke gl_UNISTD_H_DEFAULTS. Set HAVE_GETPAGESIZE, HAVE_OS_H,
        HAVE_SYS_PARAM_H.
        * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Initialize GNULIB_GETPAGESIZE,
        HAVE_GETPAGESIZE, HAVE_OS_H, HAVE_SYS_PARAM_H.
        * modules/getpagesize (Files): Remove lib/getpagesize.h.
        (Depends-on): Add unistd.
        (configure.ac): Invoke gl_UNISTD_MODULE_INDICATOR.
        (Include): Use <unistd.h> instead of getpagesize.h.
        * modules/unistd (Makefile.am): Substitute also GNULIB_GETPAGESIZE,
        HAVE_GETPAGESIZE, HAVE_OS_H, HAVE_SYS_PARAM_H.

*** lib/unistd.in.h.orig        2007-12-02 13:33:17.000000000 +0100
--- lib/unistd.in.h     2007-12-02 13:13:42.000000000 +0100
***************
*** 180,185 ****
--- 180,240 ----
  #endif
  
  
+ #if @GNULIB_GETPAGESIZE@
+ # if [EMAIL PROTECTED]@
+ /* This is for POSIX systems.  */
+ #  if !defined getpagesize && defined _SC_PAGESIZE
+ #   if ! (defined __VMS && __VMS_VER < 70000000)
+ #    define getpagesize() sysconf (_SC_PAGESIZE)
+ #   endif
+ #  endif
+ /* This is for older VMS.  */
+ #  if !defined getpagesize && defined __VMS
+ #   ifdef __ALPHA
+ #    define getpagesize() 8192
+ #   else
+ #    define getpagesize() 512
+ #   endif
+ #  endif
+ /* This is for BeOS.  */
+ #  if !defined getpagesize && @HAVE_OS_H@
+ #   include <OS.h>
+ #   if defined B_PAGE_SIZE
+ #    define getpagesize() B_PAGE_SIZE
+ #   endif
+ #  endif
+ /* This is for AmigaOS4.0.  */
+ #  if !defined getpagesize && defined __amigaos4__
+ #   define getpagesize() 2048
+ #  endif
+ /* This is for older Unix systems.  */
+ #  if !defined getpagesize && @HAVE_SYS_PARAM_H@
+ #   include <sys/param.h>
+ #   ifdef EXEC_PAGESIZE
+ #    define getpagesize() EXEC_PAGESIZE
+ #   else
+ #    ifdef NBPG
+ #     ifndef CLSIZE
+ #      define CLSIZE 1
+ #     endif
+ #     define getpagesize() (NBPG * CLSIZE)
+ #    else
+ #     ifdef NBPC
+ #      define getpagesize() NBPC
+ #     endif
+ #    endif
+ #   endif
+ #  endif
+ # endif
+ #elif defined GNULIB_POSIXCHECK
+ # undef getpagesize
+ # define getpagesize() \
+     (GL_LINK_WARNING ("getpagesize is unportable - " \
+                       "use gnulib module getpagesize for portability"), \
+      getpagesize ())
+ #endif
+ 
+ 
  #if @GNULIB_LCHOWN@
  # if @REPLACE_LCHOWN@
  /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
*** m4/getpagesize.m4.orig      2007-12-02 13:33:17.000000000 +0100
--- m4/getpagesize.m4   2007-12-02 13:31:14.000000000 +0100
***************
*** 1,13 ****
! # getpagesize.m4 serial 6
! dnl Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
  dnl with or without modifications, as long as this notice is preserved.
  
! AC_DEFUN([gl_GETPAGESIZE],
  [
!   dnl Prerequisites of lib/getpagesize.h.
!   AC_CHECK_HEADERS_ONCE(sys/param.h)
!   AC_CHECK_HEADERS(OS.h)
!   AC_CHECK_FUNCS(getpagesize)
  ])
--- 1,22 ----
! # getpagesize.m4 serial 7
! dnl Copyright (C) 2002, 2004-2005, 2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
  dnl with or without modifications, as long as this notice is preserved.
  
! AC_DEFUN([gl_FUNC_GETPAGESIZE],
  [
!   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
!   AC_CHECK_FUNCS([getpagesize])
!   if test $ac_cv_func_getpagesize = no; then
!     HAVE_GETPAGESIZE=0
!     AC_CHECK_HEADERS([OS.h])
!     if test $ac_cv_header_OS_h = yes; then
!       HAVE_OS_H=1
!     fi
!     AC_CHECK_HEADERS([sys/param.h])
!     if test $ac_cv_header_sys_param_h = yes; then
!       HAVE_SYS_PARAM_H=1
!     fi
!   fi
  ])
*** m4/unistd_h.m4.orig 2007-12-02 13:33:17.000000000 +0100
--- m4/unistd_h.m4      2007-12-02 13:23:45.000000000 +0100
***************
*** 1,4 ****
! # unistd_h.m4 serial 9
  dnl Copyright (C) 2006-2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # unistd_h.m4 serial 10
  dnl Copyright (C) 2006-2007 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
***************
*** 38,43 ****
--- 38,44 ----
    GNULIB_FTRUNCATE=0;     AC_SUBST([GNULIB_FTRUNCATE])
    GNULIB_GETCWD=0;        AC_SUBST([GNULIB_GETCWD])
    GNULIB_GETLOGIN_R=0;    AC_SUBST([GNULIB_GETLOGIN_R])
+   GNULIB_GETPAGESIZE=0;   AC_SUBST([GNULIB_GETPAGESIZE])
    GNULIB_LCHOWN=0;        AC_SUBST([GNULIB_LCHOWN])
    GNULIB_LSEEK=0;         AC_SUBST([GNULIB_LSEEK])
    GNULIB_READLINK=0;      AC_SUBST([GNULIB_READLINK])
***************
*** 45,53 ****
--- 46,57 ----
    dnl Assume proper GNU behavior unless another module says otherwise.
    HAVE_DUP2=1;            AC_SUBST([HAVE_DUP2])
    HAVE_FTRUNCATE=1;       AC_SUBST([HAVE_FTRUNCATE])
+   HAVE_GETPAGESIZE=1;     AC_SUBST([HAVE_GETPAGESIZE])
    HAVE_READLINK=1;        AC_SUBST([HAVE_READLINK])
    HAVE_SLEEP=1;           AC_SUBST([HAVE_SLEEP])
    HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R])
+   HAVE_OS_H=0;            AC_SUBST([HAVE_OS_H])
+   HAVE_SYS_PARAM_H=0;     AC_SUBST([HAVE_SYS_PARAM_H])
    REPLACE_CHOWN=0;        AC_SUBST([REPLACE_CHOWN])
    REPLACE_FCHDIR=0;       AC_SUBST([REPLACE_FCHDIR])
    REPLACE_GETCWD=0;       AC_SUBST([REPLACE_GETCWD])
*** modules/getpagesize.orig    2007-12-02 13:33:17.000000000 +0100
--- modules/getpagesize 2007-12-02 13:19:25.000000000 +0100
***************
*** 2,19 ****
  getpagesize() function: Return memory page size.
  
  Files:
- lib/getpagesize.h
  m4/getpagesize.m4
  
  Depends-on:
  
  configure.ac:
! gl_GETPAGESIZE
  
  Makefile.am:
  
  Include:
! "getpagesize.h"
  
  License:
  LGPL
--- 2,20 ----
  getpagesize() function: Return memory page size.
  
  Files:
  m4/getpagesize.m4
  
  Depends-on:
+ unistd
  
  configure.ac:
! gl_FUNC_GETPAGESIZE
! gl_UNISTD_MODULE_INDICATOR([getpagesize])
  
  Makefile.am:
  
  Include:
! <unistd.h>
  
  License:
  LGPL
*** modules/unistd.orig 2007-12-02 13:33:17.000000000 +0100
--- modules/unistd      2007-12-02 13:24:22.000000000 +0100
***************
*** 29,43 ****
--- 29,47 ----
              -e 's|@''GNULIB_FTRUNCATE''@|$(GNULIB_FTRUNCATE)|g' \
              -e 's|@''GNULIB_GETCWD''@|$(GNULIB_GETCWD)|g' \
              -e 's|@''GNULIB_GETLOGIN_R''@|$(GNULIB_GETLOGIN_R)|g' \
+             -e 's|@''GNULIB_GETPAGESIZE''@|$(GNULIB_GETPAGESIZE)|g' \
              -e 's|@''GNULIB_LCHOWN''@|$(GNULIB_LCHOWN)|g' \
              -e 's|@''GNULIB_LSEEK''@|$(GNULIB_LSEEK)|g' \
              -e 's|@''GNULIB_READLINK''@|$(GNULIB_READLINK)|g' \
              -e 's|@''GNULIB_SLEEP''@|$(GNULIB_SLEEP)|g' \
              -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
              -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \
+             -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \
              -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \
              -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \
              -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
+             -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \
+             -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \
              -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
              -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
              -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
*** NEWS.orig   2007-12-02 13:35:06.000000000 +0100
--- NEWS        2007-12-02 13:35:00.000000000 +0100
***************
*** 6,11 ****
--- 6,14 ----
  
  Date        Modules         Changes
  
+ 2007-12-02  getpagesize     The include file is changed from "getpagesize.h"
+                             to <unistd.h>.
+ 
  2007-12-02  strcase         The include file is changed from <string.h> to
                              <strings.h>.
  



Reply via email to