emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/configure.in


From: Jan Djärv
Subject: [Emacs-diffs] Changes to emacs/configure.in
Date: Tue, 05 Oct 2004 16:31:36 -0400

Index: emacs/configure.in
diff -c emacs/configure.in:1.370 emacs/configure.in:1.371
*** emacs/configure.in:1.370    Wed Sep 29 09:52:39 2004
--- emacs/configure.in  Tue Oct  5 20:24:19 2004
***************
*** 1286,1310 ****
  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.
  
--- 1286,1291 ----
***************
*** 1591,1596 ****
--- 1572,1625 ----
            [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_execshield=yes, emacs_cv_execshield=no,
+      emacs_cv_execshield='assuming no')
+ else
+   emacs_cv_execshield='assuming no'
+ fi
+ AC_MSG_RESULT($emacs_cv_execshield)
+ 
+ if test "$emacs_cv_execshield" = 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_ERROR([Heap start address is randomized and no workaround is known.
+ Probably exec-shield is turned on.  Emacs can not dump itself if this is the
+ case.  Read about exec-shield in `etc/PROBLEMS' for further information.])
+   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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]