Bruno Haible wrote: > Derek R. Price wrote: >> Removing references to AC_HEADER_DIRENT (replacing with >> AC_CHECK_HEADERS_ONCE([dirent.h])) > > Yes. All Unix systems nowadays have <dirent.h>, OpenVMS too. But native Woe32 > (MSVCRT, not mingw) doesn't.
Thanks, Bruno. I've attached a patch that replaces all the references to AC_HEADER_DIRENT with calls to AC_CHECK_HEADERS_ONCE([dirent.h ndir.h]) and makes the accompanying changes in lib/*. This patch does simplify, though not quite as much as I was originally hoping, since I had to leave in the <ndir.h> support for Windows. I did leave these potentially unneeded lines in glob.c that I was unsure of: # ifdef HAVE_VMSDIR_H # include "vmsdir.h" # endif /* HAVE_VMSDIR_H */ Is OpenVMS the only practical VMS target left? Do any others have <dirent.h>? A quick bug-cvs search shows that all the VMS bug reports for the last few years have been for OpenVMS. CVS also appears to still be including a replacment <ndir.h> for VMS that looks much like the "vmsdir.h"s I could find online, though I would not be surprised to find out it was no longer necessary. 2006-07-05 Derek R. Price <[EMAIL PROTECTED]> * lib/backupfile.c, lib/dirfd.h, lib/fts.c, lib/getcwd.c, lib/glob.c, lib/savedir.c: Remove obsolescent support for <sys/ndir.h> and <sys/dir.h>. * m4/backupfile.m4, m4/d-ino.m4, m4/d-type.m4, m4/dirfd.m4, m4/fts.m4, m4/getcwd.m4, m4/glob.m4, m4/readdir.m4, m4/savedir.m4: Likewise. Check for <dirent.h> and <ndir.h> explicitly instead of calling the obsolescent AC_HEADER_DIRENT. Cheers, Derek -- Derek R. Price CVS Solutions Architect Get CVS support at Ximbiot <http://ximbiot.com>! v: +1 248.835.1260 f: +1 248.835.1263 <mailto:[EMAIL PROTECTED]>
Index: lib/backupfile.c =================================================================== RCS file: /cvsroot/gnulib/gnulib/lib/backupfile.c,v retrieving revision 1.48 diff -u -p -r1.48 backupfile.c --- lib/backupfile.c 3 Jul 2006 08:32:46 -0000 1.48 +++ lib/backupfile.c 5 Jul 2006 16:18:52 -0000 @@ -44,21 +44,13 @@ #if HAVE_DIRENT_H # include <dirent.h> # define NLENGTH(direct) strlen ((direct)->d_name) -#else +#elif HAVE_NDIR_H # define dirent direct # define NLENGTH(direct) ((size_t) (direct)->d_namlen) -# if HAVE_SYS_NDIR_H -# include <sys/ndir.h> -# endif -# if HAVE_SYS_DIR_H -# include <sys/dir.h> -# endif -# if HAVE_NDIR_H -# include <ndir.h> -# endif +# include <ndir.h> #endif -#if HAVE_DIRENT_H || HAVE_NDIR_H || HAVE_SYS_DIR_H || HAVE_SYS_NDIR_H +#if HAVE_DIRENT_H || HAVE_NDIR_H # define HAVE_DIR 1 #else # define HAVE_DIR 0 Index: lib/dirfd.h =================================================================== RCS file: /cvsroot/gnulib/gnulib/lib/dirfd.h,v retrieving revision 1.6 diff -u -p -r1.6 dirfd.h --- lib/dirfd.h 19 Sep 2005 17:28:14 -0000 1.6 +++ lib/dirfd.h 5 Jul 2006 16:18:52 -0000 @@ -21,18 +21,10 @@ #if HAVE_DIRENT_H # include <dirent.h> -#else /* not HAVE_DIRENT_H */ +#elif HAVE_NDIR_H # define dirent direct -# if HAVE_SYS_NDIR_H -# include <sys/ndir.h> -# endif /* HAVE_SYS_NDIR_H */ -# if HAVE_SYS_DIR_H -# include <sys/dir.h> -# endif /* HAVE_SYS_DIR_H */ -# if HAVE_NDIR_H -# include <ndir.h> -# endif /* HAVE_NDIR_H */ -#endif /* HAVE_DIRENT_H */ +# include <ndir.h> +#endif #ifndef HAVE_DECL_DIRFD "this configure-time declaration test was not run" Index: lib/fts.c =================================================================== RCS file: /cvsroot/gnulib/gnulib/lib/fts.c,v retrieving revision 1.11 diff -u -p -r1.11 fts.c --- lib/fts.c 26 Jan 2006 22:12:26 -0000 1.11 +++ lib/fts.c 5 Jul 2006 16:18:52 -0000 @@ -82,18 +82,10 @@ static char sccsid[] = "@(#)fts.c 8.6 (B # if HAVE_DIRENT_H # include <dirent.h> # define NAMLEN(dirent) strlen ((dirent)->d_name) -# else +# elif HAVE_NDIR_H # define dirent direct # define NAMLEN(dirent) (dirent)->d_namlen -# if HAVE_SYS_NDIR_H -# include <sys/ndir.h> -# endif -# if HAVE_SYS_DIR_H -# include <sys/dir.h> -# endif -# if HAVE_NDIR_H -# include <ndir.h> -# endif +# include <ndir.h> # endif #endif Index: lib/getcwd.c =================================================================== RCS file: /cvsroot/gnulib/gnulib/lib/getcwd.c,v retrieving revision 1.12 diff -u -p -r1.12 getcwd.c --- lib/getcwd.c 3 Jul 2006 08:32:46 -0000 1.12 +++ lib/getcwd.c 5 Jul 2006 16:18:52 -0000 @@ -41,17 +41,9 @@ # ifndef _D_EXACT_NAMLEN # define _D_EXACT_NAMLEN(d) strlen ((d)->d_name) # endif -#else +#elif HAVE_NDIR_H # define dirent direct -# if HAVE_SYS_NDIR_H -# include <sys/ndir.h> -# endif -# if HAVE_SYS_DIR_H -# include <sys/dir.h> -# endif -# if HAVE_NDIR_H -# include <ndir.h> -# endif +# include <ndir.h> #endif #ifndef _D_EXACT_NAMLEN # define _D_EXACT_NAMLEN(d) ((d)->d_namlen) Index: lib/glob.c =================================================================== RCS file: /cvsroot/gnulib/gnulib/lib/glob.c,v retrieving revision 1.6 diff -u -p -r1.6 glob.c --- lib/glob.c 22 Jun 2006 23:40:20 -0000 1.6 +++ lib/glob.c 5 Jul 2006 16:18:52 -0000 @@ -50,15 +50,9 @@ #if defined HAVE_DIRENT_H || defined __GNU_LIBRARY__ # include <dirent.h> # define NAMLEN(dirent) strlen((dirent)->d_name) -#else +#elif HAVE_NDIR_H # define dirent direct # define NAMLEN(dirent) (dirent)->d_namlen -# ifdef HAVE_SYS_NDIR_H -# include <sys/ndir.h> -# endif -# ifdef HAVE_SYS_DIR_H -# include <sys/dir.h> -# endif # ifdef HAVE_NDIR_H # include <ndir.h> # endif Index: lib/savedir.c =================================================================== RCS file: /cvsroot/gnulib/gnulib/lib/savedir.c,v retrieving revision 1.29 diff -u -p -r1.29 savedir.c --- lib/savedir.c 28 Jun 2006 22:25:49 -0000 1.29 +++ lib/savedir.c 5 Jul 2006 16:18:52 -0000 @@ -31,17 +31,9 @@ #if HAVE_DIRENT_H # include <dirent.h> -#else +#elif HAVE_NDIR_H # define dirent direct -# if HAVE_SYS_NDIR_H -# include <sys/ndir.h> -# endif -# if HAVE_SYS_DIR_H -# include <sys/dir.h> -# endif -# if HAVE_NDIR_H -# include <ndir.h> -# endif +# include <ndir.h> #endif #include <stddef.h> Index: m4/backupfile.m4 =================================================================== RCS file: /cvsroot/gnulib/gnulib/m4/backupfile.m4,v retrieving revision 1.10 diff -u -p -r1.10 backupfile.m4 --- m4/backupfile.m4 23 Sep 2005 04:15:13 -0000 1.10 +++ m4/backupfile.m4 5 Jul 2006 16:18:52 -0000 @@ -10,7 +10,7 @@ AC_DEFUN([gl_BACKUPFILE], AC_LIBOBJ([backupfile]) dnl Prerequisites of lib/backupfile.c. - AC_REQUIRE([AC_HEADER_DIRENT]) + AC_CHECK_HEADERS_ONCE([dirent.h ndir.h]) AC_REQUIRE([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO]) AC_REQUIRE([gl_AC_DOS]) AC_REQUIRE([AC_SYS_LONG_FILE_NAMES]) Index: m4/d-ino.m4 =================================================================== RCS file: /cvsroot/gnulib/gnulib/m4/d-ino.m4,v retrieving revision 1.8 diff -u -p -r1.8 d-ino.m4 --- m4/d-ino.m4 23 Jan 2005 08:06:57 -0000 1.8 +++ m4/d-ino.m4 5 Jul 2006 16:18:52 -0000 @@ -13,7 +13,7 @@ dnl # with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO], - [AC_REQUIRE([AC_HEADER_DIRENT])dnl + [AC_CHECK_HEADERS_ONCE([dirent.h ndir.h])dnl AC_CACHE_CHECK([for d_ino member in directory struct], jm_cv_struct_dirent_d_ino, [AC_TRY_LINK(dnl @@ -21,18 +21,10 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_DIRENT_D_ #include <sys/types.h> #ifdef HAVE_DIRENT_H # include <dirent.h> -#else /* not HAVE_DIRENT_H */ +#elif HAVE_NDIR_H # define dirent direct -# ifdef HAVE_SYS_NDIR_H -# include <sys/ndir.h> -# endif /* HAVE_SYS_NDIR_H */ -# ifdef HAVE_SYS_DIR_H -# include <sys/dir.h> -# endif /* HAVE_SYS_DIR_H */ -# ifdef HAVE_NDIR_H -# include <ndir.h> -# endif /* HAVE_NDIR_H */ -#endif /* HAVE_DIRENT_H */ +# include <ndir.h> +#endif ], [struct dirent dp; dp.d_ino = 0;], Index: m4/d-type.m4 =================================================================== RCS file: /cvsroot/gnulib/gnulib/m4/d-type.m4,v retrieving revision 1.9 diff -u -p -r1.9 d-type.m4 --- m4/d-type.m4 23 Jan 2005 08:06:57 -0000 1.9 +++ m4/d-type.m4 5 Jul 2006 16:18:52 -0000 @@ -13,7 +13,7 @@ dnl # with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE], - [AC_REQUIRE([AC_HEADER_DIRENT])dnl + [AC_CHECK_HEADERS_ONCE([dirent.h ndir.h])dnl AC_CACHE_CHECK([for d_type member in directory struct], jm_cv_struct_dirent_d_type, [AC_TRY_LINK(dnl @@ -21,18 +21,10 @@ AC_DEFUN([gl_CHECK_TYPE_STRUCT_DIRENT_D_ #include <sys/types.h> #ifdef HAVE_DIRENT_H # include <dirent.h> -#else /* not HAVE_DIRENT_H */ +#elif HAVE_NDIR_H # define dirent direct -# ifdef HAVE_SYS_NDIR_H -# include <sys/ndir.h> -# endif /* HAVE_SYS_NDIR_H */ -# ifdef HAVE_SYS_DIR_H -# include <sys/dir.h> -# endif /* HAVE_SYS_DIR_H */ -# ifdef HAVE_NDIR_H -# include <ndir.h> -# endif /* HAVE_NDIR_H */ -#endif /* HAVE_DIRENT_H */ +# include <ndir.h> +#endif ], [struct dirent dp; dp.d_type = 0;], Index: m4/dirfd.m4 =================================================================== RCS file: /cvsroot/gnulib/gnulib/m4/dirfd.m4,v retrieving revision 1.19 diff -u -p -r1.19 dirfd.m4 --- m4/dirfd.m4 15 Mar 2006 21:16:25 -0000 1.19 +++ m4/dirfd.m4 5 Jul 2006 16:18:52 -0000 @@ -17,23 +17,15 @@ AC_DEFUN([gl_FUNC_DIRFD], dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57. AC_REQUIRE([AC_PROG_CPP]) AC_REQUIRE([AC_PROG_EGREP]) - AC_REQUIRE([AC_HEADER_DIRENT]) + AC_CHECK_HEADERS_ONCE([dirent.h ndir.h])dnl dirfd_headers=' #if HAVE_DIRENT_H # include <dirent.h> -#else /* not HAVE_DIRENT_H */ +#elif HAVE_NDIR_H # define dirent direct -# if HAVE_SYS_NDIR_H -# include <sys/ndir.h> -# endif /* HAVE_SYS_NDIR_H */ -# if HAVE_SYS_DIR_H -# include <sys/dir.h> -# endif /* HAVE_SYS_DIR_H */ -# if HAVE_NDIR_H -# include <ndir.h> -# endif /* HAVE_NDIR_H */ -#endif /* HAVE_DIRENT_H */ +# include <ndir.h> +#endif ' AC_CHECK_FUNCS(dirfd) AC_CHECK_DECLS([dirfd], , , $dirfd_headers) Index: m4/fts.m4 =================================================================== RCS file: /cvsroot/gnulib/gnulib/m4/fts.m4,v retrieving revision 1.6 diff -u -p -r1.6 fts.m4 --- m4/fts.m4 23 Sep 2005 04:15:13 -0000 1.6 +++ m4/fts.m4 5 Jul 2006 16:18:52 -0000 @@ -29,6 +29,5 @@ AC_DEFUN([gl_FUNC_FTS_CORE], dnl Prerequisites of lib/fts.c. # Checks for header files. - AC_REQUIRE([AC_HEADER_DIRENT]) - AC_CHECK_HEADERS_ONCE([sys/param.h]) + AC_CHECK_HEADERS_ONCE([dirent.h ndir.h sys/param.h])dnl ]) Index: m4/getcwd.m4 =================================================================== RCS file: /cvsroot/gnulib/gnulib/m4/getcwd.m4,v retrieving revision 1.10 diff -u -p -r1.10 getcwd.m4 --- m4/getcwd.m4 3 Jul 2006 08:32:46 -0000 1.10 +++ m4/getcwd.m4 5 Jul 2006 16:18:52 -0000 @@ -61,7 +61,7 @@ AC_DEFUN([gl_FUNC_GETCWD], AC_DEFUN([gl_PREREQ_GETCWD], [ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - AC_REQUIRE([AC_HEADER_DIRENT]) + AC_CHECK_HEADERS_ONCE([dirent.h ndir.h])dnl AC_REQUIRE([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO]) : ]) Index: m4/glob.m4 =================================================================== RCS file: /cvsroot/gnulib/gnulib/m4/glob.m4,v retrieving revision 1.5 diff -u -p -r1.5 glob.m4 --- m4/glob.m4 13 Sep 2005 03:47:45 -0000 1.5 +++ m4/glob.m4 5 Jul 2006 16:18:52 -0000 @@ -74,7 +74,7 @@ if (glob ("conf*-globtest", 0, NULL, &fo AC_DEFUN([gl_PREREQ_GLOB], [ AC_REQUIRE([gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE])dnl AC_REQUIRE([AC_GNU_SOURCE])dnl - AC_REQUIRE([AC_HEADER_DIRENT])dnl + AC_CHECK_HEADERS_ONCE([dirent.h ndir.h])dnl AC_CHECK_HEADERS_ONCE([sys/cdefs.h unistd.h])dnl AC_CHECK_FUNCS_ONCE([getlogin_r getpwnam_r])dnl :]) Index: m4/readdir.m4 =================================================================== RCS file: /cvsroot/gnulib/gnulib/m4/readdir.m4,v retrieving revision 1.14 diff -u -p -r1.14 readdir.m4 --- m4/readdir.m4 24 Apr 2006 07:35:24 -0000 1.14 +++ m4/readdir.m4 5 Jul 2006 16:18:52 -0000 @@ -24,7 +24,7 @@ dnl Written by Jim Meyering. AC_DEFUN([GL_FUNC_READDIR], [dnl -AC_REQUIRE([AC_HEADER_DIRENT]) +AC_CHECK_HEADERS_ONCE([dirent.h ndir.h])dnl AC_CACHE_CHECK([for working readdir], gl_cv_func_working_readdir, [dnl # Arrange for deletion of the temporary directory this test creates, in @@ -40,19 +40,11 @@ AC_CACHE_CHECK([for working readdir], gl # ifdef HAVE_DIRENT_H # include <dirent.h> # define NLENGTH(direct) (strlen((direct)->d_name)) -# else /* not HAVE_DIRENT_H */ +# elif HAVE_NDIR_H # define dirent direct # define NLENGTH(direct) ((direct)->d_namlen) -# ifdef HAVE_SYS_NDIR_H -# include <sys/ndir.h> -# endif /* HAVE_SYS_NDIR_H */ -# ifdef HAVE_SYS_DIR_H -# include <sys/dir.h> -# endif /* HAVE_SYS_DIR_H */ -# ifdef HAVE_NDIR_H -# include <ndir.h> -# endif /* HAVE_NDIR_H */ -# endif /* HAVE_DIRENT_H */ +# include <ndir.h> +# endif # define DOT_OR_DOTDOT(Basename) \ (Basename[0] == '.' && (Basename[1] == '\0' \ Index: m4/savedir.m4 =================================================================== RCS file: /cvsroot/gnulib/gnulib/m4/savedir.m4,v retrieving revision 1.5 diff -u -p -r1.5 savedir.m4 --- m4/savedir.m4 28 Jun 2006 22:25:49 -0000 1.5 +++ m4/savedir.m4 5 Jul 2006 16:18:52 -0000 @@ -10,5 +10,5 @@ AC_DEFUN([gl_SAVEDIR], AC_LIBOBJ([savedir]) dnl Prerequisites of lib/savedir.c. - AC_REQUIRE([AC_HEADER_DIRENT]) + AC_CHECK_HEADERS_ONCE([dirent.h ndir.h])dnl ])