comparison configure.in @ 57335:76b377db0bca

* configure.in (HAVE_RANDOM_HEAPSTART): Renamed HAVE_EXECSHIELD. Run test to see if heap start address is random.
author Jan Djärv <jan.h.d@swipnet.se>
date Tue, 05 Oct 2004 20:24:19 +0000
parents 6ce2eaa4905a
children c36defd6923f
comparison
equal deleted inserted replaced
57334:37199d6ac2c7 57335:76b377db0bca
1284 [AC_MSG_RESULT(no)]) 1284 [AC_MSG_RESULT(no)])
1285 1285
1286 dnl checks for Unix variants 1286 dnl checks for Unix variants
1287 AC_AIX 1287 AC_AIX
1288 1288
1289 dnl check if exec-shield is present.
1290 AC_CHECK_FILE(/proc/sys/kernel/exec-shield, emacs_cv_execshield=1,
1291 emacs_cv_execshield=0)
1292 if test "$emacs_cv_execshield" = 1; then
1293 AC_PATH_PROG(SETARCH, setarch, no)
1294 AC_SUBST(SETARCH)
1295 if test "$SETARCH" != no && test "$machine" = "intel386"; then
1296 AC_DEFINE(HAVE_EXECSHIELD, 1,
1297 [Define to 1 if this OS has exec shield and we can handle it.])
1298 else
1299 case "`cat /proc/sys/kernel/exec-shield`" in
1300 0) ;;
1301 *)
1302 AC_MSG_ERROR([Exec-shield is turned on.
1303 Emacs can not dump itself if exec-shield is turned on.
1304 See `etc/PROBLEMS' for further information.])
1305 esac
1306 fi
1307 fi
1308 1289
1309 #### Extract some information from the operating system and machine files. 1290 #### Extract some information from the operating system and machine files.
1310 1291
1311 AC_CHECKING([the machine- and system-dependent files to find out 1292 AC_CHECKING([the machine- and system-dependent files to find out
1312 - which libraries the lib-src programs will want, and 1293 - which libraries the lib-src programs will want, and
1588 AC_DEFINE(POINTER_TYPE, char) 1569 AC_DEFINE(POINTER_TYPE, char)
1589 fi 1570 fi
1590 AH_TEMPLATE(POINTER_TYPE, 1571 AH_TEMPLATE(POINTER_TYPE,
1591 [Define as `void' if your compiler accepts `void *'; otherwise 1572 [Define as `void' if your compiler accepts `void *'; otherwise
1592 define as `char'.])dnl 1573 define as `char'.])dnl
1574
1575 dnl Test if heap start address is randomized (exec-shield does this).
1576 dnl The test program requires unistd.h and stdlib.h. They are present
1577 dnl on the systems that currently have exec-shield.
1578 AC_MSG_CHECKING(whether heap start address is randomized)
1579 if test x"$ac_cv_header_unistd_h" != x && test x"$ac_cv_header_stdlib_h" != x
1580 then
1581 AC_TRY_RUN([#include <stdio.h>
1582 #include <unistd.h>
1583 #include <stdlib.h>
1584 int main (int argc, char *argv[])
1585 {
1586 unsigned long old_sbrk = 0;
1587 unsigned long this_sbrk = (unsigned long) sbrk(0);
1588 int nr = 1;
1589 if (argc != 1) {
1590 old_sbrk = strtoul (argv[1], 0, 0);
1591 nr = atoi (argv[2])+1;
1592 }
1593 if (argc == 1 || (old_sbrk == this_sbrk && nr < 3))
1594 {
1595 char buf1[32], buf2[32];
1596 sprintf (buf1, "%lu", this_sbrk);
1597 sprintf (buf2, "%d", nr);
1598 execl (argv[0], argv[0], buf1, buf2, 0);
1599 exit (-1);
1600 }
1601 exit (this_sbrk == old_sbrk);
1602 }], emacs_cv_execshield=yes, emacs_cv_execshield=no,
1603 emacs_cv_execshield='assuming no')
1604 else
1605 emacs_cv_execshield='assuming no'
1606 fi
1607 AC_MSG_RESULT($emacs_cv_execshield)
1608
1609 if test "$emacs_cv_execshield" = yes; then
1610 AC_PATH_PROG(SETARCH, setarch, no)
1611 AC_SUBST(SETARCH)
1612 if test "$SETARCH" != no && test "$machine" = "intel386"; then
1613 AC_DEFINE(HAVE_RANDOM_HEAPSTART, 1,
1614 [Define to 1 if this OS randomizes the start address of the heap.])
1615 else
1616 AC_MSG_ERROR([Heap start address is randomized and no workaround is known.
1617 Probably exec-shield is turned on. Emacs can not dump itself if this is the
1618 case. Read about exec-shield in `etc/PROBLEMS' for further information.])
1619 fi
1620 fi
1621
1593 1622
1594 dnl This could be used for targets which can have both byte sexes. 1623 dnl This could be used for targets which can have both byte sexes.
1595 dnl We could presumably replace the hardwired WORDS_BIG_ENDIAN generally. 1624 dnl We could presumably replace the hardwired WORDS_BIG_ENDIAN generally.
1596 dnl AC_C_BIGENDIAN 1625 dnl AC_C_BIGENDIAN
1597 1626