diff configure.in @ 90016:ff0e824afa37

Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-57 Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-594 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-598 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-599 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-600 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-602 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-603 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-604 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-609 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-610 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-611 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-614 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-615 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-42 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-43 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-44 - miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-46 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-47 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-48 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-49 Add {arch}/=commit-merge-make-log * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-50 {arch}/=commit-merge-make-log: Don't die if there are no ChangeLog changes
author Miles Bader <miles@gnu.org>
date Thu, 14 Oct 2004 08:50:09 +0000
parents 6c1af301b455 f95883a41a23
children f3ec05478165
line wrap: on
line diff
--- a/configure.in	Wed Oct 13 02:40:50 2004 +0000
+++ b/configure.in	Thu Oct 14 08:50:09 2004 +0000
@@ -1286,25 +1286,6 @@
 dnl checks for Unix variants
 AC_AIX
 
-dnl check if exec-shield is present.
-AC_CHECK_FILE(/proc/sys/kernel/exec-shield, emacs_cv_execshield=1,
-                                            emacs_cv_execshield=0)
-if test "$emacs_cv_execshield" = 1; then
-  AC_PATH_PROG(SETARCH, setarch, no)
-  AC_SUBST(SETARCH)
-  if test "$SETARCH" != no && test "$machine" = "intel386"; then
-    AC_DEFINE(HAVE_EXECSHIELD, 1,
-    [Define to 1 if this OS has exec shield and we can handle it.])
-  else
-    case "`cat /proc/sys/kernel/exec-shield`" in
-      0) ;;
-      *)
-        AC_MSG_ERROR([Exec-shield is turned on.
-Emacs can not dump itself if exec-shield is turned on.
-See `etc/PROBLEMS' for further information.])
-    esac
-  fi
-fi
 
 #### Extract some information from the operating system and machine files.
 
@@ -1591,6 +1572,53 @@
 	    [Define as `void' if your compiler accepts `void *'; otherwise
 	     define as `char'.])dnl
 
+dnl Test if heap start address is randomized (exec-shield does this).
+dnl The test program requires unistd.h and stdlib.h.  They are present
+dnl on the systems that currently have exec-shield.
+AC_MSG_CHECKING(whether heap start address is randomized)
+if test x"$ac_cv_header_unistd_h" != x && test x"$ac_cv_header_stdlib_h" != x
+then
+  AC_TRY_RUN([#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+int main (int argc, char *argv[])
+{
+  unsigned long old_sbrk = 0;
+  unsigned long this_sbrk = (unsigned long) sbrk(0);
+  int nr = 1;
+  if (argc != 1) {
+    old_sbrk = strtoul (argv[1], 0, 0);
+    nr = atoi (argv[2])+1;
+  }
+  if (argc == 1 || (old_sbrk == this_sbrk && nr < 3))
+  {
+    char buf1[32], buf2[32];
+    sprintf (buf1, "%lu", this_sbrk);
+    sprintf (buf2, "%d", nr);
+    execl (argv[0], argv[0], buf1, buf2, 0);
+    exit (-1);
+  }
+  exit (this_sbrk == old_sbrk);
+}], emacs_cv_randomheap=yes, emacs_cv_randomheap=no,
+     emacs_cv_randomheap='assuming no')
+else
+  emacs_cv_randomheap='assuming no'
+fi
+AC_MSG_RESULT($emacs_cv_randomheap)
+
+if test "$emacs_cv_randomheap" = yes; then
+  AC_PATH_PROG(SETARCH, setarch, no)
+  AC_SUBST(SETARCH)
+  if test "$SETARCH" != no && test "$machine" = "intel386"; then
+    AC_DEFINE(HAVE_RANDOM_HEAPSTART, 1,
+    [Define to 1 if this OS randomizes the start address of the heap.])
+  else
+    dnl We do the warning at the end of the configure run so it is seen.
+    emacs_cv_randomheap=warn
+  fi
+fi
+
+
 dnl This could be used for targets which can have both byte sexes.
 dnl We could presumably replace the hardwired WORDS_BIG_ENDIAN generally.
 dnl AC_C_BIGENDIAN
@@ -2285,6 +2313,9 @@
   AC_CHECK_HEADER(Carbon/Carbon.h, HAVE_CARBON=yes)
 fi
 
+dnl Check for malloc/malloc.h on darwin
+AC_CHECK_HEADER(malloc/malloc.h, AC_DEFINE(HAVE_MALLOC_MALLOC_H, 1, [Define to 1 if you have the <malloc/malloc.h> header file.]))
+
 if test "${HAVE_CARBON}" = "yes"; then
   AC_DEFINE(HAVE_CARBON, 1, [Define to 1 if you are using the Carbon API on Mac OS X.])
   window_system=mac
@@ -3058,6 +3089,19 @@
 echo "  Does Emacs use X toolkit scroll bars?                   ${USE_TOOLKIT_SCROLL_BARS}"
 echo
 
+if test "$emacs_cv_randomheap" = warn; then 
+  AC_MSG_WARN([
+**********************************************************************
+
+Heap start address is randomized and no workaround is known.
+Emacs will probably dump core when temacs is run in the build phase.
+Maybe exec-shield is turned on.  Read about exec-shield in `etc/PROBLEMS'
+for further information.
+
+**********************************************************************
+])
+fi
+
 # Remove any trailing slashes in these variables.
 [test "${prefix}" != NONE &&
   prefix=`echo "${prefix}" | sed 's,\([^/]\)/*$,\1,'`