File: sxe-mmap.m4

package info (click to toggle)
dateutils 0.4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 4,924 kB
  • sloc: ansic: 22,097; makefile: 1,666; yacc: 198; sh: 168; lex: 108
file content (76 lines) | stat: -rw-r--r-- 1,889 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
AC_DEFUN([SXE_CHECK_SYS_MMAN], [dnl
	AC_CHECK_HEADERS([sys/mman.h])
])dnl SXE_CHECK_SYS_MMAN

AC_DEFUN([SXE_CHECK_MAP_ANON], [dnl
	AC_MSG_CHECKING([for ANON maps])
	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#define _POSIX_C_SOURCE 200112L
#define _XOPEN_SOURCE 600
#define _BSD_SOURCE
#if defined HAVE_SYS_MMAN_H
# include <sys/mman.h>
#endif  /* HAVE_SYS_MMAN_H */
#if defined MAP_ANON
/* good */
#elif defined MAP_ANONYMOUS
/* good too */
#else
# error MAP_ANON | MAP_ANONYMOUS needed
#endif
	]])], [sxe_cv_feat_anon_maps="yes"], [sxe_cv_feat_anon_maps="no"])
	if test "${sxe_cv_feat_anon_maps}" = "no"; then
		AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#define _POSIX_C_SOURCE 200112L
#define _BSD_SOURCE
#define _XOPEN_SOURCE 600
#define _ALL_SOURCE
#if defined HAVE_SYS_MMAN_H
# include <sys/mman.h>
#endif  /* HAVE_SYS_MMAN_H */
#if defined MAP_ANON
/* good */
#elif defined MAP_ANONYMOUS
/* good too */
#else
# error MAP_ANON | MAP_ANONYMOUS needed
#endif
		]])], [
			sxe_cv_feat_anon_maps="yes"
			AC_DEFINE([MAP_ANON_NEEDS_ALL_SOURCE], [1], 
				[MAP_ANON with _ALL_SOURCE])
		], [
			sxe_cv_feat_anon_maps="no"
		])
	fi
	if test "${sxe_cv_feat_anon_maps}" = "no"; then
		AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#define _POSIX_C_SOURCE 200112L
#define _BSD_SOURCE
#define _XOPEN_SOURCE 600
#define _DARWIN_C_SOURCE
#if defined HAVE_SYS_MMAN_H
# include <sys/mman.h>
#endif  /* HAVE_SYS_MMAN_H */
#if defined MAP_ANON
/* good */
#elif defined MAP_ANONYMOUS
/* good too */
#else
# error MAP_ANON | MAP_ANONYMOUS needed
#endif
		]])], [
			sxe_cv_feat_anon_maps="yes"
			AC_DEFINE([MAP_ANON_NEEDS_DARWIN_SOURCE], [1], 
				[MAP_ANON with _DARWIN_C_SOURCE])
		], [
			sxe_cv_feat_anon_maps="no"
		])
	fi
	AC_MSG_RESULT([${sxe_cv_feat_anon_maps}])
])dnl SXE_CHECK_MAP_ANON

AC_DEFUN([SXE_CHECK_MMAP], [dnl
	AC_REQUIRE([SXE_CHECK_SYS_MMAN])
	AC_REQUIRE([SXE_CHECK_MAP_ANON])
])dnl SXE_CHECK_MMAP