bug-gnulib
[Top][All Lists]
Advanced

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

simplification of unistd.h creation


From: Bruno Haible
Subject: simplification of unistd.h creation
Date: Sun, 28 Jan 2007 17:12:08 +0100 (MET)
User-agent: KMail/1.5.4

Hi,

The AC_REQUIRE technique just developed for <string.h> can also be used to
simplify the autoconf macros for creating the <unistd.h> replacement. I
committed this.

2007-01-28  Bruno Haible  <address@hidden>

        * m4/unistd_h.m4 (gl_HEADER_UNISTD_DEFAULTS): New macro.
        (gl_HEADER_UNISTD): Require it. Don't set UNISTD_H to empty here.
        * m4/fchdir.m4 (gl_FUNC_FCHDIR): Require gl_HEADER_UNISTD_DEFAULTS.
        Set UNISTD_H instead of UNISTD_H2.
        * modules/fchdir (BUILT_SOURCES): Drop $(UNISTD_H2).

*** m4/unistd_h.m4      14 Jan 2007 11:32:10 -0000      1.3
--- m4/unistd_h.m4      28 Jan 2007 16:07:09 -0000
***************
*** 1,5 ****
! # unistd_h.m4 serial 3
! dnl Copyright (C) 2006 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.
--- 1,5 ----
! # 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.
***************
*** 8,19 ****
  
  AC_DEFUN([gl_HEADER_UNISTD],
  [
!   AC_CHECK_HEADERS([unistd.h], [
!     UNISTD_H=''
!   ], [
      UNISTD_H='unistd.h'
    ])
-   AC_SUBST(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.
--- 8,20 ----
  
  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.
***************
*** 30,32 ****
--- 31,39 ----
    fi
    AC_SUBST([ABSOLUTE_UNISTD_H])
  ])
+ 
+ AC_DEFUN([gl_HEADER_UNISTD_DEFAULTS],
+ [
+   UNISTD_H=
+   AC_SUBST(UNISTD_H)
+ ])
*** m4/fchdir.m4        14 Jan 2007 11:32:10 -0000      1.1
--- m4/fchdir.m4        28 Jan 2007 16:07:09 -0000
***************
*** 1,11 ****
! # fchdir.m4 serial 1
! dnl Copyright (C) 2006 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_FCHDIR],
  [
    AC_CHECK_FUNCS_ONCE([fchdir])
    if test $ac_cv_func_fchdir = no; then
      AC_LIBOBJ([fchdir])
--- 1,12 ----
! # 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,
  dnl with or without modifications, as long as this notice is preserved.
  
  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])
***************
*** 15,28 ****
      gl_ABSOLUTE_HEADER([dirent.h])
      ABSOLUTE_DIRENT_H=\"$gl_cv_absolute_dirent_h\"
      DIRENT_H='dirent.h'
!     UNISTD_H2='unistd.h'
    else
      DIRENT_H=
-     UNISTD_H2=
    fi
    AC_SUBST([ABSOLUTE_DIRENT_H])
    AC_SUBST([DIRENT_H])
-   AC_SUBST([UNISTD_H2])
  ])
  
  # Prerequisites of lib/fchdir.c.
--- 16,27 ----
      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
    AC_SUBST([ABSOLUTE_DIRENT_H])
    AC_SUBST([DIRENT_H])
  ])
  
  # Prerequisites of lib/fchdir.c.
*** modules/fchdir      14 Jan 2007 20:31:35 -0000      1.2
--- modules/fchdir      28 Jan 2007 16:07:09 -0000
***************
*** 18,24 ****
  gl_FUNC_FCHDIR
  
  Makefile.am:
! BUILT_SOURCES += $(DIRENT_H) $(UNISTD_H2)
  
  # We need the following in order to create <dirent.h> when the system
  # doesn't have one that works with the given compiler.
--- 18,24 ----
  gl_FUNC_FCHDIR
  
  Makefile.am:
! BUILT_SOURCES += $(DIRENT_H)
  
  # We need the following in order to create <dirent.h> when the system
  # doesn't have one that works with the given compiler.





reply via email to

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