Build fixes for recent libc versions (post glibc 2.19)
authorSteve Youngs <steve@sxemacs.org>
Fri, 17 May 2019 15:00:07 +0000 (01:00 +1000)
committerSteve Youngs <steve@sxemacs.org>
Fri, 17 May 2019 15:00:07 +0000 (01:00 +1000)
This fixes two 'undefined reference' errors when building with a recent
glibc.  One in effi.c for 'dlsym', and the other in emacs.c for
'memory_warnings'.

* configure.ac: Fix mmap detection.
Include -ldl in FFI_LIBS.
Ensure that vm-limit.o is added to the objects when using the
system malloc.
Default to using the system malloc.

* m4/sxe-emodffi.m4 (SXE_CHECK_FFI): Include -ldl in FFI_LIBS.

Signed-off-by: Steve Youngs <steve@sxemacs.org>
configure.ac
m4/sxe-emodffi.m4

index ec40bfb..48a1d29 100644 (file)
@@ -308,7 +308,7 @@ OG_ARG_WITH([debug-malloc],
 OG_ARG_WITH([system-malloc],
        AS_HELP_STRING([--with-system-malloc],
                [Use a system malloc instead of GNU.]),
 OG_ARG_WITH([system-malloc],
        AS_HELP_STRING([--with-system-malloc],
                [Use a system malloc instead of GNU.]),
-       [default], [YES if using quantify or purify; NO otherwise])
+       [yes], [YES])
 
 OG_ARG_WITH([regex-malloc],
        AS_HELP_STRING([--with-regex-malloc],
 
 OG_ARG_WITH([regex-malloc],
        AS_HELP_STRING([--with-regex-malloc],
@@ -1565,7 +1565,7 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
 int main (int argc, char *argv[])
 {
   int fd = -1;
 int main (int argc, char *argv[])
 {
   int fd = -1;
-  caddr_t p;
+
 #ifndef MAP_ANONYMOUS
   fd = open ("/dev/zero", O_RDWR);
   if (fd < 0)
 #ifndef MAP_ANONYMOUS
   fd = open ("/dev/zero", O_RDWR);
   if (fd < 0)
@@ -1899,7 +1899,7 @@ SXE_CHECK_SUFFICIENCY([ffi], [FFI support], [
        ## additional actions
        AC_DEFINE([HAVE_LIBFFI], [1], [Description here!])
        HAVE_LIBFFI=yes
        ## additional actions
        AC_DEFINE([HAVE_LIBFFI], [1], [Description here!])
        HAVE_LIBFFI=yes
-       FFI_LIBS="-lffi"
+       FFI_LIBS="-lffi -ldl"
        SXE_ADD_CRUFT_OBJS([effi.o])
 ])
 
        SXE_ADD_CRUFT_OBJS([effi.o])
 ])
 
@@ -4113,6 +4113,9 @@ if test "$GNU_MALLOC" = "yes"; then
                :
        fi
 elif test "$with_system_malloc" = "yes" -o "$system_malloc" = "yes"; then
                :
        fi
 elif test "$with_system_malloc" = "yes" -o "$system_malloc" = "yes"; then
+       if test "$after_morecore_hook_exists" = "yes"; then
+               SXE_ADD_MEMALLOC_OBJS(vm-limit.o)
+       fi
        AC_DEFINE([USE_SYSTEM_MALLOC], [1], [Description here!])
        AC_DEFINE([SYSTEM_MALLOC], [1], [Description here!])
 elif test "$with_debug_malloc"  = "yes"; then
        AC_DEFINE([USE_SYSTEM_MALLOC], [1], [Description here!])
        AC_DEFINE([SYSTEM_MALLOC], [1], [Description here!])
 elif test "$with_debug_malloc"  = "yes"; then
index 070afc7..be8849f 100644 (file)
@@ -256,7 +256,7 @@ AC_DEFUN([SXE_CHECK_FFI], [dnl
                        "$ac_cv_lib_ffi_ffi_call" = "yes"; then
                        sxe_cv_feat_ffi="yes"
                        have_ffi="yes"
                        "$ac_cv_lib_ffi_ffi_call" = "yes"; then
                        sxe_cv_feat_ffi="yes"
                        have_ffi="yes"
-                       FFI_LIBS=-lffi
+                       FFI_LIBS="-lffi -ldl"
                else
                        sxe_cv_feat_ffi="no"
                        have_ffi="no"
                else
                        sxe_cv_feat_ffi="no"
                        have_ffi="no"