summaryrefslogtreecommitdiff
path: root/src/system.h
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2006-09-05 22:57:29 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2006-09-05 22:57:29 +0000
commit2daf7bfa36f4f44692330e1102ebe004198bbc0f (patch)
tree76b8207f43af34c90cc5be0099b845e2cf9e4263 /src/system.h
parenta204b37fb2d871df551d9bf6fb722d8f269a0754 (diff)
downloaddiffutils-2daf7bfa36f4f44692330e1102ebe004198bbc0f.tar.gz
Modernize bootstrap procedure to match current gnulib.
* bootstrap: Sync with coreutils bootstrap, except check that the directory build-aux exists before trying to copy to it. * bootstrap.conf: New file. (gnulib_modules): Add config-h, dup2, extensions, fcntl, fdl, stat-macros, unistd. * configure.ac: Invoke gl_EARLY and gl_INIT rather than GNULIB_AUTOCONF_SNIPPET. (AC_CONFIG_HEADER): Rename config.h to lib/config.h. (AC_CHECK_HEADERS_ONCE): Don't check for fcntl.h, locale.h, sys/file.h, unistd.h. We now use the fcntl and unistd modules, and locale.h can be assumed for any C89 compiler. (DIFFUTILS_PREREQUISITES): Remove. No longer needed now that we use the stdint module. (AC_CHECK_FUNCS_ONCE): Remove dup2, which is no longer needed now that we use the dup2 module. (AM_GNU_GETTEXT): Use need-formatstring-macros, and ... (AM_GNU_GETTEXT_VERSION): specify version 0.15 instead of 0.14.5, to be consistent with coreutils. * lib/Makefile.am (noinst_LIBRARIES): (lib_SOURCES, libdiffutils_a_LIBADD): (libdiffutils_a_DEPENDENCIES, BUILT_SOURCES, EXTRA_DIST): (MOSTLYCLEANFILES): Remove; now computed automatically. (noinst_HEADERS, libdiffutils_a_SOURCES): Just append our special files now. * lib/cmpbuf.c: Include config.h unconditionally, since we no longer define HAVE_CONFIG_H. * lib/prepargs.c: Likewise. * src/Makefile.am (LDADD): Use $(LIBINTL), not @LIBINTL@. (diff_LDADD): Use $(LIB_CLOCK_GETTIME), not @LIB_CLOCK_GETTIME@. * src/dir.c (dir_read): Use _D_EXACT_NAMLEN, not NAMELEN. * src/system.h (volatile): Remove, since we assume C89 or better. Include stat-macros.h. (S_IRWXU, S_IRWXG, S_IRWXO, S_IRUSR, S_IWUSR): Remove, since we now use stat-macros.h. (SEEK_SET, SEEK_CUR): Remove, since we assume C89 or better. Include unistd.h unconditionally, since we use unistd. Likewise for fcntl.h. (dup2): Remove, since we now use dup2. (O_RDONLY, O_RWDR, O_BINARY): Remove, since we now use fcntl. Include dirent.h unconditionally. (NAMLEN): Remove, replacing with.... (_D_EXACT_NAMLEN): New macro. Include inttypes.h unconditionally. (PTRDIFF_MAX, SIZE_MAX, UINTMAX_MAX, strtoumax): Remove, since we now use inttypes. Include locale.h unconditionally. (setlocale): Remove, since we now assume locale.h.
Diffstat (limited to 'src/system.h')
-rw-r--r--src/system.h124
1 files changed, 15 insertions, 109 deletions
diff --git a/src/system.h b/src/system.h
index dde3619..91d358e 100644
--- a/src/system.h
+++ b/src/system.h
@@ -34,36 +34,23 @@
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6) || __STRICT_ANSI__
# define __attribute__(x)
#endif
-#if defined const && !defined volatile
-# define volatile
-#endif
#include <verify.h>
#include <sys/types.h>
-#include <sys/stat.h>
-#ifndef S_IRWXU
-# define S_IRWXU 0700
-#endif
-#ifndef S_IRWXG
-# define S_IRWXG 0070
-#endif
-#ifndef S_IRWXO
-# define S_IRWXO 0007
-#endif
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
+#include <sys/stat.h>
+#include "stat-macros.h"
-#ifndef SEEK_SET
-# define SEEK_SET 0
-#endif
-#ifndef SEEK_CUR
-# define SEEK_CUR 1
+#ifndef STAT_BLOCKSIZE
+# if HAVE_STRUCT_STAT_ST_BLKSIZE
+# define STAT_BLOCKSIZE(s) ((s).st_blksize)
+# else
+# define STAT_BLOCKSIZE(s) (8 * 1024)
+# endif
#endif
+#include <unistd.h>
#ifndef STDIN_FILENO
# define STDIN_FILENO 0
#endif
@@ -74,49 +61,9 @@
# define STDERR_FILENO 2
#endif
+#include <fcntl.h>
#include <time.h>
-#if HAVE_FCNTL_H
-# include <fcntl.h>
-#else
-# if HAVE_SYS_FILE_H
-# include <sys/file.h>
-# endif
-#endif
-
-#if !HAVE_DUP2
-# define dup2(f, t) (close (t), fcntl (f, F_DUPFD, t))
-#endif
-
-#ifndef O_RDONLY
-# define O_RDONLY 0
-#endif
-#ifndef O_RDWR
-# define O_RDWR 2
-#endif
-#ifndef S_IRUSR
-# define S_IRUSR 0400
-#endif
-#ifndef S_IWUSR
-# define S_IWUSR 0200
-#endif
-
-/* For systems that distinguish between text and binary I/O.
- O_BINARY is usually declared in fcntl.h */
-#if !defined O_BINARY && defined _O_BINARY
- /* For MSC-compatible compilers. */
-# define O_BINARY _O_BINARY
-#endif
-
-#ifdef __BEOS__
- /* BeOS 5 has O_BINARY, but it has no effect. */
-# undef O_BINARY
-#endif
-
-#ifndef O_BINARY
-# define O_BINARY 0
-#endif
-
#if HAVE_SYS_WAIT_H
# include <sys/wait.h>
#endif
@@ -127,53 +74,18 @@
# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
#endif
-#ifndef STAT_BLOCKSIZE
-# if HAVE_STRUCT_STAT_ST_BLKSIZE
-# define STAT_BLOCKSIZE(s) ((s).st_blksize)
-# else
-# define STAT_BLOCKSIZE(s) (8 * 1024)
-# endif
-#endif
-
-#if HAVE_DIRENT_H
-# include <dirent.h>
-# define NAMLEN(dirent) strlen ((dirent)->d_name)
-#else
-# 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 <dirent.h>
+#ifndef _D_EXACT_NAMLEN
+# define _D_EXACT_NAMLEN(dp) strlen ((dp)->d_name)
#endif
#include <stdlib.h>
#define EXIT_TROUBLE 2
#include <limits.h>
-
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#endif
-#ifndef PTRDIFF_MAX
-# define PTRDIFF_MAX TYPE_MAXIMUM (ptrdiff_t)
-#endif
-#ifndef SIZE_MAX
-# define SIZE_MAX TYPE_MAXIMUM (size_t)
-#endif
-#ifndef UINTMAX_MAX
-# define UINTMAX_MAX TYPE_MAXIMUM (uintmax_t)
-#endif
-#if ! HAVE_STRTOUMAX && ! defined strtoumax
-uintmax_t strtoumax (char const *, char **, int);
-#endif
-
+#include <locale.h>
#include <stddef.h>
+#include <inttypes.h>
#include <string.h>
#if ! HAVE_STRCASECOLL
@@ -187,12 +99,6 @@ uintmax_t strtoumax (char const *, char **, int);
int strcasecmp (char const *, char const *);
#endif
-#if HAVE_LOCALE_H
-# include <locale.h>
-#else
-# define setlocale(category, locale)
-#endif
-
#include <gettext.h>
#define _(msgid) gettext (msgid)