1 2# Copyright (C) Igor Sysoev 3# Copyright (C) NGINX, Inc. 4 5 6nxt_feature="arc4random()" 7nxt_feature_name=NXT_HAVE_ARC4RANDOM 8nxt_feature_run= 9nxt_feature_incs= 10nxt_feature_libs= 11nxt_feature_test="#include <stdlib.h> 12 13 int main() { 14 15 (void) arc4random(); 16 17 return 0; 18 }" 19. auto/feature 20 21 22# Linux 3.17 getrandom(). 23 24nxt_feature="getrandom()" 25nxt_feature_name=NXT_HAVE_GETRANDOM 26nxt_feature_run= 27nxt_feature_incs= 28nxt_feature_libs= 29nxt_feature_test="#include <linux/random.h> 30 31 int main() { 32 char buf[4]; 33 34 (void) getrandom(buf, 4, 0); 35 36 return 0; 37 }" 38. auto/feature 39 40 41nxt_feature="ucontext" 42nxt_feature_name=NXT_HAVE_UCONTEXT 43nxt_feature_run= 44nxt_feature_incs= 45nxt_feature_libs= 46nxt_feature_test="#include <stdlib.h> 47 #include <ucontext.h> 48 49 int main() { 50 ucontext_t uc; 51 52 if (getcontext(&uc) == 0) { 53 makecontext(&uc, NULL, 0); 54 setcontext(&uc); 55 } 56 57 return 0; 58 }" 59. auto/feature 60 61 62if [ $nxt_found = no ]; then 63 64 # MacOSX 10.6 (Snow Leopard) has deprecated ucontext 65 # and requires _XOPEN_SOURCE to be defined. 66 67 nxt_feature="_XOPEN_SOURCE ucontext" 68 nxt_feature_name=NXT_HAVE_UCONTEXT 69 nxt_feature_run= 70 nxt_feature_incs= 71 nxt_feature_libs= 72 nxt_feature_test="#define _XOPEN_SOURCE 73 #include <stdlib.h> 74 #include <ucontext.h> 75 76 int main() { 77 ucontext_t uc; 78 79 if (getcontext(&uc) == 0) { 80 makecontext(&uc, NULL, 0); 81 setcontext(&uc); 82 } 83 84 return 0; 85 }" 86 . auto/feature 87fi 88 89 90# FreeBSD dlopen() is in libc. 91# MacOSX libdl.dylib is a symlink to libSystem.dylib. 92 93NXT_LIBDL= 94 95nxt_feature="dlopen()" 96nxt_feature_name=NXT_HAVE_DLOPEN 97nxt_feature_run= 98nxt_feature_incs= 99nxt_feature_libs= 100nxt_feature_test="#include <stdlib.h> 101 #include <dlfcn.h> 102 103 int main() { 104 dlopen(NULL, 0); 105 return 0; 106 }" 107. auto/feature 108 109if [ $nxt_found = no ]; then 110 111 # Linux and Solaris prior to 10 require libdl. 112 # Solaris 10 libdl.so.1 is a filter to /usr/lib/ld.so.1. 113 114 nxt_feature="dlopen() in libdl" 115 nxt_feature_libs="-ldl" 116 . auto/feature 117 118 if [ $nxt_found = yes ]; then 119 NXT_LIBDL="-ldl" 120 fi 121fi 122 123 124nxt_feature="posix_spawn()" 125nxt_feature_name=NXT_HAVE_POSIX_SPAWN 126nxt_feature_run= 127nxt_feature_incs= 128nxt_feature_libs= 129nxt_feature_test="#include <spawn.h> 130 #include <unistd.h> 131 132 int main() { 133 (void) posix_spawn(NULL, NULL, NULL, NULL, NULL, NULL); 134 return 0; 135 }" 136. auto/feature 137 138 139# NetBSD 1.0, OpenBSD 1.0, FreeBSD 2.2 setproctitle(). 140 141nxt_feature="setproctitle()" 142nxt_feature_name=NXT_HAVE_SETPROCTITLE 143nxt_feature_run= 144nxt_feature_incs= 145nxt_feature_libs= 146nxt_feature_test="#include <stdlib.h> 147 #include <unistd.h> 148 149 int main() { 150 setproctitle(\"%s\", \"title\"); 151 return 0; 152 }" 153. auto/feature 154