bug-gnulib
[Top][All Lists]
Advanced

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

unistd: add more declarations


From: Bruno Haible
Subject: unistd: add more declarations
Date: Mon, 19 Feb 2007 03:30:40 +0100
User-agent: KMail/1.5.4

Here is a patch so that unistd.h declares all of gnulib's replacements that
belong there.

getcwd.h and getlogin_r.h are gone. Replaced with <unistd.h>.

2007-02-18  Bruno Haible  <address@hidden>

        * lib/readlink.c: Include <unistd.h>.
        * m4/readlink.m4 (gl_FUNC_READLINK): Require gl_UNISTD_H_DEFAULTS. Set
        HAVE_READLINK.
        * modules/readlink (Depends-on): Add unistd.
        (configure.ac): Invoke gl_UNISTD_MODULE_INDICATOR.
        (Include): Add <unistd.h>.

        * lib/getlogin_r.h: Remove file.
        * lib/getlogin_r.c: Include <unistd.h> instead of getlogin_r.h.
        * m4/getlogin_r.m4 (gl_GETLOGIN_R_SUBSTITUTE): Remove macro.
        (gl_GETLOGIN_R): Inline it here. Require gl_UNISTD_H_DEFAULTS. Set
        HAVE_DECL_GETLOGIN_R.
        * modules/getlogin_r (Files): Remove lib/getlogin_r.h.
        (configure.ac): Invoke gl_UNISTD_MODULE_INDICATOR.
        (Include): Use <unistd.h> instead of getlogin_r.h.

        * lib/getcwd.h: Remove file.
        * lib/getcwd.c: Include <unistd.h> instead of getcwd.h.
        * lib/xgetcwd.c: Likewise.
        * m4/getcwd.m4 (gl_FUNC_GETCWD): Require gl_UNISTD_H_DEFAULTS. Set
        REPLACE_GETCWD. Don't define __GETCWD_PREFIX.
        * modules/getcwd (Files): Remove lib/getcwd.h.
        (Depends-on): Add unistd.
        (configure.ac): Invoke gl_UNISTD_MODULE_INDICATOR.
        (Include): Use <unistd.h> instad of getcwd.h.

        * lib/ftruncate.c: Include <unistd.h> first.
        * m4/ftruncate.m4 (gl_FUNC_FTRUNCATE): Require gl_UNISTD_H_DEFAULTS.
        Set HAVE_FTRUNCATE.
        * modules/ftruncate (Depends-on): Add unistd.
        (configure.ac): Invoke gl_UNISTD_MODULE_INDICATOR.

        * lib/fchdir.c: Include <unistd.h> first.
        * lib/dirent_.h: Test REPLACE_FCHDIR, not FCHDIR_REPLACEMENT.
        * m4/fchdir.m4 (gl_FUNC_FCHDIR): Require gl_UNISTD_H_DEFAULTS instead
        of gl_HEADER_UNISTD_DEFAULTS. Set REPLACE_FCHDIR. Don't set UNISTD_H.
        * modules/fchdir (configure.ac): Invoke gl_UNISTD_MODULE_INDICATOR.
        (Makefile.am): Substitute also REPLACE_FCHDIR into dirent.h.

        * lib/dup2.c: Include <unistd.h> first.
        * m4/dup2.m4 (gl_FUNC_DUP2): Require gl_UNISTD_H_DEFAULTS. Set
        HAVE_DUP2.
        * modules/dup2 (Depends-on): Add unistd.
        (configure.ac): Invoke gl_UNISTD_MODULE_INDICATOR.

        * lib/chown.c: Include <unistd.h> first. Undefine chown later.
        * m4/chown.m4 (gl_FUNC_CHOWN): Require gl_UNISTD_H_DEFAULTS. Set
        REPLACE_CHOWN. Don't define chown as a macro here.
        * modules/chown (Depends-on): Add unistd.
        (configure.ac): Invoke gl_UNISTD_MODULE_INDICATOR.

        * lib/unistd_.h: Test HAVE_UNISTD_H determined at configure time.
        Add definition for GL_LINK_WARNING.
        (chown, dup2): New declarations.
        (fchdir): Test REPLACE_FCHDIR, not FCHDIR_REPLACEMENT. Provide optional
        link warning.
        (ftruncate): New declaration.
        (getcwd): New declaration, taken from old getcwd.h.
        (getlogin_r): New declaration, taken from old getlogin_r.h.
        (readlink): New declaration.
        * m4/unistd_h.m4 (gl_UNISTD_H): Renamed from gl_HEADER_UNISTD. Don't
        set UNISTD_H. Inline gl_PREREQ_UNISTD. Set HAVE_UNISTD_H.
        (gl_PREREQ_UNISTD): Remove macro.
        (gl_UNISTD_MODULE_INDICATOR): New macro.
        (gl_UNISTD_H_DEFAULTS): Renamed from gl_HEADER_UNISTD_DEFAULTS. Set
        many new variables. Don't set UNISTD_H.
        * modules/unistd (Description): Change.
        (Depends-on): Add link-warning.
        (configure.ac): Update.
        (Makefile.am): Create unistd.h always. Substitute many new variables
        into it.

*** lib/chown.c 14 Jan 2007 11:32:10 -0000      1.20
--- lib/chown.c 19 Feb 2007 01:52:47 -0000
***************
*** 1,7 ****
  /* provide consistent interface to chown for systems that don't interpret
     an ID of -1 as meaning `don't change the corresponding ID'.
  
!    Copyright (C) 1997, 2004, 2005, 2006 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
--- 1,7 ----
  /* provide consistent interface to chown for systems that don't interpret
     an ID of -1 as meaning `don't change the corresponding ID'.
  
!    Copyright (C) 1997, 2004, 2005, 2006, 2007 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
***************
*** 21,38 ****
  
  #include <config.h>
  
! /* Disable the definition of chown to rpl_chown (from config.h) in this
!    file.  Otherwise, we'd get conflicting prototypes for rpl_chown on
!    most systems.  */
! #undef chown
  
  #include <stdbool.h>
  #include <sys/types.h>
  #include <sys/stat.h>
- #include <unistd.h>
  #include <fcntl.h>
  #include <errno.h>
  
  /* The results of open() in this file are not used with fchdir,
     therefore save some unnecessary work in fchdir.c.  */
  #undef open
--- 21,38 ----
  
  #include <config.h>
  
! /* Specification.  */
! #include <unistd.h>
  
  #include <stdbool.h>
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <fcntl.h>
  #include <errno.h>
  
+ /* Below we refer to the system's chown().  */
+ #undef chown
+ 
  /* The results of open() in this file are not used with fchdir,
     therefore save some unnecessary work in fchdir.c.  */
  #undef open
*** lib/dirent_.h       14 Jan 2007 11:32:10 -0000      1.1
--- lib/dirent_.h       19 Feb 2007 01:52:47 -0000
***************
*** 1,5 ****
  /* Wrapper around <dirent.h>.
!    Copyright (C) 2006 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
--- 1,5 ----
  /* Wrapper around <dirent.h>.
!    Copyright (C) 2006-2007 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
***************
*** 27,33 ****
  extern "C" {
  #endif
  
! #ifdef FCHDIR_REPLACEMENT
  # define opendir rpl_opendir
  extern DIR * opendir (const char *);
  # define closedir rpl_closedir
--- 27,33 ----
  extern "C" {
  #endif
  
! #if @REPLACE_FCHDIR@
  # define opendir rpl_opendir
  extern DIR * opendir (const char *);
  # define closedir rpl_closedir
*** lib/dup2.c  13 Sep 2006 22:38:14 -0000      1.9
--- lib/dup2.c  19 Feb 2007 01:52:47 -0000
***************
*** 1,6 ****
  /* Duplicate an open file descriptor to a specified file descriptor.
  
!    Copyright (C) 1999, 2004, 2005, 2006 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
--- 1,6 ----
  /* Duplicate an open file descriptor to a specified file descriptor.
  
!    Copyright (C) 1999, 2004, 2005, 2006, 2007 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
***************
*** 20,28 ****
  
  #include <config.h>
  
  #include <errno.h>
  #include <fcntl.h>
- #include <unistd.h>
  
  #ifndef F_DUPFD
  static int
--- 20,30 ----
  
  #include <config.h>
  
+ /* Specification.  */
+ #include <unistd.h>
+ 
  #include <errno.h>
  #include <fcntl.h>
  
  #ifndef F_DUPFD
  static int
*** lib/fchdir.c        26 Jan 2007 22:16:55 -0000      1.2
--- lib/fchdir.c        19 Feb 2007 01:52:47 -0000
***************
*** 17,28 ****
  
  #include <config.h>
  
  #include <errno.h>
  #include <fcntl.h>
  #include <stdarg.h>
  #include <stdlib.h>
  #include <string.h>
- #include <unistd.h>
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <dirent.h>
--- 17,30 ----
  
  #include <config.h>
  
+ /* Specification.  */
+ #include <unistd.h>
+ 
  #include <errno.h>
  #include <fcntl.h>
  #include <stdarg.h>
  #include <stdlib.h>
  #include <string.h>
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <dirent.h>
*** lib/ftruncate.c     13 Sep 2006 22:38:14 -0000      1.11
--- lib/ftruncate.c     19 Feb 2007 01:52:47 -0000
***************
*** 3,8 ****
--- 3,11 ----
  
  #include <config.h>
  
+ /* Specification.  */
+ #include <unistd.h>
+ 
  #include <sys/types.h>
  #include <fcntl.h>
  
***************
*** 21,27 ****
  
  #  include <sys/stat.h>
  #  include <errno.h>
- #  include <unistd.h>
  
  int
  ftruncate (int fd, off_t length)
--- 24,29 ----
*** lib/getcwd.c        3 Feb 2007 00:23:57 -0000       1.18
--- lib/getcwd.c        19 Feb 2007 01:52:47 -0000
***************
*** 18,24 ****
  
  #if !_LIBC
  # include <config.h>
! # include "getcwd.h"
  #endif
  
  #include <errno.h>
--- 18,24 ----
  
  #if !_LIBC
  # include <config.h>
! # include <unistd.h>
  #endif
  
  #include <errno.h>
*** lib/getlogin_r.c    13 Sep 2006 22:38:14 -0000      1.6
--- lib/getlogin_r.c    19 Feb 2007 01:52:47 -0000
***************
*** 1,6 ****
  /* Provide a working getlogin_r for systems which lack it.
  
!    Copyright (C) 2005, 2006 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
--- 1,6 ----
  /* Provide a working getlogin_r for systems which lack it.
  
!    Copyright (C) 2005, 2006, 2007 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
***************
*** 20,30 ****
  
  #include <config.h>
  
! #include "getlogin_r.h"
  
  #include <errno.h>
  #include <string.h>
- #include <unistd.h>
  
  #if !HAVE_DECL_GETLOGIN
  char *getlogin (void);
--- 20,30 ----
  
  #include <config.h>
  
! /* Specification.  */
! #include <unistd.h>
  
  #include <errno.h>
  #include <string.h>
  
  #if !HAVE_DECL_GETLOGIN
  char *getlogin (void);
*** lib/readlink.c      14 Sep 2006 14:18:36 -0000      1.7
--- lib/readlink.c      19 Feb 2007 01:52:47 -0000
***************
*** 1,5 ****
  /* Stub for readlink().
!    Copyright (C) 2003-2006 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
--- 1,5 ----
  /* Stub for readlink().
!    Copyright (C) 2003-2007 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
***************
*** 17,22 ****
--- 17,25 ----
  
  #include <config.h>
  
+ /* Specification.  */
+ #include <unistd.h>
+ 
  #include <errno.h>
  #include <sys/types.h>
  #include <sys/stat.h>
*** lib/unistd_.h       14 Jan 2007 11:32:10 -0000      1.3
--- lib/unistd_.h       19 Feb 2007 01:52:48 -0000
***************
*** 1,5 ****
  /* Substitute for and wrapper around <unistd.h>.
!    Copyright (C) 2006 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
--- 1,5 ----
  /* Substitute for and wrapper around <unistd.h>.
!    Copyright (C) 2004-2007 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
***************
*** 18,49 ****
  #ifndef _GL_UNISTD_H
  #define _GL_UNISTD_H
  
! #if HAVE_UNISTD_H
  # include @ABSOLUTE_UNISTD_H@
  #endif
  
  
  /* Declare overridden functions.  */
  
  #ifdef __cplusplus
  extern "C" {
  #endif
  
! #ifdef FCHDIR_REPLACEMENT
  
  /* Change the process' current working directory to the directory on which
!    the given file descriptor is open.  */
  extern int fchdir (int /*fd*/);
  
! # define close rpl_close
  extern int close (int);
! # define dup rpl_dup
  extern int dup (int);
! # define dup2 rpl_dup2
  extern int dup2 (int, int);
  
  #endif
  
  #ifdef __cplusplus
  }
  #endif
--- 18,189 ----
  #ifndef _GL_UNISTD_H
  #define _GL_UNISTD_H
  
! #if @HAVE_UNISTD_H@
  # include @ABSOLUTE_UNISTD_H@
  #endif
  
  
+ /* The definition of GL_LINK_WARNING is copied here.  */
+ 
+ 
  /* Declare overridden functions.  */
  
  #ifdef __cplusplus
  extern "C" {
  #endif
  
! 
! #if @GNULIB_CHOWN@
! # if @REPLACE_CHOWN@
! /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
!    to GID (if GID is not -1).
!    Return 0 if successful, otherwise -1 and errno set.
!    See the POSIX:2001 specification
!    <http://www.opengroup.org/susv3xsh/chown.html>.  */
! #  define chown rpl_chown
! extern int chown (const char *file, uid_t uid, gid_t gid);
! # endif
! #elif defined GNULIB_POSIXCHECK
! # undef chown
! # define chown(f,u,g) \
!     (GL_LINK_WARNING ("chown fails to follow symlinks on some systems and " \
!                       "doesn't treat a uid or gid of -1 on some systems - " \
!                       "use gnulib module chown for portability"), \
!      chown (f, u, g))
! #endif
! 
! 
! #if @GNULIB_DUP2@
! # if address@hidden@
! /* Copy the file descriptor OLDFD into file descriptor NEWFD.  Do nothing if
!    NEWFD = OLDFD, otherwise close NEWFD first if it is open.
!    Return 0 if successful, otherwise -1 and errno set.
!    See the POSIX:2001 specification
!    <http://www.opengroup.org/susv3xsh/dup2.html>.  */
! extern int dup2 (int oldfd, int newfd);
! # endif
! #elif defined GNULIB_POSIXCHECK
! # undef dup2
! # define dup2(o,n) \
!     (GL_LINK_WARNING ("dup2 is unportable - " \
!                       "use gnulib module dup2 for portability"), \
!      dup2 (o, n))
! #endif
! 
! 
! #if @GNULIB_FCHDIR@
! # if @REPLACE_FCHDIR@
  
  /* Change the process' current working directory to the directory on which
!    the given file descriptor is open.
!    Return 0 if successful, otherwise -1 and errno set.
!    See the POSIX:2001 specification
!    <http://www.opengroup.org/susv3xsh/fchdir.html>.  */
  extern int fchdir (int /*fd*/);
  
! #  define close rpl_close
  extern int close (int);
! #  define dup rpl_dup
  extern int dup (int);
! #  define dup2 rpl_dup2
  extern int dup2 (int, int);
  
+ # endif
+ #elif defined GNULIB_POSIXCHECK
+ # undef fchdir
+ # define fchdir(f) \
+     (GL_LINK_WARNING ("fchdir is unportable - " \
+                       "use gnulib module fchdir for portability"), \
+      fchdir (f))
+ #endif
+ 
+ 
+ #if @GNULIB_FTRUNCATE@
+ # if address@hidden@
+ /* Change the size of the file to which FD is opened to become equal to 
LENGTH.
+    Return 0 if successful, otherwise -1 and errno set.
+    See the POSIX:2001 specification
+    <http://www.opengroup.org/susv3xsh/ftruncate.html>.  */
+ extern int ftruncate (int fd, off_t length);
+ # endif
+ #elif defined GNULIB_POSIXCHECK
+ # undef ftruncate
+ # define ftruncate(f,l) \
+     (GL_LINK_WARNING ("ftruncate is unportable - " \
+                       "use gnulib module ftruncate for portability"), \
+      ftruncate (f, l))
+ #endif
+ 
+ 
+ #if @GNULIB_GETCWD@
+ /* Include the headers that might declare getcwd so that they will not
+    cause confusion if included after this file.  */
+ # include <stdlib.h>
+ # if @REPLACE_GETCWD@
+ /* Get the name of the current working directory, and put it in SIZE bytes
+    of BUF.
+    Return BUF if successful, or NULL if the directory couldn't be determined
+    or SIZE was too small.
+    See the POSIX:2001 specification
+    <http://www.opengroup.org/susv3xsh/getcwd.html>.
+    Additionally, the gnulib module 'getcwd' guarantees the following GNU
+    extension: If BUF is NULL, an array is allocated with 'malloc'; the array
+    is SIZE bytes long, unless SIZE == 0, in which case it is as big as
+    necessary.  */
+ #  define getcwd rpl_getcwd
+ extern char * getcwd (char *buf, size_t size);
+ # endif
+ #elif defined GNULIB_POSIXCHECK
+ # undef getcwd
+ # define getcwd(b,s) \
+     (GL_LINK_WARNING ("getcwd is unportable - " \
+                       "use gnulib module getcwd for portability"), \
+      getcwd (b, s))
  #endif
  
+ 
+ #if @GNULIB_GETLOGIN_R@
+ /* Copies the user's login name to NAME.
+    The array pointed to by NAME has room for SIZE bytes.
+ 
+    Returns 0 if successful.  Upon error, an error number is returned, or -1 in
+    the case that the login name cannot be found but no specific error is
+    provided (this case is hopefully rare but is left open by the POSIX spec).
+ 
+    See <http://www.opengroup.org/susv3xsh/getlogin.html>.
+  */
+ # if address@hidden@
+ #  include <stddef.h>
+ extern int getlogin_r (char *name, size_t size);
+ # endif
+ #elif defined GNULIB_POSIXCHECK
+ # undef getlogin_r
+ # define getlogin_r(n,s) \
+     (GL_LINK_WARNING ("getlogin_r is unportable - " \
+                       "use gnulib module getlogin_r for portability"), \
+      getlogin_r (n, s))
+ #endif
+ 
+ 
+ #if @GNULIB_READLINK@
+ /* Read the contents of the symbolic link FILE and place the first BUFSIZE
+    bytes of it into BUF.  Return the number of bytes placed into BUF if
+    successful, otherwise -1 and errno set.
+    See the POSIX:2001 specification
+    <http://www.opengroup.org/susv3xsh/readlink.html>.  */
+ # if address@hidden@
+ #  include <stddef.h>
+ extern int readlink (const char *file, char *buf, size_t bufsize);
+ # endif
+ #elif defined GNULIB_POSIXCHECK
+ # undef readlink
+ # define readlink(f,b,s) \
+     (GL_LINK_WARNING ("readlink is unportable - " \
+                       "use gnulib module readlink for portability"), \
+      readlink (f, b, s))
+ #endif
+ 
+ 
  #ifdef __cplusplus
  }
  #endif
*** lib/xgetcwd.c       13 Sep 2006 22:38:14 -0000      1.21
--- lib/xgetcwd.c       19 Feb 2007 01:52:48 -0000
***************
*** 1,6 ****
  /* xgetcwd.c -- return current directory with unlimited length
  
!    Copyright (C) 2001, 2003, 2004, 2006 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
--- 1,6 ----
  /* xgetcwd.c -- return current directory with unlimited length
  
!    Copyright (C) 2001, 2003, 2004, 2006, 2007 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
***************
*** 23,30 ****
  #include "xgetcwd.h"
  
  #include <errno.h>
  
- #include "getcwd.h"
  #include "xalloc.h"
  
  /* Return the current directory, newly allocated.
--- 23,30 ----
  #include "xgetcwd.h"
  
  #include <errno.h>
+ #include <unistd.h>
  
  #include "xalloc.h"
  
  /* Return the current directory, newly allocated.
*** m4/chown.m4 23 Sep 2005 04:15:13 -0000      1.21
--- m4/chown.m4 19 Feb 2007 01:52:48 -0000
***************
*** 1,7 ****
! #serial 16
  # Determine whether we need the chown wrapper.
  
! dnl Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 Free
  dnl Software Foundation, Inc.
  
  dnl This file is free software; the Free Software Foundation
--- 1,7 ----
! #serial 17
  # Determine whether we need the chown wrapper.
  
! dnl Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2007 Free
  dnl Software Foundation, Inc.
  
  dnl This file is free software; the Free Software Foundation
***************
*** 16,21 ****
--- 16,22 ----
  
  AC_DEFUN([gl_FUNC_CHOWN],
  [
+   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
    AC_REQUIRE([AC_TYPE_UID_T])
    AC_REQUIRE([AC_FUNC_CHOWN])
    AC_REQUIRE([gl_FUNC_CHOWN_FOLLOWS_SYMLINK])
***************
*** 29,37 ****
    if test $ac_cv_func_chown_works$gl_cv_func_chown_follows_symlink = yesyes; 
then
      : # no wrapper needed
    else
      AC_LIBOBJ(chown)
-     AC_DEFINE(chown, rpl_chown,
-       [Define to rpl_chown if the replacement function should be used.])
      gl_PREREQ_CHOWN
    fi
  ])
--- 30,37 ----
    if test $ac_cv_func_chown_works$gl_cv_func_chown_follows_symlink = yesyes; 
then
      : # no wrapper needed
    else
+     REPLACE_CHOWN=1
      AC_LIBOBJ(chown)
      gl_PREREQ_CHOWN
    fi
  ])
*** m4/dup2.m4  23 Sep 2005 04:15:13 -0000      1.4
--- m4/dup2.m4  19 Feb 2007 01:52:48 -0000
***************
*** 1,10 ****
! #serial 4
! dnl Copyright (C) 2002, 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_FUNC_DUP2],
  [
!   AC_REPLACE_FUNCS(dup2)
  ])
--- 1,15 ----
! #serial 5
! dnl Copyright (C) 2002, 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_DUP2],
  [
!   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
!   AC_CHECK_FUNCS_ONCE([dup2])
!   if test $ac_cv_func_dup2 = no; then
!     HAVE_DUP2=0
!     AC_LIBOBJ([dup2])
!   fi
  ])
*** m4/fchdir.m4        28 Jan 2007 16:10:39 -0000      1.2
--- m4/fchdir.m4        19 Feb 2007 01:52:48 -0000
***************
*** 1,4 ****
! # fchdir.m4 serial 2
  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 ----
! # fchdir.m4 serial 3
  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,
***************
*** 6,14 ****
  
  AC_DEFUN([gl_FUNC_FCHDIR],
  [
!   AC_REQUIRE([gl_HEADER_UNISTD_DEFAULTS])
    AC_CHECK_FUNCS_ONCE([fchdir])
    if test $ac_cv_func_fchdir = no; then
      AC_LIBOBJ([fchdir])
      gl_PREREQ_FCHDIR
      AC_DEFINE([FCHDIR_REPLACEMENT], 1,
--- 6,15 ----
  
  AC_DEFUN([gl_FUNC_FCHDIR],
  [
!   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
    AC_CHECK_FUNCS_ONCE([fchdir])
    if test $ac_cv_func_fchdir = no; then
+     REPLACE_FCHDIR=1
      AC_LIBOBJ([fchdir])
      gl_PREREQ_FCHDIR
      AC_DEFINE([FCHDIR_REPLACEMENT], 1,
***************
*** 16,22 ****
      gl_ABSOLUTE_HEADER([dirent.h])
      ABSOLUTE_DIRENT_H=\"$gl_cv_absolute_dirent_h\"
      DIRENT_H='dirent.h'
-     UNISTD_H='unistd.h'
    else
      DIRENT_H=
    fi
--- 17,22 ----
*** m4/ftruncate.m4     5 Jul 2006 23:35:19 -0000       1.11
--- m4/ftruncate.m4     19 Feb 2007 01:52:48 -0000
***************
*** 1,8 ****
! #serial 10
  
  # See if we need to emulate a missing ftruncate function using fcntl or 
chsize.
  
! # Copyright (C) 2000, 2001, 2003-2006 Free Software Foundation, Inc.
  # This file is free software; the Free Software Foundation
  # gives unlimited permission to copy and/or distribute it,
  # with or without modifications, as long as this notice is preserved.
--- 1,8 ----
! #serial 11
  
  # See if we need to emulate a missing ftruncate function using fcntl or 
chsize.
  
! # Copyright (C) 2000, 2001, 2003-2007 Free Software Foundation, Inc.
  # This file is free software; the Free Software Foundation
  # gives unlimited permission to copy and/or distribute it,
  # with or without modifications, as long as this notice is preserved.
***************
*** 12,19 ****
  
  AC_DEFUN([gl_FUNC_FTRUNCATE],
  [
!   AC_REPLACE_FUNCS(ftruncate)
    if test $ac_cv_func_ftruncate = no; then
      gl_PREREQ_FTRUNCATE
      # If someone lacks ftruncate, make configure fail, and request
      # a bug report to inform us about it.
--- 12,22 ----
  
  AC_DEFUN([gl_FUNC_FTRUNCATE],
  [
!   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
!   AC_CHECK_FUNCS_ONCE([ftruncate])
    if test $ac_cv_func_ftruncate = no; then
+     HAVE_FTRUNCATE=0
+     AC_LIBOBJ([ftruncate])
      gl_PREREQ_FTRUNCATE
      # If someone lacks ftruncate, make configure fail, and request
      # a bug report to inform us about it.
*** m4/getcwd.m4        21 Aug 2006 21:46:31 -0000      1.13
--- m4/getcwd.m4        19 Feb 2007 01:52:48 -0000
***************
*** 1,6 ****
  # getcwd.m4 - check for working getcwd that is compatible with glibc
  
! # Copyright (C) 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
  # This file is free software; the Free Software Foundation
  # gives unlimited permission to copy and/or distribute it,
  # with or without modifications, as long as this notice is preserved.
--- 1,6 ----
  # getcwd.m4 - check for working getcwd that is compatible with glibc
  
! # Copyright (C) 2001, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, 
Inc.
  # This file is free software; the Free Software Foundation
  # gives unlimited permission to copy and/or distribute it,
  # with or without modifications, as long as this notice is preserved.
***************
*** 36,41 ****
--- 36,42 ----
  
  AC_DEFUN([gl_FUNC_GETCWD],
  [
+   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
    AC_REQUIRE([gl_FUNC_GETCWD_NULL])
  
    gl_abort_bug=no
***************
*** 48,56 ****
    case $gl_cv_func_getcwd_null,$gl_cv_func_getcwd_path_max,$gl_abort_bug in
    yes,yes,no) ;;
    *)
      AC_LIBOBJ([getcwd])
-     AC_DEFINE([__GETCWD_PREFIX], [[rpl_]],
-       [Define to rpl_ if the getcwd replacement function should be used.])
      gl_PREREQ_GETCWD;;
    esac
  ])
--- 49,56 ----
    case $gl_cv_func_getcwd_null,$gl_cv_func_getcwd_path_max,$gl_abort_bug in
    yes,yes,no) ;;
    *)
+     REPLACE_GETCWD=1
      AC_LIBOBJ([getcwd])
      gl_PREREQ_GETCWD;;
    esac
  ])
*** m4/getlogin_r.m4    22 Aug 2006 17:15:28 -0000      1.4
--- m4/getlogin_r.m4    19 Feb 2007 01:52:48 -0000
***************
*** 1,6 ****
! #serial 3
  
! # Copyright (C) 2005, 2006 Free Software Foundation, Inc.
  #
  # This file is free software; the Free Software Foundation
  # gives unlimited permission to copy and/or distribute it,
--- 1,6 ----
! #serial 4
  
! # Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
  #
  # This file is free software; the Free Software Foundation
  # gives unlimited permission to copy and/or distribute it,
***************
*** 11,33 ****
  dnl Provide getlogin_r when the system lacks it.
  dnl
  
- AC_DEFUN([gl_GETLOGIN_R_SUBSTITUTE],
- [
-   gl_PREREQ_GETLOGIN_R
-   AC_LIBOBJ([getlogin_r])
- ])
- 
  AC_DEFUN([gl_GETLOGIN_R],
  [
!   AC_REPLACE_FUNCS([getlogin_r])
    if test $ac_cv_func_getlogin_r = no; then
!     gl_GETLOGIN_R_SUBSTITUTE
    fi
  ])
  
  AC_DEFUN([gl_PREREQ_GETLOGIN_R],
  [
-   AC_CHECK_HEADERS_ONCE([unistd.h])
    AC_CHECK_DECLS_ONCE([getlogin])
    AC_CHECK_DECLS_ONCE([getlogin_r])
  ])
--- 11,33 ----
  dnl Provide getlogin_r when the system lacks it.
  dnl
  
  AC_DEFUN([gl_GETLOGIN_R],
  [
!   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
!   AC_CHECK_FUNCS_ONCE([getlogin_r])
    if test $ac_cv_func_getlogin_r = no; then
!     AC_LIBOBJ([getlogin_r])
!     gl_PREREQ_GETLOGIN_R
!     if test $ac_cv_have_decl_getlogin_r = yes; then
!       HAVE_DECL_GETLOGIN_R=1
!     else
!       HAVE_DECL_GETLOGIN_R=0
!     fi
    fi
  ])
  
  AC_DEFUN([gl_PREREQ_GETLOGIN_R],
  [
    AC_CHECK_DECLS_ONCE([getlogin])
    AC_CHECK_DECLS_ONCE([getlogin_r])
  ])
*** m4/readlink.m4      18 Jan 2005 13:07:56 -0000      1.3
--- m4/readlink.m4      19 Feb 2007 01:52:48 -0000
***************
*** 1,13 ****
! # readlink.m4 serial 2
! dnl Copyright (C) 2003 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_READLINK],
  [
    AC_CHECK_FUNCS(readlink)
    if test $ac_cv_func_readlink = no; then
      AC_LIBOBJ(readlink)
      gl_PREREQ_READLINK
    fi
--- 1,15 ----
! # readlink.m4 serial 3
! dnl Copyright (C) 2003, 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_READLINK],
  [
+   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
    AC_CHECK_FUNCS(readlink)
    if test $ac_cv_func_readlink = no; then
+     HAVE_READLINK=0
      AC_LIBOBJ(readlink)
      gl_PREREQ_READLINK
    fi
*** m4/unistd_h.m4      28 Jan 2007 16:10:39 -0000      1.4
--- m4/unistd_h.m4      19 Feb 2007 01:52:48 -0000
***************
*** 1,39 ****
! # unistd_h.m4 serial 4
  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,
  dnl with or without modifications, as long as this notice is preserved.
  
! dnl Written by Simon Josefsson
  
! AC_DEFUN([gl_HEADER_UNISTD],
  [
    dnl Use AC_REQUIRE here, so that the default behavior below is expanded
    dnl once only, before all statements that occur in other macros.
!   AC_REQUIRE([gl_HEADER_UNISTD_DEFAULTS])
  
-   AC_CHECK_HEADERS([unistd.h], [], [
-     UNISTD_H='unistd.h'
-   ])
-   dnl This module decides to build unistd.h if it is missing.
-   dnl The fchdir module decides to build unistd.h if fchdir() is missing.
-   dnl Therefore check for the prerequisites of lib/unistd.h always.
-   gl_PREREQ_UNISTD
- ])
- 
- dnl Prerequisites of lib/unistd.h.
- AC_DEFUN([gl_PREREQ_UNISTD],
- [
    AC_CHECK_HEADERS_ONCE([unistd.h])
    if test $ac_cv_header_unistd_h = yes; then
      gl_ABSOLUTE_HEADER([unistd.h])
      ABSOLUTE_UNISTD_H=\"$gl_cv_absolute_unistd_h\"
    fi
    AC_SUBST([ABSOLUTE_UNISTD_H])
  ])
  
! AC_DEFUN([gl_HEADER_UNISTD_DEFAULTS],
  [
!   UNISTD_H=
!   AC_SUBST(UNISTD_H)
  ])
--- 1,51 ----
! # unistd_h.m4 serial 5
  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,
  dnl with or without modifications, as long as this notice is preserved.
  
! dnl Written by Simon Josefsson, Bruno Haible.
  
! AC_DEFUN([gl_UNISTD_H],
  [
    dnl Use AC_REQUIRE here, so that the default behavior below is expanded
    dnl once only, before all statements that occur in other macros.
!   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
  
    AC_CHECK_HEADERS_ONCE([unistd.h])
    if test $ac_cv_header_unistd_h = yes; then
+     HAVE_UNISTD_H=1
      gl_ABSOLUTE_HEADER([unistd.h])
      ABSOLUTE_UNISTD_H=\"$gl_cv_absolute_unistd_h\"
+   else
+     HAVE_UNISTD_H=0
    fi
+   AC_SUBST([HAVE_UNISTD_H])
    AC_SUBST([ABSOLUTE_UNISTD_H])
  ])
  
! AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
! [
!   dnl Use AC_REQUIRE here, so that the default settings are expanded once 
only.
!   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
!   
GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
! ])
! 
! AC_DEFUN([gl_UNISTD_H_DEFAULTS],
  [
!   GNULIB_CHOWN=0;         AC_SUBST([GNULIB_CHOWN])
!   GNULIB_DUP2=0;          AC_SUBST([GNULIB_DUP2])
!   GNULIB_FCHDIR=0;        AC_SUBST([GNULIB_FCHDIR])
!   GNULIB_FTRUNCATE=0;     AC_SUBST([GNULIB_FTRUNCATE])
!   GNULIB_GETCWD=0;        AC_SUBST([GNULIB_GETCWD])
!   GNULIB_GETLOGIN_R=0;    AC_SUBST([GNULIB_GETLOGIN_R])
!   GNULIB_READLINK=0;      AC_SUBST([GNULIB_READLINK])
!   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_READLINK=1;        AC_SUBST([HAVE_READLINK])
!   HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R])
!   REPLACE_CHOWN=0;        AC_SUBST([REPLACE_CHOWN])
!   REPLACE_FCHDIR=0;       AC_SUBST([REPLACE_FCHDIR])
!   REPLACE_GETCWD=0;       AC_SUBST([REPLACE_GETCWD])
  ])
*** modules/chown       27 Oct 2006 20:46:43 -0000      1.10
--- modules/chown       19 Feb 2007 01:52:48 -0000
***************
*** 7,16 ****
--- 7,18 ----
  m4/chown.m4
  
  Depends-on:
+ unistd
  sys_stat
  
  configure.ac:
  gl_FUNC_CHOWN
+ gl_UNISTD_MODULE_INDICATOR([chown])
  
  Makefile.am:
  
*** modules/dup2        13 Oct 2006 12:40:23 -0000      1.7
--- modules/dup2        19 Feb 2007 01:52:48 -0000
***************
*** 6,14 ****
--- 6,16 ----
  m4/dup2.m4
  
  Depends-on:
+ unistd
  
  configure.ac:
  gl_FUNC_DUP2
+ gl_UNISTD_MODULE_INDICATOR([dup2])
  
  Makefile.am:
  
*** modules/fchdir      18 Feb 2007 22:44:21 -0000      1.4
--- modules/fchdir      19 Feb 2007 01:52:48 -0000
***************
*** 17,22 ****
--- 17,23 ----
  
  configure.ac:
  gl_FUNC_FCHDIR
+ gl_UNISTD_MODULE_INDICATOR([fchdir])
  
  Makefile.am:
  BUILT_SOURCES += $(DIRENT_H)
***************
*** 27,32 ****
--- 28,34 ----
        rm -f address@hidden $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''ABSOLUTE_DIRENT_H''@|$(ABSOLUTE_DIRENT_H)|g' \
+             -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
              < $(srcdir)/dirent_.h; \
        } > address@hidden
        mv address@hidden $@
*** modules/ftruncate   13 Oct 2006 12:40:23 -0000      1.7
--- modules/ftruncate   19 Feb 2007 01:52:48 -0000
***************
*** 6,14 ****
--- 6,16 ----
  m4/ftruncate.m4
  
  Depends-on:
+ unistd
  
  configure.ac:
  gl_FUNC_FTRUNCATE
+ gl_UNISTD_MODULE_INDICATOR([ftruncate])
  
  Makefile.am:
  
*** modules/getcwd      13 Oct 2006 12:40:23 -0000      1.12
--- modules/getcwd      19 Feb 2007 01:52:48 -0000
***************
*** 2,8 ****
  Return the current working directory.
  
  Files:
- lib/getcwd.h
  lib/getcwd.c
  m4/getcwd-abort-bug.m4
  m4/getcwd-path-max.m4
--- 2,7 ----
***************
*** 13,26 ****
  d-ino
  extensions
  stdbool
  
  configure.ac:
  gl_FUNC_GETCWD
  
  Makefile.am:
  
  Include:
! "getcwd.h"
  
  License:
  GPL
--- 12,27 ----
  d-ino
  extensions
  stdbool
+ unistd
  
  configure.ac:
  gl_FUNC_GETCWD
+ gl_UNISTD_MODULE_INDICATOR([getcwd])
  
  Makefile.am:
  
  Include:
! <unistd.h>
  
  License:
  GPL
*** modules/getlogin_r  13 Oct 2006 12:40:23 -0000      1.7
--- modules/getlogin_r  19 Feb 2007 01:52:48 -0000
***************
*** 2,8 ****
  getlogin_r() function: Get user name to a buffer allocated by the caller.
  
  Files:
- lib/getlogin_r.h
  lib/getlogin_r.c
  m4/getlogin_r.m4
  
--- 2,7 ----
***************
*** 12,22 ****
  
  configure.ac:
  gl_GETLOGIN_R
  
  Makefile.am:
  
  Include:
! "getlogin_r.h"
  
  License:
  LGPL
--- 11,22 ----
  
  configure.ac:
  gl_GETLOGIN_R
+ gl_UNISTD_MODULE_INDICATOR([getlogin_r])
  
  Makefile.am:
  
  Include:
! <unistd.h>
  
  License:
  LGPL
*** modules/readlink    13 Oct 2006 12:40:23 -0000      1.5
--- modules/readlink    19 Feb 2007 01:52:48 -0000
***************
*** 6,18 ****
--- 6,21 ----
  m4/readlink.m4
  
  Depends-on:
+ unistd
  
  configure.ac:
  gl_FUNC_READLINK
+ gl_UNISTD_MODULE_INDICATOR([readlink])
  
  Makefile.am:
  
  Include:
+ <unistd.h>
  
  License:
  LGPL
*** modules/unistd      14 Jan 2007 20:31:35 -0000      1.6
--- modules/unistd      19 Feb 2007 01:52:48 -0000
***************
*** 1,5 ****
  Description:
! A <unistd.h> for systems lacking it.
  
  Files:
  m4/unistd_h.m4
--- 1,5 ----
  Description:
! A GNU-like <unistd.h>.
  
  Files:
  m4/unistd_h.m4
***************
*** 7,25 ****
  
  Depends-on:
  absolute-header
  
  configure.ac:
! gl_HEADER_UNISTD
  
  Makefile.am:
! BUILT_SOURCES += $(UNISTD_H)
  
  # We need the following in order to create an empty placeholder for
  # <unistd.h> when the system doesn't have one.
  unistd.h: unistd_.h
        rm -f address@hidden $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
!         sed -e 's|@''ABSOLUTE_UNISTD_H''@|$(ABSOLUTE_UNISTD_H)|g' \
              < $(srcdir)/unistd_.h; \
        } > address@hidden
        mv address@hidden $@
--- 7,41 ----
  
  Depends-on:
  absolute-header
+ link-warning
  
  configure.ac:
! gl_UNISTD_H
  
  Makefile.am:
! BUILT_SOURCES += unistd.h
  
  # We need the following in order to create an empty placeholder for
  # <unistd.h> when the system doesn't have one.
  unistd.h: unistd_.h
        rm -f address@hidden $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
!         sed -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \
!             -e 's|@''ABSOLUTE_UNISTD_H''@|$(ABSOLUTE_UNISTD_H)|g' \
!             -e 's|@''GNULIB_CHOWN''@|$(GNULIB_CHOWN)|g' \
!             -e 's|@''GNULIB_DUP2''@|$(GNULIB_DUP2)|g' \
!             -e 's|@''GNULIB_FCHDIR''@|$(GNULIB_FCHDIR)|g' \
!             -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_READLINK''@|$(GNULIB_READLINK)|g' \
!             -e 's|@''HAVE_DUP2''@|$(HAVE_DUP2)|g' \
!             -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \
!             -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \
!             -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
!             -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \
!             -e 's|@''REPLACE_FCHDIR''@|$(REPLACE_FCHDIR)|g' \
!             -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
              < $(srcdir)/unistd_.h; \
        } > address@hidden
        mv address@hidden $@





reply via email to

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