diff --git a/configure.ac b/configure.ac index da1e17dd..a1f25553 100644 --- a/configure.ac +++ b/configure.ac @@ -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])]) diff --git a/lib/glob.c b/lib/glob.c index f221a531..adad16fa 100644 --- a/lib/glob.c +++ b/lib/glob.c @@ -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 diff --git a/src/dir.c b/src/dir.c index efa35f68..b867f950 100644 --- 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);