Make the generated sys/stat.h more self-contained.
authorBruno Haible <bruno@clisp.org>
Tue, 1 May 2007 18:14:44 +0000 (18:14 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 1 May 2007 18:14:44 +0000 (18:14 +0000)
ChangeLog
lib/sys_stat_.h
m4/sys_stat_h.m4
modules/sys_stat

index 7149ef4..a84e798 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2007-05-01  Bruno Haible  <bruno@clisp.org>
 
+       * lib/sys_stat_.h: Test HAVE_LSTAT, HAVE_DECL_MKDIR, HAVE_IO_H at
+       configure time.
+       * m4/sys_stat_h.m4 (gl_HEADER_SYS_STAT_H): Substitute HAVE_LSTAT,
+       HAVE_DECL_MKDIR, HAVE_IO_H via AC_SUBST.
+       * modules/sys_stat (Makefile.am): Substitute their values into
+       sys/stat.h.
+
+2007-05-01  Bruno Haible  <bruno@clisp.org>
+
        * lib/glob_.h: Test HAVE_SYS_CDEFS_H at configure time.
        * m4/glob.m4 (gl_PREREQ_GLOB): Substitute HAVE_SYS_CDEFS_H via AC_SUBST.
        * modules/glob (Makefile.am): Put HAVE_SYS_CDEFS_H value into glob.h.
 
        * m4/isc-posix.m4: New file.
 
-1998-05-10  Jim Meyering  <meyering@ascend.com>
+1998-05-10  Jim Meyering  <meyering@ascend.com>
\ No newline at end of file
index de3add5..10d5b4c 100644 (file)
 
 /* mingw does not support symlinks, therefore it does not have lstat.  But
    without links, stat does just fine.  */
-#if ! HAVE_LSTAT
+#if ! @HAVE_LSTAT@
 # define lstat stat
 #endif
 
 /* mingw's _mkdir() function has 1 argument, but we pass 2 arguments.
    Additionally, it declares _mkdir (and depending on compile flags, an
    alias mkdir), only in the nonstandard io.h.  */
-#if ! HAVE_DECL_MKDIR && HAVE_IO_H
+#if ! @HAVE_DECL_MKDIR@ && @HAVE_IO_H@
 # include <io.h>
 
 static inline int
index 9ca1311..2283138 100644 (file)
@@ -1,5 +1,5 @@
-# sys_stat_h.m4 serial 4   -*- Autoconf -*-
-dnl Copyright (C) 2006 Free Software Foundation, Inc.
+# sys_stat_h.m4 serial 5   -*- Autoconf -*-
+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.
@@ -12,6 +12,12 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H],
   dnl Check for lstat.  Systems that lack it (mingw) also lack symlinks, so
   dnl stat is a good replacement.
   AC_CHECK_FUNCS_ONCE([lstat])
+  if test $ac_cv_func_lstat = yes; then
+    HAVE_LSTAT=1
+  else
+    HAVE_LSTAT=0
+  fi
+  AC_SUBST([HAVE_LSTAT])
 
   dnl Check for mkdir.  Mingw has _mkdir(name) in the nonstandard <io.h>
   dnl instead.
@@ -19,6 +25,18 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H],
     [],
     [AC_CHECK_HEADERS([io.h])],
     [#include <sys/stat.h>])
+  if test $ac_cv_have_decl_mkdir = yes; then
+    HAVE_DECL_MKDIR=1
+  else
+    HAVE_DECL_MKDIR=0
+  fi
+  AC_SUBST([HAVE_DECL_MKDIR])
+  if test "$ac_cv_header_io_h" = yes; then
+    HAVE_IO_H=1
+  else
+    HAVE_IO_H=0
+  fi
+  AC_SUBST([HAVE_IO_H])
   AC_REQUIRE([AC_C_INLINE])
 
   dnl Check for broken stat macros.
index a37456b..fcf4c8a 100644 (file)
@@ -22,6 +22,9 @@ sys/stat.h: sys_stat_.h
        rm -f $@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's|@''ABSOLUTE_SYS_STAT_H''@|$(ABSOLUTE_SYS_STAT_H)|g' \
+             -e 's|@''HAVE_IO_H''@|$(HAVE_IO_H)|g' \
+             -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \
+             -e 's|@''HAVE_DECL_MKDIR''@|$(HAVE_DECL_MKDIR)|g' \
              < $(srcdir)/sys_stat_.h; \
        } > $@-t
        mv $@-t $@