From: Jim Meyering <[EMAIL PROTECTED]>
   Date: 03 May 2000 11:04:31 +0200

   In sh-utils, with your largefile.m4 change, I now get this:

     In file included from regex.c:31:
     ../config.h:955: warning: `_GNU_SOURCE' redefined
     regex.c:28: warning: this is the location of the previous definition

   Because config.h now defines _GNU_SOURCE and regex.c has this code:

     #undef     _GNU_SOURCE
     #define _GNU_SOURCE

     #ifdef HAVE_CONFIG_H
     # include <config.h>
     #endif

   I don't see any harm reversing those blocks:

     #ifdef HAVE_CONFIG_H
     # include <config.h>
     #endif

     #undef _GNU_SOURCE
     #define _GNU_SOURCE

Unfortunately Emacs config.h includes some system include files, so
I think that workaround might break Emacs.

We are on thin ice here.  I wish glibc didn't have the bug that causes
it to ignore _LARGEFILE_SOURCE.  I'll file a bug report about this to
bug-glibc.

However, the following further patch worked for me, and I don't see
how it would break anything else.  It uses _XOPEN_SOURCE instead of
_GNU_SOURCE.  Please give it a try.  One Emacs source file
(lib-src/fakemail.c) defines _XOPEN_SOURCE but it does so safely.

I'd also like to fix largefile.m4 so that it didn't depend on $host_os
and AC_CANONICAL_HOST, but that's a larger project....

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

        * m4/largefile.m4 (AC_SYS_LARGEFILE): Define _XOPEN_SOURCE to
        be 500, instead of _GNU_SOURCE to be 1, to work around glibc
        2.1.3 bug.  This avoids a clash when files like regex.c define
        _GNU_SOURCE.

===================================================================
RCS file: m4/largefile.m4,v
retrieving revision 1.10
retrieving revision 1.11
diff -pu -r1.10 -r1.11
--- m4/largefile.m4     2000/05/03 16:25:59     1.10
+++ m4/largefile.m4     2000/05/03 16:48:08     1.11
@@ -1,4 +1,4 @@
-#serial 10
+#serial 11
 
 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.
@@ -107,14 +107,6 @@ 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 ftello visible on some hosts (e.g. HP-UX 10.20).],
@@ -130,5 +122,13 @@ AC_DEFUN(AC_SYS_LARGEFILE,
 [      aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)]
          ac_cv_sys_large_files=1 ;;
        esac])
+     AC_SYS_LARGEFILE_MACRO_VALUE(_XOPEN_SOURCE,
+       ac_cv_sys_xopen_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 _XOPEN_SOURCE 500
+#include <stdio.h>],
+            [return !ftello;],
+            ac_cv_sys_xopen_source=500)])])
    fi
   ])

Reply via email to