From: Bruno Haible <[EMAIL PROTECTED]>
   Date: Tue, 2 May 2000 16:19:59 +0200 (MET DST)

   Trying to compile patch-2.5.4 with a recent glibc snapshot. I get warnings:

   gcc -c  -DHAVE_CONFIG_H -Ded_PROGRAM=\"/usr/bin/ed\" -I. -I. -O2 -g -Wall pch.c
   pch.c: In function `open_patch_file':
   pch.c:118: warning: implicit declaration of function `ftello'
   pch.c:142: warning: implicit declaration of function `fseeko'

   The warnings go away if I add -D_XOPEN_SOURCE=500 to the command line.

Thanks for this bug report.  The warnings are a sign of a real bug on
some hosts.  Here is a patch; it uses _GNU_SOURCE instead of
_XOPEN_SOURCE since I think that is better from an autoconf point of
view.  I'm CC'ing this to the maintainers of autoconf and fileutils as
they are using this code too.

2000-05-02  Paul Eggert  <[EMAIL PROTECTED]>

        * m4/largefile.m4 (AC_SYS_LARGEFILE): Define _GNU_SOURCE if
        this is needed to make ftello visible (e.g. glibc 2.1.3).  Use
        compile-time test, rather than inspecting host and OS, to
        decide whether to define _LARGEFILE_SOURCE.

===================================================================
RCS file: m4/largefile.m4,v
retrieving revision 1.8
retrieving revision 1.9
diff -pu -r1.8 -r1.9
--- m4/largefile.m4     2000/04/06 00:51:48     1.8
+++ m4/largefile.m4     2000/05/02 22:12:51     1.9
@@ -107,14 +107,21 @@ AC_DEFUN(AC_SYS_LARGEFILE,
 [      hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)]
          ac_cv_sys_file_offset_bits=64 ;;
        esac])
+     AC_SYS_LARGEFILE_MACRO_VALUE(_GNU_SOURCE,
+       ac_cv_sys_gnu_source,
+       [Define to make ftello visible on some hosts (e.g. glibc 2.1.3).],
+       [AC_TRY_COMPILE([#include <stdio.h>], [return !ftello;], ,
+         [AC_TRY_COMPILE([#define _GNU_SOURCE 1
+#include <stdio.h>],
+            [return !ftello;],
+            ac_cv_sys_gnu_source=1)])])
      AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE,
        ac_cv_sys_largefile_source,
-       [Define to make fseeko etc. visible, on some hosts.],
-       [case "$host_os" in
-       # HP-UX 10.20 and later
-[      hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)]
-         ac_cv_sys_largefile_source=1 ;;
-       esac])
+       [Define to make ftello visible on some hosts (e.g. HP-UX 10.20).],
+       [AC_TRY_COMPILE([#include <stdio.h>], [return !ftello;], ,
+         [AC_TRY_COMPILE([#define _LARGEFILE_SOURCE 1
+#include <stdio.h>], [return !ftello;],
+            ac_cv_sys_largefile_source=1)])])
      AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
        ac_cv_sys_large_files,
        [Define for large files, on AIX-style hosts.],

Reply via email to