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 configuration tweak


libf2c does not compile on NetBSD 1.4. The reason is that 1.4 is old
enough that it does not understand _XOPEN_SOURCE 500L, and does
instead treat it as an older version of the standard that does not
have 'fd_set'.

The reason for defining _XOPEN_SOURCE 500L is to get 64-bit file size
support. NetBSD handle 64-bit file sizes per default, so there is no
need to define _XOPEN_SOURCE. The patch below tests whether _XOPEN_SOURCE
may be defined before actually defining it.

Bootstrapped and regtested on i386-unknown-netbsdelf1.6 (where it
is safe to define it) and i386-unknown-netbsd1.4.3 (where it must not
be defined.)

OK to commit?

   /Krister


2002-10-18  Krister Walfridsson  <cato@df.lth.se>

	* libU77/configure.in (_XOPEN_SOURCE, _XOPEN_SOURCE_EXTENDED,
          __EXTENSIONS__, _FILE_OFFSET_BITS): Check that _XOPEN_SOURCE 500L
          may be defined before defining these.
	* libU77/configure: Regenerate.
	* libI77/configure.in (_XOPEN_SOURCE, _XOPEN_SOURCE_EXTENDED,
          __EXTENSIONS__, _FILE_OFFSET_BITS): Check that _XOPEN_SOURCE 500L
          may be defined before defining these.
	* libI77/configure: Regenerate.


Index: libU77/configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libf2c/libU77/configure.in,v
retrieving revision 1.14
diff -c -3 -p -r1.14 configure.in
*** libU77/configure.in	1 Jun 2002 01:53:52 -0000	1.14
--- libU77/configure.in	18 Oct 2002 19:15:42 -0000
*************** AC_PREREQ(2.12.1)
*** 23,39 ****
  AC_INIT(access_.c)
  AC_CONFIG_HEADER(config.h:config.hin)

- # These defines are necessary to get 64-bit file size support.
-
- 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.
- AC_DEFINE(__EXTENSIONS__, 1, [Solaris extensions])
- AC_DEFINE(_FILE_OFFSET_BITS, 64, [Get 64-bit file size support])
-
- dnl Checks for programs.
-
  dnl FIXME AC_PROG_CC wants CC to be able to link things, but it may
  dnl not be able to.
  define([AC_PROG_CC_WORKS],[])
--- 23,28 ----
*************** define([AC_PROG_CC_WORKS],[])
*** 41,46 ****
--- 30,55 ----
  # For g77 we'll set CC to point at the built gcc, but this will get it into
  # the makefiles
  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.
+   AC_DEFINE(__EXTENSIONS__, 1, [Solaris extensions])
+   AC_DEFINE(_FILE_OFFSET_BITS, 64, [Get 64-bit file size support])
+ fi
+
+ dnl Checks for programs.

  LIBTOOL='$(SHELL) ../libtool'
  AC_SUBST(LIBTOOL)
Index: libI77/configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libf2c/libI77/configure.in,v
retrieving revision 1.15
diff -c -3 -p -r1.15 configure.in
*** libI77/configure.in	1 Jun 2002 01:53:51 -0000	1.15
--- libI77/configure.in	18 Oct 2002 19:15:42 -0000
*************** AC_PREREQ(2.12.1)
*** 23,40 ****
  AC_INIT(ftell_.c)
  AC_CONFIG_HEADER(config.h)

- # These defines are necessary to get 64-bit file size support.
-
- 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.
- AC_DEFINE(__EXTENSIONS__, 1, [Solaris extensions])
- AC_DEFINE(_FILE_OFFSET_BITS, 64, [Get 64-bit file size support])
- AC_DEFINE(_LARGEFILE_SOURCE, 1, [Define for HP-UX ftello and fseeko extension.])
-
- dnl Checks for programs.
-
  dnl FIXME AC_PROG_CC wants CC to be able to link things, but it may
  dnl not be able to.
  define([AC_PROG_CC_WORKS],[])
--- 23,28 ----
*************** define([AC_PROG_CC_WORKS],[])
*** 42,47 ****
--- 30,56 ----
  # For g77 we'll set CC to point at the built gcc, but this will get it into
  # the makefiles
  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.
+   AC_DEFINE(__EXTENSIONS__, 1, [Solaris extensions])
+   AC_DEFINE(_FILE_OFFSET_BITS, 64, [Get 64-bit file size support])
+   AC_DEFINE(_LARGEFILE_SOURCE, 1, [Define for HP-UX ftello and fseeko extension.])
+ fi
+
+ dnl Checks for programs.

  LIBTOOL='$(SHELL) ../libtool'
  AC_SUBST(LIBTOOL)


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