From d76a6493392c315ba9da4a262efaa430b1a72476 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 6 Jul 2006 23:29:27 +0000 Subject: [PATCH] * lib/getloadavg.c: Use __VMS, not VMS. * lib/getopt.c: Likewise. * lib/getpagesize.h: Likewise. * lib/glob.c: Remove most VMS cruft; it hasn't been tested for a while and probably does not work. * lib/backupfile.c [HAVE_DIRENT_H && ! HAVE_NDIR_H]: Don't worry about this obsolete case any more. (HAVE_DIR): Remove. All uses removed; we now assume you can read directories. * lib/dirfd.h [HAVE_DIRENT_H && ! HAVE_NDIR_H]: Don't worry about this obsolete case any more. * lib/fts.c: Likewise. * lib/getcwd.c: Likewise. * lib/glob.h: Likewise. * lib/savedir.c: Likewise. * m4/backupfile.m4 (gl_BACKUPFILE): Check for dirent.h, instead of invoking obsolescent AC_HEADER_DIRENT macro. * m4/d-ino.m4 (gl_CHECK_TYPE_STRUCT_DIRENT_D_INO): Likewise. * m4/d-type.m4 (gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE): Likewise. * m4/dirfd.m4 (gl_FUNC_DIRFD): Likewise. * m4/fts.m4 (gl_FUNC_FTS_CORE): Likewise. * m4/getcwd.m4 (gl_PREREQ_GETCWD): Likewise. * m4/glob.m4 (gl_PREREQ_GLOB): Likewise. * m4/savedir.m4 (gl_SAVEDIR): Likewise. * m4/readdir.m4: Remove; no longer needed. --- lib/ChangeLog | 22 +++++++++ lib/backupfile.c | 23 +-------- lib/dirfd.h | 16 ++----- lib/fts.c | 25 ++++------ lib/getcwd.c | 16 ++----- lib/getloadavg.c | 18 +++---- lib/getopt.c | 2 +- lib/getpagesize.h | 4 +- lib/glob.c | 17 +------ lib/savedir.c | 10 +--- m4/ChangeLog | 14 ++++++ m4/backupfile.m4 | 6 +-- m4/d-ino.m4 | 20 +++----- m4/d-type.m4 | 20 +++----- m4/dirfd.m4 | 18 ++----- m4/fts.m4 | 7 ++- m4/getcwd.m4 | 2 +- m4/glob.m4 | 6 +-- m4/readdir.m4 | 140 ------------------------------------------------------ m4/savedir.m4 | 4 +- 20 files changed, 97 insertions(+), 293 deletions(-) delete mode 100644 m4/readdir.m4 diff --git a/lib/ChangeLog b/lib/ChangeLog index d74990376..1f247d4c7 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,5 +1,27 @@ 2006-07-06 Paul Eggert + * getloadavg.c: Use __VMS, not VMS. + * getopt.c: Likewise. + * getpagesize.h: Likewise. + * glob.c: Remove most VMS cruft; it hasn't been tested for a while and + probably does not work. + +2006-07-06 Derek R. Price + and Paul Eggert + + * backupfile.c [HAVE_DIRENT_H && ! HAVE_NDIR_H]: + Don't worry about this obsolete case any more. + (HAVE_DIR): Remove. All uses removed; we now assume you can read + directories. + * dirfd.h [HAVE_DIRENT_H && ! HAVE_NDIR_H]: Don't + worry about this obsolete case any more. + * fts.c: Likewise. + * getcwd.c: Likewise. + * glob.h: Likewise. + * savedir.c: Likewise. + +2006-07-06 Paul Eggert + * .cppi-disable: Add wcwidth. * fnmatch.c (ISBLANK): Remove. All uses changed to isblank. (isblank) [! (defined isblank || HAVE_DECL_ISBLANK)]: New macro. diff --git a/lib/backupfile.c b/lib/backupfile.c index 3dfaf45dc..13c471583 100644 --- a/lib/backupfile.c +++ b/lib/backupfile.c @@ -47,21 +47,7 @@ #else # define dirent direct # define NLENGTH(direct) ((size_t) (direct)->d_namlen) -# if HAVE_SYS_NDIR_H -# include -# endif -# if HAVE_SYS_DIR_H -# include -# endif -# if HAVE_NDIR_H -# include -# endif -#endif - -#if HAVE_DIRENT_H || HAVE_NDIR_H || HAVE_SYS_DIR_H || HAVE_SYS_NDIR_H -# define HAVE_DIR 1 -#else -# define HAVE_DIR 0 +# include #endif #if D_INO_IN_DIRENT @@ -166,8 +152,6 @@ check_extension (char *file, size_t filelen, char e) } } -#if HAVE_DIR - /* Returned values for NUMBERED_BACKUP. */ enum numbered_backup_result @@ -282,7 +266,6 @@ numbered_backup (char **buffer, size_t buffer_size, size_t filelen) *buffer = buf; return result; } -#endif /* HAVE_DIR */ /* Return the name of the new backup file for the existing file FILE, allocated with malloc. Report an error and fail if out of memory. @@ -301,14 +284,13 @@ find_backup_file_name (char const *file, enum backup_type backup_type) size_t simple_backup_suffix_size = strlen (simple_backup_suffix) + 1; size_t backup_suffix_size_guess = simple_backup_suffix_size; enum { GUESS = sizeof ".~12345~" }; - if (HAVE_DIR && backup_suffix_size_guess < GUESS) + if (backup_suffix_size_guess < GUESS) backup_suffix_size_guess = GUESS; ssize = filelen + backup_suffix_size_guess + 1; s = xmalloc (ssize); memcpy (s, file, filelen + 1); -#if HAVE_DIR if (backup_type != simple_backups) switch (numbered_backup (&s, ssize, filelen)) { @@ -323,7 +305,6 @@ find_backup_file_name (char const *file, enum backup_type backup_type) simple = (backup_type == numbered_existing_backups); break; } -#endif if (simple) memcpy (s + filelen, simple_backup_suffix, simple_backup_suffix_size); diff --git a/lib/dirfd.h b/lib/dirfd.h index 1223b51d2..601332c8b 100644 --- a/lib/dirfd.h +++ b/lib/dirfd.h @@ -1,5 +1,5 @@ /* Declare dirfd, if necessary. - Copyright (C) 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,18 +21,10 @@ #if HAVE_DIRENT_H # include -#else /* not HAVE_DIRENT_H */ +#else # define dirent direct -# if HAVE_SYS_NDIR_H -# include -# endif /* HAVE_SYS_NDIR_H */ -# if HAVE_SYS_DIR_H -# include -# endif /* HAVE_SYS_DIR_H */ -# if HAVE_NDIR_H -# include -# endif /* HAVE_NDIR_H */ -#endif /* HAVE_DIRENT_H */ +# include +#endif #ifndef HAVE_DECL_DIRFD "this configure-time declaration test was not run" diff --git a/lib/fts.c b/lib/fts.c index 8666cff87..0938b9c22 100644 --- a/lib/fts.c +++ b/lib/fts.c @@ -75,26 +75,17 @@ static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94"; # include "lstat.h" #endif -#if defined _LIBC +#if HAVE_DIRENT_H || _LIBC # include -# define NAMLEN(dirent) _D_EXACT_NAMLEN (dirent) -#else -# if HAVE_DIRENT_H -# include -# define NAMLEN(dirent) strlen ((dirent)->d_name) +# ifdef _D_EXACT_NAMLEN +# define NAMLEN(dirent) _D_EXACT_NAMLEN (dirent) # else -# define dirent direct -# define NAMLEN(dirent) (dirent)->d_namlen -# if HAVE_SYS_NDIR_H -# include -# endif -# if HAVE_SYS_DIR_H -# include -# endif -# if HAVE_NDIR_H -# include -# endif +# define NAMLEN(dirent) strlen ((dirent)->d_name) # endif +#else +# define dirent direct +# define NAMLEN(dirent) (dirent)->d_namlen +# include #endif #ifdef _LIBC diff --git a/lib/getcwd.c b/lib/getcwd.c index ba226799d..a67dc0c07 100644 --- a/lib/getcwd.c +++ b/lib/getcwd.c @@ -38,23 +38,13 @@ #if HAVE_DIRENT_H || _LIBC # include -# ifndef _D_EXACT_NAMLEN -# define _D_EXACT_NAMLEN(d) strlen ((d)->d_name) -# endif #else # define dirent direct -# if HAVE_SYS_NDIR_H -# include -# endif -# if HAVE_SYS_DIR_H -# include -# endif -# if HAVE_NDIR_H -# include -# endif +# define _D_EXACT_NAMLEN(d) (d)->d_namlen +# include #endif #ifndef _D_EXACT_NAMLEN -# define _D_EXACT_NAMLEN(d) ((d)->d_namlen) +# define _D_EXACT_NAMLEN(d) strlen ((d)->d_name) #endif #ifndef _D_ALLOC_NAMLEN # define _D_ALLOC_NAMLEN(d) (_D_EXACT_NAMLEN (d) + 1) diff --git a/lib/getloadavg.c b/lib/getloadavg.c index 2a5013148..98e2297dc 100644 --- a/lib/getloadavg.c +++ b/lib/getloadavg.c @@ -358,7 +358,7 @@ # ifdef LOAD_AVE_TYPE -# ifndef VMS +# ifndef __VMS # ifndef __linux__ # ifndef NLIST_STRUCT # include @@ -385,7 +385,7 @@ # endif /* LDAV_SYMBOL */ # endif /* __linux__ */ -# else /* VMS */ +# else /* __VMS */ # ifndef eunice # include @@ -393,7 +393,7 @@ # else /* eunice */ # include # endif /* eunice */ -# endif /* VMS */ +# endif /* __VMS */ # ifndef LDAV_CVT # define LDAV_CVT(n) ((double) (n)) @@ -473,9 +473,9 @@ static bool getloadavg_initialized; /* Offset in kmem to seek to read load average, or 0 means invalid. */ static long offset; -# if !defined (VMS) && !defined (sgi) && !defined (__linux__) +# if ! defined __VMS && ! defined sgi && ! defined __linux__ static struct nlist nl[2]; -# endif /* Not VMS or sgi */ +# endif # ifdef SUNOS_5 static kvm_t *kd; @@ -813,7 +813,7 @@ getloadavg (double loadavg[], int nelem) : (load_ave.tl_avenrun.l[elem] / (double) load_ave.tl_lscale)); # endif /* OSF_ALPHA */ -# if !defined (LDAV_DONE) && defined (VMS) +# if ! defined LDAV_DONE && defined __VMS /* VMS specific code -- read from the Load Ave driver. */ LOAD_AVE_TYPE load_ave[3]; @@ -851,9 +851,9 @@ getloadavg (double loadavg[], int nelem) if (!getloadavg_initialized) return -1; -# endif /* VMS */ +# endif /* ! defined LDAV_DONE && defined __VMS */ -# if !defined (LDAV_DONE) && defined (LOAD_AVE_TYPE) && !defined (VMS) +# if ! defined LDAV_DONE && defined LOAD_AVE_TYPE && ! defined __VMS /* UNIX-specific code -- read the average from /dev/kmem. */ @@ -953,7 +953,7 @@ getloadavg (double loadavg[], int nelem) if (offset == 0 || !getloadavg_initialized) return -1; -# endif /* LOAD_AVE_TYPE and not VMS */ +# endif /* ! defined LDAV_DONE && defined LOAD_AVE_TYPE && ! defined __VMS */ # if !defined (LDAV_DONE) && defined (LOAD_AVE_TYPE) /* Including VMS. */ if (nelem > 0) diff --git a/lib/getopt.c b/lib/getopt.c index 83bd6db43..f37a837bc 100644 --- a/lib/getopt.c +++ b/lib/getopt.c @@ -31,7 +31,7 @@ #include #include -#ifdef VMS +#ifdef __VMS # include #endif diff --git a/lib/getpagesize.h b/lib/getpagesize.h index 5cce3c908..b09b2c24b 100644 --- a/lib/getpagesize.h +++ b/lib/getpagesize.h @@ -21,12 +21,12 @@ #include #if !defined getpagesize && defined _SC_PAGESIZE -# if !(defined VMS && __VMS_VER < 70000000) +# if ! (defined __VMS && __VMS_VER < 70000000) # define getpagesize() sysconf (_SC_PAGESIZE) # endif #endif -#if !defined getpagesize && defined VMS +#if !defined getpagesize && defined __VMS # ifdef __ALPHA # define getpagesize() 8192 # else diff --git a/lib/glob.c b/lib/glob.c index 28ca8a06b..c1613f4ca 100644 --- a/lib/glob.c +++ b/lib/glob.c @@ -53,18 +53,7 @@ #else # define dirent direct # define NAMLEN(dirent) (dirent)->d_namlen -# ifdef HAVE_SYS_NDIR_H -# include -# endif -# ifdef HAVE_SYS_DIR_H -# include -# endif -# ifdef HAVE_NDIR_H -# include -# endif -# ifdef HAVE_VMSDIR_H -# include "vmsdir.h" -# endif /* HAVE_VMSDIR_H */ +# include #endif @@ -511,7 +500,6 @@ glob (pattern, flags, errfunc, pglob) oldcount = pglob->gl_pathc + pglob->gl_offs; -#ifndef VMS if ((flags & (GLOB_TILDE|GLOB_TILDE_CHECK)) && dirname[0] == '~') { if (dirname[1] == '\0' || dirname[1] == '/') @@ -679,7 +667,6 @@ glob (pattern, flags, errfunc, pglob) } # endif /* Not Amiga && not WINDOWS32. */ } -#endif /* Not VMS. */ /* Now test whether we looked for "~" or "~NAME". In this case we can give the answer now. */ @@ -1132,7 +1119,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags, { int fnm_flags = ((!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0) | ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0) -#if defined _AMIGA || defined VMS +#if defined _AMIGA || defined __VMS | FNM_CASEFOLD #endif ); diff --git a/lib/savedir.c b/lib/savedir.c index d5ced6cd3..c68547054 100644 --- a/lib/savedir.c +++ b/lib/savedir.c @@ -33,15 +33,7 @@ # include #else # define dirent direct -# if HAVE_SYS_NDIR_H -# include -# endif -# if HAVE_SYS_DIR_H -# include -# endif -# if HAVE_NDIR_H -# include -# endif +# include #endif #include diff --git a/m4/ChangeLog b/m4/ChangeLog index cb3b724f3..6d43370dd 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,17 @@ +2006-07-06 Derek R. Price + and Paul Eggert + + * backupfile.m4 (gl_BACKUPFILE): Check for dirent.h, instead + of invoking obsolescent AC_HEADER_DIRENT macro. + * d-ino.m4 (gl_CHECK_TYPE_STRUCT_DIRENT_D_INO): Likewise. + * d-type.m4 (gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE): Likewise. + * dirfd.m4 (gl_FUNC_DIRFD): Likewise. + * fts.m4 (gl_FUNC_FTS_CORE): Likewise. + * getcwd.m4 (gl_PREREQ_GETCWD): Likewise. + * glob.m4 (gl_PREREQ_GLOB): Likewise. + * savedir.m4 (gl_SAVEDIR): Likewise. + * readdir.m4: Remove; no longer needed. + 2006-07-06 Ralf Wildenhues * _inttypes_h.m4 (gl_INTTYPES_H): Use AC_CHECK_DECLS_ONCE diff --git a/m4/backupfile.m4 b/m4/backupfile.m4 index 3c3f41b5e..04b255626 100644 --- a/m4/backupfile.m4 +++ b/m4/backupfile.m4 @@ -1,5 +1,5 @@ -# backupfile.m4 serial 9 -dnl Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +# backupfile.m4 serial 10 +dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -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]) AC_REQUIRE([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO]) AC_REQUIRE([gl_AC_DOS]) AC_REQUIRE([AC_SYS_LONG_FILE_NAMES]) diff --git a/m4/d-ino.m4 b/m4/d-ino.m4 index 4d2c4dbfe..c86f7bb42 100644 --- a/m4/d-ino.m4 +++ b/m4/d-ino.m4 @@ -1,11 +1,11 @@ -#serial 7 +#serial 8 dnl From Jim Meyering. dnl dnl Check whether struct dirent has a member named d_ino. dnl -# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004 Free Software +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2006 Free Software # Foundation, Inc. # This file is free software; the Free Software Foundation @@ -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])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_INO], #include #ifdef HAVE_DIRENT_H # include -#else /* not HAVE_DIRENT_H */ +#else # define dirent direct -# ifdef HAVE_SYS_NDIR_H -# include -# endif /* HAVE_SYS_NDIR_H */ -# ifdef HAVE_SYS_DIR_H -# include -# endif /* HAVE_SYS_DIR_H */ -# ifdef HAVE_NDIR_H -# include -# endif /* HAVE_NDIR_H */ -#endif /* HAVE_DIRENT_H */ +# include +#endif ], [struct dirent dp; dp.d_ino = 0;], diff --git a/m4/d-type.m4 b/m4/d-type.m4 index 6f3125c7e..f4be1ce62 100644 --- a/m4/d-type.m4 +++ b/m4/d-type.m4 @@ -1,11 +1,11 @@ -#serial 8 +#serial 9 dnl From Jim Meyering. dnl dnl Check whether struct dirent has a member named d_type. dnl -# Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004 Free Software +# Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2006 Free Software # Foundation, Inc. # # This file is free software; the Free Software Foundation @@ -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])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_TYPE], #include #ifdef HAVE_DIRENT_H # include -#else /* not HAVE_DIRENT_H */ +#else # define dirent direct -# ifdef HAVE_SYS_NDIR_H -# include -# endif /* HAVE_SYS_NDIR_H */ -# ifdef HAVE_SYS_DIR_H -# include -# endif /* HAVE_SYS_DIR_H */ -# ifdef HAVE_NDIR_H -# include -# endif /* HAVE_NDIR_H */ -#endif /* HAVE_DIRENT_H */ +# include +#endif ], [struct dirent dp; dp.d_type = 0;], diff --git a/m4/dirfd.m4 b/m4/dirfd.m4 index 7c5cf9608..9e26d5210 100644 --- a/m4/dirfd.m4 +++ b/m4/dirfd.m4 @@ -1,4 +1,4 @@ -#serial 11 -*- Autoconf -*- +#serial 12 -*- Autoconf -*- dnl Find out how to get the file descriptor associated with an open DIR*. @@ -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])dnl dirfd_headers=' #if HAVE_DIRENT_H # include -#else /* not HAVE_DIRENT_H */ +#else # define dirent direct -# if HAVE_SYS_NDIR_H -# include -# endif /* HAVE_SYS_NDIR_H */ -# if HAVE_SYS_DIR_H -# include -# endif /* HAVE_SYS_DIR_H */ -# if HAVE_NDIR_H -# include -# endif /* HAVE_NDIR_H */ -#endif /* HAVE_DIRENT_H */ +# include +#endif ' AC_CHECK_FUNCS(dirfd) AC_CHECK_DECLS([dirfd], , , $dirfd_headers) diff --git a/m4/fts.m4 b/m4/fts.m4 index 61457e3ce..f9f5f6b7b 100644 --- a/m4/fts.m4 +++ b/m4/fts.m4 @@ -1,5 +1,5 @@ -#serial 6 -dnl Copyright (C) 2005 Free Software Foundation, Inc. +#serial 7 +dnl Copyright (C) 2005, 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -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 sys/param.h])dnl ]) diff --git a/m4/getcwd.m4 b/m4/getcwd.m4 index 8f17432b5..730ed42e2 100644 --- a/m4/getcwd.m4 +++ b/m4/getcwd.m4 @@ -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])dnl AC_REQUIRE([gl_CHECK_TYPE_STRUCT_DIRENT_D_INO]) : ]) diff --git a/m4/glob.m4 b/m4/glob.m4 index 690318e22..d57e323eb 100644 --- a/m4/glob.m4 +++ b/m4/glob.m4 @@ -1,5 +1,5 @@ -# glob.m4 serial 3 -dnl Copyright (C) 2005 Free Software Foundation, Inc. +# glob.m4 serial 4 +dnl Copyright (C) 2005, 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -74,7 +74,7 @@ if (glob ("conf*-globtest", 0, NULL, &found) == GLOB_NOMATCH) return 1;]]), 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])dnl AC_CHECK_HEADERS_ONCE([sys/cdefs.h unistd.h])dnl AC_CHECK_FUNCS_ONCE([getlogin_r getpwnam_r])dnl :]) diff --git a/m4/readdir.m4 b/m4/readdir.m4 deleted file mode 100644 index a20117c9e..000000000 --- a/m4/readdir.m4 +++ /dev/null @@ -1,140 +0,0 @@ -#serial 9 - -# Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2006 Free Software -# Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -dnl SunOS's readdir is broken in such a way that rm.c has to add extra code -dnl to test whether a NULL return value really means there are no more files -dnl in the directory. -dnl -dnl And the rm from coreutils-5.0 exposes a similar problem when there -dnl are 338 or more files in a directory on a Darwin-6.5 system -dnl -dnl Detect the problem by creating a directory containing 500 files (254 not -dnl counting . and .. is the minimum for SunOS, 338 for Darwin) and see -dnl if a loop doing `readdir; unlink' removes all of them. -dnl -dnl Define HAVE_WORKING_READDIR if readdir does *not* have this problem. - -dnl Written by Jim Meyering. - -AC_DEFUN([GL_FUNC_READDIR], -[dnl -AC_REQUIRE([AC_HEADER_DIRENT]) -AC_CACHE_CHECK([for working readdir], gl_cv_func_working_readdir, - [dnl - # Arrange for deletion of the temporary directory this test creates, in - # case the test itself fails to delete everything -- as happens on Sunos. - ac_clean_files="$ac_clean_files conf-dir" - - AC_TRY_RUN( -[# include -# include -# include -# include - -# ifdef HAVE_DIRENT_H -# include -# define NLENGTH(direct) (strlen((direct)->d_name)) -# else /* not HAVE_DIRENT_H */ -# define dirent direct -# define NLENGTH(direct) ((direct)->d_namlen) -# ifdef HAVE_SYS_NDIR_H -# include -# endif /* HAVE_SYS_NDIR_H */ -# ifdef HAVE_SYS_DIR_H -# include -# endif /* HAVE_SYS_DIR_H */ -# ifdef HAVE_NDIR_H -# include -# endif /* HAVE_NDIR_H */ -# endif /* HAVE_DIRENT_H */ - -# define DOT_OR_DOTDOT(Basename) \ - (Basename[0] == '.' && (Basename[1] == '\0' \ - || (Basename[1] == '.' && Basename[2] == '\0'))) - -/* Don't try to use replacement mkdir; it wouldn't resolve at link time. */ -# undef mkdir - - static void - create_N_file_dir (const char *dir, size_t n_files) - { - unsigned int i; - - if (mkdir (dir, 0700)) - abort (); - if (chdir (dir)) - abort (); - - for (i = 0; i < n_files; i++) - { - char file_name[4]; - FILE *out; - - sprintf (file_name, "%03d", i); - out = fopen (file_name, "w"); - if (!out) - abort (); - if (fclose (out) == EOF) - abort (); - } - - if (chdir ("..")) - abort (); - } - - static void - remove_dir (const char *dir) - { - DIR *dirp; - - if (chdir (dir)) - abort (); - - dirp = opendir ("."); - if (dirp == NULL) - abort (); - - while (1) - { - struct dirent *dp = readdir (dirp); - if (dp == NULL) - break; - - if (DOT_OR_DOTDOT (dp->d_name)) - continue; - - if (unlink (dp->d_name)) - abort (); - } - closedir (dirp); - - if (chdir ("..")) - abort (); - - if (rmdir (dir)) - exit (1); - } - - int - main () - { - const char *dir = "conf-dir"; - create_N_file_dir (dir, 500); - remove_dir (dir); - exit (0); - }], - gl_cv_func_working_readdir=yes, - gl_cv_func_working_readdir=no, - gl_cv_func_working_readdir=no)]) - - if test $gl_cv_func_working_readdir = yes; then - AC_DEFINE(HAVE_WORKING_READDIR, 1, - [Define if readdir is found to work properly in some unusual cases. ]) - fi -]) diff --git a/m4/savedir.m4 b/m4/savedir.m4 index 0c0ee0928..e20712353 100644 --- a/m4/savedir.m4 +++ b/m4/savedir.m4 @@ -1,4 +1,4 @@ -# savedir.m4 serial 5 +# savedir.m4 serial 7 dnl Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -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])dnl ]) -- 2.11.0