autoconf-patches
[Top][All Lists]
Advanced

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

Re: _XOPEN_SOURCE=500 breaks at least OSF1 V5.0 [Re: largefiles


From: Paul Eggert
Subject: Re: _XOPEN_SOURCE=500 breaks at least OSF1 V5.0 [Re: largefiles
Date: Sun, 5 Nov 2000 22:34:17 -0800 (PST)

   From: Jim Meyering <address@hidden>
   Date: 05 Nov 2000 12:08:32 +0100

   Is the definition of _XOPEN_SOURCE solely to get the declaration
   of ftello?

That and fseeko.

   If so, an alternative would be to provide a declaration of that
   function so that every source file using ftello gets it.

I worry that this would conflict with fseeko declarations in system
include files.  Many implementations play funny games with fseeko.

   Of course, I can work around the compile failures by configuring
   with --disable-largefile, but that seems excessive.

I agree.

I've run into other problems with _XOPEN_SOURCE too, and I'm now
thinking that defining _XOPEN_SOURCE=500 causes more problems than it
cures.  It's just not worth working around the glibc 2.1.3 bug; it's
simpler to just say that fseeko/ftello doesn't exist on that platform.
An expert configurer can work around the problem himself, by patching
glibc, or by configuring with CFLAGS=-D_XOPEN_SOURCE=500 if he knows
that this won't break anything else.

Also, I think AC_SYS_LARGEFILE is too ambitious in trying to get
fseeko and ftello to work.  Most programs that use largefiles do not
need fseeko and ftello.  So I think that we should have a new macro,
for use by programs that need fseeko or ftello, and that AC_SYS_LARGEFILE
should just do the largefile stuff.

Here's a patch, relative to the largefile.m4 that is shipped with GNU
tar.  (This code is for autoconf 2.13; will it need changes for the
next autoconf?  I'm not up-to-date with autoconf, I'm afraid.)


2000-11-05  Paul Eggert  <address@hidden>

        * m4/largefile.m4 (AC_SYS_LARGEFILE): Don't worry about
        whether fseeko and ftello are properly declared.
        (AC_FUNC_FSEEKO): New macro, which worries about fseeko (and
        presumably ftello).  Do not set _XOPEN_SOURCE; that causes too
        many problems in practice.

===================================================================
RCS file: m4/largefile.m4,v
retrieving revision 1.12
retrieving revision 1.13
diff -pu -r1.12 -r1.13
--- m4/largefile.m4     2000/05/31 17:19:22     1.12
+++ m4/largefile.m4     2000/11/06 06:17:01     1.13
@@ -1,4 +1,4 @@
-#serial 12
+#serial 13
 
 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.
@@ -59,16 +59,27 @@ AC_DEFUN(AC_SYS_LARGEFILE,
      AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64,
        ac_cv_sys_file_offset_bits,
        [Number of bits in a file offset, on hosts where this is settable.])
-     AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, 1,
-       ac_cv_sys_largefile_source,
-       [Define to make ftello visible on some hosts (e.g. HP-UX 10.20).],
-       [#include <stdio.h>], [return !ftello;])
      AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
        ac_cv_sys_large_files,
        [Define for large files, on AIX-style hosts.])
-     AC_SYS_LARGEFILE_MACRO_VALUE(_XOPEN_SOURCE, 500,
-       ac_cv_sys_xopen_source,
-       [Define to make ftello visible on some hosts (e.g. glibc 2.1.3).],
-       [#include <stdio.h>], [return !ftello;])
    fi
   ])
+
+AC_DEFUN(AC_FUNC_FSEEKO,
+  [AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, 1,
+     ac_cv_sys_largefile_source,
+     [Define to make fseeko visible on some hosts (e.g. HP-UX 10.20).],
+     [#include <stdio.h>], [return !fseeko;])
+   # We used to try defining _XOPEN_SOURCE=500 too, to work around a bug
+   # in glibc 2.1.3, but that breaks too many other things.
+   # If you want fseeko and ftello with glibc, upgrade to a fixed glibc.
+
+   AC_CACHE_CHECK([for fseeko], ac_cv_func_fseeko,
+     [ac_cv_func_fseeko=no
+      AC_TRY_LINK([#include <stdio.h>],
+        [return fseeko && fseeko (stdin, 0, 0);],
+       [ac_cv_func_fseeko=yes])
+      if test $ac_cv_func_fseeko != no; then
+        AC_DEFINE(HAVE_FSEEKO, 1,
+          [Define if fseeko (and presumably ftello) exists and is declared.])
+      fi])])



reply via email to

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