* configure.in (doug_lea_malloc): Check for __malloc_initialize_hook.
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 22 Apr 2012 06:56:42 +0000 (23:56 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 22 Apr 2012 06:56:42 +0000 (23:56 -0700)
With glibc 2.14 or later, when compiled with GCC 4.7.0's
-Werror=deprecated-declarations flag, use of hooks like
__malloc_initialize_hook causes compilation to fail because these
hooks are deprecated.  Modify 'configure' to check for these hooks too.
Simplify the 'configure' code to test for all the hooks at once.
(emacs_cv_var___after_morecore_hook): Remove, replacing with ...
(emacs_cv_var_doug_lea_malloc): ... this new var.

ChangeLog
configure.in

index ca3bcff..1997542 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2012-04-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * configure.in (doug_lea_malloc): Check for __malloc_initialize_hook.
+       With glibc 2.14 or later, when compiled with GCC 4.7.0's
+       -Werror=deprecated-declarations flag, use of hooks like
+       __malloc_initialize_hook causes compilation to fail because these
+       hooks are deprecated.  Modify 'configure' to check for these hooks too.
+       Simplify the 'configure' code to test for all the hooks at once.
+       (emacs_cv_var___after_morecore_hook): Remove, replacing with ...
+       (emacs_cv_var_doug_lea_malloc): ... this new var.
+
 2012-04-21  Paul Eggert  <eggert@cs.ucla.edu>
 
        Sync from gnulib version 4f11d6bebc3098c64ffde27079ab0d0cecfd0cdc
index c959292..e4e11bd 100644 (file)
@@ -1708,17 +1708,20 @@ esac
 # Do the opsystem or machine files prohibit the use of the GNU malloc?
 # Assume not, until told otherwise.
 GNU_MALLOC=yes
-doug_lea_malloc=yes
-AC_CHECK_FUNC(malloc_get_state, ,doug_lea_malloc=no)
-AC_CHECK_FUNC(malloc_set_state, ,doug_lea_malloc=no)
-AC_CACHE_CHECK(whether __after_morecore_hook exists,
-              emacs_cv_var___after_morecore_hook,
-[AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern void (* __after_morecore_hook)();]],[[__after_morecore_hook = 0]])],
-  emacs_cv_var___after_morecore_hook=yes,
-  emacs_cv_var___after_morecore_hook=no)])
-if test $emacs_cv_var___after_morecore_hook = no; then
-  doug_lea_malloc=no
-fi
+
+AC_CACHE_CHECK(
+  [whether malloc is Doug Lea style],
+  [emacs_cv_var_doug_lea_malloc],
+  [AC_LINK_IFELSE(
+     [AC_LANG_PROGRAM(
+        [[#include <malloc.h>
+         static void hook (void) {}]],
+        [[malloc_set_state (malloc_get_state ());
+         __after_morecore_hook = hook;
+         __malloc_initialize_hook = hook;]])],
+     [emacs_cv_var_doug_lea_malloc=yes],
+     [emacs_cv_var_doug_lea_malloc=no])])
+doug_lea_malloc=$emacs_cv_var_doug_lea_malloc
 
 
 dnl See comments in aix4-2.h about maybe using system malloc there.