Mercurial > hg > octave-lyh > gnulib-hg
changeset 9498:a2c450a3023c
Move declaration of getpagesize() from getpagesize.h to unistd.h.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Mon, 03 Dec 2007 12:57:05 +0100 |
parents | e5ba9ffae779 |
children | 5d136ebd8610 |
files | ChangeLog NEWS lib/getpagesize.h lib/pagealign_alloc.c lib/unistd.in.h m4/getpagesize.m4 m4/pagealign_alloc.m4 m4/unistd_h.m4 modules/getpagesize modules/unistd |
diffstat | 10 files changed, 108 insertions(+), 80 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2007-12-02 Martin Lambers <marlam@marlam.de> + Bruno Haible <bruno@clisp.org> + + * 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. + * m4/pagealign_alloc.m4 (gl_PREREQ_PAGEALIGN_ALLOC): Remove + gl_GETPAGESIZE invocation, already handled by module dependency. + * lib/pagealign_alloc.c: Don't include getpagesize.h. + 2007-12-02 Bruno Haible <bruno@clisp.org> * modules/strings-tests: New file.
--- a/NEWS +++ b/NEWS @@ -6,6 +6,9 @@ Date Modules Changes +2007-12-03 getpagesize The include file is changed from "getpagesize.h" + to <unistd.h>. + 2007-12-03 strcase The include file is changed from <string.h> to <strings.h>.
deleted file mode 100644 --- a/lib/getpagesize.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Emulate getpagesize on systems that lack it. - Copyright (C) 1999, 2000, 2004, 2005 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -#ifndef HAVE_GETPAGESIZE - -#include <unistd.h> - -#if !defined getpagesize && defined _SC_PAGESIZE -# if ! (defined __VMS && __VMS_VER < 70000000) -# define getpagesize() sysconf (_SC_PAGESIZE) -# endif -#endif - -#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 - -#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 /* not HAVE_GETPAGESIZE */
--- a/lib/pagealign_alloc.c +++ b/lib/pagealign_alloc.c @@ -32,7 +32,6 @@ #endif #include "error.h" -#include "getpagesize.h" #include "xalloc.h" #include "gettext.h"
--- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -180,6 +180,61 @@ #endif +#if @GNULIB_GETPAGESIZE@ +# if !@HAVE_GETPAGESIZE@ +/* 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
--- a/m4/getpagesize.m4 +++ b/m4/getpagesize.m4 @@ -1,13 +1,22 @@ -# getpagesize.m4 serial 6 -dnl Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. +# 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_GETPAGESIZE], +AC_DEFUN([gl_FUNC_GETPAGESIZE], [ - dnl Prerequisites of lib/getpagesize.h. - AC_CHECK_HEADERS_ONCE(sys/param.h) - AC_CHECK_HEADERS(OS.h) - AC_CHECK_FUNCS(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 ])
--- a/m4/pagealign_alloc.m4 +++ b/m4/pagealign_alloc.m4 @@ -1,4 +1,4 @@ -#serial 4 +#serial 5 dnl Copyright (C) 2005, 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, @@ -17,7 +17,6 @@ AC_DEFUN([gl_PREREQ_PAGEALIGN_ALLOC], [ AC_REQUIRE([gl_FUNC_MMAP_ANON]) - AC_REQUIRE([gl_GETPAGESIZE]) AC_CHECK_FUNCS_ONCE([posix_memalign]) AC_CHECK_HEADERS_ONCE([unistd.h]) ])
--- a/m4/unistd_h.m4 +++ b/m4/unistd_h.m4 @@ -1,4 +1,4 @@ -# unistd_h.m4 serial 9 +# 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,6 +38,7 @@ 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,9 +46,12 @@ 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])
--- a/modules/getpagesize +++ b/modules/getpagesize @@ -2,18 +2,19 @@ getpagesize() function: Return memory page size. Files: -lib/getpagesize.h m4/getpagesize.m4 Depends-on: +unistd configure.ac: -gl_GETPAGESIZE +gl_FUNC_GETPAGESIZE +gl_UNISTD_MODULE_INDICATOR([getpagesize]) Makefile.am: Include: -"getpagesize.h" +<unistd.h> License: LGPL
--- a/modules/unistd +++ b/modules/unistd @@ -29,15 +29,19 @@ -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' \