bug-coreutils
[Top][All Lists]
Advanced

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

Re: coreutils-5.0.90 patch 1: build feedback


From: Paul Eggert
Subject: Re: coreutils-5.0.90 patch 1: build feedback
Date: 05 Aug 2003 16:41:14 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

"Nelson H. F. Beebe" <address@hidden> writes:

> Machinetype:            Sun Sun Blade 2000 (1015MHz);  Solaris 2.9
> Remote c89 version:     cc: Sun C 5.5 Patch 112760-01 2003/05/18
> Remote CC version:      CC: Sun C++ 5.5 Patch 113817-01 2003/05/18
> Configure environment:  CC=c89 CFLAGS="-xO5 -dalign -xlibmil -xcg92 
> -xsafe=mem" CXX=CC CXXFLAGS=-xO5 LDFLAGS=-R/usr/local/lib 
> 
> c89 -DHAVE_CONFIG_H -I. -I. -I..  -I.. -I. -I../lib -I../lib 
> -I/usr/local/include  -xO5 -dalign -xlibmil -xcg92 -xsafe=mem -c `test -f 
> 'date.c' || echo './'`date.c
> "make[3]: Leaving directory `/local/build/coreutils-5.0.90.1/src'
> ../lib/timespec.h", line 39: (struct) tag redeclared: timespec
> c89: acomp failed for date.c
> make[3]: *** [date.o] Error 2

The problem is that c89 is pedantic, and it disables extensions like
'struct timespec' in some cases but not in others.  For example,
'#include <sys/stat.h>' makes 'struct timespec' visible, but '#include
<time.h>' does not.  configure looks for 'struct timespec' in <time.h>
and <sys/time.h>, but not in all the other places that Solaris defines
it.

We could spend some time hacking on coreutils to make it portable to
pedantic Solaris, but I don't think it's worth the bother.  It's much
easier simply to __EXTENSIONS__, which is the Solaris way to enable
its extensions even when compiling with 'c89'.

Some Solaris extensions are the same as GNU extensions, so perhaps the
simplest way to fix this is to modify AC_GNU_SOURCE to enable GNU
extensions on Solaris as well as on GNU systems.  Here's a patch for
that.  I'll also submit the corresponding patches to bug-gnulib.

2003-08-05  Paul Eggert  <address@hidden>

        * m4/gnu-source.m4: New file, taken from gnulib, with support
        added for __EXTENSIONS__ a la Solaris.
        * m4/jm-macros.m4 (jm_CHECK_ALL_TYPES): Call gl_TIMESPEC rather
        than jm_CHECK_TYPE_STRUCT_TIMESPEC.
        * m4/st_mtim.m4: Sync with gnulib (white space change only).
        * m4/timespec.m4: Sync with gnulib, except also require
        AC_GNU_SOURCE.

--- /dev/null   Tue Mar 18 13:55:57 2003
+++ m4/gnu-source.m4    Tue Aug  5 15:29:29 2003
@@ -0,0 +1,17 @@
+# AC_GNU_SOURCE
+# --------------
+AC_DEFUN([AC_GNU_SOURCE],
+[AH_VERBATIM([_GNU_SOURCE],
+[/* Enable GNU extensions on systems that have them.  */
+#ifndef _GNU_SOURCE
+# undef _GNU_SOURCE
+#endif
+/* Enable many GNU extensions on Solaris.  */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif])dnl
+AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
+AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
+AC_DEFINE([_GNU_SOURCE])
+AC_DEFINE([__EXTENSIONS__])
+])
Index: m4/jm-macros.m4
===================================================================
RCS file: /cvsroot/coreutils/coreutils/m4/jm-macros.m4,v
retrieving revision 1.172
diff -p -u -r1.172 jm-macros.m4
--- m4/jm-macros.m4     20 Jul 2003 05:35:38 -0000      1.172
+++ m4/jm-macros.m4     5 Aug 2003 22:57:16 -0000
@@ -323,7 +323,7 @@ AC_DEFUN([jm_CHECK_ALL_TYPES],
   AC_REQUIRE([AC_HEADER_STAT])
   AC_REQUIRE([AC_STRUCT_ST_MTIM_NSEC])
   AC_REQUIRE([AC_STRUCT_ST_DM_MODE])
-  AC_REQUIRE([jm_CHECK_TYPE_STRUCT_TIMESPEC])
+  AC_REQUIRE([gl_TIMESPEC])
 
   AC_REQUIRE([AC_TYPE_GETGROUPS])
   AC_REQUIRE([AC_TYPE_MODE_T])
Index: m4/st_mtim.m4
===================================================================
RCS file: /cvsroot/coreutils/coreutils/m4/st_mtim.m4,v
retrieving revision 1.5
diff -p -u -r1.5 st_mtim.m4
--- m4/st_mtim.m4       12 Aug 2001 13:26:01 -0000      1.5
+++ m4/st_mtim.m4       5 Aug 2003 22:57:16 -0000
@@ -1,4 +1,4 @@
-#serial 5
+#serial 6
 
 dnl From Paul Eggert.
 
@@ -26,7 +26,7 @@ AC_DEFUN([AC_STRUCT_ST_MTIM_NSEC],
   if test $ac_cv_struct_st_mtim_nsec != no; then
     AC_DEFINE_UNQUOTED(ST_MTIM_NSEC, $ac_cv_struct_st_mtim_nsec,
       [Define to be the nanoseconds member of struct stat's st_mtim,
-   if it exists.])
+       if it exists.])
   fi
  ]
 )
Index: m4/timespec.m4
===================================================================
RCS file: /cvsroot/coreutils/coreutils/m4/timespec.m4,v
retrieving revision 1.5
diff -p -u -r1.5 timespec.m4
--- m4/timespec.m4      17 Sep 2001 21:44:03 -0000      1.5
+++ m4/timespec.m4      5 Aug 2003 22:57:16 -0000
@@ -1,13 +1,30 @@
-#serial 5
+#serial 7
 
 dnl From Jim Meyering
 
+AC_DEFUN([gl_TIMESPEC],
+[
+  dnl Prerequisites of lib/timespec.h.
+  AC_REQUIRE([AC_GNU_SOURCE])
+  AC_REQUIRE([AC_HEADER_TIME])
+  AC_CHECK_HEADERS_ONCE(sys/time.h)
+  jm_CHECK_TYPE_STRUCT_TIMESPEC
+  AC_STRUCT_ST_MTIM_NSEC
+
+  dnl Persuade glibc <time.h> to declare nanosleep().
+  AC_REQUIRE([AC_GNU_SOURCE])
+
+  AC_CHECK_DECLS(nanosleep, , , [#include <time.h>])
+])
+
 dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
 dnl in time.h or sys/time.h.
 
 AC_DEFUN([jm_CHECK_TYPE_STRUCT_TIMESPEC],
 [
+  AC_REQUIRE([AC_GNU_SOURCE])
   AC_REQUIRE([AC_HEADER_TIME])
+  AC_CHECK_HEADERS_ONCE(sys/time.h)
   AC_CACHE_CHECK([for struct timespec], fu_cv_sys_struct_timespec,
     [AC_TRY_COMPILE(
       [




reply via email to

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