1 2# Copyright (C) Igor Sysoev 3# Copyright (C) NGINX, Inc. 4 5 6# Linux glibc 2.1.91, FreeBSD 7.0, Solaris 11, 7# MacOSX 10.6 (Snow Leopard), NetBSD 5.0. 8 9nxt_feature="posix_memalign()" 10nxt_feature_name=NXT_HAVE_POSIX_MEMALIGN 11nxt_feature_run=yes 12nxt_feature_incs= 13nxt_feature_libs= 14nxt_feature_test="#include <stdlib.h> 15 16 int main(void) { 17 void *p; 18 19 if (posix_memalign(&p, 4096, 4096) != 0) 20 return 1; 21 22 free(p); 23 return 0; 24 }" 25. auto/feature 26 27 28if [ $nxt_found = no ]; then 29 30 # Solaris, HP-UX. 31 32 nxt_feature="memalign()" 33 nxt_feature_name=NXT_HAVE_MEMALIGN 34 nxt_feature_run=yes 35 nxt_feature_incs= 36 nxt_feature_libs= 37 nxt_feature_test="#include <stdlib.h> 38 39 int main(void) { 40 void *p; 41 42 p = memalign(4096, 4096); 43 if (p == NULL) 44 return 1; 45 46 free(p); 47 return 0; 48 }" 49 . auto/feature 50fi 51 52 53# Linux malloc_usable_size(). 54 55nxt_feature="Linux malloc_usable_size()" 56nxt_feature_name=NXT_HAVE_MALLOC_USABLE_SIZE 57nxt_feature_run=yes 58nxt_feature_incs= 59nxt_feature_libs= 60nxt_feature_test="#include <malloc.h> 61 62 int main(void) { 63 void *p; 64 65 p = malloc(4096); 66 if (malloc_usable_size(p) < 4096) 67 return 1; 68 return 0; 69 }" 70. auto/feature 71 72 73if [ $nxt_found = no ]; then 74 75 # FreeBSD malloc_usable_size(). 76 77 nxt_feature="FreeBSD malloc_usable_size()" 78 nxt_feature_name=NXT_HAVE_MALLOC_USABLE_SIZE 79 nxt_feature_run=yes 80 nxt_feature_incs= 81 nxt_feature_libs= 82 nxt_feature_test="#include <stdlib.h> 83 #include <malloc_np.h> 84 85 int main(void) { 86 void *p; 87 88 p = malloc(4096); 89 if (malloc_usable_size(p) < 4096) 90 return 1; 91 return 0; 92 }" 93 . auto/feature 94fi 95 96 97if [ $nxt_found = no ]; then 98 99 # MacOSX malloc_good_size(). 100 101 nxt_feature="MacOSX malloc_good_size()" 102 nxt_feature_name=NXT_HAVE_MALLOC_GOOD_SIZE 103 nxt_feature_run=yes 104 nxt_feature_incs= 105 nxt_feature_libs= 106 nxt_feature_test="#include <malloc/malloc.h> 107 108 int main(void) { 109 if (malloc_good_size(4096) < 4096) 110 return 1; 111 return 0; 112 }" 113 . auto/feature 114fi 115 116 117# alloca(). 118 119# Linux, FreeBSD, MacOSX. 120 121nxt_feature="alloca()" 122nxt_feature_name=NXT_HAVE_ALLOCA 123nxt_feature_run=yes 124nxt_feature_incs= 125nxt_feature_libs= 126nxt_feature_test="#include <stdlib.h> 127 128 int main(void) { 129 void *p; 130 131 p = alloca(256); 132 if (p == 0) 133 return 1; 134 return 0; 135 }" 136. auto/feature 137 138 139if [ $nxt_found = no ]; then 140 141 # Linux, Solaris, MacOSX. 142 143 nxt_feature="alloca() in alloca.h" 144 nxt_feature_name=NXT_HAVE_ALLOCA_H 145 nxt_feature_run=yes 146 nxt_feature_incs= 147 nxt_feature_libs= 148 nxt_feature_test="#include <alloca.h> 149 150 int main(void) { 151 void *p; 152 153 p = alloca(256); 154 if (p == 0) 155 return 1; 156 return 0; 157 }" 158 . auto/feature 159fi 160 161 162# Linux mallopt(). 163 164nxt_feature="Linux mallopt()" 165nxt_feature_name=NXT_HAVE_MALLOPT 166nxt_feature_run= 167nxt_feature_incs= 168nxt_feature_libs= 169nxt_feature_test="#include <malloc.h> 170 171 int main(void) { 172 mallopt(M_PERTURB, 0x55); 173 return 0; 174 }" 175. auto/feature 176