diff options
Diffstat (limited to '')
-rw-r--r-- | auto/os/conf | 20 | ||||
-rw-r--r-- | auto/os/test | 2 | ||||
-rw-r--r-- | auto/shmem | 49 |
3 files changed, 69 insertions, 2 deletions
diff --git a/auto/os/conf b/auto/os/conf index 71c15b77..67db5df1 100644 --- a/auto/os/conf +++ b/auto/os/conf @@ -167,6 +167,26 @@ case "$NXT_SYSTEM" in NXT_LIBS="$NXT_PTHREAD" ;; + DragonFly) + nxt_have=NXT_DRAGONFLY . auto/have + + NXT_STATIC_LINK="ar -r -c" + NXT_SHARED_LINK="\$(CC) -shared" + NXT_SHARED_LOCAL_LINK="\$(CC) -shared" + NXT_MODULE_LINK="\$(CC) -shared" + + # "-Wl,-E" exports symbols of executable file. + NXT_EXEC_LINK="\$(CC) -Wl,-E" + NXT_SHARED_LOCAL_EXEC_LINK= + + NXT_LIB_STATIC="libnxt.a" + NXT_LIB_SHARED="libnxt.so" + NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so" + + NXT_LIBM="-lm" + NXT_LIBS="$NXT_LIBRT $NXT_PTHREAD" + ;; + AIX) nxt_have=NXT_AIX . auto/have diff --git a/auto/os/test b/auto/os/test index 0332fcfa..41c11b19 100644 --- a/auto/os/test +++ b/auto/os/test @@ -16,7 +16,7 @@ case "$NXT_SYSTEM" in CC=${CC:-cc} ;; - FreeBSD | NetBSD | OpenBSD) + FreeBSD | NetBSD | OpenBSD | DragonFly) NXT_SYSTEM_VERSION=`uname -r 2>/dev/null` NXT_SYSTEM_PLATFORM=`uname -m 2>/dev/null` echo=echo @@ -3,6 +3,8 @@ # Copyright (C) NGINX, Inc. +NXT_SHM_PREFIX="/" + # FreeBSD, Solaris, MacOSX nxt_feature="shm_open()" @@ -12,10 +14,12 @@ nxt_feature_incs= nxt_feature_libs= nxt_feature_test="#include <sys/mman.h> #include <fcntl.h> + #include <unistd.h> #include <sys/stat.h> #include <sys/types.h> int main() { + int ret; static char name[] = \"/unit.configure\"; shm_unlink(name); @@ -25,8 +29,10 @@ nxt_feature_test="#include <sys/mman.h> if (fd == -1) return 1; + ret = (access(name, F_OK) == 0); shm_unlink(name); - return 0; + + return ret; }" . auto/feature @@ -45,6 +51,40 @@ if [ $nxt_found = no ]; then fi +if [ $nxt_found = no ]; then + + # DragonFly has no separate namespace for shm_open(). + + nxt_feature="shm_open() in /tmp directory" + nxt_feature_libs= + nxt_feature_test="#include <sys/mman.h> + #include <fcntl.h> + #include <sys/stat.h> + #include <sys/types.h> + + int main() { + static char name[] = \"/tmp/unit.configure\"; + + shm_unlink(name); + + int fd = shm_open(name, O_CREAT | O_EXCL | O_RDWR, + S_IRUSR | S_IWUSR); + if (fd == -1) + return 1; + + shm_unlink(name); + return 0; + }" + . auto/feature + + if [ $nxt_found = yes ]; then + NXT_SHM_PREFIX="/tmp/" + fi +fi + +nxt_shm_open_found=$nxt_found + + # Linux nxt_feature="memfd_create()" @@ -67,3 +107,10 @@ nxt_feature_test="#include <linux/memfd.h> }" . auto/feature + +if [ "$nxt_shm_open_found$nxt_found" = nono ]; then + $echo + $echo $0: error: no shared memory implementation found. + $echo + exit 1; +fi |