1 1.1 christos # serial 20 2 1.1 christos 3 1.1 christos dnl From Jim Meyering. 4 1.1 christos dnl 5 1.1 christos dnl Check whether struct dirent has a member named d_ino. 6 1.1 christos dnl 7 1.1 christos 8 1.1.1.2 christos # Copyright (C) 1997, 1999-2001, 2003-2004, 2006-2007, 2009-2022 Free Software 9 1.1 christos # Foundation, Inc. 10 1.1 christos 11 1.1 christos # This file is free software; the Free Software Foundation 12 1.1 christos # gives unlimited permission to copy and/or distribute it, 13 1.1 christos # with or without modifications, as long as this notice is preserved. 14 1.1 christos 15 1.1 christos AC_DEFUN([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO], 16 1.1 christos [AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles 17 1.1 christos AC_CACHE_CHECK([for d_ino member in directory struct], 18 1.1 christos [gl_cv_struct_dirent_d_ino], 19 1.1 christos [AC_RUN_IFELSE( 20 1.1 christos [AC_LANG_PROGRAM( 21 1.1 christos [[#include <sys/types.h> 22 1.1 christos #include <sys/stat.h> 23 1.1 christos #include <dirent.h> 24 1.1 christos ]], 25 1.1 christos [[DIR *dp = opendir ("."); 26 1.1 christos struct dirent *e; 27 1.1 christos struct stat st; 28 1.1 christos if (! dp) 29 1.1 christos return 1; 30 1.1 christos e = readdir (dp); 31 1.1 christos if (! e) 32 1.1 christos { closedir (dp); return 2; } 33 1.1 christos if (lstat (e->d_name, &st) != 0) 34 1.1 christos { closedir (dp); return 3; } 35 1.1 christos if (e->d_ino != st.st_ino) 36 1.1 christos { closedir (dp); return 4; } 37 1.1 christos closedir (dp); 38 1.1 christos return 0; 39 1.1 christos ]])], 40 1.1 christos [gl_cv_struct_dirent_d_ino=yes], 41 1.1 christos [gl_cv_struct_dirent_d_ino=no], 42 1.1 christos [case "$host_os" in 43 1.1 christos # Guess yes on glibc systems with Linux kernel. 44 1.1 christos linux*-gnu*) gl_cv_struct_dirent_d_ino="guessing yes" ;; 45 1.1 christos # Guess yes on musl systems with Linux kernel. 46 1.1 christos linux*-musl*) gl_cv_struct_dirent_d_ino="guessing yes" ;; 47 1.1 christos # Guess no on native Windows. 48 1.1 christos mingw*) gl_cv_struct_dirent_d_ino="guessing no" ;; 49 1.1 christos # If we don't know, obey --enable-cross-guesses. 50 1.1 christos *) gl_cv_struct_dirent_d_ino="$gl_cross_guess_normal" ;; 51 1.1 christos esac 52 1.1 christos ])]) 53 1.1 christos case "$gl_cv_struct_dirent_d_ino" in 54 1.1 christos *yes) 55 1.1 christos AC_DEFINE([D_INO_IN_DIRENT], [1], 56 1.1 christos [Define if struct dirent has a member d_ino that actually works.]) 57 1.1 christos ;; 58 1.1 christos esac 59 1.1 christos ] 60 1.1 christos ) 61