]> git.ipfire.org Git - thirdparty/make.git/commitdiff
* configure.ac: Check whether struct dirent has a d_type field
authorPaul Smith <psmith@gnu.org>
Sat, 7 Sep 2019 20:59:46 +0000 (16:59 -0400)
committerPaul Smith <psmith@gnu.org>
Sun, 8 Sep 2019 00:12:44 +0000 (20:12 -0400)
* src/dir.c (dir_contents_file_exists_p): Use the autoconf macro
HAVE_STRUCT_DIRENT_D_TYPE rather than relying on the GNU libc-
specific _DIRENT_HAVE_D_TYPE.
* lib/glob.c: Set HAVE_D_TYPE if HAVE_STRUCT_DIRENT_D_TYPE.

configure.ac
lib/glob.c
src/dir.c

index da1e17dd2a044469be63c6e9d4b4bb6d2473a0d3..a1f255538b76c1809bac02991bbec7736f5c6b62 100644 (file)
@@ -164,6 +164,9 @@ AC_CHECK_FUNCS([strcasecmp strncasecmp strcmpi strncmpi stricmp strnicmp])
 AC_FUNC_STRCOLL
 AC_FUNC_CLOSEDIR_VOID
 
+# dir.c and our glob.c use dirent.d_type if available
+AC_STRUCT_DIRENT_D_TYPE
+
 # See if the user wants to add (or not) GNU Guile support
 AC_ARG_WITH([guile], [AS_HELP_STRING([--with-guile],
             [Support GNU Guile for embedded scripting])])
index f221a5317183951c97a395fcfd078d3c19e3f8e3..adad16fa6ddaea28c6e5a00fa03add2bb4b93fbd 100644 (file)
@@ -117,7 +117,7 @@ extern int errno;
 
 /* When used in the GNU libc the symbol _DIRENT_HAVE_D_TYPE is available
    if the `d_type' member for `struct dirent' is available.  */
-#ifdef _DIRENT_HAVE_D_TYPE
+#if defined(_DIRENT_HAVE_D_TYPE) || defined(HAVE_STRUCT_DIRENT_D_TYPE)
 # define HAVE_D_TYPE   1
 #endif
 
index efa35f68b67ac98663eb3bd2292292d444da9fc6..b867f950e99685adf80365acadf3505e4096616c 100644 (file)
--- a/src/dir.c
+++ b/src/dir.c
@@ -732,7 +732,7 @@ dir_contents_file_exists_p (struct directory_contents *dir,
 #else
           df->name = strcache_add_len (d->d_name, len);
 #endif
-#ifdef _DIRENT_HAVE_D_TYPE
+#ifdef HAVE_STRUCT_DIRENT_D_TYPE
           df->type = d->d_type;
 #endif
           df->length = len;
@@ -1245,7 +1245,7 @@ read_dirstream (__ptr_t stream)
 #ifdef _DIRENT_HAVE_D_NAMLEN
           d->d_namlen = len - 1;
 #endif
-#ifdef _DIRENT_HAVE_D_TYPE
+#ifdef HAVE_STRUCT_DIRENT_D_TYPE
           d->d_type = df->type;
 #endif
           memcpy (d->d_name, df->name, len);