- applied in cvs

This commit is contained in:
Bryce Denney 2002-10-11 13:21:34 +00:00
parent 909b3104d9
commit be8db98f49

View File

@ -1,118 +0,0 @@
----------------------------------------------------------------------
Patch name: patch.detect-largefiles
Author: Bryce Denney
Date: Fri Oct 11 00:48:52 EDT 2002
Detailed description:
This patch replaces the standard AC_SYS_LARGEFILE macro with the one
that Vadim Zeitlin wrote for wxWindows. The standard one does not
add largefiles arguments for gcc/linux, but Vadim's does the right
thing.
I have asked Vadim for permission to include his test in the Bochs
distribution.
Patch was created with:
cvs diff -u
Apply patch to what version:
cvs checked out on DATE, release version VER
Instructions:
To patch, go to main bochs directory.
Type "patch -p0 < THIS_PATCH_FILE".
----------------------------------------------------------------------
Index: aclocal.m4
===================================================================
RCS file: aclocal.m4
diff -N aclocal.m4
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ aclocal.m4 11 Oct 2002 04:28:14 -0000
@@ -0,0 +1,58 @@
+dnl WX_SYS_LARGEFILE_TEST
+dnl
+dnl NB: original autoconf test was checking if compiler supported 6 bit off_t
+dnl arithmetic properly but this failed miserably with gcc under Linux
+dnl whereas the system still supports 64 bit files, so now simply check
+dnl that off_t is big enough
+define(WX_SYS_LARGEFILE_TEST,
+[typedef struct {
+ unsigned int field: sizeof(off_t) == 8;
+} wxlf;
+])
+
+
+dnl WX_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR)
+define(WX_SYS_LARGEFILE_MACRO_VALUE,
+[
+ AC_CACHE_CHECK([for $1 value needed for large files], [$3],
+ [
+ AC_TRY_COMPILE([#define $1 $2
+ #include <sys/types.h>],
+ WX_SYS_LARGEFILE_TEST,
+ [$3=$2],
+ [$3=no])
+ ]
+ )
+
+ if test "$$3" != no; then
+ wx_largefile=yes
+ AC_DEFINE_UNQUOTED([$1], [$$3])
+ fi
+])
+
+dnl AC_SYS_LARGEFILE
+dnl ----------------
+dnl By default, many hosts won't let programs access large files;
+dnl one must use special compiler options to get large-file access to work.
+dnl For more details about this brain damage please see:
+dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
+AC_DEFUN([AC_SYS_LARGEFILE],
+[AC_ARG_ENABLE(largefile,
+ [ --disable-largefile omit support for large files])
+if test "$enable_largefile" != no; then
+ dnl _FILE_OFFSET_BITS==64 is needed for Linux, Solaris, ...
+ dnl _LARGE_FILES -- for AIX
+ wx_largefile=no
+ WX_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64, ac_cv_sys_file_offset_bits)
+ if test "x$wx_largefile" != "xyes"; then
+ WX_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1, ac_cv_sys_large_files)
+ fi
+
+ AC_MSG_CHECKING(if large file support is available)
+ if test "x$wx_largefile" = "xyes"; then
+ AC_DEFINE(HAVE_LARGEFILE_SUPPORT)
+ fi
+ AC_MSG_RESULT($wx_largefile)
+fi
+])
+
Index: configure.in
===================================================================
RCS file: /cvsroot/bochs/bochs/configure.in,v
retrieving revision 1.149
diff -u -r1.149 configure.in
--- configure.in 11 Oct 2002 01:11:10 -0000 1.149
+++ configure.in 11 Oct 2002 04:28:23 -0000
@@ -132,6 +132,22 @@
# We may need to do something similar. See aclocal.m4 in wxWindows sources, at
# http://cvs.wxwindows.org/cgi-bin/viewcvs.cgi/wxWindows/aclocal.m4
+dnl we need to define _FILE_OFFSET_BITS or _LARGE_FILES on the compiler command
+dnl line because otherwise the system headers risk being included before
+dnl config.h which defines these constants leading to inconsistent
+dnl sizeof(off_t) in different source files of the same program and linking
+dnl problems
+if test "x$wx_largefile" = "xyes"; then
+ if test "x$ac_cv_sys_file_offset_bits" = "x64"; then
+ BX_LARGEFILE_FLAGS="-D_FILE_OFFSET_BITS=64 -D_LARGE_FILES"
+ else
+ BX_LARGEFILE_FLAGS="-D_LARGE_FILES"
+ fi
+ CFLAGS="$CFLAGS $BX_LARGEFILE_FLAGS"
+ CXXFLAGS="$CXXFLAGS $BX_LARGEFILE_FLAGS"
+ CPPFLAGS="$CPPFLAGS $BX_LARGEFILE_FLAGS"
+fi
+
AC_MSG_CHECKING(for struct timeval)
AC_TRY_COMPILE([#include <sys/time.h>],
[struct timeval x;],