APPROVE COMMIT
NOTE: This patch has been committed
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1511418088 0
# Thu Nov 23 06:21:28 2017 +0000
# Node ID 443cffbae274ea3343c00812661255855a54296b
# Parent 3b1ef8c61ffe707960e449c29f1b06b4e96499f3
_GNU_SOURCE isn't specific enough for glibc, provide HAVE_GLIBC instead
ChangeLog addition:
2017-11-23 Aidan Kehoe <kehoea(a)parhasard.net>
* configure.ac (XE_COMPLEX_ARG):
Make a HAVE_GLIBC #define available, turns out autoconf is too
enthusiastic about _GNU_SOURCE, #defining it even on non-glibc
systems.
* configure: Regenerate.
src/ChangeLog addition:
2017-11-23 Aidan Kehoe <kehoea(a)parhasard.net>
* config.h.in:
Provide HAVE_GLIBC, since _GNU_SOURCE isn't specific enough to
glibc.
* alloc.c:
* alloc.c (malloced_storage_size):
* alloc.c (common_init_alloc_early):
* emacs.c:
* emacs.c (main):
* gc.h:
* ralloc.c:
* ralloc.c (init_ralloc):
Use the new HAVE_GLIBC define in these files, instead of _GNU_SOURCE.
diff -r 3b1ef8c61ffe -r 443cffbae274 ChangeLog
--- a/ChangeLog Thu Nov 23 05:08:49 2017 +0000
+++ b/ChangeLog Thu Nov 23 06:21:28 2017 +0000
@@ -1,3 +1,11 @@
+2017-11-23 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * configure.ac (XE_COMPLEX_ARG):
+ Make a HAVE_GLIBC #define available, turns out autoconf is too
+ enthusiastic about _GNU_SOURCE, #defining it even on non-glibc
+ systems.
+ * configure: Regenerate.
+
2017-11-23 Aidan Kehoe <kehoea(a)parhasard.net>
* configure.ac (XE_COMPLEX_ARG):
diff -r 3b1ef8c61ffe -r 443cffbae274 configure
--- a/configure Thu Nov 23 05:08:49 2017 +0000
+++ b/configure Thu Nov 23 06:21:28 2017 +0000
@@ -825,7 +825,6 @@
docdir
oldincludedir
includedir
-runstatedir
localstatedir
sharedstatedir
sysconfdir
@@ -1106,7 +1105,6 @@
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
-runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1359,15 +1357,6 @@
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
- -runstatedir | --runstatedir | --runstatedi | --runstated \
- | --runstate | --runstat | --runsta | --runst | --runs \
- | --run | --ru | --r)
- ac_prev=runstatedir ;;
- -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
- | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
- | --run=* | --ru=* | --r=*)
- runstatedir=$ac_optarg ;;
-
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1505,7 +1494,7 @@
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
- libdir localedir mandir runstatedir
+ libdir localedir mandir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
@@ -1658,7 +1647,6 @@
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
- --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -9189,8 +9177,12 @@
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_glibc" >&5
$as_echo "$have_glibc" >&6; }
-test "$have_glibc" = "yes" && $as_echo "#define _GNU_SOURCE 1" >>confdefs.h
-
+if test "$have_glibc" = "yes"; then
+ $as_echo "#define HAVE_GLIBC 1" >>confdefs.h
+
+ $as_echo "#define _GNU_SOURCE 1" >>confdefs.h
+
+fi
case "$opsys" in
sol2)
@@ -11781,7 +11773,7 @@
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -11827,7 +11819,7 @@
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -11851,7 +11843,7 @@
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -11896,7 +11888,7 @@
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
@@ -11920,7 +11912,7 @@
We can't simply define LARGE_OFF_T to be 9223372036854775807,
since some C++ compilers masquerading as C compilers
incorrectly reject 9223372036854775807. */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
&& LARGE_OFF_T % 2147483647 == 1)
? 1 : -1];
diff -r 3b1ef8c61ffe -r 443cffbae274 configure.ac
--- a/configure.ac Thu Nov 23 05:08:49 2017 +0000
+++ b/configure.ac Thu Nov 23 06:21:28 2017 +0000
@@ -1673,7 +1673,13 @@
AC_MSG_RESULT($have_glibc)
dnl I'm tired of pop being broken with GLIBC -slb
dnl Well. then why not fix fucking pop?
-test "$have_glibc" = "yes" && AC_DEFINE(_GNU_SOURCE)
+if test "$have_glibc" = "yes"; then
+ dnl Defining _GNU_SOURCE on its own isn't helpful, since autoconf is very
+ dnl enthusiastic about defining it on non-GNU systems. Make a separate
+ dnl HAVE_GLIBC available.
+ AC_DEFINE(HAVE_GLIBC)
+ AC_DEFINE(_GNU_SOURCE)
+fi
dnl We'd like to use vendor extensions, where available.
dnl We'd like to use functions from the latest Unix98 standards.
diff -r 3b1ef8c61ffe -r 443cffbae274 src/ChangeLog
--- a/src/ChangeLog Thu Nov 23 05:08:49 2017 +0000
+++ b/src/ChangeLog Thu Nov 23 06:21:28 2017 +0000
@@ -1,3 +1,18 @@
+2017-11-23 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * config.h.in:
+ Provide HAVE_GLIBC, since _GNU_SOURCE isn't specific enough to
+ glibc.
+ * alloc.c:
+ * alloc.c (malloced_storage_size):
+ * alloc.c (common_init_alloc_early):
+ * emacs.c:
+ * emacs.c (main):
+ * gc.h:
+ * ralloc.c:
+ * ralloc.c (init_ralloc):
+ Use the new HAVE_GLIBC define in these files, instead of _GNU_SOURCE.
+
2017-11-23 Aidan Kehoe <kehoea(a)parhasard.net>
* gmalloc.c: Removed. Use the system malloc all the time instead.
diff -r 3b1ef8c61ffe -r 443cffbae274 src/alloc.c
--- a/src/alloc.c Thu Nov 23 05:08:49 2017 +0000
+++ b/src/alloc.c Thu Nov 23 06:21:28 2017 +0000
@@ -66,7 +66,7 @@
#endif /* NEW_GC */
#include "console-stream.h"
-#ifdef _GNU_SOURCE
+#ifdef HAVE_GLIBC
#include <malloc.h>
#endif
#ifdef USE_VALGRIND
@@ -220,7 +220,7 @@
}
}
-#if !defined(HAVE_MMAP) || defined(_GNU_SOURCE)
+#if !defined(HAVE_MMAP) || defined(HAVE_GLIBC)
/* If we released our reserve (due to running out of memory),
and we have a fair amount free once again,
try to set aside another reserve in case we run out once more.
@@ -233,7 +233,7 @@
if (breathing_space == 0)
breathing_space = (char *) malloc (4096 - MALLOC_OVERHEAD);
}
-#endif /* !defined(HAVE_MMAP) || defined(_GNU_SOURCE) */
+#endif /* !defined(HAVE_MMAP) || defined(HAVE_GLIBC) */
#endif /* not NEW_GC */
@@ -4051,7 +4051,7 @@
{
Bytecount orig_claimed_size = claimed_size;
-#ifdef _GNU_SOURCE
+#ifdef HAVE_GLIBC
/* The following actually reflects the old gmalloc.c that we included with
XEmacs. The malloc implementation included in glibc has likely diverged
from this, but this answer is still going to be better than the
@@ -5960,7 +5960,7 @@
all_lcrecords = 0;
#endif /* not NEW_GC */
ignore_malloc_warnings = 1;
-#ifdef _GNU_SOURCE
+#ifdef HAVE_GLIBC
mallopt (M_TRIM_THRESHOLD, 128*1024); /* trim threshold */
mallopt (M_MMAP_THRESHOLD, 64*1024); /* mmap threshold */
#if 0 /* Moved to emacs.c */
diff -r 3b1ef8c61ffe -r 443cffbae274 src/config.h.in
--- a/src/config.h.in Thu Nov 23 05:08:49 2017 +0000
+++ b/src/config.h.in Thu Nov 23 06:21:28 2017 +0000
@@ -151,6 +151,9 @@
/* Undefine on systems which don't have processes */
#undef HAVE_UNIX_PROCESSES
+/* Use this define to actually check if this is a glibc system. */
+#undef HAVE_GLIBC
+
/* Define if you are using libmcheck.a from the GNU C Library. */
#undef HAVE_LIBMCHECK
diff -r 3b1ef8c61ffe -r 443cffbae274 src/emacs.c
--- a/src/emacs.c Thu Nov 23 05:08:49 2017 +0000
+++ b/src/emacs.c Thu Nov 23 06:21:28 2017 +0000
@@ -476,9 +476,9 @@
on subsequent starts. */
int initialized;
-#ifdef _GNU_SOURCE
+#ifdef HAVE_GLIBC
# include <malloc.h>
-#endif /* _GNU_SOURCE */
+#endif /* HAVE_GLIBC */
/* Variable whose value is symbol giving operating system type. */
Lisp_Object Vsystem_type;
@@ -3189,7 +3189,7 @@
if (!initialized)
{
-#ifdef _GNU_SOURCE
+#ifdef HAVE_GLIBC
mallopt (M_MMAP_MAX, 0);
#endif
run_temacs_argc = 0;
@@ -3229,7 +3229,7 @@
run_time_remap (argv[0]);
#endif
-#ifdef _GNU_SOURCE
+#ifdef HAVE_GLIBC
if (initialized)
{
/* mmap works in glibc-2.1, glibc-2.0 (Non-Mule only) and Linux libc5 */
@@ -3239,7 +3239,7 @@
mallopt (M_MMAP_MAX, 64);
#endif
}
-#endif /* _GNU_SOURCE */
+#endif /* HAVE_GLIBC */
run_temacs_argc = -2;
diff -r 3b1ef8c61ffe -r 443cffbae274 src/gc.h
--- a/src/gc.h Thu Nov 23 05:08:49 2017 +0000
+++ b/src/gc.h Thu Nov 23 06:21:28 2017 +0000
@@ -84,7 +84,7 @@
/************************************************************************/
#ifndef MALLOC_OVERHEAD
-#ifdef _GNU_SOURCE
+#ifdef HAVE_GLIBC
#define MALLOC_OVERHEAD 0
#elif defined (rcheck)
#define MALLOC_OVERHEAD 20
diff -r 3b1ef8c61ffe -r 443cffbae274 src/ralloc.c
--- a/src/ralloc.c Thu Nov 23 05:08:49 2017 +0000
+++ b/src/ralloc.c Thu Nov 23 06:21:28 2017 +0000
@@ -51,7 +51,7 @@
/* Unconditionally use unsigned char * for this. */
typedef unsigned char *POINTER;
-#ifdef _GNU_SOURCE
+#ifdef HAVE_GLIBC
#define M_TOP_PAD -2
#include <malloc.h>
#endif
@@ -1122,7 +1122,7 @@
page_size = PAGE;
extra_bytes = ROUNDUP (50000);
-#ifdef _GNU_SOURCE
+#ifdef HAVE_GLIBC
mallopt (M_TOP_PAD, 64 * 4096);
#else
#if 0 /* Hasn't been synched yet */
--
‘As I sat looking up at the Guinness ad, I could never figure out /
How your man stayed up on the surfboard after forty pints of stout’
(C. Moore)