]> git.cworth.org Git - tar/blob - m4/d-ino.m4
6e6dab3d23053bc0af0be91e4f7263217702e0f3
[tar] / m4 / d-ino.m4
1 #serial 10
2
3 dnl From Jim Meyering.
4 dnl
5 dnl Check whether struct dirent has a member named d_ino.
6 dnl
7
8 # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2006, 2007 Free Software
9 # Foundation, Inc.
10
11 # This file is free software; the Free Software Foundation
12 # gives unlimited permission to copy and/or distribute it,
13 # with or without modifications, as long as this notice is preserved.
14
15 AC_DEFUN([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO],
16   [AC_CACHE_CHECK([for d_ino member in directory struct],
17                   gl_cv_struct_dirent_d_ino,
18      [AC_RUN_IFELSE(
19         [AC_LANG_PROGRAM(
20            [[#include <sys/types.h>
21              #include <sys/stat.h>
22              #include <dirent.h>
23            ]],
24            [[DIR *dp = opendir (".");
25              struct dirent *e;
26              struct stat st;
27              if (! dp)
28                return 1;
29              e = readdir (dp);
30              return ! (e
31                        && stat (e->d_name, &st) == 0
32                        && e->d_ino == st.st_ino);]])],
33             [gl_cv_struct_dirent_d_ino=yes],
34             [gl_cv_struct_dirent_d_ino=no],
35             [gl_cv_struct_dirent_d_ino=no])])
36    if test $gl_cv_struct_dirent_d_ino = yes; then
37      AC_DEFINE(D_INO_IN_DIRENT, 1,
38        [Define if struct dirent has a member d_ino that actually works.])
39    fi
40   ]
41 )