bug-gnulib
[Top][All Lists]
Advanced

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

extensions.m4 patch for Solaris 10 Sun C 5.7 c89 and some -D options


From: Paul Eggert
Subject: extensions.m4 patch for Solaris 10 Sun C 5.7 c89 and some -D options
Date: Sun, 05 Feb 2006 21:29:38 -0800
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

In <http://lists.gnu.org/archive/html/bug-bison/2005-09/msg00021.html>
Nelson H. F. Beebe summarized the following problem with building
Bison 2.1 on Solaris 10 with Sun C 5.7 c89 -D_XOPEN_SOURCE
-D_XOPEN_SOURCE_EXTENDED:

/opt/SUNWspro/bin/c89 -DHAVE_CONFIG_H -I. -I. -I..   -I/usr/local/include  
-D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1 -I/usr/local/include -c subpipe.c
"/usr/include/sys/types.h", line 487: warning: useless declaration
"/usr/include/sys/types.h", line 487: warning: typedef declares no type name
"/usr/include/sys/regset.h", line 304: syntax error before or at: uint64_t
"/usr/include/sys/regset.h", line 307: syntax error before or at: uint64_t
c89: acomp failed for subpipe.c

I tracked this down, I think, to a bug in Solaris 10's system headers
when compiled with c89 -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED
-D__EXTENSIONS__.  With that combination, you cannot compile a simple
file containing only "#include <stdlib.h>" because types like uint64_t
are used without being defined.

I installed this patch to work around the problem: it causes
"configure" to not defined __EXTENSIONS__ in this case.  This
is installed into both gnulib and coreutils.

2006-02-05  Paul Eggert  <address@hidden>

        * extensions.m4 (gl_USE_SYSTEM_EXTENSIONS): Don't #define
        __EXTENSIONS__ if this causes compilation to fail.  Problem
        reported by Nelson H. F. Beebe with Solaris 10 and Sun C 5.7
        c89 -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED.

--- extensions.m4.~1.7.~        2005-05-26 10:33:40.000000000 -0700
+++ extensions.m4       2006-02-05 20:56:45.000000000 -0800
@@ -1,6 +1,6 @@
 # Enable extensions on systems that normally disable them.
 
-# Copyright (C) 2003 Free Software Foundation, Inc.
+# Copyright (C) 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.
@@ -25,6 +25,15 @@ AC_DEFUN([gl_USE_SYSTEM_EXTENSIONS], [
 #ifndef _POSIX_PTHREAD_SEMANTICS
 # undef _POSIX_PTHREAD_SEMANTICS
 #endif])
-  AC_DEFINE([__EXTENSIONS__])
+  AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
+    [ac_cv_safe_to_define___extensions__],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM([
+         #define __EXTENSIONS__ 1
+         AC_INCLUDES_DEFAULT])],
+       [ac_cv_safe_to_define___extensions__=yes],
+       [ac_cv_safe_to_define___extensions__=no])])
+  test $ac_cv_safe_to_define___extensions__ == yes &&
+    AC_DEFINE([__EXTENSIONS__])
   AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
 ])




reply via email to

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