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# GCC5 AddressSanitizer intercepts dlopen() and dlclose() but not dlsym() 77# so all dynamic linker functions should be tested. 78 79NXT_LIBDL= 80 81nxt_feature="dlopen()" 82nxt_feature_name=NXT_HAVE_DLOPEN 83nxt_feature_run= 84nxt_feature_incs= 85nxt_feature_libs= 86nxt_feature_test="#include <stdlib.h> 87 #include <dlfcn.h> 88 89 int main() { 90 void *h = dlopen(NULL, RTLD_NOW | RTLD_GLOBAL); 91 dlsym(h, \"\"); 92 dlclose(h); 93 return 0; 94 }" 95. auto/feature 96 97if [ $nxt_found = no ]; then 98 99 # Linux and Solaris prior to 10 require libdl. 100 # Solaris 10 libdl.so.1 is a filter to /usr/lib/ld.so.1. 101 102 nxt_feature="dlopen() in libdl" 103 nxt_feature_libs="-ldl" 104 . auto/feature 105 106 if [ $nxt_found = yes ]; then 107 NXT_LIBDL="-ldl" 108 fi 109fi 110 111 112nxt_feature="posix_spawn()" 113nxt_feature_name=NXT_HAVE_POSIX_SPAWN 114nxt_feature_run= 115nxt_feature_incs= 116nxt_feature_libs= 117nxt_feature_test="#include <spawn.h> 118 #include <unistd.h> 119 120 int main() { 121 (void) posix_spawn(NULL, NULL, NULL, NULL, NULL, NULL); 122 return 0; 123 }" 124. auto/feature 125 126 127# NetBSD 1.0, OpenBSD 1.0, FreeBSD 2.2 setproctitle(). 128 129nxt_feature="setproctitle()" 130nxt_feature_name=NXT_HAVE_SETPROCTITLE 131nxt_feature_run= 132nxt_feature_incs= 133nxt_feature_libs= 134nxt_feature_test="#include <stdlib.h> 135 #include <unistd.h> 136 137 int main() { 138 setproctitle(\"%s\", \"title\"); 139 return 0; 140 }" 141. auto/feature 142