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