1 2# Copyright (C) Igor Sysoev 3# Copyright (C) NGINX, Inc. 4 5 6# Linux 2.6.32 CLOCK_REALTIME_COARSE. 7# Linux clock_gettime() is in librt. 8 9NXT_LIBRT= 10 11nxt_feature="Linux clock_gettime(CLOCK_REALTIME_COARSE)" 12nxt_feature_name=NXT_HAVE_CLOCK_REALTIME_COARSE 13nxt_feature_run=yes 14nxt_feature_incs= 15nxt_feature_libs="-lrt" 16nxt_feature_test="#include <time.h> 17 18 int main() { 19 struct timespec ts; 20 21 if (clock_gettime(CLOCK_REALTIME_COARSE, &ts) == -1) 22 return 1; 23 return 0; 24 }" 25. auto/feature 26 27if [ $nxt_found = yes ]; then 28 NXT_LIBRT=$nxt_feature_libs 29fi 30 31 32# FreeBSD 7.0 CLOCK_REALTIME_FAST 33 34nxt_feature="FreeBSD clock_gettime(CLOCK_REALTIME_FAST)" 35nxt_feature_name=NXT_HAVE_CLOCK_REALTIME_FAST 36nxt_feature_run=yes 37nxt_feature_incs= 38nxt_feature_libs= 39nxt_feature_test="#include <time.h> 40 41 int main() { 42 struct timespec ts; 43 44 if (clock_gettime(CLOCK_REALTIME_FAST, &ts) == -1) 45 return 1; 46 return 0; 47 }" 48. auto/feature 49 50 51nxt_feature="clock_gettime(CLOCK_REALTIME)" 52nxt_feature_name=NXT_HAVE_CLOCK_REALTIME 53nxt_feature_run=yes 54nxt_feature_incs= 55nxt_feature_libs= 56nxt_feature_test="#include <time.h> 57 58 int main() { 59 struct timespec ts; 60 61 if (clock_gettime(CLOCK_REALTIME, &ts) == -1) 62 return 1; 63 return 0; 64 }" 65. auto/feature 66 67 68if [ $nxt_found = no ]; then 69 70 # Linux and Solaris 10 clock_gettime() are in librt. 71 72 nxt_feature="clock_gettime(CLOCK_REALTIME) in librt" 73 nxt_feature_libs="-lrt" 74 . auto/feature 75 76 if [ $nxt_found = yes ]; then 77 NXT_LIBRT=$nxt_feature_libs 78 fi 79fi 80 81 82# Linux 2.6.32 CLOCK_MONOTONIC_COARSE. 83# Linux clock_gettime() is in librt. 84 85nxt_feature="Linux clock_gettime(CLOCK_MONOTONIC_COARSE)" 86nxt_feature_name=NXT_HAVE_CLOCK_MONOTONIC_COARSE 87nxt_feature_run=yes 88nxt_feature_incs= 89nxt_feature_libs="-lrt" 90nxt_feature_test="#include <time.h> 91 92 int main() { 93 struct timespec ts; 94 95 if (clock_gettime(CLOCK_MONOTONIC_COARSE, &ts) == -1) 96 return 1; 97 return 0; 98 }" 99. auto/feature 100 101if [ $nxt_found = yes ]; then 102 NXT_LIBRT=$nxt_feature_libs 103fi 104 105 106# FreeBSD 7.0 CLOCK_MONOTONIC_FAST 107 108nxt_feature="FreeBSD clock_gettime(CLOCK_MONOTONIC_FAST)" 109nxt_feature_name=NXT_HAVE_CLOCK_MONOTONIC_FAST 110nxt_feature_run=yes 111nxt_feature_incs= 112nxt_feature_libs= 113nxt_feature_test="#include <time.h> 114 115 int main() { 116 struct timespec ts; 117 118 if (clock_gettime(CLOCK_MONOTONIC_FAST, &ts) == -1) 119 return 1; 120 return 0; 121 }" 122. auto/feature 123 124 125nxt_feature="clock_gettime(CLOCK_MONOTONIC)" 126nxt_feature_name=NXT_HAVE_CLOCK_MONOTONIC 127nxt_feature_run=yes 128nxt_feature_incs= 129nxt_feature_libs= 130nxt_feature_test="#include <time.h> 131 132 int main() { 133 struct timespec ts; 134 135 if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1) 136 return 1; 137 return 0; 138 }" 139. auto/feature 140 141 142if [ $nxt_found = no ]; then 143 144 # Linux and Solaris 10 clock_gettime() are in librt. 145 146 nxt_feature="clock_gettime(CLOCK_MONOTONIC) in librt" 147 nxt_feature_libs="-lrt" 148 . auto/feature 149 150 if [ $nxt_found = yes ]; then 151 NXT_LIBRT=$nxt_feature_libs 152 fi 153fi 154 155 156# HP-UX Mercury Library hg_gethrtime(). 157 158NXT_LIBHG= 159 160nxt_feature="HP-UX hg_gethrtime()" 161nxt_feature_name=NXT_HAVE_HG_GETHRTIME 162nxt_feature_run=yes 163nxt_feature_incs= 164nxt_feature_libs="-lhg" 165nxt_feature_test="#include <stdlib.h> 166 #include <sys/mercury.h> 167 168 int main() { 169 hg_gethrtime(); 170 return 0; 171 }" 172. auto/feature 173 174if [ $nxt_found = yes ]; then 175 NXT_LIBHG=$nxt_feature_libs 176fi 177 178 179nxt_feature="struct tm.tm_gmtoff" 180nxt_feature_name=NXT_HAVE_TM_GMTOFF 181nxt_feature_run= 182nxt_feature_incs= 183nxt_feature_libs= 184nxt_feature_test="#include <time.h> 185 186 int main() { 187 time_t t; 188 struct tm tm; 189 190 t = 0; 191 localtime_r(&t, &tm); 192 return tm.tm_gmtoff; 193 }" 194. auto/feature 195 196 197nxt_feature="altzone" 198nxt_feature_name=NXT_HAVE_ALTZONE 199nxt_feature_run= 200nxt_feature_incs= 201nxt_feature_libs= 202nxt_feature_test="#include <time.h> 203 204 int main() { 205 altzone = 0; 206 return 0; 207 }" 208. auto/feature 209 210 211nxt_feature="localtime_r()" 212nxt_feature_name=NXT_HAVE_LOCALTIME_R 213nxt_feature_run= 214nxt_feature_incs= 215nxt_feature_libs= 216nxt_feature_test="#include <time.h> 217 218 int main() { 219 time_t t; 220 struct tm tm; 221 222 t = 0; 223 localtime_r(&t, &tm); 224 return 0; 225 }" 226. auto/feature 227