annotate m4/mmap-anon.m4 @ 448:5cccf90bf838 3.0 tip

Fixed bug with complex external references generating invalid relocations in the object file
author lost@l-w.ca
date Fri, 05 Nov 2010 22:27:00 -0600
parents b8bf63962a99
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
434
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
1 # mmap-anon.m4 serial 8
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
2 dnl Copyright (C) 2005, 2007, 2009-2010 Free Software Foundation, Inc.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
3 dnl This file is free software; the Free Software Foundation
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
4 dnl gives unlimited permission to copy and/or distribute it,
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
5 dnl with or without modifications, as long as this notice is preserved.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
6
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
7 # Detect how mmap can be used to create anonymous (not file-backed) memory
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
8 # mappings.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
9 # - On Linux, AIX, OSF/1, Solaris, Cygwin, Interix, Haiku, both MAP_ANONYMOUS
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
10 # and MAP_ANON exist and have the same value.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
11 # - On HP-UX, only MAP_ANONYMOUS exists.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
12 # - On MacOS X, FreeBSD, NetBSD, OpenBSD, only MAP_ANON exists.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
13 # - On IRIX, neither exists, and a file descriptor opened to /dev/zero must be
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
14 # used.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
15
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
16 AC_DEFUN([gl_FUNC_MMAP_ANON],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
17 [
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
18 dnl Work around a bug of AC_EGREP_CPP in autoconf-2.57.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
19 AC_REQUIRE([AC_PROG_CPP])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
20 AC_REQUIRE([AC_PROG_EGREP])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
21
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
22 dnl Persuade glibc <sys/mman.h> to define MAP_ANONYMOUS.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
23 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
24
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
25 # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
26 # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
27 # irrelevant for anonymous mappings.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
28 AC_CHECK_FUNC([mmap], [gl_have_mmap=yes], [gl_have_mmap=no])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
29
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
30 # Try to allow MAP_ANONYMOUS.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
31 gl_have_mmap_anonymous=no
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
32 if test $gl_have_mmap = yes; then
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
33 AC_MSG_CHECKING([for MAP_ANONYMOUS])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
34 AC_EGREP_CPP([I cant identify this map.], [
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
35 #include <sys/mman.h>
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
36 #ifdef MAP_ANONYMOUS
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
37 I cant identify this map.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
38 #endif
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
39 ],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
40 [gl_have_mmap_anonymous=yes])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
41 if test $gl_have_mmap_anonymous != yes; then
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
42 AC_EGREP_CPP([I cant identify this map.], [
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
43 #include <sys/mman.h>
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
44 #ifdef MAP_ANON
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
45 I cant identify this map.
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
46 #endif
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
47 ],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
48 [AC_DEFINE([MAP_ANONYMOUS], [MAP_ANON],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
49 [Define to a substitute value for mmap()'s MAP_ANONYMOUS flag.])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
50 gl_have_mmap_anonymous=yes])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
51 fi
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
52 AC_MSG_RESULT([$gl_have_mmap_anonymous])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
53 if test $gl_have_mmap_anonymous = yes; then
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
54 AC_DEFINE([HAVE_MAP_ANONYMOUS], [1],
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
55 [Define to 1 if mmap()'s MAP_ANONYMOUS flag is available after including
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
56 config.h and <sys/mman.h>.])
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
57 fi
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
58 fi
b8bf63962a99 Added various generated files for release
lost@l-w.ca
parents:
diff changeset
59 ])