1 2# Copyright (C) Igor Sysoev 3# Copyright (C) NGINX, Inc. 4 5 6# Linux, FreeBSD, Solaris, MacOSX. 7 8nxt_feature="MAP_ANON" 9nxt_feature_name=NXT_HAVE_MAP_ANON 10nxt_feature_run=yes 11nxt_feature_incs= 12nxt_feature_libs= 13nxt_feature_test="#include <stdlib.h> 14 #include <sys/mman.h> 15 16 int main() { 17 if (mmap(NULL, 4096, PROT_READ | PROT_WRITE, 18 MAP_PRIVATE | MAP_ANON, -1, 0) 19 == MAP_FAILED) 20 return 1; 21 return 0; 22 }" 23. auto/feature 24 25 26if [ $nxt_found = no ]; then 27 28 # Linux, Solaris, HP-UX. 29 30 nxt_feature="MAP_ANONYMOUS" 31 nxt_feature_name=NXT_HAVE_MAP_ANONYMOUS 32 nxt_feature_run=yes 33 nxt_feature_incs= 34 nxt_feature_libs= 35 nxt_feature_test="#include <stdlib.h> 36 #include <sys/mman.h> 37 38 int main() { 39 if (mmap(NULL, 4096, PROT_READ | PROT_WRITE, 40 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0) 41 == MAP_FAILED) 42 return 1; 43 return 0; 44 }" 45 . auto/feature 46fi 47 48 49# Linux. 50 51nxt_feature="MAP_POPULATE" 52nxt_feature_name=NXT_HAVE_MAP_POPULATE 53nxt_feature_run=no 54nxt_feature_incs= 55nxt_feature_libs= 56nxt_feature_test="#include <stdlib.h> 57 #include <sys/mman.h> 58 59 int main() { 60 if (mmap(NULL, 4096, PROT_READ | PROT_WRITE, 61 MAP_SHARED | MAP_POPULATE, -1, 0) 62 == MAP_FAILED) 63 return 1; 64 return 0; 65 }" 66. auto/feature 67 68 69# FreeBSD. 70 71nxt_feature="MAP_PREFAULT_READ" 72nxt_feature_name=NXT_HAVE_MAP_PREFAULT_READ 73nxt_feature_run=yes 74nxt_feature_incs= 75nxt_feature_libs= 76nxt_feature_test="#include <stdlib.h> 77 #include <sys/mman.h> 78 79 int main() { 80 if (mmap(NULL, 4096, PROT_READ | PROT_WRITE, 81 MAP_PRIVATE | MAP_ANON | MAP_PREFAULT_READ, 82 -1, 0) 83 == MAP_FAILED) 84 return 1; 85 return 0; 86 }" 87. auto/feature 88