re-mark 1.29b-2 as not yet uploaded (merge madness!)
[debian/tar] / m4 / d-ino.m4
1 # serial 14
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-2001, 2003-2004, 2006-2007, 2009-2015 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_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
17    AC_CACHE_CHECK([for d_ino member in directory struct],
18                   gl_cv_struct_dirent_d_ino,
19      [AC_RUN_IFELSE(
20         [AC_LANG_PROGRAM(
21            [[#include <sys/types.h>
22              #include <sys/stat.h>
23              #include <dirent.h>
24            ]],
25            [[DIR *dp = opendir (".");
26              struct dirent *e;
27              struct stat st;
28              if (! dp)
29                return 1;
30              e = readdir (dp);
31              if (! e)
32                return 2;
33              if (lstat (e->d_name, &st) != 0)
34                return 3;
35              if (e->d_ino != st.st_ino)
36                return 4;
37              return 0;
38            ]])],
39            [gl_cv_struct_dirent_d_ino=yes],
40            [gl_cv_struct_dirent_d_ino=no],
41            [case "$host_os" in
42                            # Guess yes on glibc systems with Linux kernel.
43               linux*-gnu*) gl_cv_struct_dirent_d_ino="guessing yes" ;;
44                            # If we don't know, assume the worst.
45               *)           gl_cv_struct_dirent_d_ino="guessing no" ;;
46             esac
47            ])])
48    case "$gl_cv_struct_dirent_d_ino" in
49      *yes)
50        AC_DEFINE([D_INO_IN_DIRENT], [1],
51          [Define if struct dirent has a member d_ino that actually works.])
52        ;;
53    esac
54   ]
55 )