bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

avoid creating sys/time.h replacement when possible


From: Bruno Haible
Subject: avoid creating sys/time.h replacement when possible
Date: Sun, 28 Jan 2007 17:35:05 +0100 (MET)
User-agent: KMail/1.5.4

Hi Paul, Jim,

Most developers are using glibc systems nowadays. When gnulib creates many
replacement header files on such systems, it makes look gnulib a bit
ridiculous. So can we avoid to create a header file when it's easy to do so?
Here is a proposed patch.

2007-01-28  Bruno Haible  <address@hidden>

        * modules/sys_time (Makefile.am): Build sys/time.h only when it's the
        value of $(SYS_TIME_H).
        * m4/sys_time_h.m4 (gl_HEADER_SYS_TIME_H_BODY): Set SYS_TIME_H.
        * m4/gettimeofday.m4 (gl_FUNC_GETTIMEOFDAY,
        gl_FUNC_GETTIMEOFDAY_CLOBBER): Set SYS_TIME_H when setting
        GETTIMEOFDAY_REPLACEMENT to 1.

--- modules/sys_time    22 Jan 2007 23:07:42 -0000      1.4
+++ modules/sys_time    28 Jan 2007 16:24:14 -0000
@@ -13,7 +13,7 @@
 AC_PROG_MKDIR_P
 
 Makefile.am:
-BUILT_SOURCES += sys/time.h
+BUILT_SOURCES += $(SYS_TIME_H)
 
 # We need the following in order to create <sys/time.h> when the system
 # doesn't have one that works with the given compiler.
--- m4/sys_time_h.m4    19 Jan 2007 02:04:14 -0000      1.3
+++ m4/sys_time_h.m4    28 Jan 2007 16:24:13 -0000
@@ -52,4 +52,10 @@
   dnl Assume POSIX behavior unless another module says otherwise.
   GETTIMEOFDAY_REPLACEMENT=0
   AC_SUBST([GETTIMEOFDAY_REPLACEMENT])
+  if test $HAVE_SYS_TIME_H = 0 || test $HAVE_STRUCT_TIMEVAL = 0; then
+    SYS_TIME_H='sys/time.h'
+  else
+    SYS_TIME_H=
+  fi
+  AC_SUBST([SYS_TIME_H])
 ])
--- m4/gettimeofday.m4  19 Jan 2007 02:00:37 -0000      1.16
+++ m4/gettimeofday.m4  28 Jan 2007 16:24:13 -0000
@@ -32,6 +32,7 @@
 
   if test $gl_cv_func_gettimeofday_posix_signature != yes; then
     GETTIMEOFDAY_REPLACEMENT=1
+    SYS_TIME_H='sys/time.h'
     if test $gl_cv_func_gettimeofday_clobber != yes; then
       AC_LIBOBJ(gettimeofday)
       gl_PREREQ_GETTIMEOFDAY
@@ -77,6 +78,7 @@
 
  if test $gl_cv_func_gettimeofday_clobber = yes; then
    GETTIMEOFDAY_REPLACEMENT=1
+   SYS_TIME_H='sys/time.h'
    gl_GETTIMEOFDAY_REPLACE_LOCALTIME
    AC_DEFINE([GETTIMEOFDAY_CLOBBERS_LOCALTIME], 1,
      [Define if gettimeofday clobbers the localtime buffer.])





reply via email to

[Prev in Thread] Current Thread [Next in Thread]