dnl autoconf
dnl in the directory containing this script.
dnl
-dnl Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2003
+dnl Copyright (C) 1994, 95, 96, 1999, 2000, 01, 02, 03, 2004
dnl Free Software Foundation, Inc.
dnl
dnl This file is part of GNU Emacs.
use GNU make. If you do not have GNU make, then you must
now do `make distclean' in ${srcdir},
and then run $0 again.]])
-
-[extrasub='/^VPATH[ ]*=/c\
-vpath %.c $(srcdir)\
-vpath %.h $(srcdir)\
-vpath %.y $(srcdir)\
-vpath %.l $(srcdir)\
-vpath %.s $(srcdir)\
-vpath %.in $(srcdir)\
-vpath %.texi $(srcdir)']
fi
#### Given the configuration name, set machfile and opsysfile to the
ac_link="$ac_link $NON_GCC_LINK_TEST_OPTIONS"
fi
+dnl We need -znocombreloc if we're using a relatively recent GNU ld.
+dnl If we can link with the flag, it shouldn't do any harm anyhow.
+dnl (Don't use `-z nocombreloc' as -z takes no arg on Irix.)
+dnl Treat GCC specially since it just gives a non-fatal `unrecognized option'
+dnl if not built to support GNU ld.
+
+late_LDFLAGS=$LDFLAGS
+if test "$GCC" = yes; then
+ LDFLAGS="$LDFLAGS -Wl,-znocombreloc"
+else
+ LDFLAGS="$LDFLAGS -znocombreloc"
+fi
+
+AC_MSG_CHECKING([For -znocombreloc])
+AC_LINK_IFELSE([main(){return 0;}],
+ [AC_MSG_RESULT(yes)],
+ LDFLAGS=$late_LDFLAGS
+ [AC_MSG_RESULT(no)])
+
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
[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
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
__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)
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,'`