Debian Codegraph @

m4/d-ino.m4

raw
1 # d-ino.m4
2 # serial 22
3 dnl Copyright (C) 1997, 1999-2001, 2003-2004, 2006-2007, 2009-2026 Free
4 dnl Software Foundation, Inc.
5 dnl This file is free software; the Free Software Foundation
6 dnl gives unlimited permission to copy and/or distribute it,
7 dnl with or without modifications, as long as this notice is preserved.
8 dnl This file is offered as-is, without any warranty.
9
10 dnl From Jim Meyering.
11 dnl
12 dnl Check whether struct dirent has a member named d_ino.
13
14 AC_DEFUN([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO],
15 [AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
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 if (! e)
31 { closedir (dp); return 2; }
32 if (lstat (e->d_name, &st) != 0)
33 { closedir (dp); return 3; }
34 if (e->d_ino != st.st_ino)
35 { closedir (dp); return 4; }
36 closedir (dp);
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 # Guess yes on musl systems with Linux kernel.
45 linux*-musl*) gl_cv_struct_dirent_d_ino="guessing yes" ;;
46 # Guess yes on systems that emulate the Linux system calls.
47 midipix*) gl_cv_struct_dirent_d_ino="guessing yes" ;;
48 # Guess no on native Windows.
49 mingw* | windows*) gl_cv_struct_dirent_d_ino="guessing no" ;;
50 # If we don't know, obey --enable-cross-guesses.
51 *) gl_cv_struct_dirent_d_ino="$gl_cross_guess_normal" ;;
52 esac
53 ])])
54 case "$gl_cv_struct_dirent_d_ino" in
55 *yes)
56 AC_DEFINE([D_INO_IN_DIRENT], [1],
57 [Define if struct dirent has a member d_ino that actually works.])
58 ;;
59 esac
60 ]
61 )