-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
- 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
-fi