Bug 1063726 - Define MALLOC_H like top-level configure.in. r=ted
authorJan Beich <jbeich@vfemail.net>
Sat, 20 Sep 2014 02:03:00 +0200
changeset 216613 97bee197641244562ea79a9b9be7549027dc91c9
parent 216612 42426a21f382fde74bf5b05ccc02025102d02aab
child 216614 7775bda3aa20620e9bac01b004dd3a10bdb3f3f8
push idunknown
push userunknown
push dateunknown
reviewersted
bugs1063726
milestone36.0a1
Bug 1063726 - Define MALLOC_H like top-level configure.in. r=ted
js/src/configure.in
js/src/shell/js.cpp
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -3970,17 +3970,27 @@ dnl top-level configure may override thi
 MOZ_CONFIG_ICU()
 
 MOZ_SUBCONFIGURE_ICU()
 
 dnl ========================================================
 dnl JavaScript shell
 dnl ========================================================
 
-AC_CHECK_HEADERS(malloc.h malloc/malloc.h)
+MALLOC_HEADERS="malloc.h malloc_np.h malloc/malloc.h sys/malloc.h"
+MALLOC_H=
+
+for file in $MALLOC_HEADERS; do
+  MOZ_CHECK_HEADER($file, [MALLOC_H=$file])
+  if test "$MALLOC_H" != ""; then
+    AC_DEFINE_UNQUOTED(MALLOC_H, <$MALLOC_H>)
+    break
+  fi
+done
+
 AC_CHECK_FUNCS(setlocale localeconv malloc_size malloc_usable_size)
 
 AC_SUBST(MOZILLA_VERSION)
 
 AC_SUBST(ac_configure_args)
 
 AC_SUBST(TOOLCHAIN_PREFIX)
 
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -17,21 +17,18 @@
 # include <process.h>
 #endif
 #include <errno.h>
 #include <fcntl.h>
 #if defined(XP_WIN)
 # include <io.h>     /* for isatty() */
 #endif
 #include <locale.h>
-#ifdef HAVE_MALLOC_H /* for malloc_usable_size on Linux, _msize on Windows */
-#include <malloc.h>
-#endif
-#ifdef HAVE_MALLOC_MALLOC_H
-#include <malloc/malloc.h> /* for malloc_size on OSX */
+#if defined(MALLOC_H)
+# include MALLOC_H    /* for malloc_usable_size, malloc_size, _msize */
 #endif
 #include <math.h>
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>