<sys/stat.h> must provide the nlink_t type.
authorBruno Haible <bruno@clisp.org>
Sun, 20 Apr 2008 07:53:38 +0000 (09:53 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 20 Apr 2008 07:53:38 +0000 (09:53 +0200)
ChangeLog
m4/sys_stat_h.m4
tests/test-sys_stat.c

index 101bdb0efebcbb7994b7ef39f4648aac7bdf8eda..a562163b7c96b1a14ad208c6df592522a493c844 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-04-20  Bruno Haible  <bruno@clisp.org>
+
+       * m4/sys_stat_h.m4 (gl_HEADER_SYS_STAT_H): Also provided a substitute
+       for nlink_t if missing.
+       * tests/test-sys_stat.c: Check the existence of the nlink_t type.
+
 2008-04-19  Bruno Haible  <bruno@clisp.org>
 
        Work around snprintf bug on Linux libc5.
index 1bc08a17261f8785e7352a9b1c1a91ce48e48cbb..8e66eb023e91fd9037d3073195fc392d30505e80 100644 (file)
@@ -1,5 +1,5 @@
-# sys_stat_h.m4 serial 6   -*- Autoconf -*-
-dnl Copyright (C) 2006-2007 Free Software Foundation, Inc.
+# sys_stat_h.m4 serial 7   -*- Autoconf -*-
+dnl Copyright (C) 2006-2008 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.
@@ -45,4 +45,13 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H],
   gl_CHECK_NEXT_HEADERS([sys/stat.h])
   SYS_STAT_H='sys/stat.h'
   AC_SUBST([SYS_STAT_H])
+
+  dnl Define types that are supposed to be defined in <sys/types.h> or
+  dnl <sys/stat.h>.
+  AC_CHECK_TYPE([nlink_t], [],
+    [AC_DEFINE([nlink_t], [int],
+       [Define to the type of st_nlink in struct stat, or a supertype.])],
+    [#include <sys/types.h>
+     #include <sys/stat.h>])
+
 ]) # gl_HEADER_SYS_STAT_H
index 450fd51a2e8652dc2d6ca6eb8cc0f24f35f4535e..4b5eb767b7fd05bc37bdb9e7b203595f8b634fd3 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <sys/stat.h> substitute.
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2007-2008 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
@@ -253,6 +253,9 @@ verify (!S_ISWHT (S_IFLNK));
 verify (!S_ISWHT (S_IFSOCK));
 #endif
 
+/* Check the existence of some types.  */
+nlink_t t1;
+
 int
 main ()
 {