Update Gnulib to the latest git version
[deliverable/binutils-gdb.git] / gnulib / import / m4 / d-ino.m4
CommitLineData
c0c3707f 1# serial 20
6ec2e0f5
SDJ
2
3dnl From Jim Meyering.
4dnl
5dnl Check whether struct dirent has a member named d_ino.
6dnl
7
c0c3707f 8# Copyright (C) 1997, 1999-2001, 2003-2004, 2006-2007, 2009-2019 Free Software
6ec2e0f5
SDJ
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
15AC_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],
c0c3707f 18 [gl_cv_struct_dirent_d_ino],
6ec2e0f5
SDJ
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)
c0c3707f 32 { closedir (dp); return 2; }
6ec2e0f5 33 if (lstat (e->d_name, &st) != 0)
c0c3707f 34 { closedir (dp); return 3; }
6ec2e0f5 35 if (e->d_ino != st.st_ino)
c0c3707f 36 { closedir (dp); return 4; }
6ec2e0f5
SDJ
37 closedir (dp);
38 return 0;
39 ]])],
40 [gl_cv_struct_dirent_d_ino=yes],
41 [gl_cv_struct_dirent_d_ino=no],
42 [case "$host_os" in
c0c3707f
CB
43 # Guess yes on glibc systems with Linux kernel.
44 linux*-gnu*) gl_cv_struct_dirent_d_ino="guessing yes" ;;
45 # Guess yes on musl systems with Linux kernel.
46 linux*-musl*) gl_cv_struct_dirent_d_ino="guessing yes" ;;
47 # Guess no on native Windows.
48 mingw*) gl_cv_struct_dirent_d_ino="guessing no" ;;
49 # If we don't know, obey --enable-cross-guesses.
50 *) gl_cv_struct_dirent_d_ino="$gl_cross_guess_normal" ;;
6ec2e0f5
SDJ
51 esac
52 ])])
53 case "$gl_cv_struct_dirent_d_ino" in
54 *yes)
55 AC_DEFINE([D_INO_IN_DIRENT], [1],
56 [Define if struct dirent has a member d_ino that actually works.])
57 ;;
58 esac
59 ]
60)
This page took 0.205006 seconds and 4 git commands to generate.