This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH (libf2c, mainline & 3.3): Support FreeBSD 5 system headers


I don't know exactly when this happened again (from the looks of
<stdio.h>'s ChangeLogs, around 7/15/02?) but I do know I fixed this
exact issue 1/4/02 (with a kludge) and 1/15/02 (better) for FreeBSD 5
once before: fseeko & ftello are found by autoconf's link-only
check but not during the library compilation.  These prototypes:

	int      fseeko(FILE *, __off_t, int);
	__off_t  ftello(FILE *);

are only visible from the system headers when _XOPEN_SOURCE >= 600L.
(Thus, basically, I wish we had gone with Andreas's more aggressive
patch: http://gcc.gnu.org/ml/gcc-patches/2003-02/msg00110.html ;-)

I think it is safe to bump _XOPEN_SOURCE to 600 since system headers
should be using a >= test never a == test to enable features from SUS
based on that macros value (I believe this based on reading a few
system's headers plus the standard itself).

_XOPEN_SOURCE == 600 implies POSIX 2001 support exposed in headers
(this is according to the SUS standard).  On FreeBSD, you either have
to request POSIX 2001 support to see fseeko & ftello from the headers,
or you have to get the default (which is expose everything).  Since
those functions were available in SUS v2 (I think), I don't know why
both glibc and FreeBSD libc wait to expose it in SUS v3 only.

Rebuilt libf2c from scratch on i386-unknown-freebsd5.0.  OK to commit
on mainline and then move to 3.3?  Fixes io1.f execution FAIL (six
copies).  (The remaining 980520-1.f FAIL appears common to other ports.)

	* libI77/configure.in (_XOPEN_SOURCE): Bump to 600.
	* libI77/configure: Regenerate. 
	* libU77/configure.in (_XOPEN_SOURCE): Bump to 600.
	* libU77/configure: Regenerate. 

Index: libf2c/libI77/configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libf2c/libI77/configure.in,v
retrieving revision 1.16
diff -c -r1.16 configure.in
*** libf2c/libI77/configure.in	29 Nov 2002 17:53:44 -0000	1.16
--- libf2c/libI77/configure.in	19 Apr 2003 10:08:36 -0000
***************
*** 32,47 ****
  AC_PROG_CC
  
  # These defines are necessary to get 64-bit file size support.
! # NetBSD 1.4 header files does not support XOPEN_SOURCE == 500, but it
  # handles 64-bit file sizes without needing these defines.
  AC_MSG_CHECKING(whether _XOPEN_SOURCE may be defined)
! AC_TRY_COMPILE([#define _XOPEN_SOURCE 500L
  #include <unistd.h>],,
  may_use_xopen_source=yes,
  may_use_xopen_source=no)
  AC_MSG_RESULT($may_use_xopen_source)
  if test $may_use_xopen_source = yes; then
!   AC_DEFINE(_XOPEN_SOURCE, 500L, [Get Single Unix Specification semantics])
    # The following is needed by irix6.2 so that struct timeval is declared.
    AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, [Get Single Unix Specification semantics])
    # The following is needed by Solaris2.5.1 so that struct timeval is declared.
--- 32,47 ----
  AC_PROG_CC
  
  # These defines are necessary to get 64-bit file size support.
! # NetBSD 1.4 header files does not support XOPEN_SOURCE == 600, but it
  # handles 64-bit file sizes without needing these defines.
  AC_MSG_CHECKING(whether _XOPEN_SOURCE may be defined)
! AC_TRY_COMPILE([#define _XOPEN_SOURCE 600L
  #include <unistd.h>],,
  may_use_xopen_source=yes,
  may_use_xopen_source=no)
  AC_MSG_RESULT($may_use_xopen_source)
  if test $may_use_xopen_source = yes; then
!   AC_DEFINE(_XOPEN_SOURCE, 600L, [Get Single Unix Specification semantics])
    # The following is needed by irix6.2 so that struct timeval is declared.
    AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, [Get Single Unix Specification semantics])
    # The following is needed by Solaris2.5.1 so that struct timeval is declared.
Index: libf2c/libU77/configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libf2c/libU77/configure.in,v
retrieving revision 1.16
diff -c -r1.16 configure.in
*** libf2c/libU77/configure.in	4 Feb 2003 10:03:38 -0000	1.16
--- libf2c/libU77/configure.in	19 Apr 2003 10:08:36 -0000
***************
*** 32,47 ****
  AC_PROG_CC
  
  # These defines are necessary to get 64-bit file size support.
! # NetBSD 1.4 header files does not support XOPEN_SOURCE == 500, but it
  # handles 64-bit file sizes without needing these defines.
  AC_MSG_CHECKING(whether _XOPEN_SOURCE may be defined)
! AC_TRY_COMPILE([#define _XOPEN_SOURCE 500L
  #include <unistd.h>],,
  may_use_xopen_source=yes,
  may_use_xopen_source=no)
  AC_MSG_RESULT($may_use_xopen_source)
  if test $may_use_xopen_source = yes; then
!   AC_DEFINE(_XOPEN_SOURCE, 500L, [Get Single Unix Specification semantics])
    # The following is needed by irix6.2 so that struct timeval is declared.
    AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, [Get Single Unix Specification semantics])
    # The following is needed by Solaris2.5.1 so that struct timeval is declared.
--- 32,47 ----
  AC_PROG_CC
  
  # These defines are necessary to get 64-bit file size support.
! # NetBSD 1.4 header files does not support XOPEN_SOURCE == 600, but it
  # handles 64-bit file sizes without needing these defines.
  AC_MSG_CHECKING(whether _XOPEN_SOURCE may be defined)
! AC_TRY_COMPILE([#define _XOPEN_SOURCE 600L
  #include <unistd.h>],,
  may_use_xopen_source=yes,
  may_use_xopen_source=no)
  AC_MSG_RESULT($may_use_xopen_source)
  if test $may_use_xopen_source = yes; then
!   AC_DEFINE(_XOPEN_SOURCE, 600L, [Get Single Unix Specification semantics])
    # The following is needed by irix6.2 so that struct timeval is declared.
    AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, [Get Single Unix Specification semantics])
    # The following is needed by Solaris2.5.1 so that struct timeval is declared.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]