X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/8f9d49058212da0396f8c4206b0628395ada6779..f1625eaa20d8b2d43bc7f0a439129eeab4d5948b:/configure.in diff --git a/configure.in b/configure.in index b7318b8f80..519f826f27 100644 --- a/configure.in +++ b/configure.in @@ -1286,6 +1286,7 @@ AC_LINK_IFELSE([main(){return 0;}], dnl checks for Unix variants AC_AIX + #### Extract some information from the operating system and machine files. AC_CHECKING([the machine- and system-dependent files to find out @@ -1571,6 +1572,53 @@ AH_TEMPLATE(POINTER_TYPE, [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 +#include +#include +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 @@ -2265,6 +2313,9 @@ if test "${with_carbon}" != "no"; then 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 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 @@ -2342,7 +2393,7 @@ utimes setrlimit setpgid getcwd getwd shutdown getaddrinfo \ __fpending mblen mbrlen mbsinit strsignal setitimer ualarm index rindex \ sendto recvfrom getsockopt setsockopt getsockname getpeername \ gai_strerror mkstemp getline getdelim mremap memmove fsync bzero \ -memset memcmp memmove difftime memcpy mempcpy mblen mbrlen posix_memalign) +memset memcmp difftime memcpy mempcpy mblen mbrlen posix_memalign) AC_CHECK_HEADERS(sys/un.h) @@ -3038,6 +3089,19 @@ echo " Does Emacs use -lpng? ${HAVE_PNG}" 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,'`